aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/auxvec.h24
-rw-r--r--include/asm-alpha/elf.h22
-rw-r--r--include/asm-alpha/fcntl.h35
-rw-r--r--include/asm-alpha/futex.h53
-rw-r--r--include/asm-alpha/hdreg.h1
-rw-r--r--include/asm-alpha/page.h16
-rw-r--r--include/asm-alpha/socket.h2
-rw-r--r--include/asm-alpha/system.h29
-rw-r--r--include/asm-alpha/types.h2
-rw-r--r--include/asm-alpha/uaccess.h6
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h102
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h19
-rw-r--r--include/asm-arm/arch-ixp4xx/timex.h6
-rw-r--r--include/asm-arm/arch-omap/board-h4.h3
-rw-r--r--include/asm-arm/arch-omap/board-innovator.h25
-rw-r--r--include/asm-arm/arch-omap/board-perseus2.h17
-rw-r--r--include/asm-arm/arch-omap/board-voiceblue.h5
-rw-r--r--include/asm-arm/arch-omap/board.h19
-rw-r--r--include/asm-arm/arch-omap/cpu.h187
-rw-r--r--include/asm-arm/arch-omap/debug-macro.S13
-rw-r--r--include/asm-arm/arch-omap/dma.h1
-rw-r--r--include/asm-arm/arch-omap/dmtimer.h92
-rw-r--r--include/asm-arm/arch-omap/dsp.h244
-rw-r--r--include/asm-arm/arch-omap/dsp_common.h37
-rw-r--r--include/asm-arm/arch-omap/entry-macro.S28
-rw-r--r--include/asm-arm/arch-omap/gpio.h28
-rw-r--r--include/asm-arm/arch-omap/hardware.h39
-rw-r--r--include/asm-arm/arch-omap/io.h26
-rw-r--r--include/asm-arm/arch-omap/irqs.h6
-rw-r--r--include/asm-arm/arch-omap/memory.h14
-rw-r--r--include/asm-arm/arch-omap/mtd-xip.h61
-rw-r--r--include/asm-arm/arch-omap/mux.h10
-rw-r--r--include/asm-arm/arch-omap/omap1510.h13
-rw-r--r--include/asm-arm/arch-omap/omap16xx.h16
-rw-r--r--include/asm-arm/arch-omap/omap24xx.h15
-rw-r--r--include/asm-arm/arch-omap/omap730.h4
-rw-r--r--include/asm-arm/arch-omap/pm.h55
-rw-r--r--include/asm-arm/arch-omap/serial.h37
-rw-r--r--include/asm-arm/arch-omap/uncompress.h10
-rw-r--r--include/asm-arm/arch-pxa/corgi.h8
-rw-r--r--include/asm-arm/arch-pxa/mmc.h1
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h29
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-cpld.h24
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-irq.h23
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-map.h46
-rw-r--r--include/asm-arm/arch-s3c2410/regs-clock.h11
-rw-r--r--include/asm-arm/arch-s3c2410/usb-control.h3
-rw-r--r--include/asm-arm/arch-sa1100/mcp.h21
-rw-r--r--include/asm-arm/auxvec.h4
-rw-r--r--include/asm-arm/bug.h2
-rw-r--r--include/asm-arm/cpu-multi32.h2
-rw-r--r--include/asm-arm/cpu-single.h2
-rw-r--r--include/asm-arm/fcntl.h78
-rw-r--r--include/asm-arm/futex.h53
-rw-r--r--include/asm-arm/hardware/gic.h41
-rw-r--r--include/asm-arm/hardware/scoop.h13
-rw-r--r--include/asm-arm/hdreg.h1
-rw-r--r--include/asm-arm/mach/irq.h12
-rw-r--r--include/asm-arm/mach/time.h2
-rw-r--r--include/asm-arm/page.h16
-rw-r--r--include/asm-arm/pgtable.h14
-rw-r--r--include/asm-arm/socket.h2
-rw-r--r--include/asm-arm/types.h2
-rw-r--r--include/asm-arm/uaccess.h6
-rw-r--r--include/asm-arm/unistd.h8
-rw-r--r--include/asm-arm26/auxvec.h4
-rw-r--r--include/asm-arm26/fcntl.h76
-rw-r--r--include/asm-arm26/futex.h53
-rw-r--r--include/asm-arm26/hdreg.h1
-rw-r--r--include/asm-arm26/page.h16
-rw-r--r--include/asm-arm26/socket.h2
-rw-r--r--include/asm-arm26/types.h2
-rw-r--r--include/asm-arm26/uaccess.h6
-rw-r--r--include/asm-cris/auxvec.h4
-rw-r--r--include/asm-cris/fcntl.h91
-rw-r--r--include/asm-cris/futex.h53
-rw-r--r--include/asm-cris/irq.h5
-rw-r--r--include/asm-cris/page.h15
-rw-r--r--include/asm-cris/socket.h2
-rw-r--r--include/asm-cris/types.h2
-rw-r--r--include/asm-cris/uaccess.h7
-rw-r--r--include/asm-frv/auxvec.h4
-rw-r--r--include/asm-frv/fcntl.h89
-rw-r--r--include/asm-frv/futex.h53
-rw-r--r--include/asm-frv/page.h17
-rw-r--r--include/asm-frv/socket.h2
-rw-r--r--include/asm-frv/types.h2
-rw-r--r--include/asm-frv/uaccess.h6
-rw-r--r--include/asm-generic/fcntl.h149
-rw-r--r--include/asm-generic/hdreg.h8
-rw-r--r--include/asm-generic/page.h26
-rw-r--r--include/asm-generic/pgtable.h16
-rw-r--r--include/asm-generic/sections.h1
-rw-r--r--include/asm-generic/unaligned.h12
-rw-r--r--include/asm-generic/vmlinux.lds.h15
-rw-r--r--include/asm-h8300/auxvec.h4
-rw-r--r--include/asm-h8300/fcntl.h78
-rw-r--r--include/asm-h8300/futex.h53
-rw-r--r--include/asm-h8300/hdreg.h15
-rw-r--r--include/asm-h8300/page.h16
-rw-r--r--include/asm-h8300/socket.h2
-rw-r--r--include/asm-h8300/types.h2
-rw-r--r--include/asm-h8300/uaccess.h6
-rw-r--r--include/asm-i386/agp.h2
-rw-r--r--include/asm-i386/apicdef.h1
-rw-r--r--include/asm-i386/auxvec.h11
-rw-r--r--include/asm-i386/bugs.h5
-rw-r--r--include/asm-i386/checksum.h2
-rw-r--r--include/asm-i386/desc.h33
-rw-r--r--include/asm-i386/elf.h8
-rw-r--r--include/asm-i386/fcntl.h89
-rw-r--r--include/asm-i386/futex.h108
-rw-r--r--include/asm-i386/hdreg.h1
-rw-r--r--include/asm-i386/kdebug.h11
-rw-r--r--include/asm-i386/mach-es7000/mach_mpparse.h30
-rw-r--r--include/asm-i386/mach-generic/mach_apic.h2
-rw-r--r--include/asm-i386/mpspec.h1
-rw-r--r--include/asm-i386/msr.h15
-rw-r--r--include/asm-i386/page.h17
-rw-r--r--include/asm-i386/pci.h4
-rw-r--r--include/asm-i386/pgtable-3level.h2
-rw-r--r--include/asm-i386/pgtable.h42
-rw-r--r--include/asm-i386/processor.h46
-rw-r--r--include/asm-i386/ptrace.h7
-rw-r--r--include/asm-i386/setup.h2
-rw-r--r--include/asm-i386/smp.h2
-rw-r--r--include/asm-i386/socket.h2
-rw-r--r--include/asm-i386/system.h36
-rw-r--r--include/asm-i386/thread_info.h5
-rw-r--r--include/asm-i386/timer.h3
-rw-r--r--include/asm-i386/types.h2
-rw-r--r--include/asm-i386/uaccess.h24
-rw-r--r--include/asm-i386/xor.h26
-rw-r--r--include/asm-ia64/acpi.h5
-rw-r--r--include/asm-ia64/auxvec.h11
-rw-r--r--include/asm-ia64/compat.h20
-rw-r--r--include/asm-ia64/elf.h8
-rw-r--r--include/asm-ia64/fcntl.h79
-rw-r--r--include/asm-ia64/futex.h53
-rw-r--r--include/asm-ia64/hdreg.h14
-rw-r--r--include/asm-ia64/hw_irq.h7
-rw-r--r--include/asm-ia64/io.h12
-rw-r--r--include/asm-ia64/iosapic.h4
-rw-r--r--include/asm-ia64/irq.h11
-rw-r--r--include/asm-ia64/kprobes.h1
-rw-r--r--include/asm-ia64/mmu.h8
-rw-r--r--include/asm-ia64/mmu_context.h61
-rw-r--r--include/asm-ia64/page.h27
-rw-r--r--include/asm-ia64/pal.h21
-rw-r--r--include/asm-ia64/pgtable.h13
-rw-r--r--include/asm-ia64/processor.h3
-rw-r--r--include/asm-ia64/rwsem.h35
-rw-r--r--include/asm-ia64/sn/addrs.h112
-rw-r--r--include/asm-ia64/sn/geo.h3
-rw-r--r--include/asm-ia64/sn/intr.h3
-rw-r--r--include/asm-ia64/sn/nodepda.h3
-rw-r--r--include/asm-ia64/sn/pcibus_provider_defs.h8
-rw-r--r--include/asm-ia64/sn/pda.h1
-rw-r--r--include/asm-ia64/sn/sn2/sn_hwperf.h10
-rw-r--r--include/asm-ia64/sn/sn_sal.h60
-rw-r--r--include/asm-ia64/sn/tioce.h740
-rw-r--r--include/asm-ia64/sn/tioce_provider.h66
-rw-r--r--include/asm-ia64/socket.h2
-rw-r--r--include/asm-ia64/spinlock.h33
-rw-r--r--include/asm-ia64/system.h5
-rw-r--r--include/asm-ia64/topology.h23
-rw-r--r--include/asm-ia64/types.h2
-rw-r--r--include/asm-ia64/uaccess.h7
-rw-r--r--include/asm-m32r/auxvec.h4
-rw-r--r--include/asm-m32r/checksum.h2
-rw-r--r--include/asm-m32r/fcntl.h93
-rw-r--r--include/asm-m32r/futex.h53
-rw-r--r--include/asm-m32r/hdreg.h1
-rw-r--r--include/asm-m32r/page.h21
-rw-r--r--include/asm-m32r/smp.h2
-rw-r--r--include/asm-m32r/socket.h2
-rw-r--r--include/asm-m32r/types.h2
-rw-r--r--include/asm-m32r/uaccess.h25
-rw-r--r--include/asm-m68k/auxvec.h4
-rw-r--r--include/asm-m68k/cacheflush.h31
-rw-r--r--include/asm-m68k/fcntl.h78
-rw-r--r--include/asm-m68k/futex.h53
-rw-r--r--include/asm-m68k/hdreg.h1
-rw-r--r--include/asm-m68k/page.h22
-rw-r--r--include/asm-m68k/socket.h2
-rw-r--r--include/asm-m68k/string.h403
-rw-r--r--include/asm-m68k/types.h2
-rw-r--r--include/asm-m68k/uaccess.h6
-rw-r--r--include/asm-m68knommu/auxvec.h4
-rw-r--r--include/asm-m68knommu/futex.h53
-rw-r--r--include/asm-m68knommu/hdreg.h1
-rw-r--r--include/asm-m68knommu/page.h21
-rw-r--r--include/asm-m68knommu/uaccess.h6
-rw-r--r--include/asm-mips/a.out.h4
-rw-r--r--include/asm-mips/addrspace.h2
-rw-r--r--include/asm-mips/asmmacro.h8
-rw-r--r--include/asm-mips/atomic.h4
-rw-r--r--include/asm-mips/auxvec.h4
-rw-r--r--include/asm-mips/bitops.h12
-rw-r--r--include/asm-mips/bugs.h2
-rw-r--r--include/asm-mips/checksum.h4
-rw-r--r--include/asm-mips/compat.h10
-rw-r--r--include/asm-mips/cpu-features.h4
-rw-r--r--include/asm-mips/ddb5xxx/ddb5477.h6
-rw-r--r--include/asm-mips/dec/prom.h12
-rw-r--r--include/asm-mips/delay.h6
-rw-r--r--include/asm-mips/elf.h16
-rw-r--r--include/asm-mips/fcntl.h75
-rw-r--r--include/asm-mips/fpregdef.h4
-rw-r--r--include/asm-mips/fpu.h8
-rw-r--r--include/asm-mips/futex.h53
-rw-r--r--include/asm-mips/hdreg.h1
-rw-r--r--include/asm-mips/hp-lj/asic.h7
-rw-r--r--include/asm-mips/ip32/mace.h8
-rw-r--r--include/asm-mips/lasat/serial.h4
-rw-r--r--include/asm-mips/local.h4
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h2
-rw-r--r--include/asm-mips/mach-db1x00/db1x00.h2
-rw-r--r--include/asm-mips/mach-generic/spaces.h8
-rw-r--r--include/asm-mips/mach-ip22/spaces.h8
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-jazz/floppy.h2
-rw-r--r--include/asm-mips/mach-pb1x00/pb1500.h4
-rw-r--r--include/asm-mips/mach-qemu/cpu-feature-overrides.h31
-rw-r--r--include/asm-mips/mach-qemu/param.h13
-rw-r--r--include/asm-mips/mach-vr41xx/timex.h18
-rw-r--r--include/asm-mips/mmu_context.h6
-rw-r--r--include/asm-mips/module.h4
-rw-r--r--include/asm-mips/msgbuf.h12
-rw-r--r--include/asm-mips/paccess.h4
-rw-r--r--include/asm-mips/page.h16
-rw-r--r--include/asm-mips/pci.h21
-rw-r--r--include/asm-mips/pgalloc.h4
-rw-r--r--include/asm-mips/pgtable.h4
-rw-r--r--include/asm-mips/processor.h4
-rw-r--r--include/asm-mips/ptrace.h2
-rw-r--r--include/asm-mips/qemu.h24
-rw-r--r--include/asm-mips/r4kcache.h68
-rw-r--r--include/asm-mips/reg.h6
-rw-r--r--include/asm-mips/resource.h2
-rw-r--r--include/asm-mips/rtc.h2
-rw-r--r--include/asm-mips/sgi/gio.h2
-rw-r--r--include/asm-mips/sgi/hpc3.h4
-rw-r--r--include/asm-mips/sgi/ioc.h4
-rw-r--r--include/asm-mips/sgi/ip22.h2
-rw-r--r--include/asm-mips/sgi/mc.h6
-rw-r--r--include/asm-mips/sgiarcs.h8
-rw-r--r--include/asm-mips/sibyte/carmel.h12
-rw-r--r--include/asm-mips/sibyte/sb1250_defs.h38
-rw-r--r--include/asm-mips/sibyte/sb1250_dma.h42
-rw-r--r--include/asm-mips/sibyte/sb1250_genbus.h24
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h24
-rw-r--r--include/asm-mips/sibyte/sb1250_l2c.h22
-rw-r--r--include/asm-mips/sibyte/sb1250_ldt.h32
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h26
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h28
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h68
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h36
-rw-r--r--include/asm-mips/sibyte/sb1250_smbus.h24
-rw-r--r--include/asm-mips/sibyte/sb1250_syncser.h12
-rw-r--r--include/asm-mips/sibyte/sb1250_uart.h30
-rw-r--r--include/asm-mips/sigcontext.h4
-rw-r--r--include/asm-mips/siginfo.h4
-rw-r--r--include/asm-mips/sim.h8
-rw-r--r--include/asm-mips/socket.h4
-rw-r--r--include/asm-mips/stackframe.h22
-rw-r--r--include/asm-mips/statfs.h2
-rw-r--r--include/asm-mips/string.h8
-rw-r--r--include/asm-mips/system.h4
-rw-r--r--include/asm-mips/thread_info.h4
-rw-r--r--include/asm-mips/titan_dep.h2
-rw-r--r--include/asm-mips/tx4927/tx4927.h52
-rw-r--r--include/asm-mips/tx4927/tx4927_pci.h4
-rw-r--r--include/asm-mips/types.h4
-rw-r--r--include/asm-mips/uaccess.h31
-rw-r--r--include/asm-mips/unistd.h2
-rw-r--r--include/asm-mips/vr4181/irq.h122
-rw-r--r--include/asm-mips/vr4181/vr4181.h413
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h16
-rw-r--r--include/asm-mips/vr41xx/vrc4173.h4
-rw-r--r--include/asm-mips/war.h4
-rw-r--r--include/asm-mips/xxs1500.h2
-rw-r--r--include/asm-parisc/auxvec.h4
-rw-r--r--include/asm-parisc/compat.h10
-rw-r--r--include/asm-parisc/fcntl.h56
-rw-r--r--include/asm-parisc/futex.h53
-rw-r--r--include/asm-parisc/hdreg.h1
-rw-r--r--include/asm-parisc/irq.h5
-rw-r--r--include/asm-parisc/page.h16
-rw-r--r--include/asm-parisc/socket.h2
-rw-r--r--include/asm-parisc/types.h2
-rw-r--r--include/asm-parisc/uaccess.h4
-rw-r--r--include/asm-powerpc/8253pit.h (renamed from include/asm-ppc64/8253pit.h)2
-rw-r--r--include/asm-powerpc/agp.h (renamed from include/asm-ppc/agp.h)0
-rw-r--r--include/asm-powerpc/bugs.h (renamed from include/asm-ppc64/shmparam.h)13
-rw-r--r--include/asm-powerpc/cputime.h1
-rw-r--r--include/asm-powerpc/div64.h (renamed from include/asm-ppc/div64.h)0
-rw-r--r--include/asm-powerpc/emergency-restart.h1
-rw-r--r--include/asm-powerpc/errno.h (renamed from include/asm-ppc/errno.h)0
-rw-r--r--include/asm-powerpc/fcntl.h11
-rw-r--r--include/asm-powerpc/ioctl.h (renamed from include/asm-ppc/ioctl.h)0
-rw-r--r--include/asm-powerpc/ioctls.h (renamed from include/asm-ppc/ioctls.h)0
-rw-r--r--include/asm-powerpc/ipc.h (renamed from include/asm-ppc/ipc.h)0
-rw-r--r--include/asm-powerpc/linkage.h (renamed from include/asm-ppc/linkage.h)0
-rw-r--r--include/asm-powerpc/local.h (renamed from include/asm-ppc64/local.h)0
-rw-r--r--include/asm-powerpc/mc146818rtc.h (renamed from include/asm-ppc64/mc146818rtc.h)10
-rw-r--r--include/asm-powerpc/mman.h (renamed from include/asm-ppc64/mman.h)6
-rw-r--r--include/asm-powerpc/module.h77
-rw-r--r--include/asm-powerpc/namei.h (renamed from include/asm-ppc/namei.h)0
-rw-r--r--include/asm-powerpc/percpu.h1
-rw-r--r--include/asm-powerpc/poll.h (renamed from include/asm-ppc/poll.h)0
-rw-r--r--include/asm-powerpc/resource.h1
-rw-r--r--include/asm-powerpc/sembuf.h (renamed from include/asm-ppc64/sembuf.h)31
-rw-r--r--include/asm-powerpc/shmbuf.h (renamed from include/asm-ppc64/shmbuf.h)42
-rw-r--r--include/asm-powerpc/shmparam.h (renamed from include/asm-ppc/shmparam.h)0
-rw-r--r--include/asm-powerpc/siginfo.h (renamed from include/asm-ppc64/siginfo.h)12
-rw-r--r--include/asm-powerpc/socket.h (renamed from include/asm-ppc64/socket.h)14
-rw-r--r--include/asm-powerpc/sockios.h (renamed from include/asm-ppc64/sockios.h)6
-rw-r--r--include/asm-powerpc/string.h (renamed from include/asm-ppc/string.h)0
-rw-r--r--include/asm-powerpc/termbits.h (renamed from include/asm-ppc64/termbits.h)8
-rw-r--r--include/asm-powerpc/termios.h (renamed from include/asm-ppc64/termios.h)7
-rw-r--r--include/asm-powerpc/unaligned.h (renamed from include/asm-ppc/unaligned.h)0
-rw-r--r--include/asm-powerpc/xor.h (renamed from include/asm-ppc/xor.h)0
-rw-r--r--include/asm-ppc/8253pit.h10
-rw-r--r--include/asm-ppc/auxvec.h14
-rw-r--r--include/asm-ppc/bugs.h6
-rw-r--r--include/asm-ppc/cputime.h6
-rw-r--r--include/asm-ppc/dma-mapping.h3
-rw-r--r--include/asm-ppc/elf.h11
-rw-r--r--include/asm-ppc/emergency-restart.h6
-rw-r--r--include/asm-ppc/fcntl.h93
-rw-r--r--include/asm-ppc/futex.h53
-rw-r--r--include/asm-ppc/hdreg.h1
-rw-r--r--include/asm-ppc/ibm44x.h4
-rw-r--r--include/asm-ppc/ibm4xx.h12
-rw-r--r--include/asm-ppc/ibm_ocp.h19
-rw-r--r--include/asm-ppc/irq.h6
-rw-r--r--include/asm-ppc/kmap_types.h1
-rw-r--r--include/asm-ppc/local.h6
-rw-r--r--include/asm-ppc/mc146818rtc.h31
-rw-r--r--include/asm-ppc/mman.h44
-rw-r--r--include/asm-ppc/module.h44
-rw-r--r--include/asm-ppc/mpc8260.h18
-rw-r--r--include/asm-ppc/mpc8xx.h4
-rw-r--r--include/asm-ppc/mv64x60.h7
-rw-r--r--include/asm-ppc/mv64x60_defs.h9
-rw-r--r--include/asm-ppc/param.h4
-rw-r--r--include/asm-ppc/percpu.h6
-rw-r--r--include/asm-ppc/pmac_feature.h1
-rw-r--r--include/asm-ppc/ppc4xx_dma.h2
-rw-r--r--include/asm-ppc/ppc_sys.h5
-rw-r--r--include/asm-ppc/resource.h6
-rw-r--r--include/asm-ppc/sembuf.h19
-rw-r--r--include/asm-ppc/serial.h2
-rw-r--r--include/asm-ppc/shmbuf.h37
-rw-r--r--include/asm-ppc/siginfo.h6
-rw-r--r--include/asm-ppc/socket.h56
-rw-r--r--include/asm-ppc/sockios.h17
-rw-r--r--include/asm-ppc/system.h5
-rw-r--r--include/asm-ppc/termbits.h185
-rw-r--r--include/asm-ppc/termios.h232
-rw-r--r--include/asm-ppc/time.h2
-rw-r--r--include/asm-ppc/types.h2
-rw-r--r--include/asm-ppc/uaccess.h7
-rw-r--r--include/asm-ppc64/abs_addr.h86
-rw-r--r--include/asm-ppc64/agp.h23
-rw-r--r--include/asm-ppc64/auxvec.h19
-rw-r--r--include/asm-ppc64/bug.h7
-rw-r--r--include/asm-ppc64/bugs.h12
-rw-r--r--include/asm-ppc64/compat.h18
-rw-r--r--include/asm-ppc64/cputable.h57
-rw-r--r--include/asm-ppc64/cputime.h6
-rw-r--r--include/asm-ppc64/div64.h1
-rw-r--r--include/asm-ppc64/elf.h16
-rw-r--r--include/asm-ppc64/emergency-restart.h6
-rw-r--r--include/asm-ppc64/errno.h18
-rw-r--r--include/asm-ppc64/fcntl.h89
-rw-r--r--include/asm-ppc64/firmware.h101
-rw-r--r--include/asm-ppc64/futex.h83
-rw-r--r--include/asm-ppc64/hdreg.h1
-rw-r--r--include/asm-ppc64/iSeries/LparMap.h9
-rw-r--r--include/asm-ppc64/imalloc.h2
-rw-r--r--include/asm-ppc64/ioctl.h74
-rw-r--r--include/asm-ppc64/ioctls.h114
-rw-r--r--include/asm-ppc64/iommu.h3
-rw-r--r--include/asm-ppc64/ipc.h1
-rw-r--r--include/asm-ppc64/irq.h5
-rw-r--r--include/asm-ppc64/kprobes.h3
-rw-r--r--include/asm-ppc64/linkage.h6
-rw-r--r--include/asm-ppc64/lmb.h23
-rw-r--r--include/asm-ppc64/lppaca.h2
-rw-r--r--include/asm-ppc64/machdep.h8
-rw-r--r--include/asm-ppc64/memory.h2
-rw-r--r--include/asm-ppc64/mmu.h22
-rw-r--r--include/asm-ppc64/module.h36
-rw-r--r--include/asm-ppc64/naca.h7
-rw-r--r--include/asm-ppc64/namei.h23
-rw-r--r--include/asm-ppc64/oprofile_impl.h111
-rw-r--r--include/asm-ppc64/page.h72
-rw-r--r--include/asm-ppc64/param.h4
-rw-r--r--include/asm-ppc64/percpu.h6
-rw-r--r--include/asm-ppc64/pgalloc.h93
-rw-r--r--include/asm-ppc64/pgtable.h92
-rw-r--r--include/asm-ppc64/pmc.h2
-rw-r--r--include/asm-ppc64/poll.h32
-rw-r--r--include/asm-ppc64/processor.h19
-rw-r--r--include/asm-ppc64/prom.h14
-rw-r--r--include/asm-ppc64/resource.h6
-rw-r--r--include/asm-ppc64/string.h35
-rw-r--r--include/asm-ppc64/system.h23
-rw-r--r--include/asm-ppc64/types.h1
-rw-r--r--include/asm-ppc64/uaccess.h7
-rw-r--r--include/asm-ppc64/udbg.h27
-rw-r--r--include/asm-ppc64/unaligned.h21
-rw-r--r--include/asm-ppc64/vio.h91
-rw-r--r--include/asm-ppc64/xor.h1
-rw-r--r--include/asm-s390/auxvec.h4
-rw-r--r--include/asm-s390/compat.h20
-rw-r--r--include/asm-s390/debug.h2
-rw-r--r--include/asm-s390/fcntl.h98
-rw-r--r--include/asm-s390/futex.h53
-rw-r--r--include/asm-s390/lowcore.h8
-rw-r--r--include/asm-s390/page.h16
-rw-r--r--include/asm-s390/socket.h2
-rw-r--r--include/asm-s390/spinlock.h4
-rw-r--r--include/asm-s390/types.h2
-rw-r--r--include/asm-s390/uaccess.h28
-rw-r--r--include/asm-sh/auxvec.h4
-rw-r--r--include/asm-sh/fcntl.h89
-rw-r--r--include/asm-sh/futex.h53
-rw-r--r--include/asm-sh/hdreg.h1
-rw-r--r--include/asm-sh/page.h20
-rw-r--r--include/asm-sh/socket.h2
-rw-r--r--include/asm-sh/types.h2
-rw-r--r--include/asm-sh/uaccess.h6
-rw-r--r--include/asm-sh/unistd.h10
-rw-r--r--include/asm-sh64/auxvec.h4
-rw-r--r--include/asm-sh64/fcntl.h6
-rw-r--r--include/asm-sh64/futex.h53
-rw-r--r--include/asm-sh64/hdreg.h6
-rw-r--r--include/asm-sh64/page.h20
-rw-r--r--include/asm-sh64/types.h2
-rw-r--r--include/asm-sh64/uaccess.h6
-rw-r--r--include/asm-sh64/unistd.h7
-rw-r--r--include/asm-sparc/auxvec.h4
-rw-r--r--include/asm-sparc/fcntl.h59
-rw-r--r--include/asm-sparc/futex.h53
-rw-r--r--include/asm-sparc/hdreg.h1
-rw-r--r--include/asm-sparc/page.h16
-rw-r--r--include/asm-sparc/pgtable.h3
-rw-r--r--include/asm-sparc/processor.h1
-rw-r--r--include/asm-sparc/segment.h6
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc/system.h1
-rw-r--r--include/asm-sparc/types.h2
-rw-r--r--include/asm-sparc/uaccess.h6
-rw-r--r--include/asm-sparc64/atomic.h8
-rw-r--r--include/asm-sparc64/auxvec.h4
-rw-r--r--include/asm-sparc64/bitops.h4
-rw-r--r--include/asm-sparc64/compat.h18
-rw-r--r--include/asm-sparc64/cpudata.h4
-rw-r--r--include/asm-sparc64/fcntl.h46
-rw-r--r--include/asm-sparc64/futex.h53
-rw-r--r--include/asm-sparc64/hardirq.h16
-rw-r--r--include/asm-sparc64/hdreg.h1
-rw-r--r--include/asm-sparc64/io.h47
-rw-r--r--include/asm-sparc64/page.h16
-rw-r--r--include/asm-sparc64/pgtable.h3
-rw-r--r--include/asm-sparc64/processor.h1
-rw-r--r--include/asm-sparc64/segment.h6
-rw-r--r--include/asm-sparc64/sfafsr.h82
-rw-r--r--include/asm-sparc64/socket.h2
-rw-r--r--include/asm-sparc64/spinlock.h42
-rw-r--r--include/asm-sparc64/system.h17
-rw-r--r--include/asm-sparc64/thread_info.h5
-rw-r--r--include/asm-sparc64/types.h2
-rw-r--r--include/asm-sparc64/uaccess.h6
-rw-r--r--include/asm-um/auxvec.h4
-rw-r--r--include/asm-um/futex.h53
-rw-r--r--include/asm-um/hdreg.h6
-rw-r--r--include/asm-um/mmu_context.h10
-rw-r--r--include/asm-um/page.h20
-rw-r--r--include/asm-um/pgalloc.h12
-rw-r--r--include/asm-um/pgtable-2level.h27
-rw-r--r--include/asm-um/pgtable-3level.h45
-rw-r--r--include/asm-um/pgtable.h54
-rw-r--r--include/asm-v850/auxvec.h4
-rw-r--r--include/asm-v850/fcntl.h78
-rw-r--r--include/asm-v850/futex.h53
-rw-r--r--include/asm-v850/page.h21
-rw-r--r--include/asm-v850/socket.h2
-rw-r--r--include/asm-v850/types.h2
-rw-r--r--include/asm-v850/uaccess.h6
-rw-r--r--include/asm-x86_64/auxvec.h4
-rw-r--r--include/asm-x86_64/checksum.h2
-rw-r--r--include/asm-x86_64/compat.h20
-rw-r--r--include/asm-x86_64/e820.h2
-rw-r--r--include/asm-x86_64/fcntl.h77
-rw-r--r--include/asm-x86_64/futex.h98
-rw-r--r--include/asm-x86_64/hdreg.h1
-rw-r--r--include/asm-x86_64/page.h17
-rw-r--r--include/asm-x86_64/pci.h4
-rw-r--r--include/asm-x86_64/pgtable.h19
-rw-r--r--include/asm-x86_64/processor.h9
-rw-r--r--include/asm-x86_64/socket.h2
-rw-r--r--include/asm-x86_64/types.h2
-rw-r--r--include/asm-x86_64/uaccess.h7
-rw-r--r--include/asm-xtensa/atomic.h12
-rw-r--r--include/asm-xtensa/auxvec.h4
-rw-r--r--include/asm-xtensa/checksum.h4
-rw-r--r--include/asm-xtensa/delay.h2
-rw-r--r--include/asm-xtensa/fcntl.h48
-rw-r--r--include/asm-xtensa/hdreg.h17
-rw-r--r--include/asm-xtensa/io.h14
-rw-r--r--include/asm-xtensa/mmu_context.h18
-rw-r--r--include/asm-xtensa/page.h2
-rw-r--r--include/asm-xtensa/page.h.n135
-rw-r--r--include/asm-xtensa/pci.h4
-rw-r--r--include/asm-xtensa/pgtable.h6
-rw-r--r--include/asm-xtensa/semaphore.h10
-rw-r--r--include/asm-xtensa/socket.h2
-rw-r--r--include/asm-xtensa/string.h8
-rw-r--r--include/asm-xtensa/system.h10
-rw-r--r--include/asm-xtensa/tlbflush.h40
-rw-r--r--include/asm-xtensa/types.h2
-rw-r--r--include/asm-xtensa/uaccess.h10
-rw-r--r--include/linux/8250_pci.h39
-rw-r--r--include/linux/ata.h45
-rw-r--r--include/linux/attribute_container.h12
-rw-r--r--include/linux/auxvec.h31
-rw-r--r--include/linux/bio.h8
-rw-r--r--include/linux/blkdev.h10
-rw-r--r--include/linux/capability.h1
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cpuset.h11
-rw-r--r--include/linux/crypto.h1
-rw-r--r--include/linux/dcache.h4
-rw-r--r--include/linux/dccp.h456
-rw-r--r--include/linux/dmi.h36
-rw-r--r--include/linux/efi.h14
-rw-r--r--include/linux/elf.h24
-rw-r--r--include/linux/etherdevice.h6
-rw-r--r--include/linux/ethtool.h17
-rw-r--r--include/linux/ext2_fs.h3
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/firmware.h5
-rw-r--r--include/linux/fs.h21
-rw-r--r--include/linux/fsnotify.h6
-rw-r--r--include/linux/futex.h36
-rw-r--r--include/linux/gfp.h8
-rw-r--r--include/linux/hippidevice.h8
-rw-r--r--include/linux/hugetlb.h6
-rw-r--r--include/linux/hwmon-sysfs.h15
-rw-r--r--include/linux/hwmon-vid.h45
-rw-r--r--include/linux/hwmon.h35
-rw-r--r--include/linux/i2c-id.h192
-rw-r--r--include/linux/i2c-isa.h36
-rw-r--r--include/linux/i2c-sensor.h263
-rw-r--r--include/linux/i2c-vid.h111
-rw-r--r--include/linux/i2c.h206
-rw-r--r--include/linux/ide.h6
-rw-r--r--include/linux/if_ether.h2
-rw-r--r--include/linux/if_fc.h2
-rw-r--r--include/linux/if_fddi.h2
-rw-r--r--include/linux/if_frad.h6
-rw-r--r--include/linux/if_hippi.h6
-rw-r--r--include/linux/if_tr.h4
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_vlan.h1
-rw-r--r--include/linux/igmp.h3
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/inet_diag.h138
-rw-r--r--include/linux/inotify.h5
-rw-r--r--include/linux/input.h25
-rw-r--r--include/linux/ioctl32.h22
-rw-r--r--include/linux/ip.h2
-rw-r--r--include/linux/ipmi.h34
-rw-r--r--include/linux/ipv6.h52
-rw-r--r--include/linux/irq.h130
-rw-r--r--include/linux/isdn.h1
-rw-r--r--include/linux/jbd.h1
-rw-r--r--include/linux/klist.h16
-rw-r--r--include/linux/kprobes.h3
-rw-r--r--include/linux/libata.h51
-rw-r--r--include/linux/linkage.h7
-rw-r--r--include/linux/list.h65
-rw-r--r--include/linux/mempolicy.h3
-rw-r--r--include/linux/mii.h9
-rw-r--r--include/linux/mmc/card.h15
-rw-r--r--include/linux/mmc/host.h24
-rw-r--r--include/linux/mmc/mmc.h2
-rw-r--r--include/linux/mmc/protocol.h7
-rw-r--r--include/linux/mmzone.h25
-rw-r--r--include/linux/mod_devicetable.h17
-rw-r--r--include/linux/msg.h1
-rw-r--r--include/linux/mv643xx.h2
-rw-r--r--include/linux/net.h11
-rw-r--r--include/linux/netdevice.h35
-rw-r--r--include/linux/netfilter.h88
-rw-r--r--include/linux/netfilter/nfnetlink.h169
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h124
-rw-r--r--include/linux/netfilter/nfnetlink_log.h88
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h89
-rw-r--r--include/linux/netfilter_decnet.h17
-rw-r--r--include/linux/netfilter_ipv4.h8
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h194
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h18
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_protocol.h24
-rw-r--r--include/linux/netfilter_ipv4/ip_logging.h20
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h25
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_rule.h5
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h1
-rw-r--r--include/linux/netfilter_ipv4/ipt_NFQUEUE.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_TTL.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_connbytes.h25
-rw-r--r--include/linux/netfilter_ipv4/ipt_dccp.h23
-rw-r--r--include/linux/netfilter_ipv4/ipt_string.h18
-rw-r--r--include/linux/netfilter_ipv6.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6_logging.h20
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6t_HL.h22
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h1
-rw-r--r--include/linux/netfilter_ipv6/ip6t_REJECT.h18
-rw-r--r--include/linux/netlink.h18
-rw-r--r--include/linux/netpoll.h20
-rw-r--r--include/linux/nfs_fs.h42
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/pci.h3
-rw-r--r--include/linux/pci_ids.h17
-rw-r--r--include/linux/phy.h377
-rw-r--r--include/linux/pipe_fs_i.h3
-rw-r--r--include/linux/pm.h14
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/ptrace.h3
-rw-r--r--include/linux/raid_class.h59
-rw-r--r--include/linux/random.h2
-rw-r--r--include/linux/relayfs_fs.h255
-rw-r--r--include/linux/rtnetlink.h42
-rw-r--r--include/linux/sched.h28
-rw-r--r--include/linux/security.h6
-rw-r--r--include/linux/selinux_netlink.h13
-rw-r--r--include/linux/sem.h1
-rw-r--r--include/linux/serial.h4
-rw-r--r--include/linux/serialP.h40
-rw-r--r--include/linux/serial_8250.h16
-rw-r--r--include/linux/serial_core.h16
-rw-r--r--include/linux/skbuff.h120
-rw-r--r--include/linux/slab.h16
-rw-r--r--include/linux/socket.h9
-rw-r--r--include/linux/sonypi.h2
-rw-r--r--include/linux/sound.h2
-rw-r--r--include/linux/sunrpc/cache.h1
-rw-r--r--include/linux/sunrpc/xdr.h1
-rw-r--r--include/linux/swap.h22
-rw-r--r--include/linux/swapops.h2
-rw-r--r--include/linux/sysctl.h6
-rw-r--r--include/linux/tcp.h82
-rw-r--r--include/linux/tcp_diag.h127
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timex.h23
-rw-r--r--include/linux/topology.h23
-rw-r--r--include/linux/transport_class.h11
-rw-r--r--include/linux/types.h3
-rw-r--r--include/linux/vmalloc.h8
-rw-r--r--include/linux/wireless.h38
-rw-r--r--include/linux/xfrm.h18
-rw-r--r--include/media/id.h5
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/addrconf.h6
-rw-r--r--include/net/af_unix.h15
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/ax25.h22
-rw-r--r--include/net/bluetooth/bluetooth.h5
-rw-r--r--include/net/bluetooth/hci.h15
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--include/net/bluetooth/rfcomm.h14
-rw-r--r--include/net/datalink.h2
-rw-r--r--include/net/dn.h1
-rw-r--r--include/net/icmp.h7
-rw-r--r--include/net/ieee80211.h265
-rw-r--r--include/net/ieee80211_crypt.h86
-rw-r--r--include/net/inet6_hashtables.h130
-rw-r--r--include/net/inet_common.h6
-rw-r--r--include/net/inet_connection_sock.h276
-rw-r--r--include/net/inet_hashtables.h427
-rw-r--r--include/net/inet_timewait_sock.h219
-rw-r--r--include/net/ip.h32
-rw-r--r--include/net/ip6_route.h1
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--include/net/ip_vs.h3
-rw-r--r--include/net/ipv6.h39
-rw-r--r--include/net/irda/irlan_filter.h2
-rw-r--r--include/net/iw_handler.h123
-rw-r--r--include/net/llc.h8
-rw-r--r--include/net/neighbour.h9
-rw-r--r--include/net/p8022.h5
-rw-r--r--include/net/pkt_cls.h6
-rw-r--r--include/net/psnap.h2
-rw-r--r--include/net/raw.h9
-rw-r--r--include/net/rawv6.h5
-rw-r--r--include/net/request_sock.h14
-rw-r--r--include/net/route.h6
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sock.h134
-rw-r--r--include/net/tcp.h724
-rw-r--r--include/net/tcp_ecn.h2
-rw-r--r--include/net/tcp_states.h34
-rw-r--r--include/net/udp.h5
-rw-r--r--include/net/x25.h2
-rw-r--r--include/net/x25device.h1
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/rdma/ib_cache.h105
-rw-r--r--include/rdma/ib_cm.h568
-rw-r--r--include/rdma/ib_fmr_pool.h93
-rw-r--r--include/rdma/ib_mad.h579
-rw-r--r--include/rdma/ib_pack.h245
-rw-r--r--include/rdma/ib_sa.h373
-rw-r--r--include/rdma/ib_smi.h94
-rw-r--r--include/rdma/ib_user_cm.h328
-rw-r--r--include/rdma/ib_user_mad.h137
-rw-r--r--include/rdma/ib_user_verbs.h422
-rw-r--r--include/rdma/ib_verbs.h1461
-rw-r--r--include/scsi/scsi_cmnd.h8
-rw-r--r--include/scsi/scsi_dbg.h2
-rw-r--r--include/scsi/scsi_device.h22
-rw-r--r--include/scsi/scsi_eh.h11
-rw-r--r--include/scsi/scsi_host.h26
-rw-r--r--include/scsi/scsi_request.h16
-rw-r--r--include/scsi/scsi_transport.h8
-rw-r--r--include/scsi/scsi_transport_spi.h6
-rw-r--r--include/sound/ac97_codec.h9
-rw-r--r--include/sound/ad1816a.h1
-rw-r--r--include/sound/asound.h6
-rw-r--r--include/sound/core.h4
-rw-r--r--include/sound/cs46xx.h2
-rw-r--r--include/sound/emu10k1.h2
-rw-r--r--include/sound/gus.h8
-rw-r--r--include/sound/pcm.h3
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/ymfpci.h6
-rw-r--r--include/video/pmag-ba-fb.h41
-rw-r--r--include/video/pmagb-b-fb.h74
-rw-r--r--include/video/w100fb.h138
746 files changed, 16349 insertions, 8397 deletions
diff --git a/include/asm-alpha/auxvec.h b/include/asm-alpha/auxvec.h
new file mode 100644
index 000000000000..e96fe880e310
--- /dev/null
+++ b/include/asm-alpha/auxvec.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_ALPHA_AUXVEC_H
2#define __ASM_ALPHA_AUXVEC_H
3
4/* Reserve these numbers for any future use of a VDSO. */
5#if 0
6#define AT_SYSINFO 32
7#define AT_SYSINFO_EHDR 33
8#endif
9
10/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
11 value is -1, then the cache doesn't exist. Otherwise:
12
13 bit 0-3: Cache set-associativity; 0 means fully associative.
14 bit 4-7: Log2 of cacheline size.
15 bit 8-31: Size of the entire cache >> 8.
16 bit 32-63: Reserved.
17*/
18
19#define AT_L1I_CACHESHAPE 34
20#define AT_L1D_CACHESHAPE 35
21#define AT_L2_CACHESHAPE 36
22#define AT_L3_CACHESHAPE 37
23
24#endif /* __ASM_ALPHA_AUXVEC_H */
diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h
index e94a945a2314..6c2d78fba264 100644
--- a/include/asm-alpha/elf.h
+++ b/include/asm-alpha/elf.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_ALPHA_ELF_H 1#ifndef __ASM_ALPHA_ELF_H
2#define __ASM_ALPHA_ELF_H 2#define __ASM_ALPHA_ELF_H
3 3
4#include <asm/auxvec.h>
5
4/* Special values for the st_other field in the symbol table. */ 6/* Special values for the st_other field in the symbol table. */
5 7
6#define STO_ALPHA_NOPV 0x80 8#define STO_ALPHA_NOPV 0x80
@@ -142,26 +144,6 @@ extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
142 : amask (AMASK_CIX) ? "ev6" : "ev67"); \ 144 : amask (AMASK_CIX) ? "ev6" : "ev67"); \
143}) 145})
144 146
145/* Reserve these numbers for any future use of a VDSO. */
146#if 0
147#define AT_SYSINFO 32
148#define AT_SYSINFO_EHDR 33
149#endif
150
151/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
152 value is -1, then the cache doesn't exist. Otherwise:
153
154 bit 0-3: Cache set-associativity; 0 means fully associative.
155 bit 4-7: Log2 of cacheline size.
156 bit 8-31: Size of the entire cache >> 8.
157 bit 32-63: Reserved.
158*/
159
160#define AT_L1I_CACHESHAPE 34
161#define AT_L1D_CACHESHAPE 35
162#define AT_L2_CACHESHAPE 36
163#define AT_L3_CACHESHAPE 37
164
165#ifdef __KERNEL__ 147#ifdef __KERNEL__
166 148
167#define SET_PERSONALITY(EX, IBCS2) \ 149#define SET_PERSONALITY(EX, IBCS2) \
diff --git a/include/asm-alpha/fcntl.h b/include/asm-alpha/fcntl.h
index 6b7d6c1649ce..87f2cf459e26 100644
--- a/include/asm-alpha/fcntl.h
+++ b/include/asm-alpha/fcntl.h
@@ -3,10 +3,6 @@
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */ 5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 01000 /* not fcntl */ 6#define O_CREAT 01000 /* not fcntl */
11#define O_TRUNC 02000 /* not fcntl */ 7#define O_TRUNC 02000 /* not fcntl */
12#define O_EXCL 04000 /* not fcntl */ 8#define O_EXCL 04000 /* not fcntl */
@@ -14,20 +10,13 @@
14 10
15#define O_NONBLOCK 00004 11#define O_NONBLOCK 00004
16#define O_APPEND 00010 12#define O_APPEND 00010
17#define O_NDELAY O_NONBLOCK
18#define O_SYNC 040000 13#define O_SYNC 040000
19#define FASYNC 020000 /* fcntl, for BSD compatibility */
20#define O_DIRECTORY 0100000 /* must be a directory */ 14#define O_DIRECTORY 0100000 /* must be a directory */
21#define O_NOFOLLOW 0200000 /* don't follow links */ 15#define O_NOFOLLOW 0200000 /* don't follow links */
22#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */ 16#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
23#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */ 17#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
24#define O_NOATIME 04000000 18#define O_NOATIME 04000000
25 19
26#define F_DUPFD 0 /* dup */
27#define F_GETFD 1 /* get close_on_exec */
28#define F_SETFD 2 /* set/clear close_on_exec */
29#define F_GETFL 3 /* get file->f_flags */
30#define F_SETFL 4 /* set file->f_flags */
31#define F_GETLK 7 20#define F_GETLK 7
32#define F_SETLK 8 21#define F_SETLK 8
33#define F_SETLKW 9 22#define F_SETLKW 9
@@ -37,9 +26,6 @@
37#define F_SETSIG 10 /* for sockets. */ 26#define F_SETSIG 10 /* for sockets. */
38#define F_GETSIG 11 /* for sockets. */ 27#define F_GETSIG 11 /* for sockets. */
39 28
40/* for F_[GET|SET]FL */
41#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
42
43/* for posix fcntl() and lockf() */ 29/* for posix fcntl() and lockf() */
44#define F_RDLCK 1 30#define F_RDLCK 1
45#define F_WRLCK 2 31#define F_WRLCK 2
@@ -51,25 +37,6 @@
51 37
52#define F_INPROGRESS 64 38#define F_INPROGRESS 64
53 39
54/* operations for bsd flock(), also used by the kernel implementation */ 40#include <asm-generic/fcntl.h>
55#define LOCK_SH 1 /* shared lock */
56#define LOCK_EX 2 /* exclusive lock */
57#define LOCK_NB 4 /* or'd with one of the above to prevent
58 blocking */
59#define LOCK_UN 8 /* remove lock */
60#define LOCK_MAND 32 /* This is a mandatory flock */
61#define LOCK_READ 64 /* ... Which allows concurrent read operations */
62#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
63#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
64
65struct flock {
66 short l_type;
67 short l_whence;
68 __kernel_off_t l_start;
69 __kernel_off_t l_len;
70 __kernel_pid_t l_pid;
71};
72
73#define F_LINUX_SPECIFIC_BASE 1024
74 41
75#endif 42#endif
diff --git a/include/asm-alpha/futex.h b/include/asm-alpha/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-alpha/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-alpha/hdreg.h b/include/asm-alpha/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-alpha/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index 0577daffc720..fa0b41b164a7 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -63,20 +63,6 @@ typedef unsigned long pgprot_t;
63 63
64#endif /* STRICT_MM_TYPECHECKS */ 64#endif /* STRICT_MM_TYPECHECKS */
65 65
66/* Pure 2^n version of get_order */
67extern __inline__ int get_order(unsigned long size)
68{
69 int order;
70
71 size = (size-1) >> (PAGE_SHIFT-1);
72 order = -1;
73 do {
74 size >>= 1;
75 order++;
76 } while (size);
77 return order;
78}
79
80#ifdef USE_48_BIT_KSEG 66#ifdef USE_48_BIT_KSEG
81#define PAGE_OFFSET 0xffff800000000000UL 67#define PAGE_OFFSET 0xffff800000000000UL
82#else 68#else
@@ -112,4 +98,6 @@ extern __inline__ int get_order(unsigned long size)
112 98
113#endif /* __KERNEL__ */ 99#endif /* __KERNEL__ */
114 100
101#include <asm-generic/page.h>
102
115#endif /* _ALPHA_PAGE_H */ 103#endif /* _ALPHA_PAGE_H */
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index d00259d3dc78..b5193229132a 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -25,6 +25,8 @@
25#define SO_ERROR 0x1007 25#define SO_ERROR 0x1007
26#define SO_SNDBUF 0x1001 26#define SO_SNDBUF 0x1001
27#define SO_RCVBUF 0x1002 27#define SO_RCVBUF 0x1002
28#define SO_SNDBUFFORCE 0x100a
29#define SO_RCVBUFFORCE 0x100b
28#define SO_RCVLOWAT 0x1010 30#define SO_RCVLOWAT 0x1010
29#define SO_SNDLOWAT 0x1011 31#define SO_SNDLOWAT 0x1011
30#define SO_RCVTIMEO 0x1012 32#define SO_RCVTIMEO 0x1012
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index c08ce970ff8c..bdb4d66418f1 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -443,22 +443,19 @@ __xchg_u64(volatile long *m, unsigned long val)
443 if something tries to do an invalid xchg(). */ 443 if something tries to do an invalid xchg(). */
444extern void __xchg_called_with_bad_pointer(void); 444extern void __xchg_called_with_bad_pointer(void);
445 445
446static inline unsigned long 446#define __xchg(ptr, x, size) \
447__xchg(volatile void *ptr, unsigned long x, int size) 447({ \
448{ 448 unsigned long __xchg__res; \
449 switch (size) { 449 volatile void *__xchg__ptr = (ptr); \
450 case 1: 450 switch (size) { \
451 return __xchg_u8(ptr, x); 451 case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
452 case 2: 452 case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
453 return __xchg_u16(ptr, x); 453 case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
454 case 4: 454 case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
455 return __xchg_u32(ptr, x); 455 default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
456 case 8: 456 } \
457 return __xchg_u64(ptr, x); 457 __xchg__res; \
458 } 458})
459 __xchg_called_with_bad_pointer();
460 return x;
461}
462 459
463#define xchg(ptr,x) \ 460#define xchg(ptr,x) \
464 ({ \ 461 ({ \
diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h
index 43264d219246..f5716139ec89 100644
--- a/include/asm-alpha/types.h
+++ b/include/asm-alpha/types.h
@@ -56,8 +56,6 @@ typedef unsigned long u64;
56typedef u64 dma_addr_t; 56typedef u64 dma_addr_t;
57typedef u64 dma64_addr_t; 57typedef u64 dma64_addr_t;
58 58
59typedef unsigned short kmem_bufctl_t;
60
61#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
62#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
63#endif /* _ALPHA_TYPES_H */ 61#endif /* _ALPHA_TYPES_H */
diff --git a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h
index 4c39ee750f38..22de3b434a22 100644
--- a/include/asm-alpha/uaccess.h
+++ b/include/asm-alpha/uaccess.h
@@ -48,12 +48,6 @@
48 __access_ok(((unsigned long)(addr)),(size),get_fs()); \ 48 __access_ok(((unsigned long)(addr)),(size),get_fs()); \
49}) 49})
50 50
51/* this function will go away soon - use access_ok() instead */
52extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
53{
54 return access_ok(type,addr,size) ? 0 : -EFAULT;
55}
56
57/* 51/*
58 * These are the main single-value transfer routines. They automatically 52 * These are the main single-value transfer routines. They automatically
59 * use the right size if we just have the right pointer type. 53 * use the right size if we just have the right pointer type.
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index 7495026e2c18..e350dcb544e8 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -383,39 +383,45 @@ __ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
383 *vaddr++ = inl(io_addr); 383 *vaddr++ = inl(io_addr);
384} 384}
385 385
386#define __is_io_address(p) (((unsigned long)p >= 0x0) && \ 386#define PIO_OFFSET 0x10000UL
387 ((unsigned long)p <= 0x0000ffff)) 387#define PIO_MASK 0x0ffffUL
388
389#define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \
390 ((unsigned long)p <= (PIO_MASK + PIO_OFFSET)))
388static inline unsigned int 391static inline unsigned int
389__ixp4xx_ioread8(void __iomem *port) 392__ixp4xx_ioread8(void __iomem *addr)
390{ 393{
394 unsigned long port = (unsigned long __force)addr;
391 if (__is_io_address(port)) 395 if (__is_io_address(port))
392 return (unsigned int)__ixp4xx_inb((unsigned int)port); 396 return (unsigned int)__ixp4xx_inb(port & PIO_MASK);
393 else 397 else
394#ifndef CONFIG_IXP4XX_INDIRECT_PCI 398#ifndef CONFIG_IXP4XX_INDIRECT_PCI
395 return (unsigned int)__raw_readb((u32)port); 399 return (unsigned int)__raw_readb(port);
396#else 400#else
397 return (unsigned int)__ixp4xx_readb((u32)port); 401 return (unsigned int)__ixp4xx_readb(port);
398#endif 402#endif
399} 403}
400 404
401static inline void 405static inline void
402__ixp4xx_ioread8_rep(u32 port, u8 *vaddr, u32 count) 406__ixp4xx_ioread8_rep(void __iomem *addr, void *vaddr, u32 count)
403{ 407{
408 unsigned long port = (unsigned long __force)addr;
404 if (__is_io_address(port)) 409 if (__is_io_address(port))
405 __ixp4xx_insb(port, vaddr, count); 410 __ixp4xx_insb(port & PIO_MASK, vaddr, count);
406 else 411 else
407#ifndef CONFIG_IXP4XX_INDIRECT_PCI 412#ifndef CONFIG_IXP4XX_INDIRECT_PCI
408 __raw_readsb((void __iomem *)port, vaddr, count); 413 __raw_readsb(addr, vaddr, count);
409#else 414#else
410 __ixp4xx_readsb(port, vaddr, count); 415 __ixp4xx_readsb(port, vaddr, count);
411#endif 416#endif
412} 417}
413 418
414static inline unsigned int 419static inline unsigned int
415__ixp4xx_ioread16(void __iomem *port) 420__ixp4xx_ioread16(void __iomem *addr)
416{ 421{
422 unsigned long port = (unsigned long __force)addr;
417 if (__is_io_address(port)) 423 if (__is_io_address(port))
418 return (unsigned int)__ixp4xx_inw((unsigned int)port); 424 return (unsigned int)__ixp4xx_inw(port & PIO_MASK);
419 else 425 else
420#ifndef CONFIG_IXP4XX_INDIRECT_PCI 426#ifndef CONFIG_IXP4XX_INDIRECT_PCI
421 return le16_to_cpu(__raw_readw((u32)port)); 427 return le16_to_cpu(__raw_readw((u32)port));
@@ -425,23 +431,25 @@ __ixp4xx_ioread16(void __iomem *port)
425} 431}
426 432
427static inline void 433static inline void
428__ixp4xx_ioread16_rep(u32 port, u16 *vaddr, u32 count) 434__ixp4xx_ioread16_rep(void __iomem *addr, void *vaddr, u32 count)
429{ 435{
436 unsigned long port = (unsigned long __force)addr;
430 if (__is_io_address(port)) 437 if (__is_io_address(port))
431 __ixp4xx_insw(port, vaddr, count); 438 __ixp4xx_insw(port & PIO_MASK, vaddr, count);
432 else 439 else
433#ifndef CONFIG_IXP4XX_INDIRECT_PCI 440#ifndef CONFIG_IXP4XX_INDIRECT_PCI
434 __raw_readsw((void __iomem *)port, vaddr, count); 441 __raw_readsw(addr, vaddr, count);
435#else 442#else
436 __ixp4xx_readsw(port, vaddr, count); 443 __ixp4xx_readsw(port, vaddr, count);
437#endif 444#endif
438} 445}
439 446
440static inline unsigned int 447static inline unsigned int
441__ixp4xx_ioread32(void __iomem *port) 448__ixp4xx_ioread32(void __iomem *addr)
442{ 449{
450 unsigned long port = (unsigned long __force)addr;
443 if (__is_io_address(port)) 451 if (__is_io_address(port))
444 return (unsigned int)__ixp4xx_inl((unsigned int)port); 452 return (unsigned int)__ixp4xx_inl(port & PIO_MASK);
445 else { 453 else {
446#ifndef CONFIG_IXP4XX_INDIRECT_PCI 454#ifndef CONFIG_IXP4XX_INDIRECT_PCI
447 return le32_to_cpu(__raw_readl((u32)port)); 455 return le32_to_cpu(__raw_readl((u32)port));
@@ -452,90 +460,100 @@ __ixp4xx_ioread32(void __iomem *port)
452} 460}
453 461
454static inline void 462static inline void
455__ixp4xx_ioread32_rep(u32 port, u32 *vaddr, u32 count) 463__ixp4xx_ioread32_rep(void __iomem *addr, void *vaddr, u32 count)
456{ 464{
465 unsigned long port = (unsigned long __force)addr;
457 if (__is_io_address(port)) 466 if (__is_io_address(port))
458 __ixp4xx_insl(port, vaddr, count); 467 __ixp4xx_insl(port & PIO_MASK, vaddr, count);
459 else 468 else
460#ifndef CONFIG_IXP4XX_INDIRECT_PCI 469#ifndef CONFIG_IXP4XX_INDIRECT_PCI
461 __raw_readsl((void __iomem *)port, vaddr, count); 470 __raw_readsl(addr, vaddr, count);
462#else 471#else
463 __ixp4xx_readsl(port, vaddr, count); 472 __ixp4xx_readsl(port, vaddr, count);
464#endif 473#endif
465} 474}
466 475
467static inline void 476static inline void
468__ixp4xx_iowrite8(u8 value, void __iomem *port) 477__ixp4xx_iowrite8(u8 value, void __iomem *addr)
469{ 478{
479 unsigned long port = (unsigned long __force)addr;
470 if (__is_io_address(port)) 480 if (__is_io_address(port))
471 __ixp4xx_outb(value, (unsigned int)port); 481 __ixp4xx_outb(value, port & PIO_MASK);
472 else 482 else
473#ifndef CONFIG_IXP4XX_INDIRECT_PCI 483#ifndef CONFIG_IXP4XX_INDIRECT_PCI
474 __raw_writeb(value, (u32)port); 484 __raw_writeb(value, port);
475#else 485#else
476 __ixp4xx_writeb(value, (u32)port); 486 __ixp4xx_writeb(value, port);
477#endif 487#endif
478} 488}
479 489
480static inline void 490static inline void
481__ixp4xx_iowrite8_rep(u32 port, u8 *vaddr, u32 count) 491__ixp4xx_iowrite8_rep(void __iomem *addr, const void *vaddr, u32 count)
482{ 492{
493 unsigned long port = (unsigned long __force)addr;
483 if (__is_io_address(port)) 494 if (__is_io_address(port))
484 __ixp4xx_outsb(port, vaddr, count); 495 __ixp4xx_outsb(port & PIO_MASK, vaddr, count);
496 else
485#ifndef CONFIG_IXP4XX_INDIRECT_PCI 497#ifndef CONFIG_IXP4XX_INDIRECT_PCI
486 __raw_writesb((void __iomem *)port, vaddr, count); 498 __raw_writesb(addr, vaddr, count);
487#else 499#else
488 __ixp4xx_writesb(port, vaddr, count); 500 __ixp4xx_writesb(port, vaddr, count);
489#endif 501#endif
490} 502}
491 503
492static inline void 504static inline void
493__ixp4xx_iowrite16(u16 value, void __iomem *port) 505__ixp4xx_iowrite16(u16 value, void __iomem *addr)
494{ 506{
507 unsigned long port = (unsigned long __force)addr;
495 if (__is_io_address(port)) 508 if (__is_io_address(port))
496 __ixp4xx_outw(value, (unsigned int)port); 509 __ixp4xx_outw(value, port & PIO_MASK);
497 else 510 else
498#ifndef CONFIG_IXP4XX_INDIRECT_PCI 511#ifndef CONFIG_IXP4XX_INDIRECT_PCI
499 __raw_writew(cpu_to_le16(value), (u32)port); 512 __raw_writew(cpu_to_le16(value), addr);
500#else 513#else
501 __ixp4xx_writew(value, (u32)port); 514 __ixp4xx_writew(value, port);
502#endif 515#endif
503} 516}
504 517
505static inline void 518static inline void
506__ixp4xx_iowrite16_rep(u32 port, u16 *vaddr, u32 count) 519__ixp4xx_iowrite16_rep(void __iomem *addr, const void *vaddr, u32 count)
507{ 520{
521 unsigned long port = (unsigned long __force)addr;
508 if (__is_io_address(port)) 522 if (__is_io_address(port))
509 __ixp4xx_outsw(port, vaddr, count); 523 __ixp4xx_outsw(port & PIO_MASK, vaddr, count);
524 else
510#ifndef CONFIG_IXP4XX_INDIRECT_PCI 525#ifndef CONFIG_IXP4XX_INDIRECT_PCI
511 __raw_readsw((void __iomem *)port, vaddr, count); 526 __raw_writesw(addr, vaddr, count);
512#else 527#else
513 __ixp4xx_writesw(port, vaddr, count); 528 __ixp4xx_writesw(port, vaddr, count);
514#endif 529#endif
515} 530}
516 531
517static inline void 532static inline void
518__ixp4xx_iowrite32(u32 value, void __iomem *port) 533__ixp4xx_iowrite32(u32 value, void __iomem *addr)
519{ 534{
535 unsigned long port = (unsigned long __force)addr;
520 if (__is_io_address(port)) 536 if (__is_io_address(port))
521 __ixp4xx_outl(value, (unsigned int)port); 537 __ixp4xx_outl(value, port & PIO_MASK);
522 else 538 else
523#ifndef CONFIG_IXP4XX_INDIRECT_PCI 539#ifndef CONFIG_IXP4XX_INDIRECT_PCI
524 __raw_writel(cpu_to_le32(value), (u32)port); 540 __raw_writel(cpu_to_le32(value), port);
525#else 541#else
526 __ixp4xx_writel(value, (u32)port); 542 __ixp4xx_writel(value, port);
527#endif 543#endif
528} 544}
529 545
530static inline void 546static inline void
531__ixp4xx_iowrite32_rep(u32 port, u32 *vaddr, u32 count) 547__ixp4xx_iowrite32_rep(void __iomem *addr, const void *vaddr, u32 count)
532{ 548{
549 unsigned long port = (unsigned long __force)addr;
533 if (__is_io_address(port)) 550 if (__is_io_address(port))
534 __ixp4xx_outsl(port, vaddr, count); 551 __ixp4xx_outsl(port & PIO_MASK, vaddr, count);
552 else
535#ifndef CONFIG_IXP4XX_INDIRECT_PCI 553#ifndef CONFIG_IXP4XX_INDIRECT_PCI
536 __raw_readsl((void __iomem *)port, vaddr, count); 554 __raw_writesl(addr, vaddr, count);
537#else 555#else
538 __ixp4xx_outsl(port, vaddr, count); 556 __ixp4xx_writesl(port, vaddr, count);
539#endif 557#endif
540} 558}
541 559
@@ -555,7 +573,7 @@ __ixp4xx_iowrite32_rep(u32 port, u32 *vaddr, u32 count)
555#define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c) 573#define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c)
556#define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c) 574#define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c)
557 575
558#define ioport_map(port, nr) ((void __iomem*)port) 576#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET))
559#define ioport_unmap(addr) 577#define ioport_unmap(addr)
560 578
561#endif // __ASM_ARM_ARCH_IO_H 579#endif // __ASM_ARM_ARCH_IO_H
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 3a626c03ea26..d13ee7f78c70 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -83,17 +83,6 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
83#define IXP4XX_GPIO_OUT 0x1 83#define IXP4XX_GPIO_OUT 0x1
84#define IXP4XX_GPIO_IN 0x2 84#define IXP4XX_GPIO_IN 0x2
85 85
86#define IXP4XX_GPIO_INTSTYLE_MASK 0x7C /* Bits [6:2] define interrupt style */
87
88/*
89 * GPIO interrupt types.
90 */
91#define IXP4XX_GPIO_ACTIVE_HIGH 0x4 /* Default */
92#define IXP4XX_GPIO_ACTIVE_LOW 0x8
93#define IXP4XX_GPIO_RISING_EDGE 0x10
94#define IXP4XX_GPIO_FALLING_EDGE 0x20
95#define IXP4XX_GPIO_TRANSITIONAL 0x40
96
97/* GPIO signal types */ 86/* GPIO signal types */
98#define IXP4XX_GPIO_LOW 0 87#define IXP4XX_GPIO_LOW 0
99#define IXP4XX_GPIO_HIGH 1 88#define IXP4XX_GPIO_HIGH 1
@@ -102,7 +91,13 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
102#define IXP4XX_GPIO_CLK_0 14 91#define IXP4XX_GPIO_CLK_0 14
103#define IXP4XX_GPIO_CLK_1 15 92#define IXP4XX_GPIO_CLK_1 15
104 93
105extern void gpio_line_config(u8 line, u32 style); 94static inline void gpio_line_config(u8 line, u32 direction)
95{
96 if (direction == IXP4XX_GPIO_OUT)
97 *IXP4XX_GPIO_GPOER |= (1 << line);
98 else
99 *IXP4XX_GPIO_GPOER &= ~(1 << line);
100}
106 101
107static inline void gpio_line_get(u8 line, int *value) 102static inline void gpio_line_get(u8 line, int *value)
108{ 103{
diff --git a/include/asm-arm/arch-ixp4xx/timex.h b/include/asm-arm/arch-ixp4xx/timex.h
index 38c9d77d3727..3745e35cc030 100644
--- a/include/asm-arm/arch-ixp4xx/timex.h
+++ b/include/asm-arm/arch-ixp4xx/timex.h
@@ -7,7 +7,9 @@
7 7
8/* 8/*
9 * We use IXP425 General purpose timer for our timer needs, it runs at 9 * We use IXP425 General purpose timer for our timer needs, it runs at
10 * 66.66... MHz 10 * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
11 * timer register ignores the bottom 2 bits of the LATCH value.
11 */ 12 */
12#define CLOCK_TICK_RATE (66666666) 13#define FREQ 66666666
14#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
13 15
diff --git a/include/asm-arm/arch-omap/board-h4.h b/include/asm-arm/arch-omap/board-h4.h
index 79138dcfb4ac..d64ee9211eed 100644
--- a/include/asm-arm/arch-omap/board-h4.h
+++ b/include/asm-arm/arch-omap/board-h4.h
@@ -30,6 +30,9 @@
30#define __ASM_ARCH_OMAP_H4_H 30#define __ASM_ARCH_OMAP_H4_H
31 31
32/* Placeholder for H4 specific defines */ 32/* Placeholder for H4 specific defines */
33/* GPMC CS1 */
34#define OMAP24XX_ETHR_START 0x08000300
35#define OMAP24XX_ETHR_GPIO_IRQ 92
33 36
34#endif /* __ASM_ARCH_OMAP_H4_H */ 37#endif /* __ASM_ARCH_OMAP_H4_H */
35 38
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
index 0f1abaefe4de..79574e0ed13d 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -36,31 +36,6 @@
36#define OMAP1510P1_EMIFS_PRI_VALUE 0x00 36#define OMAP1510P1_EMIFS_PRI_VALUE 0x00
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00 37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38 38
39/*
40 * These definitions define an area of FLASH set aside
41 * for the use of MTD/JFFS2. This is the area of flash
42 * that a JFFS2 filesystem will reside which is mounted
43 * at boot with the "root=/dev/mtdblock/0 rw"
44 * command line option. The flash address used here must
45 * fall within the legal range defined by rrload for storing
46 * the filesystem component. This address will be sufficiently
47 * deep into the overall flash range to avoid the other
48 * components also stored in flash such as the bootloader,
49 * the bootloader params, and the kernel.
50 * The SW2 settings for the map below are:
51 * 1 off, 2 off, 3 on, 4 off.
52 */
53
54/* Intel flash_0, partitioned as expected by rrload */
55#define OMAP_FLASH_0_BASE 0xD8000000
56#define OMAP_FLASH_0_START 0x00000000
57#define OMAP_FLASH_0_SIZE SZ_16M
58
59/* Intel flash_1, used for cramfs or other flash file systems */
60#define OMAP_FLASH_1_BASE 0xD9000000
61#define OMAP_FLASH_1_START 0x01000000
62#define OMAP_FLASH_1_SIZE SZ_16M
63
64#define NR_FPGA_IRQS 24 39#define NR_FPGA_IRQS 24
65#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS 40#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS
66 41
diff --git a/include/asm-arm/arch-omap/board-perseus2.h b/include/asm-arm/arch-omap/board-perseus2.h
index 0c224cc74fe4..691e52a52b43 100644
--- a/include/asm-arm/arch-omap/board-perseus2.h
+++ b/include/asm-arm/arch-omap/board-perseus2.h
@@ -36,23 +36,14 @@
36#define OMAP_SDRAM_DEVICE D256M_1X16_4B 36#define OMAP_SDRAM_DEVICE D256M_1X16_4B
37#endif 37#endif
38 38
39/*
40 * These definitions define an area of FLASH set aside
41 * for the use of MTD/JFFS2. This is the area of flash
42 * that a JFFS2 filesystem will reside which is mounted
43 * at boot with the "root=/dev/mtdblock/0 rw"
44 * command line option.
45 */
46
47/* Intel flash_0, partitioned as expected by rrload */
48#define OMAP_FLASH_0_BASE 0xD8000000 /* VA */
49#define OMAP_FLASH_0_START 0x00000000 /* PA */
50#define OMAP_FLASH_0_SIZE SZ_32M
51
52#define MAXIRQNUM IH_BOARD_BASE 39#define MAXIRQNUM IH_BOARD_BASE
53#define MAXFIQNUM MAXIRQNUM 40#define MAXFIQNUM MAXIRQNUM
54#define MAXSWINUM MAXIRQNUM 41#define MAXSWINUM MAXIRQNUM
55 42
56#define NR_IRQS (MAXIRQNUM + 1) 43#define NR_IRQS (MAXIRQNUM + 1)
57 44
45/* Samsung NAND flash at CS2B or CS3(NAND Boot) */
46#define OMAP_NAND_FLASH_START1 0x0A000000 /* CS2B */
47#define OMAP_NAND_FLASH_START2 0x0C000000 /* CS3 */
48
58#endif 49#endif
diff --git a/include/asm-arm/arch-omap/board-voiceblue.h b/include/asm-arm/arch-omap/board-voiceblue.h
index 33977b8956fb..ed6d346ee123 100644
--- a/include/asm-arm/arch-omap/board-voiceblue.h
+++ b/include/asm-arm/arch-omap/board-voiceblue.h
@@ -11,11 +11,6 @@
11#ifndef __ASM_ARCH_VOICEBLUE_H 11#ifndef __ASM_ARCH_VOICEBLUE_H
12#define __ASM_ARCH_VOICEBLUE_H 12#define __ASM_ARCH_VOICEBLUE_H
13 13
14#if (EXTERNAL_MAX_NR_PORTS < 4)
15#undef EXTERNAL_MAX_NR_PORTS
16#define EXTERNAL_MAX_NR_PORTS 4
17#endif
18
19extern void voiceblue_wdt_enable(void); 14extern void voiceblue_wdt_enable(void);
20extern void voiceblue_wdt_disable(void); 15extern void voiceblue_wdt_disable(void);
21extern void voiceblue_wdt_ping(void); 16extern void voiceblue_wdt_ping(void);
diff --git a/include/asm-arm/arch-omap/board.h b/include/asm-arm/arch-omap/board.h
index 95bd625480c1..a0040cd86639 100644
--- a/include/asm-arm/arch-omap/board.h
+++ b/include/asm-arm/arch-omap/board.h
@@ -30,10 +30,23 @@ struct omap_clock_config {
30 u8 system_clock_type; 30 u8 system_clock_type;
31}; 31};
32 32
33struct omap_mmc_conf {
34 unsigned enabled:1;
35 /* nomux means "standard" muxing is wrong on this board, and that
36 * board-specific code handled it before common init logic.
37 */
38 unsigned nomux:1;
39 /* switch pin can be for card detect (default) or card cover */
40 unsigned cover:1;
41 /* 4 wire signaling is optional, and is only used for SD/SDIO */
42 unsigned wire4:1;
43 s16 power_pin;
44 s16 switch_pin;
45 s16 wp_pin;
46};
47
33struct omap_mmc_config { 48struct omap_mmc_config {
34 u8 mmc_blocks; 49 struct omap_mmc_conf mmc[2];
35 s16 mmc1_power_pin, mmc2_power_pin;
36 s16 mmc1_switch_pin, mmc2_switch_pin;
37}; 50};
38 51
39struct omap_serial_console_config { 52struct omap_serial_console_config {
diff --git a/include/asm-arm/arch-omap/cpu.h b/include/asm-arm/arch-omap/cpu.h
index e8786713ee5c..1119e2b53e72 100644
--- a/include/asm-arm/arch-omap/cpu.h
+++ b/include/asm-arm/arch-omap/cpu.h
@@ -38,146 +38,179 @@ extern unsigned int system_rev;
38/* 38/*
39 * Test if multicore OMAP support is needed 39 * Test if multicore OMAP support is needed
40 */ 40 */
41#undef MULTI_OMAP 41#undef MULTI_OMAP1
42#undef MULTI_OMAP2
42#undef OMAP_NAME 43#undef OMAP_NAME
43 44
44#ifdef CONFIG_ARCH_OMAP730 45#ifdef CONFIG_ARCH_OMAP730
45# ifdef OMAP_NAME 46# ifdef OMAP_NAME
46# undef MULTI_OMAP 47# undef MULTI_OMAP1
47# define MULTI_OMAP 48# define MULTI_OMAP1
48# else 49# else
49# define OMAP_NAME omap730 50# define OMAP_NAME omap730
50# endif 51# endif
51#endif 52#endif
52#ifdef CONFIG_ARCH_OMAP1510 53#ifdef CONFIG_ARCH_OMAP1510
53# ifdef OMAP_NAME 54# ifdef OMAP_NAME
54# undef MULTI_OMAP 55# undef MULTI_OMAP1
55# define MULTI_OMAP 56# define MULTI_OMAP1
56# else 57# else
57# define OMAP_NAME omap1510 58# define OMAP_NAME omap1510
58# endif 59# endif
59#endif 60#endif
60#ifdef CONFIG_ARCH_OMAP16XX 61#ifdef CONFIG_ARCH_OMAP16XX
61# ifdef OMAP_NAME 62# ifdef OMAP_NAME
62# undef MULTI_OMAP 63# undef MULTI_OMAP1
63# define MULTI_OMAP 64# define MULTI_OMAP1
64# else 65# else
65# define OMAP_NAME omap1610 66# define OMAP_NAME omap16xx
66# endif 67# endif
67#endif 68#endif
68#ifdef CONFIG_ARCH_OMAP16XX 69#ifdef CONFIG_ARCH_OMAP24XX
69# ifdef OMAP_NAME 70# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
70# undef MULTI_OMAP 71# error "OMAP1 and OMAP2 can't be selected at the same time"
71# define MULTI_OMAP
72# else 72# else
73# define OMAP_NAME omap1710 73# undef MULTI_OMAP2
74# define OMAP_NAME omap24xx
74# endif 75# endif
75#endif 76#endif
76 77
77/* 78/*
78 * Generate various OMAP cpu specific macros, and cpu class 79 * Macros to group OMAP into cpu classes.
79 * specific macros 80 * These can be used in most places.
81 * cpu_is_omap7xx(): True for OMAP730
82 * cpu_is_omap15xx(): True for OMAP1510 and OMAP5910
83 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
84 * cpu_is_omap24xx(): True for OMAP2420
80 */ 85 */
81#define GET_OMAP_TYPE ((system_rev >> 24) & 0xff)
82#define GET_OMAP_CLASS (system_rev & 0xff) 86#define GET_OMAP_CLASS (system_rev & 0xff)
83 87
84#define IS_OMAP_TYPE(type, id) \
85static inline int is_omap ##type (void) \
86{ \
87 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
88}
89
90#define IS_OMAP_CLASS(class, id) \ 88#define IS_OMAP_CLASS(class, id) \
91static inline int is_omap ##class (void) \ 89static inline int is_omap ##class (void) \
92{ \ 90{ \
93 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 91 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
94} 92}
95 93
96IS_OMAP_TYPE(730, 0x07)
97IS_OMAP_TYPE(1510, 0x15)
98IS_OMAP_TYPE(1610, 0x16)
99IS_OMAP_TYPE(5912, 0x16)
100IS_OMAP_TYPE(1710, 0x17)
101IS_OMAP_TYPE(2420, 0x24)
102
103IS_OMAP_CLASS(7xx, 0x07) 94IS_OMAP_CLASS(7xx, 0x07)
104IS_OMAP_CLASS(15xx, 0x15) 95IS_OMAP_CLASS(15xx, 0x15)
105IS_OMAP_CLASS(16xx, 0x16) 96IS_OMAP_CLASS(16xx, 0x16)
106IS_OMAP_CLASS(24xx, 0x24) 97IS_OMAP_CLASS(24xx, 0x24)
107 98
108/* 99#define cpu_is_omap7xx() 0
109 * Macros to group OMAP types into cpu classes. 100#define cpu_is_omap15xx() 0
110 * These can be used in most places. 101#define cpu_is_omap16xx() 0
111 * cpu_is_omap15xx(): True for 1510 and 5910 102#define cpu_is_omap24xx() 0
112 * cpu_is_omap16xx(): True for 1610, 5912 and 1710 103
113 */ 104#if defined(MULTI_OMAP1)
114#if defined(MULTI_OMAP) 105# if defined(CONFIG_ARCH_OMAP730)
115# define cpu_is_omap7xx() is_omap7xx() 106# undef cpu_is_omap7xx
116# define cpu_is_omap15xx() is_omap15xx() 107# define cpu_is_omap7xx() is_omap7xx()
117# if !(defined(CONFIG_ARCH_OMAP1510) || defined(CONFIG_ARCH_OMAP730)) 108# endif
118# define cpu_is_omap16xx() 1 109# if defined(CONFIG_ARCH_OMAP1510)
119# else 110# undef cpu_is_omap15xx
111# define cpu_is_omap15xx() is_omap15xx()
112# endif
113# if defined(CONFIG_ARCH_OMAP16XX)
114# undef cpu_is_omap16xx
120# define cpu_is_omap16xx() is_omap16xx() 115# define cpu_is_omap16xx() is_omap16xx()
121# endif 116# endif
122#else 117#else
123# if defined(CONFIG_ARCH_OMAP730) 118# if defined(CONFIG_ARCH_OMAP730)
119# undef cpu_is_omap7xx
124# define cpu_is_omap7xx() 1 120# define cpu_is_omap7xx() 1
125# else
126# define cpu_is_omap7xx() 0
127# endif 121# endif
128# if defined(CONFIG_ARCH_OMAP1510) 122# if defined(CONFIG_ARCH_OMAP1510)
123# undef cpu_is_omap15xx
129# define cpu_is_omap15xx() 1 124# define cpu_is_omap15xx() 1
130# else
131# define cpu_is_omap15xx() 0
132# endif 125# endif
133# if defined(CONFIG_ARCH_OMAP16XX) 126# if defined(CONFIG_ARCH_OMAP16XX)
127# undef cpu_is_omap16xx
134# define cpu_is_omap16xx() 1 128# define cpu_is_omap16xx() 1
135# else 129# endif
136# define cpu_is_omap16xx() 0 130# if defined(CONFIG_ARCH_OMAP24XX)
131# undef cpu_is_omap24xx
132# define cpu_is_omap24xx() 1
137# endif 133# endif
138#endif 134#endif
139 135
140#if defined(MULTI_OMAP) 136/*
141# define cpu_is_omap730() is_omap730() 137 * Macros to detect individual cpu types.
142# define cpu_is_omap1510() is_omap1510() 138 * These are only rarely needed.
143# define cpu_is_omap1610() is_omap1610() 139 * cpu_is_omap730(): True for OMAP730
144# define cpu_is_omap5912() is_omap5912() 140 * cpu_is_omap1510(): True for OMAP1510
145# define cpu_is_omap1710() is_omap1710() 141 * cpu_is_omap1610(): True for OMAP1610
142 * cpu_is_omap1611(): True for OMAP1611
143 * cpu_is_omap5912(): True for OMAP5912
144 * cpu_is_omap1621(): True for OMAP1621
145 * cpu_is_omap1710(): True for OMAP1710
146 * cpu_is_omap2420(): True for OMAP2420
147 */
148#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff)
149
150#define IS_OMAP_TYPE(type, id) \
151static inline int is_omap ##type (void) \
152{ \
153 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
154}
155
156IS_OMAP_TYPE(730, 0x0730)
157IS_OMAP_TYPE(1510, 0x1510)
158IS_OMAP_TYPE(1610, 0x1610)
159IS_OMAP_TYPE(1611, 0x1611)
160IS_OMAP_TYPE(5912, 0x1611)
161IS_OMAP_TYPE(1621, 0x1621)
162IS_OMAP_TYPE(1710, 0x1710)
163IS_OMAP_TYPE(2420, 0x2420)
164
165#define cpu_is_omap730() 0
166#define cpu_is_omap1510() 0
167#define cpu_is_omap1610() 0
168#define cpu_is_omap5912() 0
169#define cpu_is_omap1611() 0
170#define cpu_is_omap1621() 0
171#define cpu_is_omap1710() 0
172#define cpu_is_omap2420() 0
173
174#if defined(MULTI_OMAP1)
175# if defined(CONFIG_ARCH_OMAP730)
176# undef cpu_is_omap730
177# define cpu_is_omap730() is_omap730()
178# endif
179# if defined(CONFIG_ARCH_OMAP1510)
180# undef cpu_is_omap1510
181# define cpu_is_omap1510() is_omap1510()
182# endif
146#else 183#else
147# if defined(CONFIG_ARCH_OMAP730) 184# if defined(CONFIG_ARCH_OMAP730)
185# undef cpu_is_omap730
148# define cpu_is_omap730() 1 186# define cpu_is_omap730() 1
149# else
150# define cpu_is_omap730() 0
151# endif 187# endif
152# if defined(CONFIG_ARCH_OMAP1510) 188# if defined(CONFIG_ARCH_OMAP1510)
189# undef cpu_is_omap1510
153# define cpu_is_omap1510() 1 190# define cpu_is_omap1510() 1
154# else
155# define cpu_is_omap1510() 0
156# endif 191# endif
157# if defined(CONFIG_ARCH_OMAP16XX) 192#endif
158# define cpu_is_omap1610() 1 193
159# else 194/*
160# define cpu_is_omap1610() 0 195 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
161# endif 196 * between 1611B/5912 and 1710.
162# if defined(CONFIG_ARCH_OMAP16XX) 197 */
163# define cpu_is_omap5912() 1 198#if defined(CONFIG_ARCH_OMAP16XX)
164# else 199# undef cpu_is_omap1610
165# define cpu_is_omap5912() 0 200# undef cpu_is_omap1611
166# endif 201# undef cpu_is_omap5912
167# if defined(CONFIG_ARCH_OMAP16XX) 202# undef cpu_is_omap1621
203# undef cpu_is_omap1710
168# define cpu_is_omap1610() is_omap1610() 204# define cpu_is_omap1610() is_omap1610()
205# define cpu_is_omap1611() is_omap1611()
169# define cpu_is_omap5912() is_omap5912() 206# define cpu_is_omap5912() is_omap5912()
207# define cpu_is_omap1621() is_omap1621()
170# define cpu_is_omap1710() is_omap1710() 208# define cpu_is_omap1710() is_omap1710()
171# else 209#endif
172# define cpu_is_omap1610() 0 210
173# define cpu_is_omap5912() 0 211#if defined(CONFIG_ARCH_OMAP2420)
174# define cpu_is_omap1710() 0 212# undef cpu_is_omap2420
175# endif
176# if defined(CONFIG_ARCH_OMAP2420)
177# define cpu_is_omap2420() 1 213# define cpu_is_omap2420() 1
178# else
179# define cpu_is_omap2420() 0
180# endif
181#endif 214#endif
182 215
183#endif 216#endif
diff --git a/include/asm-arm/arch-omap/debug-macro.S b/include/asm-arm/arch-omap/debug-macro.S
index 83bb458afd0b..ca4f577f9675 100644
--- a/include/asm-arm/arch-omap/debug-macro.S
+++ b/include/asm-arm/arch-omap/debug-macro.S
@@ -14,6 +14,7 @@
14 .macro addruart,rx 14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0 15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled? 16 tst \rx, #1 @ MMU enabled?
17#ifdef CONFIG_ARCH_OMAP1
17 moveq \rx, #0xff000000 @ physical base address 18 moveq \rx, #0xff000000 @ physical base address
18 movne \rx, #0xfe000000 @ virtual base 19 movne \rx, #0xfe000000 @ virtual base
19 orr \rx, \rx, #0x00fb0000 20 orr \rx, \rx, #0x00fb0000
@@ -23,6 +24,18 @@
23#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) 24#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
24 orr \rx, \rx, #0x00000800 @ UART 2 & 3 25 orr \rx, \rx, #0x00000800 @ UART 2 & 3
25#endif 26#endif
27
28#elif CONFIG_ARCH_OMAP2
29 moveq \rx, #0x48000000 @ physical base address
30 movne \rx, #0xd8000000 @ virtual base
31 orr \rx, \rx, #0x0006a000
32#ifdef CONFIG_OMAP_LL_DEBUG_UART2
33 add \rx, \rx, #0x00002000 @ UART 2
34#endif
35#ifdef CONFIG_OMAP_LL_DEBUG_UART3
36 add \rx, \rx, #0x00004000 @ UART 3
37#endif
38#endif
26 .endm 39 .endm
27 40
28 .macro senduart,rd,rx 41 .macro senduart,rd,rx
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index ce114ce5af5d..04ebef5c6e95 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -240,6 +240,7 @@ extern void omap_dma_unlink_lch (int lch_head, int lch_queue);
240 240
241extern dma_addr_t omap_get_dma_src_pos(int lch); 241extern dma_addr_t omap_get_dma_src_pos(int lch);
242extern dma_addr_t omap_get_dma_dst_pos(int lch); 242extern dma_addr_t omap_get_dma_dst_pos(int lch);
243extern int omap_get_dma_src_addr_counter(int lch);
243extern void omap_clear_dma(int lch); 244extern void omap_clear_dma(int lch);
244extern int omap_dma_running(void); 245extern int omap_dma_running(void);
245 246
diff --git a/include/asm-arm/arch-omap/dmtimer.h b/include/asm-arm/arch-omap/dmtimer.h
new file mode 100644
index 000000000000..11772c792f3e
--- /dev/null
+++ b/include/asm-arm/arch-omap/dmtimer.h
@@ -0,0 +1,92 @@
1/*
2 * linux/include/asm-arm/arm/arch-omap/dmtimer.h
3 *
4 * OMAP Dual-Mode Timers
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __ASM_ARCH_TIMER_H
29#define __ASM_ARCH_TIMER_H
30
31#include <linux/list.h>
32
33#define OMAP_TIMER_SRC_ARMXOR 0x00
34#define OMAP_TIMER_SRC_32_KHZ 0x01
35#define OMAP_TIMER_SRC_EXT_CLK 0x02
36
37/* timer control reg bits */
38#define OMAP_TIMER_CTRL_CAPTMODE (1 << 13)
39#define OMAP_TIMER_CTRL_PT (1 << 12)
40#define OMAP_TIMER_CTRL_TRG_OVERFLOW (0x1 << 10)
41#define OMAP_TIMER_CTRL_TRG_OFANDMATCH (0x2 << 10)
42#define OMAP_TIMER_CTRL_TCM_LOWTOHIGH (0x1 << 8)
43#define OMAP_TIMER_CTRL_TCM_HIGHTOLOW (0x2 << 8)
44#define OMAP_TIMER_CTRL_TCM_BOTHEDGES (0x3 << 8)
45#define OMAP_TIMER_CTRL_SCPWM (1 << 7)
46#define OMAP_TIMER_CTRL_CE (1 << 6) /* compare enable */
47#define OMAP_TIMER_CTRL_PRE (1 << 5) /* prescaler enable */
48#define OMAP_TIMER_CTRL_PTV_SHIFT 2 /* how much to shift the prescaler value */
49#define OMAP_TIMER_CTRL_AR (1 << 1) /* auto-reload enable */
50#define OMAP_TIMER_CTRL_ST (1 << 0) /* start timer */
51
52/* timer interrupt enable bits */
53#define OMAP_TIMER_INT_CAPTURE (1 << 2)
54#define OMAP_TIMER_INT_OVERFLOW (1 << 1)
55#define OMAP_TIMER_INT_MATCH (1 << 0)
56
57
58struct omap_dm_timer {
59 struct list_head timer_list;
60
61 u32 base;
62 unsigned int irq;
63};
64
65u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, int reg);
66void omap_dm_timer_write_reg(struct omap_dm_timer *timer, int reg, u32 value);
67
68struct omap_dm_timer * omap_dm_timer_request(void);
69void omap_dm_timer_free(struct omap_dm_timer *timer);
70void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
71
72void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
73void omap_dm_timer_set_trigger(struct omap_dm_timer *timer, unsigned int value);
74void omap_dm_timer_enable_compare(struct omap_dm_timer *timer);
75void omap_dm_timer_enable_autoreload(struct omap_dm_timer *timer);
76
77void omap_dm_timer_trigger(struct omap_dm_timer *timer);
78void omap_dm_timer_start(struct omap_dm_timer *timer);
79void omap_dm_timer_stop(struct omap_dm_timer *timer);
80
81void omap_dm_timer_set_load(struct omap_dm_timer *timer, unsigned int load);
82void omap_dm_timer_set_match(struct omap_dm_timer *timer, unsigned int match);
83
84unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
85void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
86
87unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer);
88void omap_dm_timer_reset_counter(struct omap_dm_timer *timer);
89
90int omap_dm_timers_active(void);
91
92#endif /* __ASM_ARCH_TIMER_H */
diff --git a/include/asm-arm/arch-omap/dsp.h b/include/asm-arm/arch-omap/dsp.h
new file mode 100644
index 000000000000..57bf4f39ca58
--- /dev/null
+++ b/include/asm-arm/arch-omap/dsp.h
@@ -0,0 +1,244 @@
1/*
2 * linux/include/asm-arm/arch-omap/dsp.h
3 *
4 * Header for OMAP DSP driver
5 *
6 * Copyright (C) 2002-2005 Nokia Corporation
7 *
8 * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * 2005/06/01: DSP Gateway version 3.3
25 */
26
27#ifndef ASM_ARCH_DSP_H
28#define ASM_ARCH_DSP_H
29
30
31/*
32 * for /dev/dspctl/ctl
33 */
34#define OMAP_DSP_IOCTL_RESET 1
35#define OMAP_DSP_IOCTL_RUN 2
36#define OMAP_DSP_IOCTL_SETRSTVECT 3
37#define OMAP_DSP_IOCTL_CPU_IDLE 4
38#define OMAP_DSP_IOCTL_MPUI_WORDSWAP_ON 5
39#define OMAP_DSP_IOCTL_MPUI_WORDSWAP_OFF 6
40#define OMAP_DSP_IOCTL_MPUI_BYTESWAP_ON 7
41#define OMAP_DSP_IOCTL_MPUI_BYTESWAP_OFF 8
42#define OMAP_DSP_IOCTL_GBL_IDLE 9
43#define OMAP_DSP_IOCTL_DSPCFG 10
44#define OMAP_DSP_IOCTL_DSPUNCFG 11
45#define OMAP_DSP_IOCTL_TASKCNT 12
46#define OMAP_DSP_IOCTL_POLL 13
47#define OMAP_DSP_IOCTL_REGMEMR 40
48#define OMAP_DSP_IOCTL_REGMEMW 41
49#define OMAP_DSP_IOCTL_REGIOR 42
50#define OMAP_DSP_IOCTL_REGIOW 43
51#define OMAP_DSP_IOCTL_GETVAR 44
52#define OMAP_DSP_IOCTL_SETVAR 45
53#define OMAP_DSP_IOCTL_RUNLEVEL 50
54#define OMAP_DSP_IOCTL_SUSPEND 51
55#define OMAP_DSP_IOCTL_RESUME 52
56#define OMAP_DSP_IOCTL_FBEN 53
57#define OMAP_DSP_IOCTL_FBDIS 54
58#define OMAP_DSP_IOCTL_MBSEND 99
59
60/*
61 * for taskdev
62 * (ioctls below should be >= 0x10000)
63 */
64#define OMAP_DSP_TASK_IOCTL_BFLSH 0x10000
65#define OMAP_DSP_TASK_IOCTL_SETBSZ 0x10001
66#define OMAP_DSP_TASK_IOCTL_LOCK 0x10002
67#define OMAP_DSP_TASK_IOCTL_UNLOCK 0x10003
68#define OMAP_DSP_TASK_IOCTL_GETNAME 0x10004
69
70/*
71 * for /dev/dspctl/mem
72 */
73#define OMAP_DSP_MEM_IOCTL_EXMAP 1
74#define OMAP_DSP_MEM_IOCTL_EXUNMAP 2
75#define OMAP_DSP_MEM_IOCTL_EXMAP_FLUSH 3
76#define OMAP_DSP_MEM_IOCTL_FBEXPORT 5
77#define OMAP_DSP_MEM_IOCTL_MMUITACK 7
78#define OMAP_DSP_MEM_IOCTL_MMUINIT 9
79#define OMAP_DSP_MEM_IOCTL_KMEM_RESERVE 11
80#define OMAP_DSP_MEM_IOCTL_KMEM_RELEASE 12
81
82struct omap_dsp_mapinfo {
83 unsigned long dspadr;
84 unsigned long size;
85};
86
87/*
88 * for /dev/dspctl/twch
89 */
90#define OMAP_DSP_TWCH_IOCTL_MKDEV 1
91#define OMAP_DSP_TWCH_IOCTL_RMDEV 2
92#define OMAP_DSP_TWCH_IOCTL_TADD 11
93#define OMAP_DSP_TWCH_IOCTL_TDEL 12
94#define OMAP_DSP_TWCH_IOCTL_TKILL 13
95
96#define OMAP_DSP_DEVSTATE_NOTASK 0x00000001
97#define OMAP_DSP_DEVSTATE_ATTACHED 0x00000002
98#define OMAP_DSP_DEVSTATE_GARBAGE 0x00000004
99#define OMAP_DSP_DEVSTATE_INVALID 0x00000008
100#define OMAP_DSP_DEVSTATE_ADDREQ 0x00000100
101#define OMAP_DSP_DEVSTATE_DELREQ 0x00000200
102#define OMAP_DSP_DEVSTATE_ADDFAIL 0x00001000
103#define OMAP_DSP_DEVSTATE_ADDING 0x00010000
104#define OMAP_DSP_DEVSTATE_DELING 0x00020000
105#define OMAP_DSP_DEVSTATE_KILLING 0x00040000
106#define OMAP_DSP_DEVSTATE_STATE_MASK 0x7fffffff
107#define OMAP_DSP_DEVSTATE_STALE 0x80000000
108
109struct omap_dsp_taddinfo {
110 unsigned char minor;
111 unsigned long taskadr;
112};
113#define OMAP_DSP_TADD_ABORTADR 0xffffffff
114
115
116/*
117 * error cause definition (for error detection device)
118 */
119#define OMAP_DSP_ERRDT_WDT 0x00000001
120#define OMAP_DSP_ERRDT_MMU 0x00000002
121
122
123/*
124 * mailbox protocol definitions
125 */
126
127struct omap_dsp_mailbox_cmd {
128 unsigned short cmd;
129 unsigned short data;
130};
131
132struct omap_dsp_reginfo {
133 unsigned short adr;
134 unsigned short val;
135};
136
137struct omap_dsp_varinfo {
138 unsigned char varid;
139 unsigned short val[0];
140};
141
142#define OMAP_DSP_MBPROT_REVISION 0x0019
143
144#define OMAP_DSP_MBCMD_WDSND 0x10
145#define OMAP_DSP_MBCMD_WDREQ 0x11
146#define OMAP_DSP_MBCMD_BKSND 0x20
147#define OMAP_DSP_MBCMD_BKREQ 0x21
148#define OMAP_DSP_MBCMD_BKYLD 0x23
149#define OMAP_DSP_MBCMD_BKSNDP 0x24
150#define OMAP_DSP_MBCMD_BKREQP 0x25
151#define OMAP_DSP_MBCMD_TCTL 0x30
152#define OMAP_DSP_MBCMD_TCTLDATA 0x31
153#define OMAP_DSP_MBCMD_POLL 0x32
154#define OMAP_DSP_MBCMD_WDT 0x50 /* v3.3: obsolete */
155#define OMAP_DSP_MBCMD_RUNLEVEL 0x51
156#define OMAP_DSP_MBCMD_PM 0x52
157#define OMAP_DSP_MBCMD_SUSPEND 0x53
158#define OMAP_DSP_MBCMD_KFUNC 0x54
159#define OMAP_DSP_MBCMD_TCFG 0x60
160#define OMAP_DSP_MBCMD_TADD 0x62
161#define OMAP_DSP_MBCMD_TDEL 0x63
162#define OMAP_DSP_MBCMD_TSTOP 0x65
163#define OMAP_DSP_MBCMD_DSPCFG 0x70
164#define OMAP_DSP_MBCMD_REGRW 0x72
165#define OMAP_DSP_MBCMD_GETVAR 0x74
166#define OMAP_DSP_MBCMD_SETVAR 0x75
167#define OMAP_DSP_MBCMD_ERR 0x78
168#define OMAP_DSP_MBCMD_DBG 0x79
169
170#define OMAP_DSP_MBCMD_TCTL_TINIT 0x0000
171#define OMAP_DSP_MBCMD_TCTL_TEN 0x0001
172#define OMAP_DSP_MBCMD_TCTL_TDIS 0x0002
173#define OMAP_DSP_MBCMD_TCTL_TCLR 0x0003
174#define OMAP_DSP_MBCMD_TCTL_TCLR_FORCE 0x0004
175
176#define OMAP_DSP_MBCMD_RUNLEVEL_USER 0x01
177#define OMAP_DSP_MBCMD_RUNLEVEL_SUPER 0x0e
178#define OMAP_DSP_MBCMD_RUNLEVEL_RECOVERY 0x10
179
180#define OMAP_DSP_MBCMD_PM_DISABLE 0x00
181#define OMAP_DSP_MBCMD_PM_ENABLE 0x01
182
183#define OMAP_DSP_MBCMD_KFUNC_FBCTL 0x00
184
185#define OMAP_DSP_MBCMD_FBCTL_ENABLE 0x0002
186#define OMAP_DSP_MBCMD_FBCTL_DISABLE 0x0003
187
188#define OMAP_DSP_MBCMD_TDEL_SAFE 0x0000
189#define OMAP_DSP_MBCMD_TDEL_KILL 0x0001
190
191#define OMAP_DSP_MBCMD_DSPCFG_REQ 0x00
192#define OMAP_DSP_MBCMD_DSPCFG_SYSADRH 0x28
193#define OMAP_DSP_MBCMD_DSPCFG_SYSADRL 0x29
194#define OMAP_DSP_MBCMD_DSPCFG_PROTREV 0x70
195#define OMAP_DSP_MBCMD_DSPCFG_ABORT 0x78
196#define OMAP_DSP_MBCMD_DSPCFG_LAST 0x80
197
198#define OMAP_DSP_MBCMD_REGRW_MEMR 0x00
199#define OMAP_DSP_MBCMD_REGRW_MEMW 0x01
200#define OMAP_DSP_MBCMD_REGRW_IOR 0x02
201#define OMAP_DSP_MBCMD_REGRW_IOW 0x03
202#define OMAP_DSP_MBCMD_REGRW_DATA 0x04
203
204#define OMAP_DSP_MBCMD_VARID_ICRMASK 0x00
205#define OMAP_DSP_MBCMD_VARID_LOADINFO 0x01
206
207#define OMAP_DSP_TTYP_ARCV 0x0001
208#define OMAP_DSP_TTYP_ASND 0x0002
209#define OMAP_DSP_TTYP_BKMD 0x0004
210#define OMAP_DSP_TTYP_BKDM 0x0008
211#define OMAP_DSP_TTYP_PVMD 0x0010
212#define OMAP_DSP_TTYP_PVDM 0x0020
213
214#define OMAP_DSP_EID_BADTID 0x10
215#define OMAP_DSP_EID_BADTCN 0x11
216#define OMAP_DSP_EID_BADBID 0x20
217#define OMAP_DSP_EID_BADCNT 0x21
218#define OMAP_DSP_EID_NOTLOCKED 0x22
219#define OMAP_DSP_EID_STVBUF 0x23
220#define OMAP_DSP_EID_BADADR 0x24
221#define OMAP_DSP_EID_BADTCTL 0x30
222#define OMAP_DSP_EID_BADPARAM 0x50
223#define OMAP_DSP_EID_FATAL 0x58
224#define OMAP_DSP_EID_NOMEM 0xc0
225#define OMAP_DSP_EID_NORES 0xc1
226#define OMAP_DSP_EID_IPBFULL 0xc2
227#define OMAP_DSP_EID_WDT 0xd0
228#define OMAP_DSP_EID_TASKNOTRDY 0xe0
229#define OMAP_DSP_EID_TASKBSY 0xe1
230#define OMAP_DSP_EID_TASKERR 0xef
231#define OMAP_DSP_EID_BADCFGTYP 0xf0
232#define OMAP_DSP_EID_DEBUG 0xf8
233#define OMAP_DSP_EID_BADSEQ 0xfe
234#define OMAP_DSP_EID_BADCMD 0xff
235
236#define OMAP_DSP_TNM_LEN 16
237
238#define OMAP_DSP_TID_FREE 0xff
239#define OMAP_DSP_TID_ANON 0xfe
240
241#define OMAP_DSP_BID_NULL 0xffff
242#define OMAP_DSP_BID_PVT 0xfffe
243
244#endif /* ASM_ARCH_DSP_H */
diff --git a/include/asm-arm/arch-omap/dsp_common.h b/include/asm-arm/arch-omap/dsp_common.h
new file mode 100644
index 000000000000..4fcce6944056
--- /dev/null
+++ b/include/asm-arm/arch-omap/dsp_common.h
@@ -0,0 +1,37 @@
1/*
2 * linux/include/asm-arm/arch-omap/dsp_common.h
3 *
4 * Header for OMAP DSP subsystem control
5 *
6 * Copyright (C) 2004,2005 Nokia Corporation
7 *
8 * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * 2005/06/03: DSP Gateway version 3.3
25 */
26
27#ifndef ASM_ARCH_DSP_COMMON_H
28#define ASM_ARCH_DSP_COMMON_H
29
30void omap_dsp_pm_suspend(void);
31void omap_dsp_pm_resume(void);
32void omap_dsp_request_mpui(void);
33void omap_dsp_release_mpui(void);
34int omap_dsp_request_mem(void);
35int omap_dsp_release_mem(void);
36
37#endif /* ASM_ARCH_DSP_COMMON_H */
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
index 57b126889b98..0d29b9c56a95 100644
--- a/include/asm-arm/arch-omap/entry-macro.S
+++ b/include/asm-arm/arch-omap/entry-macro.S
@@ -8,6 +8,8 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11#if defined(CONFIG_ARCH_OMAP1)
12
11 .macro disable_fiq 13 .macro disable_fiq
12 .endm 14 .endm
13 15
@@ -30,3 +32,29 @@
301510: 321510:
31 .endm 33 .endm
32 34
35#elif defined(CONFIG_ARCH_OMAP24XX)
36
37#include <asm/arch/omap24xx.h>
38
39 .macro disable_fiq
40 .endm
41
42 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
43 ldr \base, =VA_IC_BASE
44 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
45 cmp \irqnr, #0x0
46 bne 2222f
47 ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
48 cmp \irqnr, #0x0
49 bne 2222f
50 ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
51 cmp \irqnr, #0x0
522222:
53 ldrne \irqnr, [\base, #IRQ_SIR_IRQ]
54
55 .endm
56
57 .macro irq_prio_table
58 .endm
59
60#endif
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
index fad2fc93ee70..74cb2b93b700 100644
--- a/include/asm-arm/arch-omap/gpio.h
+++ b/include/asm-arm/arch-omap/gpio.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * OMAP GPIO handling defines and functions 4 * OMAP GPIO handling defines and functions
5 * 5 *
6 * Copyright (C) 2003 Nokia Corporation 6 * Copyright (C) 2003-2005 Nokia Corporation
7 * 7 *
8 * Written by Juha Yrjölä <juha.yrjola@nokia.com> 8 * Written by Juha Yrjölä <juha.yrjola@nokia.com>
9 * 9 *
@@ -30,7 +30,23 @@
30#include <asm/arch/irqs.h> 30#include <asm/arch/irqs.h>
31#include <asm/io.h> 31#include <asm/io.h>
32 32
33#define OMAP_MPUIO_BASE 0xfffb5000 33#define OMAP_MPUIO_BASE (void __iomem *)0xfffb5000
34
35#ifdef CONFIG_ARCH_OMAP730
36#define OMAP_MPUIO_INPUT_LATCH 0x00
37#define OMAP_MPUIO_OUTPUT 0x02
38#define OMAP_MPUIO_IO_CNTL 0x04
39#define OMAP_MPUIO_KBR_LATCH 0x08
40#define OMAP_MPUIO_KBC 0x0a
41#define OMAP_MPUIO_GPIO_EVENT_MODE 0x0c
42#define OMAP_MPUIO_GPIO_INT_EDGE 0x0e
43#define OMAP_MPUIO_KBD_INT 0x10
44#define OMAP_MPUIO_GPIO_INT 0x12
45#define OMAP_MPUIO_KBD_MASKIT 0x14
46#define OMAP_MPUIO_GPIO_MASKIT 0x16
47#define OMAP_MPUIO_GPIO_DEBOUNCING 0x18
48#define OMAP_MPUIO_LATCH 0x1a
49#else
34#define OMAP_MPUIO_INPUT_LATCH 0x00 50#define OMAP_MPUIO_INPUT_LATCH 0x00
35#define OMAP_MPUIO_OUTPUT 0x04 51#define OMAP_MPUIO_OUTPUT 0x04
36#define OMAP_MPUIO_IO_CNTL 0x08 52#define OMAP_MPUIO_IO_CNTL 0x08
@@ -44,6 +60,7 @@
44#define OMAP_MPUIO_GPIO_MASKIT 0x2c 60#define OMAP_MPUIO_GPIO_MASKIT 0x2c
45#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30 61#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30
46#define OMAP_MPUIO_LATCH 0x34 62#define OMAP_MPUIO_LATCH 0x34
63#endif
47 64
48#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr)) 65#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr))
49#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES) 66#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
@@ -52,18 +69,11 @@
52 IH_MPUIO_BASE + ((nr) & 0x0f) : \ 69 IH_MPUIO_BASE + ((nr) & 0x0f) : \
53 IH_GPIO_BASE + ((nr) & 0x3f)) 70 IH_GPIO_BASE + ((nr) & 0x3f))
54 71
55/* For EDGECTRL */
56#define OMAP_GPIO_NO_EDGE 0x00
57#define OMAP_GPIO_FALLING_EDGE 0x01
58#define OMAP_GPIO_RISING_EDGE 0x02
59#define OMAP_GPIO_BOTH_EDGES 0x03
60
61extern int omap_gpio_init(void); /* Call from board init only */ 72extern int omap_gpio_init(void); /* Call from board init only */
62extern int omap_request_gpio(int gpio); 73extern int omap_request_gpio(int gpio);
63extern void omap_free_gpio(int gpio); 74extern void omap_free_gpio(int gpio);
64extern void omap_set_gpio_direction(int gpio, int is_input); 75extern void omap_set_gpio_direction(int gpio, int is_input);
65extern void omap_set_gpio_dataout(int gpio, int enable); 76extern void omap_set_gpio_dataout(int gpio, int enable);
66extern int omap_get_gpio_datain(int gpio); 77extern int omap_get_gpio_datain(int gpio);
67extern void omap_set_gpio_edge_ctrl(int gpio, int edge);
68 78
69#endif 79#endif
diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
index 48258c7f6541..60201e1dd6ad 100644
--- a/include/asm-arm/arch-omap/hardware.h
+++ b/include/asm-arm/arch-omap/hardware.h
@@ -43,6 +43,7 @@
43#include <asm/arch/cpu.h> 43#include <asm/arch/cpu.h>
44#endif 44#endif
45#include <asm/arch/io.h> 45#include <asm/arch/io.h>
46#include <asm/arch/serial.h>
46 47
47/* 48/*
48 * --------------------------------------------------------------------------- 49 * ---------------------------------------------------------------------------
@@ -89,11 +90,12 @@
89/* DPLL control registers */ 90/* DPLL control registers */
90#define DPLL_CTL (0xfffecf00) 91#define DPLL_CTL (0xfffecf00)
91 92
92/* DSP clock control */ 93/* DSP clock control. Must use __raw_readw() and __raw_writew() with these */
93#define DSP_CONFIG_REG_BASE (0xe1008000) 94#define DSP_CONFIG_REG_BASE (0xe1008000)
94#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0) 95#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0)
95#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4) 96#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4)
96#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8) 97#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8)
98#define DSP_RSTCT2 (DSP_CONFIG_REG_BASE + 0x14)
97 99
98/* 100/*
99 * --------------------------------------------------------------------------- 101 * ---------------------------------------------------------------------------
@@ -142,6 +144,13 @@
142 * Interrupts 144 * Interrupts
143 * --------------------------------------------------------------------------- 145 * ---------------------------------------------------------------------------
144 */ 146 */
147#ifdef CONFIG_ARCH_OMAP1
148
149/*
150 * XXX: These probably want to be moved to arch/arm/mach-omap/omap1/irq.c
151 * or something similar.. -- PFM.
152 */
153
145#define OMAP_IH1_BASE 0xfffecb00 154#define OMAP_IH1_BASE 0xfffecb00
146#define OMAP_IH2_BASE 0xfffe0000 155#define OMAP_IH2_BASE 0xfffe0000
147 156
@@ -170,6 +179,8 @@
170#define IRQ_ILR0_REG_OFFSET 0x1c 179#define IRQ_ILR0_REG_OFFSET 0x1c
171#define IRQ_GMR_REG_OFFSET 0xa0 180#define IRQ_GMR_REG_OFFSET 0xa0
172 181
182#endif
183
173/* 184/*
174 * ---------------------------------------------------------------------------- 185 * ----------------------------------------------------------------------------
175 * System control registers 186 * System control registers
@@ -260,32 +271,17 @@
260 271
261/* 272/*
262 * --------------------------------------------------------------------------- 273 * ---------------------------------------------------------------------------
263 * Serial ports
264 * ---------------------------------------------------------------------------
265 */
266#define OMAP_UART1_BASE (unsigned char *)0xfffb0000
267#define OMAP_UART2_BASE (unsigned char *)0xfffb0800
268#define OMAP_UART3_BASE (unsigned char *)0xfffb9800
269#define OMAP_MAX_NR_PORTS 3
270#define OMAP1510_BASE_BAUD (12000000/16)
271#define OMAP16XX_BASE_BAUD (48000000/16)
272
273#define is_omap_port(p) ({int __ret = 0; \
274 if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
275 p == IO_ADDRESS(OMAP_UART2_BASE) || \
276 p == IO_ADDRESS(OMAP_UART3_BASE)) \
277 __ret = 1; \
278 __ret; \
279 })
280
281/*
282 * ---------------------------------------------------------------------------
283 * Processor specific defines 274 * Processor specific defines
284 * --------------------------------------------------------------------------- 275 * ---------------------------------------------------------------------------
285 */ 276 */
286 277
287#include "omap730.h" 278#include "omap730.h"
288#include "omap1510.h" 279#include "omap1510.h"
280
281#ifdef CONFIG_ARCH_OMAP24XX
282#include "omap24xx.h"
283#endif
284
289#include "omap16xx.h" 285#include "omap16xx.h"
290 286
291/* 287/*
@@ -312,7 +308,6 @@
312 308
313#ifdef CONFIG_MACH_OMAP_H4 309#ifdef CONFIG_MACH_OMAP_H4
314#include "board-h4.h" 310#include "board-h4.h"
315#error "Support for H4 board not yet implemented."
316#endif 311#endif
317 312
318#ifdef CONFIG_MACH_OMAP_OSK 313#ifdef CONFIG_MACH_OMAP_OSK
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
index 1c8c9fcc766e..11fbf629bf75 100644
--- a/include/asm-arm/arch-omap/io.h
+++ b/include/asm-arm/arch-omap/io.h
@@ -49,16 +49,24 @@
49 * I/O mapping 49 * I/O mapping
50 * ---------------------------------------------------------------------------- 50 * ----------------------------------------------------------------------------
51 */ 51 */
52#define IO_PHYS 0xFFFB0000
53#define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
54#define IO_VIRT (IO_PHYS - IO_OFFSET)
55#define IO_SIZE 0x40000
56#define IO_ADDRESS(x) ((x) - IO_OFFSET)
57 52
58#define PCIO_BASE 0 53#if defined(CONFIG_ARCH_OMAP1)
54#define IO_PHYS 0xFFFB0000
55#define IO_OFFSET -0x01000000 /* Virtual IO = 0xfefb0000 */
56#define IO_SIZE 0x40000
59 57
60#define io_p2v(x) ((x) - IO_OFFSET) 58#elif defined(CONFIG_ARCH_OMAP2)
61#define io_v2p(x) ((x) + IO_OFFSET) 59#define IO_PHYS 0x48000000 /* L4 peripherals; other stuff has to be mapped *
60 * manually. */
61#define IO_OFFSET 0x90000000 /* Virtual IO = 0xd8000000 */
62#define IO_SIZE 0x08000000
63#endif
64
65#define IO_VIRT (IO_PHYS + IO_OFFSET)
66#define IO_ADDRESS(x) ((x) + IO_OFFSET)
67#define PCIO_BASE 0
68#define io_p2v(x) ((x) + IO_OFFSET)
69#define io_v2p(x) ((x) - IO_OFFSET)
62 70
63#ifndef __ASSEMBLER__ 71#ifndef __ASSEMBLER__
64 72
@@ -96,6 +104,8 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
96 ->offset[((vaddr)&4095)>>2] 104 ->offset[((vaddr)&4095)>>2]
97#define __REG32(paddr) __REGV32(io_p2v(paddr)) 105#define __REG32(paddr) __REGV32(io_p2v(paddr))
98 106
107extern void omap_map_common_io(void);
108
99#else 109#else
100 110
101#define __REG8(paddr) io_p2v(paddr) 111#define __REG8(paddr) io_p2v(paddr)
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h
index 0d05a7c957d1..74e108ccac16 100644
--- a/include/asm-arm/arch-omap/irqs.h
+++ b/include/asm-arm/arch-omap/irqs.h
@@ -135,7 +135,6 @@
135/* 135/*
136 * OMAP-1510 specific IRQ numbers for interrupt handler 2 136 * OMAP-1510 specific IRQ numbers for interrupt handler 2
137 */ 137 */
138#define INT_1510_OS_32kHz_TIMER (22 + IH2_BASE)
139#define INT_1510_COM_SPI_RO (31 + IH2_BASE) 138#define INT_1510_COM_SPI_RO (31 + IH2_BASE)
140 139
141/* 140/*
@@ -232,6 +231,11 @@
232#define INT_730_DMA_CH15 (62 + IH2_BASE) 231#define INT_730_DMA_CH15 (62 + IH2_BASE)
233#define INT_730_NAND (63 + IH2_BASE) 232#define INT_730_NAND (63 + IH2_BASE)
234 233
234#define INT_24XX_GPIO_BANK1 29
235#define INT_24XX_GPIO_BANK2 30
236#define INT_24XX_GPIO_BANK3 31
237#define INT_24XX_GPIO_BANK4 32
238
235/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and 239/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
236 * 16 MPUIO lines */ 240 * 16 MPUIO lines */
237#define OMAP_MAX_GPIO_LINES 192 241#define OMAP_MAX_GPIO_LINES 192
diff --git a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h
index f6b57dd846a3..84f81e315a25 100644
--- a/include/asm-arm/arch-omap/memory.h
+++ b/include/asm-arm/arch-omap/memory.h
@@ -36,12 +36,11 @@
36/* 36/*
37 * Physical DRAM offset. 37 * Physical DRAM offset.
38 */ 38 */
39#if defined(CONFIG_ARCH_OMAP1)
39#define PHYS_OFFSET (0x10000000UL) 40#define PHYS_OFFSET (0x10000000UL)
40 41#elif defined(CONFIG_ARCH_OMAP2)
41/* 42#define PHYS_OFFSET (0x80000000UL)
42 * OMAP-1510 Local Bus address offset 43#endif
43 */
44#define OMAP1510_LB_OFFSET (0x30000000UL)
45 44
46/* 45/*
47 * Conversion between SDRAM and fake PCI bus, used by USB 46 * Conversion between SDRAM and fake PCI bus, used by USB
@@ -64,6 +63,11 @@
64 */ 63 */
65#ifdef CONFIG_ARCH_OMAP1510 64#ifdef CONFIG_ARCH_OMAP1510
66 65
66/*
67 * OMAP-1510 Local Bus address offset
68 */
69#define OMAP1510_LB_OFFSET (0x30000000UL)
70
67#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
68#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) 72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
69#define is_lbus_device(dev) (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0)) 73#define is_lbus_device(dev) (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
diff --git a/include/asm-arm/arch-omap/mtd-xip.h b/include/asm-arm/arch-omap/mtd-xip.h
new file mode 100644
index 000000000000..a73a28571fee
--- /dev/null
+++ b/include/asm-arm/arch-omap/mtd-xip.h
@@ -0,0 +1,61 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions.
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Vladimir Barinov <vbarinov@ru.mvista.com>
7 *
8 * (c) 2005 MontaVista Software, Inc. This file is licensed under the
9 * terms of the GNU General Public License version 2. This program is
10 * licensed "as is" without any warranty of any kind, whether express or
11 * implied.
12 */
13
14#ifndef __ARCH_OMAP_MTD_XIP_H__
15#define __ARCH_OMAP_MTD_XIP_H__
16
17#include <asm/hardware.h>
18#define OMAP_MPU_TIMER_BASE (0xfffec500)
19#define OMAP_MPU_TIMER_OFFSET 0x100
20
21typedef struct {
22 u32 cntl; /* CNTL_TIMER, R/W */
23 u32 load_tim; /* LOAD_TIM, W */
24 u32 read_tim; /* READ_TIM, R */
25} xip_omap_mpu_timer_regs_t;
26
27#define xip_omap_mpu_timer_base(n) \
28((volatile xip_omap_mpu_timer_regs_t*)IO_ADDRESS(OMAP_MPU_TIMER_BASE + \
29 (n)*OMAP_MPU_TIMER_OFFSET))
30
31static inline unsigned long xip_omap_mpu_timer_read(int nr)
32{
33 volatile xip_omap_mpu_timer_regs_t* timer = xip_omap_mpu_timer_base(nr);
34 return timer->read_tim;
35}
36
37#define xip_irqpending() \
38 (omap_readl(OMAP_IH1_ITR) & ~omap_readl(OMAP_IH1_MIR))
39#define xip_currtime() (~xip_omap_mpu_timer_read(0))
40
41/*
42 * It's permitted to do approxmation for xip_elapsed_since macro
43 * (see linux/mtd/xip.h)
44 */
45
46#ifdef CONFIG_MACH_OMAP_PERSEUS2
47#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 7)
48#else
49#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 6)
50#endif
51
52/*
53 * xip_cpu_idle() is used when waiting for a delay equal or larger than
54 * the system timer tick period. This should put the CPU into idle mode
55 * to save power and to be woken up only when some interrupts are pending.
56 * As above, this should not rely upon standard kernel code.
57 */
58
59#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (1))
60
61#endif /* __ARCH_OMAP_MTD_XIP_H__ */
diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h
index 5bd3f0097fc6..1b1ad4105349 100644
--- a/include/asm-arm/arch-omap/mux.h
+++ b/include/asm-arm/arch-omap/mux.h
@@ -185,6 +185,7 @@ typedef enum {
185 185
186 /* MPUIO */ 186 /* MPUIO */
187 MPUIO2, 187 MPUIO2,
188 N15_1610_MPUIO2,
188 MPUIO4, 189 MPUIO4,
189 MPUIO5, 190 MPUIO5,
190 T20_1610_MPUIO5, 191 T20_1610_MPUIO5,
@@ -210,6 +211,7 @@ typedef enum {
210 211
211 /* Misc ballouts */ 212 /* Misc ballouts */
212 BALLOUT_V8_ARMIO3, 213 BALLOUT_V8_ARMIO3,
214 N20_HDQ,
213 215
214 /* OMAP-1610 MMC2 */ 216 /* OMAP-1610 MMC2 */
215 W8_1610_MMC2_DAT0, 217 W8_1610_MMC2_DAT0,
@@ -235,6 +237,7 @@ typedef enum {
235 P20_1610_GPIO4, 237 P20_1610_GPIO4,
236 V9_1610_GPIO7, 238 V9_1610_GPIO7,
237 W8_1610_GPIO9, 239 W8_1610_GPIO9,
240 N20_1610_GPIO11,
238 N19_1610_GPIO13, 241 N19_1610_GPIO13,
239 P10_1610_GPIO22, 242 P10_1610_GPIO22,
240 V5_1610_GPIO24, 243 V5_1610_GPIO24,
@@ -250,7 +253,7 @@ typedef enum {
250 U18_1610_UWIRE_SDI, 253 U18_1610_UWIRE_SDI,
251 W21_1610_UWIRE_SDO, 254 W21_1610_UWIRE_SDO,
252 N14_1610_UWIRE_CS0, 255 N14_1610_UWIRE_CS0,
253 P15_1610_UWIRE_CS0, 256 P15_1610_UWIRE_CS3,
254 N15_1610_UWIRE_CS1, 257 N15_1610_UWIRE_CS1,
255 258
256 /* OMAP-1610 Flash */ 259 /* OMAP-1610 Flash */
@@ -411,7 +414,8 @@ MUX_CFG("N21_1710_GPIO14", 6, 9, 0, 1, 1, 1, 1, 1, 1)
411MUX_CFG("W15_1710_GPIO40", 9, 27, 7, 2, 5, 1, 2, 1, 1) 414MUX_CFG("W15_1710_GPIO40", 9, 27, 7, 2, 5, 1, 2, 1, 1)
412 415
413/* MPUIO */ 416/* MPUIO */
414MUX_CFG("MPUIO2", 7, 18, 0, 1, 1, 1, NA, 0, 1) 417MUX_CFG("MPUIO2", 7, 18, 0, 1, 14, 1, NA, 0, 1)
418MUX_CFG("N15_1610_MPUIO2", 7, 18, 0, 1, 14, 1, 1, 0, 1)
415MUX_CFG("MPUIO4", 7, 15, 0, 1, 13, 1, NA, 0, 1) 419MUX_CFG("MPUIO4", 7, 15, 0, 1, 13, 1, NA, 0, 1)
416MUX_CFG("MPUIO5", 7, 12, 0, 1, 12, 1, NA, 0, 1) 420MUX_CFG("MPUIO5", 7, 12, 0, 1, 12, 1, NA, 0, 1)
417 421
@@ -438,6 +442,7 @@ MUX_CFG("MCBSP3_CLKX", 9, 3, 1, 1, 29, 0, NA, 0, 1)
438 442
439/* Misc ballouts */ 443/* Misc ballouts */
440MUX_CFG("BALLOUT_V8_ARMIO3", B, 18, 0, 2, 25, 1, NA, 0, 1) 444MUX_CFG("BALLOUT_V8_ARMIO3", B, 18, 0, 2, 25, 1, NA, 0, 1)
445MUX_CFG("N20_HDQ", 6, 18, 1, 1, 4, 0, 1, 4, 0)
441 446
442/* OMAP-1610 MMC2 */ 447/* OMAP-1610 MMC2 */
443MUX_CFG("W8_1610_MMC2_DAT0", B, 21, 6, 2, 23, 1, 2, 1, 1) 448MUX_CFG("W8_1610_MMC2_DAT0", B, 21, 6, 2, 23, 1, 2, 1, 1)
@@ -463,6 +468,7 @@ MUX_CFG("J18_1610_ETM_D7", 5, 27, 1, 0, 19, 0, 0, 0, 1)
463MUX_CFG("P20_1610_GPIO4", 6, 27, 0, 1, 7, 0, 1, 1, 1) 468MUX_CFG("P20_1610_GPIO4", 6, 27, 0, 1, 7, 0, 1, 1, 1)
464MUX_CFG("V9_1610_GPIO7", B, 12, 1, 2, 20, 0, 2, 1, 1) 469MUX_CFG("V9_1610_GPIO7", B, 12, 1, 2, 20, 0, 2, 1, 1)
465MUX_CFG("W8_1610_GPIO9", B, 21, 0, 2, 23, 0, 2, 1, 1) 470MUX_CFG("W8_1610_GPIO9", B, 21, 0, 2, 23, 0, 2, 1, 1)
471MUX_CFG("N20_1610_GPIO11", 6, 18, 0, 1, 4, 0, 1, 1, 1)
466MUX_CFG("N19_1610_GPIO13", 6, 12, 0, 1, 2, 0, 1, 1, 1) 472MUX_CFG("N19_1610_GPIO13", 6, 12, 0, 1, 2, 0, 1, 1, 1)
467MUX_CFG("P10_1610_GPIO22", C, 0, 7, 2, 26, 0, 2, 1, 1) 473MUX_CFG("P10_1610_GPIO22", C, 0, 7, 2, 26, 0, 2, 1, 1)
468MUX_CFG("V5_1610_GPIO24", B, 15, 7, 2, 21, 0, 2, 1, 1) 474MUX_CFG("V5_1610_GPIO24", B, 15, 7, 2, 21, 0, 2, 1, 1)
diff --git a/include/asm-arm/arch-omap/omap1510.h b/include/asm-arm/arch-omap/omap1510.h
index f491a48ef2e1..f086a3933906 100644
--- a/include/asm-arm/arch-omap/omap1510.h
+++ b/include/asm-arm/arch-omap/omap1510.h
@@ -36,10 +36,6 @@
36 36
37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ 37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
38 38
39#define OMAP1510_SRAM_BASE 0xD0000000
40#define OMAP1510_SRAM_SIZE (SZ_128K + SZ_64K)
41#define OMAP1510_SRAM_START 0x20000000
42
43#define OMAP1510_DSP_BASE 0xE0000000 39#define OMAP1510_DSP_BASE 0xE0000000
44#define OMAP1510_DSP_SIZE 0x28000 40#define OMAP1510_DSP_SIZE 0x28000
45#define OMAP1510_DSP_START 0xE0000000 41#define OMAP1510_DSP_START 0xE0000000
@@ -48,14 +44,5 @@
48#define OMAP1510_DSPREG_SIZE SZ_128K 44#define OMAP1510_DSPREG_SIZE SZ_128K
49#define OMAP1510_DSPREG_START 0xE1000000 45#define OMAP1510_DSPREG_START 0xE1000000
50 46
51/*
52 * ----------------------------------------------------------------------------
53 * Memory used by power management
54 * ----------------------------------------------------------------------------
55 */
56
57#define OMAP1510_SRAM_IDLE_SUSPEND (OMAP1510_SRAM_BASE + OMAP1510_SRAM_SIZE - 0x200)
58#define OMAP1510_SRAM_API_SUSPEND (OMAP1510_SRAM_IDLE_SUSPEND + 0x100)
59
60#endif /* __ASM_ARCH_OMAP1510_H */ 47#endif /* __ASM_ARCH_OMAP1510_H */
61 48
diff --git a/include/asm-arm/arch-omap/omap16xx.h b/include/asm-arm/arch-omap/omap16xx.h
index 38a9b95e6a33..f0c7f0fb4dc0 100644
--- a/include/asm-arm/arch-omap/omap16xx.h
+++ b/include/asm-arm/arch-omap/omap16xx.h
@@ -36,11 +36,6 @@
36 36
37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ 37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
38 38
39#define OMAP16XX_SRAM_BASE 0xD0000000
40#define OMAP1610_SRAM_SIZE (SZ_16K)
41#define OMAP5912_SRAM_SIZE 0x3E800
42#define OMAP16XX_SRAM_START 0x20000000
43
44#define OMAP16XX_DSP_BASE 0xE0000000 39#define OMAP16XX_DSP_BASE 0xE0000000
45#define OMAP16XX_DSP_SIZE 0x28000 40#define OMAP16XX_DSP_SIZE 0x28000
46#define OMAP16XX_DSP_START 0xE0000000 41#define OMAP16XX_DSP_START 0xE0000000
@@ -50,17 +45,6 @@
50#define OMAP16XX_DSPREG_START 0xE1000000 45#define OMAP16XX_DSPREG_START 0xE1000000
51 46
52/* 47/*
53 * ----------------------------------------------------------------------------
54 * Memory used by power management
55 * ----------------------------------------------------------------------------
56 */
57
58#define OMAP1610_SRAM_IDLE_SUSPEND (OMAP16XX_SRAM_BASE + OMAP1610_SRAM_SIZE - 0x200)
59#define OMAP1610_SRAM_API_SUSPEND (OMAP1610_SRAM_IDLE_SUSPEND + 0x100)
60#define OMAP5912_SRAM_IDLE_SUSPEND (OMAP16XX_SRAM_BASE + OMAP5912_SRAM_SIZE - 0x200)
61#define OMAP5912_SRAM_API_SUSPEND (OMAP5912_SRAM_IDLE_SUSPEND + 0x100)
62
63/*
64 * --------------------------------------------------------------------------- 48 * ---------------------------------------------------------------------------
65 * Interrupts 49 * Interrupts
66 * --------------------------------------------------------------------------- 50 * ---------------------------------------------------------------------------
diff --git a/include/asm-arm/arch-omap/omap24xx.h b/include/asm-arm/arch-omap/omap24xx.h
new file mode 100644
index 000000000000..a9105466a417
--- /dev/null
+++ b/include/asm-arm/arch-omap/omap24xx.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_ARCH_OMAP24XX_H
2#define __ASM_ARCH_OMAP24XX_H
3
4#define OMAP24XX_L4_IO_BASE 0x48000000
5
6/* interrupt controller */
7#define OMAP24XX_IC_BASE (OMAP24XX_L4_IO_BASE + 0xfe000)
8#define VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE)
9
10#define OMAP24XX_IVA_INTC_BASE 0x40000000
11
12#define IRQ_SIR_IRQ 0x0040
13
14#endif /* __ASM_ARCH_OMAP24XX_H */
15
diff --git a/include/asm-arm/arch-omap/omap730.h b/include/asm-arm/arch-omap/omap730.h
index 599ab00f5488..755b64c5e9f0 100644
--- a/include/asm-arm/arch-omap/omap730.h
+++ b/include/asm-arm/arch-omap/omap730.h
@@ -36,10 +36,6 @@
36 36
37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ 37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
38 38
39#define OMAP730_SRAM_BASE 0xD0000000
40#define OMAP730_SRAM_SIZE (SZ_128K + SZ_64K + SZ_8K)
41#define OMAP730_SRAM_START 0x20000000
42
43#define OMAP730_DSP_BASE 0xE0000000 39#define OMAP730_DSP_BASE 0xE0000000
44#define OMAP730_DSP_SIZE 0x50000 40#define OMAP730_DSP_SIZE 0x50000
45#define OMAP730_DSP_START 0xE0000000 41#define OMAP730_DSP_START 0xE0000000
diff --git a/include/asm-arm/arch-omap/pm.h b/include/asm-arm/arch-omap/pm.h
index f209fc0953fb..fbd742d0c499 100644
--- a/include/asm-arm/arch-omap/pm.h
+++ b/include/asm-arm/arch-omap/pm.h
@@ -61,7 +61,10 @@
61#define PER_EN 0x1 61#define PER_EN 0x1
62 62
63#define CPU_SUSPEND_SIZE 200 63#define CPU_SUSPEND_SIZE 200
64#define ULPD_LOW_POWER_EN 0x0001 64#define ULPD_LOW_PWR_EN 0x0001
65#define ULPD_DEEP_SLEEP_TRANSITION_EN 0x0010
66#define ULPD_SETUP_ANALOG_CELL_3_VAL 0
67#define ULPD_POWER_CTRL_REG_VAL 0x0219
65 68
66#define DSP_IDLE_DELAY 10 69#define DSP_IDLE_DELAY 10
67#define DSP_IDLE 0x0040 70#define DSP_IDLE 0x0040
@@ -86,46 +89,35 @@
86#define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5 89#define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5
87#define OMAP1510_IDLE_LOOP_REQUEST 0x0c00 90#define OMAP1510_IDLE_LOOP_REQUEST 0x0c00
88#define OMAP1510_IDLE_CLOCK_DOMAINS 0x2 91#define OMAP1510_IDLE_CLOCK_DOMAINS 0x2
89#define OMAP1510_ULPD_LOW_POWER_REQ 0x0001
90 92
91#define OMAP1610_DEEP_SLEEP_REQUEST 0x17c7 93/* Both big sleep and deep sleep use same values. Difference is in ULPD. */
92#define OMAP1610_BIG_SLEEP_REQUEST TBD 94#define OMAP1610_IDLECT1_SLEEP_VAL 0x13c7
95#define OMAP1610_IDLECT2_SLEEP_VAL 0x09c7
96#define OMAP1610_IDLECT3_VAL 0x3f
97#define OMAP1610_IDLECT3_SLEEP_ORMASK 0x2c
98#define OMAP1610_IDLECT3 0xfffece24
93#define OMAP1610_IDLE_LOOP_REQUEST 0x0400 99#define OMAP1610_IDLE_LOOP_REQUEST 0x0400
94#define OMAP1610_IDLE_CLOCK_DOMAINS 0x09c7
95#define OMAP1610_ULPD_LOW_POWER_REQ 0x3
96
97#ifndef OMAP1510_SRAM_IDLE_SUSPEND
98#define OMAP1510_SRAM_IDLE_SUSPEND 0
99#endif
100#ifndef OMAP1610_SRAM_IDLE_SUSPEND
101#define OMAP1610_SRAM_IDLE_SUSPEND 0
102#endif
103#ifndef OMAP5912_SRAM_IDLE_SUSPEND
104#define OMAP5912_SRAM_IDLE_SUSPEND 0
105#endif
106
107#ifndef OMAP1510_SRAM_API_SUSPEND
108#define OMAP1510_SRAM_API_SUSPEND 0
109#endif
110#ifndef OMAP1610_SRAM_API_SUSPEND
111#define OMAP1610_SRAM_API_SUSPEND 0
112#endif
113#ifndef OMAP5912_SRAM_API_SUSPEND
114#define OMAP5912_SRAM_API_SUSPEND 0
115#endif
116 100
117#if !defined(CONFIG_ARCH_OMAP1510) && \ 101#if !defined(CONFIG_ARCH_OMAP1510) && \
118 !defined(CONFIG_ARCH_OMAP16XX) 102 !defined(CONFIG_ARCH_OMAP16XX) && \
103 !defined(CONFIG_ARCH_OMAP24XX)
119#error "Power management for this processor not implemented yet" 104#error "Power management for this processor not implemented yet"
120#endif 105#endif
121 106
122#ifndef __ASSEMBLER__ 107#ifndef __ASSEMBLER__
123extern void omap_pm_idle(void); 108extern void omap_pm_idle(void);
124extern void omap_pm_suspend(void); 109extern void omap_pm_suspend(void);
125extern int omap1510_cpu_suspend(unsigned short, unsigned short); 110extern void omap1510_cpu_suspend(unsigned short, unsigned short);
126extern int omap1610_cpu_suspend(unsigned short, unsigned short); 111extern void omap1610_cpu_suspend(unsigned short, unsigned short);
127extern int omap1510_idle_loop_suspend(void); 112extern void omap1510_idle_loop_suspend(void);
128extern int omap1610_idle_loop_suspend(void); 113extern void omap1610_idle_loop_suspend(void);
114
115#ifdef CONFIG_OMAP_SERIAL_WAKE
116extern void omap_serial_wake_trigger(int enable);
117#else
118#define omap_serial_wake_trigger(x) {}
119#endif /* CONFIG_OMAP_SERIAL_WAKE */
120
129extern unsigned int omap1510_cpu_suspend_sz; 121extern unsigned int omap1510_cpu_suspend_sz;
130extern unsigned int omap1510_idle_loop_suspend_sz; 122extern unsigned int omap1510_idle_loop_suspend_sz;
131extern unsigned int omap1610_cpu_suspend_sz; 123extern unsigned int omap1610_cpu_suspend_sz;
@@ -161,6 +153,7 @@ enum arm_save_state {
161 ARM_SLEEP_SAVE_ARM_CKCTL, 153 ARM_SLEEP_SAVE_ARM_CKCTL,
162 ARM_SLEEP_SAVE_ARM_IDLECT1, 154 ARM_SLEEP_SAVE_ARM_IDLECT1,
163 ARM_SLEEP_SAVE_ARM_IDLECT2, 155 ARM_SLEEP_SAVE_ARM_IDLECT2,
156 ARM_SLEEP_SAVE_ARM_IDLECT3,
164 ARM_SLEEP_SAVE_ARM_EWUPCT, 157 ARM_SLEEP_SAVE_ARM_EWUPCT,
165 ARM_SLEEP_SAVE_ARM_RSTCT1, 158 ARM_SLEEP_SAVE_ARM_RSTCT1,
166 ARM_SLEEP_SAVE_ARM_RSTCT2, 159 ARM_SLEEP_SAVE_ARM_RSTCT2,
diff --git a/include/asm-arm/arch-omap/serial.h b/include/asm-arm/arch-omap/serial.h
new file mode 100644
index 000000000000..79a5297af9fc
--- /dev/null
+++ b/include/asm-arm/arch-omap/serial.h
@@ -0,0 +1,37 @@
1/*
2 * linux/include/asm-arm/arch-omap/serial.h
3 *
4 * This program is distributed in the hope that it will be useful,
5 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 * GNU General Public License for more details.
8 */
9
10#ifndef __ASM_ARCH_SERIAL_H
11#define __ASM_ARCH_SERIAL_H
12
13#if defined(CONFIG_ARCH_OMAP1)
14/* OMAP1 serial ports */
15#define OMAP_UART1_BASE 0xfffb0000
16#define OMAP_UART2_BASE 0xfffb0800
17#define OMAP_UART3_BASE 0xfffb9800
18#elif defined(CONFIG_ARCH_OMAP2)
19/* OMAP2 serial ports */
20#define OMAP_UART1_BASE 0x4806a000
21#define OMAP_UART2_BASE 0x4806c000
22#define OMAP_UART3_BASE 0x4806e000
23#endif
24
25#define OMAP_MAX_NR_PORTS 3
26#define OMAP1510_BASE_BAUD (12000000/16)
27#define OMAP16XX_BASE_BAUD (48000000/16)
28
29#define is_omap_port(p) ({int __ret = 0; \
30 if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
31 p == IO_ADDRESS(OMAP_UART2_BASE) || \
32 p == IO_ADDRESS(OMAP_UART3_BASE)) \
33 __ret = 1; \
34 __ret; \
35 })
36
37#endif
diff --git a/include/asm-arm/arch-omap/uncompress.h b/include/asm-arm/arch-omap/uncompress.h
index 3e640aba8c20..3545c86859cc 100644
--- a/include/asm-arm/arch-omap/uncompress.h
+++ b/include/asm-arm/arch-omap/uncompress.h
@@ -20,7 +20,7 @@
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <asm/arch/hardware.h> 23#include <asm/arch/serial.h>
24 24
25unsigned int system_rev; 25unsigned int system_rev;
26 26
@@ -34,8 +34,9 @@ static void
34putstr(const char *s) 34putstr(const char *s)
35{ 35{
36 volatile u8 * uart = 0; 36 volatile u8 * uart = 0;
37 int shift; 37 int shift = 2;
38 38
39#ifdef CONFIG_ARCH_OMAP
39#ifdef CONFIG_OMAP_LL_DEBUG_UART3 40#ifdef CONFIG_OMAP_LL_DEBUG_UART3
40 uart = (volatile u8 *)(OMAP_UART3_BASE); 41 uart = (volatile u8 *)(OMAP_UART3_BASE);
41#elif CONFIG_OMAP_LL_DEBUG_UART2 42#elif CONFIG_OMAP_LL_DEBUG_UART2
@@ -44,6 +45,7 @@ putstr(const char *s)
44 uart = (volatile u8 *)(OMAP_UART1_BASE); 45 uart = (volatile u8 *)(OMAP_UART1_BASE);
45#endif 46#endif
46 47
48#ifdef CONFIG_ARCH_OMAP1
47 /* Determine which serial port to use */ 49 /* Determine which serial port to use */
48 do { 50 do {
49 /* MMU is not on, so cpu_is_omapXXXX() won't work here */ 51 /* MMU is not on, so cpu_is_omapXXXX() won't work here */
@@ -51,14 +53,14 @@ putstr(const char *s)
51 53
52 if (omap_id == OMAP_ID_730) 54 if (omap_id == OMAP_ID_730)
53 shift = 0; 55 shift = 0;
54 else
55 shift = 2;
56 56
57 if (check_port(uart, shift)) 57 if (check_port(uart, shift))
58 break; 58 break;
59 /* Silent boot if no serial ports are enabled. */ 59 /* Silent boot if no serial ports are enabled. */
60 return; 60 return;
61 } while (0); 61 } while (0);
62#endif /* CONFIG_ARCH_OMAP1 */
63#endif
62 64
63 /* 65 /*
64 * Now, xmit each character 66 * Now, xmit each character
diff --git a/include/asm-arm/arch-pxa/corgi.h b/include/asm-arm/arch-pxa/corgi.h
index 324db06b5dd4..4b7aa0b8391e 100644
--- a/include/asm-arm/arch-pxa/corgi.h
+++ b/include/asm-arm/arch-pxa/corgi.h
@@ -103,18 +103,20 @@
103 * Shared data structures 103 * Shared data structures
104 */ 104 */
105extern struct platform_device corgiscoop_device; 105extern struct platform_device corgiscoop_device;
106extern struct platform_device corgissp_device;
107extern struct platform_device corgifb_device;
106 108
107/* 109/*
108 * External Functions 110 * External Functions
109 */ 111 */
110extern unsigned long corgi_ssp_ads7846_putget(unsigned long); 112extern unsigned long corgi_ssp_ads7846_putget(unsigned long);
111extern unsigned long corgi_ssp_ads7846_get(void); 113extern unsigned long corgi_ssp_ads7846_get(void);
112extern void corgi_ssp_ads7846_put(ulong data); 114extern void corgi_ssp_ads7846_put(unsigned long data);
113extern void corgi_ssp_ads7846_lock(void); 115extern void corgi_ssp_ads7846_lock(void);
114extern void corgi_ssp_ads7846_unlock(void); 116extern void corgi_ssp_ads7846_unlock(void);
115extern void corgi_ssp_lcdtg_send (u8 adrs, u8 data); 117extern void corgi_ssp_lcdtg_send (unsigned char adrs, unsigned char data);
116extern void corgi_ssp_blduty_set(int duty); 118extern void corgi_ssp_blduty_set(int duty);
117extern int corgi_ssp_max1111_get(ulong data); 119extern int corgi_ssp_max1111_get(unsigned long data);
118 120
119#endif /* __ASM_ARCH_CORGI_H */ 121#endif /* __ASM_ARCH_CORGI_H */
120 122
diff --git a/include/asm-arm/arch-pxa/mmc.h b/include/asm-arm/arch-pxa/mmc.h
index 7492ea7ea614..9718063a2119 100644
--- a/include/asm-arm/arch-pxa/mmc.h
+++ b/include/asm-arm/arch-pxa/mmc.h
@@ -10,6 +10,7 @@ struct mmc_host;
10struct pxamci_platform_data { 10struct pxamci_platform_data {
11 unsigned int ocr_mask; /* available voltages */ 11 unsigned int ocr_mask; /* available voltages */
12 int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *); 12 int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *);
13 int (*get_ro)(struct device *);
13 void (*setpower)(struct device *, unsigned int); 14 void (*setpower)(struct device *, unsigned int);
14 void (*exit)(struct device *, void *); 15 void (*exit)(struct device *, void *);
15}; 16};
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 51f0fe0ac165..939d9e5020a0 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -818,6 +818,23 @@
818#define UDCOTGICR_IEIDF (1 << 0) /* OTG ID Change Falling Edge 818#define UDCOTGICR_IEIDF (1 << 0) /* OTG ID Change Falling Edge
819 Interrupt Enable */ 819 Interrupt Enable */
820 820
821#define UP2OCR __REG(0x40600020) /* USB Port 2 Output Control register */
822
823#define UP2OCR_CPVEN (1 << 0) /* Charge Pump Vbus Enable */
824#define UP2OCR_CPVPE (1 << 1) /* Charge Pump Vbus Pulse Enable */
825#define UP2OCR_DPPDE (1 << 2) /* Host Port 2 Transceiver D+ Pull Down Enable */
826#define UP2OCR_DMPDE (1 << 3) /* Host Port 2 Transceiver D- Pull Down Enable */
827#define UP2OCR_DPPUE (1 << 4) /* Host Port 2 Transceiver D+ Pull Up Enable */
828#define UP2OCR_DMPUE (1 << 5) /* Host Port 2 Transceiver D- Pull Up Enable */
829#define UP2OCR_DPPUBE (1 << 6) /* Host Port 2 Transceiver D+ Pull Up Bypass Enable */
830#define UP2OCR_DMPUBE (1 << 7) /* Host Port 2 Transceiver D- Pull Up Bypass Enable */
831#define UP2OCR_EXSP (1 << 8) /* External Transceiver Speed Control */
832#define UP2OCR_EXSUS (1 << 9) /* External Transceiver Speed Enable */
833#define UP2OCR_IDON (1 << 10) /* OTG ID Read Enable */
834#define UP2OCR_HXS (1 << 16) /* Host Port 2 Transceiver Output Select */
835#define UP2OCR_HXOE (1 << 17) /* Host Port 2 Transceiver Output Enable */
836#define UP2OCR_SEOS (1 << 24) /* Single-Ended Output Select */
837
821#define UDCCSN(x) __REG2(0x40600100, (x) << 2) 838#define UDCCSN(x) __REG2(0x40600100, (x) << 2)
822#define UDCCSR0 __REG(0x40600100) /* UDC Control/Status register - Endpoint 0 */ 839#define UDCCSR0 __REG(0x40600100) /* UDC Control/Status register - Endpoint 0 */
823#define UDCCSR0_SA (1 << 7) /* Setup Active */ 840#define UDCCSR0_SA (1 << 7) /* Setup Active */
@@ -1423,6 +1440,7 @@
1423#define GPIO84_NSSP_RX (84 | GPIO_ALT_FN_2_IN) 1440#define GPIO84_NSSP_RX (84 | GPIO_ALT_FN_2_IN)
1424#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT) 1441#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT)
1425#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT) 1442#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT)
1443#define GPIO104_pSKTSEL_MD (104 | GPIO_ALT_FN_1_OUT)
1426#define GPIO109_MMCDAT1_MD (109 | GPIO_ALT_FN_1_OUT) 1444#define GPIO109_MMCDAT1_MD (109 | GPIO_ALT_FN_1_OUT)
1427#define GPIO110_MMCDAT2_MD (110 | GPIO_ALT_FN_1_OUT) 1445#define GPIO110_MMCDAT2_MD (110 | GPIO_ALT_FN_1_OUT)
1428#define GPIO110_MMCCS0_MD (110 | GPIO_ALT_FN_1_OUT) 1446#define GPIO110_MMCCS0_MD (110 | GPIO_ALT_FN_1_OUT)
@@ -1510,6 +1528,8 @@
1510#define PSSR_BFS (1 << 1) /* Battery Fault Status */ 1528#define PSSR_BFS (1 << 1) /* Battery Fault Status */
1511#define PSSR_SSS (1 << 0) /* Software Sleep Status */ 1529#define PSSR_SSS (1 << 0) /* Software Sleep Status */
1512 1530
1531#define PSLR_SL_ROD (1 << 20) /* Sleep-Mode/Depp-Sleep Mode nRESET_OUT Disable */
1532
1513#define PCFR_RO (1 << 15) /* RDH Override */ 1533#define PCFR_RO (1 << 15) /* RDH Override */
1514#define PCFR_PO (1 << 14) /* PH Override */ 1534#define PCFR_PO (1 << 14) /* PH Override */
1515#define PCFR_GPROD (1 << 12) /* GPIO nRESET_OUT Disable */ 1535#define PCFR_GPROD (1 << 12) /* GPIO nRESET_OUT Disable */
@@ -1517,6 +1537,7 @@
1517#define PCFR_FVC (1 << 10) /* Frequency/Voltage Change */ 1537#define PCFR_FVC (1 << 10) /* Frequency/Voltage Change */
1518#define PCFR_DC_EN (1 << 7) /* Sleep/deep-sleep DC-DC Converter Enable */ 1538#define PCFR_DC_EN (1 << 7) /* Sleep/deep-sleep DC-DC Converter Enable */
1519#define PCFR_PI2CEN (1 << 6) /* Enable PI2C controller */ 1539#define PCFR_PI2CEN (1 << 6) /* Enable PI2C controller */
1540#define PCFR_GPR_EN (1 << 4) /* nRESET_GPIO Pin Enable */
1520#define PCFR_DS (1 << 3) /* Deep Sleep Mode */ 1541#define PCFR_DS (1 << 3) /* Deep Sleep Mode */
1521#define PCFR_FS (1 << 2) /* Float Static Chip Selects */ 1542#define PCFR_FS (1 << 2) /* Float Static Chip Selects */
1522#define PCFR_FP (1 << 1) /* Float PCMCIA controls */ 1543#define PCFR_FP (1 << 1) /* Float PCMCIA controls */
@@ -1810,6 +1831,11 @@
1810#define LCCR0_PDD_S 12 1831#define LCCR0_PDD_S 12
1811#define LCCR0_BM (1 << 20) /* Branch mask */ 1832#define LCCR0_BM (1 << 20) /* Branch mask */
1812#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */ 1833#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
1834#define LCCR0_LCDT (1 << 22) /* LCD panel type */
1835#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
1836#define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */
1837#define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */
1838#define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */
1813 1839
1814#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */ 1840#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */
1815#define LCCR1_DisWdth(Pixel) /* Display Width [1..800 pix.] */ \ 1841#define LCCR1_DisWdth(Pixel) /* Display Width [1..800 pix.] */ \
@@ -2062,7 +2088,10 @@
2062#define UHCFMN __REG(0x4C00003C) /* UHC Frame Number */ 2088#define UHCFMN __REG(0x4C00003C) /* UHC Frame Number */
2063#define UHCPERS __REG(0x4C000040) /* UHC Periodic Start */ 2089#define UHCPERS __REG(0x4C000040) /* UHC Periodic Start */
2064#define UHCLS __REG(0x4C000044) /* UHC Low Speed Threshold */ 2090#define UHCLS __REG(0x4C000044) /* UHC Low Speed Threshold */
2091
2065#define UHCRHDA __REG(0x4C000048) /* UHC Root Hub Descriptor A */ 2092#define UHCRHDA __REG(0x4C000048) /* UHC Root Hub Descriptor A */
2093#define UHCRHDA_NOCP (1 << 12) /* No over current protection */
2094
2066#define UHCRHDB __REG(0x4C00004C) /* UHC Root Hub Descriptor B */ 2095#define UHCRHDB __REG(0x4C00004C) /* UHC Root Hub Descriptor B */
2067#define UHCRHS __REG(0x4C000050) /* UHC Root Hub Status */ 2096#define UHCRHS __REG(0x4C000050) /* UHC Root Hub Status */
2068#define UHCRHPS1 __REG(0x4C000054) /* UHC Root Hub Port 1 Status */ 2097#define UHCRHPS1 __REG(0x4C000054) /* UHC Root Hub Port 1 Status */
diff --git a/include/asm-arm/arch-s3c2410/anubis-cpld.h b/include/asm-arm/arch-s3c2410/anubis-cpld.h
new file mode 100644
index 000000000000..5675b1796b55
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/anubis-cpld.h
@@ -0,0 +1,24 @@
1/* linux/include/asm-arm/arch-s3c2410/anubis-cpld.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * ANUBIS - CPLD control constants
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14 *
15*/
16
17#ifndef __ASM_ARCH_ANUBISCPLD_H
18#define __ASM_ARCH_ANUBISCPLD_H
19
20/* CTRL2 - NAND WP control, IDE Reset assert/check */
21
22#define ANUBIS_CTRL1_NANDSEL (0x3)
23
24#endif /* __ASM_ARCH_ANUBISCPLD_H */
diff --git a/include/asm-arm/arch-s3c2410/anubis-irq.h b/include/asm-arm/arch-s3c2410/anubis-irq.h
new file mode 100644
index 000000000000..82f15dbd97e8
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/anubis-irq.h
@@ -0,0 +1,23 @@
1/* linux/include/asm-arm/arch-s3c2410/anubis-irq.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * ANUBIS - IRQ Number definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14 */
15
16#ifndef __ASM_ARCH_ANUBISIRQ_H
17#define __ASM_ARCH_ANUBISIRQ_H
18
19#define IRQ_IDE0 IRQ_EINT2
20#define IRQ_IDE1 IRQ_EINT3
21#define IRQ_ASIX IRQ_EINT1
22
23#endif /* __ASM_ARCH_ANUBISIRQ_H */
diff --git a/include/asm-arm/arch-s3c2410/anubis-map.h b/include/asm-arm/arch-s3c2410/anubis-map.h
new file mode 100644
index 000000000000..97741d6e506a
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/anubis-map.h
@@ -0,0 +1,46 @@
1/* linux/include/asm-arm/arch-s3c2410/anubis-map.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * ANUBIS - Memory map definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14*/
15
16/* needs arch/map.h including with this */
17
18#ifndef __ASM_ARCH_ANUBISMAP_H
19#define __ASM_ARCH_ANUBISMAP_H
20
21/* start peripherals off after the S3C2410 */
22
23#define ANUBIS_IOADDR(x) (S3C2410_ADDR((x) + 0x02000000))
24
25#define ANUBIS_PA_CPLD (S3C2410_CS1 | (1<<26))
26
27/* we put the CPLD registers next, to get them out of the way */
28
29#define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01300000 */
30#define ANUBIS_PA_CTRL1 (ANUBIS_PA_CPLD)
31
32#define ANUBIS_VA_CTRL2 ANUBIS_IOADDR(0x00100000) /* 0x01400000 */
33#define ANUBIS_PA_CTRL2 (ANUBIS_PA_CPLD)
34
35#define ANUBIS_VA_CTRL3 ANUBIS_IOADDR(0x00200000) /* 0x01500000 */
36#define ANUBIS_PA_CTRL3 (ANUBIS_PA_CPLD)
37
38#define ANUBIS_VA_CTRL4 ANUBIS_IOADDR(0x00300000) /* 0x01600000 */
39#define ANUBIS_PA_CTRL4 (ANUBIS_PA_CPLD)
40
41#define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000)
42#define ANUBIS_IDEPRIAUX ANUBIS_IOADDR(0x01100000)
43#define ANUBIS_IDESEC ANUBIS_IOADDR(0x01200000)
44#define ANUBIS_IDESECAUX ANUBIS_IOADDR(0x01300000)
45
46#endif /* __ASM_ARCH_ANUBISMAP_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h
index e5e938b79acc..16f4c3cc1388 100644
--- a/include/asm-arm/arch-s3c2410/regs-clock.h
+++ b/include/asm-arm/arch-s3c2410/regs-clock.h
@@ -1,7 +1,7 @@
1/* linux/include/asm/arch-s3c2410/regs-clock.h 1/* linux/include/asm/arch-s3c2410/regs-clock.h
2 * 2 *
3 * Copyright (c) 2003,2004 Simtec Electronics <linux@simtec.co.uk> 3 * Copyright (c) 2003,2004,2005 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://armlinux.simtec.co.uk/
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 as 7 * it under the terms of the GNU General Public License version 2 as
@@ -17,6 +17,7 @@
17 * 29-Sep-2004 Ben Dooks Fixed usage for assembly inclusion 17 * 29-Sep-2004 Ben Dooks Fixed usage for assembly inclusion
18 * 10-Feb-2005 Ben Dooks Fixed CAMDIVN address (Guillaume Gourat) 18 * 10-Feb-2005 Ben Dooks Fixed CAMDIVN address (Guillaume Gourat)
19 * 10-Mar-2005 Lucas Villa Real Changed S3C2410_VA to S3C24XX_VA 19 * 10-Mar-2005 Lucas Villa Real Changed S3C2410_VA to S3C24XX_VA
20 * 27-Aug-2005 Ben Dooks Add clock-slow info
20 */ 21 */
21 22
22#ifndef __ASM_ARM_REGS_CLOCK 23#ifndef __ASM_ARM_REGS_CLOCK
@@ -74,6 +75,12 @@
74#define S3C2410_CLKDIVN_PDIVN (1<<0) 75#define S3C2410_CLKDIVN_PDIVN (1<<0)
75#define S3C2410_CLKDIVN_HDIVN (1<<1) 76#define S3C2410_CLKDIVN_HDIVN (1<<1)
76 77
78#define S3C2410_CLKSLOW_UCLK_OFF (1<<7)
79#define S3C2410_CLKSLOW_MPLL_OFF (1<<5)
80#define S3C2410_CLKSLOW_SLOW (1<<4)
81#define S3C2410_CLKSLOW_SLOWVAL(x) (x)
82#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)
83
77#ifndef __ASSEMBLY__ 84#ifndef __ASSEMBLY__
78 85
79static inline unsigned int 86static inline unsigned int
diff --git a/include/asm-arm/arch-s3c2410/usb-control.h b/include/asm-arm/arch-s3c2410/usb-control.h
index 1cc85a096b23..bd43b566db3e 100644
--- a/include/asm-arm/arch-s3c2410/usb-control.h
+++ b/include/asm-arm/arch-s3c2410/usb-control.h
@@ -12,6 +12,7 @@
12 * Changelog: 12 * Changelog:
13 * 11-Sep-2004 BJD Created file 13 * 11-Sep-2004 BJD Created file
14 * 21-Sep-2004 BJD Updated port info 14 * 21-Sep-2004 BJD Updated port info
15 * 09-Aug-2005 BJD Renamed s3c2410_report_oc s3c2410_usb_report_oc
15*/ 16*/
16 17
17#ifndef __ASM_ARCH_USBCONTROL_H 18#ifndef __ASM_ARCH_USBCONTROL_H
@@ -35,7 +36,7 @@ struct s3c2410_hcd_info {
35 void (*report_oc)(struct s3c2410_hcd_info *, int ports); 36 void (*report_oc)(struct s3c2410_hcd_info *, int ports);
36}; 37};
37 38
38static void inline s3c2410_report_oc(struct s3c2410_hcd_info *info, int ports) 39static void inline s3c2410_usb_report_oc(struct s3c2410_hcd_info *info, int ports)
39{ 40{
40 if (info->report_oc != NULL) { 41 if (info->report_oc != NULL) {
41 (info->report_oc)(info, ports); 42 (info->report_oc)(info, ports);
diff --git a/include/asm-arm/arch-sa1100/mcp.h b/include/asm-arm/arch-sa1100/mcp.h
new file mode 100644
index 000000000000..f58a22755c61
--- /dev/null
+++ b/include/asm-arm/arch-sa1100/mcp.h
@@ -0,0 +1,21 @@
1/*
2 * linux/include/asm-arm/arch-sa1100/mcp.h
3 *
4 * Copyright (C) 2005 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_ARCH_MCP_H
11#define __ASM_ARM_ARCH_MCP_H
12
13#include <linux/types.h>
14
15struct mcp_plat_data {
16 u32 mccr0;
17 u32 mccr1;
18 unsigned int sclk_rate;
19};
20
21#endif
diff --git a/include/asm-arm/auxvec.h b/include/asm-arm/auxvec.h
new file mode 100644
index 000000000000..c0536f6b29a7
--- /dev/null
+++ b/include/asm-arm/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMARM_AUXVEC_H
2#define __ASMARM_AUXVEC_H
3
4#endif
diff --git a/include/asm-arm/bug.h b/include/asm-arm/bug.h
index 24d11672eb60..7fb02138f585 100644
--- a/include/asm-arm/bug.h
+++ b/include/asm-arm/bug.h
@@ -5,7 +5,7 @@
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
8extern volatile void __bug(const char *file, int line, void *data); 8extern void __bug(const char *file, int line, void *data) __attribute__((noreturn));
9 9
10/* give file/line information */ 10/* give file/line information */
11#define BUG() __bug(__FILE__, __LINE__, NULL) 11#define BUG() __bug(__FILE__, __LINE__, NULL)
diff --git a/include/asm-arm/cpu-multi32.h b/include/asm-arm/cpu-multi32.h
index ff48022e4720..4679f63688e9 100644
--- a/include/asm-arm/cpu-multi32.h
+++ b/include/asm-arm/cpu-multi32.h
@@ -31,7 +31,7 @@ extern struct processor {
31 /* 31 /*
32 * Special stuff for a reset 32 * Special stuff for a reset
33 */ 33 */
34 volatile void (*reset)(unsigned long addr); 34 void (*reset)(unsigned long addr) __attribute__((noreturn));
35 /* 35 /*
36 * Idle the processor 36 * Idle the processor
37 */ 37 */
diff --git a/include/asm-arm/cpu-single.h b/include/asm-arm/cpu-single.h
index b5ec5d54665d..6723e67244fa 100644
--- a/include/asm-arm/cpu-single.h
+++ b/include/asm-arm/cpu-single.h
@@ -41,4 +41,4 @@ extern int cpu_do_idle(void);
41extern void cpu_dcache_clean_area(void *, int); 41extern void cpu_dcache_clean_area(void *, int);
42extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); 42extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
43extern void cpu_set_pte(pte_t *ptep, pte_t pte); 43extern void cpu_set_pte(pte_t *ptep, pte_t pte);
44extern volatile void cpu_reset(unsigned long addr); 44extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
diff --git a/include/asm-arm/fcntl.h b/include/asm-arm/fcntl.h
index 485b6bdf4d7a..a80b6607b2ef 100644
--- a/include/asm-arm/fcntl.h
+++ b/include/asm-arm/fcntl.h
@@ -1,87 +1,11 @@
1#ifndef _ARM_FCNTL_H 1#ifndef _ARM_FCNTL_H
2#define _ARM_FCNTL_H 2#define _ARM_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */ 4#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */ 5#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 6#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0400000 7#define O_LARGEFILE 0400000
23#define O_NOATIME 01000000
24 8
25#define F_DUPFD 0 /* dup */ 9#include <asm-generic/fcntl.h>
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33 10
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif 11#endif
diff --git a/include/asm-arm/futex.h b/include/asm-arm/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-arm/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-arm/hardware/gic.h b/include/asm-arm/hardware/gic.h
new file mode 100644
index 000000000000..3fa5eb70f64e
--- /dev/null
+++ b/include/asm-arm/hardware/gic.h
@@ -0,0 +1,41 @@
1/*
2 * linux/include/asm-arm/hardware/gic.h
3 *
4 * Copyright (C) 2002 ARM Limited, 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 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_HARDWARE_GIC_H
11#define __ASM_ARM_HARDWARE_GIC_H
12
13#include <linux/compiler.h>
14
15#define GIC_CPU_CTRL 0x00
16#define GIC_CPU_PRIMASK 0x04
17#define GIC_CPU_BINPOINT 0x08
18#define GIC_CPU_INTACK 0x0c
19#define GIC_CPU_EOI 0x10
20#define GIC_CPU_RUNNINGPRI 0x14
21#define GIC_CPU_HIGHPRI 0x18
22
23#define GIC_DIST_CTRL 0x000
24#define GIC_DIST_CTR 0x004
25#define GIC_DIST_ENABLE_SET 0x100
26#define GIC_DIST_ENABLE_CLEAR 0x180
27#define GIC_DIST_PENDING_SET 0x200
28#define GIC_DIST_PENDING_CLEAR 0x280
29#define GIC_DIST_ACTIVE_BIT 0x300
30#define GIC_DIST_PRI 0x400
31#define GIC_DIST_TARGET 0x800
32#define GIC_DIST_CONFIG 0xc00
33#define GIC_DIST_SOFTINT 0xf00
34
35#ifndef __ASSEMBLY__
36void gic_dist_init(void __iomem *base);
37void gic_cpu_init(void __iomem *base);
38void gic_raise_softirq(cpumask_t cpumask, unsigned int irq);
39#endif
40
41#endif
diff --git a/include/asm-arm/hardware/scoop.h b/include/asm-arm/hardware/scoop.h
index 7ea771ff6144..527404b5a8df 100644
--- a/include/asm-arm/hardware/scoop.h
+++ b/include/asm-arm/hardware/scoop.h
@@ -40,6 +40,19 @@ struct scoop_config {
40 unsigned short io_dir; 40 unsigned short io_dir;
41}; 41};
42 42
43/* Structure for linking scoop devices to PCMCIA sockets */
44struct scoop_pcmcia_dev {
45 struct device *dev; /* Pointer to this socket's scoop device */
46 int irq; /* irq for socket */
47 int cd_irq;
48 const char *cd_irq_str;
49 unsigned char keep_vs;
50 unsigned char keep_rd;
51};
52
53extern int scoop_num;
54extern struct scoop_pcmcia_dev *scoop_devs;
55
43void reset_scoop(struct device *dev); 56void reset_scoop(struct device *dev);
44unsigned short set_scoop_gpio(struct device *dev, unsigned short bit); 57unsigned short set_scoop_gpio(struct device *dev, unsigned short bit);
45unsigned short reset_scoop_gpio(struct device *dev, unsigned short bit); 58unsigned short reset_scoop_gpio(struct device *dev, unsigned short bit);
diff --git a/include/asm-arm/hdreg.h b/include/asm-arm/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-arm/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-arm/mach/irq.h b/include/asm-arm/mach/irq.h
index a43a353f6c7b..0ce6ca588d8c 100644
--- a/include/asm-arm/mach/irq.h
+++ b/include/asm-arm/mach/irq.h
@@ -42,11 +42,11 @@ struct irqchip {
42 /* 42 /*
43 * Set the type of the IRQ. 43 * Set the type of the IRQ.
44 */ 44 */
45 int (*type)(unsigned int, unsigned int); 45 int (*set_type)(unsigned int, unsigned int);
46 /* 46 /*
47 * Set wakeup-enable on the selected IRQ 47 * Set wakeup-enable on the selected IRQ
48 */ 48 */
49 int (*wake)(unsigned int, unsigned int); 49 int (*set_wake)(unsigned int, unsigned int);
50 50
51#ifdef CONFIG_SMP 51#ifdef CONFIG_SMP
52 /* 52 /*
@@ -92,6 +92,14 @@ struct irqdesc {
92extern struct irqdesc irq_desc[]; 92extern struct irqdesc irq_desc[];
93 93
94/* 94/*
95 * Helpful inline function for calling irq descriptor handlers.
96 */
97static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
98{
99 desc->handle(irq, desc, regs);
100}
101
102/*
95 * This is internal. Do not use it. 103 * This is internal. Do not use it.
96 */ 104 */
97extern void (*init_arch_irq)(void); 105extern void (*init_arch_irq)(void);
diff --git a/include/asm-arm/mach/time.h b/include/asm-arm/mach/time.h
index 2cf279a44017..96c6db7dd0e1 100644
--- a/include/asm-arm/mach/time.h
+++ b/include/asm-arm/mach/time.h
@@ -47,9 +47,7 @@ struct sys_timer {
47 47
48#ifdef CONFIG_NO_IDLE_HZ 48#ifdef CONFIG_NO_IDLE_HZ
49 49
50#define DYN_TICK_SKIPPING (1 << 2)
51#define DYN_TICK_ENABLED (1 << 1) 50#define DYN_TICK_ENABLED (1 << 1)
52#define DYN_TICK_SUITABLE (1 << 0)
53 51
54struct dyn_tick_timer { 52struct dyn_tick_timer {
55 unsigned int state; /* Current state */ 53 unsigned int state; /* Current state */
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 019c45d75730..4da1d532cbeb 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -163,20 +163,6 @@ typedef unsigned long pgprot_t;
163/* the upper-most page table pointer */ 163/* the upper-most page table pointer */
164extern pmd_t *top_pmd; 164extern pmd_t *top_pmd;
165 165
166/* Pure 2^n version of get_order */
167static inline int get_order(unsigned long size)
168{
169 int order;
170
171 size = (size-1) >> (PAGE_SHIFT-1);
172 order = -1;
173 do {
174 size >>= 1;
175 order++;
176 } while (size);
177 return order;
178}
179
180#include <asm/memory.h> 166#include <asm/memory.h>
181 167
182#endif /* !__ASSEMBLY__ */ 168#endif /* !__ASSEMBLY__ */
@@ -186,4 +172,6 @@ static inline int get_order(unsigned long size)
186 172
187#endif /* __KERNEL__ */ 173#endif /* __KERNEL__ */
188 174
175#include <asm-generic/page.h>
176
189#endif 177#endif
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index a9892eb42a23..478c49b56e18 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -188,12 +188,18 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
188/* 188/*
189 * - extended small page/tiny page 189 * - extended small page/tiny page
190 */ 190 */
191#define PTE_EXT_XN (1 << 0) /* v6 */
191#define PTE_EXT_AP_MASK (3 << 4) 192#define PTE_EXT_AP_MASK (3 << 4)
193#define PTE_EXT_AP0 (1 << 4)
194#define PTE_EXT_AP1 (2 << 4)
192#define PTE_EXT_AP_UNO_SRO (0 << 4) 195#define PTE_EXT_AP_UNO_SRO (0 << 4)
193#define PTE_EXT_AP_UNO_SRW (1 << 4) 196#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
194#define PTE_EXT_AP_URO_SRW (2 << 4) 197#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
195#define PTE_EXT_AP_URW_SRW (3 << 4) 198#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
196#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */ 199#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */
200#define PTE_EXT_APX (1 << 9) /* v6 */
201#define PTE_EXT_SHARED (1 << 10) /* v6 */
202#define PTE_EXT_NG (1 << 11) /* v6 */
197 203
198/* 204/*
199 * - small page 205 * - small page
@@ -224,6 +230,8 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
224#define L_PTE_WRITE (1 << 5) 230#define L_PTE_WRITE (1 << 5)
225#define L_PTE_EXEC (1 << 6) 231#define L_PTE_EXEC (1 << 6)
226#define L_PTE_DIRTY (1 << 7) 232#define L_PTE_DIRTY (1 << 7)
233#define L_PTE_SHARED (1 << 10) /* shared between CPUs (v6) */
234#define L_PTE_ASID (1 << 11) /* non-global (use ASID, v6) */
227 235
228#ifndef __ASSEMBLY__ 236#ifndef __ASSEMBLY__
229 237
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 46d20585d951..3c51da6438c9 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h
index f4c92e4c8c02..22992ee0627a 100644
--- a/include/asm-arm/types.h
+++ b/include/asm-arm/types.h
@@ -52,8 +52,6 @@ typedef unsigned long long u64;
52typedef u32 dma_addr_t; 52typedef u32 dma_addr_t;
53typedef u32 dma64_addr_t; 53typedef u32 dma64_addr_t;
54 54
55typedef unsigned int kmem_bufctl_t;
56
57#endif /* __ASSEMBLY__ */ 55#endif /* __ASSEMBLY__ */
58 56
59#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
index a7c018b8a0d4..a2fdad0138b3 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -77,12 +77,6 @@ static inline void set_fs (mm_segment_t fs)
77 77
78#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 78#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
79 79
80/* this function will go away soon - use access_ok() instead */
81static inline int __deprecated verify_area(int type, const void __user *addr, unsigned long size)
82{
83 return access_ok(type, addr, size) ? 0 : -EFAULT;
84}
85
86/* 80/*
87 * Single-value transfer routines. They automatically use the right 81 * Single-value transfer routines. They automatically use the right
88 * size if we just have the right pointer type. Note that the functions 82 * size if we just have the right pointer type. Note that the functions
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index ace27480886e..278de61224d1 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -295,7 +295,7 @@
295#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267) 295#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267)
296#define __NR_tgkill (__NR_SYSCALL_BASE+268) 296#define __NR_tgkill (__NR_SYSCALL_BASE+268)
297#define __NR_utimes (__NR_SYSCALL_BASE+269) 297#define __NR_utimes (__NR_SYSCALL_BASE+269)
298#define __NR_fadvise64_64 (__NR_SYSCALL_BASE+270) 298#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270)
299#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271) 299#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271)
300#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272) 300#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272)
301#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273) 301#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273)
@@ -350,6 +350,11 @@
350#endif 350#endif
351 351
352#define __NR_vserver (__NR_SYSCALL_BASE+313) 352#define __NR_vserver (__NR_SYSCALL_BASE+313)
353#define __NR_ioprio_set (__NR_SYSCALL_BASE+314)
354#define __NR_ioprio_get (__NR_SYSCALL_BASE+315)
355#define __NR_inotify_init (__NR_SYSCALL_BASE+316)
356#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
357#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
353 358
354/* 359/*
355 * The following SWIs are ARM private. 360 * The following SWIs are ARM private.
@@ -510,7 +515,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
510#define __ARCH_WANT_SYS_TIME 515#define __ARCH_WANT_SYS_TIME
511#define __ARCH_WANT_SYS_UTIME 516#define __ARCH_WANT_SYS_UTIME
512#define __ARCH_WANT_SYS_SOCKETCALL 517#define __ARCH_WANT_SYS_SOCKETCALL
513#define __ARCH_WANT_SYS_FADVISE64
514#define __ARCH_WANT_SYS_GETPGRP 518#define __ARCH_WANT_SYS_GETPGRP
515#define __ARCH_WANT_SYS_LLSEEK 519#define __ARCH_WANT_SYS_LLSEEK
516#define __ARCH_WANT_SYS_NICE 520#define __ARCH_WANT_SYS_NICE
diff --git a/include/asm-arm26/auxvec.h b/include/asm-arm26/auxvec.h
new file mode 100644
index 000000000000..c0536f6b29a7
--- /dev/null
+++ b/include/asm-arm26/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMARM_AUXVEC_H
2#define __ASMARM_AUXVEC_H
3
4#endif
diff --git a/include/asm-arm26/fcntl.h b/include/asm-arm26/fcntl.h
index 485b6bdf4d7a..d85995e7459e 100644
--- a/include/asm-arm26/fcntl.h
+++ b/include/asm-arm26/fcntl.h
@@ -3,85 +3,11 @@
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */ 5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */ 6#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */ 7#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 8#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0400000 9#define O_LARGEFILE 0400000
23#define O_NOATIME 01000000
24 10
25#define F_DUPFD 0 /* dup */ 11#include <asm-generic/fcntl.h>
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33 12
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif 13#endif
diff --git a/include/asm-arm26/futex.h b/include/asm-arm26/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-arm26/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-arm26/hdreg.h b/include/asm-arm26/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-arm26/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-arm26/page.h b/include/asm-arm26/page.h
index c334079b082b..d3f23ac4d468 100644
--- a/include/asm-arm26/page.h
+++ b/include/asm-arm26/page.h
@@ -89,20 +89,6 @@ typedef unsigned long pgprot_t;
89#ifdef __KERNEL__ 89#ifdef __KERNEL__
90#ifndef __ASSEMBLY__ 90#ifndef __ASSEMBLY__
91 91
92/* Pure 2^n version of get_order */
93static inline int get_order(unsigned long size)
94{
95 int order;
96
97 size = (size-1) >> (PAGE_SHIFT-1);
98 order = -1;
99 do {
100 size >>= 1;
101 order++;
102 } while (size);
103 return order;
104}
105
106#include <asm/memory.h> 92#include <asm/memory.h>
107 93
108#endif /* !__ASSEMBLY__ */ 94#endif /* !__ASSEMBLY__ */
@@ -112,4 +98,6 @@ static inline int get_order(unsigned long size)
112 98
113#endif /* __KERNEL__ */ 99#endif /* __KERNEL__ */
114 100
101#include <asm-generic/page.h>
102
115#endif 103#endif
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h
index 46d20585d951..3c51da6438c9 100644
--- a/include/asm-arm26/socket.h
+++ b/include/asm-arm26/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-arm26/types.h b/include/asm-arm26/types.h
index 56cbe573a234..81bd357ada02 100644
--- a/include/asm-arm26/types.h
+++ b/include/asm-arm26/types.h
@@ -52,8 +52,6 @@ typedef unsigned long long u64;
52typedef u32 dma_addr_t; 52typedef u32 dma_addr_t;
53typedef u32 dma64_addr_t; 53typedef u32 dma64_addr_t;
54 54
55typedef unsigned int kmem_bufctl_t;
56
57#endif /* __ASSEMBLY__ */ 55#endif /* __ASSEMBLY__ */
58 56
59#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
diff --git a/include/asm-arm26/uaccess.h b/include/asm-arm26/uaccess.h
index ab9ce38c6aec..3f2dd1093e58 100644
--- a/include/asm-arm26/uaccess.h
+++ b/include/asm-arm26/uaccess.h
@@ -40,12 +40,6 @@ extern int fixup_exception(struct pt_regs *regs);
40 40
41#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 41#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
42 42
43/* this function will go away soon - use access_ok() instead */
44static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
45{
46 return access_ok(type, addr, size) ? 0 : -EFAULT;
47}
48
49/* 43/*
50 * Single-value transfer routines. They automatically use the right 44 * Single-value transfer routines. They automatically use the right
51 * size if we just have the right pointer type. Note that the functions 45 * size if we just have the right pointer type. Note that the functions
diff --git a/include/asm-cris/auxvec.h b/include/asm-cris/auxvec.h
new file mode 100644
index 000000000000..cb30b01bf19f
--- /dev/null
+++ b/include/asm-cris/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMCRIS_AUXVEC_H
2#define __ASMCRIS_AUXVEC_H
3
4#endif
diff --git a/include/asm-cris/fcntl.h b/include/asm-cris/fcntl.h
index 61c563242b51..46ab12db5739 100644
--- a/include/asm-cris/fcntl.h
+++ b/include/asm-cris/fcntl.h
@@ -1,90 +1 @@
1#ifndef _CRIS_FCNTL_H #include <asm-generic/fcntl.h>
2#define _CRIS_FCNTL_H
3
4/* verbatim copy of i386 version */
5
6/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
7 located on an ext2 file system */
8#define O_ACCMODE 0003
9#define O_RDONLY 00
10#define O_WRONLY 01
11#define O_RDWR 02
12#define O_CREAT 0100 /* not fcntl */
13#define O_EXCL 0200 /* not fcntl */
14#define O_NOCTTY 0400 /* not fcntl */
15#define O_TRUNC 01000 /* not fcntl */
16#define O_APPEND 02000
17#define O_NONBLOCK 04000
18#define O_NDELAY O_NONBLOCK
19#define O_SYNC 010000
20#define FASYNC 020000 /* fcntl, for BSD compatibility */
21#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0100000
23#define O_DIRECTORY 0200000 /* must be a directory */
24#define O_NOFOLLOW 0400000 /* don't follow links */
25#define O_NOATIME 01000000
26
27#define F_DUPFD 0 /* dup */
28#define F_GETFD 1 /* get f_flags */
29#define F_SETFD 2 /* set f_flags */
30#define F_GETFL 3 /* more flags (cloexec) */
31#define F_SETFL 4
32#define F_GETLK 5
33#define F_SETLK 6
34#define F_SETLKW 7
35
36#define F_SETOWN 8 /* for sockets. */
37#define F_GETOWN 9 /* for sockets. */
38#define F_SETSIG 10 /* for sockets. */
39#define F_GETSIG 11 /* for sockets. */
40
41#define F_GETLK64 12 /* using 'struct flock64' */
42#define F_SETLK64 13
43#define F_SETLKW64 14
44
45/* for F_[GET|SET]FL */
46#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
47
48/* for posix fcntl() and lockf() */
49#define F_RDLCK 0
50#define F_WRLCK 1
51#define F_UNLCK 2
52
53/* for old implementation of bsd flock () */
54#define F_EXLCK 4 /* or 3 */
55#define F_SHLCK 8 /* or 4 */
56
57/* for leases */
58#define F_INPROGRESS 16
59
60/* operations for bsd flock(), also used by the kernel implementation */
61#define LOCK_SH 1 /* shared lock */
62#define LOCK_EX 2 /* exclusive lock */
63#define LOCK_NB 4 /* or'd with one of the above to prevent
64 blocking */
65#define LOCK_UN 8 /* remove lock */
66
67#define LOCK_MAND 32 /* This is a mandatory flock */
68#define LOCK_READ 64 /* ... Which allows concurrent read operations */
69#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
70#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
71
72struct flock {
73 short l_type;
74 short l_whence;
75 off_t l_start;
76 off_t l_len;
77 pid_t l_pid;
78};
79
80struct flock64 {
81 short l_type;
82 short l_whence;
83 loff_t l_start;
84 loff_t l_len;
85 pid_t l_pid;
86};
87
88#define F_LINUX_SPECIFIC_BASE 1024
89
90#endif
diff --git a/include/asm-cris/futex.h b/include/asm-cris/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-cris/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-cris/irq.h b/include/asm-cris/irq.h
index 8e787fdaedd4..4fab5c3b2e15 100644
--- a/include/asm-cris/irq.h
+++ b/include/asm-cris/irq.h
@@ -1,6 +1,11 @@
1#ifndef _ASM_IRQ_H 1#ifndef _ASM_IRQ_H
2#define _ASM_IRQ_H 2#define _ASM_IRQ_H
3 3
4/*
5 * IRQ line status macro IRQ_PER_CPU is used
6 */
7#define ARCH_HAS_IRQ_PER_CPU
8
4#include <asm/arch/irq.h> 9#include <asm/arch/irq.h>
5 10
6extern __inline__ int irq_canonicalize(int irq) 11extern __inline__ int irq_canonicalize(int irq)
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index bbf17bd39385..c99c478c482f 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -70,19 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
70 70
71#ifndef __ASSEMBLY__ 71#ifndef __ASSEMBLY__
72 72
73/* Pure 2^n version of get_order */
74static inline int get_order(unsigned long size)
75{
76 int order;
77
78 size = (size-1) >> (PAGE_SHIFT-1);
79 order = -1;
80 do {
81 size >>= 1;
82 order++;
83 } while (size);
84 return order;
85}
86#endif /* __ASSEMBLY__ */ 73#endif /* __ASSEMBLY__ */
87 74
88#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 75#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
@@ -90,5 +77,7 @@ static inline int get_order(unsigned long size)
90 77
91#endif /* __KERNEL__ */ 78#endif /* __KERNEL__ */
92 79
80#include <asm-generic/page.h>
81
93#endif /* _CRIS_PAGE_H */ 82#endif /* _CRIS_PAGE_H */
94 83
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index f159b4f165f7..8b1da3e58c55 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -16,6 +16,8 @@
16#define SO_BROADCAST 6 16#define SO_BROADCAST 6
17#define SO_SNDBUF 7 17#define SO_SNDBUF 7
18#define SO_RCVBUF 8 18#define SO_RCVBUF 8
19#define SO_SNDBUFFORCE 32
20#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9 21#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10 22#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11 23#define SO_NO_CHECK 11
diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h
index 8fa6d6c7afce..84557c9bac93 100644
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -52,8 +52,6 @@ typedef unsigned long long u64;
52typedef u32 dma_addr_t; 52typedef u32 dma_addr_t;
53typedef u32 dma64_addr_t; 53typedef u32 dma64_addr_t;
54 54
55typedef unsigned short kmem_bufctl_t;
56
57#endif /* __ASSEMBLY__ */ 55#endif /* __ASSEMBLY__ */
58 56
59#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
diff --git a/include/asm-cris/uaccess.h b/include/asm-cris/uaccess.h
index 6db17221fd9e..7d50086eb5ea 100644
--- a/include/asm-cris/uaccess.h
+++ b/include/asm-cris/uaccess.h
@@ -91,13 +91,6 @@
91#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) 91#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
92#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) 92#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
93 93
94/* this function will go away soon - use access_ok() instead */
95extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
96{
97 return access_ok(type,addr,size) ? 0 : -EFAULT;
98}
99
100
101#include <asm/arch/uaccess.h> 94#include <asm/arch/uaccess.h>
102 95
103/* 96/*
diff --git a/include/asm-frv/auxvec.h b/include/asm-frv/auxvec.h
new file mode 100644
index 000000000000..07710778fa10
--- /dev/null
+++ b/include/asm-frv/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __FRV_AUXVEC_H
2#define __FRV_AUXVEC_H
3
4#endif
diff --git a/include/asm-frv/fcntl.h b/include/asm-frv/fcntl.h
index d61b999f9973..46ab12db5739 100644
--- a/include/asm-frv/fcntl.h
+++ b/include/asm-frv/fcntl.h
@@ -1,88 +1 @@
1#ifndef _ASM_FCNTL_H #include <asm-generic/fcntl.h>
2#define _ASM_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECT 040000 /* direct disk access hint */
20#define O_LARGEFILE 0100000
21#define O_DIRECTORY 0200000 /* must be a directory */
22#define O_NOFOLLOW 0400000 /* don't follow links */
23#define O_NOATIME 01000000
24
25#define F_DUPFD 0 /* dup */
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif /* _ASM_FCNTL_H */
88
diff --git a/include/asm-frv/futex.h b/include/asm-frv/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-frv/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index f7914f1782b0..4feba567e7fd 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -45,21 +45,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
45/* to align the pointer to the (next) page boundary */ 45/* to align the pointer to the (next) page boundary */
46#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 46#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
47 47
48/* Pure 2^n version of get_order */
49static inline int get_order(unsigned long size) __attribute_const__;
50static inline int get_order(unsigned long size)
51{
52 int order;
53
54 size = (size - 1) >> (PAGE_SHIFT - 1);
55 order = -1;
56 do {
57 size >>= 1;
58 order++;
59 } while (size);
60 return order;
61}
62
63#define devmem_is_allowed(pfn) 1 48#define devmem_is_allowed(pfn) 1
64 49
65#define __pa(vaddr) virt_to_phys((void *) vaddr) 50#define __pa(vaddr) virt_to_phys((void *) vaddr)
@@ -102,4 +87,6 @@ extern unsigned long max_pfn;
102#define WANT_PAGE_VIRTUAL 1 87#define WANT_PAGE_VIRTUAL 1
103#endif 88#endif
104 89
90#include <asm-generic/page.h>
91
105#endif /* _ASM_PAGE_H */ 92#endif /* _ASM_PAGE_H */
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index c3be17c7de4b..7177f8b9817c 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h
index 1a5b6546bb41..50605df6d8ac 100644
--- a/include/asm-frv/types.h
+++ b/include/asm-frv/types.h
@@ -65,8 +65,6 @@ typedef u64 u_quad_t;
65 65
66typedef u32 dma_addr_t; 66typedef u32 dma_addr_t;
67 67
68typedef unsigned short kmem_bufctl_t;
69
70#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
71 69
72#endif /* __KERNEL__ */ 70#endif /* __KERNEL__ */
diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h
index 32dc52e883e5..991b50fbba24 100644
--- a/include/asm-frv/uaccess.h
+++ b/include/asm-frv/uaccess.h
@@ -67,12 +67,6 @@ static inline int ___range_ok(unsigned long addr, unsigned long size)
67#define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0) 67#define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0)
68#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) 68#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0)
69 69
70/* this function will go away soon - use access_ok() / __range_ok() instead */
71static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
72{
73 return __range_ok(addr, size);
74}
75
76/* 70/*
77 * The exception table consists of pairs of addresses: the first is the 71 * The exception table consists of pairs of addresses: the first is the
78 * address of an instruction that is allowed to fault, and the second is 72 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
new file mode 100644
index 000000000000..b663520dcdc4
--- /dev/null
+++ b/include/asm-generic/fcntl.h
@@ -0,0 +1,149 @@
1#ifndef _ASM_GENERIC_FCNTL_H
2#define _ASM_GENERIC_FCNTL_H
3
4#include <linux/config.h>
5#include <linux/types.h>
6
7/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
8 located on an ext2 file system */
9#define O_ACCMODE 00000003
10#define O_RDONLY 00000000
11#define O_WRONLY 00000001
12#define O_RDWR 00000002
13#ifndef O_CREAT
14#define O_CREAT 00000100 /* not fcntl */
15#endif
16#ifndef O_EXCL
17#define O_EXCL 00000200 /* not fcntl */
18#endif
19#ifndef O_NOCTTY
20#define O_NOCTTY 00000400 /* not fcntl */
21#endif
22#ifndef O_TRUNC
23#define O_TRUNC 00001000 /* not fcntl */
24#endif
25#ifndef O_APPEND
26#define O_APPEND 00002000
27#endif
28#ifndef O_NONBLOCK
29#define O_NONBLOCK 00004000
30#endif
31#ifndef O_SYNC
32#define O_SYNC 00010000
33#endif
34#ifndef FASYNC
35#define FASYNC 00020000 /* fcntl, for BSD compatibility */
36#endif
37#ifndef O_DIRECT
38#define O_DIRECT 00040000 /* direct disk access hint */
39#endif
40#ifndef O_LARGEFILE
41#define O_LARGEFILE 00100000
42#endif
43#ifndef O_DIRECTORY
44#define O_DIRECTORY 00200000 /* must be a directory */
45#endif
46#ifndef O_NOFOLLOW
47#define O_NOFOLLOW 00400000 /* don't follow links */
48#endif
49#ifndef O_NOATIME
50#define O_NOATIME 01000000
51#endif
52#ifndef O_NDELAY
53#define O_NDELAY O_NONBLOCK
54#endif
55
56#define F_DUPFD 0 /* dup */
57#define F_GETFD 1 /* get close_on_exec */
58#define F_SETFD 2 /* set/clear close_on_exec */
59#define F_GETFL 3 /* get file->f_flags */
60#define F_SETFL 4 /* set file->f_flags */
61#ifndef F_GETLK
62#define F_GETLK 5
63#define F_SETLK 6
64#define F_SETLKW 7
65#endif
66#ifndef F_SETOWN
67#define F_SETOWN 8 /* for sockets. */
68#define F_GETOWN 9 /* for sockets. */
69#endif
70#ifndef F_SETSIG
71#define F_SETSIG 10 /* for sockets. */
72#define F_GETSIG 11 /* for sockets. */
73#endif
74
75/* for F_[GET|SET]FL */
76#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
77
78/* for posix fcntl() and lockf() */
79#ifndef F_RDLCK
80#define F_RDLCK 0
81#define F_WRLCK 1
82#define F_UNLCK 2
83#endif
84
85/* for old implementation of bsd flock () */
86#ifndef F_EXLCK
87#define F_EXLCK 4 /* or 3 */
88#define F_SHLCK 8 /* or 4 */
89#endif
90
91/* for leases */
92#ifndef F_INPROGRESS
93#define F_INPROGRESS 16
94#endif
95
96/* operations for bsd flock(), also used by the kernel implementation */
97#define LOCK_SH 1 /* shared lock */
98#define LOCK_EX 2 /* exclusive lock */
99#define LOCK_NB 4 /* or'd with one of the above to prevent
100 blocking */
101#define LOCK_UN 8 /* remove lock */
102
103#define LOCK_MAND 32 /* This is a mandatory flock ... */
104#define LOCK_READ 64 /* which allows concurrent read operations */
105#define LOCK_WRITE 128 /* which allows concurrent write operations */
106#define LOCK_RW 192 /* which allows concurrent read & write ops */
107
108#define F_LINUX_SPECIFIC_BASE 1024
109
110#ifndef HAVE_ARCH_STRUCT_FLOCK
111#ifndef __ARCH_FLOCK_PAD
112#define __ARCH_FLOCK_PAD
113#endif
114
115struct flock {
116 short l_type;
117 short l_whence;
118 off_t l_start;
119 off_t l_len;
120 pid_t l_pid;
121 __ARCH_FLOCK_PAD
122};
123#endif
124
125#ifndef CONFIG_64BIT
126
127#ifndef F_GETLK64
128#define F_GETLK64 12 /* using 'struct flock64' */
129#define F_SETLK64 13
130#define F_SETLKW64 14
131#endif
132
133#ifndef HAVE_ARCH_STRUCT_FLOCK64
134#ifndef __ARCH_FLOCK64_PAD
135#define __ARCH_FLOCK64_PAD
136#endif
137
138struct flock64 {
139 short l_type;
140 short l_whence;
141 loff_t l_start;
142 loff_t l_len;
143 pid_t l_pid;
144 __ARCH_FLOCK64_PAD
145};
146#endif
147#endif /* !CONFIG_64BIT */
148
149#endif /* _ASM_GENERIC_FCNTL_H */
diff --git a/include/asm-generic/hdreg.h b/include/asm-generic/hdreg.h
deleted file mode 100644
index 7051fba8bcf9..000000000000
--- a/include/asm-generic/hdreg.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#warning <asm/hdreg.h> is obsolete, please do not use it
2
3#ifndef __ASM_GENERIC_HDREG_H
4#define __ASM_GENERIC_HDREG_H
5
6typedef unsigned long ide_ioreg_t;
7
8#endif /* __ASM_GENERIC_HDREG_H */
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
new file mode 100644
index 000000000000..a96b5d986b6e
--- /dev/null
+++ b/include/asm-generic/page.h
@@ -0,0 +1,26 @@
1#ifndef _ASM_GENERIC_PAGE_H
2#define _ASM_GENERIC_PAGE_H
3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__
6
7#include <linux/compiler.h>
8
9/* Pure 2^n version of get_order */
10static __inline__ __attribute_const__ int get_order(unsigned long size)
11{
12 int order;
13
14 size = (size - 1) >> (PAGE_SHIFT - 1);
15 order = -1;
16 do {
17 size >>= 1;
18 order++;
19 } while (size);
20 return order;
21}
22
23#endif /* __ASSEMBLY__ */
24#endif /* __KERNEL__ */
25
26#endif /* _ASM_GENERIC_PAGE_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index f40593565173..f86c1e549466 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -101,6 +101,22 @@ do { \
101}) 101})
102#endif 102#endif
103 103
104#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
105#define ptep_get_and_clear_full(__mm, __address, __ptep, __full) \
106({ \
107 pte_t __pte; \
108 __pte = ptep_get_and_clear((__mm), (__address), (__ptep)); \
109 __pte; \
110})
111#endif
112
113#ifndef __HAVE_ARCH_PTE_CLEAR_FULL
114#define pte_clear_full(__mm, __address, __ptep, __full) \
115do { \
116 pte_clear((__mm), (__address), (__ptep)); \
117} while (0)
118#endif
119
104#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH 120#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
105#define ptep_clear_flush(__vma, __address, __ptep) \ 121#define ptep_clear_flush(__vma, __address, __ptep) \
106({ \ 122({ \
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 450eae22c39a..886dbd116899 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -12,5 +12,6 @@ extern char _sextratext[] __attribute__((weak));
12extern char _eextratext[] __attribute__((weak)); 12extern char _eextratext[] __attribute__((weak));
13extern char _end[]; 13extern char _end[];
14extern char __per_cpu_start[], __per_cpu_end[]; 14extern char __per_cpu_start[], __per_cpu_end[];
15extern char __kprobes_text_start[], __kprobes_text_end[];
15 16
16#endif /* _ASM_GENERIC_SECTIONS_H_ */ 17#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 6c90f0f36eec..4dc8ddb401c1 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -16,9 +16,9 @@
16 * The main single-value unaligned transfer routines. 16 * The main single-value unaligned transfer routines.
17 */ 17 */
18#define get_unaligned(ptr) \ 18#define get_unaligned(ptr) \
19 ((__typeof__(*(ptr)))__get_unaligned((ptr), sizeof(*(ptr)))) 19 __get_unaligned((ptr), sizeof(*(ptr)))
20#define put_unaligned(x,ptr) \ 20#define put_unaligned(x,ptr) \
21 __put_unaligned((unsigned long)(x), (ptr), sizeof(*(ptr))) 21 __put_unaligned((__u64)(x), (ptr), sizeof(*(ptr)))
22 22
23/* 23/*
24 * This function doesn't actually exist. The idea is that when 24 * This function doesn't actually exist. The idea is that when
@@ -36,19 +36,19 @@ struct __una_u16 { __u16 x __attribute__((packed)); };
36 * Elemental unaligned loads 36 * Elemental unaligned loads
37 */ 37 */
38 38
39static inline unsigned long __uldq(const __u64 *addr) 39static inline __u64 __uldq(const __u64 *addr)
40{ 40{
41 const struct __una_u64 *ptr = (const struct __una_u64 *) addr; 41 const struct __una_u64 *ptr = (const struct __una_u64 *) addr;
42 return ptr->x; 42 return ptr->x;
43} 43}
44 44
45static inline unsigned long __uldl(const __u32 *addr) 45static inline __u32 __uldl(const __u32 *addr)
46{ 46{
47 const struct __una_u32 *ptr = (const struct __una_u32 *) addr; 47 const struct __una_u32 *ptr = (const struct __una_u32 *) addr;
48 return ptr->x; 48 return ptr->x;
49} 49}
50 50
51static inline unsigned long __uldw(const __u16 *addr) 51static inline __u16 __uldw(const __u16 *addr)
52{ 52{
53 const struct __una_u16 *ptr = (const struct __una_u16 *) addr; 53 const struct __una_u16 *ptr = (const struct __una_u16 *) addr;
54 return ptr->x; 54 return ptr->x;
@@ -78,7 +78,7 @@ static inline void __ustw(__u16 val, __u16 *addr)
78 78
79#define __get_unaligned(ptr, size) ({ \ 79#define __get_unaligned(ptr, size) ({ \
80 const void *__gu_p = ptr; \ 80 const void *__gu_p = ptr; \
81 unsigned long val; \ 81 __typeof__(*(ptr)) val; \
82 switch (size) { \ 82 switch (size) { \
83 case 1: \ 83 case 1: \
84 val = *(const __u8 *)__gu_p; \ 84 val = *(const __u8 *)__gu_p; \
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b3bb326ae5b6..6f857be2b644 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -6,6 +6,9 @@
6#define VMLINUX_SYMBOL(_sym_) _sym_ 6#define VMLINUX_SYMBOL(_sym_) _sym_
7#endif 7#endif
8 8
9/* Align . to a 8 byte boundary equals to maximum function alignment. */
10#define ALIGN_FUNCTION() . = ALIGN(8)
11
9#define RODATA \ 12#define RODATA \
10 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 13 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
11 *(.rodata) *(.rodata.*) \ 14 *(.rodata) *(.rodata.*) \
@@ -79,12 +82,24 @@
79 VMLINUX_SYMBOL(__security_initcall_end) = .; \ 82 VMLINUX_SYMBOL(__security_initcall_end) = .; \
80 } 83 }
81 84
85/* sched.text is aling to function alignment to secure we have same
86 * address even at second ld pass when generating System.map */
82#define SCHED_TEXT \ 87#define SCHED_TEXT \
88 ALIGN_FUNCTION(); \
83 VMLINUX_SYMBOL(__sched_text_start) = .; \ 89 VMLINUX_SYMBOL(__sched_text_start) = .; \
84 *(.sched.text) \ 90 *(.sched.text) \
85 VMLINUX_SYMBOL(__sched_text_end) = .; 91 VMLINUX_SYMBOL(__sched_text_end) = .;
86 92
93/* spinlock.text is aling to function alignment to secure we have same
94 * address even at second ld pass when generating System.map */
87#define LOCK_TEXT \ 95#define LOCK_TEXT \
96 ALIGN_FUNCTION(); \
88 VMLINUX_SYMBOL(__lock_text_start) = .; \ 97 VMLINUX_SYMBOL(__lock_text_start) = .; \
89 *(.spinlock.text) \ 98 *(.spinlock.text) \
90 VMLINUX_SYMBOL(__lock_text_end) = .; 99 VMLINUX_SYMBOL(__lock_text_end) = .;
100
101#define KPROBES_TEXT \
102 ALIGN_FUNCTION(); \
103 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
104 *(.kprobes.text) \
105 VMLINUX_SYMBOL(__kprobes_text_end) = .;
diff --git a/include/asm-h8300/auxvec.h b/include/asm-h8300/auxvec.h
new file mode 100644
index 000000000000..1d36fe38b088
--- /dev/null
+++ b/include/asm-h8300/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMH8300_AUXVEC_H
2#define __ASMH8300_AUXVEC_H
3
4#endif
diff --git a/include/asm-h8300/fcntl.h b/include/asm-h8300/fcntl.h
index 355350a57bf9..1952cb2e3b06 100644
--- a/include/asm-h8300/fcntl.h
+++ b/include/asm-h8300/fcntl.h
@@ -1,87 +1,11 @@
1#ifndef _H8300_FCNTL_H 1#ifndef _H8300_FCNTL_H
2#define _H8300_FCNTL_H 2#define _H8300_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */ 4#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */ 5#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 6#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0400000 7#define O_LARGEFILE 0400000
23#define O_NOATIME 01000000
24 8
25#define F_DUPFD 0 /* dup */ 9#include <asm-generic/fcntl.h>
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33 10
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif /* _H8300_FCNTL_H */ 11#endif /* _H8300_FCNTL_H */
diff --git a/include/asm-h8300/futex.h b/include/asm-h8300/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-h8300/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-h8300/hdreg.h b/include/asm-h8300/hdreg.h
deleted file mode 100644
index 36d0c06687d8..000000000000
--- a/include/asm-h8300/hdreg.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * linux/include/asm-h8300/hdreg.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7#warning this file is obsolete, please do not use it
8
9#ifndef _H8300_HDREG_H
10#define _H8300_HDREG_H
11
12typedef unsigned int q40ide_ioreg_t;
13typedef unsigned char * ide_ioreg_t;
14
15#endif /* _H8300_HDREG_H */
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index e3b7960d445b..e8c02b8c2d99 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -54,20 +54,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
54/* to align the pointer to the (next) page boundary */ 54/* to align the pointer to the (next) page boundary */
55#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 55#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
56 56
57/* Pure 2^n version of get_order */
58extern __inline__ int get_order(unsigned long size)
59{
60 int order;
61
62 size = (size-1) >> (PAGE_SHIFT-1);
63 order = -1;
64 do {
65 size >>= 1;
66 order++;
67 } while (size);
68 return order;
69}
70
71extern unsigned long memory_start; 57extern unsigned long memory_start;
72extern unsigned long memory_end; 58extern unsigned long memory_end;
73 59
@@ -101,4 +87,6 @@ extern unsigned long memory_end;
101 87
102#endif /* __KERNEL__ */ 88#endif /* __KERNEL__ */
103 89
90#include <asm-generic/page.h>
91
104#endif /* _H8300_PAGE_H */ 92#endif /* _H8300_PAGE_H */
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index af33b8525dcf..d98cf85bafc1 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
index 21f4fc07ac0e..bf91e0d4dde7 100644
--- a/include/asm-h8300/types.h
+++ b/include/asm-h8300/types.h
@@ -58,8 +58,6 @@ typedef u32 dma_addr_t;
58#define HAVE_SECTOR_T 58#define HAVE_SECTOR_T
59typedef u64 sector_t; 59typedef u64 sector_t;
60 60
61typedef unsigned int kmem_bufctl_t;
62
63#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
64 62
65#endif /* __ASSEMBLY__ */ 63#endif /* __ASSEMBLY__ */
diff --git a/include/asm-h8300/uaccess.h b/include/asm-h8300/uaccess.h
index 1480f307a474..ebe58c6c8387 100644
--- a/include/asm-h8300/uaccess.h
+++ b/include/asm-h8300/uaccess.h
@@ -24,12 +24,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
24 return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend)); 24 return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend));
25} 25}
26 26
27/* this function will go away soon - use access_ok() instead */
28static inline int __deprecated verify_area(int type, const void *addr, unsigned long size)
29{
30 return access_ok(type,addr,size)?0:-EFAULT;
31}
32
33/* 27/*
34 * The exception table consists of pairs of addresses: the first is the 28 * The exception table consists of pairs of addresses: the first is the
35 * address of an instruction that is allowed to fault, and the second is 29 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-i386/agp.h b/include/asm-i386/agp.h
index b82f5f3ab887..9075083bab76 100644
--- a/include/asm-i386/agp.h
+++ b/include/asm-i386/agp.h
@@ -19,7 +19,7 @@ int unmap_page_from_agp(struct page *page);
19/* Could use CLFLUSH here if the cpu supports it. But then it would 19/* Could use CLFLUSH here if the cpu supports it. But then it would
20 need to be called for each cacheline of the whole page so it may not be 20 need to be called for each cacheline of the whole page so it may not be
21 worth it. Would need a page for it. */ 21 worth it. Would need a page for it. */
22#define flush_agp_cache() asm volatile("wbinvd":::"memory") 22#define flush_agp_cache() wbinvd()
23 23
24/* Convert a physical address to an address suitable for the GART. */ 24/* Convert a physical address to an address suitable for the GART. */
25#define phys_to_gart(x) (x) 25#define phys_to_gart(x) (x)
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h
index a96a8f48fbfc..03185cef8e0a 100644
--- a/include/asm-i386/apicdef.h
+++ b/include/asm-i386/apicdef.h
@@ -16,6 +16,7 @@
16#define GET_APIC_VERSION(x) ((x)&0xFF) 16#define GET_APIC_VERSION(x) ((x)&0xFF)
17#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF) 17#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF)
18#define APIC_INTEGRATED(x) ((x)&0xF0) 18#define APIC_INTEGRATED(x) ((x)&0xF0)
19#define APIC_XAPIC(x) ((x) >= 0x14)
19#define APIC_TASKPRI 0x80 20#define APIC_TASKPRI 0x80
20#define APIC_TPRI_MASK 0xFF 21#define APIC_TPRI_MASK 0xFF
21#define APIC_ARBPRI 0x90 22#define APIC_ARBPRI 0x90
diff --git a/include/asm-i386/auxvec.h b/include/asm-i386/auxvec.h
new file mode 100644
index 000000000000..395e13016bfb
--- /dev/null
+++ b/include/asm-i386/auxvec.h
@@ -0,0 +1,11 @@
1#ifndef __ASMi386_AUXVEC_H
2#define __ASMi386_AUXVEC_H
3
4/*
5 * Architecture-neutral AT_ values in 0-17, leave some room
6 * for more of them, start the x86-specific ones at 32.
7 */
8#define AT_SYSINFO 32
9#define AT_SYSINFO_EHDR 33
10
11#endif
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 6789fc275da3..ea54540638d2 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -118,7 +118,10 @@ static void __init check_hlt(void)
118 printk("disabled\n"); 118 printk("disabled\n");
119 return; 119 return;
120 } 120 }
121 __asm__ __volatile__("hlt ; hlt ; hlt ; hlt"); 121 halt();
122 halt();
123 halt();
124 halt();
122 printk("OK.\n"); 125 printk("OK.\n");
123} 126}
124 127
diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h
index f949e44c2a35..67d3630c4e89 100644
--- a/include/asm-i386/checksum.h
+++ b/include/asm-i386/checksum.h
@@ -83,7 +83,7 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
83 "adcl $0, %0 ;\n" 83 "adcl $0, %0 ;\n"
84 "notl %0 ;\n" 84 "notl %0 ;\n"
85"2: ;\n" 85"2: ;\n"
86 /* Since the input registers which are loaded with iph and ipl 86 /* Since the input registers which are loaded with iph and ihl
87 are modified, we must also specify them as outputs, or gcc 87 are modified, we must also specify them as outputs, or gcc
88 will assume they contain their original values. */ 88 will assume they contain their original values. */
89 : "=r" (sum), "=r" (iph), "=r" (ihl) 89 : "=r" (sum), "=r" (iph), "=r" (ihl)
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 11e67811a990..6df1a53c190e 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -27,8 +27,18 @@ struct Xgt_desc_struct {
27 27
28extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS]; 28extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS];
29 29
30#define load_TR_desc() __asm__ __volatile__("ltr %%ax"::"a" (GDT_ENTRY_TSS*8)) 30#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
31#define load_LDT_desc() __asm__ __volatile__("lldt %%ax"::"a" (GDT_ENTRY_LDT*8)) 31#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
32
33#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr))
34#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr))
35#define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr))
36#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt))
37
38#define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr))
39#define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr))
40#define store_tr(tr) __asm__ ("str %0":"=mr" (tr))
41#define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt))
32 42
33/* 43/*
34 * This is the ldt that every process will get unless we need 44 * This is the ldt that every process will get unless we need
@@ -39,14 +49,14 @@ extern void set_intr_gate(unsigned int irq, void * addr);
39 49
40#define _set_tssldt_desc(n,addr,limit,type) \ 50#define _set_tssldt_desc(n,addr,limit,type) \
41__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ 51__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
42 "movw %%ax,2(%2)\n\t" \ 52 "movw %w1,2(%2)\n\t" \
43 "rorl $16,%%eax\n\t" \ 53 "rorl $16,%1\n\t" \
44 "movb %%al,4(%2)\n\t" \ 54 "movb %b1,4(%2)\n\t" \
45 "movb %4,5(%2)\n\t" \ 55 "movb %4,5(%2)\n\t" \
46 "movb $0,6(%2)\n\t" \ 56 "movb $0,6(%2)\n\t" \
47 "movb %%ah,7(%2)\n\t" \ 57 "movb %h1,7(%2)\n\t" \
48 "rorl $16,%%eax" \ 58 "rorl $16,%1" \
49 : "=m"(*(n)) : "a" (addr), "r"(n), "ir"(limit), "i"(type)) 59 : "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type))
50 60
51static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) 61static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr)
52{ 62{
@@ -86,6 +96,13 @@ static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size)
86 (info)->seg_not_present == 1 && \ 96 (info)->seg_not_present == 1 && \
87 (info)->useable == 0 ) 97 (info)->useable == 0 )
88 98
99static inline void write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
100{
101 __u32 *lp = (__u32 *)((char *)ldt + entry*8);
102 *lp = entry_a;
103 *(lp+1) = entry_b;
104}
105
89#if TLS_SIZE != 24 106#if TLS_SIZE != 24
90# error update this code. 107# error update this code.
91#endif 108#endif
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 130bdc8c68cf..fa11117d3cfa 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -9,6 +9,7 @@
9#include <asm/user.h> 9#include <asm/user.h>
10#include <asm/processor.h> 10#include <asm/processor.h>
11#include <asm/system.h> /* for savesegment */ 11#include <asm/system.h> /* for savesegment */
12#include <asm/auxvec.h>
12 13
13#include <linux/utsname.h> 14#include <linux/utsname.h>
14 15
@@ -109,13 +110,6 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
109 110
110#define ELF_PLATFORM (system_utsname.machine) 111#define ELF_PLATFORM (system_utsname.machine)
111 112
112/*
113 * Architecture-neutral AT_ values in 0-17, leave some room
114 * for more of them, start the x86-specific ones at 32.
115 */
116#define AT_SYSINFO 32
117#define AT_SYSINFO_EHDR 33
118
119#ifdef __KERNEL__ 113#ifdef __KERNEL__
120#define SET_PERSONALITY(ex, ibcs2) do { } while (0) 114#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
121 115
diff --git a/include/asm-i386/fcntl.h b/include/asm-i386/fcntl.h
index 511cde94a3ed..46ab12db5739 100644
--- a/include/asm-i386/fcntl.h
+++ b/include/asm-i386/fcntl.h
@@ -1,88 +1 @@
1#ifndef _I386_FCNTL_H #include <asm-generic/fcntl.h>
2#define _I386_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECT 040000 /* direct disk access hint */
20#define O_LARGEFILE 0100000
21#define O_DIRECTORY 0200000 /* must be a directory */
22#define O_NOFOLLOW 0400000 /* don't follow links */
23#define O_NOATIME 01000000
24
25#define F_DUPFD 0 /* dup */
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87
88#endif
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
new file mode 100644
index 000000000000..44b9db806474
--- /dev/null
+++ b/include/asm-i386/futex.h
@@ -0,0 +1,108 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/system.h>
9#include <asm/processor.h>
10#include <asm/uaccess.h>
11
12#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
13 __asm__ __volatile ( \
14"1: " insn "\n" \
15"2: .section .fixup,\"ax\"\n\
163: mov %3, %1\n\
17 jmp 2b\n\
18 .previous\n\
19 .section __ex_table,\"a\"\n\
20 .align 8\n\
21 .long 1b,3b\n\
22 .previous" \
23 : "=r" (oldval), "=r" (ret), "=m" (*uaddr) \
24 : "i" (-EFAULT), "m" (*uaddr), "0" (oparg), "1" (0))
25
26#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
27 __asm__ __volatile ( \
28"1: movl %2, %0\n\
29 movl %0, %3\n" \
30 insn "\n" \
31"2: " LOCK_PREFIX "cmpxchgl %3, %2\n\
32 jnz 1b\n\
333: .section .fixup,\"ax\"\n\
344: mov %5, %1\n\
35 jmp 3b\n\
36 .previous\n\
37 .section __ex_table,\"a\"\n\
38 .align 8\n\
39 .long 1b,4b,2b,4b\n\
40 .previous" \
41 : "=&a" (oldval), "=&r" (ret), "=m" (*uaddr), \
42 "=&r" (tem) \
43 : "r" (oparg), "i" (-EFAULT), "m" (*uaddr), "1" (0))
44
45static inline int
46futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
47{
48 int op = (encoded_op >> 28) & 7;
49 int cmp = (encoded_op >> 24) & 15;
50 int oparg = (encoded_op << 8) >> 20;
51 int cmparg = (encoded_op << 20) >> 20;
52 int oldval = 0, ret, tem;
53 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
54 oparg = 1 << oparg;
55
56 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
57 return -EFAULT;
58
59 inc_preempt_count();
60
61 if (op == FUTEX_OP_SET)
62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
63 else {
64#ifndef CONFIG_X86_BSWAP
65 if (boot_cpu_data.x86 == 3)
66 ret = -ENOSYS;
67 else
68#endif
69 switch (op) {
70 case FUTEX_OP_ADD:
71 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret,
72 oldval, uaddr, oparg);
73 break;
74 case FUTEX_OP_OR:
75 __futex_atomic_op2("orl %4, %3", ret, oldval, uaddr,
76 oparg);
77 break;
78 case FUTEX_OP_ANDN:
79 __futex_atomic_op2("andl %4, %3", ret, oldval, uaddr,
80 ~oparg);
81 break;
82 case FUTEX_OP_XOR:
83 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr,
84 oparg);
85 break;
86 default:
87 ret = -ENOSYS;
88 }
89 }
90
91 dec_preempt_count();
92
93 if (!ret) {
94 switch (cmp) {
95 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
96 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
97 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
98 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
99 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
100 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
101 default: ret = -ENOSYS;
102 }
103 }
104 return ret;
105}
106
107#endif
108#endif
diff --git a/include/asm-i386/hdreg.h b/include/asm-i386/hdreg.h
deleted file mode 100644
index 5989bbc97cbf..000000000000
--- a/include/asm-i386/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#warning this file is obsolete, please do not use it
diff --git a/include/asm-i386/kdebug.h b/include/asm-i386/kdebug.h
index b3f8d5f59d5d..316138e89910 100644
--- a/include/asm-i386/kdebug.h
+++ b/include/asm-i386/kdebug.h
@@ -41,9 +41,16 @@ enum die_val {
41 DIE_PAGE_FAULT, 41 DIE_PAGE_FAULT,
42}; 42};
43 43
44static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) 44static inline int notify_die(enum die_val val, const char *str,
45 struct pt_regs *regs, long err, int trap, int sig)
45{ 46{
46 struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; 47 struct die_args args = {
48 .regs = regs,
49 .str = str,
50 .err = err,
51 .trapnr = trap,
52 .signr = sig
53 };
47 return notifier_call_chain(&i386die_chain, val, &args); 54 return notifier_call_chain(&i386die_chain, val, &args);
48} 55}
49 56
diff --git a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
index 85809e0898d7..28a84f6185a7 100644
--- a/include/asm-i386/mach-es7000/mach_mpparse.h
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_MACH_MPPARSE_H 1#ifndef __ASM_MACH_MPPARSE_H
2#define __ASM_MACH_MPPARSE_H 2#define __ASM_MACH_MPPARSE_H
3 3
4#include <linux/acpi.h>
5
4static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, 6static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
5 struct mpc_config_translation *translation) 7 struct mpc_config_translation *translation)
6{ 8{
@@ -12,8 +14,9 @@ static inline void mpc_oem_pci_bus(struct mpc_config_bus *m,
12{ 14{
13} 15}
14 16
15extern int parse_unisys_oem (char *oemptr, int oem_entries); 17extern int parse_unisys_oem (char *oemptr);
16extern int find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length); 18extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
19extern void setup_unisys();
17 20
18static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, 21static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
19 char *productid) 22 char *productid)
@@ -22,18 +25,33 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
22 struct mp_config_oemtable *oem_table = 25 struct mp_config_oemtable *oem_table =
23 (struct mp_config_oemtable *)mpc->mpc_oemptr; 26 (struct mp_config_oemtable *)mpc->mpc_oemptr;
24 if (!strncmp(oem, "UNISYS", 6)) 27 if (!strncmp(oem, "UNISYS", 6))
25 return parse_unisys_oem((char *)oem_table, oem_table->oem_length); 28 return parse_unisys_oem((char *)oem_table);
26 } 29 }
27 return 0; 30 return 0;
28} 31}
29 32
33static inline int es7000_check_dsdt()
34{
35 struct acpi_table_header *header = NULL;
36 if(!acpi_get_table_header_early(ACPI_DSDT, &header))
37 acpi_table_print(header, 0);
38 if (!strncmp(header->oem_id, "UNISYS", 6))
39 return 1;
40 return 0;
41}
42
30/* Hook from generic ACPI tables.c */ 43/* Hook from generic ACPI tables.c */
31static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) 44static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
32{ 45{
33 unsigned long oem_addr; 46 unsigned long oem_addr;
34 int oem_entries; 47 if (!find_unisys_acpi_oem_table(&oem_addr)) {
35 if (!find_unisys_acpi_oem_table(&oem_addr, &oem_entries)) 48 if (es7000_check_dsdt())
36 return parse_unisys_oem((char *)oem_addr, oem_entries); 49 return parse_unisys_oem((char *)oem_addr);
50 else {
51 setup_unisys();
52 return 1;
53 }
54 }
37 return 0; 55 return 0;
38} 56}
39 57
diff --git a/include/asm-i386/mach-generic/mach_apic.h b/include/asm-i386/mach-generic/mach_apic.h
index b13767a4e934..d9dc039da94a 100644
--- a/include/asm-i386/mach-generic/mach_apic.h
+++ b/include/asm-i386/mach-generic/mach_apic.h
@@ -28,4 +28,6 @@
28#define enable_apic_mode (genapic->enable_apic_mode) 28#define enable_apic_mode (genapic->enable_apic_mode)
29#define phys_pkg_id (genapic->phys_pkg_id) 29#define phys_pkg_id (genapic->phys_pkg_id)
30 30
31extern void generic_bigsmp_probe(void);
32
31#endif /* __ASM_MACH_APIC_H */ 33#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
index d9fafba075bc..d84a9c326c22 100644
--- a/include/asm-i386/mpspec.h
+++ b/include/asm-i386/mpspec.h
@@ -11,6 +11,7 @@ extern int mp_bus_id_to_local [MAX_MP_BUSSES];
11extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; 11extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
12extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; 12extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
13 13
14extern unsigned int def_to_bigsmp;
14extern unsigned int boot_cpu_physical_apicid; 15extern unsigned int boot_cpu_physical_apicid;
15extern int smp_found_config; 16extern int smp_found_config;
16extern void find_smp_config (void); 17extern void find_smp_config (void);
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index c76fce8badbb..62b76cd96957 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -47,6 +47,21 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
47 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ 47 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\
48 ret__; }) 48 ret__; })
49 49
50/* rdmsr with exception handling */
51#define rdmsr_safe(msr,a,b) ({ int ret__; \
52 asm volatile("2: rdmsr ; xorl %0,%0\n" \
53 "1:\n\t" \
54 ".section .fixup,\"ax\"\n\t" \
55 "3: movl %4,%0 ; jmp 1b\n\t" \
56 ".previous\n\t" \
57 ".section __ex_table,\"a\"\n" \
58 " .align 4\n\t" \
59 " .long 2b,3b\n\t" \
60 ".previous" \
61 : "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \
62 : "c" (msr), "i" (-EFAULT));\
63 ret__; })
64
50#define rdtsc(low,high) \ 65#define rdtsc(low,high) \
51 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) 66 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
52 67
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 8d93f732d72d..73296d9924fb 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -68,7 +68,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
68#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 68#define HPAGE_MASK (~(HPAGE_SIZE - 1))
69#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 69#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
70#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 70#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
71#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
72#endif 71#endif
73 72
74#define pgd_val(x) ((x).pgd) 73#define pgd_val(x) ((x).pgd)
@@ -104,20 +103,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
104 */ 103 */
105extern unsigned int __VMALLOC_RESERVE; 104extern unsigned int __VMALLOC_RESERVE;
106 105
107/* Pure 2^n version of get_order */
108static __inline__ int get_order(unsigned long size)
109{
110 int order;
111
112 size = (size-1) >> (PAGE_SHIFT-1);
113 order = -1;
114 do {
115 size >>= 1;
116 order++;
117 } while (size);
118 return order;
119}
120
121extern int sysctl_legacy_va_layout; 106extern int sysctl_legacy_va_layout;
122 107
123extern int page_is_ram(unsigned long pagenr); 108extern int page_is_ram(unsigned long pagenr);
@@ -156,4 +141,6 @@ extern int page_is_ram(unsigned long pagenr);
156 141
157#endif /* __KERNEL__ */ 142#endif /* __KERNEL__ */
158 143
144#include <asm-generic/page.h>
145
159#endif /* _I386_PAGE_H */ 146#endif /* _I386_PAGE_H */
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 2cbab30734d6..78c85985aee3 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -18,9 +18,11 @@ extern unsigned int pcibios_assign_all_busses(void);
18#define pcibios_scan_all_fns(a, b) 0 18#define pcibios_scan_all_fns(a, b) 0
19 19
20extern unsigned long pci_mem_start; 20extern unsigned long pci_mem_start;
21#define PCIBIOS_MIN_IO 0x4000 21#define PCIBIOS_MIN_IO 0x1000
22#define PCIBIOS_MIN_MEM (pci_mem_start) 22#define PCIBIOS_MIN_MEM (pci_mem_start)
23 23
24#define PCIBIOS_MIN_CARDBUS_IO 0x4000
25
24void pcibios_config_init(void); 26void pcibios_config_init(void);
25struct pci_bus * pcibios_scan_root(int bus); 27struct pci_bus * pcibios_scan_root(int bus);
26 28
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index d609f9c2c1f0..2e3f4a344a2d 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -64,7 +64,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
64#define set_pmd(pmdptr,pmdval) \ 64#define set_pmd(pmdptr,pmdval) \
65 set_64bit((unsigned long long *)(pmdptr),pmd_val(pmdval)) 65 set_64bit((unsigned long long *)(pmdptr),pmd_val(pmdval))
66#define set_pud(pudptr,pudval) \ 66#define set_pud(pudptr,pudval) \
67 set_64bit((unsigned long long *)(pudptr),pud_val(pudval)) 67 (*(pudptr) = (pudval))
68 68
69/* 69/*
70 * Pentium-II erratum A13: in PAE mode we explicitly have to flush 70 * Pentium-II erratum A13: in PAE mode we explicitly have to flush
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 77c6497f416e..47bc1ffa3d4c 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -86,9 +86,7 @@ void paging_init(void);
86#endif 86#endif
87 87
88/* 88/*
89 * The 4MB page is guessing.. Detailed in the infamous "Chapter H" 89 * _PAGE_PSE set in the page directory entry just means that
90 * of the Pentium details, but assuming intel did the straightforward
91 * thing, this bit set in the page directory entry just means that
92 * the page directory entry points directly to a 4MB-aligned block of 90 * the page directory entry points directly to a 4MB-aligned block of
93 * memory. 91 * memory.
94 */ 92 */
@@ -119,8 +117,10 @@ void paging_init(void);
119#define _PAGE_UNUSED2 0x400 117#define _PAGE_UNUSED2 0x400
120#define _PAGE_UNUSED3 0x800 118#define _PAGE_UNUSED3 0x800
121 119
122#define _PAGE_FILE 0x040 /* set:pagecache unset:swap */ 120/* If _PAGE_PRESENT is clear, we use these: */
123#define _PAGE_PROTNONE 0x080 /* If not present */ 121#define _PAGE_FILE 0x040 /* nonlinear file mapping, saved PTE; unset:swap */
122#define _PAGE_PROTNONE 0x080 /* if the user mapped it with PROT_NONE;
123 pte_present gives true */
124#ifdef CONFIG_X86_PAE 124#ifdef CONFIG_X86_PAE
125#define _PAGE_NX (1ULL<<_PAGE_BIT_NX) 125#define _PAGE_NX (1ULL<<_PAGE_BIT_NX)
126#else 126#else
@@ -215,11 +215,13 @@ extern unsigned long pg0[];
215 * The following only work if pte_present() is true. 215 * The following only work if pte_present() is true.
216 * Undefined behaviour if not.. 216 * Undefined behaviour if not..
217 */ 217 */
218#define __LARGE_PTE (_PAGE_PSE | _PAGE_PRESENT)
218static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } 219static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
219static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } 220static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
220static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } 221static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
221static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } 222static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
222static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } 223static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; }
224static inline int pte_huge(pte_t pte) { return ((pte).pte_low & __LARGE_PTE) == __LARGE_PTE; }
223 225
224/* 226/*
225 * The following only works if pte_present() is not true. 227 * The following only works if pte_present() is not true.
@@ -236,7 +238,7 @@ static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return
236static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } 238static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
237static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } 239static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
238static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 240static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
239static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; } 241static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= __LARGE_PTE; return pte; }
240 242
241#ifdef CONFIG_X86_PAE 243#ifdef CONFIG_X86_PAE
242# include <asm/pgtable-3level.h> 244# include <asm/pgtable-3level.h>
@@ -258,12 +260,39 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned
258 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); 260 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low);
259} 261}
260 262
263static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
264{
265 pte_t pte;
266 if (full) {
267 pte = *ptep;
268 *ptep = __pte(0);
269 } else {
270 pte = ptep_get_and_clear(mm, addr, ptep);
271 }
272 return pte;
273}
274
261static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 275static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
262{ 276{
263 clear_bit(_PAGE_BIT_RW, &ptep->pte_low); 277 clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
264} 278}
265 279
266/* 280/*
281 * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
282 *
283 * dst - pointer to pgd range anwhere on a pgd page
284 * src - ""
285 * count - the number of pgds to copy.
286 *
287 * dst and src can be on the same page, but the range must not overlap,
288 * and must not cross a page boundary.
289 */
290static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
291{
292 memcpy(dst, src, count * sizeof(pgd_t));
293}
294
295/*
267 * Macro to mark a page protection value as "uncacheable". On processors which do not support 296 * Macro to mark a page protection value as "uncacheable". On processors which do not support
268 * it, this is a no-op. 297 * it, this is a no-op.
269 */ 298 */
@@ -415,6 +444,7 @@ extern void noexec_setup(const char *str);
415#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 444#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
416#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 445#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
417#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 446#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
447#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
418#define __HAVE_ARCH_PTEP_SET_WRPROTECT 448#define __HAVE_ARCH_PTEP_SET_WRPROTECT
419#define __HAVE_ARCH_PTE_SAME 449#define __HAVE_ARCH_PTE_SAME
420#include <asm-generic/pgtable.h> 450#include <asm-generic/pgtable.h>
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 5d06e6bd6ba0..37bef8ed7bed 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -29,7 +29,7 @@ struct desc_struct {
29}; 29};
30 30
31#define desc_empty(desc) \ 31#define desc_empty(desc) \
32 (!((desc)->a + (desc)->b)) 32 (!((desc)->a | (desc)->b))
33 33
34#define desc_equal(desc1, desc2) \ 34#define desc_equal(desc1, desc2) \
35 (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b)) 35 (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
@@ -203,9 +203,7 @@ static inline unsigned int cpuid_edx(unsigned int op)
203 return edx; 203 return edx;
204} 204}
205 205
206#define load_cr3(pgdir) \ 206#define load_cr3(pgdir) write_cr3(__pa(pgdir))
207 asm volatile("movl %0,%%cr3": :"r" (__pa(pgdir)))
208
209 207
210/* 208/*
211 * Intel CPU features in CR4 209 * Intel CPU features in CR4
@@ -232,22 +230,20 @@ extern unsigned long mmu_cr4_features;
232 230
233static inline void set_in_cr4 (unsigned long mask) 231static inline void set_in_cr4 (unsigned long mask)
234{ 232{
233 unsigned cr4;
235 mmu_cr4_features |= mask; 234 mmu_cr4_features |= mask;
236 __asm__("movl %%cr4,%%eax\n\t" 235 cr4 = read_cr4();
237 "orl %0,%%eax\n\t" 236 cr4 |= mask;
238 "movl %%eax,%%cr4\n" 237 write_cr4(cr4);
239 : : "irg" (mask)
240 :"ax");
241} 238}
242 239
243static inline void clear_in_cr4 (unsigned long mask) 240static inline void clear_in_cr4 (unsigned long mask)
244{ 241{
242 unsigned cr4;
245 mmu_cr4_features &= ~mask; 243 mmu_cr4_features &= ~mask;
246 __asm__("movl %%cr4,%%eax\n\t" 244 cr4 = read_cr4();
247 "andl %0,%%eax\n\t" 245 cr4 &= ~mask;
248 "movl %%eax,%%cr4\n" 246 write_cr4(cr4);
249 : : "irg" (~mask)
250 :"ax");
251} 247}
252 248
253/* 249/*
@@ -281,6 +277,11 @@ static inline void clear_in_cr4 (unsigned long mask)
281 outb((data), 0x23); \ 277 outb((data), 0x23); \
282} while (0) 278} while (0)
283 279
280static inline void serialize_cpu(void)
281{
282 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
283}
284
284static inline void __monitor(const void *eax, unsigned long ecx, 285static inline void __monitor(const void *eax, unsigned long ecx,
285 unsigned long edx) 286 unsigned long edx)
286{ 287{
@@ -454,6 +455,7 @@ struct thread_struct {
454 unsigned int saved_fs, saved_gs; 455 unsigned int saved_fs, saved_gs;
455/* IO permissions */ 456/* IO permissions */
456 unsigned long *io_bitmap_ptr; 457 unsigned long *io_bitmap_ptr;
458 unsigned long iopl;
457/* max allowed port in the bitmap, in bytes: */ 459/* max allowed port in the bitmap, in bytes: */
458 unsigned long io_bitmap_max; 460 unsigned long io_bitmap_max;
459}; 461};
@@ -474,7 +476,6 @@ struct thread_struct {
474 .esp0 = sizeof(init_stack) + (long)&init_stack, \ 476 .esp0 = sizeof(init_stack) + (long)&init_stack, \
475 .ss0 = __KERNEL_DS, \ 477 .ss0 = __KERNEL_DS, \
476 .ss1 = __KERNEL_CS, \ 478 .ss1 = __KERNEL_CS, \
477 .ldt = GDT_ENTRY_LDT, \
478 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ 479 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
479 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ 480 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \
480} 481}
@@ -511,6 +512,21 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa
511 : /* no output */ \ 512 : /* no output */ \
512 :"r" (value)) 513 :"r" (value))
513 514
515/*
516 * Set IOPL bits in EFLAGS from given mask
517 */
518static inline void set_iopl_mask(unsigned mask)
519{
520 unsigned int reg;
521 __asm__ __volatile__ ("pushfl;"
522 "popl %0;"
523 "andl %1, %0;"
524 "orl %2, %0;"
525 "pushl %0;"
526 "popfl"
527 : "=&r" (reg)
528 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
529}
514 530
515/* Forward declaration, a strange C thing */ 531/* Forward declaration, a strange C thing */
516struct task_struct; 532struct task_struct;
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index 05532875e39e..7e0f2945d17d 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -61,6 +61,13 @@ struct pt_regs {
61struct task_struct; 61struct task_struct;
62extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); 62extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
63 63
64/*
65 * user_mode_vm(regs) determines whether a register set came from user mode.
66 * This is true if V8086 mode was enabled OR if the register set was from
67 * protected mode with RPL-3 CS value. This tricky test checks that with
68 * one comparison. Many places in the kernel can bypass this full check
69 * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
70 */
64static inline int user_mode(struct pt_regs *regs) 71static inline int user_mode(struct pt_regs *regs)
65{ 72{
66 return (regs->xcs & 3) != 0; 73 return (regs->xcs & 3) != 0;
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index 7a32184d54bf..826a8ca50ac8 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -44,7 +44,7 @@ extern unsigned char boot_params[PARAM_SIZE];
44#define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4))) 44#define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4)))
45#define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8))) 45#define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8)))
46#define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc))) 46#define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc)))
47#define EFI_MEMMAP ((efi_memory_desc_t *) *((unsigned long *)(PARAM+0x1d0))) 47#define EFI_MEMMAP ((void *) *((unsigned long *)(PARAM+0x1d0)))
48#define EFI_MEMMAP_SIZE (*((unsigned long *) (PARAM+0x1d4))) 48#define EFI_MEMMAP_SIZE (*((unsigned long *) (PARAM+0x1d4)))
49#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2)) 49#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
50#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8)) 50#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8))
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index a283738b80b3..13250199976d 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -59,7 +59,7 @@ extern void cpu_uninit(void);
59 59
60extern cpumask_t cpu_callout_map; 60extern cpumask_t cpu_callout_map;
61extern cpumask_t cpu_callin_map; 61extern cpumask_t cpu_callin_map;
62#define cpu_possible_map cpu_callout_map 62extern cpumask_t cpu_possible_map;
63 63
64/* We don't mark CPUs online until __cpu_up(), so we need another measure */ 64/* We don't mark CPUs online until __cpu_up(), so we need another measure */
65static inline int num_booting_cpus(void) 65static inline int num_booting_cpus(void)
diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h
index 07f6b38ad140..802ae76195b7 100644
--- a/include/asm-i386/socket.h
+++ b/include/asm-i386/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 3db717a244f0..acd5c26b69ba 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -14,8 +14,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
14 14
15#define switch_to(prev,next,last) do { \ 15#define switch_to(prev,next,last) do { \
16 unsigned long esi,edi; \ 16 unsigned long esi,edi; \
17 asm volatile("pushfl\n\t" \ 17 asm volatile("pushl %%ebp\n\t" \
18 "pushl %%ebp\n\t" \
19 "movl %%esp,%0\n\t" /* save ESP */ \ 18 "movl %%esp,%0\n\t" /* save ESP */ \
20 "movl %5,%%esp\n\t" /* restore ESP */ \ 19 "movl %5,%%esp\n\t" /* restore ESP */ \
21 "movl $1f,%1\n\t" /* save EIP */ \ 20 "movl $1f,%1\n\t" /* save EIP */ \
@@ -23,7 +22,6 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
23 "jmp __switch_to\n" \ 22 "jmp __switch_to\n" \
24 "1:\t" \ 23 "1:\t" \
25 "popl %%ebp\n\t" \ 24 "popl %%ebp\n\t" \
26 "popfl" \
27 :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ 25 :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
28 "=a" (last),"=S" (esi),"=D" (edi) \ 26 "=a" (last),"=S" (esi),"=D" (edi) \
29 :"m" (next->thread.esp),"m" (next->thread.eip), \ 27 :"m" (next->thread.esp),"m" (next->thread.eip), \
@@ -93,13 +91,13 @@ static inline unsigned long _get_base(char * addr)
93 ".align 4\n\t" \ 91 ".align 4\n\t" \
94 ".long 1b,3b\n" \ 92 ".long 1b,3b\n" \
95 ".previous" \ 93 ".previous" \
96 : :"m" (value)) 94 : :"rm" (value))
97 95
98/* 96/*
99 * Save a segment register away 97 * Save a segment register away
100 */ 98 */
101#define savesegment(seg, value) \ 99#define savesegment(seg, value) \
102 asm volatile("mov %%" #seg ",%0":"=m" (value)) 100 asm volatile("mov %%" #seg ",%0":"=rm" (value))
103 101
104/* 102/*
105 * Clear and set 'TS' bit respectively 103 * Clear and set 'TS' bit respectively
@@ -107,13 +105,33 @@ static inline unsigned long _get_base(char * addr)
107#define clts() __asm__ __volatile__ ("clts") 105#define clts() __asm__ __volatile__ ("clts")
108#define read_cr0() ({ \ 106#define read_cr0() ({ \
109 unsigned int __dummy; \ 107 unsigned int __dummy; \
110 __asm__( \ 108 __asm__ __volatile__( \
111 "movl %%cr0,%0\n\t" \ 109 "movl %%cr0,%0\n\t" \
112 :"=r" (__dummy)); \ 110 :"=r" (__dummy)); \
113 __dummy; \ 111 __dummy; \
114}) 112})
115#define write_cr0(x) \ 113#define write_cr0(x) \
116 __asm__("movl %0,%%cr0": :"r" (x)); 114 __asm__ __volatile__("movl %0,%%cr0": :"r" (x));
115
116#define read_cr2() ({ \
117 unsigned int __dummy; \
118 __asm__ __volatile__( \
119 "movl %%cr2,%0\n\t" \
120 :"=r" (__dummy)); \
121 __dummy; \
122})
123#define write_cr2(x) \
124 __asm__ __volatile__("movl %0,%%cr2": :"r" (x));
125
126#define read_cr3() ({ \
127 unsigned int __dummy; \
128 __asm__ ( \
129 "movl %%cr3,%0\n\t" \
130 :"=r" (__dummy)); \
131 __dummy; \
132})
133#define write_cr3(x) \
134 __asm__ __volatile__("movl %0,%%cr3": :"r" (x));
117 135
118#define read_cr4() ({ \ 136#define read_cr4() ({ \
119 unsigned int __dummy; \ 137 unsigned int __dummy; \
@@ -123,7 +141,7 @@ static inline unsigned long _get_base(char * addr)
123 __dummy; \ 141 __dummy; \
124}) 142})
125#define write_cr4(x) \ 143#define write_cr4(x) \
126 __asm__("movl %0,%%cr4": :"r" (x)); 144 __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
127#define stts() write_cr0(8 | read_cr0()) 145#define stts() write_cr0(8 | read_cr0())
128 146
129#endif /* __KERNEL__ */ 147#endif /* __KERNEL__ */
@@ -447,6 +465,8 @@ struct alt_instr {
447#define local_irq_enable() __asm__ __volatile__("sti": : :"memory") 465#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
448/* used in the idle loop; sti takes one instruction cycle to complete */ 466/* used in the idle loop; sti takes one instruction cycle to complete */
449#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") 467#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
468/* used when interrupts are already enabled or to shutdown the processor */
469#define halt() __asm__ __volatile__("hlt": : :"memory")
450 470
451#define irqs_disabled() \ 471#define irqs_disabled() \
452({ \ 472({ \
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 95add81237ea..e2cb9fa6f563 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -139,6 +139,7 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
139#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 139#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
140#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ 140#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
141#define TIF_IRET 5 /* return with iret */ 141#define TIF_IRET 5 /* return with iret */
142#define TIF_SYSCALL_EMU 6 /* syscall emulation active */
142#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 143#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
143#define TIF_SECCOMP 8 /* secure computing */ 144#define TIF_SECCOMP 8 /* secure computing */
144#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 145#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
@@ -150,13 +151,15 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
150#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 151#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
151#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 152#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
152#define _TIF_IRET (1<<TIF_IRET) 153#define _TIF_IRET (1<<TIF_IRET)
154#define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU)
153#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 155#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
154#define _TIF_SECCOMP (1<<TIF_SECCOMP) 156#define _TIF_SECCOMP (1<<TIF_SECCOMP)
155#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 157#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
156 158
157/* work to do on interrupt/exception return */ 159/* work to do on interrupt/exception return */
158#define _TIF_WORK_MASK \ 160#define _TIF_WORK_MASK \
159 (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|_TIF_SECCOMP)) 161 (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|\
162 _TIF_SECCOMP|_TIF_SYSCALL_EMU))
160/* work to do on any return to u-space */ 163/* work to do on any return to u-space */
161#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 164#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
162 165
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h
index dcf1e07db08a..aed16437479d 100644
--- a/include/asm-i386/timer.h
+++ b/include/asm-i386/timer.h
@@ -1,6 +1,7 @@
1#ifndef _ASMi386_TIMER_H 1#ifndef _ASMi386_TIMER_H
2#define _ASMi386_TIMER_H 2#define _ASMi386_TIMER_H
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/pm.h>
4 5
5/** 6/**
6 * struct timer_ops - used to define a timer source 7 * struct timer_ops - used to define a timer source
@@ -23,6 +24,8 @@ struct timer_opts {
23 unsigned long long (*monotonic_clock)(void); 24 unsigned long long (*monotonic_clock)(void);
24 void (*delay)(unsigned long); 25 void (*delay)(unsigned long);
25 unsigned long (*read_timer)(void); 26 unsigned long (*read_timer)(void);
27 int (*suspend)(pm_message_t state);
28 int (*resume)(void);
26}; 29};
27 30
28struct init_timer_opts { 31struct init_timer_opts {
diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h
index 901b77c42b8a..ced00fe8fe61 100644
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -63,8 +63,6 @@ typedef u64 sector_t;
63#define HAVE_SECTOR_T 63#define HAVE_SECTOR_T
64#endif 64#endif
65 65
66typedef unsigned short kmem_bufctl_t;
67
68#endif /* __ASSEMBLY__ */ 66#endif /* __ASSEMBLY__ */
69 67
70#endif /* __KERNEL__ */ 68#endif /* __KERNEL__ */
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 886867aea947..89ab7e2bc5aa 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -83,30 +83,6 @@ extern struct movsl_mask {
83 */ 83 */
84#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0)) 84#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0))
85 85
86/**
87 * verify_area: - Obsolete/deprecated and will go away soon,
88 * use access_ok() instead.
89 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
90 * @addr: User space pointer to start of block to check
91 * @size: Size of block to check
92 *
93 * Context: User context only. This function may sleep.
94 *
95 * This function has been replaced by access_ok().
96 *
97 * Checks if a pointer to a block of memory in user space is valid.
98 *
99 * Returns zero if the memory block may be valid, -EFAULT
100 * if it is definitely invalid.
101 *
102 * See access_ok() for more details.
103 */
104static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
105{
106 return access_ok(type,addr,size) ? 0 : -EFAULT;
107}
108
109
110/* 86/*
111 * The exception table consists of pairs of addresses: the first is the 87 * The exception table consists of pairs of addresses: the first is the
112 * address of an instruction that is allowed to fault, and the second is 88 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-i386/xor.h b/include/asm-i386/xor.h
index f80e2dbe1b56..23c86cef3b25 100644
--- a/include/asm-i386/xor.h
+++ b/include/asm-i386/xor.h
@@ -535,14 +535,14 @@ static struct xor_block_template xor_block_p5_mmx = {
535 535
536#define XMMS_SAVE do { \ 536#define XMMS_SAVE do { \
537 preempt_disable(); \ 537 preempt_disable(); \
538 cr0 = read_cr0(); \
539 clts(); \
538 __asm__ __volatile__ ( \ 540 __asm__ __volatile__ ( \
539 "movl %%cr0,%0 ;\n\t" \ 541 "movups %%xmm0,(%0) ;\n\t" \
540 "clts ;\n\t" \ 542 "movups %%xmm1,0x10(%0) ;\n\t" \
541 "movups %%xmm0,(%1) ;\n\t" \ 543 "movups %%xmm2,0x20(%0) ;\n\t" \
542 "movups %%xmm1,0x10(%1) ;\n\t" \ 544 "movups %%xmm3,0x30(%0) ;\n\t" \
543 "movups %%xmm2,0x20(%1) ;\n\t" \ 545 : \
544 "movups %%xmm3,0x30(%1) ;\n\t" \
545 : "=&r" (cr0) \
546 : "r" (xmm_save) \ 546 : "r" (xmm_save) \
547 : "memory"); \ 547 : "memory"); \
548} while(0) 548} while(0)
@@ -550,14 +550,14 @@ static struct xor_block_template xor_block_p5_mmx = {
550#define XMMS_RESTORE do { \ 550#define XMMS_RESTORE do { \
551 __asm__ __volatile__ ( \ 551 __asm__ __volatile__ ( \
552 "sfence ;\n\t" \ 552 "sfence ;\n\t" \
553 "movups (%1),%%xmm0 ;\n\t" \ 553 "movups (%0),%%xmm0 ;\n\t" \
554 "movups 0x10(%1),%%xmm1 ;\n\t" \ 554 "movups 0x10(%0),%%xmm1 ;\n\t" \
555 "movups 0x20(%1),%%xmm2 ;\n\t" \ 555 "movups 0x20(%0),%%xmm2 ;\n\t" \
556 "movups 0x30(%1),%%xmm3 ;\n\t" \ 556 "movups 0x30(%0),%%xmm3 ;\n\t" \
557 "movl %0,%%cr0 ;\n\t" \
558 : \ 557 : \
559 : "r" (cr0), "r" (xmm_save) \ 558 : "r" (xmm_save) \
560 : "memory"); \ 559 : "memory"); \
560 write_cr0(cr0); \
561 preempt_enable(); \ 561 preempt_enable(); \
562} while(0) 562} while(0)
563 563
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 4c06d455139c..3a544ffc5008 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -116,6 +116,11 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
116 116
117extern u16 ia64_acpiid_to_sapicid[]; 117extern u16 ia64_acpiid_to_sapicid[];
118 118
119/*
120 * Refer Intel ACPI _PDC support document for bit definitions
121 */
122#define ACPI_PDC_EST_CAPABILITY_SMP 0x8
123
119#endif /*__KERNEL__*/ 124#endif /*__KERNEL__*/
120 125
121#endif /*_ASM_ACPI_H*/ 126#endif /*_ASM_ACPI_H*/
diff --git a/include/asm-ia64/auxvec.h b/include/asm-ia64/auxvec.h
new file mode 100644
index 000000000000..23cebe5685b9
--- /dev/null
+++ b/include/asm-ia64/auxvec.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_IA64_AUXVEC_H
2#define _ASM_IA64_AUXVEC_H
3
4/*
5 * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of
6 * them, start the architecture-specific ones at 32.
7 */
8#define AT_SYSINFO 32
9#define AT_SYSINFO_EHDR 33
10
11#endif /* _ASM_IA64_AUXVEC_H */
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h
index 0c05e5bad8a0..aaf11f4e9169 100644
--- a/include/asm-ia64/compat.h
+++ b/include/asm-ia64/compat.h
@@ -13,10 +13,10 @@ typedef s32 compat_time_t;
13typedef s32 compat_clock_t; 13typedef s32 compat_clock_t;
14typedef s32 compat_key_t; 14typedef s32 compat_key_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u16 compat_uid_t; 16typedef u16 __compat_uid_t;
17typedef u16 compat_gid_t; 17typedef u16 __compat_gid_t;
18typedef u32 compat_uid32_t; 18typedef u32 __compat_uid32_t;
19typedef u32 compat_gid32_t; 19typedef u32 __compat_gid32_t;
20typedef u16 compat_mode_t; 20typedef u16 compat_mode_t;
21typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
22typedef u16 compat_dev_t; 22typedef u16 compat_dev_t;
@@ -50,8 +50,8 @@ struct compat_stat {
50 compat_ino_t st_ino; 50 compat_ino_t st_ino;
51 compat_mode_t st_mode; 51 compat_mode_t st_mode;
52 compat_nlink_t st_nlink; 52 compat_nlink_t st_nlink;
53 compat_uid_t st_uid; 53 __compat_uid_t st_uid;
54 compat_gid_t st_gid; 54 __compat_gid_t st_gid;
55 compat_dev_t st_rdev; 55 compat_dev_t st_rdev;
56 u16 __pad2; 56 u16 __pad2;
57 u32 st_size; 57 u32 st_size;
@@ -120,10 +120,10 @@ typedef u32 compat_sigset_word;
120 120
121struct compat_ipc64_perm { 121struct compat_ipc64_perm {
122 compat_key_t key; 122 compat_key_t key;
123 compat_uid32_t uid; 123 __compat_uid32_t uid;
124 compat_gid32_t gid; 124 __compat_gid32_t gid;
125 compat_uid32_t cuid; 125 __compat_uid32_t cuid;
126 compat_gid32_t cgid; 126 __compat_gid32_t cgid;
127 unsigned short mode; 127 unsigned short mode;
128 unsigned short __pad1; 128 unsigned short __pad1;
129 unsigned short seq; 129 unsigned short seq;
diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h
index 7d4ccc4b976e..446fce036fd9 100644
--- a/include/asm-ia64/elf.h
+++ b/include/asm-ia64/elf.h
@@ -12,6 +12,7 @@
12 12
13#include <asm/fpu.h> 13#include <asm/fpu.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/auxvec.h>
15 16
16/* 17/*
17 * This is used to ensure we don't load something for the wrong architecture. 18 * This is used to ensure we don't load something for the wrong architecture.
@@ -177,13 +178,6 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
177 relevant until we have real hardware to play with... */ 178 relevant until we have real hardware to play with... */
178#define ELF_PLATFORM NULL 179#define ELF_PLATFORM NULL
179 180
180/*
181 * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of
182 * them, start the architecture-specific ones at 32.
183 */
184#define AT_SYSINFO 32
185#define AT_SYSINFO_EHDR 33
186
187#ifdef __KERNEL__ 181#ifdef __KERNEL__
188#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 182#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
189#define elf_read_implies_exec(ex, executable_stack) \ 183#define elf_read_implies_exec(ex, executable_stack) \
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h
index c9f8d835d0cc..1dd275dc8f65 100644
--- a/include/asm-ia64/fcntl.h
+++ b/include/asm-ia64/fcntl.h
@@ -1,86 +1,13 @@
1#ifndef _ASM_IA64_FCNTL_H 1#ifndef _ASM_IA64_FCNTL_H
2#define _ASM_IA64_FCNTL_H 2#define _ASM_IA64_FCNTL_H
3/* 3/*
4 * Based on <asm-i386/fcntl.h>.
5 *
6 * Modified 1998-2000 4 * Modified 1998-2000
7 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co. 5 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co.
8 */ 6 */
9 7
10/* 8#define force_o_largefile() \
11 * open/fcntl - O_SYNC is only implemented on blocks devices and on 9 (personality(current->personality) != PER_LINUX32)
12 * files located on an ext2 file system
13 */
14#define O_ACCMODE 0003
15#define O_RDONLY 00
16#define O_WRONLY 01
17#define O_RDWR 02
18#define O_CREAT 0100 /* not fcntl */
19#define O_EXCL 0200 /* not fcntl */
20#define O_NOCTTY 0400 /* not fcntl */
21#define O_TRUNC 01000 /* not fcntl */
22#define O_APPEND 02000
23#define O_NONBLOCK 04000
24#define O_NDELAY O_NONBLOCK
25#define O_SYNC 010000
26#define FASYNC 020000 /* fcntl, for BSD compatibility */
27#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
28#define O_LARGEFILE 0100000
29#define O_DIRECTORY 0200000 /* must be a directory */
30#define O_NOFOLLOW 0400000 /* don't follow links */
31#define O_NOATIME 01000000
32
33#define F_DUPFD 0 /* dup */
34#define F_GETFD 1 /* get close_on_exec */
35#define F_SETFD 2 /* set/clear close_on_exec */
36#define F_GETFL 3 /* get file->f_flags */
37#define F_SETFL 4 /* set file->f_flags */
38#define F_GETLK 5
39#define F_SETLK 6
40#define F_SETLKW 7
41
42#define F_SETOWN 8 /* for sockets. */
43#define F_GETOWN 9 /* for sockets. */
44#define F_SETSIG 10 /* for sockets. */
45#define F_GETSIG 11 /* for sockets. */
46
47/* for F_[GET|SET]FL */
48#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
49
50/* for posix fcntl() and lockf() */
51#define F_RDLCK 0
52#define F_WRLCK 1
53#define F_UNLCK 2
54
55/* for old implementation of bsd flock () */
56#define F_EXLCK 4 /* or 3 */
57#define F_SHLCK 8 /* or 4 */
58
59/* for leases */
60#define F_INPROGRESS 16
61
62/* operations for bsd flock(), also used by the kernel implementation */
63#define LOCK_SH 1 /* shared lock */
64#define LOCK_EX 2 /* exclusive lock */
65#define LOCK_NB 4 /* or'd with one of the above to prevent
66 blocking */
67#define LOCK_UN 8 /* remove lock */
68
69#define LOCK_MAND 32 /* This is a mandatory flock */
70#define LOCK_READ 64 /* ... Which allows concurrent read operations */
71#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
72#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
73
74struct flock {
75 short l_type;
76 short l_whence;
77 off_t l_start;
78 off_t l_len;
79 pid_t l_pid;
80};
81
82#define F_LINUX_SPECIFIC_BASE 1024
83 10
84#define force_o_largefile() ( ! (current->personality & PER_LINUX32) ) 11#include <asm-generic/fcntl.h>
85 12
86#endif /* _ASM_IA64_FCNTL_H */ 13#endif /* _ASM_IA64_FCNTL_H */
diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-ia64/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-ia64/hdreg.h b/include/asm-ia64/hdreg.h
deleted file mode 100644
index 83b5161d2678..000000000000
--- a/include/asm-ia64/hdreg.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * linux/include/asm-ia64/hdreg.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7#warning this file is obsolete, please do not use it
8
9#ifndef __ASM_IA64_HDREG_H
10#define __ASM_IA64_HDREG_H
11
12typedef unsigned short ide_ioreg_t;
13
14#endif /* __ASM_IA64_HDREG_H */
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index 041ab8c51a64..0cf119b42f7d 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -116,13 +116,6 @@ __ia64_local_vector_to_irq (ia64_vector vec)
116 * and to obtain the irq descriptor for a given irq number. 116 * and to obtain the irq descriptor for a given irq number.
117 */ 117 */
118 118
119/* Return a pointer to the irq descriptor for IRQ. */
120static inline irq_desc_t *
121irq_descp (int irq)
122{
123 return irq_desc + irq;
124}
125
126/* Extract the IA-64 vector that corresponds to IRQ. */ 119/* Extract the IA-64 vector that corresponds to IRQ. */
127static inline ia64_vector 120static inline ia64_vector
128irq_to_vector (int irq) 121irq_to_vector (int irq)
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 491e9d1fc538..cf772a67f858 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -23,7 +23,7 @@
23#define __SLOW_DOWN_IO do { } while (0) 23#define __SLOW_DOWN_IO do { } while (0)
24#define SLOW_DOWN_IO do { } while (0) 24#define SLOW_DOWN_IO do { } while (0)
25 25
26#define __IA64_UNCACHED_OFFSET 0xc000000000000000UL /* region 6 */ 26#define __IA64_UNCACHED_OFFSET RGN_BASE(RGN_UNCACHED)
27 27
28/* 28/*
29 * The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but 29 * The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but
@@ -41,7 +41,7 @@
41#define IO_SPACE_BASE(space) ((space) << IO_SPACE_BITS) 41#define IO_SPACE_BASE(space) ((space) << IO_SPACE_BITS)
42#define IO_SPACE_PORT(port) ((port) & (IO_SPACE_SIZE - 1)) 42#define IO_SPACE_PORT(port) ((port) & (IO_SPACE_SIZE - 1))
43 43
44#define IO_SPACE_SPARSE_ENCODING(p) ((((p) >> 2) << 12) | (p & 0xfff)) 44#define IO_SPACE_SPARSE_ENCODING(p) ((((p) >> 2) << 12) | ((p) & 0xfff))
45 45
46struct io_space { 46struct io_space {
47 unsigned long mmio_base; /* base in MMIO space */ 47 unsigned long mmio_base; /* base in MMIO space */
@@ -120,14 +120,6 @@ static inline void ___ia64_mmiowb(void)
120 ia64_mfa(); 120 ia64_mfa();
121} 121}
122 122
123static inline const unsigned long
124__ia64_get_io_port_base (void)
125{
126 extern unsigned long ia64_iobase;
127
128 return ia64_iobase;
129}
130
131static inline void* 123static inline void*
132__ia64_mk_io_addr (unsigned long port) 124__ia64_mk_io_addr (unsigned long port)
133{ 125{
diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h
index 1093f35b3b90..a429fe225b07 100644
--- a/include/asm-ia64/iosapic.h
+++ b/include/asm-ia64/iosapic.h
@@ -75,6 +75,8 @@ extern int __devinit iosapic_init (unsigned long address,
75 unsigned int gsi_base); 75 unsigned int gsi_base);
76#ifdef CONFIG_HOTPLUG 76#ifdef CONFIG_HOTPLUG
77extern int iosapic_remove (unsigned int gsi_base); 77extern int iosapic_remove (unsigned int gsi_base);
78#else
79#define iosapic_remove(gsi_base) (-EINVAL)
78#endif /* CONFIG_HOTPLUG */ 80#endif /* CONFIG_HOTPLUG */
79extern int gsi_to_vector (unsigned int gsi); 81extern int gsi_to_vector (unsigned int gsi);
80extern int gsi_to_irq (unsigned int gsi); 82extern int gsi_to_irq (unsigned int gsi);
@@ -102,9 +104,7 @@ extern void __devinit map_iosapic_to_node (unsigned int, int);
102#else 104#else
103#define iosapic_system_init(pcat_compat) do { } while (0) 105#define iosapic_system_init(pcat_compat) do { } while (0)
104#define iosapic_init(address,gsi_base) (-EINVAL) 106#define iosapic_init(address,gsi_base) (-EINVAL)
105#ifdef CONFIG_HOTPLUG
106#define iosapic_remove(gsi_base) (-ENODEV) 107#define iosapic_remove(gsi_base) (-ENODEV)
107#endif /* CONFIG_HOTPLUG */
108#define iosapic_register_intr(gsi,polarity,trigger) (gsi) 108#define iosapic_register_intr(gsi,polarity,trigger) (gsi)
109#define iosapic_unregister_intr(irq) do { } while (0) 109#define iosapic_unregister_intr(irq) do { } while (0)
110#define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0) 110#define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0)
diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h
index bd07d11d9f37..cd984d08fd15 100644
--- a/include/asm-ia64/irq.h
+++ b/include/asm-ia64/irq.h
@@ -14,6 +14,11 @@
14#define NR_IRQS 256 14#define NR_IRQS 256
15#define NR_IRQ_VECTORS NR_IRQS 15#define NR_IRQ_VECTORS NR_IRQS
16 16
17/*
18 * IRQ line status macro IRQ_PER_CPU is used
19 */
20#define ARCH_HAS_IRQ_PER_CPU
21
17static __inline__ int 22static __inline__ int
18irq_canonicalize (int irq) 23irq_canonicalize (int irq)
19{ 24{
@@ -30,12 +35,6 @@ extern void disable_irq_nosync (unsigned int);
30extern void enable_irq (unsigned int); 35extern void enable_irq (unsigned int);
31extern void set_irq_affinity_info (unsigned int irq, int dest, int redir); 36extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
32 37
33#ifdef CONFIG_SMP
34extern void move_irq(int irq);
35#else
36#define move_irq(irq)
37#endif
38
39struct irqaction; 38struct irqaction;
40struct pt_regs; 39struct pt_regs;
41int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); 40int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index bf36a32e37e4..573a3574a24f 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -92,6 +92,7 @@ struct arch_specific_insn {
92 kprobe_opcode_t insn; 92 kprobe_opcode_t insn;
93 #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 93 #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1
94 #define INST_FLAG_FIX_BRANCH_REG 2 94 #define INST_FLAG_FIX_BRANCH_REG 2
95 #define INST_FLAG_BREAK_INST 4
95 unsigned long inst_flag; 96 unsigned long inst_flag;
96 unsigned short target_br_reg; 97 unsigned short target_br_reg;
97}; 98};
diff --git a/include/asm-ia64/mmu.h b/include/asm-ia64/mmu.h
index ae1525352a25..611432ba579c 100644
--- a/include/asm-ia64/mmu.h
+++ b/include/asm-ia64/mmu.h
@@ -2,10 +2,12 @@
2#define __MMU_H 2#define __MMU_H
3 3
4/* 4/*
5 * Type for a context number. We declare it volatile to ensure proper ordering when it's 5 * Type for a context number. We declare it volatile to ensure proper
6 * accessed outside of spinlock'd critical sections (e.g., as done in activate_mm() and 6 * ordering when it's accessed outside of spinlock'd critical sections
7 * init_new_context()). 7 * (e.g., as done in activate_mm() and init_new_context()).
8 */ 8 */
9typedef volatile unsigned long mm_context_t; 9typedef volatile unsigned long mm_context_t;
10 10
11typedef unsigned long nv_mm_context_t;
12
11#endif 13#endif
diff --git a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
index e3e5fededb04..8d6e72f7b08e 100644
--- a/include/asm-ia64/mmu_context.h
+++ b/include/asm-ia64/mmu_context.h
@@ -19,6 +19,7 @@
19 19
20#define ia64_rid(ctx,addr) (((ctx) << 3) | (addr >> 61)) 20#define ia64_rid(ctx,addr) (((ctx) << 3) | (addr >> 61))
21 21
22# include <asm/page.h>
22# ifndef __ASSEMBLY__ 23# ifndef __ASSEMBLY__
23 24
24#include <linux/compiler.h> 25#include <linux/compiler.h>
@@ -55,34 +56,46 @@ static inline void
55delayed_tlb_flush (void) 56delayed_tlb_flush (void)
56{ 57{
57 extern void local_flush_tlb_all (void); 58 extern void local_flush_tlb_all (void);
59 unsigned long flags;
58 60
59 if (unlikely(__ia64_per_cpu_var(ia64_need_tlb_flush))) { 61 if (unlikely(__ia64_per_cpu_var(ia64_need_tlb_flush))) {
60 local_flush_tlb_all(); 62 spin_lock_irqsave(&ia64_ctx.lock, flags);
61 __ia64_per_cpu_var(ia64_need_tlb_flush) = 0; 63 {
64 if (__ia64_per_cpu_var(ia64_need_tlb_flush)) {
65 local_flush_tlb_all();
66 __ia64_per_cpu_var(ia64_need_tlb_flush) = 0;
67 }
68 }
69 spin_unlock_irqrestore(&ia64_ctx.lock, flags);
62 } 70 }
63} 71}
64 72
65static inline mm_context_t 73static inline nv_mm_context_t
66get_mmu_context (struct mm_struct *mm) 74get_mmu_context (struct mm_struct *mm)
67{ 75{
68 unsigned long flags; 76 unsigned long flags;
69 mm_context_t context = mm->context; 77 nv_mm_context_t context = mm->context;
70 78
71 if (context) 79 if (unlikely(!context)) {
72 return context; 80 spin_lock_irqsave(&ia64_ctx.lock, flags);
73 81 {
74 spin_lock_irqsave(&ia64_ctx.lock, flags); 82 /* re-check, now that we've got the lock: */
75 { 83 context = mm->context;
76 /* re-check, now that we've got the lock: */ 84 if (context == 0) {
77 context = mm->context; 85 cpus_clear(mm->cpu_vm_mask);
78 if (context == 0) { 86 if (ia64_ctx.next >= ia64_ctx.limit)
79 cpus_clear(mm->cpu_vm_mask); 87 wrap_mmu_context(mm);
80 if (ia64_ctx.next >= ia64_ctx.limit) 88 mm->context = context = ia64_ctx.next++;
81 wrap_mmu_context(mm); 89 }
82 mm->context = context = ia64_ctx.next++;
83 } 90 }
91 spin_unlock_irqrestore(&ia64_ctx.lock, flags);
84 } 92 }
85 spin_unlock_irqrestore(&ia64_ctx.lock, flags); 93 /*
94 * Ensure we're not starting to use "context" before any old
95 * uses of it are gone from our TLB.
96 */
97 delayed_tlb_flush();
98
86 return context; 99 return context;
87} 100}
88 101
@@ -104,13 +117,13 @@ destroy_context (struct mm_struct *mm)
104} 117}
105 118
106static inline void 119static inline void
107reload_context (mm_context_t context) 120reload_context (nv_mm_context_t context)
108{ 121{
109 unsigned long rid; 122 unsigned long rid;
110 unsigned long rid_incr = 0; 123 unsigned long rid_incr = 0;
111 unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4; 124 unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
112 125
113 old_rr4 = ia64_get_rr(0x8000000000000000UL); 126 old_rr4 = ia64_get_rr(RGN_BASE(RGN_HPAGE));
114 rid = context << 3; /* make space for encoding the region number */ 127 rid = context << 3; /* make space for encoding the region number */
115 rid_incr = 1 << 8; 128 rid_incr = 1 << 8;
116 129
@@ -122,6 +135,10 @@ reload_context (mm_context_t context)
122 rr4 = rr0 + 4*rid_incr; 135 rr4 = rr0 + 4*rid_incr;
123#ifdef CONFIG_HUGETLB_PAGE 136#ifdef CONFIG_HUGETLB_PAGE
124 rr4 = (rr4 & (~(0xfcUL))) | (old_rr4 & 0xfc); 137 rr4 = (rr4 & (~(0xfcUL))) | (old_rr4 & 0xfc);
138
139# if RGN_HPAGE != 4
140# error "reload_context assumes RGN_HPAGE is 4"
141# endif
125#endif 142#endif
126 143
127 ia64_set_rr(0x0000000000000000UL, rr0); 144 ia64_set_rr(0x0000000000000000UL, rr0);
@@ -138,7 +155,7 @@ reload_context (mm_context_t context)
138static inline void 155static inline void
139activate_context (struct mm_struct *mm) 156activate_context (struct mm_struct *mm)
140{ 157{
141 mm_context_t context; 158 nv_mm_context_t context;
142 159
143 do { 160 do {
144 context = get_mmu_context(mm); 161 context = get_mmu_context(mm);
@@ -157,8 +174,6 @@ activate_context (struct mm_struct *mm)
157static inline void 174static inline void
158activate_mm (struct mm_struct *prev, struct mm_struct *next) 175activate_mm (struct mm_struct *prev, struct mm_struct *next)
159{ 176{
160 delayed_tlb_flush();
161
162 /* 177 /*
163 * We may get interrupts here, but that's OK because interrupt handlers cannot 178 * We may get interrupts here, but that's OK because interrupt handlers cannot
164 * touch user-space. 179 * touch user-space.
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 08894f73abf0..9edffad8c28b 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -13,6 +13,19 @@
13#include <asm/types.h> 13#include <asm/types.h>
14 14
15/* 15/*
16 * The top three bits of an IA64 address are its Region Number.
17 * Different regions are assigned to different purposes.
18 */
19#define RGN_SHIFT (61)
20#define RGN_BASE(r) (__IA64_UL_CONST(r)<<RGN_SHIFT)
21#define RGN_BITS (RGN_BASE(-1))
22
23#define RGN_KERNEL 7 /* Identity mapped region */
24#define RGN_UNCACHED 6 /* Identity mapped I/O region */
25#define RGN_GATE 5 /* Gate page, Kernel text, etc */
26#define RGN_HPAGE 4 /* For Huge TLB pages */
27
28/*
16 * PAGE_SHIFT determines the actual kernel page size. 29 * PAGE_SHIFT determines the actual kernel page size.
17 */ 30 */
18#if defined(CONFIG_IA64_PAGE_SIZE_4KB) 31#if defined(CONFIG_IA64_PAGE_SIZE_4KB)
@@ -36,10 +49,9 @@
36 49
37#define RGN_MAP_LIMIT ((1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE) /* per region addr limit */ 50#define RGN_MAP_LIMIT ((1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE) /* per region addr limit */
38 51
52
39#ifdef CONFIG_HUGETLB_PAGE 53#ifdef CONFIG_HUGETLB_PAGE
40# define REGION_HPAGE (4UL) /* note: this is hardcoded in reload_context()!*/ 54# define HPAGE_REGION_BASE RGN_BASE(RGN_HPAGE)
41# define REGION_SHIFT 61
42# define HPAGE_REGION_BASE (REGION_HPAGE << REGION_SHIFT)
43# define HPAGE_SHIFT hpage_shift 55# define HPAGE_SHIFT hpage_shift
44# define HPAGE_SHIFT_DEFAULT 28 /* check ia64 SDM for architecture supported size */ 56# define HPAGE_SHIFT_DEFAULT 28 /* check ia64 SDM for architecture supported size */
45# define HPAGE_SIZE (__IA64_UL_CONST(1) << HPAGE_SHIFT) 57# define HPAGE_SIZE (__IA64_UL_CONST(1) << HPAGE_SHIFT)
@@ -130,16 +142,13 @@ typedef union ia64_va {
130#define REGION_NUMBER(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg;}) 142#define REGION_NUMBER(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
131#define REGION_OFFSET(x) ({ia64_va _v; _v.l = (long) (x); _v.f.off;}) 143#define REGION_OFFSET(x) ({ia64_va _v; _v.l = (long) (x); _v.f.off;})
132 144
133#define REGION_SIZE REGION_NUMBER(1)
134#define REGION_KERNEL 7
135
136#ifdef CONFIG_HUGETLB_PAGE 145#ifdef CONFIG_HUGETLB_PAGE
137# define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \ 146# define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \
138 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT))) 147 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT)))
139# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 148# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
140# define is_hugepage_only_range(mm, addr, len) \ 149# define is_hugepage_only_range(mm, addr, len) \
141 (REGION_NUMBER(addr) == REGION_HPAGE && \ 150 (REGION_NUMBER(addr) == RGN_HPAGE && \
142 REGION_NUMBER((addr)+(len)-1) == REGION_HPAGE) 151 REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE)
143extern unsigned int hpage_shift; 152extern unsigned int hpage_shift;
144#endif 153#endif
145 154
@@ -197,7 +206,7 @@ get_order (unsigned long size)
197# define __pgprot(x) (x) 206# define __pgprot(x) (x)
198#endif /* !STRICT_MM_TYPECHECKS */ 207#endif /* !STRICT_MM_TYPECHECKS */
199 208
200#define PAGE_OFFSET __IA64_UL_CONST(0xe000000000000000) 209#define PAGE_OFFSET RGN_BASE(RGN_KERNEL)
201 210
202#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 211#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
203 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | \ 212 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | \
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 2303a10ee595..e828377ad295 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -75,6 +75,8 @@
75#define PAL_CACHE_READ 259 /* read tag & data of cacheline for diagnostic testing */ 75#define PAL_CACHE_READ 259 /* read tag & data of cacheline for diagnostic testing */
76#define PAL_CACHE_WRITE 260 /* write tag & data of cacheline for diagnostic testing */ 76#define PAL_CACHE_WRITE 260 /* write tag & data of cacheline for diagnostic testing */
77#define PAL_VM_TR_READ 261 /* read contents of translation register */ 77#define PAL_VM_TR_READ 261 /* read contents of translation register */
78#define PAL_GET_PSTATE 262 /* get the current P-state */
79#define PAL_SET_PSTATE 263 /* set the P-state */
78 80
79#ifndef __ASSEMBLY__ 81#ifndef __ASSEMBLY__
80 82
@@ -1111,6 +1113,25 @@ ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
1111 return iprv.status; 1113 return iprv.status;
1112} 1114}
1113 1115
1116/* Get the current P-state information */
1117static inline s64
1118ia64_pal_get_pstate (u64 *pstate_index)
1119{
1120 struct ia64_pal_retval iprv;
1121 PAL_CALL_STK(iprv, PAL_GET_PSTATE, 0, 0, 0);
1122 *pstate_index = iprv.v0;
1123 return iprv.status;
1124}
1125
1126/* Set the P-state */
1127static inline s64
1128ia64_pal_set_pstate (u64 pstate_index)
1129{
1130 struct ia64_pal_retval iprv;
1131 PAL_CALL_STK(iprv, PAL_SET_PSTATE, pstate_index, 0, 0);
1132 return iprv.status;
1133}
1134
1114/* Cause the processor to enter LIGHT HALT state, where prefetching and execution are 1135/* Cause the processor to enter LIGHT HALT state, where prefetching and execution are
1115 * suspended, but cache and TLB coherency is maintained. 1136 * suspended, but cache and TLB coherency is maintained.
1116 */ 1137 */
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 48586e08f432..2e34c06e6777 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -204,21 +204,18 @@ ia64_phys_addr_valid (unsigned long addr)
204#define set_pte(ptep, pteval) (*(ptep) = (pteval)) 204#define set_pte(ptep, pteval) (*(ptep) = (pteval))
205#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 205#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
206 206
207#define RGN_SIZE (1UL << 61) 207#define VMALLOC_START (RGN_BASE(RGN_GATE) + 0x200000000UL)
208#define RGN_KERNEL 7
209
210#define VMALLOC_START 0xa000000200000000UL
211#ifdef CONFIG_VIRTUAL_MEM_MAP 208#ifdef CONFIG_VIRTUAL_MEM_MAP
212# define VMALLOC_END_INIT (0xa000000000000000UL + (1UL << (4*PAGE_SHIFT - 9))) 209# define VMALLOC_END_INIT (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9)))
213# define VMALLOC_END vmalloc_end 210# define VMALLOC_END vmalloc_end
214 extern unsigned long vmalloc_end; 211 extern unsigned long vmalloc_end;
215#else 212#else
216# define VMALLOC_END (0xa000000000000000UL + (1UL << (4*PAGE_SHIFT - 9))) 213# define VMALLOC_END (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9)))
217#endif 214#endif
218 215
219/* fs/proc/kcore.c */ 216/* fs/proc/kcore.c */
220#define kc_vaddr_to_offset(v) ((v) - 0xa000000000000000UL) 217#define kc_vaddr_to_offset(v) ((v) - RGN_BASE(RGN_GATE))
221#define kc_offset_to_vaddr(o) ((o) + 0xa000000000000000UL) 218#define kc_offset_to_vaddr(o) ((o) + RGN_BASE(RGN_GATE))
222 219
223/* 220/*
224 * Conversion functions: convert page frame number (pfn) and a protection value to a page 221 * Conversion functions: convert page frame number (pfn) and a protection value to a page
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 91bbd1f22461..94e07e727395 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -20,9 +20,6 @@
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/ustack.h> 21#include <asm/ustack.h>
22 22
23/* Our arch specific arch_init_sched_domain is in arch/ia64/kernel/domain.c */
24#define ARCH_HAS_SCHED_DOMAIN
25
26#define IA64_NUM_DBG_REGS 8 23#define IA64_NUM_DBG_REGS 8
27/* 24/*
28 * Limits for PMC and PMD are set to less than maximum architected values 25 * Limits for PMC and PMD are set to less than maximum architected values
diff --git a/include/asm-ia64/rwsem.h b/include/asm-ia64/rwsem.h
index 6ece5061dc19..e18b5ab0cb75 100644
--- a/include/asm-ia64/rwsem.h
+++ b/include/asm-ia64/rwsem.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2003 Ken Chen <kenneth.w.chen@intel.com> 4 * Copyright (C) 2003 Ken Chen <kenneth.w.chen@intel.com>
5 * Copyright (C) 2003 Asit Mallick <asit.k.mallick@intel.com> 5 * Copyright (C) 2003 Asit Mallick <asit.k.mallick@intel.com>
6 * Copyright (C) 2005 Christoph Lameter <clameter@sgi.com>
6 * 7 *
7 * Based on asm-i386/rwsem.h and other architecture implementation. 8 * Based on asm-i386/rwsem.h and other architecture implementation.
8 * 9 *
@@ -11,9 +12,9 @@
11 * 12 *
12 * The lock count is initialized to 0 (no active and no waiting lockers). 13 * The lock count is initialized to 0 (no active and no waiting lockers).
13 * 14 *
14 * When a writer subtracts WRITE_BIAS, it'll get 0xffff0001 for the case 15 * When a writer subtracts WRITE_BIAS, it'll get 0xffffffff00000001 for
15 * of an uncontended lock. Readers increment by 1 and see a positive value 16 * the case of an uncontended lock. Readers increment by 1 and see a positive
16 * when uncontended, negative if there are writers (and maybe) readers 17 * value when uncontended, negative if there are writers (and maybe) readers
17 * waiting (in which case it goes to sleep). 18 * waiting (in which case it goes to sleep).
18 */ 19 */
19 20
@@ -29,7 +30,7 @@
29 * the semaphore definition 30 * the semaphore definition
30 */ 31 */
31struct rw_semaphore { 32struct rw_semaphore {
32 signed int count; 33 signed long count;
33 spinlock_t wait_lock; 34 spinlock_t wait_lock;
34 struct list_head wait_list; 35 struct list_head wait_list;
35#if RWSEM_DEBUG 36#if RWSEM_DEBUG
@@ -37,10 +38,10 @@ struct rw_semaphore {
37#endif 38#endif
38}; 39};
39 40
40#define RWSEM_UNLOCKED_VALUE 0x00000000 41#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
41#define RWSEM_ACTIVE_BIAS 0x00000001 42#define RWSEM_ACTIVE_BIAS __IA64_UL_CONST(0x0000000000000001)
42#define RWSEM_ACTIVE_MASK 0x0000ffff 43#define RWSEM_ACTIVE_MASK __IA64_UL_CONST(0x00000000ffffffff)
43#define RWSEM_WAITING_BIAS (-0x00010000) 44#define RWSEM_WAITING_BIAS -__IA64_UL_CONST(0x0000000100000000)
44#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 45#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
45#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 46#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
46 47
@@ -83,7 +84,7 @@ init_rwsem (struct rw_semaphore *sem)
83static inline void 84static inline void
84__down_read (struct rw_semaphore *sem) 85__down_read (struct rw_semaphore *sem)
85{ 86{
86 int result = ia64_fetchadd4_acq((unsigned int *)&sem->count, 1); 87 long result = ia64_fetchadd8_acq((unsigned long *)&sem->count, 1);
87 88
88 if (result < 0) 89 if (result < 0)
89 rwsem_down_read_failed(sem); 90 rwsem_down_read_failed(sem);
@@ -95,7 +96,7 @@ __down_read (struct rw_semaphore *sem)
95static inline void 96static inline void
96__down_write (struct rw_semaphore *sem) 97__down_write (struct rw_semaphore *sem)
97{ 98{
98 int old, new; 99 long old, new;
99 100
100 do { 101 do {
101 old = sem->count; 102 old = sem->count;
@@ -112,7 +113,7 @@ __down_write (struct rw_semaphore *sem)
112static inline void 113static inline void
113__up_read (struct rw_semaphore *sem) 114__up_read (struct rw_semaphore *sem)
114{ 115{
115 int result = ia64_fetchadd4_rel((unsigned int *)&sem->count, -1); 116 long result = ia64_fetchadd8_rel((unsigned long *)&sem->count, -1);
116 117
117 if (result < 0 && (--result & RWSEM_ACTIVE_MASK) == 0) 118 if (result < 0 && (--result & RWSEM_ACTIVE_MASK) == 0)
118 rwsem_wake(sem); 119 rwsem_wake(sem);
@@ -124,7 +125,7 @@ __up_read (struct rw_semaphore *sem)
124static inline void 125static inline void
125__up_write (struct rw_semaphore *sem) 126__up_write (struct rw_semaphore *sem)
126{ 127{
127 int old, new; 128 long old, new;
128 129
129 do { 130 do {
130 old = sem->count; 131 old = sem->count;
@@ -141,7 +142,7 @@ __up_write (struct rw_semaphore *sem)
141static inline int 142static inline int
142__down_read_trylock (struct rw_semaphore *sem) 143__down_read_trylock (struct rw_semaphore *sem)
143{ 144{
144 int tmp; 145 long tmp;
145 while ((tmp = sem->count) >= 0) { 146 while ((tmp = sem->count) >= 0) {
146 if (tmp == cmpxchg_acq(&sem->count, tmp, tmp+1)) { 147 if (tmp == cmpxchg_acq(&sem->count, tmp, tmp+1)) {
147 return 1; 148 return 1;
@@ -156,7 +157,7 @@ __down_read_trylock (struct rw_semaphore *sem)
156static inline int 157static inline int
157__down_write_trylock (struct rw_semaphore *sem) 158__down_write_trylock (struct rw_semaphore *sem)
158{ 159{
159 int tmp = cmpxchg_acq(&sem->count, RWSEM_UNLOCKED_VALUE, 160 long tmp = cmpxchg_acq(&sem->count, RWSEM_UNLOCKED_VALUE,
160 RWSEM_ACTIVE_WRITE_BIAS); 161 RWSEM_ACTIVE_WRITE_BIAS);
161 return tmp == RWSEM_UNLOCKED_VALUE; 162 return tmp == RWSEM_UNLOCKED_VALUE;
162} 163}
@@ -167,7 +168,7 @@ __down_write_trylock (struct rw_semaphore *sem)
167static inline void 168static inline void
168__downgrade_write (struct rw_semaphore *sem) 169__downgrade_write (struct rw_semaphore *sem)
169{ 170{
170 int old, new; 171 long old, new;
171 172
172 do { 173 do {
173 old = sem->count; 174 old = sem->count;
@@ -182,7 +183,7 @@ __downgrade_write (struct rw_semaphore *sem)
182 * Implement atomic add functionality. These used to be "inline" functions, but GCC v3.1 183 * Implement atomic add functionality. These used to be "inline" functions, but GCC v3.1
183 * doesn't quite optimize this stuff right and ends up with bad calls to fetchandadd. 184 * doesn't quite optimize this stuff right and ends up with bad calls to fetchandadd.
184 */ 185 */
185#define rwsem_atomic_add(delta, sem) atomic_add(delta, (atomic_t *)(&(sem)->count)) 186#define rwsem_atomic_add(delta, sem) atomic64_add(delta, (atomic64_t *)(&(sem)->count))
186#define rwsem_atomic_update(delta, sem) atomic_add_return(delta, (atomic_t *)(&(sem)->count)) 187#define rwsem_atomic_update(delta, sem) atomic64_add_return(delta, (atomic64_t *)(&(sem)->count))
187 188
188#endif /* _ASM_IA64_RWSEM_H */ 189#endif /* _ASM_IA64_RWSEM_H */
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h
index 103d745dc5f2..2c32e4b77b54 100644
--- a/include/asm-ia64/sn/addrs.h
+++ b/include/asm-ia64/sn/addrs.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 1992-1999,2001-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (c) 1992-1999,2001-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#ifndef _ASM_IA64_SN_ADDRS_H 9#ifndef _ASM_IA64_SN_ADDRS_H
@@ -65,7 +65,6 @@
65 65
66#define NASID_MASK ((u64)NASID_BITMASK << NASID_SHIFT) 66#define NASID_MASK ((u64)NASID_BITMASK << NASID_SHIFT)
67#define AS_MASK ((u64)AS_BITMASK << AS_SHIFT) 67#define AS_MASK ((u64)AS_BITMASK << AS_SHIFT)
68#define REGION_BITS 0xe000000000000000UL
69 68
70 69
71/* 70/*
@@ -79,38 +78,30 @@
79#define AS_CAC_SPACE (AS_CAC_VAL << AS_SHIFT) 78#define AS_CAC_SPACE (AS_CAC_VAL << AS_SHIFT)
80 79
81 80
82/*
83 * Base addresses for various address ranges.
84 */
85#define CACHED 0xe000000000000000UL
86#define UNCACHED 0xc000000000000000UL
87#define UNCACHED_PHYS 0x8000000000000000UL
88
89
90/* 81/*
91 * Virtual Mode Local & Global MMR space. 82 * Virtual Mode Local & Global MMR space.
92 */ 83 */
93#define SH1_LOCAL_MMR_OFFSET 0x8000000000UL 84#define SH1_LOCAL_MMR_OFFSET 0x8000000000UL
94#define SH2_LOCAL_MMR_OFFSET 0x0200000000UL 85#define SH2_LOCAL_MMR_OFFSET 0x0200000000UL
95#define LOCAL_MMR_OFFSET (is_shub2() ? SH2_LOCAL_MMR_OFFSET : SH1_LOCAL_MMR_OFFSET) 86#define LOCAL_MMR_OFFSET (is_shub2() ? SH2_LOCAL_MMR_OFFSET : SH1_LOCAL_MMR_OFFSET)
96#define LOCAL_MMR_SPACE (UNCACHED | LOCAL_MMR_OFFSET) 87#define LOCAL_MMR_SPACE (__IA64_UNCACHED_OFFSET | LOCAL_MMR_OFFSET)
97#define LOCAL_PHYS_MMR_SPACE (UNCACHED_PHYS | LOCAL_MMR_OFFSET) 88#define LOCAL_PHYS_MMR_SPACE (RGN_BASE(RGN_HPAGE) | LOCAL_MMR_OFFSET)
98 89
99#define SH1_GLOBAL_MMR_OFFSET 0x0800000000UL 90#define SH1_GLOBAL_MMR_OFFSET 0x0800000000UL
100#define SH2_GLOBAL_MMR_OFFSET 0x0300000000UL 91#define SH2_GLOBAL_MMR_OFFSET 0x0300000000UL
101#define GLOBAL_MMR_OFFSET (is_shub2() ? SH2_GLOBAL_MMR_OFFSET : SH1_GLOBAL_MMR_OFFSET) 92#define GLOBAL_MMR_OFFSET (is_shub2() ? SH2_GLOBAL_MMR_OFFSET : SH1_GLOBAL_MMR_OFFSET)
102#define GLOBAL_MMR_SPACE (UNCACHED | GLOBAL_MMR_OFFSET) 93#define GLOBAL_MMR_SPACE (__IA64_UNCACHED_OFFSET | GLOBAL_MMR_OFFSET)
103 94
104/* 95/*
105 * Physical mode addresses 96 * Physical mode addresses
106 */ 97 */
107#define GLOBAL_PHYS_MMR_SPACE (UNCACHED_PHYS | GLOBAL_MMR_OFFSET) 98#define GLOBAL_PHYS_MMR_SPACE (RGN_BASE(RGN_HPAGE) | GLOBAL_MMR_OFFSET)
108 99
109 100
110/* 101/*
111 * Clear region & AS bits. 102 * Clear region & AS bits.
112 */ 103 */
113#define TO_PHYS_MASK (~(REGION_BITS | AS_MASK)) 104#define TO_PHYS_MASK (~(RGN_BITS | AS_MASK))
114 105
115 106
116/* 107/*
@@ -126,6 +117,7 @@
126#define GLOBAL_MMR_PHYS_ADDR(n,a) (GLOBAL_PHYS_MMR_SPACE | REMOTE_ADDR(n,a)) 117#define GLOBAL_MMR_PHYS_ADDR(n,a) (GLOBAL_PHYS_MMR_SPACE | REMOTE_ADDR(n,a))
127#define GLOBAL_CAC_ADDR(n,a) (CAC_BASE | REMOTE_ADDR(n,a)) 118#define GLOBAL_CAC_ADDR(n,a) (CAC_BASE | REMOTE_ADDR(n,a))
128#define CHANGE_NASID(n,x) ((void *)(((u64)(x) & ~NASID_MASK) | NASID_SPACE(n))) 119#define CHANGE_NASID(n,x) ((void *)(((u64)(x) & ~NASID_MASK) | NASID_SPACE(n)))
120#define IS_TIO_NASID(n) ((n) & 1)
129 121
130 122
131/* non-II mmr's start at top of big window space (4G) */ 123/* non-II mmr's start at top of big window space (4G) */
@@ -134,10 +126,10 @@
134/* 126/*
135 * general address defines 127 * general address defines
136 */ 128 */
137#define CAC_BASE (CACHED | AS_CAC_SPACE) 129#define CAC_BASE (PAGE_OFFSET | AS_CAC_SPACE)
138#define AMO_BASE (UNCACHED | AS_AMO_SPACE) 130#define AMO_BASE (__IA64_UNCACHED_OFFSET | AS_AMO_SPACE)
139#define AMO_PHYS_BASE (UNCACHED_PHYS | AS_AMO_SPACE) 131#define AMO_PHYS_BASE (RGN_BASE(RGN_HPAGE) | AS_AMO_SPACE)
140#define GET_BASE (CACHED | AS_GET_SPACE) 132#define GET_BASE (PAGE_OFFSET | AS_GET_SPACE)
141 133
142/* 134/*
143 * Convert Memory addresses between various addressing modes. 135 * Convert Memory addresses between various addressing modes.
@@ -155,17 +147,35 @@
155 * the chiplet id is zero. If we implement TIO-TIO dma, we might need 147 * the chiplet id is zero. If we implement TIO-TIO dma, we might need
156 * to insert a chiplet id into this macro. However, it is our belief 148 * to insert a chiplet id into this macro. However, it is our belief
157 * right now that this chiplet id will be ICE, which is also zero. 149 * right now that this chiplet id will be ICE, which is also zero.
158 * Nasid starts on bit 40.
159 */ 150 */
160#define PHYS_TO_TIODMA(x) ( (((u64)(NASID_GET(x))) << 40) | NODE_OFFSET(x)) 151#define SH1_TIO_PHYS_TO_DMA(x) \
161#define PHYS_TO_DMA(x) ( (((u64)(x) & NASID_MASK) >> 2) | NODE_OFFSET(x)) 152 ((((u64)(NASID_GET(x))) << 40) | NODE_OFFSET(x))
153
154#define SH2_NETWORK_BANK_OFFSET(x) \
155 ((u64)(x) & ((1UL << (sn_hub_info->nasid_shift - 4)) -1))
156
157#define SH2_NETWORK_BANK_SELECT(x) \
158 ((((u64)(x) & (0x3UL << (sn_hub_info->nasid_shift - 4))) \
159 >> (sn_hub_info->nasid_shift - 4)) << 36)
160
161#define SH2_NETWORK_ADDRESS(x) \
162 (SH2_NETWORK_BANK_OFFSET(x) | SH2_NETWORK_BANK_SELECT(x))
163
164#define SH2_TIO_PHYS_TO_DMA(x) \
165 (((u64)(NASID_GET(x)) << 40) | SH2_NETWORK_ADDRESS(x))
166
167#define PHYS_TO_TIODMA(x) \
168 (is_shub1() ? SH1_TIO_PHYS_TO_DMA(x) : SH2_TIO_PHYS_TO_DMA(x))
169
170#define PHYS_TO_DMA(x) \
171 ((((u64)(x) & NASID_MASK) >> 2) | NODE_OFFSET(x))
162 172
163 173
164/* 174/*
165 * Macros to test for address type. 175 * Macros to test for address type.
166 */ 176 */
167#define IS_AMO_ADDRESS(x) (((u64)(x) & (REGION_BITS | AS_MASK)) == AMO_BASE) 177#define IS_AMO_ADDRESS(x) (((u64)(x) & (RGN_BITS | AS_MASK)) == AMO_BASE)
168#define IS_AMO_PHYS_ADDRESS(x) (((u64)(x) & (REGION_BITS | AS_MASK)) == AMO_PHYS_BASE) 178#define IS_AMO_PHYS_ADDRESS(x) (((u64)(x) & (RGN_BITS | AS_MASK)) == AMO_PHYS_BASE)
169 179
170 180
171/* 181/*
@@ -180,18 +190,20 @@
180#define TIO_SWIN_BASE(n, w) (TIO_IO_BASE(n) + \ 190#define TIO_SWIN_BASE(n, w) (TIO_IO_BASE(n) + \
181 ((u64) (w) << TIO_SWIN_SIZE_BITS)) 191 ((u64) (w) << TIO_SWIN_SIZE_BITS))
182#define NODE_IO_BASE(n) (GLOBAL_MMR_SPACE | NASID_SPACE(n)) 192#define NODE_IO_BASE(n) (GLOBAL_MMR_SPACE | NASID_SPACE(n))
183#define TIO_IO_BASE(n) (UNCACHED | NASID_SPACE(n)) 193#define TIO_IO_BASE(n) (__IA64_UNCACHED_OFFSET | NASID_SPACE(n))
184#define BWIN_SIZE (1UL << BWIN_SIZE_BITS) 194#define BWIN_SIZE (1UL << BWIN_SIZE_BITS)
185#define NODE_BWIN_BASE0(n) (NODE_IO_BASE(n) + BWIN_SIZE) 195#define NODE_BWIN_BASE0(n) (NODE_IO_BASE(n) + BWIN_SIZE)
186#define NODE_BWIN_BASE(n, w) (NODE_BWIN_BASE0(n) + ((u64) (w) << BWIN_SIZE_BITS)) 196#define NODE_BWIN_BASE(n, w) (NODE_BWIN_BASE0(n) + ((u64) (w) << BWIN_SIZE_BITS))
187#define RAW_NODE_SWIN_BASE(n, w) (NODE_IO_BASE(n) + ((u64) (w) << SWIN_SIZE_BITS)) 197#define RAW_NODE_SWIN_BASE(n, w) (NODE_IO_BASE(n) + ((u64) (w) << SWIN_SIZE_BITS))
188#define BWIN_WIDGET_MASK 0x7 198#define BWIN_WIDGET_MASK 0x7
189#define BWIN_WINDOWNUM(x) (((x) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK) 199#define BWIN_WINDOWNUM(x) (((x) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
200#define SH1_IS_BIG_WINDOW_ADDR(x) ((x) & BWIN_TOP)
190 201
191#define TIO_BWIN_WINDOW_SELECT_MASK 0x7 202#define TIO_BWIN_WINDOW_SELECT_MASK 0x7
192#define TIO_BWIN_WINDOWNUM(x) (((x) >> TIO_BWIN_SIZE_BITS) & TIO_BWIN_WINDOW_SELECT_MASK) 203#define TIO_BWIN_WINDOWNUM(x) (((x) >> TIO_BWIN_SIZE_BITS) & TIO_BWIN_WINDOW_SELECT_MASK)
193 204
194 205#define TIO_HWIN_SHIFT_BITS 33
206#define TIO_HWIN(x) (NODE_OFFSET(x) >> TIO_HWIN_SHIFT_BITS)
195 207
196/* 208/*
197 * The following definitions pertain to the IO special address 209 * The following definitions pertain to the IO special address
@@ -216,10 +228,6 @@
216#define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK) 228#define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK)
217 229
218 230
219#define TIO_IOSPACE_ADDR(n,x) \
220 /* Move in the Chiplet ID for TIO Local Block MMR */ \
221 (REMOTE_ADDR(n,x) | 1UL << (NASID_SHIFT - 2))
222
223/* 231/*
224 * The following macros produce the correct base virtual address for 232 * The following macros produce the correct base virtual address for
225 * the hub registers. The REMOTE_HUB_* macro produce 233 * the hub registers. The REMOTE_HUB_* macro produce
@@ -234,18 +242,40 @@
234 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S(). 242 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
235 * They're always safe. 243 * They're always safe.
236 */ 244 */
245/* Shub1 TIO & MMR addressing macros */
246#define SH1_TIO_IOSPACE_ADDR(n,x) \
247 GLOBAL_MMR_ADDR(n,x)
248
249#define SH1_REMOTE_BWIN_MMR(n,x) \
250 GLOBAL_MMR_ADDR(n,x)
251
252#define SH1_REMOTE_SWIN_MMR(n,x) \
253 (NODE_SWIN_BASE(n,1) + 0x800000UL + (x))
254
255#define SH1_REMOTE_MMR(n,x) \
256 (SH1_IS_BIG_WINDOW_ADDR(x) ? SH1_REMOTE_BWIN_MMR(n,x) : \
257 SH1_REMOTE_SWIN_MMR(n,x))
258
259/* Shub1 TIO & MMR addressing macros */
260#define SH2_TIO_IOSPACE_ADDR(n,x) \
261 ((__IA64_UNCACHED_OFFSET | REMOTE_ADDR(n,x) | 1UL << (NASID_SHIFT - 2)))
262
263#define SH2_REMOTE_MMR(n,x) \
264 GLOBAL_MMR_ADDR(n,x)
265
266
267/* TIO & MMR addressing macros that work on both shub1 & shub2 */
268#define TIO_IOSPACE_ADDR(n,x) \
269 ((u64 *)(is_shub1() ? SH1_TIO_IOSPACE_ADDR(n,x) : \
270 SH2_TIO_IOSPACE_ADDR(n,x)))
271
272#define SH_REMOTE_MMR(n,x) \
273 (is_shub1() ? SH1_REMOTE_MMR(n,x) : SH2_REMOTE_MMR(n,x))
274
237#define REMOTE_HUB_ADDR(n,x) \ 275#define REMOTE_HUB_ADDR(n,x) \
238 ((n & 1) ? \ 276 (IS_TIO_NASID(n) ? ((volatile u64*)TIO_IOSPACE_ADDR(n,x)) : \
239 /* TIO: */ \ 277 ((volatile u64*)SH_REMOTE_MMR(n,x)))
240 (is_shub2() ? \ 278
241 /* TIO on Shub2 */ \
242 (volatile u64 *)(TIO_IOSPACE_ADDR(n,x)) \
243 : /* TIO on shub1 */ \
244 (volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \
245 \
246 : /* SHUB1 and SHUB2 MMRs: */ \
247 (((x) & BWIN_TOP) ? ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \
248 : ((volatile u64 *)(NODE_SWIN_BASE(n,1) + 0x800000 + (x)))))
249 279
250#define HUB_L(x) (*((volatile typeof(*x) *)x)) 280#define HUB_L(x) (*((volatile typeof(*x) *)x))
251#define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d)) 281#define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d))
diff --git a/include/asm-ia64/sn/geo.h b/include/asm-ia64/sn/geo.h
index 84b254603b8d..f083c9434066 100644
--- a/include/asm-ia64/sn/geo.h
+++ b/include/asm-ia64/sn/geo.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#ifndef _ASM_IA64_SN_GEO_H 9#ifndef _ASM_IA64_SN_GEO_H
@@ -108,7 +108,6 @@ typedef union geoid_u {
108#define INVALID_SLAB (slabid_t)-1 108#define INVALID_SLAB (slabid_t)-1
109#define INVALID_SLOT (slotid_t)-1 109#define INVALID_SLOT (slotid_t)-1
110#define INVALID_MODULE ((moduleid_t)-1) 110#define INVALID_MODULE ((moduleid_t)-1)
111#define INVALID_PARTID ((partid_t)-1)
112 111
113static inline slabid_t geo_slab(geoid_t g) 112static inline slabid_t geo_slab(geoid_t g)
114{ 113{
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
index e190dd4213d5..e35074f526d9 100644
--- a/include/asm-ia64/sn/intr.h
+++ b/include/asm-ia64/sn/intr.h
@@ -12,13 +12,12 @@
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13 13
14#define SGI_UART_VECTOR (0xe9) 14#define SGI_UART_VECTOR (0xe9)
15#define SGI_PCIBR_ERROR (0x33)
16 15
17/* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */ 16/* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */
18#define SGI_XPC_ACTIVATE (0x30) 17#define SGI_XPC_ACTIVATE (0x30)
19#define SGI_II_ERROR (0x31) 18#define SGI_II_ERROR (0x31)
20#define SGI_XBOW_ERROR (0x32) 19#define SGI_XBOW_ERROR (0x32)
21#define SGI_PCIBR_ERROR (0x33) 20#define SGI_PCIASIC_ERROR (0x33)
22#define SGI_ACPI_SCI_INT (0x34) 21#define SGI_ACPI_SCI_INT (0x34)
23#define SGI_TIOCA_ERROR (0x35) 22#define SGI_TIOCA_ERROR (0x35)
24#define SGI_TIO_ERROR (0x36) 23#define SGI_TIO_ERROR (0x36)
diff --git a/include/asm-ia64/sn/nodepda.h b/include/asm-ia64/sn/nodepda.h
index 7138b1eafd6b..47bb8100fd00 100644
--- a/include/asm-ia64/sn/nodepda.h
+++ b/include/asm-ia64/sn/nodepda.h
@@ -37,7 +37,6 @@ struct phys_cpuid {
37 37
38struct nodepda_s { 38struct nodepda_s {
39 void *pdinfo; /* Platform-dependent per-node info */ 39 void *pdinfo; /* Platform-dependent per-node info */
40 spinlock_t bist_lock;
41 40
42 /* 41 /*
43 * The BTEs on this node are shared by the local cpus 42 * The BTEs on this node are shared by the local cpus
@@ -55,6 +54,8 @@ struct nodepda_s {
55 * Array of physical cpu identifiers. Indexed by cpuid. 54 * Array of physical cpu identifiers. Indexed by cpuid.
56 */ 55 */
57 struct phys_cpuid phys_cpuid[NR_CPUS]; 56 struct phys_cpuid phys_cpuid[NR_CPUS];
57 spinlock_t ptc_lock ____cacheline_aligned_in_smp;
58 spinlock_t bist_lock;
58}; 59};
59 60
60typedef struct nodepda_s nodepda_t; 61typedef struct nodepda_s nodepda_t;
diff --git a/include/asm-ia64/sn/pcibus_provider_defs.h b/include/asm-ia64/sn/pcibus_provider_defs.h
index 976f5eff0539..ad0e8e8ae53f 100644
--- a/include/asm-ia64/sn/pcibus_provider_defs.h
+++ b/include/asm-ia64/sn/pcibus_provider_defs.h
@@ -18,8 +18,9 @@
18#define PCIIO_ASIC_TYPE_PIC 2 18#define PCIIO_ASIC_TYPE_PIC 2
19#define PCIIO_ASIC_TYPE_TIOCP 3 19#define PCIIO_ASIC_TYPE_TIOCP 3
20#define PCIIO_ASIC_TYPE_TIOCA 4 20#define PCIIO_ASIC_TYPE_TIOCA 4
21#define PCIIO_ASIC_TYPE_TIOCE 5
21 22
22#define PCIIO_ASIC_MAX_TYPES 5 23#define PCIIO_ASIC_MAX_TYPES 6
23 24
24/* 25/*
25 * Common pciio bus provider data. There should be one of these as the 26 * Common pciio bus provider data. There should be one of these as the
@@ -30,7 +31,8 @@
30struct pcibus_bussoft { 31struct pcibus_bussoft {
31 uint32_t bs_asic_type; /* chipset type */ 32 uint32_t bs_asic_type; /* chipset type */
32 uint32_t bs_xid; /* xwidget id */ 33 uint32_t bs_xid; /* xwidget id */
33 uint64_t bs_persist_busnum; /* Persistent Bus Number */ 34 uint32_t bs_persist_busnum; /* Persistent Bus Number */
35 uint32_t bs_persist_segment; /* Segment Number */
34 uint64_t bs_legacy_io; /* legacy io pio addr */ 36 uint64_t bs_legacy_io; /* legacy io pio addr */
35 uint64_t bs_legacy_mem; /* legacy mem pio addr */ 37 uint64_t bs_legacy_mem; /* legacy mem pio addr */
36 uint64_t bs_base; /* widget base */ 38 uint64_t bs_base; /* widget base */
@@ -47,6 +49,8 @@ struct sn_pcibus_provider {
47 dma_addr_t (*dma_map_consistent)(struct pci_dev *, unsigned long, size_t); 49 dma_addr_t (*dma_map_consistent)(struct pci_dev *, unsigned long, size_t);
48 void (*dma_unmap)(struct pci_dev *, dma_addr_t, int); 50 void (*dma_unmap)(struct pci_dev *, dma_addr_t, int);
49 void * (*bus_fixup)(struct pcibus_bussoft *, struct pci_controller *); 51 void * (*bus_fixup)(struct pcibus_bussoft *, struct pci_controller *);
52 void (*force_interrupt)(struct sn_irq_info *);
53 void (*target_interrupt)(struct sn_irq_info *);
50}; 54};
51 55
52extern struct sn_pcibus_provider *sn_pci_provider[]; 56extern struct sn_pcibus_provider *sn_pci_provider[];
diff --git a/include/asm-ia64/sn/pda.h b/include/asm-ia64/sn/pda.h
index ea5590c76ca4..1c5108d44d8b 100644
--- a/include/asm-ia64/sn/pda.h
+++ b/include/asm-ia64/sn/pda.h
@@ -39,7 +39,6 @@ typedef struct pda_s {
39 unsigned long pio_write_status_val; 39 unsigned long pio_write_status_val;
40 volatile unsigned long *pio_shub_war_cam_addr; 40 volatile unsigned long *pio_shub_war_cam_addr;
41 41
42 unsigned long sn_soft_irr[4];
43 unsigned long sn_in_service_ivecs[4]; 42 unsigned long sn_in_service_ivecs[4];
44 int sn_lb_int_war_ticks; 43 int sn_lb_int_war_ticks;
45 int sn_last_irq; 44 int sn_last_irq;
diff --git a/include/asm-ia64/sn/sn2/sn_hwperf.h b/include/asm-ia64/sn/sn2/sn_hwperf.h
index df75f4c4aec3..291ef3d69da2 100644
--- a/include/asm-ia64/sn/sn2/sn_hwperf.h
+++ b/include/asm-ia64/sn/sn2/sn_hwperf.h
@@ -43,6 +43,7 @@ struct sn_hwperf_object_info {
43 43
44/* macros for object classification */ 44/* macros for object classification */
45#define SN_HWPERF_IS_NODE(x) ((x) && strstr((x)->name, "SHub")) 45#define SN_HWPERF_IS_NODE(x) ((x) && strstr((x)->name, "SHub"))
46#define SN_HWPERF_IS_NODE_SHUB2(x) ((x) && strstr((x)->name, "SHub 2."))
46#define SN_HWPERF_IS_IONODE(x) ((x) && strstr((x)->name, "TIO")) 47#define SN_HWPERF_IS_IONODE(x) ((x) && strstr((x)->name, "TIO"))
47#define SN_HWPERF_IS_ROUTER(x) ((x) && strstr((x)->name, "Router")) 48#define SN_HWPERF_IS_ROUTER(x) ((x) && strstr((x)->name, "Router"))
48#define SN_HWPERF_IS_NL3ROUTER(x) ((x) && strstr((x)->name, "NL3Router")) 49#define SN_HWPERF_IS_NL3ROUTER(x) ((x) && strstr((x)->name, "NL3Router"))
@@ -214,6 +215,15 @@ struct sn_hwperf_ioctl_args {
214 */ 215 */
215#define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT) 216#define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT)
216 217
218/*
219 * Given a node id, determine the id of the nearest node with CPUs
220 * and the id of the nearest node that has memory. The argument
221 * node would normally be a "headless" node, e.g. an "IO node".
222 * Return 0 on success.
223 */
224extern int sn_hwperf_get_nearest_node(cnodeid_t node,
225 cnodeid_t *near_mem, cnodeid_t *near_cpu);
226
217/* return codes */ 227/* return codes */
218#define SN_HWPERF_OP_OK 0 228#define SN_HWPERF_OP_OK 0
219#define SN_HWPERF_OP_NOMEM 1 229#define SN_HWPERF_OP_NOMEM 1
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index 27976d223186..e67825ad1930 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -55,7 +55,6 @@
55#define SN_SAL_BUS_CONFIG 0x02000037 55#define SN_SAL_BUS_CONFIG 0x02000037
56#define SN_SAL_SYS_SERIAL_GET 0x02000038 56#define SN_SAL_SYS_SERIAL_GET 0x02000038
57#define SN_SAL_PARTITION_SERIAL_GET 0x02000039 57#define SN_SAL_PARTITION_SERIAL_GET 0x02000039
58#define SN_SAL_SYSCTL_PARTITION_GET 0x0200003a
59#define SN_SAL_SYSTEM_POWER_DOWN 0x0200003b 58#define SN_SAL_SYSTEM_POWER_DOWN 0x0200003b
60#define SN_SAL_GET_MASTER_BASEIO_NASID 0x0200003c 59#define SN_SAL_GET_MASTER_BASEIO_NASID 0x0200003c
61#define SN_SAL_COHERENCE 0x0200003d 60#define SN_SAL_COHERENCE 0x0200003d
@@ -78,7 +77,8 @@
78 77
79#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 78#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
80#define SN_SAL_BTE_RECOVER 0x02000061 79#define SN_SAL_BTE_RECOVER 0x02000061
81#define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000062 80#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062
81#define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000064
82 82
83/* 83/*
84 * Service-specific constants 84 * Service-specific constants
@@ -586,35 +586,6 @@ sn_partition_serial_number_val(void) {
586} 586}
587 587
588/* 588/*
589 * Returns the partition id of the nasid passed in as an argument,
590 * or INVALID_PARTID if the partition id cannot be retrieved.
591 */
592static inline partid_t
593ia64_sn_sysctl_partition_get(nasid_t nasid)
594{
595 struct ia64_sal_retval ret_stuff;
596 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_SYSCTL_PARTITION_GET, nasid,
597 0, 0, 0, 0, 0, 0);
598 if (ret_stuff.status != 0)
599 return INVALID_PARTID;
600 return ((partid_t)ret_stuff.v0);
601}
602
603/*
604 * Returns the partition id of the current processor.
605 */
606
607extern partid_t sn_partid;
608
609static inline partid_t
610sn_local_partid(void) {
611 if (unlikely(sn_partid < 0)) {
612 sn_partid = ia64_sn_sysctl_partition_get(cpuid_to_nasid(smp_processor_id()));
613 }
614 return sn_partid;
615}
616
617/*
618 * Returns the physical address of the partition's reserved page through 589 * Returns the physical address of the partition's reserved page through
619 * an iterative number of calls. 590 * an iterative number of calls.
620 * 591 *
@@ -749,7 +720,8 @@ ia64_sn_power_down(void)
749{ 720{
750 struct ia64_sal_retval ret_stuff; 721 struct ia64_sal_retval ret_stuff;
751 SAL_CALL(ret_stuff, SN_SAL_SYSTEM_POWER_DOWN, 0, 0, 0, 0, 0, 0, 0); 722 SAL_CALL(ret_stuff, SN_SAL_SYSTEM_POWER_DOWN, 0, 0, 0, 0, 0, 0, 0);
752 while(1); 723 while(1)
724 cpu_relax();
753 /* never returns */ 725 /* never returns */
754} 726}
755 727
@@ -1018,24 +990,6 @@ ia64_sn_get_sn_info(int fc, u8 *shubtype, u16 *nasid_bitmask, u8 *nasid_shift,
1018 ret_stuff.v2 = 0; 990 ret_stuff.v2 = 0;
1019 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SN_INFO, fc, 0, 0, 0, 0, 0, 0); 991 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SN_INFO, fc, 0, 0, 0, 0, 0, 0);
1020 992
1021/***** BEGIN HACK - temp til old proms no longer supported ********/
1022 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
1023 int nasid = get_sapicid() & 0xfff;;
1024#define SH_SHUB_ID_NODES_PER_BIT_MASK 0x001f000000000000UL
1025#define SH_SHUB_ID_NODES_PER_BIT_SHFT 48
1026 if (shubtype) *shubtype = 0;
1027 if (nasid_bitmask) *nasid_bitmask = 0x7ff;
1028 if (nasid_shift) *nasid_shift = 38;
1029 if (systemsize) *systemsize = 11;
1030 if (sharing_domain_size) *sharing_domain_size = 9;
1031 if (partid) *partid = ia64_sn_sysctl_partition_get(nasid);
1032 if (coher) *coher = nasid >> 9;
1033 if (reg) *reg = (HUB_L((u64 *) LOCAL_MMR_ADDR(SH1_SHUB_ID)) & SH_SHUB_ID_NODES_PER_BIT_MASK) >>
1034 SH_SHUB_ID_NODES_PER_BIT_SHFT;
1035 return 0;
1036 }
1037/***** END HACK *******/
1038
1039 if (ret_stuff.status < 0) 993 if (ret_stuff.status < 0)
1040 return ret_stuff.status; 994 return ret_stuff.status;
1041 995
@@ -1068,12 +1022,10 @@ ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2,
1068} 1022}
1069 1023
1070static inline int 1024static inline int
1071ia64_sn_ioif_get_pci_topology(u64 rack, u64 bay, u64 slot, u64 slab, 1025ia64_sn_ioif_get_pci_topology(u64 buf, u64 len)
1072 u64 buf, u64 len)
1073{ 1026{
1074 struct ia64_sal_retval rv; 1027 struct ia64_sal_retval rv;
1075 SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, 1028 SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, buf, len, 0, 0, 0, 0, 0);
1076 rack, bay, slot, slab, buf, len, 0);
1077 return (int) rv.status; 1029 return (int) rv.status;
1078} 1030}
1079 1031
diff --git a/include/asm-ia64/sn/tioce.h b/include/asm-ia64/sn/tioce.h
new file mode 100644
index 000000000000..22879853e46c
--- /dev/null
+++ b/include/asm-ia64/sn/tioce.h
@@ -0,0 +1,740 @@
1/**************************************************************************
2 * *
3 * Unpublished copyright (c) 2005, Silicon Graphics, Inc. *
4 * THIS IS UNPUBLISHED CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF SGI. *
5 * *
6 * The copyright notice above does not evidence any actual or intended *
7 * publication or disclosure of this source code, which includes *
8 * information that is confidential and/or proprietary, and is a trade *
9 * secret, of Silicon Graphics, Inc. ANY REPRODUCTION, MODIFICATION, *
10 * DISTRIBUTION, PUBLIC PERFORMANCE, OR PUBLIC DISPLAY OF OR THROUGH *
11 * USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF *
12 * SILICON GRAPHICS, INC. IS STRICTLY PROHIBITED, AND IN VIOLATION OF *
13 * APPLICABLE LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR *
14 * POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT *
15 * CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS *
16 * CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY *
17 * DESCRIBE, IN WHOLE OR IN PART. *
18 * *
19 **************************************************************************/
20
21#ifndef __ASM_IA64_SN_TIOCE_H__
22#define __ASM_IA64_SN_TIOCE_H__
23
24/* CE ASIC part & mfgr information */
25#define TIOCE_PART_NUM 0xCE00
26#define TIOCE_MFGR_NUM 0x36
27#define TIOCE_REV_A 0x1
28
29/* CE Virtual PPB Vendor/Device IDs */
30#define CE_VIRT_PPB_VENDOR_ID 0x10a9
31#define CE_VIRT_PPB_DEVICE_ID 0x4002
32
33/* CE Host Bridge Vendor/Device IDs */
34#define CE_HOST_BRIDGE_VENDOR_ID 0x10a9
35#define CE_HOST_BRIDGE_DEVICE_ID 0x4003
36
37
38#define TIOCE_NUM_M40_ATES 4096
39#define TIOCE_NUM_M3240_ATES 2048
40#define TIOCE_NUM_PORTS 2
41
42/*
43 * Register layout for TIOCE. MMR offsets are shown at the far right of the
44 * structure definition.
45 */
46typedef volatile struct tioce {
47 /*
48 * ADMIN : Administration Registers
49 */
50 uint64_t ce_adm_id; /* 0x000000 */
51 uint64_t ce_pad_000008; /* 0x000008 */
52 uint64_t ce_adm_dyn_credit_status; /* 0x000010 */
53 uint64_t ce_adm_last_credit_status; /* 0x000018 */
54 uint64_t ce_adm_credit_limit; /* 0x000020 */
55 uint64_t ce_adm_force_credit; /* 0x000028 */
56 uint64_t ce_adm_control; /* 0x000030 */
57 uint64_t ce_adm_mmr_chn_timeout; /* 0x000038 */
58 uint64_t ce_adm_ssp_ure_timeout; /* 0x000040 */
59 uint64_t ce_adm_ssp_dre_timeout; /* 0x000048 */
60 uint64_t ce_adm_ssp_debug_sel; /* 0x000050 */
61 uint64_t ce_adm_int_status; /* 0x000058 */
62 uint64_t ce_adm_int_status_alias; /* 0x000060 */
63 uint64_t ce_adm_int_mask; /* 0x000068 */
64 uint64_t ce_adm_int_pending; /* 0x000070 */
65 uint64_t ce_adm_force_int; /* 0x000078 */
66 uint64_t ce_adm_ure_ups_buf_barrier_flush; /* 0x000080 */
67 uint64_t ce_adm_int_dest[15]; /* 0x000088 -- 0x0000F8 */
68 uint64_t ce_adm_error_summary; /* 0x000100 */
69 uint64_t ce_adm_error_summary_alias; /* 0x000108 */
70 uint64_t ce_adm_error_mask; /* 0x000110 */
71 uint64_t ce_adm_first_error; /* 0x000118 */
72 uint64_t ce_adm_error_overflow; /* 0x000120 */
73 uint64_t ce_adm_error_overflow_alias; /* 0x000128 */
74 uint64_t ce_pad_000130[2]; /* 0x000130 -- 0x000138 */
75 uint64_t ce_adm_tnum_error; /* 0x000140 */
76 uint64_t ce_adm_mmr_err_detail; /* 0x000148 */
77 uint64_t ce_adm_msg_sram_perr_detail; /* 0x000150 */
78 uint64_t ce_adm_bap_sram_perr_detail; /* 0x000158 */
79 uint64_t ce_adm_ce_sram_perr_detail; /* 0x000160 */
80 uint64_t ce_adm_ce_credit_oflow_detail; /* 0x000168 */
81 uint64_t ce_adm_tx_link_idle_max_timer; /* 0x000170 */
82 uint64_t ce_adm_pcie_debug_sel; /* 0x000178 */
83 uint64_t ce_pad_000180[16]; /* 0x000180 -- 0x0001F8 */
84
85 uint64_t ce_adm_pcie_debug_sel_top; /* 0x000200 */
86 uint64_t ce_adm_pcie_debug_lat_sel_lo_top; /* 0x000208 */
87 uint64_t ce_adm_pcie_debug_lat_sel_hi_top; /* 0x000210 */
88 uint64_t ce_adm_pcie_debug_trig_sel_top; /* 0x000218 */
89 uint64_t ce_adm_pcie_debug_trig_lat_sel_lo_top; /* 0x000220 */
90 uint64_t ce_adm_pcie_debug_trig_lat_sel_hi_top; /* 0x000228 */
91 uint64_t ce_adm_pcie_trig_compare_top; /* 0x000230 */
92 uint64_t ce_adm_pcie_trig_compare_en_top; /* 0x000238 */
93 uint64_t ce_adm_ssp_debug_sel_top; /* 0x000240 */
94 uint64_t ce_adm_ssp_debug_lat_sel_lo_top; /* 0x000248 */
95 uint64_t ce_adm_ssp_debug_lat_sel_hi_top; /* 0x000250 */
96 uint64_t ce_adm_ssp_debug_trig_sel_top; /* 0x000258 */
97 uint64_t ce_adm_ssp_debug_trig_lat_sel_lo_top; /* 0x000260 */
98 uint64_t ce_adm_ssp_debug_trig_lat_sel_hi_top; /* 0x000268 */
99 uint64_t ce_adm_ssp_trig_compare_top; /* 0x000270 */
100 uint64_t ce_adm_ssp_trig_compare_en_top; /* 0x000278 */
101 uint64_t ce_pad_000280[48]; /* 0x000280 -- 0x0003F8 */
102
103 uint64_t ce_adm_bap_ctrl; /* 0x000400 */
104 uint64_t ce_pad_000408[127]; /* 0x000408 -- 0x0007F8 */
105
106 uint64_t ce_msg_buf_data63_0[35]; /* 0x000800 -- 0x000918 */
107 uint64_t ce_pad_000920[29]; /* 0x000920 -- 0x0009F8 */
108
109 uint64_t ce_msg_buf_data127_64[35]; /* 0x000A00 -- 0x000B18 */
110 uint64_t ce_pad_000B20[29]; /* 0x000B20 -- 0x000BF8 */
111
112 uint64_t ce_msg_buf_parity[35]; /* 0x000C00 -- 0x000D18 */
113 uint64_t ce_pad_000D20[29]; /* 0x000D20 -- 0x000DF8 */
114
115 uint64_t ce_pad_000E00[576]; /* 0x000E00 -- 0x001FF8 */
116
117 /*
118 * LSI : LSI's PCI Express Link Registers (Link#1 and Link#2)
119 * Link#1 MMRs at start at 0x002000, Link#2 MMRs at 0x003000
120 * NOTE: the comment offsets at far right: let 'z' = {2 or 3}
121 */
122 #define ce_lsi(link_num) ce_lsi[link_num-1]
123 struct ce_lsi_reg {
124 uint64_t ce_lsi_lpu_id; /* 0x00z000 */
125 uint64_t ce_lsi_rst; /* 0x00z008 */
126 uint64_t ce_lsi_dbg_stat; /* 0x00z010 */
127 uint64_t ce_lsi_dbg_cfg; /* 0x00z018 */
128 uint64_t ce_lsi_ltssm_ctrl; /* 0x00z020 */
129 uint64_t ce_lsi_lk_stat; /* 0x00z028 */
130 uint64_t ce_pad_00z030[2]; /* 0x00z030 -- 0x00z038 */
131 uint64_t ce_lsi_int_and_stat; /* 0x00z040 */
132 uint64_t ce_lsi_int_mask; /* 0x00z048 */
133 uint64_t ce_pad_00z050[22]; /* 0x00z050 -- 0x00z0F8 */
134 uint64_t ce_lsi_lk_perf_cnt_sel; /* 0x00z100 */
135 uint64_t ce_pad_00z108; /* 0x00z108 */
136 uint64_t ce_lsi_lk_perf_cnt_ctrl; /* 0x00z110 */
137 uint64_t ce_pad_00z118; /* 0x00z118 */
138 uint64_t ce_lsi_lk_perf_cnt1; /* 0x00z120 */
139 uint64_t ce_lsi_lk_perf_cnt1_test; /* 0x00z128 */
140 uint64_t ce_lsi_lk_perf_cnt2; /* 0x00z130 */
141 uint64_t ce_lsi_lk_perf_cnt2_test; /* 0x00z138 */
142 uint64_t ce_pad_00z140[24]; /* 0x00z140 -- 0x00z1F8 */
143 uint64_t ce_lsi_lk_lyr_cfg; /* 0x00z200 */
144 uint64_t ce_lsi_lk_lyr_status; /* 0x00z208 */
145 uint64_t ce_lsi_lk_lyr_int_stat; /* 0x00z210 */
146 uint64_t ce_lsi_lk_ly_int_stat_test; /* 0x00z218 */
147 uint64_t ce_lsi_lk_ly_int_stat_mask; /* 0x00z220 */
148 uint64_t ce_pad_00z228[3]; /* 0x00z228 -- 0x00z238 */
149 uint64_t ce_lsi_fc_upd_ctl; /* 0x00z240 */
150 uint64_t ce_pad_00z248[3]; /* 0x00z248 -- 0x00z258 */
151 uint64_t ce_lsi_flw_ctl_upd_to_timer; /* 0x00z260 */
152 uint64_t ce_lsi_flw_ctl_upd_timer0; /* 0x00z268 */
153 uint64_t ce_lsi_flw_ctl_upd_timer1; /* 0x00z270 */
154 uint64_t ce_pad_00z278[49]; /* 0x00z278 -- 0x00z3F8 */
155 uint64_t ce_lsi_freq_nak_lat_thrsh; /* 0x00z400 */
156 uint64_t ce_lsi_ack_nak_lat_tmr; /* 0x00z408 */
157 uint64_t ce_lsi_rply_tmr_thr; /* 0x00z410 */
158 uint64_t ce_lsi_rply_tmr; /* 0x00z418 */
159 uint64_t ce_lsi_rply_num_stat; /* 0x00z420 */
160 uint64_t ce_lsi_rty_buf_max_addr; /* 0x00z428 */
161 uint64_t ce_lsi_rty_fifo_ptr; /* 0x00z430 */
162 uint64_t ce_lsi_rty_fifo_rd_wr_ptr; /* 0x00z438 */
163 uint64_t ce_lsi_rty_fifo_cred; /* 0x00z440 */
164 uint64_t ce_lsi_seq_cnt; /* 0x00z448 */
165 uint64_t ce_lsi_ack_sent_seq_num; /* 0x00z450 */
166 uint64_t ce_lsi_seq_cnt_fifo_max_addr; /* 0x00z458 */
167 uint64_t ce_lsi_seq_cnt_fifo_ptr; /* 0x00z460 */
168 uint64_t ce_lsi_seq_cnt_rd_wr_ptr; /* 0x00z468 */
169 uint64_t ce_lsi_tx_lk_ts_ctl; /* 0x00z470 */
170 uint64_t ce_pad_00z478; /* 0x00z478 */
171 uint64_t ce_lsi_mem_addr_ctl; /* 0x00z480 */
172 uint64_t ce_lsi_mem_d_ld0; /* 0x00z488 */
173 uint64_t ce_lsi_mem_d_ld1; /* 0x00z490 */
174 uint64_t ce_lsi_mem_d_ld2; /* 0x00z498 */
175 uint64_t ce_lsi_mem_d_ld3; /* 0x00z4A0 */
176 uint64_t ce_lsi_mem_d_ld4; /* 0x00z4A8 */
177 uint64_t ce_pad_00z4B0[2]; /* 0x00z4B0 -- 0x00z4B8 */
178 uint64_t ce_lsi_rty_d_cnt; /* 0x00z4C0 */
179 uint64_t ce_lsi_seq_buf_cnt; /* 0x00z4C8 */
180 uint64_t ce_lsi_seq_buf_bt_d; /* 0x00z4D0 */
181 uint64_t ce_pad_00z4D8; /* 0x00z4D8 */
182 uint64_t ce_lsi_ack_lat_thr; /* 0x00z4E0 */
183 uint64_t ce_pad_00z4E8[3]; /* 0x00z4E8 -- 0x00z4F8 */
184 uint64_t ce_lsi_nxt_rcv_seq_1_cntr; /* 0x00z500 */
185 uint64_t ce_lsi_unsp_dllp_rcvd; /* 0x00z508 */
186 uint64_t ce_lsi_rcv_lk_ts_ctl; /* 0x00z510 */
187 uint64_t ce_pad_00z518[29]; /* 0x00z518 -- 0x00z5F8 */
188 uint64_t ce_lsi_phy_lyr_cfg; /* 0x00z600 */
189 uint64_t ce_pad_00z608; /* 0x00z608 */
190 uint64_t ce_lsi_phy_lyr_int_stat; /* 0x00z610 */
191 uint64_t ce_lsi_phy_lyr_int_stat_test; /* 0x00z618 */
192 uint64_t ce_lsi_phy_lyr_int_mask; /* 0x00z620 */
193 uint64_t ce_pad_00z628[11]; /* 0x00z628 -- 0x00z678 */
194 uint64_t ce_lsi_rcv_phy_cfg; /* 0x00z680 */
195 uint64_t ce_lsi_rcv_phy_stat1; /* 0x00z688 */
196 uint64_t ce_lsi_rcv_phy_stat2; /* 0x00z690 */
197 uint64_t ce_lsi_rcv_phy_stat3; /* 0x00z698 */
198 uint64_t ce_lsi_rcv_phy_int_stat; /* 0x00z6A0 */
199 uint64_t ce_lsi_rcv_phy_int_stat_test; /* 0x00z6A8 */
200 uint64_t ce_lsi_rcv_phy_int_mask; /* 0x00z6B0 */
201 uint64_t ce_pad_00z6B8[9]; /* 0x00z6B8 -- 0x00z6F8 */
202 uint64_t ce_lsi_tx_phy_cfg; /* 0x00z700 */
203 uint64_t ce_lsi_tx_phy_stat; /* 0x00z708 */
204 uint64_t ce_lsi_tx_phy_int_stat; /* 0x00z710 */
205 uint64_t ce_lsi_tx_phy_int_stat_test; /* 0x00z718 */
206 uint64_t ce_lsi_tx_phy_int_mask; /* 0x00z720 */
207 uint64_t ce_lsi_tx_phy_stat2; /* 0x00z728 */
208 uint64_t ce_pad_00z730[10]; /* 0x00z730 -- 0x00z77F */
209 uint64_t ce_lsi_ltssm_cfg1; /* 0x00z780 */
210 uint64_t ce_lsi_ltssm_cfg2; /* 0x00z788 */
211 uint64_t ce_lsi_ltssm_cfg3; /* 0x00z790 */
212 uint64_t ce_lsi_ltssm_cfg4; /* 0x00z798 */
213 uint64_t ce_lsi_ltssm_cfg5; /* 0x00z7A0 */
214 uint64_t ce_lsi_ltssm_stat1; /* 0x00z7A8 */
215 uint64_t ce_lsi_ltssm_stat2; /* 0x00z7B0 */
216 uint64_t ce_lsi_ltssm_int_stat; /* 0x00z7B8 */
217 uint64_t ce_lsi_ltssm_int_stat_test; /* 0x00z7C0 */
218 uint64_t ce_lsi_ltssm_int_mask; /* 0x00z7C8 */
219 uint64_t ce_lsi_ltssm_stat_wr_en; /* 0x00z7D0 */
220 uint64_t ce_pad_00z7D8[5]; /* 0x00z7D8 -- 0x00z7F8 */
221 uint64_t ce_lsi_gb_cfg1; /* 0x00z800 */
222 uint64_t ce_lsi_gb_cfg2; /* 0x00z808 */
223 uint64_t ce_lsi_gb_cfg3; /* 0x00z810 */
224 uint64_t ce_lsi_gb_cfg4; /* 0x00z818 */
225 uint64_t ce_lsi_gb_stat; /* 0x00z820 */
226 uint64_t ce_lsi_gb_int_stat; /* 0x00z828 */
227 uint64_t ce_lsi_gb_int_stat_test; /* 0x00z830 */
228 uint64_t ce_lsi_gb_int_mask; /* 0x00z838 */
229 uint64_t ce_lsi_gb_pwr_dn1; /* 0x00z840 */
230 uint64_t ce_lsi_gb_pwr_dn2; /* 0x00z848 */
231 uint64_t ce_pad_00z850[246]; /* 0x00z850 -- 0x00zFF8 */
232 } ce_lsi[2];
233
234 uint64_t ce_pad_004000[10]; /* 0x004000 -- 0x004048 */
235
236 /*
237 * CRM: Coretalk Receive Module Registers
238 */
239 uint64_t ce_crm_debug_mux; /* 0x004050 */
240 uint64_t ce_pad_004058; /* 0x004058 */
241 uint64_t ce_crm_ssp_err_cmd_wrd; /* 0x004060 */
242 uint64_t ce_crm_ssp_err_addr; /* 0x004068 */
243 uint64_t ce_crm_ssp_err_syn; /* 0x004070 */
244
245 uint64_t ce_pad_004078[499]; /* 0x004078 -- 0x005008 */
246
247 /*
248 * CXM: Coretalk Xmit Module Registers
249 */
250 uint64_t ce_cxm_dyn_credit_status; /* 0x005010 */
251 uint64_t ce_cxm_last_credit_status; /* 0x005018 */
252 uint64_t ce_cxm_credit_limit; /* 0x005020 */
253 uint64_t ce_cxm_force_credit; /* 0x005028 */
254 uint64_t ce_cxm_disable_bypass; /* 0x005030 */
255 uint64_t ce_pad_005038[3]; /* 0x005038 -- 0x005048 */
256 uint64_t ce_cxm_debug_mux; /* 0x005050 */
257
258 uint64_t ce_pad_005058[501]; /* 0x005058 -- 0x005FF8 */
259
260 /*
261 * DTL: Downstream Transaction Layer Regs (Link#1 and Link#2)
262 * DTL: Link#1 MMRs at start at 0x006000, Link#2 MMRs at 0x008000
263 * DTL: the comment offsets at far right: let 'y' = {6 or 8}
264 *
265 * UTL: Downstream Transaction Layer Regs (Link#1 and Link#2)
266 * UTL: Link#1 MMRs at start at 0x007000, Link#2 MMRs at 0x009000
267 * UTL: the comment offsets at far right: let 'z' = {7 or 9}
268 */
269 #define ce_dtl(link_num) ce_dtl_utl[link_num-1]
270 #define ce_utl(link_num) ce_dtl_utl[link_num-1]
271 struct ce_dtl_utl_reg {
272 /* DTL */
273 uint64_t ce_dtl_dtdr_credit_limit; /* 0x00y000 */
274 uint64_t ce_dtl_dtdr_credit_force; /* 0x00y008 */
275 uint64_t ce_dtl_dyn_credit_status; /* 0x00y010 */
276 uint64_t ce_dtl_dtl_last_credit_stat; /* 0x00y018 */
277 uint64_t ce_dtl_dtl_ctrl; /* 0x00y020 */
278 uint64_t ce_pad_00y028[5]; /* 0x00y028 -- 0x00y048 */
279 uint64_t ce_dtl_debug_sel; /* 0x00y050 */
280 uint64_t ce_pad_00y058[501]; /* 0x00y058 -- 0x00yFF8 */
281
282 /* UTL */
283 uint64_t ce_utl_utl_ctrl; /* 0x00z000 */
284 uint64_t ce_utl_debug_sel; /* 0x00z008 */
285 uint64_t ce_pad_00z010[510]; /* 0x00z010 -- 0x00zFF8 */
286 } ce_dtl_utl[2];
287
288 uint64_t ce_pad_00A000[514]; /* 0x00A000 -- 0x00B008 */
289
290 /*
291 * URE: Upstream Request Engine
292 */
293 uint64_t ce_ure_dyn_credit_status; /* 0x00B010 */
294 uint64_t ce_ure_last_credit_status; /* 0x00B018 */
295 uint64_t ce_ure_credit_limit; /* 0x00B020 */
296 uint64_t ce_pad_00B028; /* 0x00B028 */
297 uint64_t ce_ure_control; /* 0x00B030 */
298 uint64_t ce_ure_status; /* 0x00B038 */
299 uint64_t ce_pad_00B040[2]; /* 0x00B040 -- 0x00B048 */
300 uint64_t ce_ure_debug_sel; /* 0x00B050 */
301 uint64_t ce_ure_pcie_debug_sel; /* 0x00B058 */
302 uint64_t ce_ure_ssp_err_cmd_wrd; /* 0x00B060 */
303 uint64_t ce_ure_ssp_err_addr; /* 0x00B068 */
304 uint64_t ce_ure_page_map; /* 0x00B070 */
305 uint64_t ce_ure_dir_map[TIOCE_NUM_PORTS]; /* 0x00B078 */
306 uint64_t ce_ure_pipe_sel1; /* 0x00B088 */
307 uint64_t ce_ure_pipe_mask1; /* 0x00B090 */
308 uint64_t ce_ure_pipe_sel2; /* 0x00B098 */
309 uint64_t ce_ure_pipe_mask2; /* 0x00B0A0 */
310 uint64_t ce_ure_pcie1_credits_sent; /* 0x00B0A8 */
311 uint64_t ce_ure_pcie1_credits_used; /* 0x00B0B0 */
312 uint64_t ce_ure_pcie1_credit_limit; /* 0x00B0B8 */
313 uint64_t ce_ure_pcie2_credits_sent; /* 0x00B0C0 */
314 uint64_t ce_ure_pcie2_credits_used; /* 0x00B0C8 */
315 uint64_t ce_ure_pcie2_credit_limit; /* 0x00B0D0 */
316 uint64_t ce_ure_pcie_force_credit; /* 0x00B0D8 */
317 uint64_t ce_ure_rd_tnum_val; /* 0x00B0E0 */
318 uint64_t ce_ure_rd_tnum_rsp_rcvd; /* 0x00B0E8 */
319 uint64_t ce_ure_rd_tnum_esent_timer; /* 0x00B0F0 */
320 uint64_t ce_ure_rd_tnum_error; /* 0x00B0F8 */
321 uint64_t ce_ure_rd_tnum_first_cl; /* 0x00B100 */
322 uint64_t ce_ure_rd_tnum_link_buf; /* 0x00B108 */
323 uint64_t ce_ure_wr_tnum_val; /* 0x00B110 */
324 uint64_t ce_ure_sram_err_addr0; /* 0x00B118 */
325 uint64_t ce_ure_sram_err_addr1; /* 0x00B120 */
326 uint64_t ce_ure_sram_err_addr2; /* 0x00B128 */
327 uint64_t ce_ure_sram_rd_addr0; /* 0x00B130 */
328 uint64_t ce_ure_sram_rd_addr1; /* 0x00B138 */
329 uint64_t ce_ure_sram_rd_addr2; /* 0x00B140 */
330 uint64_t ce_ure_sram_wr_addr0; /* 0x00B148 */
331 uint64_t ce_ure_sram_wr_addr1; /* 0x00B150 */
332 uint64_t ce_ure_sram_wr_addr2; /* 0x00B158 */
333 uint64_t ce_ure_buf_flush10; /* 0x00B160 */
334 uint64_t ce_ure_buf_flush11; /* 0x00B168 */
335 uint64_t ce_ure_buf_flush12; /* 0x00B170 */
336 uint64_t ce_ure_buf_flush13; /* 0x00B178 */
337 uint64_t ce_ure_buf_flush20; /* 0x00B180 */
338 uint64_t ce_ure_buf_flush21; /* 0x00B188 */
339 uint64_t ce_ure_buf_flush22; /* 0x00B190 */
340 uint64_t ce_ure_buf_flush23; /* 0x00B198 */
341 uint64_t ce_ure_pcie_control1; /* 0x00B1A0 */
342 uint64_t ce_ure_pcie_control2; /* 0x00B1A8 */
343
344 uint64_t ce_pad_00B1B0[458]; /* 0x00B1B0 -- 0x00BFF8 */
345
346 /* Upstream Data Buffer, Port1 */
347 struct ce_ure_maint_ups_dat1_data {
348 uint64_t data63_0[512]; /* 0x00C000 -- 0x00CFF8 */
349 uint64_t data127_64[512]; /* 0x00D000 -- 0x00DFF8 */
350 uint64_t parity[512]; /* 0x00E000 -- 0x00EFF8 */
351 } ce_ure_maint_ups_dat1;
352
353 /* Upstream Header Buffer, Port1 */
354 struct ce_ure_maint_ups_hdr1_data {
355 uint64_t data63_0[512]; /* 0x00F000 -- 0x00FFF8 */
356 uint64_t data127_64[512]; /* 0x010000 -- 0x010FF8 */
357 uint64_t parity[512]; /* 0x011000 -- 0x011FF8 */
358 } ce_ure_maint_ups_hdr1;
359
360 /* Upstream Data Buffer, Port2 */
361 struct ce_ure_maint_ups_dat2_data {
362 uint64_t data63_0[512]; /* 0x012000 -- 0x012FF8 */
363 uint64_t data127_64[512]; /* 0x013000 -- 0x013FF8 */
364 uint64_t parity[512]; /* 0x014000 -- 0x014FF8 */
365 } ce_ure_maint_ups_dat2;
366
367 /* Upstream Header Buffer, Port2 */
368 struct ce_ure_maint_ups_hdr2_data {
369 uint64_t data63_0[512]; /* 0x015000 -- 0x015FF8 */
370 uint64_t data127_64[512]; /* 0x016000 -- 0x016FF8 */
371 uint64_t parity[512]; /* 0x017000 -- 0x017FF8 */
372 } ce_ure_maint_ups_hdr2;
373
374 /* Downstream Data Buffer */
375 struct ce_ure_maint_dns_dat_data {
376 uint64_t data63_0[512]; /* 0x018000 -- 0x018FF8 */
377 uint64_t data127_64[512]; /* 0x019000 -- 0x019FF8 */
378 uint64_t parity[512]; /* 0x01A000 -- 0x01AFF8 */
379 } ce_ure_maint_dns_dat;
380
381 /* Downstream Header Buffer */
382 struct ce_ure_maint_dns_hdr_data {
383 uint64_t data31_0[64]; /* 0x01B000 -- 0x01B1F8 */
384 uint64_t data95_32[64]; /* 0x01B200 -- 0x01B3F8 */
385 uint64_t parity[64]; /* 0x01B400 -- 0x01B5F8 */
386 } ce_ure_maint_dns_hdr;
387
388 /* RCI Buffer Data */
389 struct ce_ure_maint_rci_data {
390 uint64_t data41_0[64]; /* 0x01B600 -- 0x01B7F8 */
391 uint64_t data69_42[64]; /* 0x01B800 -- 0x01B9F8 */
392 } ce_ure_maint_rci;
393
394 /* Response Queue */
395 uint64_t ce_ure_maint_rspq[64]; /* 0x01BA00 -- 0x01BBF8 */
396
397 uint64_t ce_pad_01C000[4224]; /* 0x01BC00 -- 0x023FF8 */
398
399 /* Admin Build-a-Packet Buffer */
400 struct ce_adm_maint_bap_buf_data {
401 uint64_t data63_0[258]; /* 0x024000 -- 0x024808 */
402 uint64_t data127_64[258]; /* 0x024810 -- 0x025018 */
403 uint64_t parity[258]; /* 0x025020 -- 0x025828 */
404 } ce_adm_maint_bap_buf;
405
406 uint64_t ce_pad_025830[5370]; /* 0x025830 -- 0x02FFF8 */
407
408 /* URE: 40bit PMU ATE Buffer */ /* 0x030000 -- 0x037FF8 */
409 uint64_t ce_ure_ate40[TIOCE_NUM_M40_ATES];
410
411 /* URE: 32/40bit PMU ATE Buffer */ /* 0x038000 -- 0x03BFF8 */
412 uint64_t ce_ure_ate3240[TIOCE_NUM_M3240_ATES];
413
414 uint64_t ce_pad_03C000[2050]; /* 0x03C000 -- 0x040008 */
415
416 /*
417 * DRE: Down Stream Request Engine
418 */
419 uint64_t ce_dre_dyn_credit_status1; /* 0x040010 */
420 uint64_t ce_dre_dyn_credit_status2; /* 0x040018 */
421 uint64_t ce_dre_last_credit_status1; /* 0x040020 */
422 uint64_t ce_dre_last_credit_status2; /* 0x040028 */
423 uint64_t ce_dre_credit_limit1; /* 0x040030 */
424 uint64_t ce_dre_credit_limit2; /* 0x040038 */
425 uint64_t ce_dre_force_credit1; /* 0x040040 */
426 uint64_t ce_dre_force_credit2; /* 0x040048 */
427 uint64_t ce_dre_debug_mux1; /* 0x040050 */
428 uint64_t ce_dre_debug_mux2; /* 0x040058 */
429 uint64_t ce_dre_ssp_err_cmd_wrd; /* 0x040060 */
430 uint64_t ce_dre_ssp_err_addr; /* 0x040068 */
431 uint64_t ce_dre_comp_err_cmd_wrd; /* 0x040070 */
432 uint64_t ce_dre_comp_err_addr; /* 0x040078 */
433 uint64_t ce_dre_req_status; /* 0x040080 */
434 uint64_t ce_dre_config1; /* 0x040088 */
435 uint64_t ce_dre_config2; /* 0x040090 */
436 uint64_t ce_dre_config_req_status; /* 0x040098 */
437 uint64_t ce_pad_0400A0[12]; /* 0x0400A0 -- 0x0400F8 */
438 uint64_t ce_dre_dyn_fifo; /* 0x040100 */
439 uint64_t ce_pad_040108[3]; /* 0x040108 -- 0x040118 */
440 uint64_t ce_dre_last_fifo; /* 0x040120 */
441
442 uint64_t ce_pad_040128[27]; /* 0x040128 -- 0x0401F8 */
443
444 /* DRE Downstream Head Queue */
445 struct ce_dre_maint_ds_head_queue {
446 uint64_t data63_0[32]; /* 0x040200 -- 0x0402F8 */
447 uint64_t data127_64[32]; /* 0x040300 -- 0x0403F8 */
448 uint64_t parity[32]; /* 0x040400 -- 0x0404F8 */
449 } ce_dre_maint_ds_head_q;
450
451 uint64_t ce_pad_040500[352]; /* 0x040500 -- 0x040FF8 */
452
453 /* DRE Downstream Data Queue */
454 struct ce_dre_maint_ds_data_queue {
455 uint64_t data63_0[256]; /* 0x041000 -- 0x0417F8 */
456 uint64_t ce_pad_041800[256]; /* 0x041800 -- 0x041FF8 */
457 uint64_t data127_64[256]; /* 0x042000 -- 0x0427F8 */
458 uint64_t ce_pad_042800[256]; /* 0x042800 -- 0x042FF8 */
459 uint64_t parity[256]; /* 0x043000 -- 0x0437F8 */
460 uint64_t ce_pad_043800[256]; /* 0x043800 -- 0x043FF8 */
461 } ce_dre_maint_ds_data_q;
462
463 /* DRE URE Upstream Response Queue */
464 struct ce_dre_maint_ure_us_rsp_queue {
465 uint64_t data63_0[8]; /* 0x044000 -- 0x044038 */
466 uint64_t ce_pad_044040[24]; /* 0x044040 -- 0x0440F8 */
467 uint64_t data127_64[8]; /* 0x044100 -- 0x044138 */
468 uint64_t ce_pad_044140[24]; /* 0x044140 -- 0x0441F8 */
469 uint64_t parity[8]; /* 0x044200 -- 0x044238 */
470 uint64_t ce_pad_044240[24]; /* 0x044240 -- 0x0442F8 */
471 } ce_dre_maint_ure_us_rsp_q;
472
473 uint64_t ce_dre_maint_us_wrt_rsp[32];/* 0x044300 -- 0x0443F8 */
474
475 uint64_t ce_end_of_struct; /* 0x044400 */
476} tioce_t;
477
478
479/* ce_adm_int_mask/ce_adm_int_status register bit defines */
480#define CE_ADM_INT_CE_ERROR_SHFT 0
481#define CE_ADM_INT_LSI1_IP_ERROR_SHFT 1
482#define CE_ADM_INT_LSI2_IP_ERROR_SHFT 2
483#define CE_ADM_INT_PCIE_ERROR_SHFT 3
484#define CE_ADM_INT_PORT1_HOTPLUG_EVENT_SHFT 4
485#define CE_ADM_INT_PORT2_HOTPLUG_EVENT_SHFT 5
486#define CE_ADM_INT_PCIE_PORT1_DEV_A_SHFT 6
487#define CE_ADM_INT_PCIE_PORT1_DEV_B_SHFT 7
488#define CE_ADM_INT_PCIE_PORT1_DEV_C_SHFT 8
489#define CE_ADM_INT_PCIE_PORT1_DEV_D_SHFT 9
490#define CE_ADM_INT_PCIE_PORT2_DEV_A_SHFT 10
491#define CE_ADM_INT_PCIE_PORT2_DEV_B_SHFT 11
492#define CE_ADM_INT_PCIE_PORT2_DEV_C_SHFT 12
493#define CE_ADM_INT_PCIE_PORT2_DEV_D_SHFT 13
494#define CE_ADM_INT_PCIE_MSG_SHFT 14 /*see int_dest_14*/
495#define CE_ADM_INT_PCIE_MSG_SLOT_0_SHFT 14
496#define CE_ADM_INT_PCIE_MSG_SLOT_1_SHFT 15
497#define CE_ADM_INT_PCIE_MSG_SLOT_2_SHFT 16
498#define CE_ADM_INT_PCIE_MSG_SLOT_3_SHFT 17
499#define CE_ADM_INT_PORT1_PM_PME_MSG_SHFT 22
500#define CE_ADM_INT_PORT2_PM_PME_MSG_SHFT 23
501
502/* ce_adm_force_int register bit defines */
503#define CE_ADM_FORCE_INT_PCIE_PORT1_DEV_A_SHFT 0
504#define CE_ADM_FORCE_INT_PCIE_PORT1_DEV_B_SHFT 1
505#define CE_ADM_FORCE_INT_PCIE_PORT1_DEV_C_SHFT 2
506#define CE_ADM_FORCE_INT_PCIE_PORT1_DEV_D_SHFT 3
507#define CE_ADM_FORCE_INT_PCIE_PORT2_DEV_A_SHFT 4
508#define CE_ADM_FORCE_INT_PCIE_PORT2_DEV_B_SHFT 5
509#define CE_ADM_FORCE_INT_PCIE_PORT2_DEV_C_SHFT 6
510#define CE_ADM_FORCE_INT_PCIE_PORT2_DEV_D_SHFT 7
511#define CE_ADM_FORCE_INT_ALWAYS_SHFT 8
512
513/* ce_adm_int_dest register bit masks & shifts */
514#define INTR_VECTOR_SHFT 56
515
516/* ce_adm_error_mask and ce_adm_error_summary register bit masks */
517#define CE_ADM_ERR_CRM_SSP_REQ_INVALID (0x1ULL << 0)
518#define CE_ADM_ERR_SSP_REQ_HEADER (0x1ULL << 1)
519#define CE_ADM_ERR_SSP_RSP_HEADER (0x1ULL << 2)
520#define CE_ADM_ERR_SSP_PROTOCOL_ERROR (0x1ULL << 3)
521#define CE_ADM_ERR_SSP_SBE (0x1ULL << 4)
522#define CE_ADM_ERR_SSP_MBE (0x1ULL << 5)
523#define CE_ADM_ERR_CXM_CREDIT_OFLOW (0x1ULL << 6)
524#define CE_ADM_ERR_DRE_SSP_REQ_INVAL (0x1ULL << 7)
525#define CE_ADM_ERR_SSP_REQ_LONG (0x1ULL << 8)
526#define CE_ADM_ERR_SSP_REQ_OFLOW (0x1ULL << 9)
527#define CE_ADM_ERR_SSP_REQ_SHORT (0x1ULL << 10)
528#define CE_ADM_ERR_SSP_REQ_SIDEBAND (0x1ULL << 11)
529#define CE_ADM_ERR_SSP_REQ_ADDR_ERR (0x1ULL << 12)
530#define CE_ADM_ERR_SSP_REQ_BAD_BE (0x1ULL << 13)
531#define CE_ADM_ERR_PCIE_COMPL_TIMEOUT (0x1ULL << 14)
532#define CE_ADM_ERR_PCIE_UNEXP_COMPL (0x1ULL << 15)
533#define CE_ADM_ERR_PCIE_ERR_COMPL (0x1ULL << 16)
534#define CE_ADM_ERR_DRE_CREDIT_OFLOW (0x1ULL << 17)
535#define CE_ADM_ERR_DRE_SRAM_PE (0x1ULL << 18)
536#define CE_ADM_ERR_SSP_RSP_INVALID (0x1ULL << 19)
537#define CE_ADM_ERR_SSP_RSP_LONG (0x1ULL << 20)
538#define CE_ADM_ERR_SSP_RSP_SHORT (0x1ULL << 21)
539#define CE_ADM_ERR_SSP_RSP_SIDEBAND (0x1ULL << 22)
540#define CE_ADM_ERR_URE_SSP_RSP_UNEXP (0x1ULL << 23)
541#define CE_ADM_ERR_URE_SSP_WR_REQ_TIMEOUT (0x1ULL << 24)
542#define CE_ADM_ERR_URE_SSP_RD_REQ_TIMEOUT (0x1ULL << 25)
543#define CE_ADM_ERR_URE_ATE3240_PAGE_FAULT (0x1ULL << 26)
544#define CE_ADM_ERR_URE_ATE40_PAGE_FAULT (0x1ULL << 27)
545#define CE_ADM_ERR_URE_CREDIT_OFLOW (0x1ULL << 28)
546#define CE_ADM_ERR_URE_SRAM_PE (0x1ULL << 29)
547#define CE_ADM_ERR_ADM_SSP_RSP_UNEXP (0x1ULL << 30)
548#define CE_ADM_ERR_ADM_SSP_REQ_TIMEOUT (0x1ULL << 31)
549#define CE_ADM_ERR_MMR_ACCESS_ERROR (0x1ULL << 32)
550#define CE_ADM_ERR_MMR_ADDR_ERROR (0x1ULL << 33)
551#define CE_ADM_ERR_ADM_CREDIT_OFLOW (0x1ULL << 34)
552#define CE_ADM_ERR_ADM_SRAM_PE (0x1ULL << 35)
553#define CE_ADM_ERR_DTL1_MIN_PDATA_CREDIT_ERR (0x1ULL << 36)
554#define CE_ADM_ERR_DTL1_INF_COMPL_CRED_UPDT_ERR (0x1ULL << 37)
555#define CE_ADM_ERR_DTL1_INF_POSTED_CRED_UPDT_ERR (0x1ULL << 38)
556#define CE_ADM_ERR_DTL1_INF_NPOSTED_CRED_UPDT_ERR (0x1ULL << 39)
557#define CE_ADM_ERR_DTL1_COMP_HD_CRED_MAX_ERR (0x1ULL << 40)
558#define CE_ADM_ERR_DTL1_COMP_D_CRED_MAX_ERR (0x1ULL << 41)
559#define CE_ADM_ERR_DTL1_NPOSTED_HD_CRED_MAX_ERR (0x1ULL << 42)
560#define CE_ADM_ERR_DTL1_NPOSTED_D_CRED_MAX_ERR (0x1ULL << 43)
561#define CE_ADM_ERR_DTL1_POSTED_HD_CRED_MAX_ERR (0x1ULL << 44)
562#define CE_ADM_ERR_DTL1_POSTED_D_CRED_MAX_ERR (0x1ULL << 45)
563#define CE_ADM_ERR_DTL2_MIN_PDATA_CREDIT_ERR (0x1ULL << 46)
564#define CE_ADM_ERR_DTL2_INF_COMPL_CRED_UPDT_ERR (0x1ULL << 47)
565#define CE_ADM_ERR_DTL2_INF_POSTED_CRED_UPDT_ERR (0x1ULL << 48)
566#define CE_ADM_ERR_DTL2_INF_NPOSTED_CRED_UPDT_ERR (0x1ULL << 49)
567#define CE_ADM_ERR_DTL2_COMP_HD_CRED_MAX_ERR (0x1ULL << 50)
568#define CE_ADM_ERR_DTL2_COMP_D_CRED_MAX_ERR (0x1ULL << 51)
569#define CE_ADM_ERR_DTL2_NPOSTED_HD_CRED_MAX_ERR (0x1ULL << 52)
570#define CE_ADM_ERR_DTL2_NPOSTED_D_CRED_MAX_ERR (0x1ULL << 53)
571#define CE_ADM_ERR_DTL2_POSTED_HD_CRED_MAX_ERR (0x1ULL << 54)
572#define CE_ADM_ERR_DTL2_POSTED_D_CRED_MAX_ERR (0x1ULL << 55)
573#define CE_ADM_ERR_PORT1_PCIE_COR_ERR (0x1ULL << 56)
574#define CE_ADM_ERR_PORT1_PCIE_NFAT_ERR (0x1ULL << 57)
575#define CE_ADM_ERR_PORT1_PCIE_FAT_ERR (0x1ULL << 58)
576#define CE_ADM_ERR_PORT2_PCIE_COR_ERR (0x1ULL << 59)
577#define CE_ADM_ERR_PORT2_PCIE_NFAT_ERR (0x1ULL << 60)
578#define CE_ADM_ERR_PORT2_PCIE_FAT_ERR (0x1ULL << 61)
579
580/* ce_adm_ure_ups_buf_barrier_flush register bit masks and shifts */
581#define FLUSH_SEL_PORT1_PIPE0_SHFT 0
582#define FLUSH_SEL_PORT1_PIPE1_SHFT 4
583#define FLUSH_SEL_PORT1_PIPE2_SHFT 8
584#define FLUSH_SEL_PORT1_PIPE3_SHFT 12
585#define FLUSH_SEL_PORT2_PIPE0_SHFT 16
586#define FLUSH_SEL_PORT2_PIPE1_SHFT 20
587#define FLUSH_SEL_PORT2_PIPE2_SHFT 24
588#define FLUSH_SEL_PORT2_PIPE3_SHFT 28
589
590/* ce_dre_config1 register bit masks and shifts */
591#define CE_DRE_RO_ENABLE (0x1ULL << 0)
592#define CE_DRE_DYN_RO_ENABLE (0x1ULL << 1)
593#define CE_DRE_SUP_CONFIG_COMP_ERROR (0x1ULL << 2)
594#define CE_DRE_SUP_IO_COMP_ERROR (0x1ULL << 3)
595#define CE_DRE_ADDR_MODE_SHFT 4
596
597/* ce_dre_config_req_status register bit masks */
598#define CE_DRE_LAST_CONFIG_COMPLETION (0x7ULL << 0)
599#define CE_DRE_DOWNSTREAM_CONFIG_ERROR (0x1ULL << 3)
600#define CE_DRE_CONFIG_COMPLETION_VALID (0x1ULL << 4)
601#define CE_DRE_CONFIG_REQUEST_ACTIVE (0x1ULL << 5)
602
603/* ce_ure_control register bit masks & shifts */
604#define CE_URE_RD_MRG_ENABLE (0x1ULL << 0)
605#define CE_URE_WRT_MRG_ENABLE1 (0x1ULL << 4)
606#define CE_URE_WRT_MRG_ENABLE2 (0x1ULL << 5)
607#define CE_URE_RSPQ_BYPASS_DISABLE (0x1ULL << 24)
608#define CE_URE_UPS_DAT1_PAR_DISABLE (0x1ULL << 32)
609#define CE_URE_UPS_HDR1_PAR_DISABLE (0x1ULL << 33)
610#define CE_URE_UPS_DAT2_PAR_DISABLE (0x1ULL << 34)
611#define CE_URE_UPS_HDR2_PAR_DISABLE (0x1ULL << 35)
612#define CE_URE_ATE_PAR_DISABLE (0x1ULL << 36)
613#define CE_URE_RCI_PAR_DISABLE (0x1ULL << 37)
614#define CE_URE_RSPQ_PAR_DISABLE (0x1ULL << 38)
615#define CE_URE_DNS_DAT_PAR_DISABLE (0x1ULL << 39)
616#define CE_URE_DNS_HDR_PAR_DISABLE (0x1ULL << 40)
617#define CE_URE_MALFORM_DISABLE (0x1ULL << 44)
618#define CE_URE_UNSUP_DISABLE (0x1ULL << 45)
619
620/* ce_ure_page_map register bit masks & shifts */
621#define CE_URE_ATE3240_ENABLE (0x1ULL << 0)
622#define CE_URE_ATE40_ENABLE (0x1ULL << 1)
623#define CE_URE_PAGESIZE_SHFT 4
624#define CE_URE_PAGESIZE_MASK (0x7ULL << CE_URE_PAGESIZE_SHFT)
625#define CE_URE_4K_PAGESIZE (0x0ULL << CE_URE_PAGESIZE_SHFT)
626#define CE_URE_16K_PAGESIZE (0x1ULL << CE_URE_PAGESIZE_SHFT)
627#define CE_URE_64K_PAGESIZE (0x2ULL << CE_URE_PAGESIZE_SHFT)
628#define CE_URE_128K_PAGESIZE (0x3ULL << CE_URE_PAGESIZE_SHFT)
629#define CE_URE_256K_PAGESIZE (0x4ULL << CE_URE_PAGESIZE_SHFT)
630
631/* ce_ure_pipe_sel register bit masks & shifts */
632#define PKT_TRAFIC_SHRT 16
633#define BUS_SRC_ID_SHFT 8
634#define DEV_SRC_ID_SHFT 3
635#define FNC_SRC_ID_SHFT 0
636#define CE_URE_TC_MASK (0x07ULL << PKT_TRAFIC_SHRT)
637#define CE_URE_BUS_MASK (0xFFULL << BUS_SRC_ID_SHFT)
638#define CE_URE_DEV_MASK (0x1FULL << DEV_SRC_ID_SHFT)
639#define CE_URE_FNC_MASK (0x07ULL << FNC_SRC_ID_SHFT)
640#define CE_URE_PIPE_BUS(b) (((uint64_t)(b) << BUS_SRC_ID_SHFT) & \
641 CE_URE_BUS_MASK)
642#define CE_URE_PIPE_DEV(d) (((uint64_t)(d) << DEV_SRC_ID_SHFT) & \
643 CE_URE_DEV_MASK)
644#define CE_URE_PIPE_FNC(f) (((uint64_t)(f) << FNC_SRC_ID_SHFT) & \
645 CE_URE_FNC_MASK)
646
647#define CE_URE_SEL1_SHFT 0
648#define CE_URE_SEL2_SHFT 20
649#define CE_URE_SEL3_SHFT 40
650#define CE_URE_SEL1_MASK (0x7FFFFULL << CE_URE_SEL1_SHFT)
651#define CE_URE_SEL2_MASK (0x7FFFFULL << CE_URE_SEL2_SHFT)
652#define CE_URE_SEL3_MASK (0x7FFFFULL << CE_URE_SEL3_SHFT)
653
654
655/* ce_ure_pipe_mask register bit masks & shifts */
656#define CE_URE_MASK1_SHFT 0
657#define CE_URE_MASK2_SHFT 20
658#define CE_URE_MASK3_SHFT 40
659#define CE_URE_MASK1_MASK (0x7FFFFULL << CE_URE_MASK1_SHFT)
660#define CE_URE_MASK2_MASK (0x7FFFFULL << CE_URE_MASK2_SHFT)
661#define CE_URE_MASK3_MASK (0x7FFFFULL << CE_URE_MASK3_SHFT)
662
663
664/* ce_ure_pcie_control1 register bit masks & shifts */
665#define CE_URE_SI (0x1ULL << 0)
666#define CE_URE_ELAL_SHFT 4
667#define CE_URE_ELAL_MASK (0x7ULL << CE_URE_ELAL_SHFT)
668#define CE_URE_ELAL1_SHFT 8
669#define CE_URE_ELAL1_MASK (0x7ULL << CE_URE_ELAL1_SHFT)
670#define CE_URE_SCC (0x1ULL << 12)
671#define CE_URE_PN1_SHFT 16
672#define CE_URE_PN1_MASK (0xFFULL << CE_URE_PN1_SHFT)
673#define CE_URE_PN2_SHFT 24
674#define CE_URE_PN2_MASK (0xFFULL << CE_URE_PN2_SHFT)
675#define CE_URE_PN1_SET(n) (((uint64_t)(n) << CE_URE_PN1_SHFT) & \
676 CE_URE_PN1_MASK)
677#define CE_URE_PN2_SET(n) (((uint64_t)(n) << CE_URE_PN2_SHFT) & \
678 CE_URE_PN2_MASK)
679
680/* ce_ure_pcie_control2 register bit masks & shifts */
681#define CE_URE_ABP (0x1ULL << 0)
682#define CE_URE_PCP (0x1ULL << 1)
683#define CE_URE_MSP (0x1ULL << 2)
684#define CE_URE_AIP (0x1ULL << 3)
685#define CE_URE_PIP (0x1ULL << 4)
686#define CE_URE_HPS (0x1ULL << 5)
687#define CE_URE_HPC (0x1ULL << 6)
688#define CE_URE_SPLV_SHFT 7
689#define CE_URE_SPLV_MASK (0xFFULL << CE_URE_SPLV_SHFT)
690#define CE_URE_SPLS_SHFT 15
691#define CE_URE_SPLS_MASK (0x3ULL << CE_URE_SPLS_SHFT)
692#define CE_URE_PSN1_SHFT 19
693#define CE_URE_PSN1_MASK (0x1FFFULL << CE_URE_PSN1_SHFT)
694#define CE_URE_PSN2_SHFT 32
695#define CE_URE_PSN2_MASK (0x1FFFULL << CE_URE_PSN2_SHFT)
696#define CE_URE_PSN1_SET(n) (((uint64_t)(n) << CE_URE_PSN1_SHFT) & \
697 CE_URE_PSN1_MASK)
698#define CE_URE_PSN2_SET(n) (((uint64_t)(n) << CE_URE_PSN2_SHFT) & \
699 CE_URE_PSN2_MASK)
700
701/*
702 * PIO address space ranges for CE
703 */
704
705/* Local CE Registers Space */
706#define CE_PIO_MMR 0x00000000
707#define CE_PIO_MMR_LEN 0x04000000
708
709/* PCI Compatible Config Space */
710#define CE_PIO_CONFIG_SPACE 0x04000000
711#define CE_PIO_CONFIG_SPACE_LEN 0x04000000
712
713/* PCI I/O Space Alias */
714#define CE_PIO_IO_SPACE_ALIAS 0x08000000
715#define CE_PIO_IO_SPACE_ALIAS_LEN 0x08000000
716
717/* PCI Enhanced Config Space */
718#define CE_PIO_E_CONFIG_SPACE 0x10000000
719#define CE_PIO_E_CONFIG_SPACE_LEN 0x10000000
720
721/* PCI I/O Space */
722#define CE_PIO_IO_SPACE 0x100000000
723#define CE_PIO_IO_SPACE_LEN 0x100000000
724
725/* PCI MEM Space */
726#define CE_PIO_MEM_SPACE 0x200000000
727#define CE_PIO_MEM_SPACE_LEN TIO_HWIN_SIZE
728
729
730/*
731 * CE PCI Enhanced Config Space shifts & masks
732 */
733#define CE_E_CONFIG_BUS_SHFT 20
734#define CE_E_CONFIG_BUS_MASK (0xFF << CE_E_CONFIG_BUS_SHFT)
735#define CE_E_CONFIG_DEVICE_SHFT 15
736#define CE_E_CONFIG_DEVICE_MASK (0x1F << CE_E_CONFIG_DEVICE_SHFT)
737#define CE_E_CONFIG_FUNC_SHFT 12
738#define CE_E_CONFIG_FUNC_MASK (0x7 << CE_E_CONFIG_FUNC_SHFT)
739
740#endif /* __ASM_IA64_SN_TIOCE_H__ */
diff --git a/include/asm-ia64/sn/tioce_provider.h b/include/asm-ia64/sn/tioce_provider.h
new file mode 100644
index 000000000000..7f63dec0a79a
--- /dev/null
+++ b/include/asm-ia64/sn/tioce_provider.h
@@ -0,0 +1,66 @@
1/**************************************************************************
2 * Copyright (C) 2005, Silicon Graphics, Inc. *
3 * *
4 * These coded instructions, statements, and computer programs contain *
5 * unpublished proprietary information of Silicon Graphics, Inc., and *
6 * are protected by Federal copyright law. They may not be disclosed *
7 * to third parties or copied or duplicated in any form, in whole or *
8 * in part, without the prior written consent of Silicon Graphics, Inc. *
9 * *
10 **************************************************************************/
11
12#ifndef _ASM_IA64_SN_CE_PROVIDER_H
13#define _ASM_IA64_SN_CE_PROVIDER_H
14
15#include <asm/sn/pcibus_provider_defs.h>
16#include <asm/sn/tioce.h>
17
18/*
19 * Common TIOCE structure shared between the prom and kernel
20 *
21 * DO NOT CHANGE THIS STRUCT WITHOUT MAKING CORRESPONDING CHANGES TO THE
22 * PROM VERSION.
23 */
24struct tioce_common {
25 struct pcibus_bussoft ce_pcibus; /* common pciio header */
26
27 uint32_t ce_rev;
28 uint64_t ce_kernel_private;
29 uint64_t ce_prom_private;
30};
31
32struct tioce_kernel {
33 struct tioce_common *ce_common;
34 spinlock_t ce_lock;
35 struct list_head ce_dmamap_list;
36
37 uint64_t ce_ate40_shadow[TIOCE_NUM_M40_ATES];
38 uint64_t ce_ate3240_shadow[TIOCE_NUM_M3240_ATES];
39 uint32_t ce_ate3240_pagesize;
40
41 uint8_t ce_port1_secondary;
42
43 /* per-port resources */
44 struct {
45 int dirmap_refcnt;
46 uint64_t dirmap_shadow;
47 } ce_port[TIOCE_NUM_PORTS];
48};
49
50struct tioce_dmamap {
51 struct list_head ce_dmamap_list; /* headed by tioce_kernel */
52 uint32_t refcnt;
53
54 uint64_t nbytes; /* # bytes mapped */
55
56 uint64_t ct_start; /* coretalk start address */
57 uint64_t pci_start; /* bus start address */
58
59 uint64_t *ate_hw; /* hw ptr of first ate in map */
60 uint64_t *ate_shadow; /* shadow ptr of firat ate */
61 uint16_t ate_count; /* # ate's in the map */
62};
63
64extern int tioce_init_provider(void);
65
66#endif /* __ASM_IA64_SN_CE_PROVIDER_H */
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index 21a9f10d6baa..a255006fb7b5 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -23,6 +23,8 @@
23#define SO_BROADCAST 6 23#define SO_BROADCAST 6
24#define SO_SNDBUF 7 24#define SO_SNDBUF 7
25#define SO_RCVBUF 8 25#define SO_RCVBUF 8
26#define SO_SNDBUFFORCE 32
27#define SO_RCVBUFFORCE 33
26#define SO_KEEPALIVE 9 28#define SO_KEEPALIVE 9
27#define SO_OOBINLINE 10 29#define SO_OOBINLINE 10
28#define SO_NO_CHECK 11 30#define SO_NO_CHECK 11
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index 909936f25512..d2430aa0d49d 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -93,7 +93,15 @@ _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
93# endif /* CONFIG_MCKINLEY */ 93# endif /* CONFIG_MCKINLEY */
94#endif 94#endif
95} 95}
96
96#define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0) 97#define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0)
98
99/* Unlock by doing an ordered store and releasing the cacheline with nta */
100static inline void _raw_spin_unlock(spinlock_t *x) {
101 barrier();
102 asm volatile ("st4.rel.nta [%0] = r0\n\t" :: "r"(x));
103}
104
97#else /* !ASM_SUPPORTED */ 105#else /* !ASM_SUPPORTED */
98#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 106#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
99# define _raw_spin_lock(x) \ 107# define _raw_spin_lock(x) \
@@ -109,16 +117,16 @@ do { \
109 } while (ia64_spinlock_val); \ 117 } while (ia64_spinlock_val); \
110 } \ 118 } \
111} while (0) 119} while (0)
120#define _raw_spin_unlock(x) do { barrier(); ((spinlock_t *) x)->lock = 0; } while (0)
112#endif /* !ASM_SUPPORTED */ 121#endif /* !ASM_SUPPORTED */
113 122
114#define spin_is_locked(x) ((x)->lock != 0) 123#define spin_is_locked(x) ((x)->lock != 0)
115#define _raw_spin_unlock(x) do { barrier(); ((spinlock_t *) x)->lock = 0; } while (0)
116#define _raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0) 124#define _raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0)
117#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) 125#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock)
118 126
119typedef struct { 127typedef struct {
120 volatile unsigned int read_counter : 31; 128 volatile unsigned int read_counter : 24;
121 volatile unsigned int write_lock : 1; 129 volatile unsigned int write_lock : 8;
122#ifdef CONFIG_PREEMPT 130#ifdef CONFIG_PREEMPT
123 unsigned int break_lock; 131 unsigned int break_lock;
124#endif 132#endif
@@ -174,6 +182,13 @@ do { \
174 (result == 0); \ 182 (result == 0); \
175}) 183})
176 184
185static inline void _raw_write_unlock(rwlock_t *x)
186{
187 u8 *y = (u8 *)x;
188 barrier();
189 asm volatile ("st1.rel.nta [%0] = r0\n\t" :: "r"(y+3) : "memory" );
190}
191
177#else /* !ASM_SUPPORTED */ 192#else /* !ASM_SUPPORTED */
178 193
179#define _raw_write_lock(l) \ 194#define _raw_write_lock(l) \
@@ -195,14 +210,14 @@ do { \
195 (ia64_val == 0); \ 210 (ia64_val == 0); \
196}) 211})
197 212
213static inline void _raw_write_unlock(rwlock_t *x)
214{
215 barrier();
216 x->write_lock = 0;
217}
218
198#endif /* !ASM_SUPPORTED */ 219#endif /* !ASM_SUPPORTED */
199 220
200#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) 221#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
201 222
202#define _raw_write_unlock(x) \
203({ \
204 smp_mb__before_clear_bit(); /* need barrier before releasing lock... */ \
205 clear_bit(31, (x)); \
206})
207
208#endif /* _ASM_IA64_SPINLOCK_H */ 223#endif /* _ASM_IA64_SPINLOCK_H */
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index cd2cf76b2db1..33256db4a7cf 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -19,12 +19,13 @@
19#include <asm/pal.h> 19#include <asm/pal.h>
20#include <asm/percpu.h> 20#include <asm/percpu.h>
21 21
22#define GATE_ADDR __IA64_UL_CONST(0xa000000000000000) 22#define GATE_ADDR RGN_BASE(RGN_GATE)
23
23/* 24/*
24 * 0xa000000000000000+2*PERCPU_PAGE_SIZE 25 * 0xa000000000000000+2*PERCPU_PAGE_SIZE
25 * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page) 26 * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
26 */ 27 */
27#define KERNEL_START __IA64_UL_CONST(0xa000000100000000) 28#define KERNEL_START (GATE_ADDR+0x100000000)
28#define PERCPU_ADDR (-PERCPU_PAGE_SIZE) 29#define PERCPU_ADDR (-PERCPU_PAGE_SIZE)
29 30
30#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index 399bc29729fd..a9f738bf18a7 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -98,29 +98,6 @@ void build_cpu_to_node_map(void);
98 .nr_balance_failed = 0, \ 98 .nr_balance_failed = 0, \
99} 99}
100 100
101/* sched_domains SD_ALLNODES_INIT for IA64 NUMA machines */
102#define SD_ALLNODES_INIT (struct sched_domain) { \
103 .span = CPU_MASK_NONE, \
104 .parent = NULL, \
105 .groups = NULL, \
106 .min_interval = 64, \
107 .max_interval = 64*num_online_cpus(), \
108 .busy_factor = 128, \
109 .imbalance_pct = 133, \
110 .cache_hot_time = (10*1000000), \
111 .cache_nice_tries = 1, \
112 .busy_idx = 3, \
113 .idle_idx = 3, \
114 .newidle_idx = 0, /* unused */ \
115 .wake_idx = 0, /* unused */ \
116 .forkexec_idx = 0, /* unused */ \
117 .per_cpu_gain = 100, \
118 .flags = SD_LOAD_BALANCE, \
119 .last_balance = jiffies, \
120 .balance_interval = 64, \
121 .nr_balance_failed = 0, \
122}
123
124#endif /* CONFIG_NUMA */ 101#endif /* CONFIG_NUMA */
125 102
126#include <asm-generic/topology.h> 103#include <asm-generic/topology.h>
diff --git a/include/asm-ia64/types.h b/include/asm-ia64/types.h
index a677565aa954..902850d12424 100644
--- a/include/asm-ia64/types.h
+++ b/include/asm-ia64/types.h
@@ -67,8 +67,6 @@ typedef __u64 u64;
67 67
68typedef u64 dma_addr_t; 68typedef u64 dma_addr_t;
69 69
70typedef unsigned short kmem_bufctl_t;
71
72# endif /* __KERNEL__ */ 70# endif /* __KERNEL__ */
73#endif /* !__ASSEMBLY__ */ 71#endif /* !__ASSEMBLY__ */
74 72
diff --git a/include/asm-ia64/uaccess.h b/include/asm-ia64/uaccess.h
index 8edd9a90949c..3a7829bb5954 100644
--- a/include/asm-ia64/uaccess.h
+++ b/include/asm-ia64/uaccess.h
@@ -72,13 +72,6 @@
72}) 72})
73#define access_ok(type, addr, size) __access_ok((addr), (size), get_fs()) 73#define access_ok(type, addr, size) __access_ok((addr), (size), get_fs())
74 74
75/* this function will go away soon - use access_ok() instead */
76static inline int __deprecated
77verify_area (int type, const void __user *addr, unsigned long size)
78{
79 return access_ok(type, addr, size) ? 0 : -EFAULT;
80}
81
82/* 75/*
83 * These are the main single-value transfer routines. They automatically 76 * These are the main single-value transfer routines. They automatically
84 * use the right size if we just have the right pointer type. 77 * use the right size if we just have the right pointer type.
diff --git a/include/asm-m32r/auxvec.h b/include/asm-m32r/auxvec.h
new file mode 100644
index 000000000000..f76dcc860fae
--- /dev/null
+++ b/include/asm-m32r/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef _ASM_M32R__AUXVEC_H
2#define _ASM_M32R__AUXVEC_H
3
4#endif /* _ASM_M32R__AUXVEC_H */
diff --git a/include/asm-m32r/checksum.h b/include/asm-m32r/checksum.h
index 99f37dbf2558..877ebf46e9ff 100644
--- a/include/asm-m32r/checksum.h
+++ b/include/asm-m32r/checksum.h
@@ -105,7 +105,7 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
105 " addx %0, %3 \n" 105 " addx %0, %3 \n"
106 " .fillinsn\n" 106 " .fillinsn\n"
107 "2: \n" 107 "2: \n"
108 /* Since the input registers which are loaded with iph and ipl 108 /* Since the input registers which are loaded with iph and ihl
109 are modified, we must also specify them as outputs, or gcc 109 are modified, we must also specify them as outputs, or gcc
110 will assume they contain their original values. */ 110 will assume they contain their original values. */
111 : "=&r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmpreg0), "=&r" (tmpreg1) 111 : "=&r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmpreg0), "=&r" (tmpreg1)
diff --git a/include/asm-m32r/fcntl.h b/include/asm-m32r/fcntl.h
index 3e3089572028..46ab12db5739 100644
--- a/include/asm-m32r/fcntl.h
+++ b/include/asm-m32r/fcntl.h
@@ -1,92 +1 @@
1#ifndef _ASM_M32R_FCNTL_H #include <asm-generic/fcntl.h>
2#define _ASM_M32R_FCNTL_H
3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
9 located on an ext2 file system */
10#define O_ACCMODE 0003
11#define O_RDONLY 00
12#define O_WRONLY 01
13#define O_RDWR 02
14#define O_CREAT 0100 /* not fcntl */
15#define O_EXCL 0200 /* not fcntl */
16#define O_NOCTTY 0400 /* not fcntl */
17#define O_TRUNC 01000 /* not fcntl */
18#define O_APPEND 02000
19#define O_NONBLOCK 04000
20#define O_NDELAY O_NONBLOCK
21#define O_SYNC 010000
22#define FASYNC 020000 /* fcntl, for BSD compatibility */
23#define O_DIRECT 040000 /* direct disk access hint */
24#define O_LARGEFILE 0100000
25#define O_DIRECTORY 0200000 /* must be a directory */
26#define O_NOFOLLOW 0400000 /* don't follow links */
27#define O_NOATIME 01000000
28
29#define F_DUPFD 0 /* dup */
30#define F_GETFD 1 /* get close_on_exec */
31#define F_SETFD 2 /* set/clear close_on_exec */
32#define F_GETFL 3 /* get file->f_flags */
33#define F_SETFL 4 /* set file->f_flags */
34#define F_GETLK 5
35#define F_SETLK 6
36#define F_SETLKW 7
37
38#define F_SETOWN 8 /* for sockets. */
39#define F_GETOWN 9 /* for sockets. */
40#define F_SETSIG 10 /* for sockets. */
41#define F_GETSIG 11 /* for sockets. */
42
43#define F_GETLK64 12 /* using 'struct flock64' */
44#define F_SETLK64 13
45#define F_SETLKW64 14
46
47/* for F_[GET|SET]FL */
48#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
49
50/* for posix fcntl() and lockf() */
51#define F_RDLCK 0
52#define F_WRLCK 1
53#define F_UNLCK 2
54
55/* for old implementation of bsd flock () */
56#define F_EXLCK 4 /* or 3 */
57#define F_SHLCK 8 /* or 4 */
58
59/* for leases */
60#define F_INPROGRESS 16
61
62/* operations for bsd flock(), also used by the kernel implementation */
63#define LOCK_SH 1 /* shared lock */
64#define LOCK_EX 2 /* exclusive lock */
65#define LOCK_NB 4 /* or'd with one of the above to prevent
66 blocking */
67#define LOCK_UN 8 /* remove lock */
68
69#define LOCK_MAND 32 /* This is a mandatory flock */
70#define LOCK_READ 64 /* ... Which allows concurrent read operations */
71#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
72#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
73
74struct flock {
75 short l_type;
76 short l_whence;
77 off_t l_start;
78 off_t l_len;
79 pid_t l_pid;
80};
81
82struct flock64 {
83 short l_type;
84 short l_whence;
85 loff_t l_start;
86 loff_t l_len;
87 pid_t l_pid;
88};
89
90#define F_LINUX_SPECIFIC_BASE 1024
91
92#endif /* _ASM_M32R_FCNTL_H */
diff --git a/include/asm-m32r/futex.h b/include/asm-m32r/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-m32r/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-m32r/hdreg.h b/include/asm-m32r/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-m32r/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 1c6abb9f3f1f..4ab578876361 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -61,25 +61,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
61 61
62/* This handles the memory map.. */ 62/* This handles the memory map.. */
63 63
64#ifndef __ASSEMBLY__
65
66/* Pure 2^n version of get_order */
67static __inline__ int get_order(unsigned long size)
68{
69 int order;
70
71 size = (size - 1) >> (PAGE_SHIFT - 1);
72 order = -1;
73 do {
74 size >>= 1;
75 order++;
76 } while (size);
77
78 return order;
79}
80
81#endif /* __ASSEMBLY__ */
82
83#define __MEMORY_START CONFIG_MEMORY_START 64#define __MEMORY_START CONFIG_MEMORY_START
84#define __MEMORY_SIZE CONFIG_MEMORY_SIZE 65#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
85 66
@@ -111,5 +92,7 @@ static __inline__ int get_order(unsigned long size)
111 92
112#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
113 94
95#include <asm-generic/page.h>
96
114#endif /* _ASM_M32R_PAGE_H */ 97#endif /* _ASM_M32R_PAGE_H */
115 98
diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h
index b9a20cdad65f..7885b7df84a2 100644
--- a/include/asm-m32r/smp.h
+++ b/include/asm-m32r/smp.h
@@ -61,9 +61,7 @@ extern physid_mask_t phys_cpu_present_map;
61 * Some lowlevel functions might want to know about 61 * Some lowlevel functions might want to know about
62 * the real CPU ID <-> CPU # mapping. 62 * the real CPU ID <-> CPU # mapping.
63 */ 63 */
64extern volatile int physid_2_cpu[NR_CPUS];
65extern volatile int cpu_2_physid[NR_CPUS]; 64extern volatile int cpu_2_physid[NR_CPUS];
66#define physid_to_cpu(physid) physid_2_cpu[physid]
67#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] 65#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id]
68 66
69#define raw_smp_processor_id() (current_thread_info()->cpu) 67#define raw_smp_processor_id() (current_thread_info()->cpu)
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 159519d99042..8b6680f223c0 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h
index ca0a887d2237..fcf24c64c3ba 100644
--- a/include/asm-m32r/types.h
+++ b/include/asm-m32r/types.h
@@ -55,8 +55,6 @@ typedef unsigned long long u64;
55typedef u32 dma_addr_t; 55typedef u32 dma_addr_t;
56typedef u64 dma64_addr_t; 56typedef u64 dma64_addr_t;
57 57
58typedef unsigned short kmem_bufctl_t;
59
60#endif /* __ASSEMBLY__ */ 58#endif /* __ASSEMBLY__ */
61 59
62#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h
index bbb8ac4018a0..93d863c455a1 100644
--- a/include/asm-m32r/uaccess.h
+++ b/include/asm-m32r/uaccess.h
@@ -120,31 +120,6 @@ static inline int access_ok(int type, const void *addr, unsigned long size)
120} 120}
121#endif /* CONFIG_MMU */ 121#endif /* CONFIG_MMU */
122 122
123/**
124 * verify_area: - Obsolete/deprecated and will go away soon,
125 * use access_ok() instead.
126 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
127 * @addr: User space pointer to start of block to check
128 * @size: Size of block to check
129 *
130 * Context: User context only. This function may sleep.
131 *
132 * This function has been replaced by access_ok().
133 *
134 * Checks if a pointer to a block of memory in user space is valid.
135 *
136 * Returns zero if the memory block may be valid, -EFAULT
137 * if it is definitely invalid.
138 *
139 * See access_ok() for more details.
140 */
141static inline int __deprecated verify_area(int type, const void __user *addr,
142 unsigned long size)
143{
144 return access_ok(type, addr, size) ? 0 : -EFAULT;
145}
146
147
148/* 123/*
149 * The exception table consists of pairs of addresses: the first is the 124 * The exception table consists of pairs of addresses: the first is the
150 * address of an instruction that is allowed to fault, and the second is 125 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-m68k/auxvec.h b/include/asm-m68k/auxvec.h
new file mode 100644
index 000000000000..844d6d52204b
--- /dev/null
+++ b/include/asm-m68k/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMm68k_AUXVEC_H
2#define __ASMm68k_AUXVEC_H
3
4#endif
diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h
index e4773946f10d..8aba971b1368 100644
--- a/include/asm-m68k/cacheflush.h
+++ b/include/asm-m68k/cacheflush.h
@@ -130,20 +130,25 @@ static inline void __flush_page_to_ram(void *vaddr)
130#define flush_dcache_mmap_lock(mapping) do { } while (0) 130#define flush_dcache_mmap_lock(mapping) do { } while (0)
131#define flush_dcache_mmap_unlock(mapping) do { } while (0) 131#define flush_dcache_mmap_unlock(mapping) do { } while (0)
132#define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page)) 132#define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page))
133#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
134
135#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
136 do { \
137 flush_cache_page(vma, vaddr, page_to_pfn(page));\
138 memcpy(dst, src, len); \
139 } while (0)
140
141#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
142 do { \
143 flush_cache_page(vma, vaddr, page_to_pfn(page));\
144 memcpy(dst, src, len); \
145 } while (0)
146 133
134extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
135 unsigned long addr, int len);
147extern void flush_icache_range(unsigned long address, unsigned long endaddr); 136extern void flush_icache_range(unsigned long address, unsigned long endaddr);
148 137
138static inline void copy_to_user_page(struct vm_area_struct *vma,
139 struct page *page, unsigned long vaddr,
140 void *dst, void *src, int len)
141{
142 flush_cache_page(vma, vaddr, page_to_pfn(page));
143 memcpy(dst, src, len);
144 flush_icache_user_range(vma, page, vaddr, len);
145}
146static inline void copy_from_user_page(struct vm_area_struct *vma,
147 struct page *page, unsigned long vaddr,
148 void *dst, void *src, int len)
149{
150 flush_cache_page(vma, vaddr, page_to_pfn(page));
151 memcpy(dst, src, len);
152}
153
149#endif /* _M68K_CACHEFLUSH_H */ 154#endif /* _M68K_CACHEFLUSH_H */
diff --git a/include/asm-m68k/fcntl.h b/include/asm-m68k/fcntl.h
index 0d4212983a33..1c369b20dc45 100644
--- a/include/asm-m68k/fcntl.h
+++ b/include/asm-m68k/fcntl.h
@@ -1,87 +1,11 @@
1#ifndef _M68K_FCNTL_H 1#ifndef _M68K_FCNTL_H
2#define _M68K_FCNTL_H 2#define _M68K_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */ 4#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */ 5#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 6#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0400000 7#define O_LARGEFILE 0400000
23#define O_NOATIME 01000000
24 8
25#define F_DUPFD 0 /* dup */ 9#include <asm-generic/fcntl.h>
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33 10
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif /* _M68K_FCNTL_H */ 11#endif /* _M68K_FCNTL_H */
diff --git a/include/asm-m68k/futex.h b/include/asm-m68k/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-m68k/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-m68k/hdreg.h b/include/asm-m68k/hdreg.h
deleted file mode 100644
index 5989bbc97cbf..000000000000
--- a/include/asm-m68k/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#warning this file is obsolete, please do not use it
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 99a516709210..f206dfbc1d48 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -107,20 +107,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
107/* to align the pointer to the (next) page boundary */ 107/* to align the pointer to the (next) page boundary */
108#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 108#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
109 109
110/* Pure 2^n version of get_order */
111static inline int get_order(unsigned long size)
112{
113 int order;
114
115 size = (size-1) >> (PAGE_SHIFT-1);
116 order = -1;
117 do {
118 size >>= 1;
119 order++;
120 } while (size);
121 return order;
122}
123
124#endif /* !__ASSEMBLY__ */ 110#endif /* !__ASSEMBLY__ */
125 111
126#include <asm/page_offset.h> 112#include <asm/page_offset.h>
@@ -138,13 +124,13 @@ extern unsigned long m68k_memoffset;
138#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset) 124#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset)
139#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset)) 125#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset))
140#else 126#else
141#define __pa(vaddr) virt_to_phys((void *)vaddr) 127#define __pa(vaddr) virt_to_phys((void *)(vaddr))
142#define __va(paddr) phys_to_virt((unsigned long)paddr) 128#define __va(paddr) phys_to_virt((unsigned long)(paddr))
143#endif 129#endif
144 130
145#else /* !CONFIG_SUN3 */ 131#else /* !CONFIG_SUN3 */
146/* This #define is a horrible hack to suppress lots of warnings. --m */ 132/* This #define is a horrible hack to suppress lots of warnings. --m */
147#define __pa(x) ___pa((unsigned long)x) 133#define __pa(x) ___pa((unsigned long)(x))
148static inline unsigned long ___pa(unsigned long x) 134static inline unsigned long ___pa(unsigned long x)
149{ 135{
150 if(x == 0) 136 if(x == 0)
@@ -192,4 +178,6 @@ static inline void *__va(unsigned long x)
192 178
193#endif /* __KERNEL__ */ 179#endif /* __KERNEL__ */
194 180
181#include <asm-generic/page.h>
182
195#endif /* _M68K_PAGE_H */ 183#endif /* _M68K_PAGE_H */
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index 8d0b9fc2d07e..f578ca4b776a 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-m68k/string.h b/include/asm-m68k/string.h
index 44def078132a..6c59215b285e 100644
--- a/include/asm-m68k/string.h
+++ b/include/asm-m68k/string.h
@@ -80,43 +80,6 @@ static inline char * strchr(const char * s, int c)
80 return( (char *) s); 80 return( (char *) s);
81} 81}
82 82
83#if 0
84#define __HAVE_ARCH_STRPBRK
85static inline char *strpbrk(const char *cs,const char *ct)
86{
87 const char *sc1,*sc2;
88
89 for( sc1 = cs; *sc1 != '\0'; ++sc1)
90 for( sc2 = ct; *sc2 != '\0'; ++sc2)
91 if (*sc1 == *sc2)
92 return((char *) sc1);
93 return( NULL );
94}
95#endif
96
97#if 0
98#define __HAVE_ARCH_STRSPN
99static inline size_t strspn(const char *s, const char *accept)
100{
101 const char *p;
102 const char *a;
103 size_t count = 0;
104
105 for (p = s; *p != '\0'; ++p)
106 {
107 for (a = accept; *a != '\0'; ++a)
108 if (*p == *a)
109 break;
110 if (*a == '\0')
111 return count;
112 else
113 ++count;
114 }
115
116 return count;
117}
118#endif
119
120/* strstr !! */ 83/* strstr !! */
121 84
122#define __HAVE_ARCH_STRLEN 85#define __HAVE_ARCH_STRLEN
@@ -173,370 +136,18 @@ static inline int strncmp(const char * cs,const char * ct,size_t count)
173} 136}
174 137
175#define __HAVE_ARCH_MEMSET 138#define __HAVE_ARCH_MEMSET
176/* 139extern void *memset(void *, int, __kernel_size_t);
177 * This is really ugly, but its highly optimizatiable by the 140#define memset(d, c, n) __builtin_memset(d, c, n)
178 * compiler and is meant as compensation for gcc's missing
179 * __builtin_memset(). For the 680[23]0 it might be worth considering
180 * the optimal number of misaligned writes compared to the number of
181 * tests'n'branches needed to align the destination address. The
182 * 680[46]0 doesn't really care due to their copy-back caches.
183 * 10/09/96 - Jes Sorensen
184 */
185static inline void * __memset_g(void * s, int c, size_t count)
186{
187 void *xs = s;
188 size_t temp;
189
190 if (!count)
191 return xs;
192
193 c &= 0xff;
194 c |= c << 8;
195 c |= c << 16;
196
197 if (count < 36){
198 long *ls = s;
199
200 switch(count){
201 case 32: case 33: case 34: case 35:
202 *ls++ = c;
203 case 28: case 29: case 30: case 31:
204 *ls++ = c;
205 case 24: case 25: case 26: case 27:
206 *ls++ = c;
207 case 20: case 21: case 22: case 23:
208 *ls++ = c;
209 case 16: case 17: case 18: case 19:
210 *ls++ = c;
211 case 12: case 13: case 14: case 15:
212 *ls++ = c;
213 case 8: case 9: case 10: case 11:
214 *ls++ = c;
215 case 4: case 5: case 6: case 7:
216 *ls++ = c;
217 break;
218 default:
219 break;
220 }
221 s = ls;
222 if (count & 0x02){
223 short *ss = s;
224 *ss++ = c;
225 s = ss;
226 }
227 if (count & 0x01){
228 char *cs = s;
229 *cs++ = c;
230 s = cs;
231 }
232 return xs;
233 }
234
235 if ((long) s & 1)
236 {
237 char *cs = s;
238 *cs++ = c;
239 s = cs;
240 count--;
241 }
242 if (count > 2 && (long) s & 2)
243 {
244 short *ss = s;
245 *ss++ = c;
246 s = ss;
247 count -= 2;
248 }
249 temp = count >> 2;
250 if (temp)
251 {
252 long *ls = s;
253 temp--;
254 do
255 *ls++ = c;
256 while (temp--);
257 s = ls;
258 }
259 if (count & 2)
260 {
261 short *ss = s;
262 *ss++ = c;
263 s = ss;
264 }
265 if (count & 1)
266 {
267 char *cs = s;
268 *cs = c;
269 }
270 return xs;
271}
272
273/*
274 * __memset_page assumes that data is longword aligned. Most, if not
275 * all, of these page sized memsets are performed on page aligned
276 * areas, thus we do not need to check if the destination is longword
277 * aligned. Of course we suffer a serious performance loss if this is
278 * not the case but I think the risk of this ever happening is
279 * extremely small. We spend a lot of time clearing pages in
280 * get_empty_page() so I think it is worth it anyway. Besides, the
281 * 680[46]0 do not really care about misaligned writes due to their
282 * copy-back cache.
283 *
284 * The optimized case for the 680[46]0 is implemented using the move16
285 * instruction. My tests showed that this implementation is 35-45%
286 * faster than the original implementation using movel, the only
287 * caveat is that the destination address must be 16-byte aligned.
288 * 01/09/96 - Jes Sorensen
289 */
290static inline void * __memset_page(void * s,int c,size_t count)
291{
292 unsigned long data, tmp;
293 void *xs = s;
294
295 c = c & 255;
296 data = c | (c << 8);
297 data |= data << 16;
298
299#ifdef CPU_M68040_OR_M68060_ONLY
300
301 if (((unsigned long) s) & 0x0f)
302 __memset_g(s, c, count);
303 else{
304 unsigned long *sp = s;
305 *sp++ = data;
306 *sp++ = data;
307 *sp++ = data;
308 *sp++ = data;
309
310 __asm__ __volatile__("1:\t"
311 ".chip 68040\n\t"
312 "move16 %2@+,%0@+\n\t"
313 ".chip 68k\n\t"
314 "subqw #8,%2\n\t"
315 "subqw #8,%2\n\t"
316 "dbra %1,1b\n\t"
317 : "=a" (sp), "=d" (tmp)
318 : "a" (s), "0" (sp), "1" ((count - 16) / 16 - 1)
319 );
320 }
321
322#else
323 __asm__ __volatile__("1:\t"
324 "movel %2,%0@+\n\t"
325 "movel %2,%0@+\n\t"
326 "movel %2,%0@+\n\t"
327 "movel %2,%0@+\n\t"
328 "movel %2,%0@+\n\t"
329 "movel %2,%0@+\n\t"
330 "movel %2,%0@+\n\t"
331 "movel %2,%0@+\n\t"
332 "dbra %1,1b\n\t"
333 : "=a" (s), "=d" (tmp)
334 : "d" (data), "0" (s), "1" (count / 32 - 1)
335 );
336#endif
337
338 return xs;
339}
340
341extern void *memset(void *,int,__kernel_size_t);
342
343#define __memset_const(s,c,count) \
344((count==PAGE_SIZE) ? \
345 __memset_page((s),(c),(count)) : \
346 __memset_g((s),(c),(count)))
347
348#define memset(s, c, count) \
349(__builtin_constant_p(count) ? \
350 __memset_const((s),(c),(count)) : \
351 __memset_g((s),(c),(count)))
352 141
353#define __HAVE_ARCH_MEMCPY 142#define __HAVE_ARCH_MEMCPY
354extern void * memcpy(void *, const void *, size_t ); 143extern void *memcpy(void *, const void *, __kernel_size_t);
355/* 144#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
356 * __builtin_memcpy() does not handle page-sized memcpys very well,
357 * thus following the same assumptions as for page-sized memsets, this
358 * function copies page-sized areas using an unrolled loop, without
359 * considering alignment.
360 *
361 * For the 680[46]0 only kernels we use the move16 instruction instead
362 * as it writes through the data-cache, invalidating the cache-lines
363 * touched. In this way we do not use up the entire data-cache (well,
364 * half of it on the 68060) by copying a page. An unrolled loop of two
365 * move16 instructions seem to the fastest. The only caveat is that
366 * both source and destination must be 16-byte aligned, if not we fall
367 * back to the generic memcpy function. - Jes
368 */
369static inline void * __memcpy_page(void * to, const void * from, size_t count)
370{
371 unsigned long tmp;
372 void *xto = to;
373
374#ifdef CPU_M68040_OR_M68060_ONLY
375
376 if (((unsigned long) to | (unsigned long) from) & 0x0f)
377 return memcpy(to, from, count);
378
379 __asm__ __volatile__("1:\t"
380 ".chip 68040\n\t"
381 "move16 %1@+,%0@+\n\t"
382 "move16 %1@+,%0@+\n\t"
383 ".chip 68k\n\t"
384 "dbra %2,1b\n\t"
385 : "=a" (to), "=a" (from), "=d" (tmp)
386 : "0" (to), "1" (from) , "2" (count / 32 - 1)
387 );
388#else
389 __asm__ __volatile__("1:\t"
390 "movel %1@+,%0@+\n\t"
391 "movel %1@+,%0@+\n\t"
392 "movel %1@+,%0@+\n\t"
393 "movel %1@+,%0@+\n\t"
394 "movel %1@+,%0@+\n\t"
395 "movel %1@+,%0@+\n\t"
396 "movel %1@+,%0@+\n\t"
397 "movel %1@+,%0@+\n\t"
398 "dbra %2,1b\n\t"
399 : "=a" (to), "=a" (from), "=d" (tmp)
400 : "0" (to), "1" (from) , "2" (count / 32 - 1)
401 );
402#endif
403 return xto;
404}
405
406#define __memcpy_const(to, from, n) \
407((n==PAGE_SIZE) ? \
408 __memcpy_page((to),(from),(n)) : \
409 __builtin_memcpy((to),(from),(n)))
410
411#define memcpy(to, from, n) \
412(__builtin_constant_p(n) ? \
413 __memcpy_const((to),(from),(n)) : \
414 memcpy((to),(from),(n)))
415 145
416#define __HAVE_ARCH_MEMMOVE 146#define __HAVE_ARCH_MEMMOVE
417static inline void * memmove(void * dest,const void * src, size_t n) 147extern void *memmove(void *, const void *, __kernel_size_t);
418{
419 void *xdest = dest;
420 size_t temp;
421
422 if (!n)
423 return xdest;
424
425 if (dest < src)
426 {
427 if ((long) dest & 1)
428 {
429 char *cdest = dest;
430 const char *csrc = src;
431 *cdest++ = *csrc++;
432 dest = cdest;
433 src = csrc;
434 n--;
435 }
436 if (n > 2 && (long) dest & 2)
437 {
438 short *sdest = dest;
439 const short *ssrc = src;
440 *sdest++ = *ssrc++;
441 dest = sdest;
442 src = ssrc;
443 n -= 2;
444 }
445 temp = n >> 2;
446 if (temp)
447 {
448 long *ldest = dest;
449 const long *lsrc = src;
450 temp--;
451 do
452 *ldest++ = *lsrc++;
453 while (temp--);
454 dest = ldest;
455 src = lsrc;
456 }
457 if (n & 2)
458 {
459 short *sdest = dest;
460 const short *ssrc = src;
461 *sdest++ = *ssrc++;
462 dest = sdest;
463 src = ssrc;
464 }
465 if (n & 1)
466 {
467 char *cdest = dest;
468 const char *csrc = src;
469 *cdest = *csrc;
470 }
471 }
472 else
473 {
474 dest = (char *) dest + n;
475 src = (const char *) src + n;
476 if ((long) dest & 1)
477 {
478 char *cdest = dest;
479 const char *csrc = src;
480 *--cdest = *--csrc;
481 dest = cdest;
482 src = csrc;
483 n--;
484 }
485 if (n > 2 && (long) dest & 2)
486 {
487 short *sdest = dest;
488 const short *ssrc = src;
489 *--sdest = *--ssrc;
490 dest = sdest;
491 src = ssrc;
492 n -= 2;
493 }
494 temp = n >> 2;
495 if (temp)
496 {
497 long *ldest = dest;
498 const long *lsrc = src;
499 temp--;
500 do
501 *--ldest = *--lsrc;
502 while (temp--);
503 dest = ldest;
504 src = lsrc;
505 }
506 if (n & 2)
507 {
508 short *sdest = dest;
509 const short *ssrc = src;
510 *--sdest = *--ssrc;
511 dest = sdest;
512 src = ssrc;
513 }
514 if (n & 1)
515 {
516 char *cdest = dest;
517 const char *csrc = src;
518 *--cdest = *--csrc;
519 }
520 }
521 return xdest;
522}
523 148
524#define __HAVE_ARCH_MEMCMP 149#define __HAVE_ARCH_MEMCMP
525extern int memcmp(const void * ,const void * ,size_t ); 150extern int memcmp(const void *, const void *, __kernel_size_t);
526#define memcmp(cs, ct, n) \ 151#define memcmp(d, s, n) __builtin_memcmp(d, s, n)
527(__builtin_constant_p(n) ? \
528 __builtin_memcmp((cs),(ct),(n)) : \
529 memcmp((cs),(ct),(n)))
530
531#define __HAVE_ARCH_MEMCHR
532static inline void *memchr(const void *cs, int c, size_t count)
533{
534 /* Someone else can optimize this, I don't care - tonym@mac.linux-m68k.org */
535 unsigned char *ret = (unsigned char *)cs;
536 for(;count>0;count--,ret++)
537 if(*ret == c) return ret;
538
539 return NULL;
540}
541 152
542#endif /* _M68K_STRING_H_ */ 153#endif /* _M68K_STRING_H_ */
diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h
index f391cbe39b96..b5a1febc97d4 100644
--- a/include/asm-m68k/types.h
+++ b/include/asm-m68k/types.h
@@ -60,8 +60,6 @@ typedef unsigned long long u64;
60typedef u32 dma_addr_t; 60typedef u32 dma_addr_t;
61typedef u32 dma64_addr_t; 61typedef u32 dma64_addr_t;
62 62
63typedef unsigned short kmem_bufctl_t;
64
65#endif /* __ASSEMBLY__ */ 63#endif /* __ASSEMBLY__ */
66 64
67#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index 605e6cb811f8..f5cedf19cf68 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -14,12 +14,6 @@
14/* We let the MMU do all checking */ 14/* We let the MMU do all checking */
15#define access_ok(type,addr,size) 1 15#define access_ok(type,addr,size) 1
16 16
17/* this function will go away soon - use access_ok() instead */
18static inline int __deprecated verify_area(int type, const void *addr, unsigned long size)
19{
20 return access_ok(type,addr,size) ? 0 : -EFAULT;
21}
22
23/* 17/*
24 * The exception table consists of pairs of addresses: the first is the 18 * The exception table consists of pairs of addresses: the first is the
25 * address of an instruction that is allowed to fault, and the second is 19 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-m68knommu/auxvec.h b/include/asm-m68knommu/auxvec.h
new file mode 100644
index 000000000000..844d6d52204b
--- /dev/null
+++ b/include/asm-m68knommu/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMm68k_AUXVEC_H
2#define __ASMm68k_AUXVEC_H
3
4#endif
diff --git a/include/asm-m68knommu/futex.h b/include/asm-m68knommu/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-m68knommu/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-m68knommu/hdreg.h b/include/asm-m68knommu/hdreg.h
deleted file mode 100644
index 5cdd9b084d37..000000000000
--- a/include/asm-m68knommu/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-m68k/hdreg.h>
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h
index 05e03df0ec29..942dfbead27f 100644
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -48,20 +48,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
48/* to align the pointer to the (next) page boundary */ 48/* to align the pointer to the (next) page boundary */
49#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 49#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
50 50
51/* Pure 2^n version of get_order */
52extern __inline__ int get_order(unsigned long size)
53{
54 int order;
55
56 size = (size-1) >> (PAGE_SHIFT-1);
57 order = -1;
58 do {
59 size >>= 1;
60 order++;
61 } while (size);
62 return order;
63}
64
65extern unsigned long memory_start; 51extern unsigned long memory_start;
66extern unsigned long memory_end; 52extern unsigned long memory_end;
67 53
@@ -73,8 +59,8 @@ extern unsigned long memory_end;
73 59
74#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
75 61
76#define __pa(vaddr) virt_to_phys((void *)vaddr) 62#define __pa(vaddr) virt_to_phys((void *)(vaddr))
77#define __va(paddr) phys_to_virt((unsigned long)paddr) 63#define __va(paddr) phys_to_virt((unsigned long)(paddr))
78 64
79#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 65#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
80#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 66#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
@@ -84,6 +70,7 @@ extern unsigned long memory_end;
84 70
85#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) 71#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
86#define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) 72#define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
73#define pfn_valid(pfn) ((pfn) < max_mapnr)
87 74
88#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 75#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
89 ((void *)(kaddr) < (void *)memory_end)) 76 ((void *)(kaddr) < (void *)memory_end))
@@ -92,4 +79,6 @@ extern unsigned long memory_end;
92 79
93#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
94 81
82#include <asm-generic/page.h>
83
95#endif /* _M68KNOMMU_PAGE_H */ 84#endif /* _M68KNOMMU_PAGE_H */
diff --git a/include/asm-m68knommu/uaccess.h b/include/asm-m68knommu/uaccess.h
index f0be74bb353c..05be9515a2d2 100644
--- a/include/asm-m68knommu/uaccess.h
+++ b/include/asm-m68knommu/uaccess.h
@@ -23,12 +23,6 @@ static inline int _access_ok(unsigned long addr, unsigned long size)
23 (is_in_rom(addr) && is_in_rom(addr+size))); 23 (is_in_rom(addr) && is_in_rom(addr+size)));
24} 24}
25 25
26/* this function will go away soon - use access_ok() instead */
27extern inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
28{
29 return access_ok(type,addr,size)?0:-EFAULT;
30}
31
32/* 26/*
33 * The exception table consists of pairs of addresses: the first is the 27 * The exception table consists of pairs of addresses: the first is the
34 * address of an instruction that is allowed to fault, and the second is 28 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-mips/a.out.h b/include/asm-mips/a.out.h
index e42b3093e903..2b3dc3bed4da 100644
--- a/include/asm-mips/a.out.h
+++ b/include/asm-mips/a.out.h
@@ -35,10 +35,10 @@ struct exec
35 35
36#ifdef __KERNEL__ 36#ifdef __KERNEL__
37 37
38#ifdef CONFIG_MIPS32 38#ifdef CONFIG_32BIT
39#define STACK_TOP TASK_SIZE 39#define STACK_TOP TASK_SIZE
40#endif 40#endif
41#ifdef CONFIG_MIPS64 41#ifdef CONFIG_64BIT
42#define STACK_TOP (current->thread.mflags & MF_32BIT_ADDR ? TASK_SIZE32 : TASK_SIZE) 42#define STACK_TOP (current->thread.mflags & MF_32BIT_ADDR ? TASK_SIZE32 : TASK_SIZE)
43#endif 43#endif
44 44
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 2caa8c427204..7dc2619f5006 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -48,7 +48,7 @@
48#define CPHYSADDR(a) ((_ACAST32_ (a)) & 0x1fffffff) 48#define CPHYSADDR(a) ((_ACAST32_ (a)) & 0x1fffffff)
49#define XPHYSADDR(a) ((_ACAST64_ (a)) & 0x000000ffffffffff) 49#define XPHYSADDR(a) ((_ACAST64_ (a)) & 0x000000ffffffffff)
50 50
51#ifdef CONFIG_MIPS64 51#ifdef CONFIG_64BIT
52 52
53/* 53/*
54 * Memory segments (64bit kernel mode addresses) 54 * Memory segments (64bit kernel mode addresses)
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
index 37a460aa0378..30b18ea6cb11 100644
--- a/include/asm-mips/asmmacro.h
+++ b/include/asm-mips/asmmacro.h
@@ -7,14 +7,14 @@
7 */ 7 */
8#ifndef _ASM_ASMMACRO_H 8#ifndef _ASM_ASMMACRO_H
9#define _ASM_ASMMACRO_H 9#define _ASM_ASMMACRO_H
10 10
11#include <linux/config.h> 11#include <linux/config.h>
12#include <asm/hazards.h> 12#include <asm/hazards.h>
13 13
14#ifdef CONFIG_MIPS32 14#ifdef CONFIG_32BIT
15#include <asm/asmmacro-32.h> 15#include <asm/asmmacro-32.h>
16#endif 16#endif
17#ifdef CONFIG_MIPS64 17#ifdef CONFIG_64BIT
18#include <asm/asmmacro-64.h> 18#include <asm/asmmacro-64.h>
19#endif 19#endif
20 20
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 7d89e87bc8c6..c0bd8d014e14 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -334,7 +334,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
334 */ 334 */
335#define atomic_add_negative(i,v) (atomic_add_return(i, (v)) < 0) 335#define atomic_add_negative(i,v) (atomic_add_return(i, (v)) < 0)
336 336
337#ifdef CONFIG_MIPS64 337#ifdef CONFIG_64BIT
338 338
339typedef struct { volatile __s64 counter; } atomic64_t; 339typedef struct { volatile __s64 counter; } atomic64_t;
340 340
@@ -639,7 +639,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
639 */ 639 */
640#define atomic64_add_negative(i,v) (atomic64_add_return(i, (v)) < 0) 640#define atomic64_add_negative(i,v) (atomic64_add_return(i, (v)) < 0)
641 641
642#endif /* CONFIG_MIPS64 */ 642#endif /* CONFIG_64BIT */
643 643
644/* 644/*
645 * atomic*_return operations are serializing but not the non-*_return 645 * atomic*_return operations are serializing but not the non-*_return
diff --git a/include/asm-mips/auxvec.h b/include/asm-mips/auxvec.h
new file mode 100644
index 000000000000..7cf7f2d21943
--- /dev/null
+++ b/include/asm-mips/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef _ASM_AUXVEC_H
2#define _ASM_AUXVEC_H
3
4#endif /* _ASM_AUXVEC_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 779d2187a6a4..eb8d79dba11c 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -20,13 +20,13 @@
20#define SZLONG_MASK 31UL 20#define SZLONG_MASK 31UL
21#define __LL "ll " 21#define __LL "ll "
22#define __SC "sc " 22#define __SC "sc "
23#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x)) 23#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x))
24#elif (_MIPS_SZLONG == 64) 24#elif (_MIPS_SZLONG == 64)
25#define SZLONG_LOG 6 25#define SZLONG_LOG 6
26#define SZLONG_MASK 63UL 26#define SZLONG_MASK 63UL
27#define __LL "lld " 27#define __LL "lld "
28#define __SC "scd " 28#define __SC "scd "
29#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x)) 29#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x))
30#endif 30#endif
31 31
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
@@ -533,14 +533,14 @@ static inline unsigned long ffz(unsigned long word)
533 int b = 0, s; 533 int b = 0, s;
534 534
535 word = ~word; 535 word = ~word;
536#ifdef CONFIG_MIPS32 536#ifdef CONFIG_32BIT
537 s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s; 537 s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s;
538 s = 8; if (word << 24 != 0) s = 0; b += s; word >>= s; 538 s = 8; if (word << 24 != 0) s = 0; b += s; word >>= s;
539 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s; 539 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s;
540 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s; 540 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s;
541 s = 1; if (word << 31 != 0) s = 0; b += s; 541 s = 1; if (word << 31 != 0) s = 0; b += s;
542#endif 542#endif
543#ifdef CONFIG_MIPS64 543#ifdef CONFIG_64BIT
544 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s; 544 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;
545 s = 16; if (word << 48 != 0) s = 0; b += s; word >>= s; 545 s = 16; if (word << 48 != 0) s = 0; b += s; word >>= s;
546 s = 8; if (word << 56 != 0) s = 0; b += s; word >>= s; 546 s = 8; if (word << 56 != 0) s = 0; b += s; word >>= s;
@@ -683,7 +683,7 @@ found_middle:
683 */ 683 */
684static inline int sched_find_first_bit(const unsigned long *b) 684static inline int sched_find_first_bit(const unsigned long *b)
685{ 685{
686#ifdef CONFIG_MIPS32 686#ifdef CONFIG_32BIT
687 if (unlikely(b[0])) 687 if (unlikely(b[0]))
688 return __ffs(b[0]); 688 return __ffs(b[0]);
689 if (unlikely(b[1])) 689 if (unlikely(b[1]))
@@ -694,7 +694,7 @@ static inline int sched_find_first_bit(const unsigned long *b)
694 return __ffs(b[3]) + 96; 694 return __ffs(b[3]) + 96;
695 return __ffs(b[4]) + 128; 695 return __ffs(b[4]) + 128;
696#endif 696#endif
697#ifdef CONFIG_MIPS64 697#ifdef CONFIG_64BIT
698 if (unlikely(b[0])) 698 if (unlikely(b[0]))
699 return __ffs(b[0]); 699 return __ffs(b[0]);
700 if (unlikely(b[1])) 700 if (unlikely(b[1]))
diff --git a/include/asm-mips/bugs.h b/include/asm-mips/bugs.h
index 18cced19cca4..b14b961c2100 100644
--- a/include/asm-mips/bugs.h
+++ b/include/asm-mips/bugs.h
@@ -15,7 +15,7 @@ extern void check_bugs64(void);
15static inline void check_bugs(void) 15static inline void check_bugs(void)
16{ 16{
17 check_bugs32(); 17 check_bugs32();
18#ifdef CONFIG_MIPS64 18#ifdef CONFIG_64BIT
19 check_bugs64(); 19 check_bugs64();
20#endif 20#endif
21} 21}
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index c25cc92b9950..c1ea5a8714f3 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -128,7 +128,7 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
128{ 128{
129 __asm__( 129 __asm__(
130 ".set\tnoat\t\t\t# csum_tcpudp_nofold\n\t" 130 ".set\tnoat\t\t\t# csum_tcpudp_nofold\n\t"
131#ifdef CONFIG_MIPS32 131#ifdef CONFIG_32BIT
132 "addu\t%0, %2\n\t" 132 "addu\t%0, %2\n\t"
133 "sltu\t$1, %0, %2\n\t" 133 "sltu\t$1, %0, %2\n\t"
134 "addu\t%0, $1\n\t" 134 "addu\t%0, $1\n\t"
@@ -141,7 +141,7 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
141 "sltu\t$1, %0, %4\n\t" 141 "sltu\t$1, %0, %4\n\t"
142 "addu\t%0, $1\n\t" 142 "addu\t%0, $1\n\t"
143#endif 143#endif
144#ifdef CONFIG_MIPS64 144#ifdef CONFIG_64BIT
145 "daddu\t%0, %2\n\t" 145 "daddu\t%0, %2\n\t"
146 "daddu\t%0, %3\n\t" 146 "daddu\t%0, %3\n\t"
147 "daddu\t%0, %4\n\t" 147 "daddu\t%0, %4\n\t"
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index d78002afb1e1..2c084cd4bc0a 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -15,8 +15,10 @@ typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t; 15typedef s32 compat_suseconds_t;
16 16
17typedef s32 compat_pid_t; 17typedef s32 compat_pid_t;
18typedef s32 compat_uid_t; 18typedef u32 __compat_uid_t;
19typedef s32 compat_gid_t; 19typedef u32 __compat_gid_t;
20typedef u32 __compat_uid32_t;
21typedef u32 __compat_gid32_t;
20typedef u32 compat_mode_t; 22typedef u32 compat_mode_t;
21typedef u32 compat_ino_t; 23typedef u32 compat_ino_t;
22typedef u32 compat_dev_t; 24typedef u32 compat_dev_t;
@@ -52,8 +54,8 @@ struct compat_stat {
52 compat_ino_t st_ino; 54 compat_ino_t st_ino;
53 compat_mode_t st_mode; 55 compat_mode_t st_mode;
54 compat_nlink_t st_nlink; 56 compat_nlink_t st_nlink;
55 compat_uid_t st_uid; 57 __compat_uid32_t st_uid;
56 compat_gid_t st_gid; 58 __compat_gid32_t st_gid;
57 compat_dev_t st_rdev; 59 compat_dev_t st_rdev;
58 s32 st_pad2[2]; 60 s32 st_pad2[2];
59 compat_off_t st_size; 61 compat_off_t st_size;
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 1df2c299de82..9a2de642eee6 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -106,7 +106,7 @@
106#define PLAT_TRAMPOLINE_STUFF_LINE 0UL 106#define PLAT_TRAMPOLINE_STUFF_LINE 0UL
107#endif 107#endif
108 108
109#ifdef CONFIG_MIPS32 109#ifdef CONFIG_32BIT
110# ifndef cpu_has_nofpuex 110# ifndef cpu_has_nofpuex
111# define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX) 111# define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX)
112# endif 112# endif
@@ -124,7 +124,7 @@
124# endif 124# endif
125#endif 125#endif
126 126
127#ifdef CONFIG_MIPS64 127#ifdef CONFIG_64BIT
128# ifndef cpu_has_nofpuex 128# ifndef cpu_has_nofpuex
129# define cpu_has_nofpuex 0 129# define cpu_has_nofpuex 0
130# endif 130# endif
diff --git a/include/asm-mips/ddb5xxx/ddb5477.h b/include/asm-mips/ddb5xxx/ddb5477.h
index ae3e2a38fd5f..a438548e6ef3 100644
--- a/include/asm-mips/ddb5xxx/ddb5477.h
+++ b/include/asm-mips/ddb5xxx/ddb5477.h
@@ -247,7 +247,7 @@ extern void ll_vrc5477_irq_disable(int vrc5477_irq);
247 * All PCI irq but INTC are active low. 247 * All PCI irq but INTC are active low.
248 */ 248 */
249 249
250/* 250/*
251 * irq number block assignment 251 * irq number block assignment
252 */ 252 */
253 253
@@ -285,7 +285,7 @@ extern void ll_vrc5477_irq_disable(int vrc5477_irq);
285#define VRC5477_IRQ_IOPCI_INTB (17 + VRC5477_IRQ_BASE) /* USB-P */ 285#define VRC5477_IRQ_IOPCI_INTB (17 + VRC5477_IRQ_BASE) /* USB-P */
286#define VRC5477_IRQ_IOPCI_INTC (18 + VRC5477_IRQ_BASE) /* AC97 */ 286#define VRC5477_IRQ_IOPCI_INTC (18 + VRC5477_IRQ_BASE) /* AC97 */
287#define VRC5477_IRQ_IOPCI_INTD (19 + VRC5477_IRQ_BASE) /* Reserved */ 287#define VRC5477_IRQ_IOPCI_INTD (19 + VRC5477_IRQ_BASE) /* Reserved */
288#define VRC5477_IRQ_UART1 (20 + VRC5477_IRQ_BASE) 288#define VRC5477_IRQ_UART1 (20 + VRC5477_IRQ_BASE)
289#define VRC5477_IRQ_SPT0 (21 + VRC5477_IRQ_BASE) /* special purpose timer 0 */ 289#define VRC5477_IRQ_SPT0 (21 + VRC5477_IRQ_BASE) /* special purpose timer 0 */
290#define VRC5477_IRQ_GPT0 (22 + VRC5477_IRQ_BASE) /* general purpose timer 0 */ 290#define VRC5477_IRQ_GPT0 (22 + VRC5477_IRQ_BASE) /* general purpose timer 0 */
291#define VRC5477_IRQ_GPT1 (23 + VRC5477_IRQ_BASE) /* general purpose timer 1 */ 291#define VRC5477_IRQ_GPT1 (23 + VRC5477_IRQ_BASE) /* general purpose timer 1 */
@@ -301,7 +301,7 @@ extern void ll_vrc5477_irq_disable(int vrc5477_irq);
301/* 301/*
302 * i2859 irq assignment 302 * i2859 irq assignment
303 */ 303 */
304#define I8259_IRQ_RESERVED_0 (0 + I8259_IRQ_BASE) 304#define I8259_IRQ_RESERVED_0 (0 + I8259_IRQ_BASE)
305#define I8259_IRQ_KEYBOARD (1 + I8259_IRQ_BASE) /* M1543 default */ 305#define I8259_IRQ_KEYBOARD (1 + I8259_IRQ_BASE) /* M1543 default */
306#define I8259_IRQ_CASCADE (2 + I8259_IRQ_BASE) 306#define I8259_IRQ_CASCADE (2 + I8259_IRQ_BASE)
307#define I8259_IRQ_UART_B (3 + I8259_IRQ_BASE) /* M1543 default, may conflict with RTC according to schematic diagram */ 307#define I8259_IRQ_UART_B (3 + I8259_IRQ_BASE) /* M1543 default, may conflict with RTC according to schematic diagram */
diff --git a/include/asm-mips/dec/prom.h b/include/asm-mips/dec/prom.h
index b63e2f2317d1..a05d6d3395fe 100644
--- a/include/asm-mips/dec/prom.h
+++ b/include/asm-mips/dec/prom.h
@@ -48,15 +48,15 @@
48 */ 48 */
49#define REX_PROM_MAGIC 0x30464354 49#define REX_PROM_MAGIC 0x30464354
50 50
51#ifdef CONFIG_MIPS64 51#ifdef CONFIG_64BIT
52 52
53#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ 53#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */
54 54
55#else /* !CONFIG_MIPS64 */ 55#else /* !CONFIG_64BIT */
56 56
57#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) 57#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC)
58 58
59#endif /* !CONFIG_MIPS64 */ 59#endif /* !CONFIG_64BIT */
60 60
61 61
62/* 62/*
@@ -105,7 +105,7 @@ extern int (*__pmax_read)(int, void *, int);
105extern int (*__pmax_close)(int); 105extern int (*__pmax_close)(int);
106 106
107 107
108#ifdef CONFIG_MIPS64 108#ifdef CONFIG_64BIT
109 109
110/* 110/*
111 * On MIPS64 we have to call PROM functions via a helper 111 * On MIPS64 we have to call PROM functions via a helper
@@ -138,7 +138,7 @@ int _prom_printf(int (*)(char *, ...), char *, ...) __DEC_PROM_O32;
138#define prom_getenv(x) _prom_getenv(__prom_getenv, x) 138#define prom_getenv(x) _prom_getenv(__prom_getenv, x)
139#define prom_printf(x...) _prom_printf(__prom_printf, x) 139#define prom_printf(x...) _prom_printf(__prom_printf, x)
140 140
141#else /* !CONFIG_MIPS64 */ 141#else /* !CONFIG_64BIT */
142 142
143/* 143/*
144 * On plain MIPS we just call PROM functions directly. 144 * On plain MIPS we just call PROM functions directly.
@@ -160,7 +160,7 @@ int _prom_printf(int (*)(char *, ...), char *, ...) __DEC_PROM_O32;
160#define pmax_read __pmax_read 160#define pmax_read __pmax_read
161#define pmax_close __pmax_close 161#define pmax_close __pmax_close
162 162
163#endif /* !CONFIG_MIPS64 */ 163#endif /* !CONFIG_64BIT */
164 164
165 165
166extern void prom_meminit(u32); 166extern void prom_meminit(u32);
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index d0f68447e5a7..a606dbee0412 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -57,11 +57,11 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
57 * The common rates of 1000 and 128 are rounded wrongly by the 57 * The common rates of 1000 and 128 are rounded wrongly by the
58 * catchall case for 64-bit. Excessive precission? Probably ... 58 * catchall case for 64-bit. Excessive precission? Probably ...
59 */ 59 */
60#if defined(CONFIG_MIPS64) && (HZ == 128) 60#if defined(CONFIG_64BIT) && (HZ == 128)
61 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */ 61 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */
62#elif defined(CONFIG_MIPS64) && (HZ == 1000) 62#elif defined(CONFIG_64BIT) && (HZ == 1000)
63 usecs *= 0x004189374BC6A7f0UL; /* 2**64 / (1000000 / HZ) */ 63 usecs *= 0x004189374BC6A7f0UL; /* 2**64 / (1000000 / HZ) */
64#elif defined(CONFIG_MIPS64) 64#elif defined(CONFIG_64BIT)
65 usecs *= (0x8000000000000000UL / (500000 / HZ)); 65 usecs *= (0x8000000000000000UL / (500000 / HZ));
66#else /* 32-bit junk follows here */ 66#else /* 32-bit junk follows here */
67 usecs *= (unsigned long) (((0x8000000000000000ULL / (500000 / HZ)) + 67 usecs *= (unsigned long) (((0x8000000000000000ULL / (500000 / HZ)) +
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index 7b92c8045cc2..e48811440015 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -125,7 +125,7 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
125typedef double elf_fpreg_t; 125typedef double elf_fpreg_t;
126typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 126typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
127 127
128#ifdef CONFIG_MIPS32 128#ifdef CONFIG_32BIT
129 129
130/* 130/*
131 * This is used to ensure we don't load something for the wrong architecture. 131 * This is used to ensure we don't load something for the wrong architecture.
@@ -153,9 +153,9 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
153 */ 153 */
154#define ELF_CLASS ELFCLASS32 154#define ELF_CLASS ELFCLASS32
155 155
156#endif /* CONFIG_MIPS32 */ 156#endif /* CONFIG_32BIT */
157 157
158#ifdef CONFIG_MIPS64 158#ifdef CONFIG_64BIT
159/* 159/*
160 * This is used to ensure we don't load something for the wrong architecture. 160 * This is used to ensure we don't load something for the wrong architecture.
161 */ 161 */
@@ -177,7 +177,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
177 */ 177 */
178#define ELF_CLASS ELFCLASS64 178#define ELF_CLASS ELFCLASS64
179 179
180#endif /* CONFIG_MIPS64 */ 180#endif /* CONFIG_64BIT */
181 181
182/* 182/*
183 * These are used to set parameters in the core dumps. 183 * These are used to set parameters in the core dumps.
@@ -193,7 +193,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
193 193
194#ifdef __KERNEL__ 194#ifdef __KERNEL__
195 195
196#ifdef CONFIG_MIPS32 196#ifdef CONFIG_32BIT
197 197
198#define SET_PERSONALITY(ex, ibcs2) \ 198#define SET_PERSONALITY(ex, ibcs2) \
199do { \ 199do { \
@@ -202,9 +202,9 @@ do { \
202 set_personality(PER_LINUX); \ 202 set_personality(PER_LINUX); \
203} while (0) 203} while (0)
204 204
205#endif /* CONFIG_MIPS32 */ 205#endif /* CONFIG_32BIT */
206 206
207#ifdef CONFIG_MIPS64 207#ifdef CONFIG_64BIT
208 208
209#define SET_PERSONALITY(ex, ibcs2) \ 209#define SET_PERSONALITY(ex, ibcs2) \
210do { current->thread.mflags &= ~MF_ABI_MASK; \ 210do { current->thread.mflags &= ~MF_ABI_MASK; \
@@ -222,7 +222,7 @@ do { current->thread.mflags &= ~MF_ABI_MASK; \
222 set_personality(PER_LINUX); \ 222 set_personality(PER_LINUX); \
223} while (0) 223} while (0)
224 224
225#endif /* CONFIG_MIPS64 */ 225#endif /* CONFIG_64BIT */
226 226
227extern void dump_regs(elf_greg_t *, struct pt_regs *regs); 227extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
228extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 228extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
index 2436392e7990..06c5d13faf66 100644
--- a/include/asm-mips/fcntl.h
+++ b/include/asm-mips/fcntl.h
@@ -8,33 +8,16 @@
8#ifndef _ASM_FCNTL_H 8#ifndef _ASM_FCNTL_H
9#define _ASM_FCNTL_H 9#define _ASM_FCNTL_H
10 10
11/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
12 located on an ext2 file system */
13#define O_ACCMODE 0x0003
14#define O_RDONLY 0x0000
15#define O_WRONLY 0x0001
16#define O_RDWR 0x0002
17#define O_APPEND 0x0008 11#define O_APPEND 0x0008
18#define O_SYNC 0x0010 12#define O_SYNC 0x0010
19#define O_NONBLOCK 0x0080 13#define O_NONBLOCK 0x0080
20#define O_CREAT 0x0100 /* not fcntl */ 14#define O_CREAT 0x0100 /* not fcntl */
21#define O_TRUNC 0x0200 /* not fcntl */
22#define O_EXCL 0x0400 /* not fcntl */ 15#define O_EXCL 0x0400 /* not fcntl */
23#define O_NOCTTY 0x0800 /* not fcntl */ 16#define O_NOCTTY 0x0800 /* not fcntl */
24#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ 17#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
25#define O_LARGEFILE 0x2000 /* allow large file opens */ 18#define O_LARGEFILE 0x2000 /* allow large file opens */
26#define O_DIRECT 0x8000 /* direct disk access hint */ 19#define O_DIRECT 0x8000 /* direct disk access hint */
27#define O_DIRECTORY 0x10000 /* must be a directory */
28#define O_NOFOLLOW 0x20000 /* don't follow links */
29#define O_NOATIME 0x40000
30 20
31#define O_NDELAY O_NONBLOCK
32
33#define F_DUPFD 0 /* dup */
34#define F_GETFD 1 /* get close_on_exec */
35#define F_SETFD 2 /* set/clear close_on_exec */
36#define F_GETFL 3 /* get file->f_flags */
37#define F_SETFL 4 /* set file->f_flags */
38#define F_GETLK 14 21#define F_GETLK 14
39#define F_SETLK 6 22#define F_SETLK 6
40#define F_SETLKW 7 23#define F_SETLKW 7
@@ -50,33 +33,6 @@
50#define F_SETLKW64 35 33#define F_SETLKW64 35
51#endif 34#endif
52 35
53/* for F_[GET|SET]FL */
54#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
55
56/* for posix fcntl() and lockf() */
57#define F_RDLCK 0
58#define F_WRLCK 1
59#define F_UNLCK 2
60
61/* for old implementation of bsd flock () */
62#define F_EXLCK 4 /* or 3 */
63#define F_SHLCK 8 /* or 4 */
64
65/* for leases */
66#define F_INPROGRESS 16
67
68/* operations for bsd flock(), also used by the kernel implementation */
69#define LOCK_SH 1 /* shared lock */
70#define LOCK_EX 2 /* exclusive lock */
71#define LOCK_NB 4 /* or'd with one of the above to prevent
72 blocking */
73#define LOCK_UN 8 /* remove lock */
74
75#define LOCK_MAND 32 /* This is a mandatory flock */
76#define LOCK_READ 64 /* ... Which allows concurrent read operations */
77#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
78#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
79
80/* 36/*
81 * The flavours of struct flock. "struct flock" is the ABI compliant 37 * The flavours of struct flock. "struct flock" is the ABI compliant
82 * variant. Finally struct flock64 is the LFS variant of struct flock. As 38 * variant. Finally struct flock64 is the LFS variant of struct flock. As
@@ -86,7 +42,7 @@
86 42
87#ifndef __mips64 43#ifndef __mips64
88 44
89typedef struct flock { 45struct flock {
90 short l_type; 46 short l_type;
91 short l_whence; 47 short l_whence;
92 __kernel_off_t l_start; 48 __kernel_off_t l_start;
@@ -94,32 +50,17 @@ typedef struct flock {
94 long l_sysid; 50 long l_sysid;
95 __kernel_pid_t l_pid; 51 __kernel_pid_t l_pid;
96 long pad[4]; 52 long pad[4];
97} flock_t; 53};
98
99typedef struct flock64 {
100 short l_type;
101 short l_whence;
102 loff_t l_start;
103 loff_t l_len;
104 pid_t l_pid;
105} flock64_t;
106 54
107#else /* 64-bit definitions */ 55#define HAVE_ARCH_STRUCT_FLOCK
108 56
109typedef struct flock {
110 short l_type;
111 short l_whence;
112 __kernel_off_t l_start;
113 __kernel_off_t l_len;
114 __kernel_pid_t l_pid;
115} flock_t;
116
117#ifdef __KERNEL__
118#define flock64 flock
119#endif 57#endif
120 58
121#endif 59#include <asm-generic/fcntl.h>
122 60
123#define F_LINUX_SPECIFIC_BASE 1024 61typedef struct flock flock_t;
62#ifndef __mips64
63typedef struct flock64 flock64_t;
64#endif
124 65
125#endif /* _ASM_FCNTL_H */ 66#endif /* _ASM_FCNTL_H */
diff --git a/include/asm-mips/fpregdef.h b/include/asm-mips/fpregdef.h
index 1d9aa0979181..2b5fddc8f487 100644
--- a/include/asm-mips/fpregdef.h
+++ b/include/asm-mips/fpregdef.h
@@ -13,7 +13,7 @@
13#define _ASM_FPREGDEF_H 13#define _ASM_FPREGDEF_H
14 14
15#include <asm/sgidefs.h> 15#include <asm/sgidefs.h>
16 16
17#if _MIPS_SIM == _MIPS_SIM_ABI32 17#if _MIPS_SIM == _MIPS_SIM_ABI32
18 18
19/* 19/*
@@ -56,7 +56,7 @@
56#define fcr31 $31 /* FPU status register */ 56#define fcr31 $31 /* FPU status register */
57 57
58#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 58#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
59 59
60#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 60#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
61 61
62#define fv0 $f0 /* return value */ 62#define fv0 $f0 /* return value */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 6cb38d5c0407..ea24e733b1bc 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -82,7 +82,7 @@ do { \
82 82
83static inline int is_fpu_owner(void) 83static inline int is_fpu_owner(void)
84{ 84{
85 return cpu_has_fpu && test_thread_flag(TIF_USEDFPU); 85 return cpu_has_fpu && test_thread_flag(TIF_USEDFPU);
86} 86}
87 87
88static inline void own_fpu(void) 88static inline void own_fpu(void)
@@ -90,7 +90,7 @@ static inline void own_fpu(void)
90 if (cpu_has_fpu) { 90 if (cpu_has_fpu) {
91 __enable_fpu(); 91 __enable_fpu();
92 KSTK_STATUS(current) |= ST0_CU1; 92 KSTK_STATUS(current) |= ST0_CU1;
93 set_thread_flag(TIF_USEDFPU); 93 set_thread_flag(TIF_USEDFPU);
94 } 94 }
95} 95}
96 96
@@ -98,7 +98,7 @@ static inline void lose_fpu(void)
98{ 98{
99 if (cpu_has_fpu) { 99 if (cpu_has_fpu) {
100 KSTK_STATUS(current) &= ~ST0_CU1; 100 KSTK_STATUS(current) &= ~ST0_CU1;
101 clear_thread_flag(TIF_USEDFPU); 101 clear_thread_flag(TIF_USEDFPU);
102 __disable_fpu(); 102 __disable_fpu();
103 } 103 }
104} 104}
@@ -127,7 +127,7 @@ static inline void restore_fp(struct task_struct *tsk)
127static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) 127static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
128{ 128{
129 if (cpu_has_fpu) { 129 if (cpu_has_fpu) {
130 if ((tsk == current) && is_fpu_owner()) 130 if ((tsk == current) && is_fpu_owner())
131 _save_fp(current); 131 _save_fp(current);
132 return tsk->thread.fpu.hard.fpr; 132 return tsk->thread.fpu.hard.fpr;
133 } 133 }
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
new file mode 100644
index 000000000000..9feff4ce1424
--- /dev/null
+++ b/include/asm-mips/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-mips/hdreg.h b/include/asm-mips/hdreg.h
deleted file mode 100644
index 5989bbc97cbf..000000000000
--- a/include/asm-mips/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#warning this file is obsolete, please do not use it
diff --git a/include/asm-mips/hp-lj/asic.h b/include/asm-mips/hp-lj/asic.h
deleted file mode 100644
index fc2ca656da00..000000000000
--- a/include/asm-mips/hp-lj/asic.h
+++ /dev/null
@@ -1,7 +0,0 @@
1
2typedef enum { IllegalAsic, UnknownAsic, AndrosAsic, HarmonyAsic } AsicId;
3
4AsicId GetAsicId(void);
5
6const char* const GetAsicName(void);
7
diff --git a/include/asm-mips/ip32/mace.h b/include/asm-mips/ip32/mace.h
index 2b7b0fdeac19..432011b16c26 100644
--- a/include/asm-mips/ip32/mace.h
+++ b/include/asm-mips/ip32/mace.h
@@ -94,7 +94,7 @@ struct mace_video {
94 unsigned long xxx; /* later... */ 94 unsigned long xxx; /* later... */
95}; 95};
96 96
97/* 97/*
98 * Ethernet interface 98 * Ethernet interface
99 */ 99 */
100struct mace_ethernet { 100struct mace_ethernet {
@@ -129,7 +129,7 @@ struct mace_ethernet {
129 volatile unsigned long rx_fifo; 129 volatile unsigned long rx_fifo;
130}; 130};
131 131
132/* 132/*
133 * Peripherals 133 * Peripherals
134 */ 134 */
135 135
@@ -251,7 +251,7 @@ struct mace_timers {
251 timer_reg audio_out2; 251 timer_reg audio_out2;
252 timer_reg video_in1; 252 timer_reg video_in1;
253 timer_reg video_in2; 253 timer_reg video_in2;
254 timer_reg video_out; 254 timer_reg video_out;
255}; 255};
256 256
257struct mace_perif { 257struct mace_perif {
@@ -272,7 +272,7 @@ struct mace_perif {
272}; 272};
273 273
274 274
275/* 275/*
276 * ISA peripherals 276 * ISA peripherals
277 */ 277 */
278 278
diff --git a/include/asm-mips/lasat/serial.h b/include/asm-mips/lasat/serial.h
index 21d0fb7cee64..9e88c7669c7a 100644
--- a/include/asm-mips/lasat/serial.h
+++ b/include/asm-mips/lasat/serial.h
@@ -1,13 +1,13 @@
1#include <asm/lasat/lasat.h> 1#include <asm/lasat/lasat.h>
2 2
3/* Lasat 100 boards serial configuration */ 3/* Lasat 100 boards serial configuration */
4#define LASAT_BASE_BAUD_100 ( 7372800 / 16 ) 4#define LASAT_BASE_BAUD_100 ( 7372800 / 16 )
5#define LASAT_UART_REGS_BASE_100 0x1c8b0000 5#define LASAT_UART_REGS_BASE_100 0x1c8b0000
6#define LASAT_UART_REGS_SHIFT_100 2 6#define LASAT_UART_REGS_SHIFT_100 2
7#define LASATINT_UART_100 8 7#define LASATINT_UART_100 8
8 8
9/* * LASAT 200 boards serial configuration */ 9/* * LASAT 200 boards serial configuration */
10#define LASAT_BASE_BAUD_200 (100000000 / 16 / 12) 10#define LASAT_BASE_BAUD_200 (100000000 / 16 / 12)
11#define LASAT_UART_REGS_BASE_200 (Vrc5074_PHYS_BASE + 0x0300) 11#define LASAT_UART_REGS_BASE_200 (Vrc5074_PHYS_BASE + 0x0300)
12#define LASAT_UART_REGS_SHIFT_200 3 12#define LASAT_UART_REGS_SHIFT_200 3
13#define LASATINT_UART_200 13 13#define LASATINT_UART_200 13
diff --git a/include/asm-mips/local.h b/include/asm-mips/local.h
index 7eb6bf661b80..c38844f615fc 100644
--- a/include/asm-mips/local.h
+++ b/include/asm-mips/local.h
@@ -5,7 +5,7 @@
5#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <asm/atomic.h> 6#include <asm/atomic.h>
7 7
8#ifdef CONFIG_MIPS32 8#ifdef CONFIG_32BIT
9 9
10typedef atomic_t local_t; 10typedef atomic_t local_t;
11 11
@@ -20,7 +20,7 @@ typedef atomic_t local_t;
20 20
21#endif 21#endif
22 22
23#ifdef CONFIG_MIPS64 23#ifdef CONFIG_64BIT
24 24
25typedef atomic64_t local_t; 25typedef atomic64_t local_t;
26 26
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index 2b36ea346910..148bae2fa7d3 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -1383,7 +1383,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1383#define PCI_IO_START 0 1383#define PCI_IO_START 0
1384#define PCI_IO_END 0 1384#define PCI_IO_END 0
1385#define PCI_MEM_START 0 1385#define PCI_MEM_START 0
1386#define PCI_MEM_END 0 1386#define PCI_MEM_END 0
1387#define PCI_FIRST_DEVFN 0 1387#define PCI_FIRST_DEVFN 0
1388#define PCI_LAST_DEVFN 0 1388#define PCI_LAST_DEVFN 0
1389#endif 1389#endif
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
index 4691398a414f..efafe65258b6 100644
--- a/include/asm-mips/mach-db1x00/db1x00.h
+++ b/include/asm-mips/mach-db1x00/db1x00.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * ######################################################################## 24 * ########################################################################
25 * 25 *
26 * 26 *
27 */ 27 */
28#ifndef __ASM_DB1X00_H 28#ifndef __ASM_DB1X00_H
29#define __ASM_DB1X00_H 29#define __ASM_DB1X00_H
diff --git a/include/asm-mips/mach-generic/spaces.h b/include/asm-mips/mach-generic/spaces.h
index 63c0a81c7832..5a2c1efb4eb7 100644
--- a/include/asm-mips/mach-generic/spaces.h
+++ b/include/asm-mips/mach-generic/spaces.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14 14
15#ifdef CONFIG_MIPS32 15#ifdef CONFIG_32BIT
16 16
17#define CAC_BASE 0x80000000 17#define CAC_BASE 0x80000000
18#define IO_BASE 0xa0000000 18#define IO_BASE 0xa0000000
@@ -32,9 +32,9 @@
32#define HIGHMEM_START 0x20000000UL 32#define HIGHMEM_START 0x20000000UL
33#endif 33#endif
34 34
35#endif /* CONFIG_MIPS32 */ 35#endif /* CONFIG_32BIT */
36 36
37#ifdef CONFIG_MIPS64 37#ifdef CONFIG_64BIT
38 38
39/* 39/*
40 * This handles the memory map. 40 * This handles the memory map.
@@ -67,6 +67,6 @@
67#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) 67#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
68#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK)) 68#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
69 69
70#endif /* CONFIG_MIPS64 */ 70#endif /* CONFIG_64BIT */
71 71
72#endif /* __ASM_MACH_GENERIC_SPACES_H */ 72#endif /* __ASM_MACH_GENERIC_SPACES_H */
diff --git a/include/asm-mips/mach-ip22/spaces.h b/include/asm-mips/mach-ip22/spaces.h
index 30d42fcafe3d..e96166f27c49 100644
--- a/include/asm-mips/mach-ip22/spaces.h
+++ b/include/asm-mips/mach-ip22/spaces.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14 14
15#ifdef CONFIG_MIPS32 15#ifdef CONFIG_32BIT
16 16
17#define CAC_BASE 0x80000000 17#define CAC_BASE 0x80000000
18#define IO_BASE 0xa0000000 18#define IO_BASE 0xa0000000
@@ -32,9 +32,9 @@
32#define HIGHMEM_START 0x20000000UL 32#define HIGHMEM_START 0x20000000UL
33#endif 33#endif
34 34
35#endif /* CONFIG_MIPS32 */ 35#endif /* CONFIG_32BIT */
36 36
37#ifdef CONFIG_MIPS64 37#ifdef CONFIG_64BIT
38#define PAGE_OFFSET 0xffffffff80000000UL 38#define PAGE_OFFSET 0xffffffff80000000UL
39 39
40#ifndef HIGHMEM_START 40#ifndef HIGHMEM_START
@@ -50,6 +50,6 @@
50#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) 50#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
51#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK)) 51#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
52 52
53#endif /* CONFIG_MIPS64 */ 53#endif /* CONFIG_64BIT */
54 54
55#endif /* __ASM_MACH_IP22_SPACES_H */ 55#endif /* __ASM_MACH_IP22_SPACES_H */
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index b932237f2193..04713973c6c3 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -18,7 +18,7 @@
18 * so, for 64bit IP32 kernel we just don't use ll/sc. 18 * so, for 64bit IP32 kernel we just don't use ll/sc.
19 * This does not affect luserland. 19 * This does not affect luserland.
20 */ 20 */
21#if defined(CONFIG_CPU_R5000) && defined(CONFIG_MIPS64) 21#if defined(CONFIG_CPU_R5000) && defined(CONFIG_64BIT)
22#define cpu_has_llsc 0 22#define cpu_has_llsc 0
23#else 23#else
24#define cpu_has_llsc 1 24#define cpu_has_llsc 1
diff --git a/include/asm-mips/mach-jazz/floppy.h b/include/asm-mips/mach-jazz/floppy.h
index 8cf0d042c864..c9dad99b1232 100644
--- a/include/asm-mips/mach-jazz/floppy.h
+++ b/include/asm-mips/mach-jazz/floppy.h
@@ -92,7 +92,7 @@ static inline int fd_request_irq(void)
92 return request_irq(FLOPPY_IRQ, floppy_interrupt, 92 return request_irq(FLOPPY_IRQ, floppy_interrupt,
93 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL); 93 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL);
94} 94}
95 95
96static inline void fd_free_irq(void) 96static inline void fd_free_irq(void)
97{ 97{
98 free_irq(FLOPPY_IRQ, NULL); 98 free_irq(FLOPPY_IRQ, NULL);
diff --git a/include/asm-mips/mach-pb1x00/pb1500.h b/include/asm-mips/mach-pb1x00/pb1500.h
index d6c779747b3c..ff6d40c87a25 100644
--- a/include/asm-mips/mach-pb1x00/pb1500.h
+++ b/include/asm-mips/mach-pb1x00/pb1500.h
@@ -33,11 +33,11 @@
33#define PCI_BOARD_REG 0xAE000010 33#define PCI_BOARD_REG 0xAE000010
34#define PCMCIA_BOARD_REG 0xAE000010 34#define PCMCIA_BOARD_REG 0xAE000010
35 #define PC_DEASSERT_RST 0x80 35 #define PC_DEASSERT_RST 0x80
36 #define PC_DRV_EN 0x10 36 #define PC_DRV_EN 0x10
37#define PB1500_G_CONTROL 0xAE000014 37#define PB1500_G_CONTROL 0xAE000014
38#define PB1500_RST_VDDI 0xAE00001C 38#define PB1500_RST_VDDI 0xAE00001C
39#define PB1500_LEDS 0xAE000018 39#define PB1500_LEDS 0xAE000018
40 40
41#define PB1500_HEX_LED 0xAF000004 41#define PB1500_HEX_LED 0xAF000004
42#define PB1500_HEX_LED_BLANK 0xAF000008 42#define PB1500_HEX_LED_BLANK 0xAF000008
43 43
diff --git a/include/asm-mips/mach-qemu/cpu-feature-overrides.h b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
new file mode 100644
index 000000000000..f4e370e27168
--- /dev/null
+++ b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
@@ -0,0 +1,31 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 */
8#ifndef __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * QEMU only comes with a hazard-free MIPS32 processor, so things are easy.
13 */
14#define cpu_has_mips16 0
15#define cpu_has_divec 0
16#define cpu_has_cache_cdex_p 0
17#define cpu_has_prefetch 0
18#define cpu_has_mcheck 0
19#define cpu_has_ejtag 0
20
21#define cpu_has_llsc 1
22#define cpu_has_vtag_icache 0
23#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
24#define cpu_has_ic_fills_f_dc 0
25
26#define cpu_has_dsp 0
27
28#define cpu_has_nofpuex 0
29#define cpu_has_64bits 0
30
31#endif /* __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-qemu/param.h b/include/asm-mips/mach-qemu/param.h
new file mode 100644
index 000000000000..cb30ee490ae6
--- /dev/null
+++ b/include/asm-mips/mach-qemu/param.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_QEMU_PARAM_H
9#define __ASM_MACH_QEMU_PARAM_H
10
11#define HZ 100 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_QEMU_PARAM_H */
diff --git a/include/asm-mips/mach-vr41xx/timex.h b/include/asm-mips/mach-vr41xx/timex.h
deleted file mode 100644
index 8d71485d003a..000000000000
--- a/include/asm-mips/mach-vr41xx/timex.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8/*
9 * Changes:
10 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
11 * - CLOCK_TICK_RATE is changed into 32768 from 6144000.
12 */
13#ifndef __ASM_MACH_VR41XX_TIMEX_H
14#define __ASM_MACH_VR41XX_TIMEX_H
15
16#define CLOCK_TICK_RATE 32768
17
18#endif /* __ASM_MACH_VR41XX_TIMEX_H */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 48b77c9fb4f2..45cd72d172e8 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -28,17 +28,17 @@ extern unsigned long pgd_current[];
28#define TLBMISS_HANDLER_SETUP_PGD(pgd) \ 28#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
29 pgd_current[smp_processor_id()] = (unsigned long)(pgd) 29 pgd_current[smp_processor_id()] = (unsigned long)(pgd)
30 30
31#ifdef CONFIG_MIPS32 31#ifdef CONFIG_32BIT
32#define TLBMISS_HANDLER_SETUP() \ 32#define TLBMISS_HANDLER_SETUP() \
33 write_c0_context((unsigned long) smp_processor_id() << 23); \ 33 write_c0_context((unsigned long) smp_processor_id() << 23); \
34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
35#endif 35#endif
36#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64) 36#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
37#define TLBMISS_HANDLER_SETUP() \ 37#define TLBMISS_HANDLER_SETUP() \
38 write_c0_context((unsigned long) &pgd_current[smp_processor_id()] << 23); \ 38 write_c0_context((unsigned long) &pgd_current[smp_processor_id()] << 23); \
39 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 39 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
40#endif 40#endif
41#if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64) 41#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
42#define TLBMISS_HANDLER_SETUP() \ 42#define TLBMISS_HANDLER_SETUP() \
43 write_c0_context((unsigned long) smp_processor_id() << 23); \ 43 write_c0_context((unsigned long) smp_processor_id() << 23); \
44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
diff --git a/include/asm-mips/module.h b/include/asm-mips/module.h
index 90ee24aad955..0be58b2aeb9f 100644
--- a/include/asm-mips/module.h
+++ b/include/asm-mips/module.h
@@ -25,7 +25,7 @@ typedef struct
25 Elf64_Sxword r_addend; /* Addend. */ 25 Elf64_Sxword r_addend; /* Addend. */
26} Elf64_Mips_Rela; 26} Elf64_Mips_Rela;
27 27
28#ifdef CONFIG_MIPS32 28#ifdef CONFIG_32BIT
29 29
30#define Elf_Shdr Elf32_Shdr 30#define Elf_Shdr Elf32_Shdr
31#define Elf_Sym Elf32_Sym 31#define Elf_Sym Elf32_Sym
@@ -33,7 +33,7 @@ typedef struct
33 33
34#endif 34#endif
35 35
36#ifdef CONFIG_MIPS64 36#ifdef CONFIG_64BIT
37 37
38#define Elf_Shdr Elf64_Shdr 38#define Elf_Shdr Elf64_Shdr
39#define Elf_Sym Elf64_Sym 39#define Elf_Sym Elf64_Sym
diff --git a/include/asm-mips/msgbuf.h b/include/asm-mips/msgbuf.h
index 513b2824838b..a1533959742e 100644
--- a/include/asm-mips/msgbuf.h
+++ b/include/asm-mips/msgbuf.h
@@ -15,25 +15,25 @@
15 15
16struct msqid64_ds { 16struct msqid64_ds {
17 struct ipc64_perm msg_perm; 17 struct ipc64_perm msg_perm;
18#if defined(CONFIG_MIPS32) && !defined(CONFIG_CPU_LITTLE_ENDIAN) 18#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
19 unsigned long __unused1; 19 unsigned long __unused1;
20#endif 20#endif
21 __kernel_time_t msg_stime; /* last msgsnd time */ 21 __kernel_time_t msg_stime; /* last msgsnd time */
22#if defined(CONFIG_MIPS32) && defined(CONFIG_CPU_LITTLE_ENDIAN) 22#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN)
23 unsigned long __unused1; 23 unsigned long __unused1;
24#endif 24#endif
25#if defined(CONFIG_MIPS32) && !defined(CONFIG_CPU_LITTLE_ENDIAN) 25#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
26 unsigned long __unused2; 26 unsigned long __unused2;
27#endif 27#endif
28 __kernel_time_t msg_rtime; /* last msgrcv time */ 28 __kernel_time_t msg_rtime; /* last msgrcv time */
29#if defined(CONFIG_MIPS32) && defined(CONFIG_CPU_LITTLE_ENDIAN) 29#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN)
30 unsigned long __unused2; 30 unsigned long __unused2;
31#endif 31#endif
32#if defined(CONFIG_MIPS32) && !defined(CONFIG_CPU_LITTLE_ENDIAN) 32#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
33 unsigned long __unused3; 33 unsigned long __unused3;
34#endif 34#endif
35 __kernel_time_t msg_ctime; /* last change time */ 35 __kernel_time_t msg_ctime; /* last change time */
36#if defined(CONFIG_MIPS32) && defined(CONFIG_CPU_LITTLE_ENDIAN) 36#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN)
37 unsigned long __unused3; 37 unsigned long __unused3;
38#endif 38#endif
39 unsigned long msg_cbytes; /* current number of bytes on queue */ 39 unsigned long msg_cbytes; /* current number of bytes on queue */
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
index 36cec9e31696..309bc3099f68 100644
--- a/include/asm-mips/paccess.h
+++ b/include/asm-mips/paccess.h
@@ -16,10 +16,10 @@
16#include <linux/config.h> 16#include <linux/config.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18 18
19#ifdef CONFIG_MIPS32 19#ifdef CONFIG_32BIT
20#define __PA_ADDR ".word" 20#define __PA_ADDR ".word"
21#endif 21#endif
22#ifdef CONFIG_MIPS64 22#ifdef CONFIG_64BIT
23#define __PA_ADDR ".dword" 23#define __PA_ADDR ".dword"
24#endif 24#endif
25 25
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 5cae35cd9ba9..652b6d67a571 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -103,20 +103,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
103#define __pgd(x) ((pgd_t) { (x) } ) 103#define __pgd(x) ((pgd_t) { (x) } )
104#define __pgprot(x) ((pgprot_t) { (x) } ) 104#define __pgprot(x) ((pgprot_t) { (x) } )
105 105
106/* Pure 2^n version of get_order */
107static __inline__ int get_order(unsigned long size)
108{
109 int order;
110
111 size = (size-1) >> (PAGE_SHIFT-1);
112 order = -1;
113 do {
114 size >>= 1;
115 order++;
116 } while (size);
117 return order;
118}
119
120#endif /* !__ASSEMBLY__ */ 106#endif /* !__ASSEMBLY__ */
121 107
122/* to align the pointer to the (next) page boundary */ 108/* to align the pointer to the (next) page boundary */
@@ -148,4 +134,6 @@ static __inline__ int get_order(unsigned long size)
148#define WANT_PAGE_VIRTUAL 134#define WANT_PAGE_VIRTUAL
149#endif 135#endif
150 136
137#include <asm-generic/page.h>
138
151#endif /* _ASM_PAGE_H */ 139#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index d70dc355c1f3..c9a00ca1c012 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -94,7 +94,7 @@ struct pci_dev;
94 */ 94 */
95extern unsigned int PCI_DMA_BUS_IS_PHYS; 95extern unsigned int PCI_DMA_BUS_IS_PHYS;
96 96
97#ifdef CONFIG_MAPPED_DMA_IO 97#ifdef CONFIG_DMA_NEED_PCI_MAP_STATE
98 98
99/* pci_unmap_{single,page} is not a nop, thus... */ 99/* pci_unmap_{single,page} is not a nop, thus... */
100#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME; 100#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
@@ -104,7 +104,7 @@ extern unsigned int PCI_DMA_BUS_IS_PHYS;
104#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) 104#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
105#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) 105#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
106 106
107#else /* CONFIG_MAPPED_DMA_IO */ 107#else /* CONFIG_DMA_NEED_PCI_MAP_STATE */
108 108
109/* pci_unmap_{page,single} is a nop so... */ 109/* pci_unmap_{page,single} is a nop so... */
110#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 110#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
@@ -114,7 +114,7 @@ extern unsigned int PCI_DMA_BUS_IS_PHYS;
114#define pci_unmap_len(PTR, LEN_NAME) (0) 114#define pci_unmap_len(PTR, LEN_NAME) (0)
115#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 115#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
116 116
117#endif /* CONFIG_MAPPED_DMA_IO */ 117#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */
118 118
119/* This is always fine. */ 119/* This is always fine. */
120#define pci_dac_dma_supported(pci_dev, mask) (1) 120#define pci_dac_dma_supported(pci_dev, mask) (1)
@@ -142,6 +142,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
142 142
143extern void pcibios_resource_to_bus(struct pci_dev *dev, 143extern void pcibios_resource_to_bus(struct pci_dev *dev,
144 struct pci_bus_region *region, struct resource *res); 144 struct pci_bus_region *region, struct resource *res);
145extern void pcibios_bus_to_resource(struct pci_dev *dev,
146 struct resource *res, struct pci_bus_region *region);
145 147
146#ifdef CONFIG_PCI_DOMAINS 148#ifdef CONFIG_PCI_DOMAINS
147 149
@@ -167,4 +169,17 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev)
167/* Do platform specific device initialization at pci_enable_device() time */ 169/* Do platform specific device initialization at pci_enable_device() time */
168extern int pcibios_plat_dev_init(struct pci_dev *dev); 170extern int pcibios_plat_dev_init(struct pci_dev *dev);
169 171
172static inline struct resource *
173pcibios_select_root(struct pci_dev *pdev, struct resource *res)
174{
175 struct resource *root = NULL;
176
177 if (res->flags & IORESOURCE_IO)
178 root = &ioport_resource;
179 if (res->flags & IORESOURCE_MEM)
180 root = &iomem_resource;
181
182 return root;
183}
184
170#endif /* _ASM_PCI_H */ 185#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
index 2d63f5ba403f..ce57288d43bd 100644
--- a/include/asm-mips/pgalloc.h
+++ b/include/asm-mips/pgalloc.h
@@ -85,7 +85,7 @@ static inline void pte_free(struct page *pte)
85 85
86#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 86#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
87 87
88#ifdef CONFIG_MIPS32 88#ifdef CONFIG_32BIT
89#define pgd_populate(mm, pmd, pte) BUG() 89#define pgd_populate(mm, pmd, pte) BUG()
90 90
91/* 91/*
@@ -97,7 +97,7 @@ static inline void pte_free(struct page *pte)
97#define __pmd_free_tlb(tlb,x) do { } while (0) 97#define __pmd_free_tlb(tlb,x) do { } while (0)
98#endif 98#endif
99 99
100#ifdef CONFIG_MIPS64 100#ifdef CONFIG_64BIT
101 101
102#define pgd_populate(mm, pgd, pmd) set_pgd(pgd, __pgd(pmd)) 102#define pgd_populate(mm, pgd, pmd) set_pgd(pgd, __pgd(pmd))
103 103
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index e76ccd6e3a5d..dbe13da0bdad 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -11,10 +11,10 @@
11#include <asm-generic/4level-fixup.h> 11#include <asm-generic/4level-fixup.h>
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14#ifdef CONFIG_MIPS32 14#ifdef CONFIG_32BIT
15#include <asm/pgtable-32.h> 15#include <asm/pgtable-32.h>
16#endif 16#endif
17#ifdef CONFIG_MIPS64 17#ifdef CONFIG_64BIT
18#include <asm/pgtable-64.h> 18#include <asm/pgtable-64.h>
19#endif 19#endif
20 20
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 13c54d5b3b48..d6466aa09fb7 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -33,7 +33,7 @@ extern void (*cpu_wait)(void);
33 33
34extern unsigned int vced_count, vcei_count; 34extern unsigned int vced_count, vcei_count;
35 35
36#ifdef CONFIG_MIPS32 36#ifdef CONFIG_32BIT
37/* 37/*
38 * User space process size: 2GB. This is hardcoded into a few places, 38 * User space process size: 2GB. This is hardcoded into a few places,
39 * so don't change it unless you know what you are doing. 39 * so don't change it unless you know what you are doing.
@@ -47,7 +47,7 @@ extern unsigned int vced_count, vcei_count;
47#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) 47#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
48#endif 48#endif
49 49
50#ifdef CONFIG_MIPS64 50#ifdef CONFIG_64BIT
51/* 51/*
52 * User space process size: 1TB. This is hardcoded into a few places, 52 * User space process size: 1TB. This is hardcoded into a few places,
53 * so don't change it unless you know what you are doing. TASK_SIZE 53 * so don't change it unless you know what you are doing. TASK_SIZE
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index d3c46d633826..2b5c624c3d4f 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -28,7 +28,7 @@
28 * system call/exception. As usual the registers k0/k1 aren't being saved. 28 * system call/exception. As usual the registers k0/k1 aren't being saved.
29 */ 29 */
30struct pt_regs { 30struct pt_regs {
31#ifdef CONFIG_MIPS32 31#ifdef CONFIG_32BIT
32 /* Pad bytes for argument save space on the stack. */ 32 /* Pad bytes for argument save space on the stack. */
33 unsigned long pad0[6]; 33 unsigned long pad0[6];
34#endif 34#endif
diff --git a/include/asm-mips/qemu.h b/include/asm-mips/qemu.h
new file mode 100644
index 000000000000..905c39585903
--- /dev/null
+++ b/include/asm-mips/qemu.h
@@ -0,0 +1,24 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_QEMU_H
9#define __ASM_QEMU_H
10
11/*
12 * Interrupt numbers
13 */
14#define Q_PIC_IRQ_BASE 0
15#define Q_COUNT_COMPARE_IRQ 16
16
17/*
18 * Qemu clock rate. Unlike on real MIPS this has no relation to the
19 * instruction issue rate, so the choosen value is pure fiction, just needs
20 * to match the value in Qemu itself.
21 */
22#define QEMU_C0_COUNTER_CLOCK 100000000
23
24#endif /* __ASM_QEMU_H */
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index da03a32c1ca7..5bea49feec66 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -171,11 +171,11 @@ static inline void blast_dcache16(void)
171 unsigned long start = INDEX_BASE; 171 unsigned long start = INDEX_BASE;
172 unsigned long end = start + current_cpu_data.dcache.waysize; 172 unsigned long end = start + current_cpu_data.dcache.waysize;
173 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit; 173 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
174 unsigned long ws_end = current_cpu_data.dcache.ways << 174 unsigned long ws_end = current_cpu_data.dcache.ways <<
175 current_cpu_data.dcache.waybit; 175 current_cpu_data.dcache.waybit;
176 unsigned long ws, addr; 176 unsigned long ws, addr;
177 177
178 for (ws = 0; ws < ws_end; ws += ws_inc) 178 for (ws = 0; ws < ws_end; ws += ws_inc)
179 for (addr = start; addr < end; addr += 0x200) 179 for (addr = start; addr < end; addr += 0x200)
180 cache16_unroll32(addr|ws,Index_Writeback_Inv_D); 180 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
181} 181}
@@ -200,8 +200,8 @@ static inline void blast_dcache16_page_indexed(unsigned long page)
200 current_cpu_data.dcache.waybit; 200 current_cpu_data.dcache.waybit;
201 unsigned long ws, addr; 201 unsigned long ws, addr;
202 202
203 for (ws = 0; ws < ws_end; ws += ws_inc) 203 for (ws = 0; ws < ws_end; ws += ws_inc)
204 for (addr = start; addr < end; addr += 0x200) 204 for (addr = start; addr < end; addr += 0x200)
205 cache16_unroll32(addr|ws,Index_Writeback_Inv_D); 205 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
206} 206}
207 207
@@ -214,8 +214,8 @@ static inline void blast_icache16(void)
214 current_cpu_data.icache.waybit; 214 current_cpu_data.icache.waybit;
215 unsigned long ws, addr; 215 unsigned long ws, addr;
216 216
217 for (ws = 0; ws < ws_end; ws += ws_inc) 217 for (ws = 0; ws < ws_end; ws += ws_inc)
218 for (addr = start; addr < end; addr += 0x200) 218 for (addr = start; addr < end; addr += 0x200)
219 cache16_unroll32(addr|ws,Index_Invalidate_I); 219 cache16_unroll32(addr|ws,Index_Invalidate_I);
220} 220}
221 221
@@ -239,8 +239,8 @@ static inline void blast_icache16_page_indexed(unsigned long page)
239 current_cpu_data.icache.waybit; 239 current_cpu_data.icache.waybit;
240 unsigned long ws, addr; 240 unsigned long ws, addr;
241 241
242 for (ws = 0; ws < ws_end; ws += ws_inc) 242 for (ws = 0; ws < ws_end; ws += ws_inc)
243 for (addr = start; addr < end; addr += 0x200) 243 for (addr = start; addr < end; addr += 0x200)
244 cache16_unroll32(addr|ws,Index_Invalidate_I); 244 cache16_unroll32(addr|ws,Index_Invalidate_I);
245} 245}
246 246
@@ -249,11 +249,11 @@ static inline void blast_scache16(void)
249 unsigned long start = INDEX_BASE; 249 unsigned long start = INDEX_BASE;
250 unsigned long end = start + current_cpu_data.scache.waysize; 250 unsigned long end = start + current_cpu_data.scache.waysize;
251 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; 251 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
252 unsigned long ws_end = current_cpu_data.scache.ways << 252 unsigned long ws_end = current_cpu_data.scache.ways <<
253 current_cpu_data.scache.waybit; 253 current_cpu_data.scache.waybit;
254 unsigned long ws, addr; 254 unsigned long ws, addr;
255 255
256 for (ws = 0; ws < ws_end; ws += ws_inc) 256 for (ws = 0; ws < ws_end; ws += ws_inc)
257 for (addr = start; addr < end; addr += 0x200) 257 for (addr = start; addr < end; addr += 0x200)
258 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD); 258 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD);
259} 259}
@@ -278,8 +278,8 @@ static inline void blast_scache16_page_indexed(unsigned long page)
278 current_cpu_data.scache.waybit; 278 current_cpu_data.scache.waybit;
279 unsigned long ws, addr; 279 unsigned long ws, addr;
280 280
281 for (ws = 0; ws < ws_end; ws += ws_inc) 281 for (ws = 0; ws < ws_end; ws += ws_inc)
282 for (addr = start; addr < end; addr += 0x200) 282 for (addr = start; addr < end; addr += 0x200)
283 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD); 283 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD);
284} 284}
285 285
@@ -318,8 +318,8 @@ static inline void blast_dcache32(void)
318 current_cpu_data.dcache.waybit; 318 current_cpu_data.dcache.waybit;
319 unsigned long ws, addr; 319 unsigned long ws, addr;
320 320
321 for (ws = 0; ws < ws_end; ws += ws_inc) 321 for (ws = 0; ws < ws_end; ws += ws_inc)
322 for (addr = start; addr < end; addr += 0x400) 322 for (addr = start; addr < end; addr += 0x400)
323 cache32_unroll32(addr|ws,Index_Writeback_Inv_D); 323 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
324} 324}
325 325
@@ -343,8 +343,8 @@ static inline void blast_dcache32_page_indexed(unsigned long page)
343 current_cpu_data.dcache.waybit; 343 current_cpu_data.dcache.waybit;
344 unsigned long ws, addr; 344 unsigned long ws, addr;
345 345
346 for (ws = 0; ws < ws_end; ws += ws_inc) 346 for (ws = 0; ws < ws_end; ws += ws_inc)
347 for (addr = start; addr < end; addr += 0x400) 347 for (addr = start; addr < end; addr += 0x400)
348 cache32_unroll32(addr|ws,Index_Writeback_Inv_D); 348 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
349} 349}
350 350
@@ -357,8 +357,8 @@ static inline void blast_icache32(void)
357 current_cpu_data.icache.waybit; 357 current_cpu_data.icache.waybit;
358 unsigned long ws, addr; 358 unsigned long ws, addr;
359 359
360 for (ws = 0; ws < ws_end; ws += ws_inc) 360 for (ws = 0; ws < ws_end; ws += ws_inc)
361 for (addr = start; addr < end; addr += 0x400) 361 for (addr = start; addr < end; addr += 0x400)
362 cache32_unroll32(addr|ws,Index_Invalidate_I); 362 cache32_unroll32(addr|ws,Index_Invalidate_I);
363} 363}
364 364
@@ -383,7 +383,7 @@ static inline void blast_icache32_page_indexed(unsigned long page)
383 unsigned long ws, addr; 383 unsigned long ws, addr;
384 384
385 for (ws = 0; ws < ws_end; ws += ws_inc) 385 for (ws = 0; ws < ws_end; ws += ws_inc)
386 for (addr = start; addr < end; addr += 0x400) 386 for (addr = start; addr < end; addr += 0x400)
387 cache32_unroll32(addr|ws,Index_Invalidate_I); 387 cache32_unroll32(addr|ws,Index_Invalidate_I);
388} 388}
389 389
@@ -392,11 +392,11 @@ static inline void blast_scache32(void)
392 unsigned long start = INDEX_BASE; 392 unsigned long start = INDEX_BASE;
393 unsigned long end = start + current_cpu_data.scache.waysize; 393 unsigned long end = start + current_cpu_data.scache.waysize;
394 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; 394 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
395 unsigned long ws_end = current_cpu_data.scache.ways << 395 unsigned long ws_end = current_cpu_data.scache.ways <<
396 current_cpu_data.scache.waybit; 396 current_cpu_data.scache.waybit;
397 unsigned long ws, addr; 397 unsigned long ws, addr;
398 398
399 for (ws = 0; ws < ws_end; ws += ws_inc) 399 for (ws = 0; ws < ws_end; ws += ws_inc)
400 for (addr = start; addr < end; addr += 0x400) 400 for (addr = start; addr < end; addr += 0x400)
401 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD); 401 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD);
402} 402}
@@ -421,8 +421,8 @@ static inline void blast_scache32_page_indexed(unsigned long page)
421 current_cpu_data.scache.waybit; 421 current_cpu_data.scache.waybit;
422 unsigned long ws, addr; 422 unsigned long ws, addr;
423 423
424 for (ws = 0; ws < ws_end; ws += ws_inc) 424 for (ws = 0; ws < ws_end; ws += ws_inc)
425 for (addr = start; addr < end; addr += 0x400) 425 for (addr = start; addr < end; addr += 0x400)
426 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD); 426 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD);
427} 427}
428 428
@@ -461,8 +461,8 @@ static inline void blast_icache64(void)
461 current_cpu_data.icache.waybit; 461 current_cpu_data.icache.waybit;
462 unsigned long ws, addr; 462 unsigned long ws, addr;
463 463
464 for (ws = 0; ws < ws_end; ws += ws_inc) 464 for (ws = 0; ws < ws_end; ws += ws_inc)
465 for (addr = start; addr < end; addr += 0x800) 465 for (addr = start; addr < end; addr += 0x800)
466 cache64_unroll32(addr|ws,Index_Invalidate_I); 466 cache64_unroll32(addr|ws,Index_Invalidate_I);
467} 467}
468 468
@@ -487,7 +487,7 @@ static inline void blast_icache64_page_indexed(unsigned long page)
487 unsigned long ws, addr; 487 unsigned long ws, addr;
488 488
489 for (ws = 0; ws < ws_end; ws += ws_inc) 489 for (ws = 0; ws < ws_end; ws += ws_inc)
490 for (addr = start; addr < end; addr += 0x800) 490 for (addr = start; addr < end; addr += 0x800)
491 cache64_unroll32(addr|ws,Index_Invalidate_I); 491 cache64_unroll32(addr|ws,Index_Invalidate_I);
492} 492}
493 493
@@ -496,11 +496,11 @@ static inline void blast_scache64(void)
496 unsigned long start = INDEX_BASE; 496 unsigned long start = INDEX_BASE;
497 unsigned long end = start + current_cpu_data.scache.waysize; 497 unsigned long end = start + current_cpu_data.scache.waysize;
498 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; 498 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
499 unsigned long ws_end = current_cpu_data.scache.ways << 499 unsigned long ws_end = current_cpu_data.scache.ways <<
500 current_cpu_data.scache.waybit; 500 current_cpu_data.scache.waybit;
501 unsigned long ws, addr; 501 unsigned long ws, addr;
502 502
503 for (ws = 0; ws < ws_end; ws += ws_inc) 503 for (ws = 0; ws < ws_end; ws += ws_inc)
504 for (addr = start; addr < end; addr += 0x800) 504 for (addr = start; addr < end; addr += 0x800)
505 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD); 505 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD);
506} 506}
@@ -525,8 +525,8 @@ static inline void blast_scache64_page_indexed(unsigned long page)
525 current_cpu_data.scache.waybit; 525 current_cpu_data.scache.waybit;
526 unsigned long ws, addr; 526 unsigned long ws, addr;
527 527
528 for (ws = 0; ws < ws_end; ws += ws_inc) 528 for (ws = 0; ws < ws_end; ws += ws_inc)
529 for (addr = start; addr < end; addr += 0x800) 529 for (addr = start; addr < end; addr += 0x800)
530 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD); 530 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD);
531} 531}
532 532
@@ -561,11 +561,11 @@ static inline void blast_scache128(void)
561 unsigned long start = INDEX_BASE; 561 unsigned long start = INDEX_BASE;
562 unsigned long end = start + current_cpu_data.scache.waysize; 562 unsigned long end = start + current_cpu_data.scache.waysize;
563 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; 563 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
564 unsigned long ws_end = current_cpu_data.scache.ways << 564 unsigned long ws_end = current_cpu_data.scache.ways <<
565 current_cpu_data.scache.waybit; 565 current_cpu_data.scache.waybit;
566 unsigned long ws, addr; 566 unsigned long ws, addr;
567 567
568 for (ws = 0; ws < ws_end; ws += ws_inc) 568 for (ws = 0; ws < ws_end; ws += ws_inc)
569 for (addr = start; addr < end; addr += 0x1000) 569 for (addr = start; addr < end; addr += 0x1000)
570 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); 570 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD);
571} 571}
@@ -590,8 +590,8 @@ static inline void blast_scache128_page_indexed(unsigned long page)
590 current_cpu_data.scache.waybit; 590 current_cpu_data.scache.waybit;
591 unsigned long ws, addr; 591 unsigned long ws, addr;
592 592
593 for (ws = 0; ws < ws_end; ws += ws_inc) 593 for (ws = 0; ws < ws_end; ws += ws_inc)
594 for (addr = start; addr < end; addr += 0x1000) 594 for (addr = start; addr < end; addr += 0x1000)
595 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); 595 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD);
596} 596}
597 597
diff --git a/include/asm-mips/reg.h b/include/asm-mips/reg.h
index 7b33bbca9585..6173004cc88e 100644
--- a/include/asm-mips/reg.h
+++ b/include/asm-mips/reg.h
@@ -14,7 +14,7 @@
14 14
15#include <linux/config.h> 15#include <linux/config.h>
16 16
17#if defined(CONFIG_MIPS32) || defined(WANT_COMPAT_REG_H) 17#if defined(CONFIG_32BIT) || defined(WANT_COMPAT_REG_H)
18 18
19#define EF_R0 6 19#define EF_R0 6
20#define EF_R1 7 20#define EF_R1 7
@@ -70,7 +70,7 @@
70 70
71#endif 71#endif
72 72
73#if CONFIG_MIPS64 73#ifdef CONFIG_64BIT
74 74
75#define EF_R0 0 75#define EF_R0 0
76#define EF_R1 1 76#define EF_R1 1
@@ -124,6 +124,6 @@
124 124
125#define EF_SIZE 304 /* size in bytes */ 125#define EF_SIZE 304 /* size in bytes */
126 126
127#endif /* CONFIG_MIPS64 */ 127#endif /* CONFIG_64BIT */
128 128
129#endif /* __ASM_MIPS_REG_H */ 129#endif /* __ASM_MIPS_REG_H */
diff --git a/include/asm-mips/resource.h b/include/asm-mips/resource.h
index fd3c6d17a5f6..1fba00c22077 100644
--- a/include/asm-mips/resource.h
+++ b/include/asm-mips/resource.h
@@ -27,7 +27,7 @@
27 * but we keep the old value on MIPS32, 27 * but we keep the old value on MIPS32,
28 * for compatibility: 28 * for compatibility:
29 */ 29 */
30#ifdef CONFIG_MIPS32 30#ifdef CONFIG_32BIT
31# define RLIM_INFINITY 0x7fffffffUL 31# define RLIM_INFINITY 0x7fffffffUL
32#endif 32#endif
33 33
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
index 31c0c2347f4f..3c4b637fd925 100644
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-mips/rtc.h 2 * include/asm-mips/rtc.h
3 * 3 *
4 * (Really an interface for drivers/char/genrtc.c) 4 * (Really an interface for drivers/char/genrtc.c)
5 * 5 *
diff --git a/include/asm-mips/sgi/gio.h b/include/asm-mips/sgi/gio.h
index a38d66f99872..889cf028c95d 100644
--- a/include/asm-mips/sgi/gio.h
+++ b/include/asm-mips/sgi/gio.h
@@ -16,7 +16,7 @@
16 * 16 *
17 * The Indigo and Indy have two GIO bus connectors. Indigo2 (all models) have 17 * The Indigo and Indy have two GIO bus connectors. Indigo2 (all models) have
18 * three physical connectors, but only two slots, GFX and EXP0. 18 * three physical connectors, but only two slots, GFX and EXP0.
19 * 19 *
20 * There is 10MB of GIO address space for GIO64 slot devices 20 * There is 10MB of GIO address space for GIO64 slot devices
21 * slot# slot type address range size 21 * slot# slot type address range size
22 * ----- --------- ----------------------- ----- 22 * ----- --------- ----------------------- -----
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
index a5b988d7327a..ac3dfc7af5b0 100644
--- a/include/asm-mips/sgi/hpc3.h
+++ b/include/asm-mips/sgi/hpc3.h
@@ -221,7 +221,7 @@ struct hpc3_regs {
221#define HPC3_BESTAT_PIDMASK 0x3f700 /* DMA channel parity identifier */ 221#define HPC3_BESTAT_PIDMASK 0x3f700 /* DMA channel parity identifier */
222 222
223 u32 _unused1[0x14000/4 - 5]; /* padding */ 223 u32 _unused1[0x14000/4 - 5]; /* padding */
224 224
225 /* Now direct PIO per-HPC3 peripheral access to external regs. */ 225 /* Now direct PIO per-HPC3 peripheral access to external regs. */
226 volatile u32 scsi0_ext[256]; /* SCSI channel 0 external regs */ 226 volatile u32 scsi0_ext[256]; /* SCSI channel 0 external regs */
227 u32 _unused2[0x7c00/4]; 227 u32 _unused2[0x7c00/4];
@@ -304,7 +304,7 @@ struct hpc3_regs {
304 volatile u32 bbram[8192-50-14]; /* Battery backed ram */ 304 volatile u32 bbram[8192-50-14]; /* Battery backed ram */
305}; 305};
306 306
307/* 307/*
308 * It is possible to have two HPC3's within the address space on 308 * It is possible to have two HPC3's within the address space on
309 * one machine, though only having one is more likely on an Indy. 309 * one machine, though only having one is more likely on an Indy.
310 */ 310 */
diff --git a/include/asm-mips/sgi/ioc.h b/include/asm-mips/sgi/ioc.h
index 169187f53fbc..f3e3dc9bb732 100644
--- a/include/asm-mips/sgi/ioc.h
+++ b/include/asm-mips/sgi/ioc.h
@@ -16,7 +16,7 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <asm/sgi/pi1.h> 17#include <asm/sgi/pi1.h>
18 18
19/* 19/*
20 * All registers are 8-bit wide alligned on 32-bit boundary. Bad things 20 * All registers are 8-bit wide alligned on 32-bit boundary. Bad things
21 * happen if you try word access them. You have been warned. 21 * happen if you try word access them. You have been warned.
22 */ 22 */
@@ -138,7 +138,7 @@ struct sgioc_regs {
138 u8 _sysid[3]; 138 u8 _sysid[3];
139 volatile u8 sysid; 139 volatile u8 sysid;
140#define SGIOC_SYSID_FULLHOUSE 0x01 140#define SGIOC_SYSID_FULLHOUSE 0x01
141#define SGIOC_SYSID_BOARDREV(x) ((x & 0xe0) > 5) 141#define SGIOC_SYSID_BOARDREV(x) ((x & 0xe0) > 5)
142#define SGIOC_SYSID_CHIPREV(x) ((x & 0x1e) > 1) 142#define SGIOC_SYSID_CHIPREV(x) ((x & 0x1e) > 1)
143 u32 _unused2; 143 u32 _unused2;
144 u8 _read[3]; 144 u8 _read[3];
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
index 97d73adb4e40..bbfc05c3cab9 100644
--- a/include/asm-mips/sgi/ip22.h
+++ b/include/asm-mips/sgi/ip22.h
@@ -12,7 +12,7 @@
12#ifndef _SGI_IP22_H 12#ifndef _SGI_IP22_H
13#define _SGI_IP22_H 13#define _SGI_IP22_H
14 14
15/* 15/*
16 * These are the virtual IRQ numbers, we divide all IRQ's into 16 * These are the virtual IRQ numbers, we divide all IRQ's into
17 * 'spaces', the 'space' determines where and how to enable/disable 17 * 'spaces', the 'space' determines where and how to enable/disable
18 * that particular IRQ on an SGI machine. HPC DMA and MC DMA interrups 18 * that particular IRQ on an SGI machine. HPC DMA and MC DMA interrups
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h
index fd98f930607c..c52f7834c7c8 100644
--- a/include/asm-mips/sgi/mc.h
+++ b/include/asm-mips/sgi/mc.h
@@ -182,14 +182,14 @@ struct sgimc_regs {
182 volatile u32 dtlb_hi3; 182 volatile u32 dtlb_hi3;
183 u32 _unused33; 183 u32 _unused33;
184 volatile u32 dtlb_lo3; 184 volatile u32 dtlb_lo3;
185 185
186 u32 _unused34[0x0392]; 186 u32 _unused34[0x0392];
187 187
188 u32 _unused35; 188 u32 _unused35;
189 volatile u32 rpsscounter; /* Chirps at 100ns */ 189 volatile u32 rpsscounter; /* Chirps at 100ns */
190 190
191 u32 _unused36[0x1000/4-2*4]; 191 u32 _unused36[0x1000/4-2*4];
192 192
193 u32 _unused37; 193 u32 _unused37;
194 volatile u32 maddronly; /* Address DMA goes at */ 194 volatile u32 maddronly; /* Address DMA goes at */
195 u32 _unused38; 195 u32 _unused38;
diff --git a/include/asm-mips/sgiarcs.h b/include/asm-mips/sgiarcs.h
index 59450335f049..722b77a8c5e5 100644
--- a/include/asm-mips/sgiarcs.h
+++ b/include/asm-mips/sgiarcs.h
@@ -367,7 +367,7 @@ struct linux_smonblock {
367 * Macros for calling a 32-bit ARC implementation from 64-bit code 367 * Macros for calling a 32-bit ARC implementation from 64-bit code
368 */ 368 */
369 369
370#if defined(CONFIG_MIPS64) && defined(CONFIG_ARC32) 370#if defined(CONFIG_64BIT) && defined(CONFIG_ARC32)
371 371
372#define __arc_clobbers \ 372#define __arc_clobbers \
373 "$2","$3" /* ... */, "$8","$9","$10","$11", \ 373 "$2","$3" /* ... */, "$8","$9","$10","$11", \
@@ -476,10 +476,10 @@ struct linux_smonblock {
476 __res; \ 476 __res; \
477}) 477})
478 478
479#endif /* defined(CONFIG_MIPS64) && defined(CONFIG_ARC32) */ 479#endif /* defined(CONFIG_64BIT) && defined(CONFIG_ARC32) */
480 480
481#if (defined(CONFIG_MIPS32) && defined(CONFIG_ARC32)) || \ 481#if (defined(CONFIG_32BIT) && defined(CONFIG_ARC32)) || \
482 (defined(CONFIG_MIPS64) && defined(CONFIG_ARC64)) 482 (defined(CONFIG_64BIT) && defined(CONFIG_ARC64))
483 483
484#define ARC_CALL0(dest) \ 484#define ARC_CALL0(dest) \
485({ long __res; \ 485({ long __res; \
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h
index 7ac5da13ce8a..b5e7dae19f0f 100644
--- a/include/asm-mips/sibyte/carmel.h
+++ b/include/asm-mips/sibyte/carmel.h
@@ -25,12 +25,12 @@
25 25
26#define SIBYTE_BOARD_NAME "Carmel" 26#define SIBYTE_BOARD_NAME "Carmel"
27 27
28#define GPIO_PHY_INTERRUPT 2 28#define GPIO_PHY_INTERRUPT 2
29#define GPIO_NONMASKABLE_INT 3 29#define GPIO_NONMASKABLE_INT 3
30#define GPIO_CF_INSERTED 6 30#define GPIO_CF_INSERTED 6
31#define GPIO_MONTEREY_RESET 7 31#define GPIO_MONTEREY_RESET 7
32#define GPIO_QUADUART_INT 8 32#define GPIO_QUADUART_INT 8
33#define GPIO_CF_INT 9 33#define GPIO_CF_INT 9
34#define GPIO_FPGA_CCLK 10 34#define GPIO_FPGA_CCLK 10
35#define GPIO_FPGA_DOUT 11 35#define GPIO_FPGA_DOUT 11
36#define GPIO_FPGA_DIN 12 36#define GPIO_FPGA_DIN 12
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h
index 96088fb074a4..40ef97c76c8b 100644
--- a/include/asm-mips/sibyte/sb1250_defs.h
+++ b/include/asm-mips/sibyte/sb1250_defs.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * Global constants and macros File: sb1250_defs.h 4 * Global constants and macros File: sb1250_defs.h
5 * 5 *
6 * This file contains macros and definitions used by the other 6 * This file contains macros and definitions used by the other
7 * include files. 7 * include files.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -105,7 +105,7 @@
105#define SIBYTE_HDR_FMASK_112x_ALL 0x0000f00 105#define SIBYTE_HDR_FMASK_112x_ALL 0x0000f00
106#define SIBYTE_HDR_FMASK_112x_PASS1 0x0000100 106#define SIBYTE_HDR_FMASK_112x_PASS1 0x0000100
107 107
108/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */ 108/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */
109#define SIBYTE_HDR_FMASK(chip, pass) \ 109#define SIBYTE_HDR_FMASK(chip, pass) \
110 (SIBYTE_HDR_FMASK_ ## chip ## _ ## pass) 110 (SIBYTE_HDR_FMASK_ ## chip ## _ ## pass)
111#define SIBYTE_HDR_FMASK_ALLREVS(chip) \ 111#define SIBYTE_HDR_FMASK_ALLREVS(chip) \
@@ -150,31 +150,31 @@
150 150
151/* ********************************************************************* 151/* *********************************************************************
152 * Naming schemes for constants in these files: 152 * Naming schemes for constants in these files:
153 * 153 *
154 * M_xxx MASK constant (identifies bits in a register). 154 * M_xxx MASK constant (identifies bits in a register).
155 * For multi-bit fields, all bits in the field will 155 * For multi-bit fields, all bits in the field will
156 * be set. 156 * be set.
157 * 157 *
158 * K_xxx "Code" constant (value for data in a multi-bit 158 * K_xxx "Code" constant (value for data in a multi-bit
159 * field). The value is right justified. 159 * field). The value is right justified.
160 * 160 *
161 * V_xxx "Value" constant. This is the same as the 161 * V_xxx "Value" constant. This is the same as the
162 * corresponding "K_xxx" constant, except it is 162 * corresponding "K_xxx" constant, except it is
163 * shifted to the correct position in the register. 163 * shifted to the correct position in the register.
164 * 164 *
165 * S_xxx SHIFT constant. This is the number of bits that 165 * S_xxx SHIFT constant. This is the number of bits that
166 * a field value (code) needs to be shifted 166 * a field value (code) needs to be shifted
167 * (towards the left) to put the value in the right 167 * (towards the left) to put the value in the right
168 * position for the register. 168 * position for the register.
169 * 169 *
170 * A_xxx ADDRESS constant. This will be a physical 170 * A_xxx ADDRESS constant. This will be a physical
171 * address. Use the PHYS_TO_K1 macro to generate 171 * address. Use the PHYS_TO_K1 macro to generate
172 * a K1SEG address. 172 * a K1SEG address.
173 * 173 *
174 * R_xxx RELATIVE offset constant. This is an offset from 174 * R_xxx RELATIVE offset constant. This is an offset from
175 * an A_xxx constant (usually the first register in 175 * an A_xxx constant (usually the first register in
176 * a group). 176 * a group).
177 * 177 *
178 * G_xxx(X) GET value. This macro obtains a multi-bit field 178 * G_xxx(X) GET value. This macro obtains a multi-bit field
179 * from a register, masks it, and shifts it to 179 * from a register, masks it, and shifts it to
180 * the bottom of the register (retrieving a K_xxx 180 * the bottom of the register (retrieving a K_xxx
@@ -189,7 +189,7 @@
189 189
190 190
191/* 191/*
192 * Cast to 64-bit number. Presumably the syntax is different in 192 * Cast to 64-bit number. Presumably the syntax is different in
193 * assembly language. 193 * assembly language.
194 * 194 *
195 * Note: you'll need to define uint32_t and uint64_t in your headers. 195 * Note: you'll need to define uint32_t and uint64_t in your headers.
diff --git a/include/asm-mips/sibyte/sb1250_dma.h b/include/asm-mips/sibyte/sb1250_dma.h
index f1b08d32338d..3cdb48f50ed0 100644
--- a/include/asm-mips/sibyte/sb1250_dma.h
+++ b/include/asm-mips/sibyte/sb1250_dma.h
@@ -1,24 +1,24 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * DMA definitions File: sb1250_dma.h 4 * DMA definitions File: sb1250_dma.h
5 * 5 *
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * programming the SB1250's DMA controllers, both the data mover 7 * programming the SB1250's DMA controllers, both the data mover
8 * and the Ethernet DMA. 8 * and the Ethernet DMA.
9 * 9 *
10 * SB1250 specification level: User's manual 1/02/02 10 * SB1250 specification level: User's manual 1/02/02
11 * 11 *
12 * Author: Mitch Lichtenberg 12 * Author: Mitch Lichtenberg
13 * 13 *
14 ********************************************************************* 14 *********************************************************************
15 * 15 *
16 * Copyright 2000,2001,2002,2003 16 * Copyright 2000,2001,2002,2003
17 * Broadcom Corporation. All rights reserved. 17 * Broadcom Corporation. All rights reserved.
18 * 18 *
19 * This program is free software; you can redistribute it and/or 19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License as 20 * modify it under the terms of the GNU General Public License as
21 * published by the Free Software Foundation; either version 2 of 21 * published by the Free Software Foundation; either version 2 of
22 * the License, or (at your option) any later version. 22 * the License, or (at your option) any later version.
23 * 23 *
24 * This program is distributed in the hope that it will be useful, 24 * This program is distributed in the hope that it will be useful,
@@ -28,7 +28,7 @@
28 * 28 *
29 * You should have received a copy of the GNU General Public License 29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software 30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA 32 * MA 02111-1307 USA
33 ********************************************************************* */ 33 ********************************************************************* */
34 34
@@ -43,9 +43,9 @@
43 * DMA Registers 43 * DMA Registers
44 ********************************************************************* */ 44 ********************************************************************* */
45 45
46/* 46/*
47 * Ethernet and Serial DMA Configuration Register 0 (Table 7-4) 47 * Ethernet and Serial DMA Configuration Register 0 (Table 7-4)
48 * Registers: DMA_CONFIG0_MAC_x_RX_CH_0 48 * Registers: DMA_CONFIG0_MAC_x_RX_CH_0
49 * Registers: DMA_CONFIG0_MAC_x_TX_CH_0 49 * Registers: DMA_CONFIG0_MAC_x_TX_CH_0
50 * Registers: DMA_CONFIG0_SER_x_RX 50 * Registers: DMA_CONFIG0_SER_x_RX
51 * Registers: DMA_CONFIG0_SER_x_TX 51 * Registers: DMA_CONFIG0_SER_x_TX
@@ -98,7 +98,7 @@
98 98
99/* 99/*
100 * Ethernet and Serial DMA Configuration Register 1 (Table 7-5) 100 * Ethernet and Serial DMA Configuration Register 1 (Table 7-5)
101 * Registers: DMA_CONFIG1_MAC_x_RX_CH_0 101 * Registers: DMA_CONFIG1_MAC_x_RX_CH_0
102 * Registers: DMA_CONFIG1_DMA_x_TX_CH_0 102 * Registers: DMA_CONFIG1_DMA_x_TX_CH_0
103 * Registers: DMA_CONFIG1_SER_x_RX 103 * Registers: DMA_CONFIG1_SER_x_RX
104 * Registers: DMA_CONFIG1_SER_x_TX 104 * Registers: DMA_CONFIG1_SER_x_TX
@@ -152,11 +152,11 @@
152/* 152/*
153 * DMA Descriptor Count Registers (Table 7-8) 153 * DMA Descriptor Count Registers (Table 7-8)
154 */ 154 */
155 155
156/* No bitfields */ 156/* No bitfields */
157 157
158 158
159/* 159/*
160 * Current Descriptor Address Register (Table 7-11) 160 * Current Descriptor Address Register (Table 7-11)
161 */ 161 */
162 162
@@ -275,14 +275,14 @@
275#define V_DMA_DSCRB_STATUS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_STATUS) 275#define V_DMA_DSCRB_STATUS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_STATUS)
276#define G_DMA_DSCRB_STATUS(x) _SB_GETVALUE(x,S_DMA_DSCRB_STATUS,M_DMA_DSCRB_STATUS) 276#define G_DMA_DSCRB_STATUS(x) _SB_GETVALUE(x,S_DMA_DSCRB_STATUS,M_DMA_DSCRB_STATUS)
277 277
278/* 278/*
279 * Ethernet Descriptor Status Bits (Table 7-15) 279 * Ethernet Descriptor Status Bits (Table 7-15)
280 */ 280 */
281 281
282#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51) 282#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51)
283#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52) 283#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52)
284 284
285#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 285#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
286/* Note: BADTCPCS is actually in DSCR_B options field */ 286/* Note: BADTCPCS is actually in DSCR_B options field */
287#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0) 287#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0)
288#endif /* 1250 PASS2 || 112x PASS1 */ 288#endif /* 1250 PASS2 || 112x PASS1 */
@@ -324,7 +324,7 @@
324 324
325#define M_DMA_ETHTX_SOP _SB_MAKEMASK1(63) 325#define M_DMA_ETHTX_SOP _SB_MAKEMASK1(63)
326 326
327/* 327/*
328 * Ethernet Transmit Options (Table 7-17) 328 * Ethernet Transmit Options (Table 7-17)
329 */ 329 */
330 330
@@ -377,7 +377,7 @@
377 * Data Mover Registers 377 * Data Mover Registers
378 ********************************************************************* */ 378 ********************************************************************* */
379 379
380/* 380/*
381 * Data Mover Descriptor Base Address Register (Table 7-22) 381 * Data Mover Descriptor Base Address Register (Table 7-22)
382 * Register: DM_DSCR_BASE_0 382 * Register: DM_DSCR_BASE_0
383 * Register: DM_DSCR_BASE_1 383 * Register: DM_DSCR_BASE_1
@@ -414,7 +414,7 @@
414#define M_DM_DSCR_BASE_ABORT _SB_MAKEMASK1(62) 414#define M_DM_DSCR_BASE_ABORT _SB_MAKEMASK1(62)
415#define M_DM_DSCR_BASE_ENABL _SB_MAKEMASK1(63) 415#define M_DM_DSCR_BASE_ENABL _SB_MAKEMASK1(63)
416 416
417/* 417/*
418 * Data Mover Descriptor Count Register (Table 7-25) 418 * Data Mover Descriptor Count Register (Table 7-25)
419 */ 419 */
420 420
diff --git a/include/asm-mips/sibyte/sb1250_genbus.h b/include/asm-mips/sibyte/sb1250_genbus.h
index 0d9dfac3d7db..f1f509f295c4 100644
--- a/include/asm-mips/sibyte/sb1250_genbus.h
+++ b/include/asm-mips/sibyte/sb1250_genbus.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * Generic Bus Constants File: sb1250_genbus.h 4 * Generic Bus Constants File: sb1250_genbus.h
5 * 5 *
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * manipulating the SB1250's Generic Bus interface 7 * manipulating the SB1250's Generic Bus interface
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
index c3f74df211f4..e173e2ea4c98 100644
--- a/include/asm-mips/sibyte/sb1250_int.h
+++ b/include/asm-mips/sibyte/sb1250_int.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * Interrupt Mapper definitions File: sb1250_int.h 4 * Interrupt Mapper definitions File: sb1250_int.h
5 * 5 *
6 * This module contains constants for manipulating the SB1250's 6 * This module contains constants for manipulating the SB1250's
7 * interrupt mapper and definitions for the interrupt sources. 7 * interrupt mapper and definitions for the interrupt sources.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -43,7 +43,7 @@
43 43
44/* 44/*
45 * Interrupt sources (Table 4-8, UM 0.2) 45 * Interrupt sources (Table 4-8, UM 0.2)
46 * 46 *
47 * First, the interrupt numbers. 47 * First, the interrupt numbers.
48 */ 48 */
49 49
diff --git a/include/asm-mips/sibyte/sb1250_l2c.h b/include/asm-mips/sibyte/sb1250_l2c.h
index 799db828d963..8afe8e01581b 100644
--- a/include/asm-mips/sibyte/sb1250_l2c.h
+++ b/include/asm-mips/sibyte/sb1250_l2c.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * L2 Cache constants and macros File: sb1250_l2c.h 4 * L2 Cache constants and macros File: sb1250_l2c.h
5 * 5 *
6 * This module contains constants useful for manipulating the 6 * This module contains constants useful for manipulating the
7 * level 2 cache. 7 * level 2 cache.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
diff --git a/include/asm-mips/sibyte/sb1250_ldt.h b/include/asm-mips/sibyte/sb1250_ldt.h
index d8753885df17..f2617ded0a8f 100644
--- a/include/asm-mips/sibyte/sb1250_ldt.h
+++ b/include/asm-mips/sibyte/sb1250_ldt.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * LDT constants File: sb1250_ldt.h 4 * LDT constants File: sb1250_ldt.h
5 * 5 *
6 * This module contains constants and macros to describe 6 * This module contains constants and macros to describe
7 * the LDT interface on the SB1250. 7 * the LDT interface on the SB1250.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -155,7 +155,7 @@
155 155
156/* 156/*
157 * LDT Status Register (Table 8-14). Note that these constants 157 * LDT Status Register (Table 8-14). Note that these constants
158 * assume you've read the command and status register 158 * assume you've read the command and status register
159 * together (32-bit read at offset 0x04) 159 * together (32-bit read at offset 0x04)
160 * 160 *
161 * These bits also apply to the secondary status 161 * These bits also apply to the secondary status
@@ -183,8 +183,8 @@
183#define M_LDT_STATUS_DETPARERR _SB_MAKEMASK1_32(31) 183#define M_LDT_STATUS_DETPARERR _SB_MAKEMASK1_32(31)
184 184
185/* 185/*
186 * Bridge Control Register (Table 8-16). Note that these 186 * Bridge Control Register (Table 8-16). Note that these
187 * constants assume you've read the register as a 32-bit 187 * constants assume you've read the register as a 32-bit
188 * read (offset 0x3C) 188 * read (offset 0x3C)
189 */ 189 */
190 190
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index 81f603f03a98..18e74e43f4a2 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * MAC constants and macros File: sb1250_mac.h 4 * MAC constants and macros File: sb1250_mac.h
5 * 5 *
6 * This module contains constants and macros for the SB1250's 6 * This module contains constants and macros for the SB1250's
7 * ethernet controllers. 7 * ethernet controllers.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -311,7 +311,7 @@
311 311
312/* 312/*
313 * These constants are used to configure the fields within the Frame 313 * These constants are used to configure the fields within the Frame
314 * Configuration Register. 314 * Configuration Register.
315 */ 315 */
316 316
317#define K_MAC_IFG_RX_10 _SB_MAKE64(0) /* See table 176, not used */ 317#define K_MAC_IFG_RX_10 _SB_MAKE64(0) /* See table 176, not used */
@@ -393,7 +393,7 @@
393 * Register: MAC_INT_MASK_2 393 * Register: MAC_INT_MASK_2
394 */ 394 */
395 395
396/* 396/*
397 * Use these constants to shift the appropriate channel 397 * Use these constants to shift the appropriate channel
398 * into the CH0 position so the same tests can be used 398 * into the CH0 position so the same tests can be used
399 * on each channel. 399 * on each channel.
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
index 93a48334b874..1dd41c927996 100644
--- a/include/asm-mips/sibyte/sb1250_mc.h
+++ b/include/asm-mips/sibyte/sb1250_mc.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * Memory Controller constants File: sb1250_mc.h 4 * Memory Controller constants File: sb1250_mc.h
5 * 5 *
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * programming the memory controller. 7 * programming the memory controller.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -166,7 +166,7 @@
166 166
167#define K_MC_REF_RATE_100MHz 0x62 167#define K_MC_REF_RATE_100MHz 0x62
168#define K_MC_REF_RATE_133MHz 0x81 168#define K_MC_REF_RATE_133MHz 0x81
169#define K_MC_REF_RATE_200MHz 0xC4 169#define K_MC_REF_RATE_200MHz 0xC4
170 170
171#define V_MC_REF_RATE_100MHz V_MC_REF_RATE(K_MC_REF_RATE_100MHz) 171#define V_MC_REF_RATE_100MHz V_MC_REF_RATE(K_MC_REF_RATE_100MHz)
172#define V_MC_REF_RATE_133MHz V_MC_REF_RATE(K_MC_REF_RATE_133MHz) 172#define V_MC_REF_RATE_133MHz V_MC_REF_RATE(K_MC_REF_RATE_133MHz)
@@ -228,7 +228,7 @@
228 V_MC_ADDR_DRIVE_DEFAULT | \ 228 V_MC_ADDR_DRIVE_DEFAULT | \
229 V_MC_DATA_DRIVE_DEFAULT | \ 229 V_MC_DATA_DRIVE_DEFAULT | \
230 V_MC_CLOCK_DRIVE_DEFAULT | \ 230 V_MC_CLOCK_DRIVE_DEFAULT | \
231 V_MC_REF_RATE_DEFAULT 231 V_MC_REF_RATE_DEFAULT
232 232
233 233
234 234
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index 5d496c6faba6..9db80cd13a79 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * Register Definitions File: sb1250_regs.h 4 * Register Definitions File: sb1250_regs.h
5 * 5 *
6 * This module contains the addresses of the on-chip peripherals 6 * This module contains the addresses of the on-chip peripherals
7 * on the SB1250. 7 * on the SB1250.
8 * 8 *
9 * SB1250 specification level: 01/02/2002 9 * SB1250 specification level: 01/02/2002
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -40,20 +40,20 @@
40 40
41/* ********************************************************************* 41/* *********************************************************************
42 * Some general notes: 42 * Some general notes:
43 * 43 *
44 * For the most part, when there is more than one peripheral 44 * For the most part, when there is more than one peripheral
45 * of the same type on the SOC, the constants below will be 45 * of the same type on the SOC, the constants below will be
46 * offsets from the base of each peripheral. For example, 46 * offsets from the base of each peripheral. For example,
47 * the MAC registers are described as offsets from the first 47 * the MAC registers are described as offsets from the first
48 * MAC register, and there will be a MAC_REGISTER() macro 48 * MAC register, and there will be a MAC_REGISTER() macro
49 * to calculate the base address of a given MAC. 49 * to calculate the base address of a given MAC.
50 * 50 *
51 * The information in this file is based on the SB1250 SOC 51 * The information in this file is based on the SB1250 SOC
52 * manual version 0.2, July 2000. 52 * manual version 0.2, July 2000.
53 ********************************************************************* */ 53 ********************************************************************* */
54 54
55 55
56/* ********************************************************************* 56/* *********************************************************************
57 * Memory Controller Registers 57 * Memory Controller Registers
58 ********************************************************************* */ 58 ********************************************************************* */
59 59
@@ -101,7 +101,7 @@
101#define R_MC_TEST_ECC 0x0000000420 101#define R_MC_TEST_ECC 0x0000000420
102#define R_MC_MCLK_CFG 0x0000000500 102#define R_MC_MCLK_CFG 0x0000000500
103 103
104/* ********************************************************************* 104/* *********************************************************************
105 * L2 Cache Control Registers 105 * L2 Cache Control Registers
106 ********************************************************************* */ 106 ********************************************************************* */
107 107
@@ -126,7 +126,7 @@
126#define A_L2_EEC_ADDRESS A_L2_ECC_TAG 126#define A_L2_EEC_ADDRESS A_L2_ECC_TAG
127 127
128 128
129/* ********************************************************************* 129/* *********************************************************************
130 * PCI Interface Registers 130 * PCI Interface Registers
131 ********************************************************************* */ 131 ********************************************************************* */
132 132
@@ -134,7 +134,7 @@
134#define A_PCI_TYPE01_HEADER 0x00DE000800 134#define A_PCI_TYPE01_HEADER 0x00DE000800
135 135
136 136
137/* ********************************************************************* 137/* *********************************************************************
138 * Ethernet DMA and MACs 138 * Ethernet DMA and MACs
139 ********************************************************************* */ 139 ********************************************************************* */
140 140
@@ -184,7 +184,7 @@
184 (R_MAC_DMA_CHANNEL_BASE(txrx,chan) + \ 184 (R_MAC_DMA_CHANNEL_BASE(txrx,chan) + \
185 (reg)) 185 (reg))
186 186
187/* 187/*
188 * DMA channel registers, relative to A_MAC_DMA_CHANNEL_BASE 188 * DMA channel registers, relative to A_MAC_DMA_CHANNEL_BASE
189 */ 189 */
190 190
@@ -259,7 +259,7 @@
259#define MAC_CHMAP_COUNT 4 259#define MAC_CHMAP_COUNT 4
260 260
261 261
262/* ********************************************************************* 262/* *********************************************************************
263 * DUART Registers 263 * DUART Registers
264 ********************************************************************* */ 264 ********************************************************************* */
265 265
@@ -363,7 +363,7 @@
363#endif /* 1250 PASS2 || 112x PASS1 */ 363#endif /* 1250 PASS2 || 112x PASS1 */
364 364
365 365
366/* ********************************************************************* 366/* *********************************************************************
367 * Synchronous Serial Registers 367 * Synchronous Serial Registers
368 ********************************************************************* */ 368 ********************************************************************* */
369 369
@@ -397,7 +397,7 @@
397 (reg)) 397 (reg))
398 398
399 399
400/* 400/*
401 * DMA channel registers, relative to A_SER_DMA_CHANNEL_BASE 401 * DMA channel registers, relative to A_SER_DMA_CHANNEL_BASE
402 */ 402 */
403 403
@@ -457,7 +457,7 @@
457#define R_SER_RMON_RX_ERRORS 0x000001F0 457#define R_SER_RMON_RX_ERRORS 0x000001F0
458#define R_SER_RMON_RX_BADADDR 0x000001F8 458#define R_SER_RMON_RX_BADADDR 0x000001F8
459 459
460/* ********************************************************************* 460/* *********************************************************************
461 * Generic Bus Registers 461 * Generic Bus Registers
462 ********************************************************************* */ 462 ********************************************************************* */
463 463
@@ -513,7 +513,7 @@
513#define R_IO_PCMCIA_CFG 0x0A60 513#define R_IO_PCMCIA_CFG 0x0A60
514#define R_IO_PCMCIA_STATUS 0x0A70 514#define R_IO_PCMCIA_STATUS 0x0A70
515 515
516/* ********************************************************************* 516/* *********************************************************************
517 * GPIO Registers 517 * GPIO Registers
518 ********************************************************************* */ 518 ********************************************************************* */
519 519
@@ -537,7 +537,7 @@
537#define R_GPIO_PIN_CLR 0x30 537#define R_GPIO_PIN_CLR 0x30
538#define R_GPIO_PIN_SET 0x38 538#define R_GPIO_PIN_SET 0x38
539 539
540/* ********************************************************************* 540/* *********************************************************************
541 * SMBus Registers 541 * SMBus Registers
542 ********************************************************************* */ 542 ********************************************************************* */
543 543
@@ -573,7 +573,7 @@
573#define R_SMB_CONTROL 0x0000000060 573#define R_SMB_CONTROL 0x0000000060
574#define R_SMB_PEC 0x0000000070 574#define R_SMB_PEC 0x0000000070
575 575
576/* ********************************************************************* 576/* *********************************************************************
577 * Timer Registers 577 * Timer Registers
578 ********************************************************************* */ 578 ********************************************************************* */
579 579
@@ -641,7 +641,7 @@
641#endif /* 1250 PASS2 || 112x PASS1 */ 641#endif /* 1250 PASS2 || 112x PASS1 */
642 642
643 643
644/* ********************************************************************* 644/* *********************************************************************
645 * System Control Registers 645 * System Control Registers
646 ********************************************************************* */ 646 ********************************************************************* */
647 647
@@ -649,7 +649,7 @@
649#define A_SCD_SYSTEM_CFG 0x0010020008 649#define A_SCD_SYSTEM_CFG 0x0010020008
650#define A_SCD_SYSTEM_MANUF 0x0010038000 650#define A_SCD_SYSTEM_MANUF 0x0010038000
651 651
652/* ********************************************************************* 652/* *********************************************************************
653 * System Address Trap Registers 653 * System Address Trap Registers
654 ********************************************************************* */ 654 ********************************************************************* */
655 655
@@ -672,7 +672,7 @@
672#endif /* 1250 PASS2 || 112x PASS1 */ 672#endif /* 1250 PASS2 || 112x PASS1 */
673 673
674 674
675/* ********************************************************************* 675/* *********************************************************************
676 * System Interrupt Mapper Registers 676 * System Interrupt Mapper Registers
677 ********************************************************************* */ 677 ********************************************************************* */
678 678
@@ -701,7 +701,7 @@
701#define R_IMR_INTERRUPT_MAP_BASE 0x0200 701#define R_IMR_INTERRUPT_MAP_BASE 0x0200
702#define R_IMR_INTERRUPT_MAP_COUNT 64 702#define R_IMR_INTERRUPT_MAP_COUNT 64
703 703
704/* ********************************************************************* 704/* *********************************************************************
705 * System Performance Counter Registers 705 * System Performance Counter Registers
706 ********************************************************************* */ 706 ********************************************************************* */
707 707
@@ -711,7 +711,7 @@
711#define A_SCD_PERF_CNT_2 0x00100204E0 711#define A_SCD_PERF_CNT_2 0x00100204E0
712#define A_SCD_PERF_CNT_3 0x00100204E8 712#define A_SCD_PERF_CNT_3 0x00100204E8
713 713
714/* ********************************************************************* 714/* *********************************************************************
715 * System Bus Watcher Registers 715 * System Bus Watcher Registers
716 ********************************************************************* */ 716 ********************************************************************* */
717 717
@@ -726,13 +726,13 @@
726#define A_BUS_L2_ERRORS 0x00100208C0 726#define A_BUS_L2_ERRORS 0x00100208C0
727#define A_BUS_MEM_IO_ERRORS 0x00100208C8 727#define A_BUS_MEM_IO_ERRORS 0x00100208C8
728 728
729/* ********************************************************************* 729/* *********************************************************************
730 * System Debug Controller Registers 730 * System Debug Controller Registers
731 ********************************************************************* */ 731 ********************************************************************* */
732 732
733#define A_SCD_JTAG_BASE 0x0010000000 733#define A_SCD_JTAG_BASE 0x0010000000
734 734
735/* ********************************************************************* 735/* *********************************************************************
736 * System Trace Buffer Registers 736 * System Trace Buffer Registers
737 ********************************************************************* */ 737 ********************************************************************* */
738 738
@@ -755,7 +755,7 @@
755#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 755#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
756#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 756#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
757 757
758/* ********************************************************************* 758/* *********************************************************************
759 * System Generic DMA Registers 759 * System Generic DMA Registers
760 ********************************************************************* */ 760 ********************************************************************* */
761 761
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index 22e8041959e2..dbbd682fb47e 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * SCD Constants and Macros File: sb1250_scd.h 4 * SCD Constants and Macros File: sb1250_scd.h
5 * 5 *
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * manipulating the System Control and Debug module on the 1250. 7 * manipulating the System Control and Debug module on the 1250.
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -130,40 +130,40 @@
130/* System Manufacturing Register 130/* System Manufacturing Register
131* Register: SCD_SYSTEM_MANUF 131* Register: SCD_SYSTEM_MANUF
132*/ 132*/
133 133
134/* Wafer ID: bits 31:0 */ 134/* Wafer ID: bits 31:0 */
135#define S_SYS_WAFERID1_200 _SB_MAKE64(0) 135#define S_SYS_WAFERID1_200 _SB_MAKE64(0)
136#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32,S_SYS_WAFERID1_200) 136#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32,S_SYS_WAFERID1_200)
137#define V_SYS_WAFERID1_200(x) _SB_MAKEVALUE(x,S_SYS_WAFERID1_200) 137#define V_SYS_WAFERID1_200(x) _SB_MAKEVALUE(x,S_SYS_WAFERID1_200)
138#define G_SYS_WAFERID1_200(x) _SB_GETVALUE(x,S_SYS_WAFERID1_200,M_SYS_WAFERID1_200) 138#define G_SYS_WAFERID1_200(x) _SB_GETVALUE(x,S_SYS_WAFERID1_200,M_SYS_WAFERID1_200)
139 139
140#define S_SYS_BIN _SB_MAKE64(32) 140#define S_SYS_BIN _SB_MAKE64(32)
141#define M_SYS_BIN _SB_MAKEMASK(4,S_SYS_BIN) 141#define M_SYS_BIN _SB_MAKEMASK(4,S_SYS_BIN)
142#define V_SYS_BIN _SB_MAKEVALUE(x,S_SYS_BIN) 142#define V_SYS_BIN _SB_MAKEVALUE(x,S_SYS_BIN)
143#define G_SYS_BIN _SB_GETVALUE(x,S_SYS_BIN,M_SYS_BIN) 143#define G_SYS_BIN _SB_GETVALUE(x,S_SYS_BIN,M_SYS_BIN)
144 144
145/* Wafer ID: bits 39:36 */ 145/* Wafer ID: bits 39:36 */
146#define S_SYS_WAFERID2_200 _SB_MAKE64(36) 146#define S_SYS_WAFERID2_200 _SB_MAKE64(36)
147#define M_SYS_WAFERID2_200 _SB_MAKEMASK(4,S_SYS_WAFERID2_200) 147#define M_SYS_WAFERID2_200 _SB_MAKEMASK(4,S_SYS_WAFERID2_200)
148#define V_SYS_WAFERID2_200(x) _SB_MAKEVALUE(x,S_SYS_WAFERID2_200) 148#define V_SYS_WAFERID2_200(x) _SB_MAKEVALUE(x,S_SYS_WAFERID2_200)
149#define G_SYS_WAFERID2_200(x) _SB_GETVALUE(x,S_SYS_WAFERID2_200,M_SYS_WAFERID2_200) 149#define G_SYS_WAFERID2_200(x) _SB_GETVALUE(x,S_SYS_WAFERID2_200,M_SYS_WAFERID2_200)
150 150
151/* Wafer ID: bits 39:0 */ 151/* Wafer ID: bits 39:0 */
152#define S_SYS_WAFERID_300 _SB_MAKE64(0) 152#define S_SYS_WAFERID_300 _SB_MAKE64(0)
153#define M_SYS_WAFERID_300 _SB_MAKEMASK(40,S_SYS_WAFERID_300) 153#define M_SYS_WAFERID_300 _SB_MAKEMASK(40,S_SYS_WAFERID_300)
154#define V_SYS_WAFERID_300(x) _SB_MAKEVALUE(x,S_SYS_WAFERID_300) 154#define V_SYS_WAFERID_300(x) _SB_MAKEVALUE(x,S_SYS_WAFERID_300)
155#define G_SYS_WAFERID_300(x) _SB_GETVALUE(x,S_SYS_WAFERID_300,M_SYS_WAFERID_300) 155#define G_SYS_WAFERID_300(x) _SB_GETVALUE(x,S_SYS_WAFERID_300,M_SYS_WAFERID_300)
156 156
157#define S_SYS_XPOS _SB_MAKE64(40) 157#define S_SYS_XPOS _SB_MAKE64(40)
158#define M_SYS_XPOS _SB_MAKEMASK(6,S_SYS_XPOS) 158#define M_SYS_XPOS _SB_MAKEMASK(6,S_SYS_XPOS)
159#define V_SYS_XPOS(x) _SB_MAKEVALUE(x,S_SYS_XPOS) 159#define V_SYS_XPOS(x) _SB_MAKEVALUE(x,S_SYS_XPOS)
160#define G_SYS_XPOS(x) _SB_GETVALUE(x,S_SYS_XPOS,M_SYS_XPOS) 160#define G_SYS_XPOS(x) _SB_GETVALUE(x,S_SYS_XPOS,M_SYS_XPOS)
161 161
162#define S_SYS_YPOS _SB_MAKE64(46) 162#define S_SYS_YPOS _SB_MAKE64(46)
163#define M_SYS_YPOS _SB_MAKEMASK(6,S_SYS_YPOS) 163#define M_SYS_YPOS _SB_MAKEMASK(6,S_SYS_YPOS)
164#define V_SYS_YPOS(x) _SB_MAKEVALUE(x,S_SYS_YPOS) 164#define V_SYS_YPOS(x) _SB_MAKEVALUE(x,S_SYS_YPOS)
165#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) 165#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS)
166 166
167/* 167/*
168 * System Config Register (Table 4-2) 168 * System Config Register (Table 4-2)
169 * Register: SCD_SYSTEM_CFG 169 * Register: SCD_SYSTEM_CFG
diff --git a/include/asm-mips/sibyte/sb1250_smbus.h b/include/asm-mips/sibyte/sb1250_smbus.h
index 287cbfe9efa2..335c53e92936 100644
--- a/include/asm-mips/sibyte/sb1250_smbus.h
+++ b/include/asm-mips/sibyte/sb1250_smbus.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * SMBUS Constants File: sb1250_smbus.h 4 * SMBUS Constants File: sb1250_smbus.h
5 * 5 *
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * manipulating the SB1250's SMbus devices. 7 * manipulating the SB1250's SMbus devices.
8 * 8 *
9 * SB1250 specification level: 01/02/2002 9 * SB1250 specification level: 01/02/2002
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
diff --git a/include/asm-mips/sibyte/sb1250_syncser.h b/include/asm-mips/sibyte/sb1250_syncser.h
index 8d5e8edd3c4b..fa2760d38b8b 100644
--- a/include/asm-mips/sibyte/sb1250_syncser.h
+++ b/include/asm-mips/sibyte/sb1250_syncser.h
@@ -7,17 +7,17 @@
7 * manipulating the SB1250's Synchronous Serial 7 * manipulating the SB1250's Synchronous Serial
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
diff --git a/include/asm-mips/sibyte/sb1250_uart.h b/include/asm-mips/sibyte/sb1250_uart.h
index 7655d6945cca..923ea4f44e0f 100644
--- a/include/asm-mips/sibyte/sb1250_uart.h
+++ b/include/asm-mips/sibyte/sb1250_uart.h
@@ -1,23 +1,23 @@
1/* ********************************************************************* 1/* *********************************************************************
2 * SB1250 Board Support Package 2 * SB1250 Board Support Package
3 * 3 *
4 * UART Constants File: sb1250_uart.h 4 * UART Constants File: sb1250_uart.h
5 * 5 *
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * manipulating the SB1250's UARTs 7 * manipulating the SB1250's UARTs
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg 11 * Author: Mitch Lichtenberg
12 * 12 *
13 ********************************************************************* 13 *********************************************************************
14 * 14 *
15 * Copyright 2000,2001,2002,2003 15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved. 16 * Broadcom Corporation. All rights reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA 31 * MA 02111-1307 USA
32 ********************************************************************* */ 32 ********************************************************************* */
33 33
@@ -37,7 +37,7 @@
37 37
38#include "sb1250_defs.h" 38#include "sb1250_defs.h"
39 39
40/* ********************************************************************** 40/* **********************************************************************
41 * DUART Registers 41 * DUART Registers
42 ********************************************************************** */ 42 ********************************************************************** */
43 43
@@ -145,7 +145,7 @@
145#define V_DUART_MISC_CMD_START_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK) 145#define V_DUART_MISC_CMD_START_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK)
146#define V_DUART_MISC_CMD_STOP_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK) 146#define V_DUART_MISC_CMD_STOP_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK)
147 147
148#define M_DUART_CMD_RESERVED _SB_MAKEMASK1(7) 148#define M_DUART_CMD_RESERVED _SB_MAKEMASK1(7)
149 149
150/* 150/*
151 * DUART Status Register (Table 10-6) 151 * DUART Status Register (Table 10-6)
@@ -165,7 +165,7 @@
165 165
166/* 166/*
167 * DUART Baud Rate Register (Table 10-7) 167 * DUART Baud Rate Register (Table 10-7)
168 * Register: DUART_CLK_SEL_A 168 * Register: DUART_CLK_SEL_A
169 * Register: DUART_CLK_SEL_B 169 * Register: DUART_CLK_SEL_B
170 */ 170 */
171 171
@@ -332,7 +332,7 @@
332 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1) 332 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1)
333 333
334#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 334#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
335/* 335/*
336 * Full Interrupt Control Register 336 * Full Interrupt Control Register
337 */ 337 */
338 338
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
index 18939e84b6f2..f7fbebaa0744 100644
--- a/include/asm-mips/sigcontext.h
+++ b/include/asm-mips/sigcontext.h
@@ -10,7 +10,7 @@
10#define _ASM_SIGCONTEXT_H 10#define _ASM_SIGCONTEXT_H
11 11
12#include <asm/sgidefs.h> 12#include <asm/sgidefs.h>
13 13
14#if _MIPS_SIM == _MIPS_SIM_ABI32 14#if _MIPS_SIM == _MIPS_SIM_ABI32
15 15
16/* 16/*
@@ -38,7 +38,7 @@ struct sigcontext {
38}; 38};
39 39
40#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 40#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
41 41
42#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 42#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
43 43
44/* 44/*
diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h
index a0e26e6c994d..698becab5a9e 100644
--- a/include/asm-mips/siginfo.h
+++ b/include/asm-mips/siginfo.h
@@ -25,10 +25,10 @@ struct siginfo;
25/* 25/*
26 * Careful to keep union _sifields from shifting ... 26 * Careful to keep union _sifields from shifting ...
27 */ 27 */
28#ifdef CONFIG_MIPS32 28#ifdef CONFIG_32BIT
29#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) 29#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
30#endif 30#endif
31#ifdef CONFIG_MIPS64 31#ifdef CONFIG_64BIT
32#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 32#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
33#endif 33#endif
34 34
diff --git a/include/asm-mips/sim.h b/include/asm-mips/sim.h
index 6333169be329..3ccfe09fa744 100644
--- a/include/asm-mips/sim.h
+++ b/include/asm-mips/sim.h
@@ -16,7 +16,7 @@
16#define __str2(x) #x 16#define __str2(x) #x
17#define __str(x) __str2(x) 17#define __str(x) __str2(x)
18 18
19#ifdef CONFIG_MIPS32 19#ifdef CONFIG_32BIT
20 20
21#define save_static_function(symbol) \ 21#define save_static_function(symbol) \
22__asm__ ( \ 22__asm__ ( \
@@ -42,9 +42,9 @@ __asm__ ( \
42 42
43#define nabi_no_regargs 43#define nabi_no_regargs
44 44
45#endif /* CONFIG_MIPS32 */ 45#endif /* CONFIG_32BIT */
46 46
47#ifdef CONFIG_MIPS64 47#ifdef CONFIG_64BIT
48 48
49#define save_static_function(symbol) \ 49#define save_static_function(symbol) \
50__asm__ ( \ 50__asm__ ( \
@@ -78,6 +78,6 @@ __asm__ ( \
78 unsigned long __dummy6, \ 78 unsigned long __dummy6, \
79 unsigned long __dummy7, 79 unsigned long __dummy7,
80 80
81#endif /* CONFIG_MIPS64 */ 81#endif /* CONFIG_64BIT */
82 82
83#endif /* _ASM_SIM_H */ 83#endif /* _ASM_SIM_H */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 020b4db70ee5..753b6620e6fa 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -37,6 +37,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
37#define SO_ERROR 0x1007 /* get error status and clear */ 37#define SO_ERROR 0x1007 /* get error status and clear */
38#define SO_SNDBUF 0x1001 /* Send buffer size. */ 38#define SO_SNDBUF 0x1001 /* Send buffer size. */
39#define SO_RCVBUF 0x1002 /* Receive buffer. */ 39#define SO_RCVBUF 0x1002 /* Receive buffer. */
40#define SO_SNDBUFFORCE 0x100a
41#define SO_RCVBUFFORCE 0x100b
40#define SO_SNDLOWAT 0x1003 /* send low-water mark */ 42#define SO_SNDLOWAT 0x1003 /* send low-water mark */
41#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ 43#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
42#define SO_SNDTIMEO 0x1005 /* send timeout */ 44#define SO_SNDTIMEO 0x1005 /* send timeout */
@@ -80,7 +82,7 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
80 * @SOCK_STREAM - stream (connection) socket 82 * @SOCK_STREAM - stream (connection) socket
81 * @SOCK_RAW - raw socket 83 * @SOCK_RAW - raw socket
82 * @SOCK_RDM - reliably-delivered message 84 * @SOCK_RDM - reliably-delivered message
83 * @SOCK_SEQPACKET - sequential packet socket 85 * @SOCK_SEQPACKET - sequential packet socket
84 * @SOCK_PACKET - linux specific way of getting packets at the dev level. 86 * @SOCK_PACKET - linux specific way of getting packets at the dev level.
85 * For writing rarp and other similar things on the user level. 87 * For writing rarp and other similar things on the user level.
86 */ 88 */
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 86283c25fd5b..fb42f99f8527 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -26,7 +26,7 @@
26 26
27 .macro SAVE_TEMP 27 .macro SAVE_TEMP
28 mfhi v1 28 mfhi v1
29#ifdef CONFIG_MIPS32 29#ifdef CONFIG_32BIT
30 LONG_S $8, PT_R8(sp) 30 LONG_S $8, PT_R8(sp)
31 LONG_S $9, PT_R9(sp) 31 LONG_S $9, PT_R9(sp)
32#endif 32#endif
@@ -56,7 +56,7 @@
56 56
57#ifdef CONFIG_SMP 57#ifdef CONFIG_SMP
58 .macro get_saved_sp /* SMP variation */ 58 .macro get_saved_sp /* SMP variation */
59#ifdef CONFIG_MIPS32 59#ifdef CONFIG_32BIT
60 mfc0 k0, CP0_CONTEXT 60 mfc0 k0, CP0_CONTEXT
61 lui k1, %hi(kernelsp) 61 lui k1, %hi(kernelsp)
62 srl k0, k0, 23 62 srl k0, k0, 23
@@ -64,7 +64,7 @@
64 addu k1, k0 64 addu k1, k0
65 LONG_L k1, %lo(kernelsp)(k1) 65 LONG_L k1, %lo(kernelsp)(k1)
66#endif 66#endif
67#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64) 67#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
68 MFC0 k1, CP0_CONTEXT 68 MFC0 k1, CP0_CONTEXT
69 dsra k1, 23 69 dsra k1, 23
70 lui k0, %hi(pgd_current) 70 lui k0, %hi(pgd_current)
@@ -74,7 +74,7 @@
74 daddu k1, k0 74 daddu k1, k0
75 LONG_L k1, %lo(kernelsp)(k1) 75 LONG_L k1, %lo(kernelsp)(k1)
76#endif 76#endif
77#if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64) 77#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
78 MFC0 k1, CP0_CONTEXT 78 MFC0 k1, CP0_CONTEXT
79 dsrl k1, 23 79 dsrl k1, 23
80 dsll k1, k1, 3 80 dsll k1, k1, 3
@@ -83,20 +83,20 @@
83 .endm 83 .endm
84 84
85 .macro set_saved_sp stackp temp temp2 85 .macro set_saved_sp stackp temp temp2
86#ifdef CONFIG_MIPS32 86#ifdef CONFIG_32BIT
87 mfc0 \temp, CP0_CONTEXT 87 mfc0 \temp, CP0_CONTEXT
88 srl \temp, 23 88 srl \temp, 23
89 sll \temp, 2 89 sll \temp, 2
90 LONG_S \stackp, kernelsp(\temp) 90 LONG_S \stackp, kernelsp(\temp)
91#endif 91#endif
92#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64) 92#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
93 lw \temp, TI_CPU(gp) 93 lw \temp, TI_CPU(gp)
94 dsll \temp, 3 94 dsll \temp, 3
95 lui \temp2, %hi(kernelsp) 95 lui \temp2, %hi(kernelsp)
96 daddu \temp, \temp2 96 daddu \temp, \temp2
97 LONG_S \stackp, %lo(kernelsp)(\temp) 97 LONG_S \stackp, %lo(kernelsp)(\temp)
98#endif 98#endif
99#if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64) 99#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
100 lw \temp, TI_CPU(gp) 100 lw \temp, TI_CPU(gp)
101 dsll \temp, 3 101 dsll \temp, 3
102 LONG_S \stackp, kernelsp(\temp) 102 LONG_S \stackp, kernelsp(\temp)
@@ -140,7 +140,7 @@
140 LONG_S $6, PT_R6(sp) 140 LONG_S $6, PT_R6(sp)
141 MFC0 v1, CP0_EPC 141 MFC0 v1, CP0_EPC
142 LONG_S $7, PT_R7(sp) 142 LONG_S $7, PT_R7(sp)
143#ifdef CONFIG_MIPS64 143#ifdef CONFIG_64BIT
144 LONG_S $8, PT_R8(sp) 144 LONG_S $8, PT_R8(sp)
145 LONG_S $9, PT_R9(sp) 145 LONG_S $9, PT_R9(sp)
146#endif 146#endif
@@ -169,7 +169,7 @@
169 169
170 .macro RESTORE_TEMP 170 .macro RESTORE_TEMP
171 LONG_L $24, PT_LO(sp) 171 LONG_L $24, PT_LO(sp)
172#ifdef CONFIG_MIPS32 172#ifdef CONFIG_32BIT
173 LONG_L $8, PT_R8(sp) 173 LONG_L $8, PT_R8(sp)
174 LONG_L $9, PT_R9(sp) 174 LONG_L $9, PT_R9(sp)
175#endif 175#endif
@@ -217,7 +217,7 @@
217 LONG_L $31, PT_R31(sp) 217 LONG_L $31, PT_R31(sp)
218 LONG_L $28, PT_R28(sp) 218 LONG_L $28, PT_R28(sp)
219 LONG_L $25, PT_R25(sp) 219 LONG_L $25, PT_R25(sp)
220#ifdef CONFIG_MIPS64 220#ifdef CONFIG_64BIT
221 LONG_L $8, PT_R8(sp) 221 LONG_L $8, PT_R8(sp)
222 LONG_L $9, PT_R9(sp) 222 LONG_L $9, PT_R9(sp)
223#endif 223#endif
@@ -262,7 +262,7 @@
262 LONG_L $31, PT_R31(sp) 262 LONG_L $31, PT_R31(sp)
263 LONG_L $28, PT_R28(sp) 263 LONG_L $28, PT_R28(sp)
264 LONG_L $25, PT_R25(sp) 264 LONG_L $25, PT_R25(sp)
265#ifdef CONFIG_MIPS64 265#ifdef CONFIG_64BIT
266 LONG_L $8, PT_R8(sp) 266 LONG_L $8, PT_R8(sp)
267 LONG_L $9, PT_R9(sp) 267 LONG_L $9, PT_R9(sp)
268#endif 268#endif
diff --git a/include/asm-mips/statfs.h b/include/asm-mips/statfs.h
index 5076fec65780..c3ddf973c1c0 100644
--- a/include/asm-mips/statfs.h
+++ b/include/asm-mips/statfs.h
@@ -57,7 +57,7 @@ struct statfs64 {
57}; 57};
58 58
59#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 59#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
60 60
61#if _MIPS_SIM == _MIPS_SIM_ABI64 61#if _MIPS_SIM == _MIPS_SIM_ABI64
62 62
63struct statfs64 { /* Same as struct statfs */ 63struct statfs64 { /* Same as struct statfs */
diff --git a/include/asm-mips/string.h b/include/asm-mips/string.h
index b18345504f8a..5a06f6d13899 100644
--- a/include/asm-mips/string.h
+++ b/include/asm-mips/string.h
@@ -16,7 +16,7 @@
16 * Most of the inline functions are rather naive implementations so I just 16 * Most of the inline functions are rather naive implementations so I just
17 * didn't bother updating them for 64-bit ... 17 * didn't bother updating them for 64-bit ...
18 */ 18 */
19#ifdef CONFIG_MIPS32 19#ifdef CONFIG_32BIT
20 20
21#ifndef IN_STRING_C 21#ifndef IN_STRING_C
22 22
@@ -130,7 +130,7 @@ strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count)
130 130
131 return __res; 131 return __res;
132} 132}
133#endif /* CONFIG_MIPS32 */ 133#endif /* CONFIG_32BIT */
134 134
135#define __HAVE_ARCH_MEMSET 135#define __HAVE_ARCH_MEMSET
136extern void *memset(void *__s, int __c, size_t __count); 136extern void *memset(void *__s, int __c, size_t __count);
@@ -141,7 +141,7 @@ extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
141#define __HAVE_ARCH_MEMMOVE 141#define __HAVE_ARCH_MEMMOVE
142extern void *memmove(void *__dest, __const__ void *__src, size_t __n); 142extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
143 143
144#ifdef CONFIG_MIPS32 144#ifdef CONFIG_32BIT
145#define __HAVE_ARCH_MEMSCAN 145#define __HAVE_ARCH_MEMSCAN
146static __inline__ void *memscan(void *__addr, int __c, size_t __size) 146static __inline__ void *memscan(void *__addr, int __c, size_t __size)
147{ 147{
@@ -161,6 +161,6 @@ static __inline__ void *memscan(void *__addr, int __c, size_t __size)
161 161
162 return __addr; 162 return __addr;
163} 163}
164#endif /* CONFIG_MIPS32 */ 164#endif /* CONFIG_32BIT */
165 165
166#endif /* _ASM_STRING_H */ 166#endif /* _ASM_STRING_H */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 169f3d4265b1..6663efd49b27 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -208,7 +208,7 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
208 return retval; 208 return retval;
209} 209}
210 210
211#ifdef CONFIG_MIPS64 211#ifdef CONFIG_64BIT
212static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val) 212static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
213{ 213{
214 __u64 retval; 214 __u64 retval;
@@ -330,7 +330,7 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
330 return retval; 330 return retval;
331} 331}
332 332
333#ifdef CONFIG_MIPS64 333#ifdef CONFIG_64BIT
334static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old, 334static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
335 unsigned long new) 335 unsigned long new)
336{ 336{
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index 42fcd6f2c206..a70cb0854c8a 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -62,10 +62,10 @@ register struct thread_info *__current_thread_info __asm__("$28");
62#define current_thread_info() __current_thread_info 62#define current_thread_info() __current_thread_info
63 63
64/* thread information allocation */ 64/* thread information allocation */
65#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS32) 65#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_32BIT)
66#define THREAD_SIZE_ORDER (1) 66#define THREAD_SIZE_ORDER (1)
67#endif 67#endif
68#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS64) 68#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_64BIT)
69#define THREAD_SIZE_ORDER (2) 69#define THREAD_SIZE_ORDER (2)
70#endif 70#endif
71#ifdef CONFIG_PAGE_SIZE_8KB 71#ifdef CONFIG_PAGE_SIZE_8KB
diff --git a/include/asm-mips/titan_dep.h b/include/asm-mips/titan_dep.h
index fd9599e40a0a..fee1908c65d2 100644
--- a/include/asm-mips/titan_dep.h
+++ b/include/asm-mips/titan_dep.h
@@ -228,4 +228,4 @@ extern unsigned long ocd_base;
228#define RM9K_READ_8(ofs, val) *(val) = *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs) 228#define RM9K_READ_8(ofs, val) *(val) = *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs)
229#define RM9K_READ_16(ofs, val) *(val) = *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs) 229#define RM9K_READ_16(ofs, val) *(val) = *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs)
230 230
231#endif 231#endif
diff --git a/include/asm-mips/tx4927/tx4927.h b/include/asm-mips/tx4927/tx4927.h
index 5d939db6e220..3bb7f0087d68 100644
--- a/include/asm-mips/tx4927/tx4927.h
+++ b/include/asm-mips/tx4927/tx4927.h
@@ -45,14 +45,14 @@
45 45
46 46
47/* TX4927 SDRAM controller (64-bit registers) */ 47/* TX4927 SDRAM controller (64-bit registers) */
48#define TX4927_SDRAMC_BASE 0x8000 48#define TX4927_SDRAMC_BASE 0x8000
49#define TX4927_SDRAMC_SDCCR0 0x8000 49#define TX4927_SDRAMC_SDCCR0 0x8000
50#define TX4927_SDRAMC_SDCCR1 0x8008 50#define TX4927_SDRAMC_SDCCR1 0x8008
51#define TX4927_SDRAMC_SDCCR2 0x8010 51#define TX4927_SDRAMC_SDCCR2 0x8010
52#define TX4927_SDRAMC_SDCCR3 0x8018 52#define TX4927_SDRAMC_SDCCR3 0x8018
53#define TX4927_SDRAMC_SDCTR 0x8040 53#define TX4927_SDRAMC_SDCTR 0x8040
54#define TX4927_SDRAMC_SDCMD 0x8058 54#define TX4927_SDRAMC_SDCMD 0x8058
55#define TX4927_SDRAMC_LIMIT 0x8fff 55#define TX4927_SDRAMC_LIMIT 0x8fff
56 56
57 57
58/* TX4927 external bus controller (64-bit registers) */ 58/* TX4927 external bus controller (64-bit registers) */
@@ -289,8 +289,8 @@
289 289
290 290
291/* TX4927 serial port 0 (32-bit registers) */ 291/* TX4927 serial port 0 (32-bit registers) */
292#define TX4927_SIO0_BASE 0xf300 292#define TX4927_SIO0_BASE 0xf300
293#define TX4927_SIO0_SILCR0 0xf300 293#define TX4927_SIO0_SILCR0 0xf300
294#define TX4927_SIO0_SILCR0_RESERVED_16_31 BM_16_31 294#define TX4927_SIO0_SILCR0_RESERVED_16_31 BM_16_31
295#define TX4927_SIO0_SILCR0_RWUB BM_15_15 295#define TX4927_SIO0_SILCR0_RWUB BM_15_15
296#define TX4927_SIO0_SILCR0_TWUB BM_14_14 296#define TX4927_SIO0_SILCR0_TWUB BM_14_14
@@ -309,7 +309,7 @@
309#define TX4927_SIO0_SILCR0_UMODE_DATA_7_BIT (~BM_00_01) 309#define TX4927_SIO0_SILCR0_UMODE_DATA_7_BIT (~BM_00_01)
310#define TX4927_SIO0_SILCR0_UMODE_DATA_8_BIT_MC BM_01_01 310#define TX4927_SIO0_SILCR0_UMODE_DATA_8_BIT_MC BM_01_01
311#define TX4927_SIO0_SILCR0_UMODE_DATA_7_BIT_MC BM_00_01 311#define TX4927_SIO0_SILCR0_UMODE_DATA_7_BIT_MC BM_00_01
312#define TX4927_SIO0_SIDICR0 0xf304 312#define TX4927_SIO0_SIDICR0 0xf304
313#define TX4927_SIO0_SIDICR0_RESERVED_16_31 BM_16_31 313#define TX4927_SIO0_SIDICR0_RESERVED_16_31 BM_16_31
314#define TX4927_SIO0_SIDICR0_TDE BM_15_15 314#define TX4927_SIO0_SIDICR0_TDE BM_15_15
315#define TX4927_SIO0_SIDICR0_RDE BM_14_14 315#define TX4927_SIO0_SIDICR0_RDE BM_14_14
@@ -330,7 +330,7 @@
330#define TX4927_SIO0_SIDICR0_STIE_TRDY BM_02_02 330#define TX4927_SIO0_SIDICR0_STIE_TRDY BM_02_02
331#define TX4927_SIO0_SIDICR0_STIE_TXALS BM_01_01 331#define TX4927_SIO0_SIDICR0_STIE_TXALS BM_01_01
332#define TX4927_SIO0_SIDICR0_STIE_UBRKD BM_00_00 332#define TX4927_SIO0_SIDICR0_STIE_UBRKD BM_00_00
333#define TX4927_SIO0_SIDISR0 0xf308 333#define TX4927_SIO0_SIDISR0 0xf308
334#define TX4927_SIO0_SIDISR0_RESERVED_16_31 BM_16_31 334#define TX4927_SIO0_SIDISR0_RESERVED_16_31 BM_16_31
335#define TX4927_SIO0_SIDISR0_UBRK BM_15_15 335#define TX4927_SIO0_SIDISR0_UBRK BM_15_15
336#define TX4927_SIO0_SIDISR0_UVALID BM_14_14 336#define TX4927_SIO0_SIDISR0_UVALID BM_14_14
@@ -344,7 +344,7 @@
344#define TX4927_SIO0_SIDISR0_STIS BM_06_06 344#define TX4927_SIO0_SIDISR0_STIS BM_06_06
345#define TX4927_SIO0_SIDISR0_RESERVED_05_05 BM_05_05 345#define TX4927_SIO0_SIDISR0_RESERVED_05_05 BM_05_05
346#define TX4927_SIO0_SIDISR0_RFDN BM_00_04 346#define TX4927_SIO0_SIDISR0_RFDN BM_00_04
347#define TX4927_SIO0_SISCISR0 0xf30c 347#define TX4927_SIO0_SISCISR0 0xf30c
348#define TX4927_SIO0_SISCISR0_RESERVED_06_31 BM_06_31 348#define TX4927_SIO0_SISCISR0_RESERVED_06_31 BM_06_31
349#define TX4927_SIO0_SISCISR0_OERS BM_05_05 349#define TX4927_SIO0_SISCISR0_OERS BM_05_05
350#define TX4927_SIO0_SISCISR0_CTSS BM_04_04 350#define TX4927_SIO0_SISCISR0_CTSS BM_04_04
@@ -352,7 +352,7 @@
352#define TX4927_SIO0_SISCISR0_TRDY BM_02_02 352#define TX4927_SIO0_SISCISR0_TRDY BM_02_02
353#define TX4927_SIO0_SISCISR0_TXALS BM_01_01 353#define TX4927_SIO0_SISCISR0_TXALS BM_01_01
354#define TX4927_SIO0_SISCISR0_UBRKD BM_00_00 354#define TX4927_SIO0_SISCISR0_UBRKD BM_00_00
355#define TX4927_SIO0_SIFCR0 0xf310 355#define TX4927_SIO0_SIFCR0 0xf310
356#define TX4927_SIO0_SIFCR0_RESERVED_16_31 BM_16_31 356#define TX4927_SIO0_SIFCR0_RESERVED_16_31 BM_16_31
357#define TX4927_SIO0_SIFCR0_SWRST BM_16_31 357#define TX4927_SIO0_SIFCR0_SWRST BM_16_31
358#define TX4927_SIO0_SIFCR0_RESERVED_09_14 BM_09_14 358#define TX4927_SIO0_SIFCR0_RESERVED_09_14 BM_09_14
@@ -370,7 +370,7 @@
370#define TX4927_SIO0_SIFCR0_TFRST BM_02_02 370#define TX4927_SIO0_SIFCR0_TFRST BM_02_02
371#define TX4927_SIO0_SIFCR0_RFRST BM_01_01 371#define TX4927_SIO0_SIFCR0_RFRST BM_01_01
372#define TX4927_SIO0_SIFCR0_FRSTE BM_00_00 372#define TX4927_SIO0_SIFCR0_FRSTE BM_00_00
373#define TX4927_SIO0_SIFLCR0 0xf314 373#define TX4927_SIO0_SIFLCR0 0xf314
374#define TX4927_SIO0_SIFLCR0_RESERVED_13_31 BM_13_31 374#define TX4927_SIO0_SIFLCR0_RESERVED_13_31 BM_13_31
375#define TX4927_SIO0_SIFLCR0_RCS BM_12_12 375#define TX4927_SIO0_SIFLCR0_RCS BM_12_12
376#define TX4927_SIO0_SIFLCR0_TES BM_11_11 376#define TX4927_SIO0_SIFLCR0_TES BM_11_11
@@ -381,7 +381,7 @@
381#define TX4927_SIO0_SIFLCR0_RESERVED_05_06 BM_05_06 381#define TX4927_SIO0_SIFLCR0_RESERVED_05_06 BM_05_06
382#define TX4927_SIO0_SIFLCR0_RTSTL BM_01_04 382#define TX4927_SIO0_SIFLCR0_RTSTL BM_01_04
383#define TX4927_SIO0_SIFLCR0_TBRK BM_00_00 383#define TX4927_SIO0_SIFLCR0_TBRK BM_00_00
384#define TX4927_SIO0_SIBGR0 0xf318 384#define TX4927_SIO0_SIBGR0 0xf318
385#define TX4927_SIO0_SIBGR0_RESERVED_10_31 BM_10_31 385#define TX4927_SIO0_SIBGR0_RESERVED_10_31 BM_10_31
386#define TX4927_SIO0_SIBGR0_BCLK BM_08_09 386#define TX4927_SIO0_SIBGR0_BCLK BM_08_09
387#define TX4927_SIO0_SIBGR0_BCLK_T0 (~BM_08_09) 387#define TX4927_SIO0_SIBGR0_BCLK_T0 (~BM_08_09)
@@ -389,28 +389,28 @@
389#define TX4927_SIO0_SIBGR0_BCLK_T4 BM_09_09 389#define TX4927_SIO0_SIBGR0_BCLK_T4 BM_09_09
390#define TX4927_SIO0_SIBGR0_BCLK_T6 BM_08_09 390#define TX4927_SIO0_SIBGR0_BCLK_T6 BM_08_09
391#define TX4927_SIO0_SIBGR0_BRD BM_00_07 391#define TX4927_SIO0_SIBGR0_BRD BM_00_07
392#define TX4927_SIO0_SITFIF00 0xf31c 392#define TX4927_SIO0_SITFIF00 0xf31c
393#define TX4927_SIO0_SITFIF00_RESERVED_08_31 BM_08_31 393#define TX4927_SIO0_SITFIF00_RESERVED_08_31 BM_08_31
394#define TX4927_SIO0_SITFIF00_TXD BM_00_07 394#define TX4927_SIO0_SITFIF00_TXD BM_00_07
395#define TX4927_SIO0_SIRFIFO0 0xf320 395#define TX4927_SIO0_SIRFIFO0 0xf320
396#define TX4927_SIO0_SIRFIFO0_RESERVED_08_31 BM_08_31 396#define TX4927_SIO0_SIRFIFO0_RESERVED_08_31 BM_08_31
397#define TX4927_SIO0_SIRFIFO0_RXD BM_00_07 397#define TX4927_SIO0_SIRFIFO0_RXD BM_00_07
398#define TX4927_SIO0_SIRFIFO0 0xf320 398#define TX4927_SIO0_SIRFIFO0 0xf320
399#define TX4927_SIO0_LIMIT 0xf3ff 399#define TX4927_SIO0_LIMIT 0xf3ff
400 400
401 401
402/* TX4927 serial port 1 (32-bit registers) */ 402/* TX4927 serial port 1 (32-bit registers) */
403#define TX4927_SIO1_BASE 0xf400 403#define TX4927_SIO1_BASE 0xf400
404#define TX4927_SIO1_SILCR1 0xf400 404#define TX4927_SIO1_SILCR1 0xf400
405#define TX4927_SIO1_SIDICR1 0xf404 405#define TX4927_SIO1_SIDICR1 0xf404
406#define TX4927_SIO1_SIDISR1 0xf408 406#define TX4927_SIO1_SIDISR1 0xf408
407#define TX4927_SIO1_SISCISR1 0xf40c 407#define TX4927_SIO1_SISCISR1 0xf40c
408#define TX4927_SIO1_SIFCR1 0xf410 408#define TX4927_SIO1_SIFCR1 0xf410
409#define TX4927_SIO1_SIFLCR1 0xf414 409#define TX4927_SIO1_SIFLCR1 0xf414
410#define TX4927_SIO1_SIBGR1 0xf418 410#define TX4927_SIO1_SIBGR1 0xf418
411#define TX4927_SIO1_SITFIF01 0xf41c 411#define TX4927_SIO1_SITFIF01 0xf41c
412#define TX4927_SIO1_SIRFIFO1 0xf420 412#define TX4927_SIO1_SIRFIFO1 0xf420
413#define TX4927_SIO1_LIMIT 0xf4ff 413#define TX4927_SIO1_LIMIT 0xf4ff
414 414
415 415
416/* TX4927 parallel port (32-bit registers) */ 416/* TX4927 parallel port (32-bit registers) */
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h
index 170433492246..165f6b8b217f 100644
--- a/include/asm-mips/tx4927/tx4927_pci.h
+++ b/include/asm-mips/tx4927/tx4927_pci.h
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2000-2001 Toshiba Corporation 6 * Copyright (C) 2000-2001 Toshiba Corporation
7 */ 7 */
8#ifndef __ASM_TX4927_TX4927_PCI_H 8#ifndef __ASM_TX4927_TX4927_PCI_H
9#define __ASM_TX4927_TX4927_PCI_H 9#define __ASM_TX4927_TX4927_PCI_H
10 10
11#define TX4927_CCFG_TOE 0x00004000 11#define TX4927_CCFG_TOE 0x00004000
12 12
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index d2f0c76b00a9..421b3aea14cc 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -78,7 +78,7 @@ typedef unsigned long long u64;
78#endif 78#endif
79 79
80#if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \ 80#if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \
81 || defined(CONFIG_MIPS64) 81 || defined(CONFIG_64BIT)
82typedef u64 dma_addr_t; 82typedef u64 dma_addr_t;
83#else 83#else
84typedef u32 dma_addr_t; 84typedef u32 dma_addr_t;
@@ -99,8 +99,6 @@ typedef u64 sector_t;
99#define HAVE_SECTOR_T 99#define HAVE_SECTOR_T
100#endif 100#endif
101 101
102typedef unsigned short kmem_bufctl_t;
103
104#endif /* __ASSEMBLY__ */ 102#endif /* __ASSEMBLY__ */
105 103
106#endif /* __KERNEL__ */ 104#endif /* __KERNEL__ */
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 07114898e065..5c2c98329012 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -22,7 +22,7 @@
22 * 22 *
23 * For historical reasons, these macros are grossly misnamed. 23 * For historical reasons, these macros are grossly misnamed.
24 */ 24 */
25#ifdef CONFIG_MIPS32 25#ifdef CONFIG_32BIT
26 26
27#define __UA_LIMIT 0x80000000UL 27#define __UA_LIMIT 0x80000000UL
28 28
@@ -32,9 +32,9 @@
32#define __UA_t0 "$8" 32#define __UA_t0 "$8"
33#define __UA_t1 "$9" 33#define __UA_t1 "$9"
34 34
35#endif /* CONFIG_MIPS32 */ 35#endif /* CONFIG_32BIT */
36 36
37#ifdef CONFIG_MIPS64 37#ifdef CONFIG_64BIT
38 38
39#define __UA_LIMIT (- TASK_SIZE) 39#define __UA_LIMIT (- TASK_SIZE)
40 40
@@ -44,7 +44,7 @@
44#define __UA_t0 "$12" 44#define __UA_t0 "$12"
45#define __UA_t1 "$13" 45#define __UA_t1 "$13"
46 46
47#endif /* CONFIG_MIPS64 */ 47#endif /* CONFIG_64BIT */
48 48
49/* 49/*
50 * USER_DS is a bitmask that has the bits set that may not be set in a valid 50 * USER_DS is a bitmask that has the bits set that may not be set in a valid
@@ -112,29 +112,6 @@
112 likely(__access_ok((unsigned long)(addr), (size),__access_mask)) 112 likely(__access_ok((unsigned long)(addr), (size),__access_mask))
113 113
114/* 114/*
115 * verify_area: - Obsolete/deprecated and will go away soon,
116 * use access_ok() instead.
117 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
118 * @addr: User space pointer to start of block to check
119 * @size: Size of block to check
120 *
121 * Context: User context only. This function may sleep.
122 *
123 * This function has been replaced by access_ok().
124 *
125 * Checks if a pointer to a block of memory in user space is valid.
126 *
127 * Returns zero if the memory block may be valid, -EFAULT
128 * if it is definitely invalid.
129 *
130 * See access_ok() for more details.
131 */
132static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
133{
134 return access_ok(type, addr, size) ? 0 : -EFAULT;
135}
136
137/*
138 * put_user: - Write a simple value into user space. 115 * put_user: - Write a simple value into user space.
139 * @x: Value to copy to user space. 116 * @x: Value to copy to user space.
140 * @ptr: Destination address, in user space. 117 * @ptr: Destination address, in user space.
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 6d21cc964f76..ad4d48056307 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -1124,7 +1124,7 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
1124# ifndef __mips64 1124# ifndef __mips64
1125# define __ARCH_WANT_STAT64 1125# define __ARCH_WANT_STAT64
1126# endif 1126# endif
1127# ifdef CONFIG_MIPS32 1127# ifdef CONFIG_32BIT
1128# define __ARCH_WANT_SYS_TIME 1128# define __ARCH_WANT_SYS_TIME
1129# endif 1129# endif
1130# ifdef CONFIG_MIPS32_O32 1130# ifdef CONFIG_MIPS32_O32
diff --git a/include/asm-mips/vr4181/irq.h b/include/asm-mips/vr4181/irq.h
deleted file mode 100644
index 4bf0ea970ed0..000000000000
--- a/include/asm-mips/vr4181/irq.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * Macros for vr4181 IRQ numbers.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/*
15 * Strategy:
16 *
17 * Vr4181 has conceptually three levels of interrupt controllers:
18 * 1. the CPU itself with 8 intr level.
19 * 2. system interrupt controller, cascaded from int0 pin in CPU, 32 intrs
20 * 3. GPIO interrupts : forwarding external interrupts to sys intr controller
21 */
22
23/* decide the irq block assignment */
24#define VR4181_NUM_CPU_IRQ 8
25#define VR4181_NUM_SYS_IRQ 32
26#define VR4181_NUM_GPIO_IRQ 16
27
28#define VR4181_IRQ_BASE 0
29
30#define VR4181_CPU_IRQ_BASE VR4181_IRQ_BASE
31#define VR4181_SYS_IRQ_BASE (VR4181_CPU_IRQ_BASE + VR4181_NUM_CPU_IRQ)
32#define VR4181_GPIO_IRQ_BASE (VR4181_SYS_IRQ_BASE + VR4181_NUM_SYS_IRQ)
33
34/* CPU interrupts */
35
36/*
37 IP0 - Software interrupt
38 IP1 - Software interrupt
39 IP2 - All but battery, high speed modem, and real time clock
40 IP3 - RTC Long1 (system timer)
41 IP4 - RTC Long2
42 IP5 - High Speed Modem (unused on VR4181)
43 IP6 - Unused
44 IP7 - Timer interrupt from CPO_COMPARE
45*/
46
47#define VR4181_IRQ_SW1 (VR4181_CPU_IRQ_BASE + 0)
48#define VR4181_IRQ_SW2 (VR4181_CPU_IRQ_BASE + 1)
49#define VR4181_IRQ_INT0 (VR4181_CPU_IRQ_BASE + 2)
50#define VR4181_IRQ_INT1 (VR4181_CPU_IRQ_BASE + 3)
51#define VR4181_IRQ_INT2 (VR4181_CPU_IRQ_BASE + 4)
52#define VR4181_IRQ_INT3 (VR4181_CPU_IRQ_BASE + 5)
53#define VR4181_IRQ_INT4 (VR4181_CPU_IRQ_BASE + 6)
54#define VR4181_IRQ_TIMER (VR4181_CPU_IRQ_BASE + 7)
55
56
57/* Cascaded from VR4181_IRQ_INT0 (ICU mapped interrupts) */
58
59/*
60 IP2 - same as VR4181_IRQ_INT1
61 IP8 - This is a cascade to GPIO IRQ's. Do not use.
62 IP16 - same as VR4181_IRQ_INT2
63 IP18 - CompactFlash
64*/
65
66#define VR4181_IRQ_BATTERY (VR4181_SYS_IRQ_BASE + 0)
67#define VR4181_IRQ_POWER (VR4181_SYS_IRQ_BASE + 1)
68#define VR4181_IRQ_RTCL1 (VR4181_SYS_IRQ_BASE + 2)
69#define VR4181_IRQ_ETIMER (VR4181_SYS_IRQ_BASE + 3)
70#define VR4181_IRQ_RFU12 (VR4181_SYS_IRQ_BASE + 4)
71#define VR4181_IRQ_PIU (VR4181_SYS_IRQ_BASE + 5)
72#define VR4181_IRQ_AIU (VR4181_SYS_IRQ_BASE + 6)
73#define VR4181_IRQ_KIU (VR4181_SYS_IRQ_BASE + 7)
74#define VR4181_IRQ_GIU (VR4181_SYS_IRQ_BASE + 8)
75#define VR4181_IRQ_SIU (VR4181_SYS_IRQ_BASE + 9)
76#define VR4181_IRQ_RFU18 (VR4181_SYS_IRQ_BASE + 10)
77#define VR4181_IRQ_SOFT (VR4181_SYS_IRQ_BASE + 11)
78#define VR4181_IRQ_RFU20 (VR4181_SYS_IRQ_BASE + 12)
79#define VR4181_IRQ_DOZEPIU (VR4181_SYS_IRQ_BASE + 13)
80#define VR4181_IRQ_RFU22 (VR4181_SYS_IRQ_BASE + 14)
81#define VR4181_IRQ_RFU23 (VR4181_SYS_IRQ_BASE + 15)
82#define VR4181_IRQ_RTCL2 (VR4181_SYS_IRQ_BASE + 16)
83#define VR4181_IRQ_LED (VR4181_SYS_IRQ_BASE + 17)
84#define VR4181_IRQ_ECU (VR4181_SYS_IRQ_BASE + 18)
85#define VR4181_IRQ_CSU (VR4181_SYS_IRQ_BASE + 19)
86#define VR4181_IRQ_USB (VR4181_SYS_IRQ_BASE + 20)
87#define VR4181_IRQ_DMA (VR4181_SYS_IRQ_BASE + 21)
88#define VR4181_IRQ_LCD (VR4181_SYS_IRQ_BASE + 22)
89#define VR4181_IRQ_RFU31 (VR4181_SYS_IRQ_BASE + 23)
90#define VR4181_IRQ_RFU32 (VR4181_SYS_IRQ_BASE + 24)
91#define VR4181_IRQ_RFU33 (VR4181_SYS_IRQ_BASE + 25)
92#define VR4181_IRQ_RFU34 (VR4181_SYS_IRQ_BASE + 26)
93#define VR4181_IRQ_RFU35 (VR4181_SYS_IRQ_BASE + 27)
94#define VR4181_IRQ_RFU36 (VR4181_SYS_IRQ_BASE + 28)
95#define VR4181_IRQ_RFU37 (VR4181_SYS_IRQ_BASE + 29)
96#define VR4181_IRQ_RFU38 (VR4181_SYS_IRQ_BASE + 30)
97#define VR4181_IRQ_RFU39 (VR4181_SYS_IRQ_BASE + 31)
98
99/* Cascaded from VR4181_IRQ_GIU */
100#define VR4181_IRQ_GPIO0 (VR4181_GPIO_IRQ_BASE + 0)
101#define VR4181_IRQ_GPIO1 (VR4181_GPIO_IRQ_BASE + 1)
102#define VR4181_IRQ_GPIO2 (VR4181_GPIO_IRQ_BASE + 2)
103#define VR4181_IRQ_GPIO3 (VR4181_GPIO_IRQ_BASE + 3)
104#define VR4181_IRQ_GPIO4 (VR4181_GPIO_IRQ_BASE + 4)
105#define VR4181_IRQ_GPIO5 (VR4181_GPIO_IRQ_BASE + 5)
106#define VR4181_IRQ_GPIO6 (VR4181_GPIO_IRQ_BASE + 6)
107#define VR4181_IRQ_GPIO7 (VR4181_GPIO_IRQ_BASE + 7)
108#define VR4181_IRQ_GPIO8 (VR4181_GPIO_IRQ_BASE + 8)
109#define VR4181_IRQ_GPIO9 (VR4181_GPIO_IRQ_BASE + 9)
110#define VR4181_IRQ_GPIO10 (VR4181_GPIO_IRQ_BASE + 10)
111#define VR4181_IRQ_GPIO11 (VR4181_GPIO_IRQ_BASE + 11)
112#define VR4181_IRQ_GPIO12 (VR4181_GPIO_IRQ_BASE + 12)
113#define VR4181_IRQ_GPIO13 (VR4181_GPIO_IRQ_BASE + 13)
114#define VR4181_IRQ_GPIO14 (VR4181_GPIO_IRQ_BASE + 14)
115#define VR4181_IRQ_GPIO15 (VR4181_GPIO_IRQ_BASE + 15)
116
117
118// Alternative to above GPIO IRQ defines
119#define VR4181_IRQ_GPIO(pin) ((VR4181_IRQ_GPIO0) + (pin))
120
121#define VR4181_IRQ_MAX (VR4181_IRQ_BASE + VR4181_NUM_CPU_IRQ + \
122 VR4181_NUM_SYS_IRQ + VR4181_NUM_GPIO_IRQ)
diff --git a/include/asm-mips/vr4181/vr4181.h b/include/asm-mips/vr4181/vr4181.h
deleted file mode 100644
index 5c5d60741515..000000000000
--- a/include/asm-mips/vr4181/vr4181.h
+++ /dev/null
@@ -1,413 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 by Michael Klar
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#ifndef __ASM_VR4181_VR4181_H
13#define __ASM_VR4181_VR4181_H
14
15#include <asm/addrspace.h>
16
17#include <asm/vr4181/irq.h>
18
19#ifndef __ASSEMBLY__
20#define __preg8 (volatile unsigned char*)
21#define __preg16 (volatile unsigned short*)
22#define __preg32 (volatile unsigned int*)
23#else
24#define __preg8
25#define __preg16
26#define __preg32
27#endif
28
29// Embedded CPU peripheral registers
30// Note that many of the registers have different physical address for VR4181
31
32// Bus Control Unit (BCU)
33#define VR4181_BCUCNTREG1 __preg16(KSEG1 + 0x0A000000) /* BCU control register 1 (R/W) */
34#define VR4181_CMUCLKMSK __preg16(KSEG1 + 0x0A000004) /* Clock mask register (R/W) */
35#define VR4181_CMUCLKMSK_MSKCSUPCLK 0x0040
36#define VR4181_CMUCLKMSK_MSKAIUPCLK 0x0020
37#define VR4181_CMUCLKMSK_MSKPIUPCLK 0x0010
38#define VR4181_CMUCLKMSK_MSKADUPCLK 0x0008
39#define VR4181_CMUCLKMSK_MSKSIU18M 0x0004
40#define VR4181_CMUCLKMSK_MSKADU18M 0x0002
41#define VR4181_CMUCLKMSK_MSKUSB 0x0001
42#define VR4181_CMUCLKMSK_MSKSIU VR4181_CMUCLKMSK_MSKSIU18M
43#define VR4181_BCUSPEEDREG __preg16(KSEG1 + 0x0A00000C) /* BCU access time parameter (R/W) */
44#define VR4181_BCURFCNTREG __preg16(KSEG1 + 0x0A000010) /* BCU refresh control register (R/W) */
45#define VR4181_REVIDREG __preg16(KSEG1 + 0x0A000014) /* Revision ID register (R) */
46#define VR4181_CLKSPEEDREG __preg16(KSEG1 + 0x0A000018) /* Clock speed register (R) */
47#define VR4181_EDOMCYTREG __preg16(KSEG1 + 0x0A000300) /* Memory cycle timing register (R/W) */
48#define VR4181_MEMCFG_REG __preg16(KSEG1 + 0x0A000304) /* Memory configuration register (R/W) */
49#define VR4181_MODE_REG __preg16(KSEG1 + 0x0A000308) /* SDRAM mode register (R/W) */
50#define VR4181_SDTIMINGREG __preg16(KSEG1 + 0x0A00030C) /* SDRAM timing register (R/W) */
51
52// DMA Control Unit (DCU)
53#define VR4181_MICDEST1REG1 __preg16(KSEG1 + 0x0A000020) /* Microphone destination 1 address register 1 (R/W) */
54#define VR4181_MICDEST1REG2 __preg16(KSEG1 + 0x0A000022) /* Microphone destination 1 address register 2 (R/W) */
55#define VR4181_MICDEST2REG1 __preg16(KSEG1 + 0x0A000024) /* Microphone destination 2 address register 1 (R/W) */
56#define VR4181_MICDEST2REG2 __preg16(KSEG1 + 0x0A000026) /* Microphone destination 2 address register 2 (R/W) */
57#define VR4181_SPKRRC1REG1 __preg16(KSEG1 + 0x0A000028) /* Speaker Source 1 address register 1 (R/W) */
58#define VR4181_SPKRRC1REG2 __preg16(KSEG1 + 0x0A00002A) /* Speaker Source 1 address register 2 (R/W) */
59#define VR4181_SPKRRC2REG1 __preg16(KSEG1 + 0x0A00002C) /* Speaker Source 2 address register 1 (R/W) */
60#define VR4181_SPKRRC2REG2 __preg16(KSEG1 + 0x0A00002E) /* Speaker Source 2 address register 2 (R/W) */
61#define VR4181_DMARSTREG __preg16(KSEG1 + 0x0A000040) /* DMA Reset register (R/W) */
62#define VR4181_AIUDMAMSKREG __preg16(KSEG1 + 0x0A000046) /* Audio DMA mask register (R/W) */
63#define VR4181_USBDMAMSKREG __preg16(KSEG1 + 0x0A000600) /* USB DMA Mask register (R/W) */
64#define VR4181_USBRXS1AREG1 __preg16(KSEG1 + 0x0A000602) /* USB Rx source 1 address register 1 (R/W) */
65#define VR4181_USBRXS1AREG2 __preg16(KSEG1 + 0x0A000604) /* USB Rx source 1 address register 2 (R/W) */
66#define VR4181_USBRXS2AREG1 __preg16(KSEG1 + 0x0A000606) /* USB Rx source 2 address register 1 (R/W) */
67#define VR4181_USBRXS2AREG2 __preg16(KSEG1 + 0x0A000608) /* USB Rx source 2 address register 2 (R/W) */
68#define VR4181_USBTXS1AREG1 __preg16(KSEG1 + 0x0A00060A) /* USB Tx source 1 address register 1 (R/W) */
69#define VR4181_USBTXS1AREG2 __preg16(KSEG1 + 0x0A00060C) /* USB Tx source 1 address register 2 (R/W) */
70#define VR4181_USBTXS2AREG1 __preg16(KSEG1 + 0x0A00060E) /* USB Tx source 2 address register 1 (R/W) */
71#define VR4181_USBTXS2AREG2 __preg16(KSEG1 + 0x0A000610) /* USB Tx source 2 address register 2 (R/W) */
72#define VR4181_USBRXD1AREG1 __preg16(KSEG1 + 0x0A00062A) /* USB Rx destination 1 address register 1 (R/W) */
73#define VR4181_USBRXD1AREG2 __preg16(KSEG1 + 0x0A00062C) /* USB Rx destination 1 address register 2 (R/W) */
74#define VR4181_USBRXD2AREG1 __preg16(KSEG1 + 0x0A00062E) /* USB Rx destination 2 address register 1 (R/W) */
75#define VR4181_USBRXD2AREG2 __preg16(KSEG1 + 0x0A000630) /* USB Rx destination 2 address register 2 (R/W) */
76#define VR4181_USBTXD1AREG1 __preg16(KSEG1 + 0x0A000632) /* USB Tx destination 1 address register 1 (R/W) */
77#define VR4181_USBTXD1AREG2 __preg16(KSEG1 + 0x0A000634) /* USB Tx destination 1 address register 2 (R/W) */
78#define VR4181_USBTXD2AREG1 __preg16(KSEG1 + 0x0A000636) /* USB Tx destination 2 address register 1 (R/W) */
79#define VR4181_USBTXD2AREG2 __preg16(KSEG1 + 0x0A000638) /* USB Tx destination 2 address register 2 (R/W) */
80#define VR4181_RxRCLENREG __preg16(KSEG1 + 0x0A000652) /* USB Rx record length register (R/W) */
81#define VR4181_TxRCLENREG __preg16(KSEG1 + 0x0A000654) /* USB Tx record length register (R/W) */
82#define VR4181_MICRCLENREG __preg16(KSEG1 + 0x0A000658) /* Microphone record length register (R/W) */
83#define VR4181_SPKRCLENREG __preg16(KSEG1 + 0x0A00065A) /* Speaker record length register (R/W) */
84#define VR4181_USBCFGREG __preg16(KSEG1 + 0x0A00065C) /* USB configuration register (R/W) */
85#define VR4181_MICDMACFGREG __preg16(KSEG1 + 0x0A00065E) /* Microphone DMA configuration register (R/W) */
86#define VR4181_SPKDMACFGREG __preg16(KSEG1 + 0x0A000660) /* Speaker DMA configuration register (R/W) */
87#define VR4181_DMAITRQREG __preg16(KSEG1 + 0x0A000662) /* DMA interrupt request register (R/W) */
88#define VR4181_DMACLTREG __preg16(KSEG1 + 0x0A000664) /* DMA control register (R/W) */
89#define VR4181_DMAITMKREG __preg16(KSEG1 + 0x0A000666) /* DMA interrupt mask register (R/W) */
90
91// ISA Bridge
92#define VR4181_ISABRGCTL __preg16(KSEG1 + 0x0B0002C0) /* ISA Bridge Control Register (R/W) */
93#define VR4181_ISABRGSTS __preg16(KSEG1 + 0x0B0002C2) /* ISA Bridge Status Register (R/W) */
94#define VR4181_XISACTL __preg16(KSEG1 + 0x0B0002C4) /* External ISA Control Register (R/W) */
95
96// Clocked Serial Interface (CSI)
97#define VR4181_CSIMODE __preg16(KSEG1 + 0x0B000900) /* CSI Mode Register (R/W) */
98#define VR4181_CSIRXDATA __preg16(KSEG1 + 0x0B000902) /* CSI Receive Data Register (R) */
99#define VR4181_CSITXDATA __preg16(KSEG1 + 0x0B000904) /* CSI Transmit Data Register (R/W) */
100#define VR4181_CSILSTAT __preg16(KSEG1 + 0x0B000906) /* CSI Line Status Register (R/W) */
101#define VR4181_CSIINTMSK __preg16(KSEG1 + 0x0B000908) /* CSI Interrupt Mask Register (R/W) */
102#define VR4181_CSIINTSTAT __preg16(KSEG1 + 0x0B00090a) /* CSI Interrupt Status Register (R/W) */
103#define VR4181_CSITXBLEN __preg16(KSEG1 + 0x0B00090c) /* CSI Transmit Burst Length Register (R/W) */
104#define VR4181_CSIRXBLEN __preg16(KSEG1 + 0x0B00090e) /* CSI Receive Burst Length Register (R/W) */
105
106// Interrupt Control Unit (ICU)
107#define VR4181_SYSINT1REG __preg16(KSEG1 + 0x0A000080) /* Level 1 System interrupt register 1 (R) */
108#define VR4181_MSYSINT1REG __preg16(KSEG1 + 0x0A00008C) /* Level 1 mask system interrupt register 1 (R/W) */
109#define VR4181_NMIREG __preg16(KSEG1 + 0x0A000098) /* NMI register (R/W) */
110#define VR4181_SOFTINTREG __preg16(KSEG1 + 0x0A00009A) /* Software interrupt register (R/W) */
111#define VR4181_SYSINT2REG __preg16(KSEG1 + 0x0A000200) /* Level 1 System interrupt register 2 (R) */
112#define VR4181_MSYSINT2REG __preg16(KSEG1 + 0x0A000206) /* Level 1 mask system interrupt register 2 (R/W) */
113#define VR4181_PIUINTREGro __preg16(KSEG1 + 0x0B000082) /* Level 2 PIU interrupt register (R) */
114#define VR4181_AIUINTREG __preg16(KSEG1 + 0x0B000084) /* Level 2 AIU interrupt register (R) */
115#define VR4181_MPIUINTREG __preg16(KSEG1 + 0x0B00008E) /* Level 2 mask PIU interrupt register (R/W) */
116#define VR4181_MAIUINTREG __preg16(KSEG1 + 0x0B000090) /* Level 2 mask AIU interrupt register (R/W) */
117#define VR4181_MKIUINTREG __preg16(KSEG1 + 0x0B000092) /* Level 2 mask KIU interrupt register (R/W) */
118#define VR4181_KIUINTREG __preg16(KSEG1 + 0x0B000198) /* Level 2 KIU interrupt register (R) */
119
120// Power Management Unit (PMU)
121#define VR4181_PMUINTREG __preg16(KSEG1 + 0x0B0000A0) /* PMU Status Register (R/W) */
122#define VR4181_PMUINT_POWERSW 0x1 /* Power switch */
123#define VR4181_PMUINT_BATT 0x2 /* Low batt during normal operation */
124#define VR4181_PMUINT_DEADMAN 0x4 /* Deadman's switch */
125#define VR4181_PMUINT_RESET 0x8 /* Reset switch */
126#define VR4181_PMUINT_RTCRESET 0x10 /* RTC Reset */
127#define VR4181_PMUINT_TIMEOUT 0x20 /* HAL Timer Reset */
128#define VR4181_PMUINT_BATTLOW 0x100 /* Battery low */
129#define VR4181_PMUINT_RTC 0x200 /* RTC Alarm */
130#define VR4181_PMUINT_DCD 0x400 /* DCD# */
131#define VR4181_PMUINT_GPIO0 0x1000 /* GPIO0 */
132#define VR4181_PMUINT_GPIO1 0x2000 /* GPIO1 */
133#define VR4181_PMUINT_GPIO2 0x4000 /* GPIO2 */
134#define VR4181_PMUINT_GPIO3 0x8000 /* GPIO3 */
135
136#define VR4181_PMUCNTREG __preg16(KSEG1 + 0x0B0000A2) /* PMU Control Register (R/W) */
137#define VR4181_PMUWAITREG __preg16(KSEG1 + 0x0B0000A8) /* PMU Wait Counter Register (R/W) */
138#define VR4181_PMUDIVREG __preg16(KSEG1 + 0x0B0000AC) /* PMU Divide Mode Register (R/W) */
139#define VR4181_DRAMHIBCTL __preg16(KSEG1 + 0x0B0000B2) /* DRAM Hibernate Control Register (R/W) */
140
141// Real Time Clock Unit (RTC)
142#define VR4181_ETIMELREG __preg16(KSEG1 + 0x0B0000C0) /* Elapsed Time L Register (R/W) */
143#define VR4181_ETIMEMREG __preg16(KSEG1 + 0x0B0000C2) /* Elapsed Time M Register (R/W) */
144#define VR4181_ETIMEHREG __preg16(KSEG1 + 0x0B0000C4) /* Elapsed Time H Register (R/W) */
145#define VR4181_ECMPLREG __preg16(KSEG1 + 0x0B0000C8) /* Elapsed Compare L Register (R/W) */
146#define VR4181_ECMPMREG __preg16(KSEG1 + 0x0B0000CA) /* Elapsed Compare M Register (R/W) */
147#define VR4181_ECMPHREG __preg16(KSEG1 + 0x0B0000CC) /* Elapsed Compare H Register (R/W) */
148#define VR4181_RTCL1LREG __preg16(KSEG1 + 0x0B0000D0) /* RTC Long 1 L Register (R/W) */
149#define VR4181_RTCL1HREG __preg16(KSEG1 + 0x0B0000D2) /* RTC Long 1 H Register (R/W) */
150#define VR4181_RTCL1CNTLREG __preg16(KSEG1 + 0x0B0000D4) /* RTC Long 1 Count L Register (R) */
151#define VR4181_RTCL1CNTHREG __preg16(KSEG1 + 0x0B0000D6) /* RTC Long 1 Count H Register (R) */
152#define VR4181_RTCL2LREG __preg16(KSEG1 + 0x0B0000D8) /* RTC Long 2 L Register (R/W) */
153#define VR4181_RTCL2HREG __preg16(KSEG1 + 0x0B0000DA) /* RTC Long 2 H Register (R/W) */
154#define VR4181_RTCL2CNTLREG __preg16(KSEG1 + 0x0B0000DC) /* RTC Long 2 Count L Register (R) */
155#define VR4181_RTCL2CNTHREG __preg16(KSEG1 + 0x0B0000DE) /* RTC Long 2 Count H Register (R) */
156#define VR4181_RTCINTREG __preg16(KSEG1 + 0x0B0001DE) /* RTC Interrupt Register (R/W) */
157
158// Deadman's Switch Unit (DSU)
159#define VR4181_DSUCNTREG __preg16(KSEG1 + 0x0B0000E0) /* DSU Control Register (R/W) */
160#define VR4181_DSUSETREG __preg16(KSEG1 + 0x0B0000E2) /* DSU Dead Time Set Register (R/W) */
161#define VR4181_DSUCLRREG __preg16(KSEG1 + 0x0B0000E4) /* DSU Clear Register (W) */
162#define VR4181_DSUTIMREG __preg16(KSEG1 + 0x0B0000E6) /* DSU Elapsed Time Register (R/W) */
163
164// General Purpose I/O Unit (GIU)
165#define VR4181_GPMD0REG __preg16(KSEG1 + 0x0B000300) /* GPIO Mode 0 Register (R/W) */
166#define VR4181_GPMD1REG __preg16(KSEG1 + 0x0B000302) /* GPIO Mode 1 Register (R/W) */
167#define VR4181_GPMD2REG __preg16(KSEG1 + 0x0B000304) /* GPIO Mode 2 Register (R/W) */
168#define VR4181_GPMD3REG __preg16(KSEG1 + 0x0B000306) /* GPIO Mode 3 Register (R/W) */
169#define VR4181_GPDATHREG __preg16(KSEG1 + 0x0B000308) /* GPIO Data High Register (R/W) */
170#define VR4181_GPDATHREG_GPIO16 0x0001
171#define VR4181_GPDATHREG_GPIO17 0x0002
172#define VR4181_GPDATHREG_GPIO18 0x0004
173#define VR4181_GPDATHREG_GPIO19 0x0008
174#define VR4181_GPDATHREG_GPIO20 0x0010
175#define VR4181_GPDATHREG_GPIO21 0x0020
176#define VR4181_GPDATHREG_GPIO22 0x0040
177#define VR4181_GPDATHREG_GPIO23 0x0080
178#define VR4181_GPDATHREG_GPIO24 0x0100
179#define VR4181_GPDATHREG_GPIO25 0x0200
180#define VR4181_GPDATHREG_GPIO26 0x0400
181#define VR4181_GPDATHREG_GPIO27 0x0800
182#define VR4181_GPDATHREG_GPIO28 0x1000
183#define VR4181_GPDATHREG_GPIO29 0x2000
184#define VR4181_GPDATHREG_GPIO30 0x4000
185#define VR4181_GPDATHREG_GPIO31 0x8000
186#define VR4181_GPDATLREG __preg16(KSEG1 + 0x0B00030A) /* GPIO Data Low Register (R/W) */
187#define VR4181_GPDATLREG_GPIO0 0x0001
188#define VR4181_GPDATLREG_GPIO1 0x0002
189#define VR4181_GPDATLREG_GPIO2 0x0004
190#define VR4181_GPDATLREG_GPIO3 0x0008
191#define VR4181_GPDATLREG_GPIO4 0x0010
192#define VR4181_GPDATLREG_GPIO5 0x0020
193#define VR4181_GPDATLREG_GPIO6 0x0040
194#define VR4181_GPDATLREG_GPIO7 0x0080
195#define VR4181_GPDATLREG_GPIO8 0x0100
196#define VR4181_GPDATLREG_GPIO9 0x0200
197#define VR4181_GPDATLREG_GPIO10 0x0400
198#define VR4181_GPDATLREG_GPIO11 0x0800
199#define VR4181_GPDATLREG_GPIO12 0x1000
200#define VR4181_GPDATLREG_GPIO13 0x2000
201#define VR4181_GPDATLREG_GPIO14 0x4000
202#define VR4181_GPDATLREG_GPIO15 0x8000
203#define VR4181_GPINTEN __preg16(KSEG1 + 0x0B00030C) /* GPIO Interrupt Enable Register (R/W) */
204#define VR4181_GPINTMSK __preg16(KSEG1 + 0x0B00030E) /* GPIO Interrupt Mask Register (R/W) */
205#define VR4181_GPINTTYPH __preg16(KSEG1 + 0x0B000310) /* GPIO Interrupt Type High Register (R/W) */
206#define VR4181_GPINTTYPL __preg16(KSEG1 + 0x0B000312) /* GPIO Interrupt Type Low Register (R/W) */
207#define VR4181_GPINTSTAT __preg16(KSEG1 + 0x0B000314) /* GPIO Interrupt Status Register (R/W) */
208#define VR4181_GPHIBSTH __preg16(KSEG1 + 0x0B000316) /* GPIO Hibernate Pin State High Register (R/W) */
209#define VR4181_GPHIBSTL __preg16(KSEG1 + 0x0B000318) /* GPIO Hibernate Pin State Low Register (R/W) */
210#define VR4181_GPSICTL __preg16(KSEG1 + 0x0B00031A) /* GPIO Serial Interface Control Register (R/W) */
211#define VR4181_KEYEN __preg16(KSEG1 + 0x0B00031C) /* Keyboard Scan Pin Enable Register (R/W) */
212#define VR4181_PCS0STRA __preg16(KSEG1 + 0x0B000320) /* Programmable Chip Select [0] Start Address Register (R/W) */
213#define VR4181_PCS0STPA __preg16(KSEG1 + 0x0B000322) /* Programmable Chip Select [0] Stop Address Register (R/W) */
214#define VR4181_PCS0HIA __preg16(KSEG1 + 0x0B000324) /* Programmable Chip Select [0] High Address Register (R/W) */
215#define VR4181_PCS1STRA __preg16(KSEG1 + 0x0B000326) /* Programmable Chip Select [1] Start Address Register (R/W) */
216#define VR4181_PCS1STPA __preg16(KSEG1 + 0x0B000328) /* Programmable Chip Select [1] Stop Address Register (R/W) */
217#define VR4181_PCS1HIA __preg16(KSEG1 + 0x0B00032A) /* Programmable Chip Select [1] High Address Register (R/W) */
218#define VR4181_PCSMODE __preg16(KSEG1 + 0x0B00032C) /* Programmable Chip Select Mode Register (R/W) */
219#define VR4181_LCDGPMODE __preg16(KSEG1 + 0x0B00032E) /* LCD General Purpose Mode Register (R/W) */
220#define VR4181_MISCREG0 __preg16(KSEG1 + 0x0B000330) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
221#define VR4181_MISCREG1 __preg16(KSEG1 + 0x0B000332) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
222#define VR4181_MISCREG2 __preg16(KSEG1 + 0x0B000334) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
223#define VR4181_MISCREG3 __preg16(KSEG1 + 0x0B000336) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
224#define VR4181_MISCREG4 __preg16(KSEG1 + 0x0B000338) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
225#define VR4181_MISCREG5 __preg16(KSEG1 + 0x0B00033A) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
226#define VR4181_MISCREG6 __preg16(KSEG1 + 0x0B00033C) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
227#define VR4181_MISCREG7 __preg16(KSEG1 + 0x0B00033D) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
228#define VR4181_MISCREG8 __preg16(KSEG1 + 0x0B000340) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
229#define VR4181_MISCREG9 __preg16(KSEG1 + 0x0B000342) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
230#define VR4181_MISCREG10 __preg16(KSEG1 + 0x0B000344) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
231#define VR4181_MISCREG11 __preg16(KSEG1 + 0x0B000346) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
232#define VR4181_MISCREG12 __preg16(KSEG1 + 0x0B000348) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
233#define VR4181_MISCREG13 __preg16(KSEG1 + 0x0B00034A) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
234#define VR4181_MISCREG14 __preg16(KSEG1 + 0x0B00034C) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
235#define VR4181_MISCREG15 __preg16(KSEG1 + 0x0B00034E) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
236#define VR4181_SECIRQMASKL VR4181_GPINTEN
237// No SECIRQMASKH for VR4181
238
239// Touch Panel Interface Unit (PIU)
240#define VR4181_PIUCNTREG __preg16(KSEG1 + 0x0B000122) /* PIU Control register (R/W) */
241#define VR4181_PIUCNTREG_PIUSEQEN 0x0004
242#define VR4181_PIUCNTREG_PIUPWR 0x0002
243#define VR4181_PIUCNTREG_PADRST 0x0001
244
245#define VR4181_PIUINTREG __preg16(KSEG1 + 0x0B000124) /* PIU Interrupt cause register (R/W) */
246#define VR4181_PIUINTREG_OVP 0x8000
247#define VR4181_PIUINTREG_PADCMD 0x0040
248#define VR4181_PIUINTREG_PADADP 0x0020
249#define VR4181_PIUINTREG_PADPAGE1 0x0010
250#define VR4181_PIUINTREG_PADPAGE0 0x0008
251#define VR4181_PIUINTREG_PADDLOST 0x0004
252#define VR4181_PIUINTREG_PENCHG 0x0001
253
254#define VR4181_PIUSIVLREG __preg16(KSEG1 + 0x0B000126) /* PIU Data sampling interval register (R/W) */
255#define VR4181_PIUSTBLREG __preg16(KSEG1 + 0x0B000128) /* PIU A/D converter start delay register (R/W) */
256#define VR4181_PIUCMDREG __preg16(KSEG1 + 0x0B00012A) /* PIU A/D command register (R/W) */
257#define VR4181_PIUASCNREG __preg16(KSEG1 + 0x0B000130) /* PIU A/D port scan register (R/W) */
258#define VR4181_PIUAMSKREG __preg16(KSEG1 + 0x0B000132) /* PIU A/D scan mask register (R/W) */
259#define VR4181_PIUCIVLREG __preg16(KSEG1 + 0x0B00013E) /* PIU Check interval register (R) */
260#define VR4181_PIUPB00REG __preg16(KSEG1 + 0x0B0002A0) /* PIU Page 0 Buffer 0 register (R/W) */
261#define VR4181_PIUPB01REG __preg16(KSEG1 + 0x0B0002A2) /* PIU Page 0 Buffer 1 register (R/W) */
262#define VR4181_PIUPB02REG __preg16(KSEG1 + 0x0B0002A4) /* PIU Page 0 Buffer 2 register (R/W) */
263#define VR4181_PIUPB03REG __preg16(KSEG1 + 0x0B0002A6) /* PIU Page 0 Buffer 3 register (R/W) */
264#define VR4181_PIUPB10REG __preg16(KSEG1 + 0x0B0002A8) /* PIU Page 1 Buffer 0 register (R/W) */
265#define VR4181_PIUPB11REG __preg16(KSEG1 + 0x0B0002AA) /* PIU Page 1 Buffer 1 register (R/W) */
266#define VR4181_PIUPB12REG __preg16(KSEG1 + 0x0B0002AC) /* PIU Page 1 Buffer 2 register (R/W) */
267#define VR4181_PIUPB13REG __preg16(KSEG1 + 0x0B0002AE) /* PIU Page 1 Buffer 3 register (R/W) */
268#define VR4181_PIUAB0REG __preg16(KSEG1 + 0x0B0002B0) /* PIU A/D scan Buffer 0 register (R/W) */
269#define VR4181_PIUAB1REG __preg16(KSEG1 + 0x0B0002B2) /* PIU A/D scan Buffer 1 register (R/W) */
270#define VR4181_PIUAB2REG __preg16(KSEG1 + 0x0B0002B4) /* PIU A/D scan Buffer 2 register (R/W) */
271#define VR4181_PIUAB3REG __preg16(KSEG1 + 0x0B0002B6) /* PIU A/D scan Buffer 3 register (R/W) */
272#define VR4181_PIUPB04REG __preg16(KSEG1 + 0x0B0002BC) /* PIU Page 0 Buffer 4 register (R/W) */
273#define VR4181_PIUPB14REG __preg16(KSEG1 + 0x0B0002BE) /* PIU Page 1 Buffer 4 register (R/W) */
274
275// Audio Interface Unit (AIU)
276#define VR4181_SODATREG __preg16(KSEG1 + 0x0B000166) /* Speaker Output Data Register (R/W) */
277#define VR4181_SCNTREG __preg16(KSEG1 + 0x0B000168) /* Speaker Output Control Register (R/W) */
278#define VR4181_MIDATREG __preg16(KSEG1 + 0x0B000170) /* Mike Input Data Register (R/W) */
279#define VR4181_MCNTREG __preg16(KSEG1 + 0x0B000172) /* Mike Input Control Register (R/W) */
280#define VR4181_DVALIDREG __preg16(KSEG1 + 0x0B000178) /* Data Valid Register (R/W) */
281#define VR4181_SEQREG __preg16(KSEG1 + 0x0B00017A) /* Sequential Register (R/W) */
282#define VR4181_INTREG __preg16(KSEG1 + 0x0B00017C) /* Interrupt Register (R/W) */
283#define VR4181_SDMADATREG __preg16(KSEG1 + 0x0B000160) /* Speaker DMA Data Register (R/W) */
284#define VR4181_MDMADATREG __preg16(KSEG1 + 0x0B000162) /* Microphone DMA Data Register (R/W) */
285#define VR4181_DAVREF_SETUP __preg16(KSEG1 + 0x0B000164) /* DAC Vref setup register (R/W) */
286#define VR4181_SCNVC_END __preg16(KSEG1 + 0x0B00016E) /* Speaker sample rate control (R/W) */
287#define VR4181_MIDATREG __preg16(KSEG1 + 0x0B000170) /* Microphone Input Data Register (R/W) */
288#define VR4181_MCNTREG __preg16(KSEG1 + 0x0B000172) /* Microphone Input Control Register (R/W) */
289#define VR4181_MCNVC_END __preg16(KSEG1 + 0x0B00017E) /* Microphone sample rate control (R/W) */
290
291// Keyboard Interface Unit (KIU)
292#define VR4181_KIUDAT0 __preg16(KSEG1 + 0x0B000180) /* KIU Data0 Register (R/W) */
293#define VR4181_KIUDAT1 __preg16(KSEG1 + 0x0B000182) /* KIU Data1 Register (R/W) */
294#define VR4181_KIUDAT2 __preg16(KSEG1 + 0x0B000184) /* KIU Data2 Register (R/W) */
295#define VR4181_KIUDAT3 __preg16(KSEG1 + 0x0B000186) /* KIU Data3 Register (R/W) */
296#define VR4181_KIUDAT4 __preg16(KSEG1 + 0x0B000188) /* KIU Data4 Register (R/W) */
297#define VR4181_KIUDAT5 __preg16(KSEG1 + 0x0B00018A) /* KIU Data5 Register (R/W) */
298#define VR4181_KIUSCANREP __preg16(KSEG1 + 0x0B000190) /* KIU Scan/Repeat Register (R/W) */
299#define VR4181_KIUSCANREP_KEYEN 0x8000
300#define VR4181_KIUSCANREP_SCANSTP 0x0008
301#define VR4181_KIUSCANREP_SCANSTART 0x0004
302#define VR4181_KIUSCANREP_ATSTP 0x0002
303#define VR4181_KIUSCANREP_ATSCAN 0x0001
304#define VR4181_KIUSCANS __preg16(KSEG1 + 0x0B000192) /* KIU Scan Status Register (R) */
305#define VR4181_KIUWKS __preg16(KSEG1 + 0x0B000194) /* KIU Wait Keyscan Stable Register (R/W) */
306#define VR4181_KIUWKI __preg16(KSEG1 + 0x0B000196) /* KIU Wait Keyscan Interval Register (R/W) */
307#define VR4181_KIUINT __preg16(KSEG1 + 0x0B000198) /* KIU Interrupt Register (R/W) */
308#define VR4181_KIUINT_KDATLOST 0x0004
309#define VR4181_KIUINT_KDATRDY 0x0002
310#define VR4181_KIUINT_SCANINT 0x0001
311#define VR4181_KIUDAT6 __preg16(KSEG1 + 0x0B00018C) /* Scan Line 6 Key Data Register (R) */
312#define VR4181_KIUDAT7 __preg16(KSEG1 + 0x0B00018E) /* Scan Line 7 Key Data Register (R) */
313
314// CompactFlash Controller
315#define VR4181_PCCARDINDEX __preg8(KSEG1 + 0x0B0008E0) /* PC Card Controller Index Register */
316#define VR4181_PCCARDDATA __preg8(KSEG1 + 0x0B0008E1) /* PC Card Controller Data Register */
317#define VR4181_INTSTATREG __preg16(KSEG1 + 0x0B0008F8) /* Interrupt Status Register (R/W) */
318#define VR4181_INTMSKREG __preg16(KSEG1 + 0x0B0008FA) /* Interrupt Mask Register (R/W) */
319#define VR4181_CFG_REG_1 __preg16(KSEG1 + 0x0B0008FE) /* Configuration Register 1 */
320
321// LED Control Unit (LED)
322#define VR4181_LEDHTSREG __preg16(KSEG1 + 0x0B000240) /* LED H Time Set register (R/W) */
323#define VR4181_LEDLTSREG __preg16(KSEG1 + 0x0B000242) /* LED L Time Set register (R/W) */
324#define VR4181_LEDCNTREG __preg16(KSEG1 + 0x0B000248) /* LED Control register (R/W) */
325#define VR4181_LEDASTCREG __preg16(KSEG1 + 0x0B00024A) /* LED Auto Stop Time Count register (R/W) */
326#define VR4181_LEDINTREG __preg16(KSEG1 + 0x0B00024C) /* LED Interrupt register (R/W) */
327
328// Serial Interface Unit (SIU / SIU1 and SIU2)
329#define VR4181_SIURB __preg8(KSEG1 + 0x0C000010) /* Receiver Buffer Register (Read) DLAB = 0 (R) */
330#define VR4181_SIUTH __preg8(KSEG1 + 0x0C000010) /* Transmitter Holding Register (Write) DLAB = 0 (W) */
331#define VR4181_SIUDLL __preg8(KSEG1 + 0x0C000010) /* Divisor Latch (Least Significant Byte) DLAB = 1 (R/W) */
332#define VR4181_SIUIE __preg8(KSEG1 + 0x0C000011) /* Interrupt Enable DLAB = 0 (R/W) */
333#define VR4181_SIUDLM __preg8(KSEG1 + 0x0C000011) /* Divisor Latch (Most Significant Byte) DLAB = 1 (R/W) */
334#define VR4181_SIUIID __preg8(KSEG1 + 0x0C000012) /* Interrupt Identification Register (Read) (R) */
335#define VR4181_SIUFC __preg8(KSEG1 + 0x0C000012) /* FIFO Control Register (Write) (W) */
336#define VR4181_SIULC __preg8(KSEG1 + 0x0C000013) /* Line Control Register (R/W) */
337#define VR4181_SIUMC __preg8(KSEG1 + 0x0C000014) /* MODEM Control Register (R/W) */
338#define VR4181_SIULS __preg8(KSEG1 + 0x0C000015) /* Line Status Register (R/W) */
339#define VR4181_SIUMS __preg8(KSEG1 + 0x0C000016) /* MODEM Status Register (R/W) */
340#define VR4181_SIUSC __preg8(KSEG1 + 0x0C000017) /* Scratch Register (R/W) */
341#define VR4181_SIURESET __preg8(KSEG1 + 0x0C000019) /* SIU Reset Register (R/W) */
342#define VR4181_SIUACTMSK __preg8(KSEG1 + 0x0C00001C) /* SIU Activity Mask (R/W) */
343#define VR4181_SIUACTTMR __preg8(KSEG1 + 0x0C00001E) /* SIU Activity Timer (R/W) */
344#define VR4181_SIURB_2 __preg8(KSEG1 + 0x0C000000) /* Receive Buffer Register (Read) (R) */
345#define VR4181_SIUTH_2 __preg8(KSEG1 + 0x0C000000) /* Transmitter Holding Register (Write) (W) */
346#define VR4181_SIUDLL_2 __preg8(KSEG1 + 0x0C000000) /* Divisor Latch (Least Significant Byte) (R/W) */
347#define VR4181_SIUIE_2 __preg8(KSEG1 + 0x0C000001) /* Interrupt Enable (DLAB = 0) (R/W) */
348#define VR4181_SIUDLM_2 __preg8(KSEG1 + 0x0C000001) /* Divisor Latch (Most Significant Byte) (DLAB = 1) (R/W) */
349#define VR4181_SIUIID_2 __preg8(KSEG1 + 0x0C000002) /* Interrupt Identification Register (Read) (R) */
350#define VR4181_SIUFC_2 __preg8(KSEG1 + 0x0C000002) /* FIFO Control Register (Write) (W) */
351#define VR4181_SIULC_2 __preg8(KSEG1 + 0x0C000003) /* Line Control Register (R/W) */
352#define VR4181_SIUMC_2 __preg8(KSEG1 + 0x0C000004) /* Modem Control Register (R/W) */
353#define VR4181_SIULS_2 __preg8(KSEG1 + 0x0C000005) /* Line Status Register (R/W) */
354#define VR4181_SIUMS_2 __preg8(KSEG1 + 0x0C000006) /* Modem Status Register (R/W) */
355#define VR4181_SIUSC_2 __preg8(KSEG1 + 0x0C000007) /* Scratch Register (R/W) */
356#define VR4181_SIUIRSEL_2 __preg8(KSEG1 + 0x0C000008) /* SIU IrDA Selectot (R/W) */
357#define VR4181_SIURESET_2 __preg8(KSEG1 + 0x0C000009) /* SIU Reset Register (R/W) */
358#define VR4181_SIUCSEL_2 __preg8(KSEG1 + 0x0C00000A) /* IrDA Echo-back Control (R/W) */
359#define VR4181_SIUACTMSK_2 __preg8(KSEG1 + 0x0C00000C) /* SIU Activity Mask Register (R/W) */
360#define VR4181_SIUACTTMR_2 __preg8(KSEG1 + 0x0C00000E) /* SIU Activity Timer Register (R/W) */
361
362
363// USB Module
364#define VR4181_USBINFIFO __preg16(KSEG1 + 0x0B000780) /* USB Bulk Input FIFO (Bulk In End Point) (W) */
365#define VR4181_USBOUTFIFO __preg16(KSEG1 + 0x0B000782) /* USB Bulk Output FIFO (Bulk Out End Point) (R) */
366#define VR4181_USBCTLFIFO __preg16(KSEG1 + 0x0B000784) /* USB Control FIFO (Control End Point) (W) */
367#define VR4181_USBSTAT __preg16(KSEG1 + 0x0B000786) /* Interrupt Status Register (R/W) */
368#define VR4181_USBINTMSK __preg16(KSEG1 + 0x0B000788) /* Interrupt Mask Register (R/W) */
369#define VR4181_USBCTLREG __preg16(KSEG1 + 0x0B00078A) /* Control Register (R/W) */
370#define VR4181_USBSTPREG __preg16(KSEG1 + 0x0B00078C) /* USB Transfer Stop Register (R/W) */
371
372// LCD Controller
373#define VR4181_HRTOTALREG __preg16(KSEG1 + 0x0A000400) /* Horizontal total Register (R/W) */
374#define VR4181_HRVISIBREG __preg16(KSEG1 + 0x0A000402) /* Horizontal Visible Register (R/W) */
375#define VR4181_LDCLKSTREG __preg16(KSEG1 + 0x0A000404) /* Load clock start Register (R/W) */
376#define VR4181_LDCLKNDREG __preg16(KSEG1 + 0x0A000406) /* Load clock end Register (R/W) */
377#define VR4181_VRTOTALREG __preg16(KSEG1 + 0x0A000408) /* Vertical Total Register (R/W) */
378#define VR4181_VRVISIBREG __preg16(KSEG1 + 0x0A00040A) /* Vertical Visible Register (R/W) */
379#define VR4181_FVSTARTREG __preg16(KSEG1 + 0x0A00040C) /* FLM vertical start Register (R/W) */
380#define VR4181_FVENDREG __preg16(KSEG1 + 0x0A00040E) /* FLM vertical end Register (R/W) */
381#define VR4181_LCDCTRLREG __preg16(KSEG1 + 0x0A000410) /* LCD control Register (R/W) */
382#define VR4181_LCDINRQREG __preg16(KSEG1 + 0x0A000412) /* LCD Interrupt request Register (R/W) */
383#define VR4181_LCDCFGREG0 __preg16(KSEG1 + 0x0A000414) /* LCD Configuration Register 0 (R/W) */
384#define VR4181_LCDCFGREG1 __preg16(KSEG1 + 0x0A000416) /* LCD Configuration Register 1 (R/W) */
385#define VR4181_FBSTAD1REG __preg16(KSEG1 + 0x0A000418) /* Frame Buffer Start Address 1 Register (R/W) */
386#define VR4181_FBSTAD2REG __preg16(KSEG1 + 0x0A00041A) /* Frame Buffer Start Address 2 Register (R/W) */
387#define VR4181_FBNDAD1REG __preg16(KSEG1 + 0x0A000420) /* Frame Buffer End Address 1 Register (R/W) */
388#define VR4181_FBNDAD2REG __preg16(KSEG1 + 0x0A000422) /* Frame Buffer End Address 2 register (R/W) */
389#define VR4181_FHSTARTREG __preg16(KSEG1 + 0x0A000424) /* FLM horizontal Start Register (R/W) */
390#define VR4181_FHENDREG __preg16(KSEG1 + 0x0A000426) /* FLM horizontal End Register (R/W) */
391#define VR4181_PWRCONREG1 __preg16(KSEG1 + 0x0A000430) /* Power Control register 1 (R/W) */
392#define VR4181_PWRCONREG2 __preg16(KSEG1 + 0x0A000432) /* Power Control register 2 (R/W) */
393#define VR4181_LCDIMSKREG __preg16(KSEG1 + 0x0A000434) /* LCD Interrupt Mask register (R/W) */
394#define VR4181_CPINDCTREG __preg16(KSEG1 + 0x0A00047E) /* Color palette Index and control Register (R/W) */
395#define VR4181_CPALDATREG __preg32(KSEG1 + 0x0A000480) /* Color palette data register (32bits Register) (R/W) */
396
397// physical address spaces
398#define VR4181_LCD 0x0a000000
399#define VR4181_INTERNAL_IO_2 0x0b000000
400#define VR4181_INTERNAL_IO_1 0x0c000000
401#define VR4181_ISA_MEM 0x10000000
402#define VR4181_ISA_IO 0x14000000
403#define VR4181_ROM 0x18000000
404
405// This is the base address for IO port decoding to which the 16 bit IO port address
406// is added. Defining it to 0 will usually cause a kernel oops any time port IO is
407// attempted, which can be handy for turning up parts of the kernel that make
408// incorrect architecture assumptions (by assuming that everything acts like a PC),
409// but we need it correctly defined to use the PCMCIA/CF controller:
410#define VR4181_PORT_BASE (KSEG1 + VR4181_ISA_IO)
411#define VR4181_ISAMEM_BASE (KSEG1 + VR4181_ISA_MEM)
412
413#endif /* __ASM_VR4181_VR4181_H */
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index 7d41e44463f9..bd2723c30901 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -7,7 +7,7 @@
7 * Copyright (C) 2001, 2002 Paul Mundt 7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc. 8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp. 9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 10 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
@@ -79,11 +79,11 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
79#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) 79#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
80#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0) 80#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
81#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1) 81#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
82#define INT0_CASCADE_IRQ MIPS_CPU_IRQ(2) 82#define INT0_IRQ MIPS_CPU_IRQ(2)
83#define INT1_CASCADE_IRQ MIPS_CPU_IRQ(3) 83#define INT1_IRQ MIPS_CPU_IRQ(3)
84#define INT2_CASCADE_IRQ MIPS_CPU_IRQ(4) 84#define INT2_IRQ MIPS_CPU_IRQ(4)
85#define INT3_CASCADE_IRQ MIPS_CPU_IRQ(5) 85#define INT3_IRQ MIPS_CPU_IRQ(5)
86#define INT4_CASCADE_IRQ MIPS_CPU_IRQ(6) 86#define INT4_IRQ MIPS_CPU_IRQ(6)
87#define TIMER_IRQ MIPS_CPU_IRQ(7) 87#define TIMER_IRQ MIPS_CPU_IRQ(7)
88 88
89/* SYINT1 Interrupt Numbers */ 89/* SYINT1 Interrupt Numbers */
@@ -97,7 +97,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
97#define PIU_IRQ SYSINT1_IRQ(5) 97#define PIU_IRQ SYSINT1_IRQ(5)
98#define AIU_IRQ SYSINT1_IRQ(6) 98#define AIU_IRQ SYSINT1_IRQ(6)
99#define KIU_IRQ SYSINT1_IRQ(7) 99#define KIU_IRQ SYSINT1_IRQ(7)
100#define GIUINT_CASCADE_IRQ SYSINT1_IRQ(8) 100#define GIUINT_IRQ SYSINT1_IRQ(8)
101#define SIU_IRQ SYSINT1_IRQ(9) 101#define SIU_IRQ SYSINT1_IRQ(9)
102#define BUSERR_IRQ SYSINT1_IRQ(10) 102#define BUSERR_IRQ SYSINT1_IRQ(10)
103#define SOFTINT_IRQ SYSINT1_IRQ(11) 103#define SOFTINT_IRQ SYSINT1_IRQ(11)
@@ -128,7 +128,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
128#define GIU_IRQ_LAST GIU_IRQ(31) 128#define GIU_IRQ_LAST GIU_IRQ(31)
129 129
130extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); 130extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
131extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq)); 131extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *));
132 132
133#define PIUINT_COMMAND 0x0040 133#define PIUINT_COMMAND 0x0040
134#define PIUINT_DATA 0x0020 134#define PIUINT_DATA 0x0020
diff --git a/include/asm-mips/vr41xx/vrc4173.h b/include/asm-mips/vr41xx/vrc4173.h
index 58e193c51b45..bb7a85c186e4 100644
--- a/include/asm-mips/vr41xx/vrc4173.h
+++ b/include/asm-mips/vr41xx/vrc4173.h
@@ -21,8 +21,8 @@
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24#ifndef __NEC_VRC4173_H 24#ifndef __NEC_VRC4173_H
25#define __NEC_VRC4173_H 25#define __NEC_VRC4173_H
26 26
27#include <linux/config.h> 27#include <linux/config.h>
28#include <asm/io.h> 28#include <asm/io.h>
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index c4a704121343..04ee53b34c2e 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -113,7 +113,7 @@
113 */ 113 */
114#define BCM1250_M3_WAR 1 114#define BCM1250_M3_WAR 1
115 115
116/* 116/*
117 * This is a DUART workaround related to glitches around register accesses 117 * This is a DUART workaround related to glitches around register accesses
118 */ 118 */
119#define SIBYTE_1956_WAR 1 119#define SIBYTE_1956_WAR 1
@@ -122,7 +122,7 @@
122 122
123/* 123/*
124 * Fill buffers not flushed on CACHE instructions 124 * Fill buffers not flushed on CACHE instructions
125 * 125 *
126 * Hit_Invalidate_I cacheops invalidate an icache line but the refill 126 * Hit_Invalidate_I cacheops invalidate an icache line but the refill
127 * for that line can get stale data from the fill buffer instead of 127 * for that line can get stale data from the fill buffer instead of
128 * accessing memory if the previous icache miss was also to that line. 128 * accessing memory if the previous icache miss was also to that line.
diff --git a/include/asm-mips/xxs1500.h b/include/asm-mips/xxs1500.h
index 75c0ddfeca13..4d84a90b0f20 100644
--- a/include/asm-mips/xxs1500.h
+++ b/include/asm-mips/xxs1500.h
@@ -22,7 +22,7 @@
22 * 22 *
23 * ######################################################################## 23 * ########################################################################
24 * 24 *
25 * 25 *
26 */ 26 */
27#ifndef __ASM_XXS1500_H 27#ifndef __ASM_XXS1500_H
28#define __ASM_XXS1500_H 28#define __ASM_XXS1500_H
diff --git a/include/asm-parisc/auxvec.h b/include/asm-parisc/auxvec.h
new file mode 100644
index 000000000000..9c3ac4b89dc9
--- /dev/null
+++ b/include/asm-parisc/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMPARISC_AUXVEC_H
2#define __ASMPARISC_AUXVEC_H
3
4#endif
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 7630d1ad2391..38b918feead9 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -13,8 +13,10 @@ typedef s32 compat_ssize_t;
13typedef s32 compat_time_t; 13typedef s32 compat_time_t;
14typedef s32 compat_clock_t; 14typedef s32 compat_clock_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u32 compat_uid_t; 16typedef u32 __compat_uid_t;
17typedef u32 compat_gid_t; 17typedef u32 __compat_gid_t;
18typedef u32 __compat_uid32_t;
19typedef u32 __compat_gid32_t;
18typedef u16 compat_mode_t; 20typedef u16 compat_mode_t;
19typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
20typedef u32 compat_dev_t; 22typedef u32 compat_dev_t;
@@ -67,8 +69,8 @@ struct compat_stat {
67 compat_dev_t st_realdev; 69 compat_dev_t st_realdev;
68 u16 st_basemode; 70 u16 st_basemode;
69 u16 st_spareshort; 71 u16 st_spareshort;
70 compat_uid_t st_uid; 72 __compat_uid32_t st_uid;
71 compat_gid_t st_gid; 73 __compat_gid32_t st_gid;
72 u32 st_spare4[3]; 74 u32 st_spare4[3];
73}; 75};
74 76
diff --git a/include/asm-parisc/fcntl.h b/include/asm-parisc/fcntl.h
index def35230716a..317851fa78f3 100644
--- a/include/asm-parisc/fcntl.h
+++ b/include/asm-parisc/fcntl.h
@@ -3,38 +3,22 @@
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */ 5 located on an ext2 file system */
6#define O_ACCMODE 00000003
7#define O_RDONLY 00000000
8#define O_WRONLY 00000001
9#define O_RDWR 00000002
10#define O_APPEND 00000010 6#define O_APPEND 00000010
11#define O_BLKSEEK 00000100 /* HPUX only */ 7#define O_BLKSEEK 00000100 /* HPUX only */
12#define O_CREAT 00000400 /* not fcntl */ 8#define O_CREAT 00000400 /* not fcntl */
13#define O_TRUNC 00001000 /* not fcntl */
14#define O_EXCL 00002000 /* not fcntl */ 9#define O_EXCL 00002000 /* not fcntl */
15#define O_LARGEFILE 00004000 10#define O_LARGEFILE 00004000
16#define O_SYNC 00100000 11#define O_SYNC 00100000
17#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ 12#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */
18#define O_NDELAY O_NONBLOCK
19#define O_NOCTTY 00400000 /* not fcntl */ 13#define O_NOCTTY 00400000 /* not fcntl */
20#define O_DSYNC 01000000 /* HPUX only */ 14#define O_DSYNC 01000000 /* HPUX only */
21#define O_RSYNC 02000000 /* HPUX only */ 15#define O_RSYNC 02000000 /* HPUX only */
22#define O_NOATIME 04000000 16#define O_NOATIME 04000000
23 17
24#define FASYNC 00020000 /* fcntl, for BSD compatibility */
25#define O_DIRECT 00040000 /* direct disk access hint - currently ignored */
26#define O_DIRECTORY 00010000 /* must be a directory */ 18#define O_DIRECTORY 00010000 /* must be a directory */
27#define O_NOFOLLOW 00000200 /* don't follow links */ 19#define O_NOFOLLOW 00000200 /* don't follow links */
28#define O_INVISIBLE 04000000 /* invisible I/O, for DMAPI/XDSM */ 20#define O_INVISIBLE 04000000 /* invisible I/O, for DMAPI/XDSM */
29 21
30#define F_DUPFD 0 /* dup */
31#define F_GETFD 1 /* get f_flags */
32#define F_SETFD 2 /* set f_flags */
33#define F_GETFL 3 /* more flags (cloexec) */
34#define F_SETFL 4
35#define F_GETLK 5
36#define F_SETLK 6
37#define F_SETLKW 7
38#define F_GETLK64 8 22#define F_GETLK64 8
39#define F_SETLK64 9 23#define F_SETLK64 9
40#define F_SETLKW64 10 24#define F_SETLKW64 10
@@ -44,49 +28,11 @@
44#define F_SETSIG 13 /* for sockets. */ 28#define F_SETSIG 13 /* for sockets. */
45#define F_GETSIG 14 /* for sockets. */ 29#define F_GETSIG 14 /* for sockets. */
46 30
47/* for F_[GET|SET]FL */
48#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
49
50/* for posix fcntl() and lockf() */ 31/* for posix fcntl() and lockf() */
51#define F_RDLCK 01 32#define F_RDLCK 01
52#define F_WRLCK 02 33#define F_WRLCK 02
53#define F_UNLCK 03 34#define F_UNLCK 03
54 35
55/* for old implementation of bsd flock () */ 36#include <asm-generic/fcntl.h>
56#define F_EXLCK 4 /* or 3 */
57#define F_SHLCK 8 /* or 4 */
58
59/* for leases */
60#define F_INPROGRESS 16
61
62/* operations for bsd flock(), also used by the kernel implementation */
63#define LOCK_SH 1 /* shared lock */
64#define LOCK_EX 2 /* exclusive lock */
65#define LOCK_NB 4 /* or'd with one of the above to prevent
66 blocking */
67#define LOCK_UN 8 /* remove lock */
68
69#define LOCK_MAND 32 /* This is a mandatory flock */
70#define LOCK_READ 64 /* ... Which allows concurrent read operations */
71#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
72#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
73
74struct flock {
75 short l_type;
76 short l_whence;
77 off_t l_start;
78 off_t l_len;
79 pid_t l_pid;
80};
81
82struct flock64 {
83 short l_type;
84 short l_whence;
85 loff_t l_start;
86 loff_t l_len;
87 pid_t l_pid;
88};
89
90#define F_LINUX_SPECIFIC_BASE 1024
91 37
92#endif 38#endif
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-parisc/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-parisc/hdreg.h b/include/asm-parisc/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-parisc/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h
index 75654ba93353..f876bdf22056 100644
--- a/include/asm-parisc/irq.h
+++ b/include/asm-parisc/irq.h
@@ -26,6 +26,11 @@
26 26
27#define NR_IRQS (CPU_IRQ_MAX + 1) 27#define NR_IRQS (CPU_IRQ_MAX + 1)
28 28
29/*
30 * IRQ line status macro IRQ_PER_CPU is used
31 */
32#define ARCH_HAS_IRQ_PER_CPU
33
29static __inline__ int irq_canonicalize(int irq) 34static __inline__ int irq_canonicalize(int irq)
30{ 35{
31 return (irq == 2) ? 9 : irq; 36 return (irq == 2) ? 9 : irq;
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 4a12692f94b4..44eae9f8274d 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -74,20 +74,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
74#define __pgd(x) ((pgd_t) { (x) } ) 74#define __pgd(x) ((pgd_t) { (x) } )
75#define __pgprot(x) ((pgprot_t) { (x) } ) 75#define __pgprot(x) ((pgprot_t) { (x) } )
76 76
77/* Pure 2^n version of get_order */
78extern __inline__ int get_order(unsigned long size)
79{
80 int order;
81
82 size = (size-1) >> (PAGE_SHIFT-1);
83 order = -1;
84 do {
85 size >>= 1;
86 order++;
87 } while (size);
88 return order;
89}
90
91typedef struct __physmem_range { 77typedef struct __physmem_range {
92 unsigned long start_pfn; 78 unsigned long start_pfn;
93 unsigned long pages; /* PAGE_SIZE pages */ 79 unsigned long pages; /* PAGE_SIZE pages */
@@ -159,4 +145,6 @@ extern int npmem_ranges;
159 145
160#endif /* __KERNEL__ */ 146#endif /* __KERNEL__ */
161 147
148#include <asm-generic/page.h>
149
162#endif /* _PARISC_PAGE_H */ 150#endif /* _PARISC_PAGE_H */
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index 4a77996c1862..1bf54dc53c10 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -16,6 +16,8 @@
16/* To add :#define SO_REUSEPORT 0x0200 */ 16/* To add :#define SO_REUSEPORT 0x0200 */
17#define SO_SNDBUF 0x1001 17#define SO_SNDBUF 0x1001
18#define SO_RCVBUF 0x1002 18#define SO_RCVBUF 0x1002
19#define SO_SNDBUFFORCE 0x100a
20#define SO_RCVBUFFORCE 0x100b
19#define SO_SNDLOWAT 0x1003 21#define SO_SNDLOWAT 0x1003
20#define SO_RCVLOWAT 0x1004 22#define SO_RCVLOWAT 0x1004
21#define SO_SNDTIMEO 0x1005 23#define SO_SNDTIMEO 0x1005
diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h
index 8fe7a44ea205..d21b9d0d63ea 100644
--- a/include/asm-parisc/types.h
+++ b/include/asm-parisc/types.h
@@ -56,8 +56,6 @@ typedef unsigned long long u64;
56typedef u32 dma_addr_t; 56typedef u32 dma_addr_t;
57typedef u64 dma64_addr_t; 57typedef u64 dma64_addr_t;
58 58
59typedef unsigned int kmem_bufctl_t;
60
61#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
62 60
63#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h
index c1b5bdea53ee..f6c417c8c484 100644
--- a/include/asm-parisc/uaccess.h
+++ b/include/asm-parisc/uaccess.h
@@ -40,10 +40,6 @@ static inline long access_ok(int type, const void __user * addr,
40 return 1; 40 return 1;
41} 41}
42 42
43#define verify_area(type,addr,size) (0) /* FIXME: all users should go away soon,
44 * and use access_ok instead, then this
45 * should be removed. */
46
47#define put_user __put_user 43#define put_user __put_user
48#define get_user __get_user 44#define get_user __get_user
49 45
diff --git a/include/asm-ppc64/8253pit.h b/include/asm-powerpc/8253pit.h
index 285f78488ccb..862708a749b0 100644
--- a/include/asm-ppc64/8253pit.h
+++ b/include/asm-powerpc/8253pit.h
@@ -5,6 +5,6 @@
5#ifndef _8253PIT_H 5#ifndef _8253PIT_H
6#define _8253PIT_H 6#define _8253PIT_H
7 7
8#define PIT_TICK_RATE 1193182UL 8#define PIT_TICK_RATE 1193182UL
9 9
10#endif 10#endif
diff --git a/include/asm-ppc/agp.h b/include/asm-powerpc/agp.h
index ca9e423307f4..ca9e423307f4 100644
--- a/include/asm-ppc/agp.h
+++ b/include/asm-powerpc/agp.h
diff --git a/include/asm-ppc64/shmparam.h b/include/asm-powerpc/bugs.h
index b2825ceff05e..310187d0e33a 100644
--- a/include/asm-ppc64/shmparam.h
+++ b/include/asm-powerpc/bugs.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_SHMPARAM_H 1#ifndef _POWERPC_BUGS_H
2#define _PPC64_SHMPARAM_H 2#define _POWERPC_BUGS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -8,6 +8,11 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ 11/*
12 * This file is included by 'init/main.c' to check for
13 * architecture-dependent bugs.
14 */
15
16extern void check_bugs(void);
12 17
13#endif /* _PPC64_SHMPARAM_H */ 18#endif /* _POWERPC_BUGS_H */
diff --git a/include/asm-powerpc/cputime.h b/include/asm-powerpc/cputime.h
new file mode 100644
index 000000000000..6d68ad7e0ea3
--- /dev/null
+++ b/include/asm-powerpc/cputime.h
@@ -0,0 +1 @@
#include <asm-generic/cputime.h>
diff --git a/include/asm-ppc/div64.h b/include/asm-powerpc/div64.h
index 6cd978cefb28..6cd978cefb28 100644
--- a/include/asm-ppc/div64.h
+++ b/include/asm-powerpc/div64.h
diff --git a/include/asm-powerpc/emergency-restart.h b/include/asm-powerpc/emergency-restart.h
new file mode 100644
index 000000000000..3711bd9d50bd
--- /dev/null
+++ b/include/asm-powerpc/emergency-restart.h
@@ -0,0 +1 @@
#include <asm-generic/emergency-restart.h>
diff --git a/include/asm-ppc/errno.h b/include/asm-powerpc/errno.h
index 19f20bd41ae6..19f20bd41ae6 100644
--- a/include/asm-ppc/errno.h
+++ b/include/asm-powerpc/errno.h
diff --git a/include/asm-powerpc/fcntl.h b/include/asm-powerpc/fcntl.h
new file mode 100644
index 000000000000..ce5c4516d404
--- /dev/null
+++ b/include/asm-powerpc/fcntl.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_FCNTL_H
2#define _ASM_FCNTL_H
3
4#define O_DIRECTORY 040000 /* must be a directory */
5#define O_NOFOLLOW 0100000 /* don't follow links */
6#define O_LARGEFILE 0200000
7#define O_DIRECT 0400000 /* direct disk access hint */
8
9#include <asm-generic/fcntl.h>
10
11#endif /* _ASM_FCNTL_H */
diff --git a/include/asm-ppc/ioctl.h b/include/asm-powerpc/ioctl.h
index 93c6acfdd0fd..93c6acfdd0fd 100644
--- a/include/asm-ppc/ioctl.h
+++ b/include/asm-powerpc/ioctl.h
diff --git a/include/asm-ppc/ioctls.h b/include/asm-powerpc/ioctls.h
index f5b7f2b055e7..f5b7f2b055e7 100644
--- a/include/asm-ppc/ioctls.h
+++ b/include/asm-powerpc/ioctls.h
diff --git a/include/asm-ppc/ipc.h b/include/asm-powerpc/ipc.h
index a46e3d9c2a3f..a46e3d9c2a3f 100644
--- a/include/asm-ppc/ipc.h
+++ b/include/asm-powerpc/ipc.h
diff --git a/include/asm-ppc/linkage.h b/include/asm-powerpc/linkage.h
index 291c2d01c44f..291c2d01c44f 100644
--- a/include/asm-ppc/linkage.h
+++ b/include/asm-powerpc/linkage.h
diff --git a/include/asm-ppc64/local.h b/include/asm-powerpc/local.h
index c11c530f74d0..c11c530f74d0 100644
--- a/include/asm-ppc64/local.h
+++ b/include/asm-powerpc/local.h
diff --git a/include/asm-ppc64/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h
index f713e1bbb533..a5619a2a1393 100644
--- a/include/asm-ppc64/mc146818rtc.h
+++ b/include/asm-powerpc/mc146818rtc.h
@@ -1,3 +1,6 @@
1#ifndef _POWERPC_MC146818RTC_H
2#define _POWERPC_MC146818RTC_H
3
1/* 4/*
2 * Machine dependent access functions for RTC registers. 5 * Machine dependent access functions for RTC registers.
3 * 6 *
@@ -6,8 +9,8 @@
6 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
8 */ 11 */
9#ifndef __ASM_PPC64_MC146818RTC_H 12
10#define __ASM_PPC64_MC146818RTC_H 13#ifdef __KERNEL__
11 14
12#include <asm/io.h> 15#include <asm/io.h>
13 16
@@ -29,4 +32,5 @@ outb_p((addr),RTC_PORT(0)); \
29outb_p((val),RTC_PORT(1)); \ 32outb_p((val),RTC_PORT(1)); \
30}) 33})
31 34
32#endif /* __ASM_PPC64_MC146818RTC_H */ 35#endif /* __KERNEL__ */
36#endif /* _POWERPC_MC146818RTC_H */
diff --git a/include/asm-ppc64/mman.h b/include/asm-powerpc/mman.h
index d4f93446a52c..f2d55988d749 100644
--- a/include/asm-ppc64/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -1,5 +1,5 @@
1#ifndef __PPC64_MMAN_H__ 1#ifndef _POWERPC_MMAN_H
2#define __PPC64_MMAN_H__ 2#define _POWERPC_MMAN_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -49,4 +49,4 @@
49#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0 50#define MAP_FILE 0
51 51
52#endif /* __PPC64_MMAN_H__ */ 52#endif /* _POWERPC_MMAN_H */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
new file mode 100644
index 000000000000..4438f4fd6524
--- /dev/null
+++ b/include/asm-powerpc/module.h
@@ -0,0 +1,77 @@
1#ifndef _POWERPC_MODULE_H
2#define _POWERPC_MODULE_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <linux/list.h>
12#include <asm/bug.h>
13
14
15#ifndef __powerpc64__
16/*
17 * Thanks to Paul M for explaining this.
18 *
19 * PPC can only do rel jumps += 32MB, and often the kernel and other
20 * modules are furthur away than this. So, we jump to a table of
21 * trampolines attached to the module (the Procedure Linkage Table)
22 * whenever that happens.
23 */
24
25struct ppc_plt_entry {
26 /* 16 byte jump instruction sequence (4 instructions) */
27 unsigned int jump[4];
28};
29#endif /* __powerpc64__ */
30
31
32struct mod_arch_specific {
33#ifdef __powerpc64__
34 unsigned int stubs_section; /* Index of stubs section in module */
35 unsigned int toc_section; /* What section is the TOC? */
36#else
37 /* Indices of PLT sections within module. */
38 unsigned int core_plt_section;
39 unsigned int init_plt_section;
40#endif
41
42 /* List of BUG addresses, source line numbers and filenames */
43 struct list_head bug_list;
44 struct bug_entry *bug_table;
45 unsigned int num_bugs;
46};
47
48extern struct bug_entry *module_find_bug(unsigned long bugaddr);
49
50/*
51 * Select ELF headers.
52 * Make empty section for module_frob_arch_sections to expand.
53 */
54
55#ifdef __powerpc64__
56# define Elf_Shdr Elf64_Shdr
57# define Elf_Sym Elf64_Sym
58# define Elf_Ehdr Elf64_Ehdr
59# ifdef MODULE
60 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
61# endif
62#else
63# define Elf_Shdr Elf32_Shdr
64# define Elf_Sym Elf32_Sym
65# define Elf_Ehdr Elf32_Ehdr
66# ifdef MODULE
67 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
68 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
69# endif /* MODULE */
70#endif
71
72
73struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish);
76
77#endif /* _POWERPC_MODULE_H */
diff --git a/include/asm-ppc/namei.h b/include/asm-powerpc/namei.h
index 29c9ec832133..29c9ec832133 100644
--- a/include/asm-ppc/namei.h
+++ b/include/asm-powerpc/namei.h
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
new file mode 100644
index 000000000000..06a959d67234
--- /dev/null
+++ b/include/asm-powerpc/percpu.h
@@ -0,0 +1 @@
#include <asm-generic/percpu.h>
diff --git a/include/asm-ppc/poll.h b/include/asm-powerpc/poll.h
index be5024913c62..be5024913c62 100644
--- a/include/asm-ppc/poll.h
+++ b/include/asm-powerpc/poll.h
diff --git a/include/asm-powerpc/resource.h b/include/asm-powerpc/resource.h
new file mode 100644
index 000000000000..04bc4db8921b
--- /dev/null
+++ b/include/asm-powerpc/resource.h
@@ -0,0 +1 @@
#include <asm-generic/resource.h>
diff --git a/include/asm-ppc64/sembuf.h b/include/asm-powerpc/sembuf.h
index 172e59000767..c98fc18fe805 100644
--- a/include/asm-ppc64/sembuf.h
+++ b/include/asm-powerpc/sembuf.h
@@ -1,27 +1,36 @@
1#ifndef _PPC64_SEMBUF_H 1#ifndef _POWERPC_SEMBUF_H
2#define _PPC64_SEMBUF_H 2#define _POWERPC_SEMBUF_H
3 3
4/* 4/*
5 * The semid64_ds structure for PPC architecture.
6 *
7 *
8 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 6 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 7 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * The semid64_ds structure for PPC architecture.
13 * Note extra padding because this structure is passed back and forth
14 * between kernel and user space.
12 * 15 *
13 * Pad space is left for: 16 * Pad space is left for:
14 * - 2 miscellaneous 64-bit values 17 * - 64-bit time_t to solve y2038 problem
18 * - 2 miscellaneous 32-bit values
15 */ 19 */
16 20
17struct semid64_ds { 21struct semid64_ds {
18 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
23#ifndef __powerpc64__
24 unsigned long __unused1;
25#endif
19 __kernel_time_t sem_otime; /* last semop time */ 26 __kernel_time_t sem_otime; /* last semop time */
27#ifndef __powerpc64__
28 unsigned long __unused2;
29#endif
20 __kernel_time_t sem_ctime; /* last change time */ 30 __kernel_time_t sem_ctime; /* last change time */
21 unsigned long sem_nsems; /* no. of semaphores in array */ 31 unsigned long sem_nsems; /* no. of semaphores in array */
22 32 unsigned long __unused3;
23 unsigned long __unused1; 33 unsigned long __unused4;
24 unsigned long __unused2;
25}; 34};
26 35
27#endif /* _PPC64_SEMBUF_H */ 36#endif /* _POWERPC_SEMBUF_H */
diff --git a/include/asm-ppc64/shmbuf.h b/include/asm-powerpc/shmbuf.h
index 02e99d6ec925..29632db3b178 100644
--- a/include/asm-ppc64/shmbuf.h
+++ b/include/asm-powerpc/shmbuf.h
@@ -1,31 +1,47 @@
1#ifndef _PPC64_SHMBUF_H 1#ifndef _POWERPC_SHMBUF_H
2#define _PPC64_SHMBUF_H 2#define _POWERPC_SHMBUF_H
3 3
4/* 4/*
5 * The shmid64_ds structure for PPC64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 *
12 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 6 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 7 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
16 */ 9 */
17 10
11/*
12 * The shmid64_ds structure for PPC architecture.
13 *
14 * Note extra padding because this structure is passed back and forth
15 * between kernel and user space.
16 *
17 * Pad space is left for:
18 * - 64-bit time_t to solve y2038 problem
19 * - 2 miscellaneous 32-bit values
20 */
21
18struct shmid64_ds { 22struct shmid64_ds {
19 struct ipc64_perm shm_perm; /* operation perms */ 23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __power64__
25 unsigned long __unused1;
26#endif
20 __kernel_time_t shm_atime; /* last attach time */ 27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __power64__
29 unsigned long __unused2;
30#endif
21 __kernel_time_t shm_dtime; /* last detach time */ 31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __power64__
33 unsigned long __unused3;
34#endif
22 __kernel_time_t shm_ctime; /* last change time */ 35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __power64__
37 unsigned long __unused4;
38#endif
23 size_t shm_segsz; /* size of segment (bytes) */ 39 size_t shm_segsz; /* size of segment (bytes) */
24 __kernel_pid_t shm_cpid; /* pid of creator */ 40 __kernel_pid_t shm_cpid; /* pid of creator */
25 __kernel_pid_t shm_lpid; /* pid of last operator */ 41 __kernel_pid_t shm_lpid; /* pid of last operator */
26 unsigned long shm_nattch; /* no. of current attaches */ 42 unsigned long shm_nattch; /* no. of current attaches */
27 unsigned long __unused1; 43 unsigned long __unused5;
28 unsigned long __unused2; 44 unsigned long __unused6;
29}; 45};
30 46
31struct shminfo64 { 47struct shminfo64 {
@@ -40,4 +56,4 @@ struct shminfo64 {
40 unsigned long __unused4; 56 unsigned long __unused4;
41}; 57};
42 58
43#endif /* _PPC64_SHMBUF_H */ 59#endif /* _POWERPC_SHMBUF_H */
diff --git a/include/asm-ppc/shmparam.h b/include/asm-powerpc/shmparam.h
index d6250602ae64..d6250602ae64 100644
--- a/include/asm-ppc/shmparam.h
+++ b/include/asm-powerpc/shmparam.h
diff --git a/include/asm-ppc64/siginfo.h b/include/asm-powerpc/siginfo.h
index 3a7c23dcb5aa..ae70b8010b19 100644
--- a/include/asm-ppc64/siginfo.h
+++ b/include/asm-powerpc/siginfo.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_SIGINFO_H 1#ifndef _POWERPC_SIGINFO_H
2#define _PPC64_SIGINFO_H 2#define _POWERPC_SIGINFO_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -8,9 +8,11 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 11#ifdef __powerpc64__
12#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) 12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14#endif
13 15
14#include <asm-generic/siginfo.h> 16#include <asm-generic/siginfo.h>
15 17
16#endif /* _PPC64_SIGINFO_H */ 18#endif /* _POWERPC_SIGINFO_H */
diff --git a/include/asm-ppc64/socket.h b/include/asm-powerpc/socket.h
index 59e00dfc8b8e..51a0cf5ee9f0 100644
--- a/include/asm-ppc64/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_SOCKET_H 1#ifndef _POWERPC_SOCKET_H
2#define _ASM_SOCKET_H 2#define _POWERPC_SOCKET_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -10,7 +10,7 @@
10 10
11#include <asm/sockios.h> 11#include <asm/sockios.h>
12 12
13/* For setsockoptions(2) */ 13/* For setsockopt(2) */
14#define SOL_SOCKET 1 14#define SOL_SOCKET 1
15 15
16#define SO_DEBUG 1 16#define SO_DEBUG 1
@@ -21,6 +21,8 @@
21#define SO_BROADCAST 6 21#define SO_BROADCAST 6
22#define SO_SNDBUF 7 22#define SO_SNDBUF 7
23#define SO_RCVBUF 8 23#define SO_RCVBUF 8
24#define SO_SNDBUFFORCE 32
25#define SO_RCVBUFFORCE 33
24#define SO_KEEPALIVE 9 26#define SO_KEEPALIVE 9
25#define SO_OOBINLINE 10 27#define SO_OOBINLINE 10
26#define SO_NO_CHECK 11 28#define SO_NO_CHECK 11
@@ -50,8 +52,8 @@
50#define SO_TIMESTAMP 29 52#define SO_TIMESTAMP 29
51#define SCM_TIMESTAMP SO_TIMESTAMP 53#define SCM_TIMESTAMP SO_TIMESTAMP
52 54
53#define SO_ACCEPTCONN 30 55#define SO_ACCEPTCONN 30
54 56
55#define SO_PEERSEC 31 57#define SO_PEERSEC 31
56 58
57#endif /* _ASM_SOCKET_H */ 59#endif /* _POWERPC_SOCKET_H */
diff --git a/include/asm-ppc64/sockios.h b/include/asm-powerpc/sockios.h
index 6bd1a22af4f6..ef7ff664167e 100644
--- a/include/asm-ppc64/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_PPC64_SOCKIOS_H 1#ifndef _POWERPC_SOCKIOS_H
2#define _ASM_PPC64_SOCKIOS_H 2#define _POWERPC_SOCKIOS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -16,4 +16,4 @@
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp */
18 18
19#endif /* _ASM_PPC64_SOCKIOS_H */ 19#endif /* _POWERPC_SOCKIOS_H */
diff --git a/include/asm-ppc/string.h b/include/asm-powerpc/string.h
index 225575997392..225575997392 100644
--- a/include/asm-ppc/string.h
+++ b/include/asm-powerpc/string.h
diff --git a/include/asm-ppc64/termbits.h b/include/asm-powerpc/termbits.h
index d1a2bee10cef..2c5bf85a8c3c 100644
--- a/include/asm-ppc64/termbits.h
+++ b/include/asm-powerpc/termbits.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_TERMBITS_H 1#ifndef _POWERPC_TERMBITS_H
2#define _PPC64_TERMBITS_H 2#define _POWERPC_TERMBITS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -8,8 +8,6 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#include <linux/posix_types.h>
12
13typedef unsigned char cc_t; 11typedef unsigned char cc_t;
14typedef unsigned int speed_t; 12typedef unsigned int speed_t;
15typedef unsigned int tcflag_t; 13typedef unsigned int tcflag_t;
@@ -190,4 +188,4 @@ struct termios {
190#define TCSADRAIN 1 188#define TCSADRAIN 1
191#define TCSAFLUSH 2 189#define TCSAFLUSH 2
192 190
193#endif /* _PPC64_TERMBITS_H */ 191#endif /* _POWERPC_TERMBITS_H */
diff --git a/include/asm-ppc64/termios.h b/include/asm-powerpc/termios.h
index 02c3d283aa62..237533bb0e9f 100644
--- a/include/asm-ppc64/termios.h
+++ b/include/asm-powerpc/termios.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_TERMIOS_H 1#ifndef _POWERPC_TERMIOS_H
2#define _PPC64_TERMIOS_H 2#define _POWERPC_TERMIOS_H
3 3
4/* 4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[] 5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
@@ -87,6 +87,7 @@ struct termio {
87#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ 87#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
88#define N_HDLC 13 /* synchronous HDLC */ 88#define N_HDLC 13 /* synchronous HDLC */
89#define N_SYNC_PPP 14 89#define N_SYNC_PPP 14
90#define N_HCI 15 /* Bluetooth HCI UART */
90 91
91#ifdef __KERNEL__ 92#ifdef __KERNEL__
92/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ 93/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
@@ -232,4 +233,4 @@ struct termio {
232 233
233#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
234 235
235#endif /* _PPC64_TERMIOS_H */ 236#endif /* _POWERPC_TERMIOS_H */
diff --git a/include/asm-ppc/unaligned.h b/include/asm-powerpc/unaligned.h
index 45520d9b85d1..45520d9b85d1 100644
--- a/include/asm-ppc/unaligned.h
+++ b/include/asm-powerpc/unaligned.h
diff --git a/include/asm-ppc/xor.h b/include/asm-powerpc/xor.h
index c82eb12a5b18..c82eb12a5b18 100644
--- a/include/asm-ppc/xor.h
+++ b/include/asm-powerpc/xor.h
diff --git a/include/asm-ppc/8253pit.h b/include/asm-ppc/8253pit.h
deleted file mode 100644
index 285f78488ccb..000000000000
--- a/include/asm-ppc/8253pit.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * 8253/8254 Programmable Interval Timer
3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif
diff --git a/include/asm-ppc/auxvec.h b/include/asm-ppc/auxvec.h
new file mode 100644
index 000000000000..172358df29c8
--- /dev/null
+++ b/include/asm-ppc/auxvec.h
@@ -0,0 +1,14 @@
1#ifndef __PPC_AUXVEC_H
2#define __PPC_AUXVEC_H
3
4/*
5 * We need to put in some extra aux table entries to tell glibc what
6 * the cache block size is, so it can use the dcbz instruction safely.
7 */
8#define AT_DCACHEBSIZE 19
9#define AT_ICACHEBSIZE 20
10#define AT_UCACHEBSIZE 21
11/* A special ignored type value for PPC, for glibc compatibility. */
12#define AT_IGNOREPPC 22
13
14#endif
diff --git a/include/asm-ppc/bugs.h b/include/asm-ppc/bugs.h
deleted file mode 100644
index 8dce1e290fd0..000000000000
--- a/include/asm-ppc/bugs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1/*
2 * This file is included by 'init/main.c'
3 */
4
5extern void
6check_bugs(void);
diff --git a/include/asm-ppc/cputime.h b/include/asm-ppc/cputime.h
deleted file mode 100644
index 8e9faf5ce720..000000000000
--- a/include/asm-ppc/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PPC_CPUTIME_H
2#define __PPC_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __PPC_CPUTIME_H */
diff --git a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h
index 6f74f59938d4..92b8ee78dcc2 100644
--- a/include/asm-ppc/dma-mapping.h
+++ b/include/asm-ppc/dma-mapping.h
@@ -60,7 +60,8 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
60} 60}
61 61
62static inline void *dma_alloc_coherent(struct device *dev, size_t size, 62static inline void *dma_alloc_coherent(struct device *dev, size_t size,
63 dma_addr_t * dma_handle, int gfp) 63 dma_addr_t * dma_handle,
64 unsigned int __nocast gfp)
64{ 65{
65#ifdef CONFIG_NOT_COHERENT_CACHE 66#ifdef CONFIG_NOT_COHERENT_CACHE
66 return __dma_alloc_coherent(size, dma_handle, gfp); 67 return __dma_alloc_coherent(size, dma_handle, gfp);
diff --git a/include/asm-ppc/elf.h b/include/asm-ppc/elf.h
index 2c056966efd3..c25cc35e6ab5 100644
--- a/include/asm-ppc/elf.h
+++ b/include/asm-ppc/elf.h
@@ -7,6 +7,7 @@
7#include <asm/types.h> 7#include <asm/types.h>
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <asm/cputable.h> 9#include <asm/cputable.h>
10#include <asm/auxvec.h>
10 11
11/* PowerPC relocations defined by the ABIs */ 12/* PowerPC relocations defined by the ABIs */
12#define R_PPC_NONE 0 13#define R_PPC_NONE 0
@@ -122,16 +123,6 @@ extern int dump_task_fpu(struct task_struct *t, elf_fpregset_t *fpu);
122 123
123#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 124#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
124 125
125/*
126 * We need to put in some extra aux table entries to tell glibc what
127 * the cache block size is, so it can use the dcbz instruction safely.
128 */
129#define AT_DCACHEBSIZE 19
130#define AT_ICACHEBSIZE 20
131#define AT_UCACHEBSIZE 21
132/* A special ignored type value for PPC, for glibc compatibility. */
133#define AT_IGNOREPPC 22
134
135extern int dcache_bsize; 126extern int dcache_bsize;
136extern int icache_bsize; 127extern int icache_bsize;
137extern int ucache_bsize; 128extern int ucache_bsize;
diff --git a/include/asm-ppc/emergency-restart.h b/include/asm-ppc/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-ppc/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/include/asm-ppc/fcntl.h b/include/asm-ppc/fcntl.h
deleted file mode 100644
index 5e28e41fb29f..000000000000
--- a/include/asm-ppc/fcntl.h
+++ /dev/null
@@ -1,93 +0,0 @@
1#ifndef _PPC_FCNTL_H
2#define _PPC_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_LARGEFILE 0200000
22#define O_DIRECT 0400000 /* direct disk access hint */
23#define O_NOATIME 01000000
24
25#define F_DUPFD 0 /* dup */
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70#ifdef __KERNEL__
71#define F_POSIX 1
72#define F_FLOCK 2
73#define F_BROKEN 4 /* broken flock() emulation */
74#endif /* __KERNEL__ */
75
76struct flock {
77 short l_type;
78 short l_whence;
79 off_t l_start;
80 off_t l_len;
81 pid_t l_pid;
82};
83
84struct flock64 {
85 short l_type;
86 short l_whence;
87 loff_t l_start;
88 loff_t l_len;
89 pid_t l_pid;
90};
91
92#define F_LINUX_SPECIFIC_BASE 1024
93#endif
diff --git a/include/asm-ppc/futex.h b/include/asm-ppc/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-ppc/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-ppc/hdreg.h b/include/asm-ppc/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-ppc/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
index 21e41c9b7267..e5374be86aef 100644
--- a/include/asm-ppc/ibm44x.h
+++ b/include/asm-ppc/ibm44x.h
@@ -423,11 +423,7 @@
423#define MQ0_CONFIG_SIZE_2G 0x0000c000 423#define MQ0_CONFIG_SIZE_2G 0x0000c000
424 424
425/* Internal SRAM Controller 440GX/440SP */ 425/* Internal SRAM Controller 440GX/440SP */
426#ifdef CONFIG_440SP
427#define DCRN_SRAM0_BASE 0x100
428#else /* 440GX */
429#define DCRN_SRAM0_BASE 0x000 426#define DCRN_SRAM0_BASE 0x000
430#endif
431 427
432#define DCRN_SRAM0_SB0CR (DCRN_SRAM0_BASE + 0x020) 428#define DCRN_SRAM0_SB0CR (DCRN_SRAM0_BASE + 0x020)
433#define DCRN_SRAM0_SB1CR (DCRN_SRAM0_BASE + 0x021) 429#define DCRN_SRAM0_SB1CR (DCRN_SRAM0_BASE + 0x021)
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index e807be96e981..e992369cb8e9 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -19,10 +19,6 @@
19 19
20#ifdef CONFIG_40x 20#ifdef CONFIG_40x
21 21
22#if defined(CONFIG_ASH)
23#include <platforms/4xx/ash.h>
24#endif
25
26#if defined(CONFIG_BUBINGA) 22#if defined(CONFIG_BUBINGA)
27#include <platforms/4xx/bubinga.h> 23#include <platforms/4xx/bubinga.h>
28#endif 24#endif
@@ -35,14 +31,6 @@
35#include <platforms/4xx/ep405.h> 31#include <platforms/4xx/ep405.h>
36#endif 32#endif
37 33
38#if defined(CONFIG_OAK)
39#include <platforms/4xx/oak.h>
40#endif
41
42#if defined(CONFIG_REDWOOD_4)
43#include <platforms/4xx/redwood.h>
44#endif
45
46#if defined(CONFIG_REDWOOD_5) 34#if defined(CONFIG_REDWOOD_5)
47#include <platforms/4xx/redwood5.h> 35#include <platforms/4xx/redwood5.h>
48#endif 36#endif
diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h
index 3f7b5669e6d5..6f10a25bd628 100644
--- a/include/asm-ppc/ibm_ocp.h
+++ b/include/asm-ppc/ibm_ocp.h
@@ -67,6 +67,7 @@ struct ocp_func_emac_data {
67 int phy_mode; /* PHY type or configurable mode */ 67 int phy_mode; /* PHY type or configurable mode */
68 u8 mac_addr[6]; /* EMAC mac address */ 68 u8 mac_addr[6]; /* EMAC mac address */
69 u32 phy_map; /* EMAC phy map */ 69 u32 phy_map; /* EMAC phy map */
70 u32 phy_feat_exc; /* Excluded PHY features */
70}; 71};
71 72
72/* Sysfs support */ 73/* Sysfs support */
@@ -83,6 +84,7 @@ OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mdio_idx) \
83OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, tah_idx) \ 84OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, tah_idx) \
84OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, phy_mode) \ 85OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, phy_mode) \
85OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "0x%08x\n", emac, phy_map) \ 86OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "0x%08x\n", emac, phy_map) \
87OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "0x%08x\n", emac, phy_feat_exc)\
86 \ 88 \
87void ocp_show_emac_data(struct device *dev) \ 89void ocp_show_emac_data(struct device *dev) \
88{ \ 90{ \
@@ -98,8 +100,22 @@ void ocp_show_emac_data(struct device *dev) \
98 device_create_file(dev, &dev_attr_emac_tah_idx); \ 100 device_create_file(dev, &dev_attr_emac_tah_idx); \
99 device_create_file(dev, &dev_attr_emac_phy_mode); \ 101 device_create_file(dev, &dev_attr_emac_phy_mode); \
100 device_create_file(dev, &dev_attr_emac_phy_map); \ 102 device_create_file(dev, &dev_attr_emac_phy_map); \
103 device_create_file(dev, &dev_attr_emac_phy_feat_exc); \
101} 104}
102 105
106/*
107 * PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY)
108 */
109#define PHY_MODE_NA 0
110#define PHY_MODE_MII 1
111#define PHY_MODE_RMII 2
112#define PHY_MODE_SMII 3
113#define PHY_MODE_RGMII 4
114#define PHY_MODE_TBI 5
115#define PHY_MODE_GMII 6
116#define PHY_MODE_RTBI 7
117#define PHY_MODE_SGMII 8
118
103#ifdef CONFIG_40x 119#ifdef CONFIG_40x
104/* 120/*
105 * Helper function to copy MAC addresses from the bd_t to OCP EMAC 121 * Helper function to copy MAC addresses from the bd_t to OCP EMAC
@@ -133,6 +149,7 @@ struct ocp_func_mal_data {
133 int txde_irq; /* TX Descriptor Error IRQ */ 149 int txde_irq; /* TX Descriptor Error IRQ */
134 int rxde_irq; /* RX Descriptor Error IRQ */ 150 int rxde_irq; /* RX Descriptor Error IRQ */
135 int serr_irq; /* MAL System Error IRQ */ 151 int serr_irq; /* MAL System Error IRQ */
152 int dcr_base; /* MALx_CFG DCR number */
136}; 153};
137 154
138#define OCP_SYSFS_MAL_DATA() \ 155#define OCP_SYSFS_MAL_DATA() \
@@ -143,6 +160,7 @@ OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxeob_irq) \
143OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, txde_irq) \ 160OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, txde_irq) \
144OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxde_irq) \ 161OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxde_irq) \
145OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, serr_irq) \ 162OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, serr_irq) \
163OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, dcr_base) \
146 \ 164 \
147void ocp_show_mal_data(struct device *dev) \ 165void ocp_show_mal_data(struct device *dev) \
148{ \ 166{ \
@@ -153,6 +171,7 @@ void ocp_show_mal_data(struct device *dev) \
153 device_create_file(dev, &dev_attr_mal_txde_irq); \ 171 device_create_file(dev, &dev_attr_mal_txde_irq); \
154 device_create_file(dev, &dev_attr_mal_rxde_irq); \ 172 device_create_file(dev, &dev_attr_mal_rxde_irq); \
155 device_create_file(dev, &dev_attr_mal_serr_irq); \ 173 device_create_file(dev, &dev_attr_mal_serr_irq); \
174 device_create_file(dev, &dev_attr_mal_dcr_base); \
156} 175}
157 176
158/* 177/*
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h
index a9b33324f562..b4b270457edd 100644
--- a/include/asm-ppc/irq.h
+++ b/include/asm-ppc/irq.h
@@ -19,6 +19,11 @@
19#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */ 19#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */
20#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */ 20#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */
21 21
22/*
23 * IRQ line status macro IRQ_PER_CPU is used
24 */
25#define ARCH_HAS_IRQ_PER_CPU
26
22#if defined(CONFIG_40x) 27#if defined(CONFIG_40x)
23#include <asm/ibm4xx.h> 28#include <asm/ibm4xx.h>
24 29
@@ -337,6 +342,7 @@ static __inline__ int irq_canonicalize(int irq)
337#define SIU_INT_IDMA3 ((uint)0x08 + CPM_IRQ_OFFSET) 342#define SIU_INT_IDMA3 ((uint)0x08 + CPM_IRQ_OFFSET)
338#define SIU_INT_IDMA4 ((uint)0x09 + CPM_IRQ_OFFSET) 343#define SIU_INT_IDMA4 ((uint)0x09 + CPM_IRQ_OFFSET)
339#define SIU_INT_SDMA ((uint)0x0a + CPM_IRQ_OFFSET) 344#define SIU_INT_SDMA ((uint)0x0a + CPM_IRQ_OFFSET)
345#define SIU_INT_USB ((uint)0x0b + CPM_IRQ_OFFSET)
340#define SIU_INT_TIMER1 ((uint)0x0c + CPM_IRQ_OFFSET) 346#define SIU_INT_TIMER1 ((uint)0x0c + CPM_IRQ_OFFSET)
341#define SIU_INT_TIMER2 ((uint)0x0d + CPM_IRQ_OFFSET) 347#define SIU_INT_TIMER2 ((uint)0x0d + CPM_IRQ_OFFSET)
342#define SIU_INT_TIMER3 ((uint)0x0e + CPM_IRQ_OFFSET) 348#define SIU_INT_TIMER3 ((uint)0x0e + CPM_IRQ_OFFSET)
diff --git a/include/asm-ppc/kmap_types.h b/include/asm-ppc/kmap_types.h
index 2589f182a6ad..6d6fc78731e5 100644
--- a/include/asm-ppc/kmap_types.h
+++ b/include/asm-ppc/kmap_types.h
@@ -17,6 +17,7 @@ enum km_type {
17 KM_SOFTIRQ0, 17 KM_SOFTIRQ0,
18 KM_SOFTIRQ1, 18 KM_SOFTIRQ1,
19 KM_PPC_SYNC_PAGE, 19 KM_PPC_SYNC_PAGE,
20 KM_PPC_SYNC_ICACHE,
20 KM_TYPE_NR 21 KM_TYPE_NR
21}; 22};
22 23
diff --git a/include/asm-ppc/local.h b/include/asm-ppc/local.h
deleted file mode 100644
index b08e3eced10e..000000000000
--- a/include/asm-ppc/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PPC_LOCAL_H
2#define __PPC_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif /* __PPC_LOCAL_H */
diff --git a/include/asm-ppc/mc146818rtc.h b/include/asm-ppc/mc146818rtc.h
deleted file mode 100644
index 227018b2fef8..000000000000
--- a/include/asm-ppc/mc146818rtc.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifdef __KERNEL__
5#ifndef __ASM_PPC_MC146818RTC_H
6#define __ASM_PPC_MC146818RTC_H
7
8#include <asm/io.h>
9
10#ifndef RTC_PORT
11#define RTC_PORT(x) (0x70 + (x))
12#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
13#endif
14
15/*
16 * The yet supported machines all access the RTC index register via
17 * an ISA port access but the way to access the date register differs ...
18 */
19#define CMOS_READ(addr) ({ \
20outb_p((addr),RTC_PORT(0)); \
21inb_p(RTC_PORT(1)); \
22})
23#define CMOS_WRITE(val, addr) ({ \
24outb_p((addr),RTC_PORT(0)); \
25outb_p((val),RTC_PORT(1)); \
26})
27
28#define RTC_IRQ 8
29
30#endif /* __ASM_PPC_MC146818RTC_H */
31#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/mman.h b/include/asm-ppc/mman.h
deleted file mode 100644
index 5fd19fd4936c..000000000000
--- a/include/asm-ppc/mman.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef __PPC_MMAN_H__
2#define __PPC_MMAN_H__
3
4#define PROT_READ 0x1 /* page can be read */
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
18#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
19#define MAP_LOCKED 0x80
20
21#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
22#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
23#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
24#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
25#define MAP_NONBLOCK 0x10000 /* do not block on IO */
26
27#define MS_ASYNC 1 /* sync memory asynchronously */
28#define MS_INVALIDATE 2 /* invalidate the caches */
29#define MS_SYNC 4 /* synchronous memory sync */
30
31#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
32#define MCL_FUTURE 0x4000 /* lock all additions to address space */
33
34#define MADV_NORMAL 0x0 /* default page-in behavior */
35#define MADV_RANDOM 0x1 /* page-in minimum required */
36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
37#define MADV_WILLNEED 0x3 /* pre-fault pages */
38#define MADV_DONTNEED 0x4 /* discard these pages */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __PPC_MMAN_H__ */
diff --git a/include/asm-ppc/module.h b/include/asm-ppc/module.h
deleted file mode 100644
index fb63492562b0..000000000000
--- a/include/asm-ppc/module.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _ASM_PPC_MODULE_H
2#define _ASM_PPC_MODULE_H
3/* Module stuff for PPC. (C) 2001 Rusty Russell */
4
5#include <linux/list.h>
6#include <asm/bug.h>
7
8/* Thanks to Paul M for explaining this.
9
10 PPC can only do rel jumps += 32MB, and often the kernel and other
11 modules are furthur away than this. So, we jump to a table of
12 trampolines attached to the module (the Procedure Linkage Table)
13 whenever that happens.
14*/
15
16struct ppc_plt_entry
17{
18 /* 16 byte jump instruction sequence (4 instructions) */
19 unsigned int jump[4];
20};
21
22struct mod_arch_specific
23{
24 /* Indices of PLT sections within module. */
25 unsigned int core_plt_section, init_plt_section;
26
27 /* List of BUG addresses, source line numbers and filenames */
28 struct list_head bug_list;
29 struct bug_entry *bug_table;
30 unsigned int num_bugs;
31};
32
33extern struct bug_entry *module_find_bug(unsigned long bugaddr);
34
35#define Elf_Shdr Elf32_Shdr
36#define Elf_Sym Elf32_Sym
37#define Elf_Ehdr Elf32_Ehdr
38
39/* Make empty sections for module_frob_arch_sections to expand. */
40#ifdef MODULE
41asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
42asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
43#endif
44#endif /* _ASM_PPC_MODULE_H */
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h
index 89eb8a2ac693..9694eca16e92 100644
--- a/include/asm-ppc/mpc8260.h
+++ b/include/asm-ppc/mpc8260.h
@@ -67,6 +67,24 @@
67#define IO_VIRT_ADDR IO_PHYS_ADDR 67#define IO_VIRT_ADDR IO_PHYS_ADDR
68#endif 68#endif
69 69
70enum ppc_sys_devices {
71 MPC82xx_CPM_FCC1,
72 MPC82xx_CPM_FCC2,
73 MPC82xx_CPM_FCC3,
74 MPC82xx_CPM_I2C,
75 MPC82xx_CPM_SCC1,
76 MPC82xx_CPM_SCC2,
77 MPC82xx_CPM_SCC3,
78 MPC82xx_CPM_SCC4,
79 MPC82xx_CPM_SPI,
80 MPC82xx_CPM_MCC1,
81 MPC82xx_CPM_MCC2,
82 MPC82xx_CPM_SMC1,
83 MPC82xx_CPM_SMC2,
84 MPC82xx_CPM_USB,
85 MPC82xx_SEC1,
86};
87
70#ifndef __ASSEMBLY__ 88#ifndef __ASSEMBLY__
71/* The "residual" data board information structure the boot loader 89/* The "residual" data board information structure the boot loader
72 * hands to us. 90 * hands to us.
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h
index 7c31f2d564a1..dc8e59896050 100644
--- a/include/asm-ppc/mpc8xx.h
+++ b/include/asm-ppc/mpc8xx.h
@@ -36,10 +36,6 @@
36#include <platforms/tqm8xx.h> 36#include <platforms/tqm8xx.h>
37#endif 37#endif
38 38
39#if defined(CONFIG_SPD823TS)
40#include <platforms/spd8xx.h>
41#endif
42
43#if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24) 39#if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24)
44#include <platforms/ivms8.h> 40#include <platforms/ivms8.h>
45#endif 41#endif
diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h
index cc25b921ad4f..835930d6faa1 100644
--- a/include/asm-ppc/mv64x60.h
+++ b/include/asm-ppc/mv64x60.h
@@ -278,6 +278,13 @@ mv64x60_modify(struct mv64x60_handle *bh, u32 offs, u32 data, u32 mask)
278#define mv64x60_set_bits(bh, offs, bits) mv64x60_modify(bh, offs, ~0, bits) 278#define mv64x60_set_bits(bh, offs, bits) mv64x60_modify(bh, offs, ~0, bits)
279#define mv64x60_clr_bits(bh, offs, bits) mv64x60_modify(bh, offs, 0, bits) 279#define mv64x60_clr_bits(bh, offs, bits) mv64x60_modify(bh, offs, 0, bits)
280 280
281#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
282#define MV64XXX_DEV_NAME "mv64xxx"
283
284struct mv64xxx_pdata {
285 u32 hs_reg_valid;
286};
287#endif
281 288
282/* Externally visible function prototypes */ 289/* Externally visible function prototypes */
283int mv64x60_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si); 290int mv64x60_init(struct mv64x60_handle *bh, struct mv64x60_setup_info *si);
diff --git a/include/asm-ppc/mv64x60_defs.h b/include/asm-ppc/mv64x60_defs.h
index 2f428746c02b..f8f7f16b9b53 100644
--- a/include/asm-ppc/mv64x60_defs.h
+++ b/include/asm-ppc/mv64x60_defs.h
@@ -333,7 +333,7 @@
333/* 333/*
334 ***************************************************************************** 334 *****************************************************************************
335 * 335 *
336 * SRAM Cotnroller Registers 336 * SRAM Controller Registers
337 * 337 *
338 ***************************************************************************** 338 *****************************************************************************
339 */ 339 */
@@ -352,7 +352,7 @@
352/* 352/*
353 ***************************************************************************** 353 *****************************************************************************
354 * 354 *
355 * SDRAM/MEM Cotnroller Registers 355 * SDRAM/MEM Controller Registers
356 * 356 *
357 ***************************************************************************** 357 *****************************************************************************
358 */ 358 */
@@ -375,6 +375,7 @@
375/* SDRAM Control Registers */ 375/* SDRAM Control Registers */
376#define MV64360_D_UNIT_CONTROL_LOW 0x1404 376#define MV64360_D_UNIT_CONTROL_LOW 0x1404
377#define MV64360_D_UNIT_CONTROL_HIGH 0x1424 377#define MV64360_D_UNIT_CONTROL_HIGH 0x1424
378#define MV64460_D_UNIT_MMASK 0x14b0
378 379
379/* SDRAM Error Report Registers (64360) */ 380/* SDRAM Error Report Registers (64360) */
380#define MV64360_SDRAM_ERR_DATA_LO 0x1444 381#define MV64360_SDRAM_ERR_DATA_LO 0x1444
@@ -388,7 +389,7 @@
388/* 389/*
389 ***************************************************************************** 390 *****************************************************************************
390 * 391 *
391 * Device/BOOT Cotnroller Registers 392 * Device/BOOT Controller Registers
392 * 393 *
393 ***************************************************************************** 394 *****************************************************************************
394 */ 395 */
@@ -680,6 +681,8 @@
680#define MV64x60_PCI1_SLAVE_P2P_IO_REMAP 0x0dec 681#define MV64x60_PCI1_SLAVE_P2P_IO_REMAP 0x0dec
681#define MV64x60_PCI1_SLAVE_CPU_REMAP 0x0df0 682#define MV64x60_PCI1_SLAVE_CPU_REMAP 0x0df0
682 683
684#define MV64360_PCICFG_CPCI_HOTSWAP 0x68
685
683/* 686/*
684 ***************************************************************************** 687 *****************************************************************************
685 * 688 *
diff --git a/include/asm-ppc/param.h b/include/asm-ppc/param.h
index b24a4e37196a..6198b1657a45 100644
--- a/include/asm-ppc/param.h
+++ b/include/asm-ppc/param.h
@@ -1,8 +1,10 @@
1#ifndef _ASM_PPC_PARAM_H 1#ifndef _ASM_PPC_PARAM_H
2#define _ASM_PPC_PARAM_H 2#define _ASM_PPC_PARAM_H
3 3
4#include <linux/config.h>
5
4#ifdef __KERNEL__ 6#ifdef __KERNEL__
5#define HZ 1000 /* internal timer frequency */ 7#define HZ CONFIG_HZ /* internal timer frequency */
6#define USER_HZ 100 /* for user interfaces in "ticks" */ 8#define USER_HZ 100 /* for user interfaces in "ticks" */
7#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ 9#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
8#endif /* __KERNEL__ */ 10#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/percpu.h b/include/asm-ppc/percpu.h
deleted file mode 100644
index d66667cd5878..000000000000
--- a/include/asm-ppc/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARCH_PPC_PERCPU__
2#define __ARCH_PPC_PERCPU__
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ARCH_PPC_PERCPU__ */
diff --git a/include/asm-ppc/pmac_feature.h b/include/asm-ppc/pmac_feature.h
index 8beb162873f4..e9683bcff19b 100644
--- a/include/asm-ppc/pmac_feature.h
+++ b/include/asm-ppc/pmac_feature.h
@@ -32,6 +32,7 @@
32#define __PPC_ASM_PMAC_FEATURE_H 32#define __PPC_ASM_PMAC_FEATURE_H
33 33
34#include <asm/macio.h> 34#include <asm/macio.h>
35#include <asm/machdep.h>
35 36
36/* 37/*
37 * Known Mac motherboard models 38 * Known Mac motherboard models
diff --git a/include/asm-ppc/ppc4xx_dma.h b/include/asm-ppc/ppc4xx_dma.h
index 8636cdbf6f8f..a415001165fa 100644
--- a/include/asm-ppc/ppc4xx_dma.h
+++ b/include/asm-ppc/ppc4xx_dma.h
@@ -285,7 +285,7 @@ typedef uint32_t sgl_handle_t;
285 285
286#define GET_DMA_POLARITY(chan) (DMAReq_ActiveLow(chan) | DMAAck_ActiveLow(chan) | EOT_ActiveLow(chan)) 286#define GET_DMA_POLARITY(chan) (DMAReq_ActiveLow(chan) | DMAAck_ActiveLow(chan) | EOT_ActiveLow(chan))
287 287
288#elif defined(CONFIG_STBXXX_DMA) /* stb03xxx */ 288#elif defined(CONFIG_STB03xxx) /* stb03xxx */
289 289
290#define DMA_PPC4xx_SIZE 4096 290#define DMA_PPC4xx_SIZE 4096
291 291
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
index 8ea624566231..048f7c8596ee 100644
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -21,7 +21,9 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/types.h> 22#include <linux/types.h>
23 23
24#if defined(CONFIG_83xx) 24#if defined(CONFIG_8260)
25#include <asm/mpc8260.h>
26#elif defined(CONFIG_83xx)
25#include <asm/mpc83xx.h> 27#include <asm/mpc83xx.h>
26#elif defined(CONFIG_85xx) 28#elif defined(CONFIG_85xx)
27#include <asm/mpc85xx.h> 29#include <asm/mpc85xx.h>
@@ -50,6 +52,7 @@ extern struct ppc_sys_spec *cur_ppc_sys_spec;
50/* determine which specific SOC we are */ 52/* determine which specific SOC we are */
51extern void identify_ppc_sys_by_id(u32 id) __init; 53extern void identify_ppc_sys_by_id(u32 id) __init;
52extern void identify_ppc_sys_by_name(char *name) __init; 54extern void identify_ppc_sys_by_name(char *name) __init;
55extern void identify_ppc_sys_by_name_and_id(char *name, u32 id) __init;
53 56
54/* describes all devices that may exist in a given family of processors */ 57/* describes all devices that may exist in a given family of processors */
55extern struct platform_device ppc_sys_platform_devices[]; 58extern struct platform_device ppc_sys_platform_devices[];
diff --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h
deleted file mode 100644
index 86a1ea23a6ed..000000000000
--- a/include/asm-ppc/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PPC_RESOURCE_H
2#define _PPC_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif
diff --git a/include/asm-ppc/sembuf.h b/include/asm-ppc/sembuf.h
deleted file mode 100644
index 883f682f85b8..000000000000
--- a/include/asm-ppc/sembuf.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _PPC_SEMBUF_H
2#define _PPC_SEMBUF_H
3
4/*
5 * The semid64_ds structure for PPC architecture.
6 */
7
8struct semid64_ds {
9 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
10 unsigned int __unused1;
11 __kernel_time_t sem_otime; /* last semop time */
12 unsigned int __unused2;
13 __kernel_time_t sem_ctime; /* last change time */
14 unsigned long sem_nsems; /* no. of semaphores in array */
15 unsigned long __unused3;
16 unsigned long __unused4;
17};
18
19#endif /* _PPC_SEMBUF_H */
diff --git a/include/asm-ppc/serial.h b/include/asm-ppc/serial.h
index 6d47438be58c..485a924e4d06 100644
--- a/include/asm-ppc/serial.h
+++ b/include/asm-ppc/serial.h
@@ -18,8 +18,6 @@
18#include <platforms/powerpmc250.h> 18#include <platforms/powerpmc250.h>
19#elif defined(CONFIG_LOPEC) 19#elif defined(CONFIG_LOPEC)
20#include <platforms/lopec.h> 20#include <platforms/lopec.h>
21#elif defined(CONFIG_MCPN765)
22#include <platforms/mcpn765.h>
23#elif defined(CONFIG_MVME5100) 21#elif defined(CONFIG_MVME5100)
24#include <platforms/mvme5100.h> 22#include <platforms/mvme5100.h>
25#elif defined(CONFIG_PAL4) 23#elif defined(CONFIG_PAL4)
diff --git a/include/asm-ppc/shmbuf.h b/include/asm-ppc/shmbuf.h
deleted file mode 100644
index 7ac0bd38cbd8..000000000000
--- a/include/asm-ppc/shmbuf.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _PPC_SHMBUF_H
2#define _PPC_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for PPC architecture.
6 */
7
8struct shmid64_ds {
9 struct ipc64_perm shm_perm; /* operation perms */
10 unsigned int __unused1;
11 __kernel_time_t shm_atime; /* last attach time */
12 unsigned int __unused2;
13 __kernel_time_t shm_dtime; /* last detach time */
14 unsigned int __unused3;
15 __kernel_time_t shm_ctime; /* last change time */
16 unsigned int __unused4;
17 size_t shm_segsz; /* size of segment (bytes) */
18 __kernel_pid_t shm_cpid; /* pid of creator */
19 __kernel_pid_t shm_lpid; /* pid of last operator */
20 unsigned long shm_nattch; /* no. of current attaches */
21 unsigned long __unused5;
22 unsigned long __unused6;
23};
24
25struct shminfo64 {
26 unsigned long shmmax;
27 unsigned long shmmin;
28 unsigned long shmmni;
29 unsigned long shmseg;
30 unsigned long shmall;
31 unsigned long __unused1;
32 unsigned long __unused2;
33 unsigned long __unused3;
34 unsigned long __unused4;
35};
36
37#endif /* _PPC_SHMBUF_H */
diff --git a/include/asm-ppc/siginfo.h b/include/asm-ppc/siginfo.h
deleted file mode 100644
index 4b9435bb9049..000000000000
--- a/include/asm-ppc/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PPC_SIGINFO_H
2#define _PPC_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/include/asm-ppc/socket.h b/include/asm-ppc/socket.h
deleted file mode 100644
index 4134376b0f66..000000000000
--- a/include/asm-ppc/socket.h
+++ /dev/null
@@ -1,56 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */
11
12/* For setsockopt(2) */
13#define SOL_SOCKET 1
14
15#define SO_DEBUG 1
16#define SO_REUSEADDR 2
17#define SO_TYPE 3
18#define SO_ERROR 4
19#define SO_DONTROUTE 5
20#define SO_BROADCAST 6
21#define SO_SNDBUF 7
22#define SO_RCVBUF 8
23#define SO_KEEPALIVE 9
24#define SO_OOBINLINE 10
25#define SO_NO_CHECK 11
26#define SO_PRIORITY 12
27#define SO_LINGER 13
28#define SO_BSDCOMPAT 14
29/* To add :#define SO_REUSEPORT 15 */
30#define SO_RCVLOWAT 16
31#define SO_SNDLOWAT 17
32#define SO_RCVTIMEO 18
33#define SO_SNDTIMEO 19
34#define SO_PASSCRED 20
35#define SO_PEERCRED 21
36
37/* Security levels - as per NRL IPv6 - don't actually do anything */
38#define SO_SECURITY_AUTHENTICATION 22
39#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
40#define SO_SECURITY_ENCRYPTION_NETWORK 24
41
42#define SO_BINDTODEVICE 25
43
44/* Socket filtering */
45#define SO_ATTACH_FILTER 26
46#define SO_DETACH_FILTER 27
47
48#define SO_PEERNAME 28
49#define SO_TIMESTAMP 29
50#define SCM_TIMESTAMP SO_TIMESTAMP
51
52#define SO_ACCEPTCONN 30
53
54#define SO_PEERSEC 31
55
56#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-ppc/sockios.h b/include/asm-ppc/sockios.h
deleted file mode 100644
index 385aedc55ceb..000000000000
--- a/include/asm-ppc/sockios.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_PPC_SOCKIOS_H
2#define _ASM_PPC_SOCKIOS_H
3
4#if 0 /* These are defined this way on Alpha - maybe later. */
5/* Socket-level I/O control calls. */
6
7#define FIOGETOWN _IOR('f', 123, int)
8#define FIOSETOWN _IOW('f', 124, int)
9
10#define SIOCATMARK _IOR('s', 7, int)
11#define SIOCSPGRP _IOW('s', 8, pid_t)
12#define SIOCGPGRP _IOR('s', 9, pid_t)
13
14#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */
15#endif
16
17#endif /* _ASM_PPC_SOCKIOS_H */
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index 82395f30004b..513a334c5810 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -84,9 +84,14 @@ extern void cvt_fd(float *from, double *to, unsigned long *fpscr);
84extern void cvt_df(double *from, float *to, unsigned long *fpscr); 84extern void cvt_df(double *from, float *to, unsigned long *fpscr);
85extern int call_rtas(const char *, int, int, unsigned long *, ...); 85extern int call_rtas(const char *, int, int, unsigned long *, ...);
86extern void cacheable_memzero(void *p, unsigned int nb); 86extern void cacheable_memzero(void *p, unsigned int nb);
87extern void *cacheable_memcpy(void *, const void *, unsigned int);
87extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); 88extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
88extern void bad_page_fault(struct pt_regs *, unsigned long, int); 89extern void bad_page_fault(struct pt_regs *, unsigned long, int);
89extern void die(const char *, struct pt_regs *, long); 90extern void die(const char *, struct pt_regs *, long);
91#ifdef CONFIG_BOOKE_WDT
92extern u32 booke_wdt_enabled;
93extern u32 booke_wdt_period;
94#endif /* CONFIG_BOOKE_WDT */
90 95
91struct device_node; 96struct device_node;
92extern void note_scsi_host(struct device_node *, void *); 97extern void note_scsi_host(struct device_node *, void *);
diff --git a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h
deleted file mode 100644
index c343fb7bdfed..000000000000
--- a/include/asm-ppc/termbits.h
+++ /dev/null
@@ -1,185 +0,0 @@
1#ifndef _PPC_TERMBITS_H
2#define _PPC_TERMBITS_H
3
4typedef unsigned char cc_t;
5typedef unsigned int speed_t;
6typedef unsigned int tcflag_t;
7
8/*
9 * termios type and macro definitions. Be careful about adding stuff
10 * to this file since it's used in GNU libc and there are strict rules
11 * concerning namespace pollution.
12 */
13
14#define NCCS 19
15struct termios {
16 tcflag_t c_iflag; /* input mode flags */
17 tcflag_t c_oflag; /* output mode flags */
18 tcflag_t c_cflag; /* control mode flags */
19 tcflag_t c_lflag; /* local mode flags */
20 cc_t c_cc[NCCS]; /* control characters */
21 cc_t c_line; /* line discipline (== c_cc[19]) */
22 speed_t c_ispeed; /* input speed */
23 speed_t c_ospeed; /* output speed */
24};
25
26/* c_cc characters */
27#define VINTR 0
28#define VQUIT 1
29#define VERASE 2
30#define VKILL 3
31#define VEOF 4
32#define VMIN 5
33#define VEOL 6
34#define VTIME 7
35#define VEOL2 8
36#define VSWTC 9
37
38#define VWERASE 10
39#define VREPRINT 11
40#define VSUSP 12
41#define VSTART 13
42#define VSTOP 14
43#define VLNEXT 15
44#define VDISCARD 16
45
46/* c_iflag bits */
47#define IGNBRK 0000001
48#define BRKINT 0000002
49#define IGNPAR 0000004
50#define PARMRK 0000010
51#define INPCK 0000020
52#define ISTRIP 0000040
53#define INLCR 0000100
54#define IGNCR 0000200
55#define ICRNL 0000400
56#define IXON 0001000
57#define IXOFF 0002000
58#define IXANY 0004000
59#define IUCLC 0010000
60#define IMAXBEL 0020000
61#define IUTF8 0040000
62
63/* c_oflag bits */
64#define OPOST 0000001
65#define ONLCR 0000002
66#define OLCUC 0000004
67
68#define OCRNL 0000010
69#define ONOCR 0000020
70#define ONLRET 0000040
71
72#define OFILL 00000100
73#define OFDEL 00000200
74#define NLDLY 00001400
75#define NL0 00000000
76#define NL1 00000400
77#define NL2 00001000
78#define NL3 00001400
79#define TABDLY 00006000
80#define TAB0 00000000
81#define TAB1 00002000
82#define TAB2 00004000
83#define TAB3 00006000
84#define XTABS 00006000 /* required by POSIX to == TAB3 */
85#define CRDLY 00030000
86#define CR0 00000000
87#define CR1 00010000
88#define CR2 00020000
89#define CR3 00030000
90#define FFDLY 00040000
91#define FF0 00000000
92#define FF1 00040000
93#define BSDLY 00100000
94#define BS0 00000000
95#define BS1 00100000
96#define VTDLY 00200000
97#define VT0 00000000
98#define VT1 00200000
99
100/* c_cflag bit meaning */
101#define CBAUD 0000377
102#define B0 0000000 /* hang up */
103#define B50 0000001
104#define B75 0000002
105#define B110 0000003
106#define B134 0000004
107#define B150 0000005
108#define B200 0000006
109#define B300 0000007
110#define B600 0000010
111#define B1200 0000011
112#define B1800 0000012
113#define B2400 0000013
114#define B4800 0000014
115#define B9600 0000015
116#define B19200 0000016
117#define B38400 0000017
118#define EXTA B19200
119#define EXTB B38400
120#define CBAUDEX 0000000
121#define B57600 00020
122#define B115200 00021
123#define B230400 00022
124#define B460800 00023
125#define B500000 00024
126#define B576000 00025
127#define B921600 00026
128#define B1000000 00027
129#define B1152000 00030
130#define B1500000 00031
131#define B2000000 00032
132#define B2500000 00033
133#define B3000000 00034
134#define B3500000 00035
135#define B4000000 00036
136
137#define CSIZE 00001400
138#define CS5 00000000
139#define CS6 00000400
140#define CS7 00001000
141#define CS8 00001400
142
143#define CSTOPB 00002000
144#define CREAD 00004000
145#define PARENB 00010000
146#define PARODD 00020000
147#define HUPCL 00040000
148
149#define CLOCAL 00100000
150#define CRTSCTS 020000000000 /* flow control */
151
152/* c_lflag bits */
153#define ISIG 0x00000080
154#define ICANON 0x00000100
155#define XCASE 0x00004000
156#define ECHO 0x00000008
157#define ECHOE 0x00000002
158#define ECHOK 0x00000004
159#define ECHONL 0x00000010
160#define NOFLSH 0x80000000
161#define TOSTOP 0x00400000
162#define ECHOCTL 0x00000040
163#define ECHOPRT 0x00000020
164#define ECHOKE 0x00000001
165#define FLUSHO 0x00800000
166#define PENDIN 0x20000000
167#define IEXTEN 0x00000400
168
169/* Values for the ACTION argument to `tcflow'. */
170#define TCOOFF 0
171#define TCOON 1
172#define TCIOFF 2
173#define TCION 3
174
175/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
176#define TCIFLUSH 0
177#define TCOFLUSH 1
178#define TCIOFLUSH 2
179
180/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
181#define TCSANOW 0
182#define TCSADRAIN 1
183#define TCSAFLUSH 2
184
185#endif /* _PPC_TERMBITS_H */
diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h
deleted file mode 100644
index 97c6287a6cba..000000000000
--- a/include/asm-ppc/termios.h
+++ /dev/null
@@ -1,232 +0,0 @@
1#ifndef _PPC_TERMIOS_H
2#define _PPC_TERMIOS_H
3
4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
6 * fields have been reordered so that termio & termios share the
7 * common subset in the same order (for brain dead programs that don't
8 * know or care about the differences).
9 */
10
11#include <asm/ioctls.h>
12#include <asm/termbits.h>
13
14struct sgttyb {
15 char sg_ispeed;
16 char sg_ospeed;
17 char sg_erase;
18 char sg_kill;
19 short sg_flags;
20};
21
22struct tchars {
23 char t_intrc;
24 char t_quitc;
25 char t_startc;
26 char t_stopc;
27 char t_eofc;
28 char t_brkc;
29};
30
31struct ltchars {
32 char t_suspc;
33 char t_dsuspc;
34 char t_rprntc;
35 char t_flushc;
36 char t_werasc;
37 char t_lnextc;
38};
39
40#define FIOCLEX _IO('f', 1)
41#define FIONCLEX _IO('f', 2)
42#define FIOASYNC _IOW('f', 125, int)
43#define FIONBIO _IOW('f', 126, int)
44#define FIONREAD _IOR('f', 127, int)
45#define TIOCINQ FIONREAD
46#define FIOQSIZE _IOR('f', 128, loff_t)
47
48#define TIOCGETP _IOR('t', 8, struct sgttyb)
49#define TIOCSETP _IOW('t', 9, struct sgttyb)
50#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
51
52#define TIOCSETC _IOW('t', 17, struct tchars)
53#define TIOCGETC _IOR('t', 18, struct tchars)
54#define TCGETS _IOR('t', 19, struct termios)
55#define TCSETS _IOW('t', 20, struct termios)
56#define TCSETSW _IOW('t', 21, struct termios)
57#define TCSETSF _IOW('t', 22, struct termios)
58
59#define TCGETA _IOR('t', 23, struct termio)
60#define TCSETA _IOW('t', 24, struct termio)
61#define TCSETAW _IOW('t', 25, struct termio)
62#define TCSETAF _IOW('t', 28, struct termio)
63
64#define TCSBRK _IO('t', 29)
65#define TCXONC _IO('t', 30)
66#define TCFLSH _IO('t', 31)
67
68#define TIOCSWINSZ _IOW('t', 103, struct winsize)
69#define TIOCGWINSZ _IOR('t', 104, struct winsize)
70#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
71#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
72#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
73
74#define TIOCGLTC _IOR('t', 116, struct ltchars)
75#define TIOCSLTC _IOW('t', 117, struct ltchars)
76#define TIOCSPGRP _IOW('t', 118, int)
77#define TIOCGPGRP _IOR('t', 119, int)
78
79#define TIOCEXCL 0x540C
80#define TIOCNXCL 0x540D
81#define TIOCSCTTY 0x540E
82
83#define TIOCSTI 0x5412
84#define TIOCMGET 0x5415
85#define TIOCMBIS 0x5416
86#define TIOCMBIC 0x5417
87#define TIOCMSET 0x5418
88#define TIOCGSOFTCAR 0x5419
89#define TIOCSSOFTCAR 0x541A
90#define TIOCLINUX 0x541C
91#define TIOCCONS 0x541D
92#define TIOCGSERIAL 0x541E
93#define TIOCSSERIAL 0x541F
94#define TIOCPKT 0x5420
95
96#define TIOCNOTTY 0x5422
97#define TIOCSETD 0x5423
98#define TIOCGETD 0x5424
99#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
100
101#define TIOCSERCONFIG 0x5453
102#define TIOCSERGWILD 0x5454
103#define TIOCSERSWILD 0x5455
104#define TIOCGLCKTRMIOS 0x5456
105#define TIOCSLCKTRMIOS 0x5457
106#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
107#define TIOCSERGETLSR 0x5459 /* Get line status register */
108#define TIOCSERGETMULTI 0x545A /* Get multiport config */
109#define TIOCSERSETMULTI 0x545B /* Set multiport config */
110
111#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
112#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
113
114/* Used for packet mode */
115#define TIOCPKT_DATA 0
116#define TIOCPKT_FLUSHREAD 1
117#define TIOCPKT_FLUSHWRITE 2
118#define TIOCPKT_STOP 4
119#define TIOCPKT_START 8
120#define TIOCPKT_NOSTOP 16
121#define TIOCPKT_DOSTOP 32
122
123struct winsize {
124 unsigned short ws_row;
125 unsigned short ws_col;
126 unsigned short ws_xpixel;
127 unsigned short ws_ypixel;
128};
129
130#define NCC 10
131struct termio {
132 unsigned short c_iflag; /* input mode flags */
133 unsigned short c_oflag; /* output mode flags */
134 unsigned short c_cflag; /* control mode flags */
135 unsigned short c_lflag; /* local mode flags */
136 unsigned char c_line; /* line discipline */
137 unsigned char c_cc[NCC]; /* control characters */
138};
139
140/* c_cc characters */
141#define _VINTR 0
142#define _VQUIT 1
143#define _VERASE 2
144#define _VKILL 3
145#define _VEOF 4
146#define _VMIN 5
147#define _VEOL 6
148#define _VTIME 7
149#define _VEOL2 8
150#define _VSWTC 9
151
152#ifdef __KERNEL__
153/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
154#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
155#endif /* __KERNEL__ */
156
157/* modem lines */
158#define TIOCM_LE 0x001
159#define TIOCM_DTR 0x002
160#define TIOCM_RTS 0x004
161#define TIOCM_ST 0x008
162#define TIOCM_SR 0x010
163#define TIOCM_CTS 0x020
164#define TIOCM_CAR 0x040
165#define TIOCM_RNG 0x080
166#define TIOCM_DSR 0x100
167#define TIOCM_CD TIOCM_CAR
168#define TIOCM_RI TIOCM_RNG
169#define TIOCM_OUT1 0x2000
170#define TIOCM_OUT2 0x4000
171#define TIOCM_LOOP 0x8000
172
173/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
174#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
175
176/* line disciplines */
177#define N_TTY 0
178#define N_SLIP 1
179#define N_MOUSE 2
180#define N_PPP 3
181#define N_STRIP 4
182#define N_AX25 5
183#define N_X25 6 /* X.25 async */
184#define N_6PACK 7
185#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
186#define N_R3964 9 /* Reserved for Simatic R3964 module */
187#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
188#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
189#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
190#define N_HDLC 13 /* synchronous HDLC */
191#define N_SYNC_PPP 14
192#define N_HCI 15 /* Bluetooth HCI UART */
193
194#ifdef __KERNEL__
195
196/*
197 * Translate a "termio" structure into a "termios". Ugh.
198 */
199#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
200 unsigned short __tmp; \
201 get_user(__tmp,&(termio)->x); \
202 (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
203}
204
205#define user_termio_to_kernel_termios(termios, termio) \
206({ \
207 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
208 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
209 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
210 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
211 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
212})
213
214/*
215 * Translate a "termios" structure into a "termio". Ugh.
216 */
217#define kernel_termios_to_user_termio(termio, termios) \
218({ \
219 put_user((termios)->c_iflag, &(termio)->c_iflag); \
220 put_user((termios)->c_oflag, &(termio)->c_oflag); \
221 put_user((termios)->c_cflag, &(termio)->c_cflag); \
222 put_user((termios)->c_lflag, &(termio)->c_lflag); \
223 put_user((termios)->c_line, &(termio)->c_line); \
224 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
225})
226
227#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
228#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
229
230#endif /* __KERNEL__ */
231
232#endif /* _PPC_TERMIOS_H */
diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h
index ce09b47fa819..321fb75b5f22 100644
--- a/include/asm-ppc/time.h
+++ b/include/asm-ppc/time.h
@@ -58,7 +58,7 @@ static __inline__ void set_dec(unsigned int val)
58/* Accessor functions for the timebase (RTC on 601) registers. */ 58/* Accessor functions for the timebase (RTC on 601) registers. */
59/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */ 59/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
60#ifdef CONFIG_6xx 60#ifdef CONFIG_6xx
61extern __inline__ int const __USE_RTC(void) { 61extern __inline__ int __attribute_pure__ __USE_RTC(void) {
62 return (mfspr(SPRN_PVR)>>16) == 1; 62 return (mfspr(SPRN_PVR)>>16) == 1;
63} 63}
64#else 64#else
diff --git a/include/asm-ppc/types.h b/include/asm-ppc/types.h
index a787bc032587..77dc24d7d2ad 100644
--- a/include/asm-ppc/types.h
+++ b/include/asm-ppc/types.h
@@ -62,8 +62,6 @@ typedef u64 sector_t;
62#define HAVE_SECTOR_T 62#define HAVE_SECTOR_T
63#endif 63#endif
64 64
65typedef unsigned int kmem_bufctl_t;
66
67#endif /* __ASSEMBLY__ */ 65#endif /* __ASSEMBLY__ */
68 66
69#endif /* __KERNEL__ */ 67#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/uaccess.h b/include/asm-ppc/uaccess.h
index b044ae03ac56..63f56224da8c 100644
--- a/include/asm-ppc/uaccess.h
+++ b/include/asm-ppc/uaccess.h
@@ -37,13 +37,6 @@
37#define access_ok(type, addr, size) \ 37#define access_ok(type, addr, size) \
38 (__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size))) 38 (__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size)))
39 39
40/* this function will go away soon - use access_ok() instead */
41extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
42{
43 return access_ok(type, addr, size) ? 0 : -EFAULT;
44}
45
46
47/* 40/*
48 * The exception table consists of pairs of addresses: the first is the 41 * The exception table consists of pairs of addresses: the first is the
49 * address of an instruction that is allowed to fault, and the second is 42 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-ppc64/abs_addr.h b/include/asm-ppc64/abs_addr.h
index 6d4e8e787058..84c24d4cdb71 100644
--- a/include/asm-ppc64/abs_addr.h
+++ b/include/asm-ppc64/abs_addr.h
@@ -16,93 +16,51 @@
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/lmb.h> 18#include <asm/lmb.h>
19#include <asm/firmware.h>
19 20
20typedef u32 msChunks_entry; 21struct mschunks_map {
21struct msChunks {
22 unsigned long num_chunks; 22 unsigned long num_chunks;
23 unsigned long chunk_size; 23 unsigned long chunk_size;
24 unsigned long chunk_shift; 24 unsigned long chunk_shift;
25 unsigned long chunk_mask; 25 unsigned long chunk_mask;
26 msChunks_entry *abs; 26 u32 *mapping;
27}; 27};
28 28
29extern struct msChunks msChunks; 29extern struct mschunks_map mschunks_map;
30 30
31extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); 31/* Chunks are 256 KB */
32extern unsigned long reloc_offset(void); 32#define MSCHUNKS_CHUNK_SHIFT (18)
33#define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT)
34#define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1)
33 35
34#ifdef CONFIG_MSCHUNKS 36static inline unsigned long chunk_to_addr(unsigned long chunk)
35
36static inline unsigned long
37chunk_to_addr(unsigned long chunk)
38{ 37{
39 unsigned long offset = reloc_offset(); 38 return chunk << MSCHUNKS_CHUNK_SHIFT;
40 struct msChunks *_msChunks = PTRRELOC(&msChunks);
41
42 return chunk << _msChunks->chunk_shift;
43} 39}
44 40
45static inline unsigned long 41static inline unsigned long addr_to_chunk(unsigned long addr)
46addr_to_chunk(unsigned long addr)
47{ 42{
48 unsigned long offset = reloc_offset(); 43 return addr >> MSCHUNKS_CHUNK_SHIFT;
49 struct msChunks *_msChunks = PTRRELOC(&msChunks);
50
51 return addr >> _msChunks->chunk_shift;
52} 44}
53 45
54static inline unsigned long 46static inline unsigned long phys_to_abs(unsigned long pa)
55chunk_offset(unsigned long addr)
56{ 47{
57 unsigned long offset = reloc_offset(); 48 unsigned long chunk;
58 struct msChunks *_msChunks = PTRRELOC(&msChunks);
59 49
60 return addr & _msChunks->chunk_mask; 50 /* This is a no-op on non-iSeries */
61} 51 if (!firmware_has_feature(FW_FEATURE_ISERIES))
52 return pa;
62 53
63static inline unsigned long 54 chunk = addr_to_chunk(pa);
64abs_chunk(unsigned long pchunk)
65{
66 unsigned long offset = reloc_offset();
67 struct msChunks *_msChunks = PTRRELOC(&msChunks);
68 if ( pchunk >= _msChunks->num_chunks ) {
69 return pchunk;
70 }
71 return PTRRELOC(_msChunks->abs)[pchunk];
72}
73 55
74/* A macro so it can take pointers or unsigned long. */ 56 if (chunk < mschunks_map.num_chunks)
75#define phys_to_abs(pa) \ 57 chunk = mschunks_map.mapping[chunk];
76 ({ unsigned long _pa = (unsigned long)(pa); \
77 chunk_to_addr(abs_chunk(addr_to_chunk(_pa))) + chunk_offset(_pa); \
78 })
79 58
80static inline unsigned long 59 return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK);
81physRpn_to_absRpn(unsigned long rpn)
82{
83 unsigned long pa = rpn << PAGE_SHIFT;
84 unsigned long aa = phys_to_abs(pa);
85 return (aa >> PAGE_SHIFT);
86} 60}
87 61
88/* A macro so it can take pointers or unsigned long. */
89#define abs_to_phys(aa) lmb_abs_to_phys((unsigned long)(aa))
90
91#else /* !CONFIG_MSCHUNKS */
92
93#define chunk_to_addr(chunk) ((unsigned long)(chunk))
94#define addr_to_chunk(addr) (addr)
95#define chunk_offset(addr) (0)
96#define abs_chunk(pchunk) (pchunk)
97
98#define phys_to_abs(pa) (pa)
99#define physRpn_to_absRpn(rpn) (rpn)
100#define abs_to_phys(aa) (aa)
101
102#endif /* !CONFIG_MSCHUNKS */
103
104/* Convenience macros */ 62/* Convenience macros */
105#define virt_to_abs(va) phys_to_abs(__pa(va)) 63#define virt_to_abs(va) phys_to_abs(__pa(va))
106#define abs_to_virt(aa) __va(abs_to_phys(aa)) 64#define abs_to_virt(aa) __va(aa)
107 65
108#endif /* _ABS_ADDR_H */ 66#endif /* _ABS_ADDR_H */
diff --git a/include/asm-ppc64/agp.h b/include/asm-ppc64/agp.h
deleted file mode 100644
index ca9e423307f4..000000000000
--- a/include/asm-ppc64/agp.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef AGP_H
2#define AGP_H 1
3
4#include <asm/io.h>
5
6/* nothing much needed here */
7
8#define map_page_into_agp(page)
9#define unmap_page_from_agp(page)
10#define flush_agp_mappings()
11#define flush_agp_cache() mb()
12
13/* Convert a physical address to an address suitable for the GART. */
14#define phys_to_gart(x) (x)
15#define gart_to_phys(x) (x)
16
17/* GATT allocation. Returns/accepts GATT kernel virtual address. */
18#define alloc_gatt_pages(order) \
19 ((char *)__get_free_pages(GFP_KERNEL, (order)))
20#define free_gatt_pages(table, order) \
21 free_pages((unsigned long)(table), (order))
22
23#endif
diff --git a/include/asm-ppc64/auxvec.h b/include/asm-ppc64/auxvec.h
new file mode 100644
index 000000000000..ac6381a106e1
--- /dev/null
+++ b/include/asm-ppc64/auxvec.h
@@ -0,0 +1,19 @@
1#ifndef __PPC64_AUXVEC_H
2#define __PPC64_AUXVEC_H
3
4/*
5 * We need to put in some extra aux table entries to tell glibc what
6 * the cache block size is, so it can use the dcbz instruction safely.
7 */
8#define AT_DCACHEBSIZE 19
9#define AT_ICACHEBSIZE 20
10#define AT_UCACHEBSIZE 21
11/* A special ignored type value for PPC, for glibc compatibility. */
12#define AT_IGNOREPPC 22
13
14/* The vDSO location. We have to use the same value as x86 for glibc's
15 * sake :-)
16 */
17#define AT_SYSINFO_EHDR 33
18
19#endif /* __PPC64_AUXVEC_H */
diff --git a/include/asm-ppc64/bug.h b/include/asm-ppc64/bug.h
index 169868fa307d..160178278861 100644
--- a/include/asm-ppc64/bug.h
+++ b/include/asm-ppc64/bug.h
@@ -43,8 +43,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
43 ".section __bug_table,\"a\"\n\t" \ 43 ".section __bug_table,\"a\"\n\t" \
44 " .llong 1b,%1,%2,%3\n" \ 44 " .llong 1b,%1,%2,%3\n" \
45 ".previous" \ 45 ".previous" \
46 : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ 46 : : "r" ((long long)(x)), "i" (__LINE__), \
47 "i" (__FUNCTION__)); \ 47 "i" (__FILE__), "i" (__FUNCTION__)); \
48} while (0) 48} while (0)
49 49
50#define WARN_ON(x) do { \ 50#define WARN_ON(x) do { \
@@ -53,7 +53,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
53 ".section __bug_table,\"a\"\n\t" \ 53 ".section __bug_table,\"a\"\n\t" \
54 " .llong 1b,%1,%2,%3\n" \ 54 " .llong 1b,%1,%2,%3\n" \
55 ".previous" \ 55 ".previous" \
56 : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ 56 : : "r" ((long long)(x)), \
57 "i" (__LINE__ + BUG_WARNING_TRAP), \
57 "i" (__FILE__), "i" (__FUNCTION__)); \ 58 "i" (__FILE__), "i" (__FUNCTION__)); \
58} while (0) 59} while (0)
59 60
diff --git a/include/asm-ppc64/bugs.h b/include/asm-ppc64/bugs.h
deleted file mode 100644
index 861074b3cf71..000000000000
--- a/include/asm-ppc64/bugs.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * This file is included by 'init/main.c' to check for architecture-dependent
3 * bugs.
4 *
5 */
6#ifndef _ASM_PPC64_BUGS_H
7#define _ASM_PPC64_BUGS_H
8
9static void check_bugs(void) {
10}
11
12#endif /* _ASM_PPC64_BUGS_H */
diff --git a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h
index 12414f5fc666..6ec62cd2d1d1 100644
--- a/include/asm-ppc64/compat.h
+++ b/include/asm-ppc64/compat.h
@@ -13,8 +13,10 @@ typedef s32 compat_ssize_t;
13typedef s32 compat_time_t; 13typedef s32 compat_time_t;
14typedef s32 compat_clock_t; 14typedef s32 compat_clock_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u32 compat_uid_t; 16typedef u32 __compat_uid_t;
17typedef u32 compat_gid_t; 17typedef u32 __compat_gid_t;
18typedef u32 __compat_uid32_t;
19typedef u32 __compat_gid32_t;
18typedef u32 compat_mode_t; 20typedef u32 compat_mode_t;
19typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
20typedef u32 compat_dev_t; 22typedef u32 compat_dev_t;
@@ -48,8 +50,8 @@ struct compat_stat {
48 compat_ino_t st_ino; 50 compat_ino_t st_ino;
49 compat_mode_t st_mode; 51 compat_mode_t st_mode;
50 compat_nlink_t st_nlink; 52 compat_nlink_t st_nlink;
51 compat_uid_t st_uid; 53 __compat_uid32_t st_uid;
52 compat_gid_t st_gid; 54 __compat_gid32_t st_gid;
53 compat_dev_t st_rdev; 55 compat_dev_t st_rdev;
54 compat_off_t st_size; 56 compat_off_t st_size;
55 compat_off_t st_blksize; 57 compat_off_t st_blksize;
@@ -144,10 +146,10 @@ static inline void __user *compat_alloc_user_space(long len)
144 */ 146 */
145struct compat_ipc64_perm { 147struct compat_ipc64_perm {
146 compat_key_t key; 148 compat_key_t key;
147 compat_uid_t uid; 149 __compat_uid_t uid;
148 compat_gid_t gid; 150 __compat_gid_t gid;
149 compat_uid_t cuid; 151 __compat_uid_t cuid;
150 compat_gid_t cgid; 152 __compat_gid_t cgid;
151 compat_mode_t mode; 153 compat_mode_t mode;
152 unsigned int seq; 154 unsigned int seq;
153 unsigned int __pad2; 155 unsigned int __pad2;
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
index d67fa9e26079..acc9b4d6c168 100644
--- a/include/asm-ppc64/cputable.h
+++ b/include/asm-ppc64/cputable.h
@@ -36,6 +36,7 @@
36 * via the mkdefs mechanism. 36 * via the mkdefs mechanism.
37 */ 37 */
38struct cpu_spec; 38struct cpu_spec;
39struct op_ppc64_model;
39 40
40typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 41typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
41 42
@@ -52,15 +53,19 @@ struct cpu_spec {
52 unsigned int icache_bsize; 53 unsigned int icache_bsize;
53 unsigned int dcache_bsize; 54 unsigned int dcache_bsize;
54 55
56 /* number of performance monitor counters */
57 unsigned int num_pmcs;
58
55 /* this is called to initialize various CPU bits like L1 cache, 59 /* this is called to initialize various CPU bits like L1 cache,
56 * BHT, SPD, etc... from head.S before branching to identify_machine 60 * BHT, SPD, etc... from head.S before branching to identify_machine
57 */ 61 */
58 cpu_setup_t cpu_setup; 62 cpu_setup_t cpu_setup;
59 63
60 /* This is used to identify firmware features which are available 64 /* Used by oprofile userspace to select the right counters */
61 * to the kernel. 65 char *oprofile_cpu_type;
62 */ 66
63 unsigned long firmware_features; 67 /* Processor specific oprofile operations */
68 struct op_ppc64_model *oprofile_model;
64}; 69};
65 70
66extern struct cpu_spec cpu_specs[]; 71extern struct cpu_spec cpu_specs[];
@@ -71,39 +76,6 @@ static inline unsigned long cpu_has_feature(unsigned long feature)
71 return cur_cpu_spec->cpu_features & feature; 76 return cur_cpu_spec->cpu_features & feature;
72} 77}
73 78
74
75/* firmware feature bitmask values */
76#define FIRMWARE_MAX_FEATURES 63
77
78#define FW_FEATURE_PFT (1UL<<0)
79#define FW_FEATURE_TCE (1UL<<1)
80#define FW_FEATURE_SPRG0 (1UL<<2)
81#define FW_FEATURE_DABR (1UL<<3)
82#define FW_FEATURE_COPY (1UL<<4)
83#define FW_FEATURE_ASR (1UL<<5)
84#define FW_FEATURE_DEBUG (1UL<<6)
85#define FW_FEATURE_TERM (1UL<<7)
86#define FW_FEATURE_PERF (1UL<<8)
87#define FW_FEATURE_DUMP (1UL<<9)
88#define FW_FEATURE_INTERRUPT (1UL<<10)
89#define FW_FEATURE_MIGRATE (1UL<<11)
90#define FW_FEATURE_PERFMON (1UL<<12)
91#define FW_FEATURE_CRQ (1UL<<13)
92#define FW_FEATURE_VIO (1UL<<14)
93#define FW_FEATURE_RDMA (1UL<<15)
94#define FW_FEATURE_LLAN (1UL<<16)
95#define FW_FEATURE_BULK (1UL<<17)
96#define FW_FEATURE_XDABR (1UL<<18)
97#define FW_FEATURE_MULTITCE (1UL<<19)
98#define FW_FEATURE_SPLPAR (1UL<<20)
99
100typedef struct {
101 unsigned long val;
102 char * name;
103} firmware_feature_t;
104
105extern firmware_feature_t firmware_features_table[];
106
107#endif /* __ASSEMBLY__ */ 79#endif /* __ASSEMBLY__ */
108 80
109/* CPU kernel features */ 81/* CPU kernel features */
@@ -133,17 +105,15 @@ extern firmware_feature_t firmware_features_table[];
133#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000001000000000) 105#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000001000000000)
134#define CPU_FTR_IABR ASM_CONST(0x0000002000000000) 106#define CPU_FTR_IABR ASM_CONST(0x0000002000000000)
135#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000) 107#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000)
136#define CPU_FTR_PMC8 ASM_CONST(0x0000008000000000) 108/* unused ASM_CONST(0x0000008000000000) */
137#define CPU_FTR_SMT ASM_CONST(0x0000010000000000) 109#define CPU_FTR_SMT ASM_CONST(0x0000010000000000)
138#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 110#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
139#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 111#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
140#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 112#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
141#define CPU_FTR_CTRL ASM_CONST(0x0000100000000000) 113#define CPU_FTR_CTRL ASM_CONST(0x0000100000000000)
142 114
143/* Platform firmware features */
144#define FW_FTR_ ASM_CONST(0x0000000000000001)
145
146#ifndef __ASSEMBLY__ 115#ifndef __ASSEMBLY__
116
147#define COMMON_USER_PPC64 (PPC_FEATURE_32 | PPC_FEATURE_64 | \ 117#define COMMON_USER_PPC64 (PPC_FEATURE_32 | PPC_FEATURE_64 | \
148 PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_MMU) 118 PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_MMU)
149 119
@@ -156,10 +126,9 @@ extern firmware_feature_t firmware_features_table[];
156#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE) 126#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE)
157#else 127#else
158#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE | CPU_FTR_16M_PAGE) 128#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE | CPU_FTR_16M_PAGE)
159#endif 129#endif /* CONFIG_PPC_ISERIES */
160 130
161#define COMMON_PPC64_FW (0) 131#endif /* __ASSEMBLY */
162#endif
163 132
164#ifdef __ASSEMBLY__ 133#ifdef __ASSEMBLY__
165 134
diff --git a/include/asm-ppc64/cputime.h b/include/asm-ppc64/cputime.h
deleted file mode 100644
index 8e9faf5ce720..000000000000
--- a/include/asm-ppc64/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PPC_CPUTIME_H
2#define __PPC_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __PPC_CPUTIME_H */
diff --git a/include/asm-ppc64/div64.h b/include/asm-ppc64/div64.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/include/asm-ppc64/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h
index 085eedb956fe..c919a89343db 100644
--- a/include/asm-ppc64/elf.h
+++ b/include/asm-ppc64/elf.h
@@ -4,6 +4,7 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/ptrace.h> 5#include <asm/ptrace.h>
6#include <asm/cputable.h> 6#include <asm/cputable.h>
7#include <asm/auxvec.h>
7 8
8/* PowerPC relocations defined by the ABIs */ 9/* PowerPC relocations defined by the ABIs */
9#define R_PPC_NONE 0 10#define R_PPC_NONE 0
@@ -237,21 +238,6 @@ do { \
237 238
238#endif 239#endif
239 240
240/*
241 * We need to put in some extra aux table entries to tell glibc what
242 * the cache block size is, so it can use the dcbz instruction safely.
243 */
244#define AT_DCACHEBSIZE 19
245#define AT_ICACHEBSIZE 20
246#define AT_UCACHEBSIZE 21
247/* A special ignored type value for PPC, for glibc compatibility. */
248#define AT_IGNOREPPC 22
249
250/* The vDSO location. We have to use the same value as x86 for glibc's
251 * sake :-)
252 */
253#define AT_SYSINFO_EHDR 33
254
255extern int dcache_bsize; 241extern int dcache_bsize;
256extern int icache_bsize; 242extern int icache_bsize;
257extern int ucache_bsize; 243extern int ucache_bsize;
diff --git a/include/asm-ppc64/emergency-restart.h b/include/asm-ppc64/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-ppc64/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/include/asm-ppc64/errno.h b/include/asm-ppc64/errno.h
deleted file mode 100644
index 69bc3b0c6cbe..000000000000
--- a/include/asm-ppc64/errno.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _PPC64_ERRNO_H
2#define _PPC64_ERRNO_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <asm-generic/errno.h>
12
13#undef EDEADLOCK
14#define EDEADLOCK 58 /* File locking deadlock error */
15
16#define _LAST_ERRNO 516
17
18#endif
diff --git a/include/asm-ppc64/fcntl.h b/include/asm-ppc64/fcntl.h
deleted file mode 100644
index 842560d50656..000000000000
--- a/include/asm-ppc64/fcntl.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef _PPC64_FCNTL_H
2#define _PPC64_FCNTL_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
12 located on an ext2 file system */
13#define O_ACCMODE 0003
14#define O_RDONLY 00
15#define O_WRONLY 01
16#define O_RDWR 02
17#define O_CREAT 0100 /* not fcntl */
18#define O_EXCL 0200 /* not fcntl */
19#define O_NOCTTY 0400 /* not fcntl */
20#define O_TRUNC 01000 /* not fcntl */
21#define O_APPEND 02000
22#define O_NONBLOCK 04000
23#define O_NDELAY O_NONBLOCK
24#define O_SYNC 010000
25#define FASYNC 020000 /* fcntl, for BSD compatibility */
26#define O_DIRECTORY 040000 /* must be a directory */
27#define O_NOFOLLOW 0100000 /* don't follow links */
28#define O_LARGEFILE 0200000
29#define O_DIRECT 0400000 /* direct disk access hint */
30#define O_NOATIME 01000000
31
32#define F_DUPFD 0 /* dup */
33#define F_GETFD 1 /* get close_on_exec */
34#define F_SETFD 2 /* set/clear close_on_exec */
35#define F_GETFL 3 /* get file->f_flags */
36#define F_SETFL 4 /* set file->f_flags */
37#define F_GETLK 5
38#define F_SETLK 6
39#define F_SETLKW 7
40
41#define F_SETOWN 8 /* for sockets. */
42#define F_GETOWN 9 /* for sockets. */
43#define F_SETSIG 10 /* for sockets. */
44#define F_GETSIG 11 /* for sockets. */
45
46/* for F_[GET|SET]FL */
47#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
48
49/* for posix fcntl() and lockf() */
50#define F_RDLCK 0
51#define F_WRLCK 1
52#define F_UNLCK 2
53
54/* for old implementation of bsd flock () */
55#define F_EXLCK 4 /* or 3 */
56#define F_SHLCK 8 /* or 4 */
57
58/* for leases */
59#define F_INPROGRESS 16
60
61/* operations for bsd flock(), also used by the kernel implementation */
62#define LOCK_SH 1 /* shared lock */
63#define LOCK_EX 2 /* exclusive lock */
64#define LOCK_NB 4 /* or'd with one of the above to prevent
65 blocking */
66#define LOCK_UN 8 /* remove lock */
67
68#define LOCK_MAND 32 /* This is a mandatory flock */
69#define LOCK_READ 64 /* ... Which allows concurrent read operations */
70#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
71#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
72
73#ifdef __KERNEL__
74#define F_POSIX 1
75#define F_FLOCK 2
76#define F_BROKEN 4 /* broken flock() emulation */
77#endif /* __KERNEL__ */
78
79struct flock {
80 short l_type;
81 short l_whence;
82 off_t l_start;
83 off_t l_len;
84 pid_t l_pid;
85};
86
87#define F_LINUX_SPECIFIC_BASE 1024
88
89#endif /* _PPC64_FCNTL_H */
diff --git a/include/asm-ppc64/firmware.h b/include/asm-ppc64/firmware.h
new file mode 100644
index 000000000000..22bb85cf60af
--- /dev/null
+++ b/include/asm-ppc64/firmware.h
@@ -0,0 +1,101 @@
1/*
2 * include/asm-ppc64/firmware.h
3 *
4 * Extracted from include/asm-ppc64/cputable.h
5 *
6 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
7 *
8 * Modifications for ppc64:
9 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#ifndef __ASM_PPC_FIRMWARE_H
17#define __ASM_PPC_FIRMWARE_H
18
19#ifdef __KERNEL__
20
21#ifndef __ASSEMBLY__
22
23/* firmware feature bitmask values */
24#define FIRMWARE_MAX_FEATURES 63
25
26#define FW_FEATURE_PFT (1UL<<0)
27#define FW_FEATURE_TCE (1UL<<1)
28#define FW_FEATURE_SPRG0 (1UL<<2)
29#define FW_FEATURE_DABR (1UL<<3)
30#define FW_FEATURE_COPY (1UL<<4)
31#define FW_FEATURE_ASR (1UL<<5)
32#define FW_FEATURE_DEBUG (1UL<<6)
33#define FW_FEATURE_TERM (1UL<<7)
34#define FW_FEATURE_PERF (1UL<<8)
35#define FW_FEATURE_DUMP (1UL<<9)
36#define FW_FEATURE_INTERRUPT (1UL<<10)
37#define FW_FEATURE_MIGRATE (1UL<<11)
38#define FW_FEATURE_PERFMON (1UL<<12)
39#define FW_FEATURE_CRQ (1UL<<13)
40#define FW_FEATURE_VIO (1UL<<14)
41#define FW_FEATURE_RDMA (1UL<<15)
42#define FW_FEATURE_LLAN (1UL<<16)
43#define FW_FEATURE_BULK (1UL<<17)
44#define FW_FEATURE_XDABR (1UL<<18)
45#define FW_FEATURE_MULTITCE (1UL<<19)
46#define FW_FEATURE_SPLPAR (1UL<<20)
47#define FW_FEATURE_ISERIES (1UL<<21)
48
49enum {
50 FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE |
51 FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY |
52 FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM |
53 FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT |
54 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
55 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
56 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
57 FW_FEATURE_SPLPAR,
58 FW_FEATURE_PSERIES_ALWAYS = 0,
59 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES,
60 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES,
61 FW_FEATURE_POSSIBLE =
62#ifdef CONFIG_PPC_PSERIES
63 FW_FEATURE_PSERIES_POSSIBLE |
64#endif
65#ifdef CONFIG_PPC_ISERIES
66 FW_FEATURE_ISERIES_POSSIBLE |
67#endif
68 0,
69 FW_FEATURE_ALWAYS =
70#ifdef CONFIG_PPC_PSERIES
71 FW_FEATURE_PSERIES_ALWAYS &
72#endif
73#ifdef CONFIG_PPC_ISERIES
74 FW_FEATURE_ISERIES_ALWAYS &
75#endif
76 FW_FEATURE_POSSIBLE,
77};
78
79/* This is used to identify firmware features which are available
80 * to the kernel.
81 */
82extern unsigned long ppc64_firmware_features;
83
84static inline unsigned long firmware_has_feature(unsigned long feature)
85{
86 return (FW_FEATURE_ALWAYS & feature) ||
87 (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature);
88}
89
90#ifdef CONFIG_PPC_PSERIES
91typedef struct {
92 unsigned long val;
93 char * name;
94} firmware_feature_t;
95
96extern firmware_feature_t firmware_features_table[];
97#endif
98
99#endif /* __ASSEMBLY__ */
100#endif /* __KERNEL__ */
101#endif /* __ASM_PPC_FIRMWARE_H */
diff --git a/include/asm-ppc64/futex.h b/include/asm-ppc64/futex.h
new file mode 100644
index 000000000000..cb2640b3a408
--- /dev/null
+++ b/include/asm-ppc64/futex.h
@@ -0,0 +1,83 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/memory.h>
9#include <asm/uaccess.h>
10
11#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
12 __asm__ __volatile (SYNC_ON_SMP \
13"1: lwarx %0,0,%2\n" \
14 insn \
15"2: stwcx. %1,0,%2\n\
16 bne- 1b\n\
17 li %1,0\n\
183: .section .fixup,\"ax\"\n\
194: li %1,%3\n\
20 b 3b\n\
21 .previous\n\
22 .section __ex_table,\"a\"\n\
23 .align 3\n\
24 .llong 1b,4b,2b,4b\n\
25 .previous" \
26 : "=&r" (oldval), "=&r" (ret) \
27 : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \
28 : "cr0", "memory")
29
30static inline int
31futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
32{
33 int op = (encoded_op >> 28) & 7;
34 int cmp = (encoded_op >> 24) & 15;
35 int oparg = (encoded_op << 8) >> 20;
36 int cmparg = (encoded_op << 20) >> 20;
37 int oldval = 0, ret;
38 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
39 oparg = 1 << oparg;
40
41 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
42 return -EFAULT;
43
44 inc_preempt_count();
45
46 switch (op) {
47 case FUTEX_OP_SET:
48 __futex_atomic_op("", ret, oldval, uaddr, oparg);
49 break;
50 case FUTEX_OP_ADD:
51 __futex_atomic_op("add %1,%0,%1\n", ret, oldval, uaddr, oparg);
52 break;
53 case FUTEX_OP_OR:
54 __futex_atomic_op("or %1,%0,%1\n", ret, oldval, uaddr, oparg);
55 break;
56 case FUTEX_OP_ANDN:
57 __futex_atomic_op("andc %1,%0,%1\n", ret, oldval, uaddr, oparg);
58 break;
59 case FUTEX_OP_XOR:
60 __futex_atomic_op("xor %1,%0,%1\n", ret, oldval, uaddr, oparg);
61 break;
62 default:
63 ret = -ENOSYS;
64 }
65
66 dec_preempt_count();
67
68 if (!ret) {
69 switch (cmp) {
70 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
71 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
72 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
73 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
74 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
75 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
76 default: ret = -ENOSYS;
77 }
78 }
79 return ret;
80}
81
82#endif
83#endif
diff --git a/include/asm-ppc64/hdreg.h b/include/asm-ppc64/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-ppc64/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-ppc64/iSeries/LparMap.h
index 5c32e38c1c01..a6840b186d03 100644
--- a/include/asm-ppc64/iSeries/LparMap.h
+++ b/include/asm-ppc64/iSeries/LparMap.h
@@ -19,6 +19,8 @@
19#ifndef _LPARMAP_H 19#ifndef _LPARMAP_H
20#define _LPARMAP_H 20#define _LPARMAP_H
21 21
22#ifndef __ASSEMBLY__
23
22#include <asm/types.h> 24#include <asm/types.h>
23 25
24/* 26/*
@@ -71,6 +73,11 @@ struct LparMap {
71 } xRanges[HvRangesToMap]; 73 } xRanges[HvRangesToMap];
72}; 74};
73 75
74extern struct LparMap xLparMap; 76extern const struct LparMap xLparMap;
77
78#endif /* __ASSEMBLY__ */
79
80/* the fixed address where the LparMap exists */
81#define LPARMAP_PHYS 0x7000
75 82
76#endif /* _LPARMAP_H */ 83#endif /* _LPARMAP_H */
diff --git a/include/asm-ppc64/imalloc.h b/include/asm-ppc64/imalloc.h
index e46ff68a6e41..42adf7033a81 100644
--- a/include/asm-ppc64/imalloc.h
+++ b/include/asm-ppc64/imalloc.h
@@ -6,7 +6,7 @@
6 */ 6 */
7#define PHBS_IO_BASE VMALLOC_END 7#define PHBS_IO_BASE VMALLOC_END
8#define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */ 8#define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */
9#define IMALLOC_END (VMALLOC_START + EADDR_MASK) 9#define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE)
10 10
11 11
12/* imalloc region types */ 12/* imalloc region types */
diff --git a/include/asm-ppc64/ioctl.h b/include/asm-ppc64/ioctl.h
deleted file mode 100644
index 42b8c5da7fbc..000000000000
--- a/include/asm-ppc64/ioctl.h
+++ /dev/null
@@ -1,74 +0,0 @@
1#ifndef _PPC64_IOCTL_H
2#define _PPC64_IOCTL_H
3
4
5/*
6 * This was copied from the alpha as it's a bit cleaner there.
7 * -- Cort
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#define _IOC_NRBITS 8
16#define _IOC_TYPEBITS 8
17#define _IOC_SIZEBITS 13
18#define _IOC_DIRBITS 3
19
20#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
21#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
22#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
23#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
24
25#define _IOC_NRSHIFT 0
26#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
27#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
28#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
29
30/*
31 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
32 * And this turns out useful to catch old ioctl numbers in header
33 * files for us.
34 */
35#define _IOC_NONE 1U
36#define _IOC_READ 2U
37#define _IOC_WRITE 4U
38
39#define _IOC(dir,type,nr,size) \
40 (((dir) << _IOC_DIRSHIFT) | \
41 ((type) << _IOC_TYPESHIFT) | \
42 ((nr) << _IOC_NRSHIFT) | \
43 ((size) << _IOC_SIZESHIFT))
44
45/* provoke compile error for invalid uses of size argument */
46extern unsigned int __invalid_size_argument_for_IOC;
47#define _IOC_TYPECHECK(t) \
48 ((sizeof(t) == sizeof(t[1]) && \
49 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
50 sizeof(t) : __invalid_size_argument_for_IOC)
51
52/* used to create numbers */
53#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
54#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
55#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
56#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
57#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
58#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
59#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
60
61/* used to decode them.. */
62#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
63#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
64#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
65#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
66
67/* various drivers, such as the pcmcia stuff, need these... */
68#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
69#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
70#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
71#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
72#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
73
74#endif /* _PPC64_IOCTL_H */
diff --git a/include/asm-ppc64/ioctls.h b/include/asm-ppc64/ioctls.h
deleted file mode 100644
index 48796bf3e4fc..000000000000
--- a/include/asm-ppc64/ioctls.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _ASM_PPC64_IOCTLS_H
2#define _ASM_PPC64_IOCTLS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <asm/ioctl.h>
12
13#define FIOCLEX _IO('f', 1)
14#define FIONCLEX _IO('f', 2)
15#define FIOASYNC _IOW('f', 125, int)
16#define FIONBIO _IOW('f', 126, int)
17#define FIONREAD _IOR('f', 127, int)
18#define TIOCINQ FIONREAD
19#define FIOQSIZE _IOR('f', 128, loff_t)
20
21#define TIOCGETP _IOR('t', 8, struct sgttyb)
22#define TIOCSETP _IOW('t', 9, struct sgttyb)
23#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
24
25#define TIOCSETC _IOW('t', 17, struct tchars)
26#define TIOCGETC _IOR('t', 18, struct tchars)
27#define TCGETS _IOR('t', 19, struct termios)
28#define TCSETS _IOW('t', 20, struct termios)
29#define TCSETSW _IOW('t', 21, struct termios)
30#define TCSETSF _IOW('t', 22, struct termios)
31
32#define TCGETA _IOR('t', 23, struct termio)
33#define TCSETA _IOW('t', 24, struct termio)
34#define TCSETAW _IOW('t', 25, struct termio)
35#define TCSETAF _IOW('t', 28, struct termio)
36
37#define TCSBRK _IO('t', 29)
38#define TCXONC _IO('t', 30)
39#define TCFLSH _IO('t', 31)
40
41#define TIOCSWINSZ _IOW('t', 103, struct winsize)
42#define TIOCGWINSZ _IOR('t', 104, struct winsize)
43#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
44#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
45#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
46
47#define TIOCGLTC _IOR('t', 116, struct ltchars)
48#define TIOCSLTC _IOW('t', 117, struct ltchars)
49#define TIOCSPGRP _IOW('t', 118, int)
50#define TIOCGPGRP _IOR('t', 119, int)
51
52#define TIOCEXCL 0x540C
53#define TIOCNXCL 0x540D
54#define TIOCSCTTY 0x540E
55
56#define TIOCSTI 0x5412
57#define TIOCMGET 0x5415
58#define TIOCMBIS 0x5416
59#define TIOCMBIC 0x5417
60#define TIOCMSET 0x5418
61# define TIOCM_LE 0x001
62# define TIOCM_DTR 0x002
63# define TIOCM_RTS 0x004
64# define TIOCM_ST 0x008
65# define TIOCM_SR 0x010
66# define TIOCM_CTS 0x020
67# define TIOCM_CAR 0x040
68# define TIOCM_RNG 0x080
69# define TIOCM_DSR 0x100
70# define TIOCM_CD TIOCM_CAR
71# define TIOCM_RI TIOCM_RNG
72
73#define TIOCGSOFTCAR 0x5419
74#define TIOCSSOFTCAR 0x541A
75#define TIOCLINUX 0x541C
76#define TIOCCONS 0x541D
77#define TIOCGSERIAL 0x541E
78#define TIOCSSERIAL 0x541F
79#define TIOCPKT 0x5420
80# define TIOCPKT_DATA 0
81# define TIOCPKT_FLUSHREAD 1
82# define TIOCPKT_FLUSHWRITE 2
83# define TIOCPKT_STOP 4
84# define TIOCPKT_START 8
85# define TIOCPKT_NOSTOP 16
86# define TIOCPKT_DOSTOP 32
87
88
89#define TIOCNOTTY 0x5422
90#define TIOCSETD 0x5423
91#define TIOCGETD 0x5424
92#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
93#define TIOCSBRK 0x5427 /* BSD compatibility */
94#define TIOCCBRK 0x5428 /* BSD compatibility */
95#define TIOCGSID 0x5429 /* Return the session ID of FD */
96#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
97#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
98
99#define TIOCSERCONFIG 0x5453
100#define TIOCSERGWILD 0x5454
101#define TIOCSERSWILD 0x5455
102#define TIOCGLCKTRMIOS 0x5456
103#define TIOCSLCKTRMIOS 0x5457
104#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
105#define TIOCSERGETLSR 0x5459 /* Get line status register */
106 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
107# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
108#define TIOCSERGETMULTI 0x545A /* Get multiport config */
109#define TIOCSERSETMULTI 0x545B /* Set multiport config */
110
111#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
112#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
113
114#endif /* _ASM_PPC64_IOCTLS_H */
diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
index 729de5cc21d9..72dcf8116b04 100644
--- a/include/asm-ppc64/iommu.h
+++ b/include/asm-ppc64/iommu.h
@@ -104,9 +104,6 @@ extern void iommu_devnode_init_pSeries(struct device_node *dn);
104 104
105#ifdef CONFIG_PPC_ISERIES 105#ifdef CONFIG_PPC_ISERIES
106 106
107/* Initializes tables for bio buses */
108extern void __init iommu_vio_init(void);
109
110struct iSeries_Device_Node; 107struct iSeries_Device_Node;
111/* Creates table for an individual device node */ 108/* Creates table for an individual device node */
112extern void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn); 109extern void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn);
diff --git a/include/asm-ppc64/ipc.h b/include/asm-ppc64/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-ppc64/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-ppc64/irq.h b/include/asm-ppc64/irq.h
index 570678b1da95..99782afb4cde 100644
--- a/include/asm-ppc64/irq.h
+++ b/include/asm-ppc64/irq.h
@@ -33,6 +33,11 @@
33#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */ 33#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */
34#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */ 34#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */
35 35
36/*
37 * IRQ line status macro IRQ_PER_CPU is used
38 */
39#define ARCH_HAS_IRQ_PER_CPU
40
36#define get_irq_desc(irq) (&irq_desc[(irq)]) 41#define get_irq_desc(irq) (&irq_desc[(irq)])
37 42
38/* Define a way to iterate across irqs. */ 43/* Define a way to iterate across irqs. */
diff --git a/include/asm-ppc64/kprobes.h b/include/asm-ppc64/kprobes.h
index 0802919c3235..d9129d2b038e 100644
--- a/include/asm-ppc64/kprobes.h
+++ b/include/asm-ppc64/kprobes.h
@@ -42,6 +42,9 @@ typedef unsigned int kprobe_opcode_t;
42 42
43#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry) 43#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry)
44 44
45#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
46 IS_TWI(instr) || IS_TDI(instr))
47
45#define ARCH_SUPPORTS_KRETPROBES 48#define ARCH_SUPPORTS_KRETPROBES
46void kretprobe_trampoline(void); 49void kretprobe_trampoline(void);
47 50
diff --git a/include/asm-ppc64/linkage.h b/include/asm-ppc64/linkage.h
deleted file mode 100644
index 291c2d01c44f..000000000000
--- a/include/asm-ppc64/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif
diff --git a/include/asm-ppc64/lmb.h b/include/asm-ppc64/lmb.h
index a6cbca21ac1d..de91e034bd98 100644
--- a/include/asm-ppc64/lmb.h
+++ b/include/asm-ppc64/lmb.h
@@ -22,7 +22,6 @@
22 22
23struct lmb_property { 23struct lmb_property {
24 unsigned long base; 24 unsigned long base;
25 unsigned long physbase;
26 unsigned long size; 25 unsigned long size;
27}; 26};
28 27
@@ -57,4 +56,26 @@ extern void lmb_dump_all(void);
57 56
58extern unsigned long io_hole_start; 57extern unsigned long io_hole_start;
59 58
59static inline unsigned long
60lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
61{
62 return type->region[region_nr].size;
63}
64static inline unsigned long
65lmb_size_pages(struct lmb_region *type, unsigned long region_nr)
66{
67 return lmb_size_bytes(type, region_nr) >> PAGE_SHIFT;
68}
69static inline unsigned long
70lmb_start_pfn(struct lmb_region *type, unsigned long region_nr)
71{
72 return type->region[region_nr].base >> PAGE_SHIFT;
73}
74static inline unsigned long
75lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
76{
77 return lmb_start_pfn(type, region_nr) +
78 lmb_size_pages(type, region_nr);
79}
80
60#endif /* _PPC64_LMB_H */ 81#endif /* _PPC64_LMB_H */
diff --git a/include/asm-ppc64/lppaca.h b/include/asm-ppc64/lppaca.h
index 70766b5f26c1..9e2a6c0649a0 100644
--- a/include/asm-ppc64/lppaca.h
+++ b/include/asm-ppc64/lppaca.h
@@ -108,7 +108,7 @@ struct lppaca
108 volatile u32 virtual_decr; // Virtual DECR for shared procsx78-x7B 108 volatile u32 virtual_decr; // Virtual DECR for shared procsx78-x7B
109 u16 slb_count; // # of SLBs to maintain x7C-x7D 109 u16 slb_count; // # of SLBs to maintain x7C-x7D
110 u8 idle; // Indicate OS is idle x7E 110 u8 idle; // Indicate OS is idle x7E
111 u8 reserved5; // Reserved x7F 111 u8 vmxregs_in_use; // VMX registers in use x7F
112 112
113 113
114//============================================================================= 114//=============================================================================
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index f0ef06375947..9a1ef4427ed2 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -103,11 +103,6 @@ struct machdep_calls {
103 103
104 void (*progress)(char *, unsigned short); 104 void (*progress)(char *, unsigned short);
105 105
106 /* Debug interface. Low level I/O to some terminal device */
107 void (*udbg_putc)(unsigned char c);
108 unsigned char (*udbg_getc)(void);
109 int (*udbg_getc_poll)(void);
110
111 /* Interface for platform error logging */ 106 /* Interface for platform error logging */
112 void (*log_error)(char *buf, unsigned int err_type, int fatal); 107 void (*log_error)(char *buf, unsigned int err_type, int fatal);
113 108
@@ -140,6 +135,9 @@ struct machdep_calls {
140 135
141 /* Idle loop for this platform, leave empty for default idle loop */ 136 /* Idle loop for this platform, leave empty for default idle loop */
142 int (*idle_loop)(void); 137 int (*idle_loop)(void);
138
139 /* Function to enable pmcs for this platform, called once per cpu. */
140 void (*enable_pmcs)(void);
143}; 141};
144 142
145extern int default_idle(void); 143extern int default_idle(void);
diff --git a/include/asm-ppc64/memory.h b/include/asm-ppc64/memory.h
index 56e09face9a8..af53ffb55726 100644
--- a/include/asm-ppc64/memory.h
+++ b/include/asm-ppc64/memory.h
@@ -18,9 +18,11 @@
18#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
19#define EIEIO_ON_SMP "eieio\n" 19#define EIEIO_ON_SMP "eieio\n"
20#define ISYNC_ON_SMP "\n\tisync" 20#define ISYNC_ON_SMP "\n\tisync"
21#define SYNC_ON_SMP "lwsync\n\t"
21#else 22#else
22#define EIEIO_ON_SMP 23#define EIEIO_ON_SMP
23#define ISYNC_ON_SMP 24#define ISYNC_ON_SMP
25#define SYNC_ON_SMP
24#endif 26#endif
25 27
26static inline void eieio(void) 28static inline void eieio(void)
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index 70348a851313..7bc42eb087ad 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -28,9 +28,12 @@
28#define STE_VSID_SHIFT 12 28#define STE_VSID_SHIFT 12
29 29
30/* Location of cpu0's segment table */ 30/* Location of cpu0's segment table */
31#define STAB0_PAGE 0x9 31#define STAB0_PAGE 0x6
32#define STAB0_PHYS_ADDR (STAB0_PAGE<<PAGE_SHIFT) 32#define STAB0_PHYS_ADDR (STAB0_PAGE<<PAGE_SHIFT)
33#define STAB0_VIRT_ADDR (KERNELBASE+STAB0_PHYS_ADDR) 33
34#ifndef __ASSEMBLY__
35extern char initial_stab[];
36#endif /* ! __ASSEMBLY */
34 37
35/* 38/*
36 * SLB 39 * SLB
@@ -51,8 +54,10 @@
51#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ 54#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
52#define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */ 55#define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */
53 56
54#define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) 57#define SLB_VSID_KERNEL (SLB_VSID_KP)
55#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) 58#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
59
60#define SLBIE_C (0x08000000)
56 61
57/* 62/*
58 * Hash table 63 * Hash table
@@ -259,8 +264,10 @@ extern void stabs_alloc(void);
259#define VSID_BITS 36 264#define VSID_BITS 36
260#define VSID_MODULUS ((1UL<<VSID_BITS)-1) 265#define VSID_MODULUS ((1UL<<VSID_BITS)-1)
261 266
262#define CONTEXT_BITS 20 267#define CONTEXT_BITS 19
263#define USER_ESID_BITS 15 268#define USER_ESID_BITS 16
269
270#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
264 271
265/* 272/*
266 * This macro generates asm code to compute the VSID scramble 273 * This macro generates asm code to compute the VSID scramble
@@ -302,8 +309,7 @@ typedef unsigned long mm_context_id_t;
302typedef struct { 309typedef struct {
303 mm_context_id_t id; 310 mm_context_id_t id;
304#ifdef CONFIG_HUGETLB_PAGE 311#ifdef CONFIG_HUGETLB_PAGE
305 pgd_t *huge_pgdir; 312 u16 low_htlb_areas, high_htlb_areas;
306 u16 htlb_segs; /* bitmask */
307#endif 313#endif
308} mm_context_t; 314} mm_context_t;
309 315
diff --git a/include/asm-ppc64/module.h b/include/asm-ppc64/module.h
deleted file mode 100644
index 0581607826e8..000000000000
--- a/include/asm-ppc64/module.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ASM_PPC64_MODULE_H
2#define _ASM_PPC64_MODULE_H
3
4#include <linux/list.h>
5#include <asm/bug.h>
6
7struct mod_arch_specific
8{
9 /* Index of stubs section within module. */
10 unsigned int stubs_section;
11
12 /* What section is the TOC? */
13 unsigned int toc_section;
14
15 /* List of BUG addresses, source line numbers and filenames */
16 struct list_head bug_list;
17 struct bug_entry *bug_table;
18 unsigned int num_bugs;
19};
20
21extern struct bug_entry *module_find_bug(unsigned long bugaddr);
22
23#define Elf_Shdr Elf64_Shdr
24#define Elf_Sym Elf64_Sym
25#define Elf_Ehdr Elf64_Ehdr
26
27/* Make empty section for module_frob_arch_sections to expand. */
28#ifdef MODULE
29asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
30#endif
31
32struct exception_table_entry;
33void sort_ex_table(struct exception_table_entry *start,
34 struct exception_table_entry *finish);
35
36#endif /* _ASM_PPC64_MODULE_H */
diff --git a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h
index bfb7caa32eaf..d2afe6447597 100644
--- a/include/asm-ppc64/naca.h
+++ b/include/asm-ppc64/naca.h
@@ -12,8 +12,6 @@
12 12
13#include <asm/types.h> 13#include <asm/types.h>
14 14
15#ifndef __ASSEMBLY__
16
17struct naca_struct { 15struct naca_struct {
18 /* Kernel only data - undefined for user space */ 16 /* Kernel only data - undefined for user space */
19 void *xItVpdAreas; /* VPD Data 0x00 */ 17 void *xItVpdAreas; /* VPD Data 0x00 */
@@ -23,9 +21,4 @@ struct naca_struct {
23 21
24extern struct naca_struct naca; 22extern struct naca_struct naca;
25 23
26#endif /* __ASSEMBLY__ */
27
28#define NACA_PAGE 0x4
29#define NACA_PHYS_ADDR (NACA_PAGE<<PAGE_SHIFT)
30
31#endif /* _NACA_H */ 24#endif /* _NACA_H */
diff --git a/include/asm-ppc64/namei.h b/include/asm-ppc64/namei.h
deleted file mode 100644
index a1412a2d102a..000000000000
--- a/include/asm-ppc64/namei.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/include/asm-ppc/namei.h
3 * Adapted from linux/include/asm-alpha/namei.h
4 *
5 * Included from linux/fs/namei.c
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef __PPC64_NAMEI_H
14#define __PPC64_NAMEI_H
15
16/* This dummy routine maybe changed to something useful
17 * for /usr/gnemul/ emulation stuff.
18 * Look at asm-sparc/namei.h for details.
19 */
20
21#define __emul_prefix() NULL
22
23#endif /* __PPC64_NAMEI_H */
diff --git a/include/asm-ppc64/oprofile_impl.h b/include/asm-ppc64/oprofile_impl.h
new file mode 100644
index 000000000000..b04f1dfb1421
--- /dev/null
+++ b/include/asm-ppc64/oprofile_impl.h
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
3 *
4 * Based on alpha version.
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 OP_IMPL_H
13#define OP_IMPL_H 1
14
15#define OP_MAX_COUNTER 8
16
17/* Per-counter configuration as set via oprofilefs. */
18struct op_counter_config {
19 unsigned long valid;
20 unsigned long enabled;
21 unsigned long event;
22 unsigned long count;
23 unsigned long kernel;
24 /* We dont support per counter user/kernel selection */
25 unsigned long user;
26 unsigned long unit_mask;
27};
28
29/* System-wide configuration as set via oprofilefs. */
30struct op_system_config {
31 unsigned long mmcr0;
32 unsigned long mmcr1;
33 unsigned long mmcra;
34 unsigned long enable_kernel;
35 unsigned long enable_user;
36 unsigned long backtrace_spinlocks;
37};
38
39/* Per-arch configuration */
40struct op_ppc64_model {
41 void (*reg_setup) (struct op_counter_config *,
42 struct op_system_config *,
43 int num_counters);
44 void (*cpu_setup) (void *);
45 void (*start) (struct op_counter_config *);
46 void (*stop) (void);
47 void (*handle_interrupt) (struct pt_regs *,
48 struct op_counter_config *);
49 int num_counters;
50};
51
52extern struct op_ppc64_model op_model_rs64;
53extern struct op_ppc64_model op_model_power4;
54
55static inline unsigned int ctr_read(unsigned int i)
56{
57 switch(i) {
58 case 0:
59 return mfspr(SPRN_PMC1);
60 case 1:
61 return mfspr(SPRN_PMC2);
62 case 2:
63 return mfspr(SPRN_PMC3);
64 case 3:
65 return mfspr(SPRN_PMC4);
66 case 4:
67 return mfspr(SPRN_PMC5);
68 case 5:
69 return mfspr(SPRN_PMC6);
70 case 6:
71 return mfspr(SPRN_PMC7);
72 case 7:
73 return mfspr(SPRN_PMC8);
74 default:
75 return 0;
76 }
77}
78
79static inline void ctr_write(unsigned int i, unsigned int val)
80{
81 switch(i) {
82 case 0:
83 mtspr(SPRN_PMC1, val);
84 break;
85 case 1:
86 mtspr(SPRN_PMC2, val);
87 break;
88 case 2:
89 mtspr(SPRN_PMC3, val);
90 break;
91 case 3:
92 mtspr(SPRN_PMC4, val);
93 break;
94 case 4:
95 mtspr(SPRN_PMC5, val);
96 break;
97 case 5:
98 mtspr(SPRN_PMC6, val);
99 break;
100 case 6:
101 mtspr(SPRN_PMC7, val);
102 break;
103 case 7:
104 mtspr(SPRN_PMC8, val);
105 break;
106 default:
107 break;
108 }
109}
110
111#endif
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
index a5893a305a09..a15422bcf30d 100644
--- a/include/asm-ppc64/page.h
+++ b/include/asm-ppc64/page.h
@@ -37,39 +37,45 @@
37 37
38#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 38#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
39 39
40/* For 64-bit processes the hugepage range is 1T-1.5T */ 40#define HTLB_AREA_SHIFT 40
41#define TASK_HPAGE_BASE ASM_CONST(0x0000010000000000) 41#define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT)
42#define TASK_HPAGE_END ASM_CONST(0x0000018000000000) 42#define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT)
43 43
44#define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ 44#define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \
45 - (1U << GET_ESID(addr))) & 0xffff) 45 - (1U << GET_ESID(addr))) & 0xffff)
46#define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \
47 - (1U << GET_HTLB_AREA(addr))) & 0xffff)
46 48
47#define ARCH_HAS_HUGEPAGE_ONLY_RANGE 49#define ARCH_HAS_HUGEPAGE_ONLY_RANGE
48#define ARCH_HAS_PREPARE_HUGEPAGE_RANGE 50#define ARCH_HAS_PREPARE_HUGEPAGE_RANGE
51#define ARCH_HAS_SETCLEAR_HUGE_PTE
49 52
50#define touches_hugepage_low_range(mm, addr, len) \ 53#define touches_hugepage_low_range(mm, addr, len) \
51 (LOW_ESID_MASK((addr), (len)) & mm->context.htlb_segs) 54 (LOW_ESID_MASK((addr), (len)) & (mm)->context.low_htlb_areas)
52#define touches_hugepage_high_range(addr, len) \ 55#define touches_hugepage_high_range(mm, addr, len) \
53 (((addr) > (TASK_HPAGE_BASE-(len))) && ((addr) < TASK_HPAGE_END)) 56 (HTLB_AREA_MASK((addr), (len)) & (mm)->context.high_htlb_areas)
54 57
55#define __within_hugepage_low_range(addr, len, segmask) \ 58#define __within_hugepage_low_range(addr, len, segmask) \
56 ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)) 59 ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask))
57#define within_hugepage_low_range(addr, len) \ 60#define within_hugepage_low_range(addr, len) \
58 __within_hugepage_low_range((addr), (len), \ 61 __within_hugepage_low_range((addr), (len), \
59 current->mm->context.htlb_segs) 62 current->mm->context.low_htlb_areas)
60#define within_hugepage_high_range(addr, len) (((addr) >= TASK_HPAGE_BASE) \ 63#define __within_hugepage_high_range(addr, len, zonemask) \
61 && ((addr)+(len) <= TASK_HPAGE_END) && ((addr)+(len) >= (addr))) 64 ((HTLB_AREA_MASK((addr), (len)) | (zonemask)) == (zonemask))
65#define within_hugepage_high_range(addr, len) \
66 __within_hugepage_high_range((addr), (len), \
67 current->mm->context.high_htlb_areas)
62 68
63#define is_hugepage_only_range(mm, addr, len) \ 69#define is_hugepage_only_range(mm, addr, len) \
64 (touches_hugepage_high_range((addr), (len)) || \ 70 (touches_hugepage_high_range((mm), (addr), (len)) || \
65 touches_hugepage_low_range((mm), (addr), (len))) 71 touches_hugepage_low_range((mm), (addr), (len)))
66#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 72#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
67 73
68#define in_hugepage_area(context, addr) \ 74#define in_hugepage_area(context, addr) \
69 (cpu_has_feature(CPU_FTR_16M_PAGE) && \ 75 (cpu_has_feature(CPU_FTR_16M_PAGE) && \
70 ( (((addr) >= TASK_HPAGE_BASE) && ((addr) < TASK_HPAGE_END)) || \ 76 ( ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) || \
71 ( ((addr) < 0x100000000L) && \ 77 ( ((addr) < 0x100000000L) && \
72 ((1 << GET_ESID(addr)) & (context).htlb_segs) ) ) ) 78 ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) ) )
73 79
74#else /* !CONFIG_HUGETLB_PAGE */ 80#else /* !CONFIG_HUGETLB_PAGE */
75 81
@@ -125,55 +131,47 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag
125 * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. 131 * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b.
126 */ 132 */
127typedef struct { unsigned long pte; } pte_t; 133typedef struct { unsigned long pte; } pte_t;
128typedef struct { unsigned int pmd; } pmd_t; 134typedef struct { unsigned long pmd; } pmd_t;
129typedef struct { unsigned int pgd; } pgd_t; 135typedef struct { unsigned long pud; } pud_t;
136typedef struct { unsigned long pgd; } pgd_t;
130typedef struct { unsigned long pgprot; } pgprot_t; 137typedef struct { unsigned long pgprot; } pgprot_t;
131 138
132#define pte_val(x) ((x).pte) 139#define pte_val(x) ((x).pte)
133#define pmd_val(x) ((x).pmd) 140#define pmd_val(x) ((x).pmd)
141#define pud_val(x) ((x).pud)
134#define pgd_val(x) ((x).pgd) 142#define pgd_val(x) ((x).pgd)
135#define pgprot_val(x) ((x).pgprot) 143#define pgprot_val(x) ((x).pgprot)
136 144
137#define __pte(x) ((pte_t) { (x) } ) 145#define __pte(x) ((pte_t) { (x) })
138#define __pmd(x) ((pmd_t) { (x) } ) 146#define __pmd(x) ((pmd_t) { (x) })
139#define __pgd(x) ((pgd_t) { (x) } ) 147#define __pud(x) ((pud_t) { (x) })
140#define __pgprot(x) ((pgprot_t) { (x) } ) 148#define __pgd(x) ((pgd_t) { (x) })
149#define __pgprot(x) ((pgprot_t) { (x) })
141 150
142#else 151#else
143/* 152/*
144 * .. while these make it easier on the compiler 153 * .. while these make it easier on the compiler
145 */ 154 */
146typedef unsigned long pte_t; 155typedef unsigned long pte_t;
147typedef unsigned int pmd_t; 156typedef unsigned long pmd_t;
148typedef unsigned int pgd_t; 157typedef unsigned long pud_t;
158typedef unsigned long pgd_t;
149typedef unsigned long pgprot_t; 159typedef unsigned long pgprot_t;
150 160
151#define pte_val(x) (x) 161#define pte_val(x) (x)
152#define pmd_val(x) (x) 162#define pmd_val(x) (x)
163#define pud_val(x) (x)
153#define pgd_val(x) (x) 164#define pgd_val(x) (x)
154#define pgprot_val(x) (x) 165#define pgprot_val(x) (x)
155 166
156#define __pte(x) (x) 167#define __pte(x) (x)
157#define __pmd(x) (x) 168#define __pmd(x) (x)
169#define __pud(x) (x)
158#define __pgd(x) (x) 170#define __pgd(x) (x)
159#define __pgprot(x) (x) 171#define __pgprot(x) (x)
160 172
161#endif 173#endif
162 174
163/* Pure 2^n version of get_order */
164static inline int get_order(unsigned long size)
165{
166 int order;
167
168 size = (size-1) >> (PAGE_SHIFT-1);
169 order = -1;
170 do {
171 size >>= 1;
172 order++;
173 } while (size);
174 return order;
175}
176
177#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 175#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
178 176
179extern int page_is_ram(unsigned long pfn); 177extern int page_is_ram(unsigned long pfn);
@@ -208,9 +206,6 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */
208#define USER_REGION_ID (0UL) 206#define USER_REGION_ID (0UL)
209#define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT) 207#define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT)
210 208
211#define __bpn_to_ba(x) ((((unsigned long)(x)) << PAGE_SHIFT) + KERNELBASE)
212#define __ba_to_bpn(x) ((((unsigned long)(x)) & ~REGION_MASK) >> PAGE_SHIFT)
213
214#define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) 209#define __va(x) ((void *)((unsigned long)(x) + KERNELBASE))
215 210
216#ifdef CONFIG_DISCONTIGMEM 211#ifdef CONFIG_DISCONTIGMEM
@@ -261,4 +256,7 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */
261 VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) 256 VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64)
262 257
263#endif /* __KERNEL__ */ 258#endif /* __KERNEL__ */
259
260#include <asm-generic/page.h>
261
264#endif /* _PPC64_PAGE_H */ 262#endif /* _PPC64_PAGE_H */
diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h
index 1fad38dcf707..76c212d475b3 100644
--- a/include/asm-ppc64/param.h
+++ b/include/asm-ppc64/param.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_PPC64_PARAM_H 1#ifndef _ASM_PPC64_PARAM_H
2#define _ASM_PPC64_PARAM_H 2#define _ASM_PPC64_PARAM_H
3 3
4#include <linux/config.h>
5
4/* 6/*
5 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -9,7 +11,7 @@
9 */ 11 */
10 12
11#ifdef __KERNEL__ 13#ifdef __KERNEL__
12# define HZ 1000 /* Internal kernel timer frequency */ 14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
13# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
14# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
15#endif 17#endif
diff --git a/include/asm-ppc64/percpu.h b/include/asm-ppc64/percpu.h
deleted file mode 100644
index 60a659a4ce1f..000000000000
--- a/include/asm-ppc64/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARCH_PPC64_PERCPU__
2#define __ARCH_PPC64_PERCPU__
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ARCH_PPC64_PERCPU__ */
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h
index 4fc4b739b380..26bc49c1108d 100644
--- a/include/asm-ppc64/pgalloc.h
+++ b/include/asm-ppc64/pgalloc.h
@@ -6,7 +6,12 @@
6#include <linux/cpumask.h> 6#include <linux/cpumask.h>
7#include <linux/percpu.h> 7#include <linux/percpu.h>
8 8
9extern kmem_cache_t *zero_cache; 9extern kmem_cache_t *pgtable_cache[];
10
11#define PTE_CACHE_NUM 0
12#define PMD_CACHE_NUM 1
13#define PUD_CACHE_NUM 1
14#define PGD_CACHE_NUM 0
10 15
11/* 16/*
12 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
@@ -15,30 +20,40 @@ extern kmem_cache_t *zero_cache;
15 * 2 of the License, or (at your option) any later version. 20 * 2 of the License, or (at your option) any later version.
16 */ 21 */
17 22
18static inline pgd_t * 23static inline pgd_t *pgd_alloc(struct mm_struct *mm)
19pgd_alloc(struct mm_struct *mm)
20{ 24{
21 return kmem_cache_alloc(zero_cache, GFP_KERNEL); 25 return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL);
22} 26}
23 27
24static inline void 28static inline void pgd_free(pgd_t *pgd)
25pgd_free(pgd_t *pgd)
26{ 29{
27 kmem_cache_free(zero_cache, pgd); 30 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd);
31}
32
33#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD)
34
35static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
36{
37 return kmem_cache_alloc(pgtable_cache[PUD_CACHE_NUM],
38 GFP_KERNEL|__GFP_REPEAT);
39}
40
41static inline void pud_free(pud_t *pud)
42{
43 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud);
28} 44}
29 45
30#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) 46#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
31 47
32static inline pmd_t * 48static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
33pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
34{ 49{
35 return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); 50 return kmem_cache_alloc(pgtable_cache[PMD_CACHE_NUM],
51 GFP_KERNEL|__GFP_REPEAT);
36} 52}
37 53
38static inline void 54static inline void pmd_free(pmd_t *pmd)
39pmd_free(pmd_t *pmd)
40{ 55{
41 kmem_cache_free(zero_cache, pmd); 56 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd);
42} 57}
43 58
44#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) 59#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte)
@@ -47,44 +62,58 @@ pmd_free(pmd_t *pmd)
47 62
48static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) 63static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
49{ 64{
50 return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); 65 return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM],
66 GFP_KERNEL|__GFP_REPEAT);
51} 67}
52 68
53static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) 69static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
54{ 70{
55 pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); 71 return virt_to_page(pte_alloc_one_kernel(mm, address));
56 if (pte)
57 return virt_to_page(pte);
58 return NULL;
59} 72}
60 73
61static inline void pte_free_kernel(pte_t *pte) 74static inline void pte_free_kernel(pte_t *pte)
62{ 75{
63 kmem_cache_free(zero_cache, pte); 76 kmem_cache_free(pgtable_cache[PTE_CACHE_NUM], pte);
64} 77}
65 78
66static inline void pte_free(struct page *ptepage) 79static inline void pte_free(struct page *ptepage)
67{ 80{
68 kmem_cache_free(zero_cache, page_address(ptepage)); 81 pte_free_kernel(page_address(ptepage));
69} 82}
70 83
71struct pte_freelist_batch 84#define PGF_CACHENUM_MASK 0xf
85
86typedef struct pgtable_free {
87 unsigned long val;
88} pgtable_free_t;
89
90static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum,
91 unsigned long mask)
72{ 92{
73 struct rcu_head rcu; 93 BUG_ON(cachenum > PGF_CACHENUM_MASK);
74 unsigned int index;
75 struct page * pages[0];
76};
77 94
78#define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \ 95 return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum};
79 sizeof(struct page *)) 96}
80 97
81extern void pte_free_now(struct page *ptepage); 98static inline void pgtable_free(pgtable_free_t pgf)
82extern void pte_free_submit(struct pte_freelist_batch *batch); 99{
100 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK);
101 int cachenum = pgf.val & PGF_CACHENUM_MASK;
83 102
84DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); 103 kmem_cache_free(pgtable_cache[cachenum], p);
104}
85 105
86void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage); 106void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
87#define __pmd_free_tlb(tlb, pmd) __pte_free_tlb(tlb, virt_to_page(pmd)) 107
108#define __pte_free_tlb(tlb, ptepage) \
109 pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \
110 PTE_CACHE_NUM, PTE_TABLE_SIZE-1))
111#define __pmd_free_tlb(tlb, pmd) \
112 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \
113 PMD_CACHE_NUM, PMD_TABLE_SIZE-1))
114#define __pud_free_tlb(tlb, pmd) \
115 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \
116 PUD_CACHE_NUM, PUD_TABLE_SIZE-1))
88 117
89#define check_pgt_cache() do { } while (0) 118#define check_pgt_cache() do { } while (0)
90 119
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
index 46cf61c2ff69..c83679c9d2b0 100644
--- a/include/asm-ppc64/pgtable.h
+++ b/include/asm-ppc64/pgtable.h
@@ -15,19 +15,24 @@
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16#endif /* __ASSEMBLY__ */ 16#endif /* __ASSEMBLY__ */
17 17
18#include <asm-generic/pgtable-nopud.h>
19
20/* 18/*
21 * Entries per page directory level. The PTE level must use a 64b record 19 * Entries per page directory level. The PTE level must use a 64b record
22 * for each page table entry. The PMD and PGD level use a 32b record for 20 * for each page table entry. The PMD and PGD level use a 32b record for
23 * each entry by assuming that each entry is page aligned. 21 * each entry by assuming that each entry is page aligned.
24 */ 22 */
25#define PTE_INDEX_SIZE 9 23#define PTE_INDEX_SIZE 9
26#define PMD_INDEX_SIZE 10 24#define PMD_INDEX_SIZE 7
27#define PGD_INDEX_SIZE 10 25#define PUD_INDEX_SIZE 7
26#define PGD_INDEX_SIZE 9
27
28#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE)
29#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
30#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE)
31#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
28 32
29#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 33#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
30#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) 34#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
35#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE)
31#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) 36#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
32 37
33/* PMD_SHIFT determines what a second-level page table entry can map */ 38/* PMD_SHIFT determines what a second-level page table entry can map */
@@ -35,8 +40,13 @@
35#define PMD_SIZE (1UL << PMD_SHIFT) 40#define PMD_SIZE (1UL << PMD_SHIFT)
36#define PMD_MASK (~(PMD_SIZE-1)) 41#define PMD_MASK (~(PMD_SIZE-1))
37 42
38/* PGDIR_SHIFT determines what a third-level page table entry can map */ 43/* PUD_SHIFT determines what a third-level page table entry can map */
39#define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) 44#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
45#define PUD_SIZE (1UL << PUD_SHIFT)
46#define PUD_MASK (~(PUD_SIZE-1))
47
48/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
49#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE)
40#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 50#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
41#define PGDIR_MASK (~(PGDIR_SIZE-1)) 51#define PGDIR_MASK (~(PGDIR_SIZE-1))
42 52
@@ -45,15 +55,23 @@
45/* 55/*
46 * Size of EA range mapped by our pagetables. 56 * Size of EA range mapped by our pagetables.
47 */ 57 */
48#define EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ 58#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \
49 PGD_INDEX_SIZE + PAGE_SHIFT) 59 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)
50#define EADDR_MASK ((1UL << EADDR_SIZE) - 1) 60#define PGTABLE_RANGE (1UL << PGTABLE_EADDR_SIZE)
61
62#if TASK_SIZE_USER64 > PGTABLE_RANGE
63#error TASK_SIZE_USER64 exceeds pagetable range
64#endif
65
66#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT))
67#error TASK_SIZE_USER64 exceeds user VSID range
68#endif
51 69
52/* 70/*
53 * Define the address range of the vmalloc VM area. 71 * Define the address range of the vmalloc VM area.
54 */ 72 */
55#define VMALLOC_START (0xD000000000000000ul) 73#define VMALLOC_START (0xD000000000000000ul)
56#define VMALLOC_SIZE (0x10000000000UL) 74#define VMALLOC_SIZE (0x80000000000UL)
57#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) 75#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
58 76
59/* 77/*
@@ -154,8 +172,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)];
154#ifndef __ASSEMBLY__ 172#ifndef __ASSEMBLY__
155int hash_huge_page(struct mm_struct *mm, unsigned long access, 173int hash_huge_page(struct mm_struct *mm, unsigned long access,
156 unsigned long ea, unsigned long vsid, int local); 174 unsigned long ea, unsigned long vsid, int local);
157
158void hugetlb_mm_free_pgd(struct mm_struct *mm);
159#endif /* __ASSEMBLY__ */ 175#endif /* __ASSEMBLY__ */
160 176
161#define HAVE_ARCH_UNMAPPED_AREA 177#define HAVE_ARCH_UNMAPPED_AREA
@@ -163,7 +179,6 @@ void hugetlb_mm_free_pgd(struct mm_struct *mm);
163#else 179#else
164 180
165#define hash_huge_page(mm,a,ea,vsid,local) -1 181#define hash_huge_page(mm,a,ea,vsid,local) -1
166#define hugetlb_mm_free_pgd(mm) do {} while (0)
167 182
168#endif 183#endif
169 184
@@ -197,39 +212,45 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
197#define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) 212#define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT)))
198#define pte_page(x) pfn_to_page(pte_pfn(x)) 213#define pte_page(x) pfn_to_page(pte_pfn(x))
199 214
200#define pmd_set(pmdp, ptep) \ 215#define pmd_set(pmdp, ptep) ({BUG_ON((u64)ptep < KERNELBASE); pmd_val(*(pmdp)) = (unsigned long)(ptep);})
201 (pmd_val(*(pmdp)) = __ba_to_bpn(ptep))
202#define pmd_none(pmd) (!pmd_val(pmd)) 216#define pmd_none(pmd) (!pmd_val(pmd))
203#define pmd_bad(pmd) (pmd_val(pmd) == 0) 217#define pmd_bad(pmd) (pmd_val(pmd) == 0)
204#define pmd_present(pmd) (pmd_val(pmd) != 0) 218#define pmd_present(pmd) (pmd_val(pmd) != 0)
205#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) 219#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
206#define pmd_page_kernel(pmd) (__bpn_to_ba(pmd_val(pmd))) 220#define pmd_page_kernel(pmd) (pmd_val(pmd))
207#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) 221#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd))
208 222
209#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (__ba_to_bpn(pmdp))) 223#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (unsigned long)(pmdp))
210#define pud_none(pud) (!pud_val(pud)) 224#define pud_none(pud) (!pud_val(pud))
211#define pud_bad(pud) ((pud_val(pud)) == 0UL) 225#define pud_bad(pud) ((pud_val(pud)) == 0)
212#define pud_present(pud) (pud_val(pud) != 0UL) 226#define pud_present(pud) (pud_val(pud) != 0)
213#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) 227#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
214#define pud_page(pud) (__bpn_to_ba(pud_val(pud))) 228#define pud_page(pud) (pud_val(pud))
229
230#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})
231#define pgd_none(pgd) (!pgd_val(pgd))
232#define pgd_bad(pgd) (pgd_val(pgd) == 0)
233#define pgd_present(pgd) (pgd_val(pgd) != 0)
234#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
235#define pgd_page(pgd) (pgd_val(pgd))
215 236
216/* 237/*
217 * Find an entry in a page-table-directory. We combine the address region 238 * Find an entry in a page-table-directory. We combine the address region
218 * (the high order N bits) and the pgd portion of the address. 239 * (the high order N bits) and the pgd portion of the address.
219 */ 240 */
220/* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */ 241/* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */
221#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x7ff) 242#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x1ff)
222 243
223#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 244#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
224 245
225/* Find an entry in the second-level page table.. */ 246#define pud_offset(pgdp, addr) \
247 (((pud_t *) pgd_page(*(pgdp))) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))
248
226#define pmd_offset(pudp,addr) \ 249#define pmd_offset(pudp,addr) \
227 ((pmd_t *) pud_page(*(pudp)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) 250 (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
228 251
229/* Find an entry in the third-level page table.. */
230#define pte_offset_kernel(dir,addr) \ 252#define pte_offset_kernel(dir,addr) \
231 ((pte_t *) pmd_page_kernel(*(dir)) \ 253 (((pte_t *) pmd_page_kernel(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
232 + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
233 254
234#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) 255#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
235#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) 256#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr))
@@ -458,23 +479,20 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr,
458#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) 479#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0)
459 480
460#define pmd_ERROR(e) \ 481#define pmd_ERROR(e) \
461 printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) 482 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
483#define pud_ERROR(e) \
484 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pud_val(e))
462#define pgd_ERROR(e) \ 485#define pgd_ERROR(e) \
463 printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) 486 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
464 487
465extern pgd_t swapper_pg_dir[]; 488extern pgd_t swapper_pg_dir[];
466 489
467extern void paging_init(void); 490extern void paging_init(void);
468 491
469/* 492#ifdef CONFIG_HUGETLB_PAGE
470 * Because the huge pgtables are only 2 level, they can take
471 * at most around 4M, much less than one hugepage which the
472 * process is presumably entitled to use. So we don't bother
473 * freeing up the pagetables on unmap, and wait until
474 * destroy_context() to clean up the lot.
475 */
476#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 493#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
477 do { } while (0) 494 free_pgd_range(tlb, addr, end, floor, ceiling)
495#endif
478 496
479/* 497/*
480 * This gets called at the end of handling a page fault, when 498 * This gets called at the end of handling a page fault, when
diff --git a/include/asm-ppc64/pmc.h b/include/asm-ppc64/pmc.h
index c924748c0bea..d1d297dbccfe 100644
--- a/include/asm-ppc64/pmc.h
+++ b/include/asm-ppc64/pmc.h
@@ -26,4 +26,6 @@ typedef void (*perf_irq_t)(struct pt_regs *);
26int reserve_pmc_hardware(perf_irq_t new_perf_irq); 26int reserve_pmc_hardware(perf_irq_t new_perf_irq);
27void release_pmc_hardware(void); 27void release_pmc_hardware(void);
28 28
29void power4_enable_pmcs(void);
30
29#endif /* _PPC64_PMC_H */ 31#endif /* _PPC64_PMC_H */
diff --git a/include/asm-ppc64/poll.h b/include/asm-ppc64/poll.h
deleted file mode 100644
index 370fa3ba0db4..000000000000
--- a/include/asm-ppc64/poll.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef __PPC64_POLL_H
2#define __PPC64_POLL_H
3
4/*
5 * Copyright (C) 2001 PPC64 Team, IBM Corp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#define POLLIN 0x0001
14#define POLLPRI 0x0002
15#define POLLOUT 0x0004
16#define POLLERR 0x0008
17#define POLLHUP 0x0010
18#define POLLNVAL 0x0020
19#define POLLRDNORM 0x0040
20#define POLLRDBAND 0x0080
21#define POLLWRNORM 0x0100
22#define POLLWRBAND 0x0200
23#define POLLMSG 0x0400
24#define POLLREMOVE 0x1000
25
26struct pollfd {
27 int fd;
28 short events;
29 short revents;
30};
31
32#endif /* __PPC64_POLL_H */
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index 352306cfb579..8bd7aa959385 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -268,6 +268,7 @@
268#define PV_970FX 0x003C 268#define PV_970FX 0x003C
269#define PV_630 0x0040 269#define PV_630 0x0040
270#define PV_630p 0x0041 270#define PV_630p 0x0041
271#define PV_970MP 0x0044
271#define PV_BE 0x0070 272#define PV_BE 0x0070
272 273
273/* Platforms supported by PPC64 */ 274/* Platforms supported by PPC64 */
@@ -310,6 +311,20 @@ name: \
310 .type GLUE(.,name),@function; \ 311 .type GLUE(.,name),@function; \
311GLUE(.,name): 312GLUE(.,name):
312 313
314#define _KPROBE(name) \
315 .section ".kprobes.text","a"; \
316 .align 2 ; \
317 .globl name; \
318 .globl GLUE(.,name); \
319 .section ".opd","aw"; \
320name: \
321 .quad GLUE(.,name); \
322 .quad .TOC.@tocbase; \
323 .quad 0; \
324 .previous; \
325 .type GLUE(.,name),@function; \
326GLUE(.,name):
327
313#define _STATIC(name) \ 328#define _STATIC(name) \
314 .section ".text"; \ 329 .section ".text"; \
315 .align 2 ; \ 330 .align 2 ; \
@@ -382,8 +397,8 @@ extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
382extern struct task_struct *last_task_used_math; 397extern struct task_struct *last_task_used_math;
383extern struct task_struct *last_task_used_altivec; 398extern struct task_struct *last_task_used_altivec;
384 399
385/* 64-bit user address space is 41-bits (2TBs user VM) */ 400/* 64-bit user address space is 44-bits (16TB user VM) */
386#define TASK_SIZE_USER64 (0x0000020000000000UL) 401#define TASK_SIZE_USER64 (0x0000100000000000UL)
387 402
388/* 403/*
389 * 32-bit user address space is 4GB - 1 page 404 * 32-bit user address space is 4GB - 1 page
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h
index 04b1a84f7ca3..dc5330b39509 100644
--- a/include/asm-ppc64/prom.h
+++ b/include/asm-ppc64/prom.h
@@ -22,13 +22,15 @@
22#define RELOC(x) (*PTRRELOC(&(x))) 22#define RELOC(x) (*PTRRELOC(&(x)))
23 23
24/* Definitions used by the flattened device tree */ 24/* Definitions used by the flattened device tree */
25#define OF_DT_HEADER 0xd00dfeed /* 4: version, 4: total size */ 25#define OF_DT_HEADER 0xd00dfeed /* marker */
26#define OF_DT_BEGIN_NODE 0x1 /* Start node: full name */ 26#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
27#define OF_DT_END_NODE 0x2 /* End node */ 27#define OF_DT_END_NODE 0x2 /* End node */
28#define OF_DT_PROP 0x3 /* Property: name off, size, content */ 28#define OF_DT_PROP 0x3 /* Property: name off, size,
29 * content */
30#define OF_DT_NOP 0x4 /* nop */
29#define OF_DT_END 0x9 31#define OF_DT_END 0x9
30 32
31#define OF_DT_VERSION 1 33#define OF_DT_VERSION 0x10
32 34
33/* 35/*
34 * This is what gets passed to the kernel by prom_init or kexec 36 * This is what gets passed to the kernel by prom_init or kexec
@@ -54,7 +56,9 @@ struct boot_param_header
54 u32 version; /* format version */ 56 u32 version; /* format version */
55 u32 last_comp_version; /* last compatible version */ 57 u32 last_comp_version; /* last compatible version */
56 /* version 2 fields below */ 58 /* version 2 fields below */
57 u32 boot_cpuid_phys; /* Which physical CPU id we're booting on */ 59 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
60 /* version 3 fields below */
61 u32 dt_strings_size; /* size of the DT strings block */
58}; 62};
59 63
60 64
diff --git a/include/asm-ppc64/resource.h b/include/asm-ppc64/resource.h
deleted file mode 100644
index add031b9dfd4..000000000000
--- a/include/asm-ppc64/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PPC64_RESOURCE_H
2#define _PPC64_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* _PPC64_RESOURCE_H */
diff --git a/include/asm-ppc64/string.h b/include/asm-ppc64/string.h
deleted file mode 100644
index eeca68ef1e91..000000000000
--- a/include/asm-ppc64/string.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef _PPC64_STRING_H_
2#define _PPC64_STRING_H_
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#define __HAVE_ARCH_STRCPY
12#define __HAVE_ARCH_STRNCPY
13#define __HAVE_ARCH_STRLEN
14#define __HAVE_ARCH_STRCMP
15#define __HAVE_ARCH_STRCAT
16#define __HAVE_ARCH_MEMSET
17#define __HAVE_ARCH_MEMCPY
18#define __HAVE_ARCH_MEMMOVE
19#define __HAVE_ARCH_MEMCMP
20#define __HAVE_ARCH_MEMCHR
21
22extern int strcasecmp(const char *, const char *);
23extern int strncasecmp(const char *, const char *, int);
24extern char * strcpy(char *,const char *);
25extern char * strncpy(char *,const char *, __kernel_size_t);
26extern __kernel_size_t strlen(const char *);
27extern int strcmp(const char *,const char *);
28extern char * strcat(char *, const char *);
29extern void * memset(void *,int,__kernel_size_t);
30extern void * memcpy(void *,const void *,__kernel_size_t);
31extern void * memmove(void *,const void *,__kernel_size_t);
32extern int memcmp(const void *,const void *,__kernel_size_t);
33extern void * memchr(const void *,int,__kernel_size_t);
34
35#endif /* _PPC64_STRING_H_ */
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index 98d120ca8a91..c0396428cc3c 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -88,7 +88,7 @@ DEBUGGER_BOILERPLATE(debugger_dabr_match)
88DEBUGGER_BOILERPLATE(debugger_fault_handler) 88DEBUGGER_BOILERPLATE(debugger_fault_handler)
89 89
90#ifdef CONFIG_XMON 90#ifdef CONFIG_XMON
91extern void xmon_init(void); 91extern void xmon_init(int enable);
92#endif 92#endif
93 93
94#else 94#else
@@ -158,7 +158,7 @@ static inline int __is_processor(unsigned long pv)
158 * is more like most of the other architectures. 158 * is more like most of the other architectures.
159 */ 159 */
160static __inline__ unsigned long 160static __inline__ unsigned long
161__xchg_u32(volatile int *m, unsigned long val) 161__xchg_u32(volatile unsigned int *m, unsigned long val)
162{ 162{
163 unsigned long dummy; 163 unsigned long dummy;
164 164
@@ -200,7 +200,7 @@ __xchg_u64(volatile long *m, unsigned long val)
200extern void __xchg_called_with_bad_pointer(void); 200extern void __xchg_called_with_bad_pointer(void);
201 201
202static __inline__ unsigned long 202static __inline__ unsigned long
203__xchg(volatile void *ptr, unsigned long x, int size) 203__xchg(volatile void *ptr, unsigned long x, unsigned int size)
204{ 204{
205 switch (size) { 205 switch (size) {
206 case 4: 206 case 4:
@@ -223,7 +223,7 @@ __xchg(volatile void *ptr, unsigned long x, int size)
223#define __HAVE_ARCH_CMPXCHG 1 223#define __HAVE_ARCH_CMPXCHG 1
224 224
225static __inline__ unsigned long 225static __inline__ unsigned long
226__cmpxchg_u32(volatile int *p, int old, int new) 226__cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
227{ 227{
228 unsigned int prev; 228 unsigned int prev;
229 229
@@ -271,7 +271,8 @@ __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new)
271extern void __cmpxchg_called_with_bad_pointer(void); 271extern void __cmpxchg_called_with_bad_pointer(void);
272 272
273static __inline__ unsigned long 273static __inline__ unsigned long
274__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 274__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
275 unsigned int size)
275{ 276{
276 switch (size) { 277 switch (size) {
277 case 4: 278 case 4:
@@ -283,13 +284,9 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
283 return old; 284 return old;
284} 285}
285 286
286#define cmpxchg(ptr,o,n) \ 287#define cmpxchg(ptr,o,n)\
287 ({ \ 288 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
288 __typeof__(*(ptr)) _o_ = (o); \ 289 (unsigned long)(n),sizeof(*(ptr))))
289 __typeof__(*(ptr)) _n_ = (n); \
290 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
291 (unsigned long)_n_, sizeof(*(ptr))); \
292 })
293 290
294/* 291/*
295 * We handle most unaligned accesses in hardware. On the other hand 292 * We handle most unaligned accesses in hardware. On the other hand
@@ -302,5 +299,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
302 299
303#define arch_align_stack(x) (x) 300#define arch_align_stack(x) (x)
304 301
302extern unsigned long reloc_offset(void);
303
305#endif /* __KERNEL__ */ 304#endif /* __KERNEL__ */
306#endif 305#endif
diff --git a/include/asm-ppc64/types.h b/include/asm-ppc64/types.h
index 5b8c2cfa1138..bf294c1761b2 100644
--- a/include/asm-ppc64/types.h
+++ b/include/asm-ppc64/types.h
@@ -72,7 +72,6 @@ typedef struct {
72 unsigned long env; 72 unsigned long env;
73} func_descr_t; 73} func_descr_t;
74 74
75typedef unsigned int kmem_bufctl_t;
76#endif /* __ASSEMBLY__ */ 75#endif /* __ASSEMBLY__ */
77 76
78#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h
index 05b5943ab1ee..c181a60d868c 100644
--- a/include/asm-ppc64/uaccess.h
+++ b/include/asm-ppc64/uaccess.h
@@ -56,13 +56,6 @@
56#define access_ok(type,addr,size) \ 56#define access_ok(type,addr,size) \
57 __access_ok(((__force unsigned long)(addr)),(size),get_fs()) 57 __access_ok(((__force unsigned long)(addr)),(size),get_fs())
58 58
59/* this function will go away soon - use access_ok() instead */
60static inline int __deprecated verify_area(int type, const void __user *addr, unsigned long size)
61{
62 return access_ok(type,addr,size) ? 0 : -EFAULT;
63}
64
65
66/* 59/*
67 * The exception table consists of pairs of addresses: the first is the 60 * The exception table consists of pairs of addresses: the first is the
68 * address of an instruction that is allowed to fault, and the second is 61 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-ppc64/udbg.h b/include/asm-ppc64/udbg.h
index a6e04d014b2b..c786604aef02 100644
--- a/include/asm-ppc64/udbg.h
+++ b/include/asm-ppc64/udbg.h
@@ -2,6 +2,7 @@
2#define __UDBG_HDR 2#define __UDBG_HDR
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/init.h>
5 6
6/* 7/*
7 * c 2001 PPC 64 Team, IBM Corp 8 * c 2001 PPC 64 Team, IBM Corp
@@ -12,17 +13,19 @@
12 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
13 */ 14 */
14 15
15void udbg_init_uart(void __iomem *comport, unsigned int speed); 16extern void (*udbg_putc)(unsigned char c);
16void udbg_putc(unsigned char c); 17extern unsigned char (*udbg_getc)(void);
17unsigned char udbg_getc(void); 18extern int (*udbg_getc_poll)(void);
18int udbg_getc_poll(void);
19void udbg_puts(const char *s);
20int udbg_write(const char *s, int n);
21int udbg_read(char *buf, int buflen);
22struct console;
23void udbg_console_write(struct console *con, const char *s, unsigned int n);
24void udbg_printf(const char *fmt, ...);
25void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
26unsigned long udbg_ifdebug(unsigned long flags);
27 19
20extern void udbg_puts(const char *s);
21extern int udbg_write(const char *s, int n);
22extern int udbg_read(char *buf, int buflen);
23
24extern void register_early_udbg_console(void);
25extern void udbg_printf(const char *fmt, ...);
26extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
27extern unsigned long udbg_ifdebug(unsigned long flags);
28extern void __init ppcdbg_initialize(void);
29
30extern void udbg_init_uart(void __iomem *comport, unsigned int speed);
28#endif 31#endif
diff --git a/include/asm-ppc64/unaligned.h b/include/asm-ppc64/unaligned.h
deleted file mode 100644
index 636e93c4f379..000000000000
--- a/include/asm-ppc64/unaligned.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __PPC64_UNALIGNED_H
2#define __PPC64_UNALIGNED_H
3
4/*
5 * The PowerPC can do unaligned accesses itself in big endian mode.
6 *
7 * The strange macros are there to make sure these can't
8 * be misused in a way that makes them not work on other
9 * architectures where unaligned accesses aren't as simple.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#define get_unaligned(ptr) (*(ptr))
18
19#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
20
21#endif /* __PPC64_UNALIGNED_H */
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h
index 20cd98ee6337..03f1b95f433b 100644
--- a/include/asm-ppc64/vio.h
+++ b/include/asm-ppc64/vio.h
@@ -19,13 +19,15 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22#include <linux/mod_devicetable.h>
23
22#include <asm/hvcall.h> 24#include <asm/hvcall.h>
23#include <asm/prom.h>
24#include <asm/scatterlist.h> 25#include <asm/scatterlist.h>
25/* 26
27/*
26 * Architecture-specific constants for drivers to 28 * Architecture-specific constants for drivers to
27 * extract attributes of the device using vio_get_attribute() 29 * extract attributes of the device using vio_get_attribute()
28*/ 30 */
29#define VETH_MAC_ADDR "local-mac-address" 31#define VETH_MAC_ADDR "local-mac-address"
30#define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters" 32#define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters"
31 33
@@ -37,64 +39,65 @@
37#define VIO_IRQ_DISABLE 0UL 39#define VIO_IRQ_DISABLE 0UL
38#define VIO_IRQ_ENABLE 1UL 40#define VIO_IRQ_ENABLE 1UL
39 41
40struct vio_dev;
41struct vio_driver;
42struct vio_device_id;
43struct iommu_table; 42struct iommu_table;
44 43
45int vio_register_driver(struct vio_driver *drv); 44/*
46void vio_unregister_driver(struct vio_driver *drv); 45 * The vio_dev structure is used to describe virtual I/O devices.
47 46 */
48#ifdef CONFIG_PPC_PSERIES 47struct vio_dev {
49struct vio_dev * __devinit vio_register_device_node( 48 struct iommu_table *iommu_table; /* vio_map_* uses this */
50 struct device_node *node_vdev); 49 char *name;
51#endif
52void __devinit vio_unregister_device(struct vio_dev *dev);
53struct vio_dev *vio_find_node(struct device_node *vnode);
54
55const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length);
56int vio_get_irq(struct vio_dev *dev);
57int vio_enable_interrupts(struct vio_dev *dev);
58int vio_disable_interrupts(struct vio_dev *dev);
59
60extern struct dma_mapping_ops vio_dma_ops;
61
62extern struct bus_type vio_bus_type;
63
64struct vio_device_id {
65 char *type; 50 char *type;
66 char *compat; 51 uint32_t unit_address;
52 unsigned int irq;
53 struct device dev;
67}; 54};
68 55
69struct vio_driver { 56struct vio_driver {
70 struct list_head node; 57 struct list_head node;
71 char *name; 58 char *name;
72 const struct vio_device_id *id_table; /* NULL if wants all devices */ 59 const struct vio_device_id *id_table;
73 int (*probe) (struct vio_dev *dev, const struct vio_device_id *id); /* New device inserted */ 60 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
74 int (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 61 int (*remove)(struct vio_dev *dev);
75 unsigned long driver_data; 62 unsigned long driver_data;
76
77 struct device_driver driver; 63 struct device_driver driver;
78}; 64};
79 65
66struct vio_bus_ops {
67 int (*match)(const struct vio_device_id *id, const struct vio_dev *dev);
68 void (*unregister_device)(struct vio_dev *);
69 void (*release_device)(struct device *);
70};
71
72extern struct dma_mapping_ops vio_dma_ops;
73extern struct bus_type vio_bus_type;
74extern struct vio_dev vio_bus_device;
75
76extern int vio_register_driver(struct vio_driver *drv);
77extern void vio_unregister_driver(struct vio_driver *drv);
78
79extern struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev);
80extern void __devinit vio_unregister_device(struct vio_dev *dev);
81
82extern int vio_bus_init(struct vio_bus_ops *);
83
84#ifdef CONFIG_PPC_PSERIES
85struct device_node;
86
87extern struct vio_dev * __devinit vio_register_device_node(
88 struct device_node *node_vdev);
89extern struct vio_dev *vio_find_node(struct device_node *vnode);
90extern const void *vio_get_attribute(struct vio_dev *vdev, void *which,
91 int *length);
92extern int vio_enable_interrupts(struct vio_dev *dev);
93extern int vio_disable_interrupts(struct vio_dev *dev);
94#endif
95
80static inline struct vio_driver *to_vio_driver(struct device_driver *drv) 96static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
81{ 97{
82 return container_of(drv, struct vio_driver, driver); 98 return container_of(drv, struct vio_driver, driver);
83} 99}
84 100
85/*
86 * The vio_dev structure is used to describe virtual I/O devices.
87 */
88struct vio_dev {
89 struct iommu_table *iommu_table; /* vio_map_* uses this */
90 char *name;
91 char *type;
92 uint32_t unit_address;
93 unsigned int irq;
94
95 struct device dev;
96};
97
98static inline struct vio_dev *to_vio_dev(struct device *dev) 101static inline struct vio_dev *to_vio_dev(struct device *dev)
99{ 102{
100 return container_of(dev, struct vio_dev, dev); 103 return container_of(dev, struct vio_dev, dev);
diff --git a/include/asm-ppc64/xor.h b/include/asm-ppc64/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/include/asm-ppc64/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/include/asm-s390/auxvec.h b/include/asm-s390/auxvec.h
new file mode 100644
index 000000000000..0d340720fd99
--- /dev/null
+++ b/include/asm-s390/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMS390_AUXVEC_H
2#define __ASMS390_AUXVEC_H
3
4#endif
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h
index 7f8f544eb262..a007715f4aea 100644
--- a/include/asm-s390/compat.h
+++ b/include/asm-s390/compat.h
@@ -13,10 +13,10 @@ typedef s32 compat_ssize_t;
13typedef s32 compat_time_t; 13typedef s32 compat_time_t;
14typedef s32 compat_clock_t; 14typedef s32 compat_clock_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u16 compat_uid_t; 16typedef u16 __compat_uid_t;
17typedef u16 compat_gid_t; 17typedef u16 __compat_gid_t;
18typedef u32 compat_uid32_t; 18typedef u32 __compat_uid32_t;
19typedef u32 compat_gid32_t; 19typedef u32 __compat_gid32_t;
20typedef u16 compat_mode_t; 20typedef u16 compat_mode_t;
21typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
22typedef u16 compat_dev_t; 22typedef u16 compat_dev_t;
@@ -51,8 +51,8 @@ struct compat_stat {
51 compat_ino_t st_ino; 51 compat_ino_t st_ino;
52 compat_mode_t st_mode; 52 compat_mode_t st_mode;
53 compat_nlink_t st_nlink; 53 compat_nlink_t st_nlink;
54 compat_uid_t st_uid; 54 __compat_uid_t st_uid;
55 compat_gid_t st_gid; 55 __compat_gid_t st_gid;
56 compat_dev_t st_rdev; 56 compat_dev_t st_rdev;
57 u16 __pad2; 57 u16 __pad2;
58 u32 st_size; 58 u32 st_size;
@@ -140,10 +140,10 @@ static inline void __user *compat_alloc_user_space(long len)
140 140
141struct compat_ipc64_perm { 141struct compat_ipc64_perm {
142 compat_key_t key; 142 compat_key_t key;
143 compat_uid32_t uid; 143 __compat_uid32_t uid;
144 compat_gid32_t gid; 144 __compat_gid32_t gid;
145 compat_uid32_t cuid; 145 __compat_uid32_t cuid;
146 compat_gid32_t cgid; 146 __compat_gid32_t cgid;
147 compat_mode_t mode; 147 compat_mode_t mode;
148 unsigned short __pad1; 148 unsigned short __pad1;
149 unsigned short seq; 149 unsigned short seq;
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h
index 92360d90144b..7127030ae162 100644
--- a/include/asm-s390/debug.h
+++ b/include/asm-s390/debug.h
@@ -52,8 +52,6 @@ struct __debug_entry{
52#define DEBUG_DATA(entry) (char*)(entry + 1) /* data is stored behind */ 52#define DEBUG_DATA(entry) (char*)(entry + 1) /* data is stored behind */
53 /* the entry information */ 53 /* the entry information */
54 54
55#define STCK(x) asm volatile ("STCK 0(%1)" : "=m" (x) : "a" (&(x)) : "cc")
56
57typedef struct __debug_entry debug_entry_t; 55typedef struct __debug_entry debug_entry_t;
58 56
59struct debug_view; 57struct debug_view;
diff --git a/include/asm-s390/fcntl.h b/include/asm-s390/fcntl.h
index 48f692b45732..46ab12db5739 100644
--- a/include/asm-s390/fcntl.h
+++ b/include/asm-s390/fcntl.h
@@ -1,97 +1 @@
1/* #include <asm-generic/fcntl.h>
2 * include/asm-s390/fcntl.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/fcntl.h"
7 */
8#ifndef _S390_FCNTL_H
9#define _S390_FCNTL_H
10
11/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
12 located on an ext2 file system */
13#define O_ACCMODE 0003
14#define O_RDONLY 00
15#define O_WRONLY 01
16#define O_RDWR 02
17#define O_CREAT 0100 /* not fcntl */
18#define O_EXCL 0200 /* not fcntl */
19#define O_NOCTTY 0400 /* not fcntl */
20#define O_TRUNC 01000 /* not fcntl */
21#define O_APPEND 02000
22#define O_NONBLOCK 04000
23#define O_NDELAY O_NONBLOCK
24#define O_SYNC 010000
25#define FASYNC 020000 /* fcntl, for BSD compatibility */
26#define O_DIRECT 040000 /* direct disk access hint */
27#define O_LARGEFILE 0100000
28#define O_DIRECTORY 0200000 /* must be a directory */
29#define O_NOFOLLOW 0400000 /* don't follow links */
30#define O_NOATIME 01000000
31
32#define F_DUPFD 0 /* dup */
33#define F_GETFD 1 /* get close_on_exec */
34#define F_SETFD 2 /* set/clear close_on_exec */
35#define F_GETFL 3 /* get file->f_flags */
36#define F_SETFL 4 /* set file->f_flags */
37#define F_GETLK 5
38#define F_SETLK 6
39#define F_SETLKW 7
40
41#define F_SETOWN 8 /* for sockets. */
42#define F_GETOWN 9 /* for sockets. */
43#define F_SETSIG 10 /* for sockets. */
44#define F_GETSIG 11 /* for sockets. */
45
46#ifndef __s390x__
47#define F_GETLK64 12 /* using 'struct flock64' */
48#define F_SETLK64 13
49#define F_SETLKW64 14
50#endif /* ! __s390x__ */
51
52/* for F_[GET|SET]FL */
53#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
54
55/* for posix fcntl() and lockf() */
56#define F_RDLCK 0
57#define F_WRLCK 1
58#define F_UNLCK 2
59
60/* for old implementation of bsd flock () */
61#define F_EXLCK 4 /* or 3 */
62#define F_SHLCK 8 /* or 4 */
63
64/* for leases */
65#define F_INPROGRESS 16
66
67/* operations for bsd flock(), also used by the kernel implementation */
68#define LOCK_SH 1 /* shared lock */
69#define LOCK_EX 2 /* exclusive lock */
70#define LOCK_NB 4 /* or'd with one of the above to prevent
71 blocking */
72#define LOCK_UN 8 /* remove lock */
73
74#define LOCK_MAND 32 /* This is a mandatory flock */
75#define LOCK_READ 64 /* ... Which allows concurrent read operations */
76#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
77#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
78
79struct flock {
80 short l_type;
81 short l_whence;
82 off_t l_start;
83 off_t l_len;
84 pid_t l_pid;
85};
86
87#ifndef __s390x__
88struct flock64 {
89 short l_type;
90 short l_whence;
91 loff_t l_start;
92 loff_t l_len;
93 pid_t l_pid;
94};
95#endif
96#define F_LINUX_SPECIFIC_BASE 1024
97#endif
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-s390/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index afe6a9f9b0ae..c6f51c9ce3ff 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -68,6 +68,7 @@
68#define __LC_SYSTEM_TIMER 0x270 68#define __LC_SYSTEM_TIMER 0x270
69#define __LC_LAST_UPDATE_CLOCK 0x278 69#define __LC_LAST_UPDATE_CLOCK 0x278
70#define __LC_STEAL_CLOCK 0x280 70#define __LC_STEAL_CLOCK 0x280
71#define __LC_RETURN_MCCK_PSW 0x288
71#define __LC_KERNEL_STACK 0xC40 72#define __LC_KERNEL_STACK 0xC40
72#define __LC_THREAD_INFO 0xC44 73#define __LC_THREAD_INFO 0xC44
73#define __LC_ASYNC_STACK 0xC48 74#define __LC_ASYNC_STACK 0xC48
@@ -90,6 +91,7 @@
90#define __LC_SYSTEM_TIMER 0x278 91#define __LC_SYSTEM_TIMER 0x278
91#define __LC_LAST_UPDATE_CLOCK 0x280 92#define __LC_LAST_UPDATE_CLOCK 0x280
92#define __LC_STEAL_CLOCK 0x288 93#define __LC_STEAL_CLOCK 0x288
94#define __LC_RETURN_MCCK_PSW 0x290
93#define __LC_KERNEL_STACK 0xD40 95#define __LC_KERNEL_STACK 0xD40
94#define __LC_THREAD_INFO 0xD48 96#define __LC_THREAD_INFO 0xD48
95#define __LC_ASYNC_STACK 0xD50 97#define __LC_ASYNC_STACK 0xD50
@@ -196,7 +198,8 @@ struct _lowcore
196 __u64 system_timer; /* 0x270 */ 198 __u64 system_timer; /* 0x270 */
197 __u64 last_update_clock; /* 0x278 */ 199 __u64 last_update_clock; /* 0x278 */
198 __u64 steal_clock; /* 0x280 */ 200 __u64 steal_clock; /* 0x280 */
199 __u8 pad8[0xc00-0x288]; /* 0x288 */ 201 psw_t return_mcck_psw; /* 0x288 */
202 __u8 pad8[0xc00-0x290]; /* 0x290 */
200 203
201 /* System info area */ 204 /* System info area */
202 __u32 save_area[16]; /* 0xc00 */ 205 __u32 save_area[16]; /* 0xc00 */
@@ -285,7 +288,8 @@ struct _lowcore
285 __u64 system_timer; /* 0x278 */ 288 __u64 system_timer; /* 0x278 */
286 __u64 last_update_clock; /* 0x280 */ 289 __u64 last_update_clock; /* 0x280 */
287 __u64 steal_clock; /* 0x288 */ 290 __u64 steal_clock; /* 0x288 */
288 __u8 pad8[0xc00-0x290]; /* 0x290 */ 291 psw_t return_mcck_psw; /* 0x290 */
292 __u8 pad8[0xc00-0x2a0]; /* 0x2a0 */
289 /* System info area */ 293 /* System info area */
290 __u64 save_area[16]; /* 0xc00 */ 294 __u64 save_area[16]; /* 0xc00 */
291 __u8 pad9[0xd40-0xc80]; /* 0xc80 */ 295 __u8 pad9[0xd40-0xc80]; /* 0xc80 */
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index 2be287b9df88..2430c561e021 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -111,20 +111,6 @@ static inline void copy_page(void *to, void *from)
111#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) 111#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
112#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 112#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
113 113
114/* Pure 2^n version of get_order */
115extern __inline__ int get_order(unsigned long size)
116{
117 int order;
118
119 size = (size-1) >> (PAGE_SHIFT-1);
120 order = -1;
121 do {
122 size >>= 1;
123 order++;
124 } while (size);
125 return order;
126}
127
128/* 114/*
129 * These are used to make use of C type-checking.. 115 * These are used to make use of C type-checking..
130 */ 116 */
@@ -207,4 +193,6 @@ page_get_storage_key(unsigned long addr)
207 193
208#endif /* __KERNEL__ */ 194#endif /* __KERNEL__ */
209 195
196#include <asm-generic/page.h>
197
210#endif /* _S390_PAGE_H */ 198#endif /* _S390_PAGE_H */
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 0e96eeca4e6b..15a5298c8744 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -22,6 +22,8 @@
22#define SO_BROADCAST 6 22#define SO_BROADCAST 6
23#define SO_SNDBUF 7 23#define SO_SNDBUF 7
24#define SO_RCVBUF 8 24#define SO_RCVBUF 8
25#define SO_SNDBUFFORCE 32
26#define SO_RCVBUFFORCE 33
25#define SO_KEEPALIVE 9 27#define SO_KEEPALIVE 9
26#define SO_OOBINLINE 10 28#define SO_OOBINLINE 10
27#define SO_NO_CHECK 11 29#define SO_NO_CHECK 11
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 8ff10300f7ee..321b23bba1ec 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -47,7 +47,7 @@ extern int _raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc);
47 47
48static inline void _raw_spin_lock(spinlock_t *lp) 48static inline void _raw_spin_lock(spinlock_t *lp)
49{ 49{
50 unsigned long pc = (unsigned long) __builtin_return_address(0); 50 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
51 51
52 if (unlikely(_raw_compare_and_swap(&lp->lock, 0, pc) != 0)) 52 if (unlikely(_raw_compare_and_swap(&lp->lock, 0, pc) != 0))
53 _raw_spin_lock_wait(lp, pc); 53 _raw_spin_lock_wait(lp, pc);
@@ -55,7 +55,7 @@ static inline void _raw_spin_lock(spinlock_t *lp)
55 55
56static inline int _raw_spin_trylock(spinlock_t *lp) 56static inline int _raw_spin_trylock(spinlock_t *lp)
57{ 57{
58 unsigned long pc = (unsigned long) __builtin_return_address(0); 58 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
59 59
60 if (likely(_raw_compare_and_swap(&lp->lock, 0, pc) == 0)) 60 if (likely(_raw_compare_and_swap(&lp->lock, 0, pc) == 0))
61 return 1; 61 return 1;
diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h
index 3fefd61416a5..d0be3e477013 100644
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -79,8 +79,6 @@ typedef unsigned long u64;
79 79
80typedef u32 dma_addr_t; 80typedef u32 dma_addr_t;
81 81
82typedef unsigned int kmem_bufctl_t;
83
84#ifndef __s390x__ 82#ifndef __s390x__
85typedef union { 83typedef union {
86 unsigned long long pair; 84 unsigned long long pair;
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index a7f43a251f81..38a5cf8ab9e3 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -65,13 +65,6 @@
65 65
66#define access_ok(type,addr,size) __access_ok(addr,size) 66#define access_ok(type,addr,size) __access_ok(addr,size)
67 67
68/* this function will go away soon - use access_ok() instead */
69extern inline int __deprecated verify_area(int type, const void __user *addr,
70 unsigned long size)
71{
72 return access_ok(type, addr, size) ? 0 : -EFAULT;
73}
74
75/* 68/*
76 * The exception table consists of pairs of addresses: the first is the 69 * The exception table consists of pairs of addresses: the first is the
77 * address of an instruction that is allowed to fault, and the second is 70 * address of an instruction that is allowed to fault, and the second is
@@ -149,11 +142,11 @@ struct exception_table_entry
149}) 142})
150#endif 143#endif
151 144
152#ifndef __CHECKER__
153#define __put_user(x, ptr) \ 145#define __put_user(x, ptr) \
154({ \ 146({ \
155 __typeof__(*(ptr)) __x = (x); \ 147 __typeof__(*(ptr)) __x = (x); \
156 int __pu_err; \ 148 int __pu_err; \
149 __chk_user_ptr(ptr); \
157 switch (sizeof (*(ptr))) { \ 150 switch (sizeof (*(ptr))) { \
158 case 1: \ 151 case 1: \
159 case 2: \ 152 case 2: \
@@ -167,14 +160,6 @@ struct exception_table_entry
167 } \ 160 } \
168 __pu_err; \ 161 __pu_err; \
169}) 162})
170#else
171#define __put_user(x, ptr) \
172({ \
173 void __user *p; \
174 p = (ptr); \
175 0; \
176})
177#endif
178 163
179#define put_user(x, ptr) \ 164#define put_user(x, ptr) \
180({ \ 165({ \
@@ -213,11 +198,11 @@ extern int __put_user_bad(void) __attribute__((noreturn));
213}) 198})
214#endif 199#endif
215 200
216#ifndef __CHECKER__
217#define __get_user(x, ptr) \ 201#define __get_user(x, ptr) \
218({ \ 202({ \
219 __typeof__(*(ptr)) __x; \ 203 __typeof__(*(ptr)) __x; \
220 int __gu_err; \ 204 int __gu_err; \
205 __chk_user_ptr(ptr); \
221 switch (sizeof(*(ptr))) { \ 206 switch (sizeof(*(ptr))) { \
222 case 1: \ 207 case 1: \
223 case 2: \ 208 case 2: \
@@ -232,15 +217,6 @@ extern int __put_user_bad(void) __attribute__((noreturn));
232 (x) = __x; \ 217 (x) = __x; \
233 __gu_err; \ 218 __gu_err; \
234}) 219})
235#else
236#define __get_user(x, ptr) \
237({ \
238 void __user *p; \
239 p = (ptr); \
240 0; \
241})
242#endif
243
244 220
245#define get_user(x, ptr) \ 221#define get_user(x, ptr) \
246({ \ 222({ \
diff --git a/include/asm-sh/auxvec.h b/include/asm-sh/auxvec.h
new file mode 100644
index 000000000000..fc21e4db5881
--- /dev/null
+++ b/include/asm-sh/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_SH_AUXVEC_H
2#define __ASM_SH_AUXVEC_H
3
4#endif /* __ASM_SH_AUXVEC_H */
diff --git a/include/asm-sh/fcntl.h b/include/asm-sh/fcntl.h
index 0b3ae524e34c..46ab12db5739 100644
--- a/include/asm-sh/fcntl.h
+++ b/include/asm-sh/fcntl.h
@@ -1,88 +1 @@
1#ifndef __ASM_SH_FCNTL_H #include <asm-generic/fcntl.h>
2#define __ASM_SH_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
20#define O_LARGEFILE 0100000
21#define O_DIRECTORY 0200000 /* must be a directory */
22#define O_NOFOLLOW 0400000 /* don't follow links */
23#define O_NOATIME 01000000
24
25#define F_DUPFD 0 /* dup */
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif /* __ASM_SH_FCNTL_H */
88
diff --git a/include/asm-sh/futex.h b/include/asm-sh/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-sh/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-sh/hdreg.h b/include/asm-sh/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-sh/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 180467be8e7b..324e6cc5ecf7 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -122,24 +122,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
122#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 122#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
123 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 123 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
124 124
125#ifndef __ASSEMBLY__
126
127/* Pure 2^n version of get_order */
128static __inline__ int get_order(unsigned long size)
129{
130 int order;
131
132 size = (size-1) >> (PAGE_SHIFT-1);
133 order = -1;
134 do {
135 size >>= 1;
136 order++;
137 } while (size);
138 return order;
139}
140
141#endif
142
143#endif /* __KERNEL__ */ 125#endif /* __KERNEL__ */
144 126
127#include <asm-generic/page.h>
128
145#endif /* __ASM_SH_PAGE_H */ 129#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
index dde696c3b4c7..553904ff9336 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_RCVBUFFORCE 32
18#define SO_SNDBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
index c4dc126c5621..cb7e183a0a6b 100644
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -58,8 +58,6 @@ typedef u64 sector_t;
58#define HAVE_SECTOR_T 58#define HAVE_SECTOR_T
59#endif 59#endif
60 60
61typedef unsigned int kmem_bufctl_t;
62
63#endif /* __ASSEMBLY__ */ 61#endif /* __ASSEMBLY__ */
64 62
65#endif /* __KERNEL__ */ 63#endif /* __KERNEL__ */
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index fb9e334afa2b..2cb01861e7c5 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -146,12 +146,6 @@ static inline int access_ok(int type, const void __user *p, unsigned long size)
146 return __access_ok(addr, size); 146 return __access_ok(addr, size);
147} 147}
148 148
149/* this function will go away soon - use access_ok() instead */
150static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
151{
152 return access_ok(type,addr,size) ? 0 : -EFAULT;
153}
154
155/* 149/*
156 * Uh, these should become the main single-value transfer routines ... 150 * Uh, these should become the main single-value transfer routines ...
157 * They automatically use the right size if we just have the right 151 * They automatically use the right size if we just have the right
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 245447081f0d..ea89e8f223ea 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -295,8 +295,14 @@
295#define __NR_add_key 285 295#define __NR_add_key 285
296#define __NR_request_key 286 296#define __NR_request_key 286
297#define __NR_keyctl 287 297#define __NR_keyctl 287
298#define __NR_ioprio_set 288
299#define __NR_ioprio_get 289
300#define __NR_inotify_init 290
301#define __NR_inotify_add_watch 291
302#define __NR_inotify_rm_watch 292
298 303
299#define NR_syscalls 288 304
305#define NR_syscalls 293
300 306
301/* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */ 307/* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */
302 308
@@ -406,7 +412,7 @@ register long __sc6 __asm__ ("r6") = (long) arg3; \
406register long __sc7 __asm__ ("r7") = (long) arg4; \ 412register long __sc7 __asm__ ("r7") = (long) arg4; \
407register long __sc0 __asm__ ("r0") = (long) arg5; \ 413register long __sc0 __asm__ ("r0") = (long) arg5; \
408register long __sc1 __asm__ ("r1") = (long) arg6; \ 414register long __sc1 __asm__ ("r1") = (long) arg6; \
409__asm__ __volatile__ ("trapa #0x15" \ 415__asm__ __volatile__ ("trapa #0x16" \
410 : "=z" (__sc0) \ 416 : "=z" (__sc0) \
411 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ 417 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
412 "r" (__sc3), "r" (__sc1) \ 418 "r" (__sc3), "r" (__sc1) \
diff --git a/include/asm-sh64/auxvec.h b/include/asm-sh64/auxvec.h
new file mode 100644
index 000000000000..1ad5a44bdc76
--- /dev/null
+++ b/include/asm-sh64/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_SH64_AUXVEC_H
2#define __ASM_SH64_AUXVEC_H
3
4#endif /* __ASM_SH64_AUXVEC_H */
diff --git a/include/asm-sh64/fcntl.h b/include/asm-sh64/fcntl.h
index ffcc36c64fa5..744dd79b9d5d 100644
--- a/include/asm-sh64/fcntl.h
+++ b/include/asm-sh64/fcntl.h
@@ -1,7 +1 @@
1#ifndef __ASM_SH64_FCNTL_H
2#define __ASM_SH64_FCNTL_H
3
4#include <asm-sh/fcntl.h> #include <asm-sh/fcntl.h>
5
6#endif /* __ASM_SH64_FCNTL_H */
7
diff --git a/include/asm-sh64/futex.h b/include/asm-sh64/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-sh64/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-sh64/hdreg.h b/include/asm-sh64/hdreg.h
deleted file mode 100644
index 52d983635a27..000000000000
--- a/include/asm-sh64/hdreg.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_SH64_HDREG_H
2#define __ASM_SH64_HDREG_H
3
4#include <asm-generic/hdreg.h>
5
6#endif /* __ASM_SH64_HDREG_H */
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h
index d6167f1c0e99..c86df90f7cbd 100644
--- a/include/asm-sh64/page.h
+++ b/include/asm-sh64/page.h
@@ -115,24 +115,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
115#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 115#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
116 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 116 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
117 117
118#ifndef __ASSEMBLY__
119
120/* Pure 2^n version of get_order */
121extern __inline__ int get_order(unsigned long size)
122{
123 int order;
124
125 size = (size-1) >> (PAGE_SHIFT-1);
126 order = -1;
127 do {
128 size >>= 1;
129 order++;
130 } while (size);
131 return order;
132}
133
134#endif
135
136#endif /* __KERNEL__ */ 118#endif /* __KERNEL__ */
137 119
120#include <asm-generic/page.h>
121
138#endif /* __ASM_SH64_PAGE_H */ 122#endif /* __ASM_SH64_PAGE_H */
diff --git a/include/asm-sh64/types.h b/include/asm-sh64/types.h
index 41d4d2f82aa9..8d41db2153b5 100644
--- a/include/asm-sh64/types.h
+++ b/include/asm-sh64/types.h
@@ -65,8 +65,6 @@ typedef u32 dma_addr_t;
65#endif 65#endif
66typedef u64 dma64_addr_t; 66typedef u64 dma64_addr_t;
67 67
68typedef unsigned int kmem_bufctl_t;
69
70#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
71 69
72#define BITS_PER_LONG 32 70#define BITS_PER_LONG 32
diff --git a/include/asm-sh64/uaccess.h b/include/asm-sh64/uaccess.h
index a33654d576a1..56aa3cf0f273 100644
--- a/include/asm-sh64/uaccess.h
+++ b/include/asm-sh64/uaccess.h
@@ -60,12 +60,6 @@
60#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 60#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
61#define __access_ok(addr,size) (__range_ok(addr,size) == 0) 61#define __access_ok(addr,size) (__range_ok(addr,size) == 0)
62 62
63/* this function will go away soon - use access_ok() instead */
64extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
65{
66 return access_ok(type,addr,size) ? 0 : -EFAULT;
67}
68
69/* 63/*
70 * Uh, these should become the main single-value transfer routines ... 64 * Uh, these should become the main single-value transfer routines ...
71 * They automatically use the right size if we just have the right 65 * They automatically use the right size if we just have the right
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index 95f0b130405c..2a1cfa404ea4 100644
--- a/include/asm-sh64/unistd.h
+++ b/include/asm-sh64/unistd.h
@@ -338,8 +338,13 @@
338#define __NR_add_key 313 338#define __NR_add_key 313
339#define __NR_request_key 314 339#define __NR_request_key 314
340#define __NR_keyctl 315 340#define __NR_keyctl 315
341#define __NR_ioprio_set 316
342#define __NR_ioprio_get 317
343#define __NR_inotify_init 318
344#define __NR_inotify_add_watch 319
345#define __NR_inotify_rm_watch 320
341 346
342#define NR_syscalls 316 347#define NR_syscalls 321
343 348
344/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */ 349/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */
345 350
diff --git a/include/asm-sparc/auxvec.h b/include/asm-sparc/auxvec.h
new file mode 100644
index 000000000000..ad6f360261f6
--- /dev/null
+++ b/include/asm-sparc/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMSPARC_AUXVEC_H
2#define __ASMSPARC_AUXVEC_H
3
4#endif /* !(__ASMSPARC_AUXVEC_H) */
diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h
index df9c75d41d68..5db60b5ae7b0 100644
--- a/include/asm-sparc/fcntl.h
+++ b/include/asm-sparc/fcntl.h
@@ -4,10 +4,6 @@
4 4
5/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 5/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
6 located on an ext2 file system */ 6 located on an ext2 file system */
7#define O_RDONLY 0x0000
8#define O_WRONLY 0x0001
9#define O_RDWR 0x0002
10#define O_ACCMODE 0x0003
11#define O_APPEND 0x0008 7#define O_APPEND 0x0008
12#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ 8#define FASYNC 0x0040 /* fcntl, for BSD compatibility */
13#define O_CREAT 0x0200 /* not fcntl */ 9#define O_CREAT 0x0200 /* not fcntl */
@@ -17,73 +13,24 @@
17#define O_NONBLOCK 0x4000 13#define O_NONBLOCK 0x4000
18#define O_NDELAY (0x0004 | O_NONBLOCK) 14#define O_NDELAY (0x0004 | O_NONBLOCK)
19#define O_NOCTTY 0x8000 /* not fcntl */ 15#define O_NOCTTY 0x8000 /* not fcntl */
20#define O_DIRECTORY 0x10000 /* must be a directory */
21#define O_NOFOLLOW 0x20000 /* don't follow links */
22#define O_LARGEFILE 0x40000 16#define O_LARGEFILE 0x40000
23#define O_DIRECT 0x100000 /* direct disk access hint */ 17#define O_DIRECT 0x100000 /* direct disk access hint */
24#define O_NOATIME 0x200000 18#define O_NOATIME 0x200000
25 19
26#define F_DUPFD 0 /* dup */
27#define F_GETFD 1 /* get close_on_exec */
28#define F_SETFD 2 /* set/clear close_on_exec */
29#define F_GETFL 3 /* get file->f_flags */
30#define F_SETFL 4 /* set file->f_flags */
31#define F_GETOWN 5 /* for sockets. */ 20#define F_GETOWN 5 /* for sockets. */
32#define F_SETOWN 6 /* for sockets. */ 21#define F_SETOWN 6 /* for sockets. */
33#define F_GETLK 7 22#define F_GETLK 7
34#define F_SETLK 8 23#define F_SETLK 8
35#define F_SETLKW 9 24#define F_SETLKW 9
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45 25
46/* for posix fcntl() and lockf() */ 26/* for posix fcntl() and lockf() */
47#define F_RDLCK 1 27#define F_RDLCK 1
48#define F_WRLCK 2 28#define F_WRLCK 2
49#define F_UNLCK 3 29#define F_UNLCK 3
50 30
51/* for old implementation of bsd flock () */ 31#define __ARCH_FLOCK_PAD short __unused;
52#define F_EXLCK 4 /* or 3 */ 32#define __ARCH_FLOCK64_PAD short __unused;
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76 short __unused;
77};
78 33
79struct flock64 { 34#include <asm-generic/fcntl.h>
80 short l_type;
81 short l_whence;
82 loff_t l_start;
83 loff_t l_len;
84 pid_t l_pid;
85 short __unused;
86};
87 35
88#define F_LINUX_SPECIFIC_BASE 1024
89#endif 36#endif
diff --git a/include/asm-sparc/futex.h b/include/asm-sparc/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-sparc/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-sparc/hdreg.h b/include/asm-sparc/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-sparc/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 383060e90d94..9122684f6c1e 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -132,20 +132,6 @@ BTFIXUPDEF_SETHI(sparc_unmapped_base)
132 132
133#define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) 133#define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base)
134 134
135/* Pure 2^n version of get_order */
136extern __inline__ int get_order(unsigned long size)
137{
138 int order;
139
140 size = (size-1) >> (PAGE_SHIFT-1);
141 order = -1;
142 do {
143 size >>= 1;
144 order++;
145 } while (size);
146 return order;
147}
148
149#else /* !(__ASSEMBLY__) */ 135#else /* !(__ASSEMBLY__) */
150 136
151#define __pgprot(x) (x) 137#define __pgprot(x) (x)
@@ -178,4 +164,6 @@ extern unsigned long pfn_base;
178 164
179#endif /* __KERNEL__ */ 165#endif /* __KERNEL__ */
180 166
167#include <asm-generic/page.h>
168
181#endif /* _SPARC_PAGE_H */ 169#endif /* _SPARC_PAGE_H */
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 40ed30a2b7c6..8f4f6a959651 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -435,9 +435,6 @@ extern unsigned long *sparc_valid_addr_bitmap;
435#define kern_addr_valid(addr) \ 435#define kern_addr_valid(addr) \
436 (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) 436 (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap))
437 437
438extern int io_remap_page_range(struct vm_area_struct *vma,
439 unsigned long from, unsigned long to,
440 unsigned long size, pgprot_t prot, int space);
441extern int io_remap_pfn_range(struct vm_area_struct *vma, 438extern int io_remap_pfn_range(struct vm_area_struct *vma,
442 unsigned long from, unsigned long pfn, 439 unsigned long from, unsigned long pfn,
443 unsigned long size, pgprot_t prot); 440 unsigned long size, pgprot_t prot);
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index 32c9699367cf..5a7a1a8d29ac 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -19,7 +19,6 @@
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/head.h> 20#include <asm/head.h>
21#include <asm/signal.h> 21#include <asm/signal.h>
22#include <asm/segment.h>
23#include <asm/btfixup.h> 22#include <asm/btfixup.h>
24#include <asm/page.h> 23#include <asm/page.h>
25 24
diff --git a/include/asm-sparc/segment.h b/include/asm-sparc/segment.h
deleted file mode 100644
index a1b7ffc9eec9..000000000000
--- a/include/asm-sparc/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __SPARC_SEGMENT_H
2#define __SPARC_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index c1154e3ecfdf..09575b608adb 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -29,6 +29,8 @@
29 29
30#define SO_SNDBUF 0x1001 30#define SO_SNDBUF 0x1001
31#define SO_RCVBUF 0x1002 31#define SO_RCVBUF 0x1002
32#define SO_SNDBUFFORCE 0x100a
33#define SO_RCVBUFFORCE 0x100b
32#define SO_ERROR 0x1007 34#define SO_ERROR 0x1007
33#define SO_TYPE 0x1008 35#define SO_TYPE 0x1008
34 36
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 898562ebe94c..3557781a4bfd 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -9,7 +9,6 @@
9#include <linux/threads.h> /* NR_CPUS */ 9#include <linux/threads.h> /* NR_CPUS */
10#include <linux/thread_info.h> 10#include <linux/thread_info.h>
11 11
12#include <asm/segment.h>
13#include <asm/page.h> 12#include <asm/page.h>
14#include <asm/psr.h> 13#include <asm/psr.h>
15#include <asm/ptrace.h> 14#include <asm/ptrace.h>
diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h
index 9eabf6e61ccc..42fc6ed98156 100644
--- a/include/asm-sparc/types.h
+++ b/include/asm-sparc/types.h
@@ -54,8 +54,6 @@ typedef unsigned long long u64;
54typedef u32 dma_addr_t; 54typedef u32 dma_addr_t;
55typedef u32 dma64_addr_t; 55typedef u32 dma64_addr_t;
56 56
57typedef unsigned short kmem_bufctl_t;
58
59#endif /* __ASSEMBLY__ */ 57#endif /* __ASSEMBLY__ */
60 58
61#endif /* __KERNEL__ */ 59#endif /* __KERNEL__ */
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
index 0a780e84a12b..f8f1ec1f06e6 100644
--- a/include/asm-sparc/uaccess.h
+++ b/include/asm-sparc/uaccess.h
@@ -47,12 +47,6 @@
47#define access_ok(type, addr, size) \ 47#define access_ok(type, addr, size) \
48 ({ (void)(type); __access_ok((unsigned long)(addr), size); }) 48 ({ (void)(type); __access_ok((unsigned long)(addr), size); })
49 49
50/* this function will go away soon - use access_ok() instead */
51static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
52{
53 return access_ok(type,addr,size) ? 0 : -EFAULT;
54}
55
56/* 50/*
57 * The exception table consists of pairs of addresses: the first is the 51 * The exception table consists of pairs of addresses: the first is the
58 * address of an instruction that is allowed to fault, and the second is 52 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index d80f3379669b..e175afcf2cde 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -72,10 +72,10 @@ extern int atomic64_sub_ret(int, atomic64_t *);
72 72
73/* Atomic operations are already serializing */ 73/* Atomic operations are already serializing */
74#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
75#define smp_mb__before_atomic_dec() membar("#StoreLoad | #LoadLoad") 75#define smp_mb__before_atomic_dec() membar_storeload_loadload();
76#define smp_mb__after_atomic_dec() membar("#StoreLoad | #StoreStore") 76#define smp_mb__after_atomic_dec() membar_storeload_storestore();
77#define smp_mb__before_atomic_inc() membar("#StoreLoad | #LoadLoad") 77#define smp_mb__before_atomic_inc() membar_storeload_loadload();
78#define smp_mb__after_atomic_inc() membar("#StoreLoad | #StoreStore") 78#define smp_mb__after_atomic_inc() membar_storeload_storestore();
79#else 79#else
80#define smp_mb__before_atomic_dec() barrier() 80#define smp_mb__before_atomic_dec() barrier()
81#define smp_mb__after_atomic_dec() barrier() 81#define smp_mb__after_atomic_dec() barrier()
diff --git a/include/asm-sparc64/auxvec.h b/include/asm-sparc64/auxvec.h
new file mode 100644
index 000000000000..436a29129828
--- /dev/null
+++ b/include/asm-sparc64/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_SPARC64_AUXVEC_H
2#define __ASM_SPARC64_AUXVEC_H
3
4#endif /* !(__ASM_SPARC64_AUXVEC_H) */
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 9c5e71970287..6388b8376c50 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -72,8 +72,8 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
72} 72}
73 73
74#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
75#define smp_mb__before_clear_bit() membar("#StoreLoad | #LoadLoad") 75#define smp_mb__before_clear_bit() membar_storeload_loadload()
76#define smp_mb__after_clear_bit() membar("#StoreLoad | #StoreStore") 76#define smp_mb__after_clear_bit() membar_storeload_storestore()
77#else 77#else
78#define smp_mb__before_clear_bit() barrier() 78#define smp_mb__before_clear_bit() barrier()
79#define smp_mb__after_clear_bit() barrier() 79#define smp_mb__after_clear_bit() barrier()
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
index b59122dd176d..c73935dc7ba1 100644
--- a/include/asm-sparc64/compat.h
+++ b/include/asm-sparc64/compat.h
@@ -12,8 +12,10 @@ typedef s32 compat_ssize_t;
12typedef s32 compat_time_t; 12typedef s32 compat_time_t;
13typedef s32 compat_clock_t; 13typedef s32 compat_clock_t;
14typedef s32 compat_pid_t; 14typedef s32 compat_pid_t;
15typedef u16 compat_uid_t; 15typedef u16 __compat_uid_t;
16typedef u16 compat_gid_t; 16typedef u16 __compat_gid_t;
17typedef u32 __compat_uid32_t;
18typedef u32 __compat_gid32_t;
17typedef u16 compat_mode_t; 19typedef u16 compat_mode_t;
18typedef u32 compat_ino_t; 20typedef u32 compat_ino_t;
19typedef u16 compat_dev_t; 21typedef u16 compat_dev_t;
@@ -47,8 +49,8 @@ struct compat_stat {
47 compat_ino_t st_ino; 49 compat_ino_t st_ino;
48 compat_mode_t st_mode; 50 compat_mode_t st_mode;
49 compat_nlink_t st_nlink; 51 compat_nlink_t st_nlink;
50 compat_uid_t st_uid; 52 __compat_uid_t st_uid;
51 compat_gid_t st_gid; 53 __compat_gid_t st_gid;
52 compat_dev_t st_rdev; 54 compat_dev_t st_rdev;
53 compat_off_t st_size; 55 compat_off_t st_size;
54 compat_time_t st_atime; 56 compat_time_t st_atime;
@@ -177,10 +179,10 @@ static __inline__ void __user *compat_alloc_user_space(long len)
177 179
178struct compat_ipc64_perm { 180struct compat_ipc64_perm {
179 compat_key_t key; 181 compat_key_t key;
180 __kernel_uid_t uid; 182 __compat_uid32_t uid;
181 __kernel_gid_t gid; 183 __compat_gid32_t gid;
182 __kernel_uid_t cuid; 184 __compat_uid32_t cuid;
183 __kernel_gid_t cgid; 185 __compat_gid32_t cgid;
184 unsigned short __pad1; 186 unsigned short __pad1;
185 compat_mode_t mode; 187 compat_mode_t mode;
186 unsigned short __pad2; 188 unsigned short __pad2;
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index cc7198aaac50..9a3a81f1cc58 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -1,6 +1,6 @@
1/* cpudata.h: Per-cpu parameters. 1/* cpudata.h: Per-cpu parameters.
2 * 2 *
3 * Copyright (C) 2003 David S. Miller (davem@redhat.com) 3 * Copyright (C) 2003, 2005 David S. Miller (davem@redhat.com)
4 */ 4 */
5 5
6#ifndef _SPARC64_CPUDATA_H 6#ifndef _SPARC64_CPUDATA_H
@@ -10,7 +10,7 @@
10 10
11typedef struct { 11typedef struct {
12 /* Dcache line 1 */ 12 /* Dcache line 1 */
13 unsigned int __pad0; /* bh_count moved to irq_stat for consistency. KAO */ 13 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
14 unsigned int multiplier; 14 unsigned int multiplier;
15 unsigned int counter; 15 unsigned int counter;
16 unsigned int idle_volume; 16 unsigned int idle_volume;
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h
index e36def0d0d80..b2aecf0054bd 100644
--- a/include/asm-sparc64/fcntl.h
+++ b/include/asm-sparc64/fcntl.h
@@ -4,10 +4,6 @@
4 4
5/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 5/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
6 located on an ext2 file system */ 6 located on an ext2 file system */
7#define O_RDONLY 0x0000
8#define O_WRONLY 0x0001
9#define O_RDWR 0x0002
10#define O_ACCMODE 0x0003
11#define O_NDELAY 0x0004 7#define O_NDELAY 0x0004
12#define O_APPEND 0x0008 8#define O_APPEND 0x0008
13#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ 9#define FASYNC 0x0040 /* fcntl, for BSD compatibility */
@@ -17,62 +13,24 @@
17#define O_SYNC 0x2000 13#define O_SYNC 0x2000
18#define O_NONBLOCK 0x4000 14#define O_NONBLOCK 0x4000
19#define O_NOCTTY 0x8000 /* not fcntl */ 15#define O_NOCTTY 0x8000 /* not fcntl */
20#define O_DIRECTORY 0x10000 /* must be a directory */
21#define O_NOFOLLOW 0x20000 /* don't follow links */
22#define O_LARGEFILE 0x40000 16#define O_LARGEFILE 0x40000
23#define O_DIRECT 0x100000 /* direct disk access hint */ 17#define O_DIRECT 0x100000 /* direct disk access hint */
24#define O_NOATIME 0x200000 18#define O_NOATIME 0x200000
25 19
26 20
27#define F_DUPFD 0 /* dup */
28#define F_GETFD 1 /* get close_on_exec */
29#define F_SETFD 2 /* set/clear close_on_exec */
30#define F_GETFL 3 /* get file->f_flags */
31#define F_SETFL 4 /* set file->f_flags */
32#define F_GETOWN 5 /* for sockets. */ 21#define F_GETOWN 5 /* for sockets. */
33#define F_SETOWN 6 /* for sockets. */ 22#define F_SETOWN 6 /* for sockets. */
34#define F_GETLK 7 23#define F_GETLK 7
35#define F_SETLK 8 24#define F_SETLK 8
36#define F_SETLKW 9 25#define F_SETLKW 9
37#define F_SETSIG 10 /* for sockets. */
38#define F_GETSIG 11 /* for sockets. */
39
40/* for F_[GET|SET]FL */
41#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
42 26
43/* for posix fcntl() and lockf() */ 27/* for posix fcntl() and lockf() */
44#define F_RDLCK 1 28#define F_RDLCK 1
45#define F_WRLCK 2 29#define F_WRLCK 2
46#define F_UNLCK 3 30#define F_UNLCK 3
47 31
48/* for old implementation of bsd flock () */ 32#define __ARCH_FLOCK_PAD short __unused;
49#define F_EXLCK 4 /* or 3 */
50#define F_SHLCK 8 /* or 4 */
51
52/* for leases */
53#define F_INPROGRESS 16
54
55/* operations for bsd flock(), also used by the kernel implementation */
56#define LOCK_SH 1 /* shared lock */
57#define LOCK_EX 2 /* exclusive lock */
58#define LOCK_NB 4 /* or'd with one of the above to prevent
59 blocking */
60#define LOCK_UN 8 /* remove lock */
61
62#define LOCK_MAND 32 /* This is a mandatory flock */
63#define LOCK_READ 64 /* ... Which allows concurrent read operations */
64#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
65#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
66
67struct flock {
68 short l_type;
69 short l_whence;
70 off_t l_start;
71 off_t l_len;
72 pid_t l_pid;
73 short __unused;
74};
75 33
76#define F_LINUX_SPECIFIC_BASE 1024 34#include <asm-generic/fcntl.h>
77 35
78#endif /* !(_SPARC64_FCNTL_H) */ 36#endif /* !(_SPARC64_FCNTL_H) */
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-sparc64/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
index d6db1aed7645..f0cf71376ec5 100644
--- a/include/asm-sparc64/hardirq.h
+++ b/include/asm-sparc64/hardirq.h
@@ -1,22 +1,16 @@
1/* hardirq.h: 64-bit Sparc hard IRQ support. 1/* hardirq.h: 64-bit Sparc hard IRQ support.
2 * 2 *
3 * Copyright (C) 1997, 1998 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1997, 1998, 2005 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#ifndef __SPARC64_HARDIRQ_H 6#ifndef __SPARC64_HARDIRQ_H
7#define __SPARC64_HARDIRQ_H 7#define __SPARC64_HARDIRQ_H
8 8
9#include <linux/config.h> 9#include <asm/cpudata.h>
10#include <linux/threads.h>
11#include <linux/spinlock.h>
12#include <linux/cache.h>
13 10
14/* rtrap.S is sensitive to the offsets of these fields */ 11#define __ARCH_IRQ_STAT
15typedef struct { 12#define local_softirq_pending() \
16 unsigned int __softirq_pending; 13 (local_cpu_data().__softirq_pending)
17} ____cacheline_aligned irq_cpustat_t;
18
19#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
20 14
21#define HARDIRQ_BITS 8 15#define HARDIRQ_BITS 8
22 16
diff --git a/include/asm-sparc64/hdreg.h b/include/asm-sparc64/hdreg.h
deleted file mode 100644
index 7f7fd1af0af3..000000000000
--- a/include/asm-sparc64/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hdreg.h>
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index afdcea90707a..0056770e83ad 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -100,18 +100,41 @@ static __inline__ void _outl(u32 l, unsigned long addr)
100#define inl_p(__addr) inl(__addr) 100#define inl_p(__addr) inl(__addr)
101#define outl_p(__l, __addr) outl(__l, __addr) 101#define outl_p(__l, __addr) outl(__l, __addr)
102 102
103extern void outsb(void __iomem *addr, const void *src, unsigned long count); 103extern void outsb(unsigned long, const void *, unsigned long);
104extern void outsw(void __iomem *addr, const void *src, unsigned long count); 104extern void outsw(unsigned long, const void *, unsigned long);
105extern void outsl(void __iomem *addr, const void *src, unsigned long count); 105extern void outsl(unsigned long, const void *, unsigned long);
106extern void insb(void __iomem *addr, void *dst, unsigned long count); 106extern void insb(unsigned long, void *, unsigned long);
107extern void insw(void __iomem *addr, void *dst, unsigned long count); 107extern void insw(unsigned long, void *, unsigned long);
108extern void insl(void __iomem *addr, void *dst, unsigned long count); 108extern void insl(unsigned long, void *, unsigned long);
109#define ioread8_rep(a,d,c) insb(a,d,c) 109
110#define ioread16_rep(a,d,c) insw(a,d,c) 110static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
111#define ioread32_rep(a,d,c) insl(a,d,c) 111{
112#define iowrite8_rep(a,s,c) outsb(a,s,c) 112 insb((unsigned long __force)port, buf, count);
113#define iowrite16_rep(a,s,c) outsw(a,s,c) 113}
114#define iowrite32_rep(a,s,c) outsl(a,s,c) 114static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count)
115{
116 insw((unsigned long __force)port, buf, count);
117}
118
119static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count)
120{
121 insl((unsigned long __force)port, buf, count);
122}
123
124static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count)
125{
126 outsb((unsigned long __force)port, buf, count);
127}
128
129static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count)
130{
131 outsw((unsigned long __force)port, buf, count);
132}
133
134static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count)
135{
136 outsl((unsigned long __force)port, buf, count);
137}
115 138
116/* Memory functions, same as I/O accesses on Ultra. */ 139/* Memory functions, same as I/O accesses on Ultra. */
117static inline u8 _readb(const volatile void __iomem *addr) 140static inline u8 _readb(const volatile void __iomem *addr)
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index b87dbbd64bc9..c9f8ef208ea5 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -150,20 +150,6 @@ struct sparc_phys_banks {
150 150
151extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; 151extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
152 152
153/* Pure 2^n version of get_order */
154static __inline__ int get_order(unsigned long size)
155{
156 int order;
157
158 size = (size-1) >> (PAGE_SHIFT-1);
159 order = -1;
160 do {
161 size >>= 1;
162 order++;
163 } while (size);
164 return order;
165}
166
167#endif /* !(__ASSEMBLY__) */ 153#endif /* !(__ASSEMBLY__) */
168 154
169#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 155#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
@@ -171,4 +157,6 @@ static __inline__ int get_order(unsigned long size)
171 157
172#endif /* !(__KERNEL__) */ 158#endif /* !(__KERNEL__) */
173 159
160#include <asm-generic/page.h>
161
174#endif /* !(_SPARC64_PAGE_H) */ 162#endif /* !(_SPARC64_PAGE_H) */
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 1ae00c5087f1..a2b4f5ed4625 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -410,9 +410,6 @@ extern unsigned long *sparc64_valid_addr_bitmap;
410#define kern_addr_valid(addr) \ 410#define kern_addr_valid(addr) \
411 (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) 411 (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap))
412 412
413extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from,
414 unsigned long offset,
415 unsigned long size, pgprot_t prot, int space);
416extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 413extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
417 unsigned long pfn, 414 unsigned long pfn,
418 unsigned long size, pgprot_t prot); 415 unsigned long size, pgprot_t prot);
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index d0bee2413560..3169f3e2237e 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -18,7 +18,6 @@
18#include <asm/a.out.h> 18#include <asm/a.out.h>
19#include <asm/pstate.h> 19#include <asm/pstate.h>
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/segment.h>
22#include <asm/page.h> 21#include <asm/page.h>
23 22
24/* The sparc has no problems with write protection */ 23/* The sparc has no problems with write protection */
diff --git a/include/asm-sparc64/segment.h b/include/asm-sparc64/segment.h
deleted file mode 100644
index b03e709fc945..000000000000
--- a/include/asm-sparc64/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __SPARC64_SEGMENT_H
2#define __SPARC64_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif
diff --git a/include/asm-sparc64/sfafsr.h b/include/asm-sparc64/sfafsr.h
new file mode 100644
index 000000000000..2f792c20b53c
--- /dev/null
+++ b/include/asm-sparc64/sfafsr.h
@@ -0,0 +1,82 @@
1#ifndef _SPARC64_SFAFSR_H
2#define _SPARC64_SFAFSR_H
3
4#include <asm/const.h>
5
6/* Spitfire Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */
7
8#define SFAFSR_ME (_AC(1,UL) << SFAFSR_ME_SHIFT)
9#define SFAFSR_ME_SHIFT 32
10#define SFAFSR_PRIV (_AC(1,UL) << SFAFSR_PRIV_SHIFT)
11#define SFAFSR_PRIV_SHIFT 31
12#define SFAFSR_ISAP (_AC(1,UL) << SFAFSR_ISAP_SHIFT)
13#define SFAFSR_ISAP_SHIFT 30
14#define SFAFSR_ETP (_AC(1,UL) << SFAFSR_ETP_SHIFT)
15#define SFAFSR_ETP_SHIFT 29
16#define SFAFSR_IVUE (_AC(1,UL) << SFAFSR_IVUE_SHIFT)
17#define SFAFSR_IVUE_SHIFT 28
18#define SFAFSR_TO (_AC(1,UL) << SFAFSR_TO_SHIFT)
19#define SFAFSR_TO_SHIFT 27
20#define SFAFSR_BERR (_AC(1,UL) << SFAFSR_BERR_SHIFT)
21#define SFAFSR_BERR_SHIFT 26
22#define SFAFSR_LDP (_AC(1,UL) << SFAFSR_LDP_SHIFT)
23#define SFAFSR_LDP_SHIFT 25
24#define SFAFSR_CP (_AC(1,UL) << SFAFSR_CP_SHIFT)
25#define SFAFSR_CP_SHIFT 24
26#define SFAFSR_WP (_AC(1,UL) << SFAFSR_WP_SHIFT)
27#define SFAFSR_WP_SHIFT 23
28#define SFAFSR_EDP (_AC(1,UL) << SFAFSR_EDP_SHIFT)
29#define SFAFSR_EDP_SHIFT 22
30#define SFAFSR_UE (_AC(1,UL) << SFAFSR_UE_SHIFT)
31#define SFAFSR_UE_SHIFT 21
32#define SFAFSR_CE (_AC(1,UL) << SFAFSR_CE_SHIFT)
33#define SFAFSR_CE_SHIFT 20
34#define SFAFSR_ETS (_AC(0xf,UL) << SFAFSR_ETS_SHIFT)
35#define SFAFSR_ETS_SHIFT 16
36#define SFAFSR_PSYND (_AC(0xffff,UL) << SFAFSR_PSYND_SHIFT)
37#define SFAFSR_PSYND_SHIFT 0
38
39/* UDB Error Register, ASI=0x7f VA<63:0>=0x0(High),0x18(Low) for read
40 * ASI=0x77 VA<63:0>=0x0(High),0x18(Low) for write
41 */
42
43#define UDBE_UE (_AC(1,UL) << 9)
44#define UDBE_CE (_AC(1,UL) << 8)
45#define UDBE_E_SYNDR (_AC(0xff,UL) << 0)
46
47/* The trap handlers for asynchronous errors encode the AFSR and
48 * other pieces of information into a 64-bit argument for C code
49 * encoded as follows:
50 *
51 * -----------------------------------------------
52 * | UDB_H | UDB_L | TL>1 | TT | AFSR |
53 * -----------------------------------------------
54 * 63 54 53 44 42 41 33 32 0
55 *
56 * The AFAR is passed in unchanged.
57 */
58#define SFSTAT_UDBH_MASK (_AC(0x3ff,UL) << SFSTAT_UDBH_SHIFT)
59#define SFSTAT_UDBH_SHIFT 54
60#define SFSTAT_UDBL_MASK (_AC(0x3ff,UL) << SFSTAT_UDBH_SHIFT)
61#define SFSTAT_UDBL_SHIFT 44
62#define SFSTAT_TL_GT_ONE (_AC(1,UL) << SFSTAT_TL_GT_ONE_SHIFT)
63#define SFSTAT_TL_GT_ONE_SHIFT 42
64#define SFSTAT_TRAP_TYPE (_AC(0x1FF,UL) << SFSTAT_TRAP_TYPE_SHIFT)
65#define SFSTAT_TRAP_TYPE_SHIFT 33
66#define SFSTAT_AFSR_MASK (_AC(0x1ffffffff,UL) << SFSTAT_AFSR_SHIFT)
67#define SFSTAT_AFSR_SHIFT 0
68
69/* ESTATE Error Enable Register, ASI=0x4b VA<63:0>=0x0 */
70#define ESTATE_ERR_CE 0x1 /* Correctable errors */
71#define ESTATE_ERR_NCE 0x2 /* TO, BERR, LDP, ETP, EDP, WP, UE, IVUE */
72#define ESTATE_ERR_ISAP 0x4 /* System address parity error */
73#define ESTATE_ERR_ALL (ESTATE_ERR_CE | \
74 ESTATE_ERR_NCE | \
75 ESTATE_ERR_ISAP)
76
77/* The various trap types that report using the above state. */
78#define TRAP_TYPE_IAE 0x09 /* Instruction Access Error */
79#define TRAP_TYPE_DAE 0x32 /* Data Access Error */
80#define TRAP_TYPE_CEE 0x63 /* Correctable ECC Error */
81
82#endif /* _SPARC64_SFAFSR_H */
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 865547a23908..59987dad3359 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -29,6 +29,8 @@
29 29
30#define SO_SNDBUF 0x1001 30#define SO_SNDBUF 0x1001
31#define SO_RCVBUF 0x1002 31#define SO_RCVBUF 0x1002
32#define SO_SNDBUFFORCE 0x100a
33#define SO_RCVBUFFORCE 0x100b
32#define SO_ERROR 0x1007 34#define SO_ERROR 0x1007
33#define SO_TYPE 0x1008 35#define SO_TYPE 0x1008
34 36
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index 9cb93a5c2b4f..a02c4370eb42 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -43,7 +43,7 @@ typedef struct {
43#define spin_is_locked(lp) ((lp)->lock != 0) 43#define spin_is_locked(lp) ((lp)->lock != 0)
44 44
45#define spin_unlock_wait(lp) \ 45#define spin_unlock_wait(lp) \
46do { membar("#LoadLoad"); \ 46do { rmb(); \
47} while((lp)->lock) 47} while((lp)->lock)
48 48
49static inline void _raw_spin_lock(spinlock_t *lock) 49static inline void _raw_spin_lock(spinlock_t *lock)
@@ -129,15 +129,18 @@ typedef struct {
129#define spin_is_locked(__lock) ((__lock)->lock != 0) 129#define spin_is_locked(__lock) ((__lock)->lock != 0)
130#define spin_unlock_wait(__lock) \ 130#define spin_unlock_wait(__lock) \
131do { \ 131do { \
132 membar("#LoadLoad"); \ 132 rmb(); \
133} while((__lock)->lock) 133} while((__lock)->lock)
134 134
135extern void _do_spin_lock (spinlock_t *lock, char *str); 135extern void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller);
136extern void _do_spin_unlock (spinlock_t *lock); 136extern void _do_spin_unlock(spinlock_t *lock);
137extern int _do_spin_trylock (spinlock_t *lock); 137extern int _do_spin_trylock(spinlock_t *lock, unsigned long caller);
138 138
139#define _raw_spin_trylock(lp) _do_spin_trylock(lp) 139#define _raw_spin_trylock(lp) \
140#define _raw_spin_lock(lock) _do_spin_lock(lock, "spin_lock") 140 _do_spin_trylock(lp, (unsigned long) __builtin_return_address(0))
141#define _raw_spin_lock(lock) \
142 _do_spin_lock(lock, "spin_lock", \
143 (unsigned long) __builtin_return_address(0))
141#define _raw_spin_unlock(lock) _do_spin_unlock(lock) 144#define _raw_spin_unlock(lock) _do_spin_unlock(lock)
142#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 145#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
143 146
@@ -279,37 +282,41 @@ typedef struct {
279#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } } 282#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } }
280#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) 283#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
281 284
282extern void _do_read_lock(rwlock_t *rw, char *str); 285extern void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller);
283extern void _do_read_unlock(rwlock_t *rw, char *str); 286extern void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller);
284extern void _do_write_lock(rwlock_t *rw, char *str); 287extern void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller);
285extern void _do_write_unlock(rwlock_t *rw); 288extern void _do_write_unlock(rwlock_t *rw, unsigned long caller);
286extern int _do_write_trylock(rwlock_t *rw, char *str); 289extern int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller);
287 290
288#define _raw_read_lock(lock) \ 291#define _raw_read_lock(lock) \
289do { unsigned long flags; \ 292do { unsigned long flags; \
290 local_irq_save(flags); \ 293 local_irq_save(flags); \
291 _do_read_lock(lock, "read_lock"); \ 294 _do_read_lock(lock, "read_lock", \
295 (unsigned long) __builtin_return_address(0)); \
292 local_irq_restore(flags); \ 296 local_irq_restore(flags); \
293} while(0) 297} while(0)
294 298
295#define _raw_read_unlock(lock) \ 299#define _raw_read_unlock(lock) \
296do { unsigned long flags; \ 300do { unsigned long flags; \
297 local_irq_save(flags); \ 301 local_irq_save(flags); \
298 _do_read_unlock(lock, "read_unlock"); \ 302 _do_read_unlock(lock, "read_unlock", \
303 (unsigned long) __builtin_return_address(0)); \
299 local_irq_restore(flags); \ 304 local_irq_restore(flags); \
300} while(0) 305} while(0)
301 306
302#define _raw_write_lock(lock) \ 307#define _raw_write_lock(lock) \
303do { unsigned long flags; \ 308do { unsigned long flags; \
304 local_irq_save(flags); \ 309 local_irq_save(flags); \
305 _do_write_lock(lock, "write_lock"); \ 310 _do_write_lock(lock, "write_lock", \
311 (unsigned long) __builtin_return_address(0)); \
306 local_irq_restore(flags); \ 312 local_irq_restore(flags); \
307} while(0) 313} while(0)
308 314
309#define _raw_write_unlock(lock) \ 315#define _raw_write_unlock(lock) \
310do { unsigned long flags; \ 316do { unsigned long flags; \
311 local_irq_save(flags); \ 317 local_irq_save(flags); \
312 _do_write_unlock(lock); \ 318 _do_write_unlock(lock, \
319 (unsigned long) __builtin_return_address(0)); \
313 local_irq_restore(flags); \ 320 local_irq_restore(flags); \
314} while(0) 321} while(0)
315 322
@@ -317,7 +324,8 @@ do { unsigned long flags; \
317({ unsigned long flags; \ 324({ unsigned long flags; \
318 int val; \ 325 int val; \
319 local_irq_save(flags); \ 326 local_irq_save(flags); \
320 val = _do_write_trylock(lock, "write_trylock"); \ 327 val = _do_write_trylock(lock, "write_trylock", \
328 (unsigned long) __builtin_return_address(0)); \
321 local_irq_restore(flags); \ 329 local_irq_restore(flags); \
322 val; \ 330 val; \
323}) 331})
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index ee4bdfc6b88f..5e94c05dc2fc 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -28,6 +28,14 @@ enum sparc_cpu {
28#define ARCH_SUN4C_SUN4 0 28#define ARCH_SUN4C_SUN4 0
29#define ARCH_SUN4 0 29#define ARCH_SUN4 0
30 30
31extern void mb(void);
32extern void rmb(void);
33extern void wmb(void);
34extern void membar_storeload(void);
35extern void membar_storeload_storestore(void);
36extern void membar_storeload_loadload(void);
37extern void membar_storestore_loadstore(void);
38
31#endif 39#endif
32 40
33#define setipl(__new_ipl) \ 41#define setipl(__new_ipl) \
@@ -78,16 +86,11 @@ enum sparc_cpu {
78 86
79#define nop() __asm__ __volatile__ ("nop") 87#define nop() __asm__ __volatile__ ("nop")
80 88
81#define membar(type) __asm__ __volatile__ ("membar " type : : : "memory")
82#define mb() \
83 membar("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad")
84#define rmb() membar("#LoadLoad")
85#define wmb() membar("#StoreStore")
86#define read_barrier_depends() do { } while(0) 89#define read_barrier_depends() do { } while(0)
87#define set_mb(__var, __value) \ 90#define set_mb(__var, __value) \
88 do { __var = __value; membar("#StoreLoad | #StoreStore"); } while(0) 91 do { __var = __value; membar_storeload_storestore(); } while(0)
89#define set_wmb(__var, __value) \ 92#define set_wmb(__var, __value) \
90 do { __var = __value; membar("#StoreStore"); } while(0) 93 do { __var = __value; wmb(); } while(0)
91 94
92#ifdef CONFIG_SMP 95#ifdef CONFIG_SMP
93#define smp_mb() mb() 96#define smp_mb() mb()
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index 352d9943661a..c94d8b3991bd 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -68,6 +68,9 @@ struct thread_info {
68 68
69 struct restart_block restart_block; 69 struct restart_block restart_block;
70 70
71 struct pt_regs *kern_una_regs;
72 unsigned int kern_una_insn;
73
71 unsigned long fpregs[0] __attribute__ ((aligned(64))); 74 unsigned long fpregs[0] __attribute__ ((aligned(64)));
72}; 75};
73 76
@@ -103,6 +106,8 @@ struct thread_info {
103#define TI_PCR 0x00000490 106#define TI_PCR 0x00000490
104#define TI_CEE_STUFF 0x00000498 107#define TI_CEE_STUFF 0x00000498
105#define TI_RESTART_BLOCK 0x000004a0 108#define TI_RESTART_BLOCK 0x000004a0
109#define TI_KUNA_REGS 0x000004c8
110#define TI_KUNA_INSN 0x000004d0
106#define TI_FPREGS 0x00000500 111#define TI_FPREGS 0x00000500
107 112
108/* We embed this in the uppermost byte of thread_info->flags */ 113/* We embed this in the uppermost byte of thread_info->flags */
diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h
index 6248ed1a9a7a..d0ee7f105838 100644
--- a/include/asm-sparc64/types.h
+++ b/include/asm-sparc64/types.h
@@ -56,8 +56,6 @@ typedef unsigned long u64;
56typedef u32 dma_addr_t; 56typedef u32 dma_addr_t;
57typedef u64 dma64_addr_t; 57typedef u64 dma64_addr_t;
58 58
59typedef unsigned short kmem_bufctl_t;
60
61#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
62 60
63#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
index 5690142f82de..80a65d7e3dbf 100644
--- a/include/asm-sparc64/uaccess.h
+++ b/include/asm-sparc64/uaccess.h
@@ -59,12 +59,6 @@ static inline int access_ok(int type, const void __user * addr, unsigned long si
59 return 1; 59 return 1;
60} 60}
61 61
62/* this function will go away soon - use access_ok() instead */
63static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
64{
65 return 0;
66}
67
68/* 62/*
69 * The exception table consists of pairs of addresses: the first is the 63 * The exception table consists of pairs of addresses: the first is the
70 * address of an instruction that is allowed to fault, and the second is 64 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-um/auxvec.h b/include/asm-um/auxvec.h
new file mode 100644
index 000000000000..1e5e1c2fc9b1
--- /dev/null
+++ b/include/asm-um/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __UM_AUXVEC_H
2#define __UM_AUXVEC_H
3
4#endif
diff --git a/include/asm-um/futex.h b/include/asm-um/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-um/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-um/hdreg.h b/include/asm-um/hdreg.h
deleted file mode 100644
index cf6363abcab9..000000000000
--- a/include/asm-um/hdreg.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_HDREG_H
2#define __UM_HDREG_H
3
4#include "asm/arch/hdreg.h"
5
6#endif
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index 095bb627b96a..2edb4f1f789c 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -20,7 +20,15 @@ extern void force_flush_all(void);
20 20
21static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) 21static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
22{ 22{
23 if (old != new) 23 /*
24 * This is called by fs/exec.c and fs/aio.c. In the first case, for an
25 * exec, we don't need to do anything as we're called from userspace
26 * and thus going to use a new host PID. In the second, we're called
27 * from a kernel thread, and thus need to go doing the mmap's on the
28 * host. Since they're very expensive, we want to avoid that as far as
29 * possible.
30 */
31 if (old != new && (current->flags & PF_BORROWED_MM))
24 force_flush_all(); 32 force_flush_all();
25} 33}
26 34
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 5afee8a8cdf3..bd850a249183 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -104,8 +104,8 @@ extern void *to_virt(unsigned long phys);
104 * casting is the right thing, but 32-bit UML can't have 64-bit virtual 104 * casting is the right thing, but 32-bit UML can't have 64-bit virtual
105 * addresses 105 * addresses
106 */ 106 */
107#define __pa(virt) to_phys((void *) (unsigned long) virt) 107#define __pa(virt) to_phys((void *) (unsigned long) (virt))
108#define __va(phys) to_virt((unsigned long) phys) 108#define __va(phys) to_virt((unsigned long) (phys))
109 109
110#define page_to_pfn(page) ((page) - mem_map) 110#define page_to_pfn(page) ((page) - mem_map)
111#define pfn_to_page(pfn) (mem_map + (pfn)) 111#define pfn_to_page(pfn) (mem_map + (pfn))
@@ -116,24 +116,12 @@ extern void *to_virt(unsigned long phys);
116#define pfn_valid(pfn) ((pfn) < max_mapnr) 116#define pfn_valid(pfn) ((pfn) < max_mapnr)
117#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) 117#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
118 118
119/* Pure 2^n version of get_order */
120static __inline__ int get_order(unsigned long size)
121{
122 int order;
123
124 size = (size-1) >> (PAGE_SHIFT-1);
125 order = -1;
126 do {
127 size >>= 1;
128 order++;
129 } while (size);
130 return order;
131}
132
133extern struct page *arch_validate(struct page *page, int mask, int order); 119extern struct page *arch_validate(struct page *page, int mask, int order);
134#define HAVE_ARCH_VALIDATE 120#define HAVE_ARCH_VALIDATE
135 121
136extern void arch_free_page(struct page *page, int order); 122extern void arch_free_page(struct page *page, int order);
137#define HAVE_ARCH_FREE_PAGE 123#define HAVE_ARCH_FREE_PAGE
138 124
125#include <asm-generic/page.h>
126
139#endif 127#endif
diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h
index 8fcb2fc0a892..ea49411236dc 100644
--- a/include/asm-um/pgalloc.h
+++ b/include/asm-um/pgalloc.h
@@ -42,11 +42,13 @@ static inline void pte_free(struct page *pte)
42#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 42#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
43 43
44#ifdef CONFIG_3_LEVEL_PGTABLES 44#ifdef CONFIG_3_LEVEL_PGTABLES
45/* 45
46 * In the 3-level case we free the pmds as part of the pgd. 46extern __inline__ void pmd_free(pmd_t *pmd)
47 */ 47{
48#define pmd_free(x) do { } while (0) 48 free_page((unsigned long)pmd);
49#define __pmd_free_tlb(tlb,x) do { } while (0) 49}
50
51#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
50#endif 52#endif
51 53
52#define check_pgt_cache() do { } while (0) 54#define check_pgt_cache() do { } while (0)
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
index 9b3abc01d60e..ffe017f6b64b 100644
--- a/include/asm-um/pgtable-2level.h
+++ b/include/asm-um/pgtable-2level.h
@@ -35,35 +35,8 @@
35static inline int pgd_newpage(pgd_t pgd) { return 0; } 35static inline int pgd_newpage(pgd_t pgd) { return 0; }
36static inline void pgd_mkuptodate(pgd_t pgd) { } 36static inline void pgd_mkuptodate(pgd_t pgd) { }
37 37
38#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
39
40static inline pte_t pte_mknewprot(pte_t pte)
41{
42 pte_val(pte) |= _PAGE_NEWPROT;
43 return(pte);
44}
45
46static inline pte_t pte_mknewpage(pte_t pte)
47{
48 pte_val(pte) |= _PAGE_NEWPAGE;
49 return(pte);
50}
51
52static inline void set_pte(pte_t *pteptr, pte_t pteval)
53{
54 /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
55 * fix_range knows to unmap it. _PAGE_NEWPROT is specific to
56 * mapped pages.
57 */
58 *pteptr = pte_mknewpage(pteval);
59 if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
60}
61#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
62
63#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) 38#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
64 39
65#define pte_page(x) pfn_to_page(pte_pfn(x))
66#define pte_none(x) !(pte_val(x) & ~_PAGE_NEWPAGE)
67#define pte_pfn(x) phys_to_pfn(pte_val(x)) 40#define pte_pfn(x) phys_to_pfn(pte_val(x))
68#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) 41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
69#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) 42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
index 65e8bfc55fc4..786c25727289 100644
--- a/include/asm-um/pgtable-3level.h
+++ b/include/asm-um/pgtable-3level.h
@@ -57,35 +57,6 @@ static inline int pgd_newpage(pgd_t pgd)
57 57
58static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } 58static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
59 59
60
61#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE))
62
63static inline pte_t pte_mknewprot(pte_t pte)
64{
65 pte_set_bits(pte, _PAGE_NEWPROT);
66 return(pte);
67}
68
69static inline pte_t pte_mknewpage(pte_t pte)
70{
71 pte_set_bits(pte, _PAGE_NEWPAGE);
72 return(pte);
73}
74
75static inline void set_pte(pte_t *pteptr, pte_t pteval)
76{
77 pte_copy(*pteptr, pteval);
78
79 /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
80 * fix_range knows to unmap it. _PAGE_NEWPROT is specific to
81 * mapped pages.
82 */
83
84 *pteptr = pte_mknewpage(*pteptr);
85 if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
86}
87#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
88
89#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) 60#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
90 61
91static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) 62static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
@@ -98,14 +69,11 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
98 return pmd; 69 return pmd;
99} 70}
100 71
101static inline void pmd_free(pmd_t *pmd){ 72extern inline void pud_clear (pud_t *pud)
102 free_page((unsigned long) pmd); 73{
74 set_pud(pud, __pud(0));
103} 75}
104 76
105#define __pmd_free_tlb(tlb,x) do { } while (0)
106
107static inline void pud_clear (pud_t * pud) { }
108
109#define pud_page(pud) \ 77#define pud_page(pud) \
110 ((struct page *) __va(pud_val(pud) & PAGE_MASK)) 78 ((struct page *) __va(pud_val(pud) & PAGE_MASK))
111 79
@@ -113,13 +81,6 @@ static inline void pud_clear (pud_t * pud) { }
113#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \ 81#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
114 pmd_index(address)) 82 pmd_index(address))
115 83
116#define pte_page(x) pfn_to_page(pte_pfn(x))
117
118static inline int pte_none(pte_t pte)
119{
120 return pte_is_zero(pte);
121}
122
123static inline unsigned long pte_pfn(pte_t pte) 84static inline unsigned long pte_pfn(pte_t pte)
124{ 85{
125 return phys_to_pfn(pte_val(pte)); 86 return phys_to_pfn(pte_val(pte));
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index a88040920311..b48e0966ecd7 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -16,13 +16,15 @@
16 16
17#define _PAGE_PRESENT 0x001 17#define _PAGE_PRESENT 0x001
18#define _PAGE_NEWPAGE 0x002 18#define _PAGE_NEWPAGE 0x002
19#define _PAGE_NEWPROT 0x004 19#define _PAGE_NEWPROT 0x004
20#define _PAGE_FILE 0x008 /* set:pagecache unset:swap */
21#define _PAGE_PROTNONE 0x010 /* If not present */
22#define _PAGE_RW 0x020 20#define _PAGE_RW 0x020
23#define _PAGE_USER 0x040 21#define _PAGE_USER 0x040
24#define _PAGE_ACCESSED 0x080 22#define _PAGE_ACCESSED 0x080
25#define _PAGE_DIRTY 0x100 23#define _PAGE_DIRTY 0x100
24/* If _PAGE_PRESENT is clear, we use these: */
25#define _PAGE_FILE 0x008 /* nonlinear file mapping, saved PTE; unset:swap */
26#define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE;
27 pte_present gives true */
26 28
27#ifdef CONFIG_3_LEVEL_PGTABLES 29#ifdef CONFIG_3_LEVEL_PGTABLES
28#include "asm/pgtable-3level.h" 30#include "asm/pgtable-3level.h"
@@ -151,10 +153,24 @@ extern unsigned long pg0[1024];
151 153
152#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK) 154#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK)
153 155
156#define pte_page(x) pfn_to_page(pte_pfn(x))
154#define pte_address(x) (__va(pte_val(x) & PAGE_MASK)) 157#define pte_address(x) (__va(pte_val(x) & PAGE_MASK))
155#define mk_phys(a, r) ((a) + (((unsigned long) r) << REGION_SHIFT)) 158#define mk_phys(a, r) ((a) + (((unsigned long) r) << REGION_SHIFT))
156#define phys_addr(p) ((p) & ~REGION_MASK) 159#define phys_addr(p) ((p) & ~REGION_MASK)
157 160
161#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE))
162
163/*
164 * =================================
165 * Flags checking section.
166 * =================================
167 */
168
169static inline int pte_none(pte_t pte)
170{
171 return pte_is_zero(pte);
172}
173
158/* 174/*
159 * The following only work if pte_present() is true. 175 * The following only work if pte_present() is true.
160 * Undefined behaviour if not.. 176 * Undefined behaviour if not..
@@ -210,6 +226,18 @@ static inline int pte_newprot(pte_t pte)
210 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT))); 226 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT)));
211} 227}
212 228
229/*
230 * =================================
231 * Flags setting section.
232 * =================================
233 */
234
235static inline pte_t pte_mknewprot(pte_t pte)
236{
237 pte_set_bits(pte, _PAGE_NEWPROT);
238 return(pte);
239}
240
213static inline pte_t pte_rdprotect(pte_t pte) 241static inline pte_t pte_rdprotect(pte_t pte)
214{ 242{
215 pte_clear_bits(pte, _PAGE_USER); 243 pte_clear_bits(pte, _PAGE_USER);
@@ -278,6 +306,26 @@ static inline pte_t pte_mkuptodate(pte_t pte)
278 return(pte); 306 return(pte);
279} 307}
280 308
309static inline pte_t pte_mknewpage(pte_t pte)
310{
311 pte_set_bits(pte, _PAGE_NEWPAGE);
312 return(pte);
313}
314
315static inline void set_pte(pte_t *pteptr, pte_t pteval)
316{
317 pte_copy(*pteptr, pteval);
318
319 /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
320 * fix_range knows to unmap it. _PAGE_NEWPROT is specific to
321 * mapped pages.
322 */
323
324 *pteptr = pte_mknewpage(*pteptr);
325 if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
326}
327#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
328
281extern phys_t page_to_phys(struct page *page); 329extern phys_t page_to_phys(struct page *page);
282 330
283/* 331/*
diff --git a/include/asm-v850/auxvec.h b/include/asm-v850/auxvec.h
new file mode 100644
index 000000000000..f493232d0224
--- /dev/null
+++ b/include/asm-v850/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __V850_AUXVEC_H__
2#define __V850_AUXVEC_H__
3
4#endif /* __V850_AUXVEC_H__ */
diff --git a/include/asm-v850/fcntl.h b/include/asm-v850/fcntl.h
index 31d4b5961221..3af4d56776dd 100644
--- a/include/asm-v850/fcntl.h
+++ b/include/asm-v850/fcntl.h
@@ -1,87 +1,11 @@
1#ifndef __V850_FCNTL_H__ 1#ifndef __V850_FCNTL_H__
2#define __V850_FCNTL_H__ 2#define __V850_FCNTL_H__
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */ 4#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */ 5#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 6#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0400000 7#define O_LARGEFILE 0400000
23#define O_NOATIME 01000000
24 8
25#define F_DUPFD 0 /* dup */ 9#include <asm-generic/fcntl.h>
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33 10
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif /* __V850_FCNTL_H__ */ 11#endif /* __V850_FCNTL_H__ */
diff --git a/include/asm-v850/futex.h b/include/asm-v850/futex.h
new file mode 100644
index 000000000000..2cac5ecd9d00
--- /dev/null
+++ b/include/asm-v850/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret, tem;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index d6091622935d..b4bc85e7b91a 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -98,25 +98,6 @@ typedef unsigned long pgprot_t;
98#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 98#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
99 99
100 100
101#ifndef __ASSEMBLY__
102
103/* Pure 2^n version of get_order */
104extern __inline__ int get_order (unsigned long size)
105{
106 int order;
107
108 size = (size-1) >> (PAGE_SHIFT-1);
109 order = -1;
110 do {
111 size >>= 1;
112 order++;
113 } while (size);
114 return order;
115}
116
117#endif /* !__ASSEMBLY__ */
118
119
120/* No current v850 processor has virtual memory. */ 101/* No current v850 processor has virtual memory. */
121#define __virt_to_phys(addr) (addr) 102#define __virt_to_phys(addr) (addr)
122#define __phys_to_virt(addr) (addr) 103#define __phys_to_virt(addr) (addr)
@@ -144,4 +125,6 @@ extern __inline__ int get_order (unsigned long size)
144 125
145#endif /* KERNEL */ 126#endif /* KERNEL */
146 127
128#include <asm-generic/page.h>
129
147#endif /* __V850_PAGE_H__ */ 130#endif /* __V850_PAGE_H__ */
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index 213b852af53e..0240d366a0a4 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-v850/types.h b/include/asm-v850/types.h
index e7cfe5b33a10..dcef57196875 100644
--- a/include/asm-v850/types.h
+++ b/include/asm-v850/types.h
@@ -59,8 +59,6 @@ typedef unsigned long long u64;
59 59
60typedef u32 dma_addr_t; 60typedef u32 dma_addr_t;
61 61
62typedef unsigned int kmem_bufctl_t;
63
64#endif /* !__ASSEMBLY__ */ 62#endif /* !__ASSEMBLY__ */
65 63
66#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
diff --git a/include/asm-v850/uaccess.h b/include/asm-v850/uaccess.h
index 4386cfc6a8dd..188b28597cf1 100644
--- a/include/asm-v850/uaccess.h
+++ b/include/asm-v850/uaccess.h
@@ -27,12 +27,6 @@ extern inline int access_ok (int type, const void *addr, unsigned long size)
27 return val >= (0x80 + NUM_CPU_IRQS*16) && val < 0xFFFFF000; 27 return val >= (0x80 + NUM_CPU_IRQS*16) && val < 0xFFFFF000;
28} 28}
29 29
30/* this function will go away soon - use access_ok() instead */
31extern inline int __deprecated verify_area (int type, const void *addr, unsigned long size)
32{
33 return access_ok (type, addr, size) ? 0 : -EFAULT;
34}
35
36/* 30/*
37 * The exception table consists of pairs of addresses: the first is the 31 * The exception table consists of pairs of addresses: the first is the
38 * address of an instruction that is allowed to fault, and the second is 32 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-x86_64/auxvec.h b/include/asm-x86_64/auxvec.h
new file mode 100644
index 000000000000..2403c4cfced2
--- /dev/null
+++ b/include/asm-x86_64/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_X86_64_AUXVEC_H
2#define __ASM_X86_64_AUXVEC_H
3
4#endif
diff --git a/include/asm-x86_64/checksum.h b/include/asm-x86_64/checksum.h
index d01356f01448..989469e8e0b7 100644
--- a/include/asm-x86_64/checksum.h
+++ b/include/asm-x86_64/checksum.h
@@ -64,7 +64,7 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
64 " adcl $0, %0\n" 64 " adcl $0, %0\n"
65 " notl %0\n" 65 " notl %0\n"
66 "2:" 66 "2:"
67 /* Since the input registers which are loaded with iph and ipl 67 /* Since the input registers which are loaded with iph and ihl
68 are modified, we must also specify them as outputs, or gcc 68 are modified, we must also specify them as outputs, or gcc
69 will assume they contain their original values. */ 69 will assume they contain their original values. */
70 : "=r" (sum), "=r" (iph), "=r" (ihl) 70 : "=r" (sum), "=r" (iph), "=r" (ihl)
diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
index d0f453c5adfc..f0155c38f639 100644
--- a/include/asm-x86_64/compat.h
+++ b/include/asm-x86_64/compat.h
@@ -14,10 +14,10 @@ typedef s32 compat_ssize_t;
14typedef s32 compat_time_t; 14typedef s32 compat_time_t;
15typedef s32 compat_clock_t; 15typedef s32 compat_clock_t;
16typedef s32 compat_pid_t; 16typedef s32 compat_pid_t;
17typedef u16 compat_uid_t; 17typedef u16 __compat_uid_t;
18typedef u16 compat_gid_t; 18typedef u16 __compat_gid_t;
19typedef u32 compat_uid32_t; 19typedef u32 __compat_uid32_t;
20typedef u32 compat_gid32_t; 20typedef u32 __compat_gid32_t;
21typedef u16 compat_mode_t; 21typedef u16 compat_mode_t;
22typedef u32 compat_ino_t; 22typedef u32 compat_ino_t;
23typedef u16 compat_dev_t; 23typedef u16 compat_dev_t;
@@ -52,8 +52,8 @@ struct compat_stat {
52 compat_ino_t st_ino; 52 compat_ino_t st_ino;
53 compat_mode_t st_mode; 53 compat_mode_t st_mode;
54 compat_nlink_t st_nlink; 54 compat_nlink_t st_nlink;
55 compat_uid_t st_uid; 55 __compat_uid_t st_uid;
56 compat_gid_t st_gid; 56 __compat_gid_t st_gid;
57 compat_dev_t st_rdev; 57 compat_dev_t st_rdev;
58 u16 __pad2; 58 u16 __pad2;
59 u32 st_size; 59 u32 st_size;
@@ -122,10 +122,10 @@ typedef u32 compat_sigset_word;
122 122
123struct compat_ipc64_perm { 123struct compat_ipc64_perm {
124 compat_key_t key; 124 compat_key_t key;
125 compat_uid32_t uid; 125 __compat_uid32_t uid;
126 compat_gid32_t gid; 126 __compat_gid32_t gid;
127 compat_uid32_t cuid; 127 __compat_uid32_t cuid;
128 compat_gid32_t cgid; 128 __compat_gid32_t cgid;
129 unsigned short mode; 129 unsigned short mode;
130 unsigned short __pad1; 130 unsigned short __pad1;
131 unsigned short seq; 131 unsigned short seq;
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index 8e94edf0b984..e682edc24a68 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -51,6 +51,8 @@ extern int e820_mapped(unsigned long start, unsigned long end, unsigned type);
51 51
52extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end); 52extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
53extern void e820_setup_gap(void); 53extern void e820_setup_gap(void);
54extern unsigned long e820_hole_size(unsigned long start_pfn,
55 unsigned long end_pfn);
54 56
55extern void __init parse_memopt(char *p, char **end); 57extern void __init parse_memopt(char *p, char **end);
56 58
diff --git a/include/asm-x86_64/fcntl.h b/include/asm-x86_64/fcntl.h
index 4411f221c037..46ab12db5739 100644
--- a/include/asm-x86_64/fcntl.h
+++ b/include/asm-x86_64/fcntl.h
@@ -1,76 +1 @@
1#ifndef _X86_64_FCNTL_H #include <asm-generic/fcntl.h>
2#define _X86_64_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECT 040000 /* direct disk access hint */
20#define O_LARGEFILE 0100000
21#define O_DIRECTORY 0200000 /* must be a directory */
22#define O_NOFOLLOW 0400000 /* don't follow links */
23#define O_NOATIME 01000000
24
25#define F_DUPFD 0 /* dup */
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39/* for F_[GET|SET]FL */
40#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
41
42/* for posix fcntl() and lockf() */
43#define F_RDLCK 0
44#define F_WRLCK 1
45#define F_UNLCK 2
46
47/* for old implementation of bsd flock () */
48#define F_EXLCK 4 /* or 3 */
49#define F_SHLCK 8 /* or 4 */
50
51/* for leases */
52#define F_INPROGRESS 16
53
54/* operations for bsd flock(), also used by the kernel implementation */
55#define LOCK_SH 1 /* shared lock */
56#define LOCK_EX 2 /* exclusive lock */
57#define LOCK_NB 4 /* or'd with one of the above to prevent
58 blocking */
59#define LOCK_UN 8 /* remove lock */
60
61#define LOCK_MAND 32 /* This is a mandatory flock */
62#define LOCK_READ 64 /* ... Which allows concurrent read operations */
63#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
64#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
65
66struct flock {
67 short l_type;
68 short l_whence;
69 off_t l_start;
70 off_t l_len;
71 pid_t l_pid;
72};
73
74#define F_LINUX_SPECIFIC_BASE 1024
75
76#endif /* !_X86_64_FCNTL_H */
diff --git a/include/asm-x86_64/futex.h b/include/asm-x86_64/futex.h
new file mode 100644
index 000000000000..8602c09bf89e
--- /dev/null
+++ b/include/asm-x86_64/futex.h
@@ -0,0 +1,98 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/system.h>
9#include <asm/uaccess.h>
10
11#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
12 __asm__ __volatile ( \
13"1: " insn "\n" \
14"2: .section .fixup,\"ax\"\n\
153: mov %3, %1\n\
16 jmp 2b\n\
17 .previous\n\
18 .section __ex_table,\"a\"\n\
19 .align 8\n\
20 .quad 1b,3b\n\
21 .previous" \
22 : "=r" (oldval), "=r" (ret), "=m" (*uaddr) \
23 : "i" (-EFAULT), "m" (*uaddr), "0" (oparg), "1" (0))
24
25#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
26 __asm__ __volatile ( \
27"1: movl %2, %0\n\
28 movl %0, %3\n" \
29 insn "\n" \
30"2: " LOCK_PREFIX "cmpxchgl %3, %2\n\
31 jnz 1b\n\
323: .section .fixup,\"ax\"\n\
334: mov %5, %1\n\
34 jmp 3b\n\
35 .previous\n\
36 .section __ex_table,\"a\"\n\
37 .align 8\n\
38 .quad 1b,4b,2b,4b\n\
39 .previous" \
40 : "=&a" (oldval), "=&r" (ret), "=m" (*uaddr), \
41 "=&r" (tem) \
42 : "r" (oparg), "i" (-EFAULT), "m" (*uaddr), "1" (0))
43
44static inline int
45futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
46{
47 int op = (encoded_op >> 28) & 7;
48 int cmp = (encoded_op >> 24) & 15;
49 int oparg = (encoded_op << 8) >> 20;
50 int cmparg = (encoded_op << 20) >> 20;
51 int oldval = 0, ret, tem;
52 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
53 oparg = 1 << oparg;
54
55 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
56 return -EFAULT;
57
58 inc_preempt_count();
59
60 switch (op) {
61 case FUTEX_OP_SET:
62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
63 break;
64 case FUTEX_OP_ADD:
65 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval,
66 uaddr, oparg);
67 break;
68 case FUTEX_OP_OR:
69 __futex_atomic_op2("orl %4, %3", ret, oldval, uaddr, oparg);
70 break;
71 case FUTEX_OP_ANDN:
72 __futex_atomic_op2("andl %4, %3", ret, oldval, uaddr, ~oparg);
73 break;
74 case FUTEX_OP_XOR:
75 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr, oparg);
76 break;
77 default:
78 ret = -ENOSYS;
79 }
80
81 dec_preempt_count();
82
83 if (!ret) {
84 switch (cmp) {
85 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
86 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
87 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
88 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
89 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
90 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
91 default: ret = -ENOSYS;
92 }
93 }
94 return ret;
95}
96
97#endif
98#endif
diff --git a/include/asm-x86_64/hdreg.h b/include/asm-x86_64/hdreg.h
deleted file mode 100644
index 5989bbc97cbf..000000000000
--- a/include/asm-x86_64/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
1#warning this file is obsolete, please do not use it
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 431318764af6..135ffaa0393b 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -28,7 +28,6 @@
28#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 28#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
29#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 29#define HPAGE_MASK (~(HPAGE_SIZE - 1))
30#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 30#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
31#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
32 31
33#ifdef __KERNEL__ 32#ifdef __KERNEL__
34#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
@@ -92,20 +91,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
92 91
93#include <asm/bug.h> 92#include <asm/bug.h>
94 93
95/* Pure 2^n version of get_order */
96extern __inline__ int get_order(unsigned long size)
97{
98 int order;
99
100 size = (size-1) >> (PAGE_SHIFT-1);
101 order = -1;
102 do {
103 size >>= 1;
104 order++;
105 } while (size);
106 return order;
107}
108
109#endif /* __ASSEMBLY__ */ 94#endif /* __ASSEMBLY__ */
110 95
111#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 96#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
@@ -141,4 +126,6 @@ extern __inline__ int get_order(unsigned long size)
141 126
142#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
143 128
129#include <asm-generic/page.h>
130
144#endif /* _X86_64_PAGE_H */ 131#endif /* _X86_64_PAGE_H */
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index 9c4527eb55e2..eeb3088a1c9e 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -22,9 +22,11 @@ extern unsigned int pcibios_assign_all_busses(void);
22extern int no_iommu, force_iommu; 22extern int no_iommu, force_iommu;
23 23
24extern unsigned long pci_mem_start; 24extern unsigned long pci_mem_start;
25#define PCIBIOS_MIN_IO 0x4000 25#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM (pci_mem_start) 26#define PCIBIOS_MIN_MEM (pci_mem_start)
27 27
28#define PCIBIOS_MIN_CARDBUS_IO 0x4000
29
28void pcibios_config_init(void); 30void pcibios_config_init(void);
29struct pci_bus * pcibios_scan_root(int bus); 31struct pci_bus * pcibios_scan_root(int bus);
30extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); 32extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 4e167b5ea8f3..5e0f2fdab0d3 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -104,6 +104,19 @@ extern inline void pgd_clear (pgd_t * pgd)
104((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) 104((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK))
105 105
106#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) 106#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0))
107
108static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
109{
110 pte_t pte;
111 if (full) {
112 pte = *ptep;
113 *ptep = __pte(0);
114 } else {
115 pte = ptep_get_and_clear(mm, addr, ptep);
116 }
117 return pte;
118}
119
107#define pte_same(a, b) ((a).pte == (b).pte) 120#define pte_same(a, b) ((a).pte == (b).pte)
108 121
109#define PMD_SIZE (1UL << PMD_SHIFT) 122#define PMD_SIZE (1UL << PMD_SHIFT)
@@ -143,7 +156,7 @@ extern inline void pgd_clear (pgd_t * pgd)
143#define _PAGE_ACCESSED 0x020 156#define _PAGE_ACCESSED 0x020
144#define _PAGE_DIRTY 0x040 157#define _PAGE_DIRTY 0x040
145#define _PAGE_PSE 0x080 /* 2MB page */ 158#define _PAGE_PSE 0x080 /* 2MB page */
146#define _PAGE_FILE 0x040 /* set:pagecache, unset:swap */ 159#define _PAGE_FILE 0x040 /* nonlinear file mapping, saved PTE; unset:swap */
147#define _PAGE_GLOBAL 0x100 /* Global TLB entry */ 160#define _PAGE_GLOBAL 0x100 /* Global TLB entry */
148 161
149#define _PAGE_PROTNONE 0x080 /* If not present */ 162#define _PAGE_PROTNONE 0x080 /* If not present */
@@ -247,6 +260,7 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
247 * The following only work if pte_present() is true. 260 * The following only work if pte_present() is true.
248 * Undefined behaviour if not.. 261 * Undefined behaviour if not..
249 */ 262 */
263#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
250static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 264static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
251extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 265extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
252extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 266extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
@@ -254,8 +268,8 @@ extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
254extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 268extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
255extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 269extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
256static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 270static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
271static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; }
257 272
258#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
259extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 273extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
260extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 274extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
261extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 275extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
@@ -433,6 +447,7 @@ extern int kern_addr_valid(unsigned long addr);
433#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 447#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
434#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 448#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
435#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 449#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
450#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
436#define __HAVE_ARCH_PTEP_SET_WRPROTECT 451#define __HAVE_ARCH_PTEP_SET_WRPROTECT
437#define __HAVE_ARCH_PTE_SAME 452#define __HAVE_ARCH_PTE_SAME
438#include <asm-generic/pgtable.h> 453#include <asm-generic/pgtable.h>
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 106f666517bb..a8321999448f 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -32,7 +32,7 @@
32#define ID_MASK 0x00200000 32#define ID_MASK 0x00200000
33 33
34#define desc_empty(desc) \ 34#define desc_empty(desc) \
35 (!((desc)->a + (desc)->b)) 35 (!((desc)->a | (desc)->b))
36 36
37#define desc_equal(desc1, desc2) \ 37#define desc_equal(desc1, desc2) \
38 (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b)) 38 (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
@@ -398,7 +398,7 @@ static inline void prefetch(void *x)
398#define ARCH_HAS_PREFETCHW 1 398#define ARCH_HAS_PREFETCHW 1
399static inline void prefetchw(void *x) 399static inline void prefetchw(void *x)
400{ 400{
401 alternative_input(ASM_NOP5, 401 alternative_input("prefetcht0 (%1)",
402 "prefetchw (%1)", 402 "prefetchw (%1)",
403 X86_FEATURE_3DNOW, 403 X86_FEATURE_3DNOW,
404 "r" (x)); 404 "r" (x));
@@ -437,6 +437,11 @@ static inline void prefetchw(void *x)
437 outb((data), 0x23); \ 437 outb((data), 0x23); \
438} while (0) 438} while (0)
439 439
440static inline void serialize_cpu(void)
441{
442 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
443}
444
440static inline void __monitor(const void *eax, unsigned long ecx, 445static inline void __monitor(const void *eax, unsigned long ecx,
441 unsigned long edx) 446 unsigned long edx)
442{ 447{
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h
index d9a252ea8210..f2cdbeae5d5b 100644
--- a/include/asm-x86_64/socket.h
+++ b/include/asm-x86_64/socket.h
@@ -14,6 +14,8 @@
14#define SO_BROADCAST 6 14#define SO_BROADCAST 6
15#define SO_SNDBUF 7 15#define SO_SNDBUF 7
16#define SO_RCVBUF 8 16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
17#define SO_KEEPALIVE 9 19#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10 20#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11 21#define SO_NO_CHECK 11
diff --git a/include/asm-x86_64/types.h b/include/asm-x86_64/types.h
index 32bd1426b523..c86c2e6793e2 100644
--- a/include/asm-x86_64/types.h
+++ b/include/asm-x86_64/types.h
@@ -51,8 +51,6 @@ typedef u64 dma_addr_t;
51typedef u64 sector_t; 51typedef u64 sector_t;
52#define HAVE_SECTOR_T 52#define HAVE_SECTOR_T
53 53
54typedef unsigned short kmem_bufctl_t;
55
56#endif /* __ASSEMBLY__ */ 54#endif /* __ASSEMBLY__ */
57 55
58#endif /* __KERNEL__ */ 56#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 48f292752c96..1bb8b8a24436 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -49,13 +49,6 @@
49 49
50#define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0) 50#define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0)
51 51
52/* this function will go away soon - use access_ok() instead */
53extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
54{
55 return access_ok(type,addr,size) ? 0 : -EFAULT;
56}
57
58
59/* 52/*
60 * The exception table consists of pairs of addresses: the first is the 53 * The exception table consists of pairs of addresses: the first is the
61 * address of an instruction that is allowed to fault, and the second is 54 * address of an instruction that is allowed to fault, and the second is
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h
index d72bcb32ba4f..24f86f0e43cf 100644
--- a/include/asm-xtensa/atomic.h
+++ b/include/asm-xtensa/atomic.h
@@ -66,7 +66,7 @@ typedef struct { volatile int counter; } atomic_t;
66 * 66 *
67 * Atomically adds @i to @v. 67 * Atomically adds @i to @v.
68 */ 68 */
69extern __inline__ void atomic_add(int i, atomic_t * v) 69static inline void atomic_add(int i, atomic_t * v)
70{ 70{
71 unsigned int vval; 71 unsigned int vval;
72 72
@@ -90,7 +90,7 @@ extern __inline__ void atomic_add(int i, atomic_t * v)
90 * 90 *
91 * Atomically subtracts @i from @v. 91 * Atomically subtracts @i from @v.
92 */ 92 */
93extern __inline__ void atomic_sub(int i, atomic_t *v) 93static inline void atomic_sub(int i, atomic_t *v)
94{ 94{
95 unsigned int vval; 95 unsigned int vval;
96 96
@@ -111,7 +111,7 @@ extern __inline__ void atomic_sub(int i, atomic_t *v)
111 * We use atomic_{add|sub}_return to define other functions. 111 * We use atomic_{add|sub}_return to define other functions.
112 */ 112 */
113 113
114extern __inline__ int atomic_add_return(int i, atomic_t * v) 114static inline int atomic_add_return(int i, atomic_t * v)
115{ 115{
116 unsigned int vval; 116 unsigned int vval;
117 117
@@ -130,7 +130,7 @@ extern __inline__ int atomic_add_return(int i, atomic_t * v)
130 return vval; 130 return vval;
131} 131}
132 132
133extern __inline__ int atomic_sub_return(int i, atomic_t * v) 133static inline int atomic_sub_return(int i, atomic_t * v)
134{ 134{
135 unsigned int vval; 135 unsigned int vval;
136 136
@@ -224,7 +224,7 @@ extern __inline__ int atomic_sub_return(int i, atomic_t * v)
224#define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0) 224#define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0)
225 225
226 226
227extern __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) 227static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
228{ 228{
229 unsigned int all_f = -1; 229 unsigned int all_f = -1;
230 unsigned int vval; 230 unsigned int vval;
@@ -243,7 +243,7 @@ extern __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v)
243 ); 243 );
244} 244}
245 245
246extern __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) 246static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
247{ 247{
248 unsigned int vval; 248 unsigned int vval;
249 249
diff --git a/include/asm-xtensa/auxvec.h b/include/asm-xtensa/auxvec.h
new file mode 100644
index 000000000000..257dec75c5af
--- /dev/null
+++ b/include/asm-xtensa/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __XTENSA_AUXVEC_H
2#define __XTENSA_AUXVEC_H
3
4#endif
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h
index 1a00fad19929..81a797ae3abe 100644
--- a/include/asm-xtensa/checksum.h
+++ b/include/asm-xtensa/checksum.h
@@ -47,14 +47,14 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
47 * If you use these functions directly please don't forget the 47 * If you use these functions directly please don't forget the
48 * verify_area(). 48 * verify_area().
49 */ 49 */
50extern __inline__ 50static inline
51unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, 51unsigned int csum_partial_copy_nocheck ( const char *src, char *dst,
52 int len, int sum) 52 int len, int sum)
53{ 53{
54 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 54 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
55} 55}
56 56
57extern __inline__ 57static inline
58unsigned int csum_partial_copy_from_user ( const char *src, char *dst, 58unsigned int csum_partial_copy_from_user ( const char *src, char *dst,
59 int len, int sum, int *err_ptr) 59 int len, int sum, int *err_ptr)
60{ 60{
diff --git a/include/asm-xtensa/delay.h b/include/asm-xtensa/delay.h
index 0a123d53a636..1bc601ec3621 100644
--- a/include/asm-xtensa/delay.h
+++ b/include/asm-xtensa/delay.h
@@ -18,7 +18,7 @@
18 18
19extern unsigned long loops_per_jiffy; 19extern unsigned long loops_per_jiffy;
20 20
21extern __inline__ void __delay(unsigned long loops) 21static inline void __delay(unsigned long loops)
22{ 22{
23 /* 2 cycles per loop. */ 23 /* 2 cycles per loop. */
24 __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b" 24 __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b"
diff --git a/include/asm-xtensa/fcntl.h b/include/asm-xtensa/fcntl.h
index 48876bb727d2..ec066ae96caf 100644
--- a/include/asm-xtensa/fcntl.h
+++ b/include/asm-xtensa/fcntl.h
@@ -14,31 +14,17 @@
14 14
15/* open/fcntl - O_SYNC is only implemented on blocks devices and on files 15/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
16 located on an ext2 file system */ 16 located on an ext2 file system */
17#define O_ACCMODE 0x0003
18#define O_RDONLY 0x0000
19#define O_WRONLY 0x0001
20#define O_RDWR 0x0002
21#define O_APPEND 0x0008 17#define O_APPEND 0x0008
22#define O_SYNC 0x0010 18#define O_SYNC 0x0010
23#define O_NONBLOCK 0x0080 19#define O_NONBLOCK 0x0080
24#define O_CREAT 0x0100 /* not fcntl */ 20#define O_CREAT 0x0100 /* not fcntl */
25#define O_TRUNC 0x0200 /* not fcntl */
26#define O_EXCL 0x0400 /* not fcntl */ 21#define O_EXCL 0x0400 /* not fcntl */
27#define O_NOCTTY 0x0800 /* not fcntl */ 22#define O_NOCTTY 0x0800 /* not fcntl */
28#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ 23#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
29#define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */ 24#define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */
30#define O_DIRECT 0x8000 /* direct disk access hint - currently ignored*/ 25#define O_DIRECT 0x8000 /* direct disk access hint - currently ignored*/
31#define O_DIRECTORY 0x10000 /* must be a directory */
32#define O_NOFOLLOW 0x20000 /* don't follow links */
33#define O_NOATIME 0x100000 26#define O_NOATIME 0x100000
34 27
35#define O_NDELAY O_NONBLOCK
36
37#define F_DUPFD 0 /* dup */
38#define F_GETFD 1 /* get close_on_exec */
39#define F_SETFD 2 /* set/clear close_on_exec */
40#define F_GETFL 3 /* get file->f_flags */
41#define F_SETFL 4 /* set file->f_flags */
42#define F_GETLK 14 28#define F_GETLK 14
43#define F_GETLK64 15 29#define F_GETLK64 15
44#define F_SETLK 6 30#define F_SETLK 6
@@ -48,35 +34,6 @@
48 34
49#define F_SETOWN 24 /* for sockets. */ 35#define F_SETOWN 24 /* for sockets. */
50#define F_GETOWN 23 /* for sockets. */ 36#define F_GETOWN 23 /* for sockets. */
51#define F_SETSIG 10 /* for sockets. */
52#define F_GETSIG 11 /* for sockets. */
53
54/* for F_[GET|SET]FL */
55#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
56
57/* for posix fcntl() and lockf() */
58#define F_RDLCK 0
59#define F_WRLCK 1
60#define F_UNLCK 2
61
62/* for old implementation of bsd flock () */
63#define F_EXLCK 4 /* or 3 */
64#define F_SHLCK 8 /* or 4 */
65
66/* for leases */
67#define F_INPROGRESS 16
68
69/* operations for bsd flock(), also used by the kernel implementation */
70#define LOCK_SH 1 /* shared lock */
71#define LOCK_EX 2 /* exclusive lock */
72#define LOCK_NB 4 /* or'd with one of the above to prevent
73 blocking */
74#define LOCK_UN 8 /* remove lock */
75
76#define LOCK_MAND 32 /* This is a mandatory flock ... */
77#define LOCK_READ 64 /* which allows concurrent read operations */
78#define LOCK_WRITE 128 /* which allows concurrent write operations */
79#define LOCK_RW 192 /* which allows concurrent read & write ops */
80 37
81typedef struct flock { 38typedef struct flock {
82 short l_type; 39 short l_type;
@@ -96,6 +53,9 @@ struct flock64 {
96 pid_t l_pid; 53 pid_t l_pid;
97}; 54};
98 55
99#define F_LINUX_SPECIFIC_BASE 1024 56#define HAVE_ARCH_STRUCT_FLOCK
57#define HAVE_ARCH_STRUCT_FLOCK64
58
59#include <asm-generic/fcntl.h>
100 60
101#endif /* _XTENSA_FCNTL_H */ 61#endif /* _XTENSA_FCNTL_H */
diff --git a/include/asm-xtensa/hdreg.h b/include/asm-xtensa/hdreg.h
deleted file mode 100644
index 64b80607b80d..000000000000
--- a/include/asm-xtensa/hdreg.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * include/asm-xtensa/hdreg.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 * Copyright (C) 1994-1996 Linus Torvalds & authors
10 */
11
12#ifndef _XTENSA_HDREG_H
13#define _XTENSA_HDREG_H
14
15typedef unsigned int ide_ioreg_t;
16
17#endif
diff --git a/include/asm-xtensa/io.h b/include/asm-xtensa/io.h
index 2c471c42ecfc..c5c13985bbe1 100644
--- a/include/asm-xtensa/io.h
+++ b/include/asm-xtensa/io.h
@@ -41,12 +41,12 @@ static inline unsigned int _swapl (unsigned int v)
41 * These are trivial on the 1:1 Linux/Xtensa mapping 41 * These are trivial on the 1:1 Linux/Xtensa mapping
42 */ 42 */
43 43
44extern inline unsigned long virt_to_phys(volatile void * address) 44static inline unsigned long virt_to_phys(volatile void * address)
45{ 45{
46 return PHYSADDR((unsigned long)address); 46 return PHYSADDR((unsigned long)address);
47} 47}
48 48
49extern inline void * phys_to_virt(unsigned long address) 49static inline void * phys_to_virt(unsigned long address)
50{ 50{
51 return (void*) CACHED_ADDR(address); 51 return (void*) CACHED_ADDR(address);
52} 52}
@@ -55,12 +55,12 @@ extern inline void * phys_to_virt(unsigned long address)
55 * IO bus memory addresses are also 1:1 with the physical address 55 * IO bus memory addresses are also 1:1 with the physical address
56 */ 56 */
57 57
58extern inline unsigned long virt_to_bus(volatile void * address) 58static inline unsigned long virt_to_bus(volatile void * address)
59{ 59{
60 return PHYSADDR((unsigned long)address); 60 return PHYSADDR((unsigned long)address);
61} 61}
62 62
63extern inline void * bus_to_virt (unsigned long address) 63static inline void * bus_to_virt (unsigned long address)
64{ 64{
65 return (void *) CACHED_ADDR(address); 65 return (void *) CACHED_ADDR(address);
66} 66}
@@ -69,17 +69,17 @@ extern inline void * bus_to_virt (unsigned long address)
69 * Change "struct page" to physical address. 69 * Change "struct page" to physical address.
70 */ 70 */
71 71
72extern inline void *ioremap(unsigned long offset, unsigned long size) 72static inline void *ioremap(unsigned long offset, unsigned long size)
73{ 73{
74 return (void *) CACHED_ADDR_IO(offset); 74 return (void *) CACHED_ADDR_IO(offset);
75} 75}
76 76
77extern inline void *ioremap_nocache(unsigned long offset, unsigned long size) 77static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
78{ 78{
79 return (void *) BYPASS_ADDR_IO(offset); 79 return (void *) BYPASS_ADDR_IO(offset);
80} 80}
81 81
82extern inline void iounmap(void *addr) 82static inline void iounmap(void *addr)
83{ 83{
84} 84}
85 85
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h
index 1b0801548cd9..364a7b057bfa 100644
--- a/include/asm-xtensa/mmu_context.h
+++ b/include/asm-xtensa/mmu_context.h
@@ -199,13 +199,13 @@ extern pgd_t *current_pgd;
199#define ASID_FIRST_VERSION \ 199#define ASID_FIRST_VERSION \
200 ((unsigned long)(~ASID_VERSION_MASK) + 1 + ASID_FIRST_NONRESERVED) 200 ((unsigned long)(~ASID_VERSION_MASK) + 1 + ASID_FIRST_NONRESERVED)
201 201
202extern inline void set_rasid_register (unsigned long val) 202static inline void set_rasid_register (unsigned long val)
203{ 203{
204 __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t" 204 __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t"
205 " isync\n" : : "a" (val)); 205 " isync\n" : : "a" (val));
206} 206}
207 207
208extern inline unsigned long get_rasid_register (void) 208static inline unsigned long get_rasid_register (void)
209{ 209{
210 unsigned long tmp; 210 unsigned long tmp;
211 __asm__ __volatile__ (" rsr %0, "__stringify(RASID)"\n\t" : "=a" (tmp)); 211 __asm__ __volatile__ (" rsr %0, "__stringify(RASID)"\n\t" : "=a" (tmp));
@@ -215,7 +215,7 @@ extern inline unsigned long get_rasid_register (void)
215 215
216#if ((XCHAL_MMU_ASID_INVALID == 0) && (XCHAL_MMU_ASID_KERNEL == 1)) 216#if ((XCHAL_MMU_ASID_INVALID == 0) && (XCHAL_MMU_ASID_KERNEL == 1))
217 217
218extern inline void 218static inline void
219get_new_mmu_context(struct mm_struct *mm, unsigned long asid) 219get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
220{ 220{
221 extern void flush_tlb_all(void); 221 extern void flush_tlb_all(void);
@@ -234,7 +234,7 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
234/* XCHAL_MMU_ASID_INVALID == 0 and XCHAL_MMU_ASID_KERNEL ==1 are 234/* XCHAL_MMU_ASID_INVALID == 0 and XCHAL_MMU_ASID_KERNEL ==1 are
235 really the best, but if you insist... */ 235 really the best, but if you insist... */
236 236
237extern inline int validate_asid (unsigned long asid) 237static inline int validate_asid (unsigned long asid)
238{ 238{
239 switch (asid) { 239 switch (asid) {
240 case XCHAL_MMU_ASID_INVALID: 240 case XCHAL_MMU_ASID_INVALID:
@@ -247,7 +247,7 @@ extern inline int validate_asid (unsigned long asid)
247 return 1; /* valid */ 247 return 1; /* valid */
248} 248}
249 249
250extern inline void 250static inline void
251get_new_mmu_context(struct mm_struct *mm, unsigned long asid) 251get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
252{ 252{
253 extern void flush_tlb_all(void); 253 extern void flush_tlb_all(void);
@@ -274,14 +274,14 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
274 * instance. 274 * instance.
275 */ 275 */
276 276
277extern inline int 277static inline int
278init_new_context(struct task_struct *tsk, struct mm_struct *mm) 278init_new_context(struct task_struct *tsk, struct mm_struct *mm)
279{ 279{
280 mm->context = NO_CONTEXT; 280 mm->context = NO_CONTEXT;
281 return 0; 281 return 0;
282} 282}
283 283
284extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 284static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
285 struct task_struct *tsk) 285 struct task_struct *tsk)
286{ 286{
287 unsigned long asid = asid_cache; 287 unsigned long asid = asid_cache;
@@ -301,7 +301,7 @@ extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
301 * Destroy context related info for an mm_struct that is about 301 * Destroy context related info for an mm_struct that is about
302 * to be put to rest. 302 * to be put to rest.
303 */ 303 */
304extern inline void destroy_context(struct mm_struct *mm) 304static inline void destroy_context(struct mm_struct *mm)
305{ 305{
306 /* Nothing to do. */ 306 /* Nothing to do. */
307} 307}
@@ -310,7 +310,7 @@ extern inline void destroy_context(struct mm_struct *mm)
310 * After we have set current->mm to a new value, this activates 310 * After we have set current->mm to a new value, this activates
311 * the context for the new mm so we see the new mappings. 311 * the context for the new mm so we see the new mappings.
312 */ 312 */
313extern inline void 313static inline void
314activate_mm(struct mm_struct *prev, struct mm_struct *next) 314activate_mm(struct mm_struct *prev, struct mm_struct *next)
315{ 315{
316 /* Unconditionally get a new ASID. */ 316 /* Unconditionally get a new ASID. */
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h
index b495e5b5a942..8ded36f255a2 100644
--- a/include/asm-xtensa/page.h
+++ b/include/asm-xtensa/page.h
@@ -55,7 +55,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
55 * Pure 2^n version of get_order 55 * Pure 2^n version of get_order
56 */ 56 */
57 57
58extern __inline__ int get_order(unsigned long size) 58static inline int get_order(unsigned long size)
59{ 59{
60 int order; 60 int order;
61#ifndef XCHAL_HAVE_NSU 61#ifndef XCHAL_HAVE_NSU
diff --git a/include/asm-xtensa/page.h.n b/include/asm-xtensa/page.h.n
deleted file mode 100644
index 546cc6624f24..000000000000
--- a/include/asm-xtensa/page.h.n
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * linux/include/asm-xtensa/page.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version2 as
6 * published by the Free Software Foundation.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PAGE_H
12#define _XTENSA_PAGE_H
13
14#ifdef __KERNEL__
15
16#include <asm/processor.h>
17#include <linux/config.h>
18
19/*
20 * PAGE_SHIFT determines the page size
21 * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary
22 */
23#define PAGE_SHIFT XCHAL_MMU_MIN_PTE_PAGE_SIZE
24#define PAGE_SIZE (1 << PAGE_SHIFT)
25#define PAGE_MASK (~(PAGE_SIZE-1))
26#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE - 1) & PAGE_MASK)
27
28#define DCACHE_WAY_SIZE (XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS)
29#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR
30
31#ifdef __ASSEMBLY__
32
33#define __pgprot(x) (x)
34
35#else
36
37
38/*
39 * These are used to make use of C type-checking..
40 */
41typedef struct { unsigned long pte; } pte_t; /* page table entry */
42typedef struct { unsigned long pmd; } pmd_t; /* PMD table entry */
43typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */
44typedef struct { unsigned long pgprot; } pgprot_t;
45
46#define pte_val(x) ((x).pte)
47#define pmd_val(x) ((x).pmd)
48#define pgd_val(x) ((x).pgd)
49#define pgprot_val(x) ((x).pgprot)
50
51#define __pte(x) ((pte_t) { (x) } )
52#define __pmd(x) ((pmd_t) { (x) } )
53#define __pgd(x) ((pgd_t) { (x) } )
54#define __pgprot(x) ((pgprot_t) { (x) } )
55
56/*
57 * Pure 2^n version of get_order
58 */
59extern __inline__ int get_order(unsigned long size)
60{
61 int order;
62#ifndef XCHAL_HAVE_NSU
63 unsigned long x1, x2, x4, x8, x16;
64
65 size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
66 x1 = size & 0xAAAAAAAA;
67 x2 = size & 0xCCCCCCCC;
68 x4 = size & 0xF0F0F0F0;
69 x8 = size & 0xFF00FF00;
70 x16 = size & 0xFFFF0000;
71 order = x2 ? 2 : 0;
72 order += (x16 != 0) * 16;
73 order += (x8 != 0) * 8;
74 order += (x4 != 0) * 4;
75 order += (x1 != 0);
76
77 return order;
78#else
79 size = (size - 1) >> PAGE_SHIFT;
80 asm ("nsau %0, %1" : "=r" (order) : "r" (size));
81 return 32 - order;
82#endif
83}
84
85
86struct page;
87extern void clear_page(void *page);
88extern void copy_page(void *to, void *from);
89
90/*
91 * If we have cache aliasing and writeback caches, we might have to do
92 * some extra work
93 */
94
95#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
96void clear_user_page(void *addr, unsigned long vaddr, struct page* page);
97void copy_user_page(void *to, void* from, unsigned long vaddr, struct page* page);
98#else
99# define clear_user_page(page,vaddr,pg) clear_page(page)
100# define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
101#endif
102
103
104/*
105 * This handles the memory map. We handle pages at
106 * XCHAL_KSEG_CACHED_VADDR for kernels with 32 bit address space.
107 * These macros are for conversion of kernel address, not user
108 * addresses.
109 */
110
111#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
112#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
113#define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr)
114#ifndef CONFIG_DISCONTIGMEM
115# define pfn_to_page(pfn) (mem_map + (pfn))
116# define page_to_pfn(page) ((unsigned long)((page) - mem_map))
117#else
118# error CONFIG_DISCONTIGMEM not supported
119#endif
120
121#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
122#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT)
123#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
124#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
125
126#define WANT_PAGE_VIRTUAL
127
128
129#endif /* __ASSEMBLY__ */
130
131#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
132 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
133
134#endif /* __KERNEL__ */
135#endif /* _XTENSA_PAGE_H */
diff --git a/include/asm-xtensa/pci.h b/include/asm-xtensa/pci.h
index 6817742301c2..24eb7fc25da8 100644
--- a/include/asm-xtensa/pci.h
+++ b/include/asm-xtensa/pci.h
@@ -22,12 +22,12 @@
22 22
23extern struct pci_controller* pcibios_alloc_controller(void); 23extern struct pci_controller* pcibios_alloc_controller(void);
24 24
25extern inline void pcibios_set_master(struct pci_dev *dev) 25static inline void pcibios_set_master(struct pci_dev *dev)
26{ 26{
27 /* No special bus mastering setup handling */ 27 /* No special bus mastering setup handling */
28} 28}
29 29
30extern inline void pcibios_penalize_isa_irq(int irq) 30static inline void pcibios_penalize_isa_irq(int irq)
31{ 31{
32 /* We don't do dynamic PCI IRQ allocation */ 32 /* We don't do dynamic PCI IRQ allocation */
33} 33}
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index 0bb6416ae266..883ebc2d75d6 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -260,7 +260,7 @@ static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pt
260#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 260#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
261#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) 261#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
262 262
263extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 263static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
264{ 264{
265 return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); 265 return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
266} 266}
@@ -278,14 +278,14 @@ static inline void update_pte(pte_t *ptep, pte_t pteval)
278#endif 278#endif
279} 279}
280 280
281extern inline void 281static inline void
282set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) 282set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval)
283{ 283{
284 update_pte(ptep, pteval); 284 update_pte(ptep, pteval);
285} 285}
286 286
287 287
288extern inline void 288static inline void
289set_pmd(pmd_t *pmdp, pmd_t pmdval) 289set_pmd(pmd_t *pmdp, pmd_t pmdval)
290{ 290{
291 *pmdp = pmdval; 291 *pmdp = pmdval;
diff --git a/include/asm-xtensa/semaphore.h b/include/asm-xtensa/semaphore.h
index c8a7574a9a57..db740b8bc6f0 100644
--- a/include/asm-xtensa/semaphore.h
+++ b/include/asm-xtensa/semaphore.h
@@ -47,7 +47,7 @@ struct semaphore {
47#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 47#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
48#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) 48#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
49 49
50extern inline void sema_init (struct semaphore *sem, int val) 50static inline void sema_init (struct semaphore *sem, int val)
51{ 51{
52/* 52/*
53 * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); 53 * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val);
@@ -79,7 +79,7 @@ asmlinkage void __up(struct semaphore * sem);
79 79
80extern spinlock_t semaphore_wake_lock; 80extern spinlock_t semaphore_wake_lock;
81 81
82extern __inline__ void down(struct semaphore * sem) 82static inline void down(struct semaphore * sem)
83{ 83{
84#if WAITQUEUE_DEBUG 84#if WAITQUEUE_DEBUG
85 CHECK_MAGIC(sem->__magic); 85 CHECK_MAGIC(sem->__magic);
@@ -89,7 +89,7 @@ extern __inline__ void down(struct semaphore * sem)
89 __down(sem); 89 __down(sem);
90} 90}
91 91
92extern __inline__ int down_interruptible(struct semaphore * sem) 92static inline int down_interruptible(struct semaphore * sem)
93{ 93{
94 int ret = 0; 94 int ret = 0;
95#if WAITQUEUE_DEBUG 95#if WAITQUEUE_DEBUG
@@ -101,7 +101,7 @@ extern __inline__ int down_interruptible(struct semaphore * sem)
101 return ret; 101 return ret;
102} 102}
103 103
104extern __inline__ int down_trylock(struct semaphore * sem) 104static inline int down_trylock(struct semaphore * sem)
105{ 105{
106 int ret = 0; 106 int ret = 0;
107#if WAITQUEUE_DEBUG 107#if WAITQUEUE_DEBUG
@@ -117,7 +117,7 @@ extern __inline__ int down_trylock(struct semaphore * sem)
117 * Note! This is subtle. We jump to wake people up only if 117 * Note! This is subtle. We jump to wake people up only if
118 * the semaphore was negative (== somebody was waiting on it). 118 * the semaphore was negative (== somebody was waiting on it).
119 */ 119 */
120extern __inline__ void up(struct semaphore * sem) 120static inline void up(struct semaphore * sem)
121{ 121{
122#if WAITQUEUE_DEBUG 122#if WAITQUEUE_DEBUG
123 CHECK_MAGIC(sem->__magic); 123 CHECK_MAGIC(sem->__magic);
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index daccd05a14cd..00f83f3a6d72 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -24,6 +24,8 @@
24#define SO_BROADCAST 6 24#define SO_BROADCAST 6
25#define SO_SNDBUF 7 25#define SO_SNDBUF 7
26#define SO_RCVBUF 8 26#define SO_RCVBUF 8
27#define SO_SNDBUFFORCE 32
28#define SO_RCVBUFFORCE 33
27#define SO_KEEPALIVE 9 29#define SO_KEEPALIVE 9
28#define SO_OOBINLINE 10 30#define SO_OOBINLINE 10
29#define SO_NO_CHECK 11 31#define SO_NO_CHECK 11
diff --git a/include/asm-xtensa/string.h b/include/asm-xtensa/string.h
index 3f81b27d9809..5fb8c27cbef5 100644
--- a/include/asm-xtensa/string.h
+++ b/include/asm-xtensa/string.h
@@ -16,7 +16,7 @@
16#define _XTENSA_STRING_H 16#define _XTENSA_STRING_H
17 17
18#define __HAVE_ARCH_STRCPY 18#define __HAVE_ARCH_STRCPY
19extern __inline__ char *strcpy(char *__dest, const char *__src) 19static inline char *strcpy(char *__dest, const char *__src)
20{ 20{
21 register char *__xdest = __dest; 21 register char *__xdest = __dest;
22 unsigned long __dummy; 22 unsigned long __dummy;
@@ -35,7 +35,7 @@ extern __inline__ char *strcpy(char *__dest, const char *__src)
35} 35}
36 36
37#define __HAVE_ARCH_STRNCPY 37#define __HAVE_ARCH_STRNCPY
38extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n) 38static inline char *strncpy(char *__dest, const char *__src, size_t __n)
39{ 39{
40 register char *__xdest = __dest; 40 register char *__xdest = __dest;
41 unsigned long __dummy; 41 unsigned long __dummy;
@@ -60,7 +60,7 @@ extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n)
60} 60}
61 61
62#define __HAVE_ARCH_STRCMP 62#define __HAVE_ARCH_STRCMP
63extern __inline__ int strcmp(const char *__cs, const char *__ct) 63static inline int strcmp(const char *__cs, const char *__ct)
64{ 64{
65 register int __res; 65 register int __res;
66 unsigned long __dummy; 66 unsigned long __dummy;
@@ -82,7 +82,7 @@ extern __inline__ int strcmp(const char *__cs, const char *__ct)
82} 82}
83 83
84#define __HAVE_ARCH_STRNCMP 84#define __HAVE_ARCH_STRNCMP
85extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) 85static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
86{ 86{
87 register int __res; 87 register int __res;
88 unsigned long __dummy; 88 unsigned long __dummy;
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
index 690fe325e671..f09393232e5e 100644
--- a/include/asm-xtensa/system.h
+++ b/include/asm-xtensa/system.h
@@ -56,7 +56,7 @@ static inline int irqs_disabled(void)
56 56
57#define clear_cpenable() __clear_cpenable() 57#define clear_cpenable() __clear_cpenable()
58 58
59extern __inline__ void __clear_cpenable(void) 59static inline void __clear_cpenable(void)
60{ 60{
61#if XCHAL_HAVE_CP 61#if XCHAL_HAVE_CP
62 unsigned long i = 0; 62 unsigned long i = 0;
@@ -64,7 +64,7 @@ extern __inline__ void __clear_cpenable(void)
64#endif 64#endif
65} 65}
66 66
67extern __inline__ void enable_coprocessor(int i) 67static inline void enable_coprocessor(int i)
68{ 68{
69#if XCHAL_HAVE_CP 69#if XCHAL_HAVE_CP
70 int cp; 70 int cp;
@@ -74,7 +74,7 @@ extern __inline__ void enable_coprocessor(int i)
74#endif 74#endif
75} 75}
76 76
77extern __inline__ void disable_coprocessor(int i) 77static inline void disable_coprocessor(int i)
78{ 78{
79#if XCHAL_HAVE_CP 79#if XCHAL_HAVE_CP
80 int cp; 80 int cp;
@@ -123,7 +123,7 @@ do { \
123 * cmpxchg 123 * cmpxchg
124 */ 124 */
125 125
126extern __inline__ unsigned long 126static inline unsigned long
127__cmpxchg_u32(volatile int *p, int old, int new) 127__cmpxchg_u32(volatile int *p, int old, int new)
128{ 128{
129 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" 129 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t"
@@ -173,7 +173,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
173 * where no register reference will cause an overflow. 173 * where no register reference will cause an overflow.
174 */ 174 */
175 175
176extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) 176static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
177{ 177{
178 unsigned long tmp; 178 unsigned long tmp;
179 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" 179 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t"
diff --git a/include/asm-xtensa/tlbflush.h b/include/asm-xtensa/tlbflush.h
index 23bfe9db45f5..43f6ec859af9 100644
--- a/include/asm-xtensa/tlbflush.h
+++ b/include/asm-xtensa/tlbflush.h
@@ -39,7 +39,7 @@ extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long);
39 * page-table pages. 39 * page-table pages.
40 */ 40 */
41 41
42extern inline void flush_tlb_pgtables(struct mm_struct *mm, 42static inline void flush_tlb_pgtables(struct mm_struct *mm,
43 unsigned long start, unsigned long end) 43 unsigned long start, unsigned long end)
44{ 44{
45} 45}
@@ -51,26 +51,26 @@ extern inline void flush_tlb_pgtables(struct mm_struct *mm,
51#define ITLB_PROBE_SUCCESS (1 << ITLB_WAYS_LOG2) 51#define ITLB_PROBE_SUCCESS (1 << ITLB_WAYS_LOG2)
52#define DTLB_PROBE_SUCCESS (1 << DTLB_WAYS_LOG2) 52#define DTLB_PROBE_SUCCESS (1 << DTLB_WAYS_LOG2)
53 53
54extern inline unsigned long itlb_probe(unsigned long addr) 54static inline unsigned long itlb_probe(unsigned long addr)
55{ 55{
56 unsigned long tmp; 56 unsigned long tmp;
57 __asm__ __volatile__("pitlb %0, %1\n\t" : "=a" (tmp) : "a" (addr)); 57 __asm__ __volatile__("pitlb %0, %1\n\t" : "=a" (tmp) : "a" (addr));
58 return tmp; 58 return tmp;
59} 59}
60 60
61extern inline unsigned long dtlb_probe(unsigned long addr) 61static inline unsigned long dtlb_probe(unsigned long addr)
62{ 62{
63 unsigned long tmp; 63 unsigned long tmp;
64 __asm__ __volatile__("pdtlb %0, %1\n\t" : "=a" (tmp) : "a" (addr)); 64 __asm__ __volatile__("pdtlb %0, %1\n\t" : "=a" (tmp) : "a" (addr));
65 return tmp; 65 return tmp;
66} 66}
67 67
68extern inline void invalidate_itlb_entry (unsigned long probe) 68static inline void invalidate_itlb_entry (unsigned long probe)
69{ 69{
70 __asm__ __volatile__("iitlb %0; isync\n\t" : : "a" (probe)); 70 __asm__ __volatile__("iitlb %0; isync\n\t" : : "a" (probe));
71} 71}
72 72
73extern inline void invalidate_dtlb_entry (unsigned long probe) 73static inline void invalidate_dtlb_entry (unsigned long probe)
74{ 74{
75 __asm__ __volatile__("idtlb %0; dsync\n\t" : : "a" (probe)); 75 __asm__ __volatile__("idtlb %0; dsync\n\t" : : "a" (probe));
76} 76}
@@ -80,68 +80,68 @@ extern inline void invalidate_dtlb_entry (unsigned long probe)
80 * caller must follow up with an 'isync', which can be relatively 80 * caller must follow up with an 'isync', which can be relatively
81 * expensive on some Xtensa implementations. 81 * expensive on some Xtensa implementations.
82 */ 82 */
83extern inline void invalidate_itlb_entry_no_isync (unsigned entry) 83static inline void invalidate_itlb_entry_no_isync (unsigned entry)
84{ 84{
85 /* Caller must follow up with 'isync'. */ 85 /* Caller must follow up with 'isync'. */
86 __asm__ __volatile__ ("iitlb %0\n" : : "a" (entry) ); 86 __asm__ __volatile__ ("iitlb %0\n" : : "a" (entry) );
87} 87}
88 88
89extern inline void invalidate_dtlb_entry_no_isync (unsigned entry) 89static inline void invalidate_dtlb_entry_no_isync (unsigned entry)
90{ 90{
91 /* Caller must follow up with 'isync'. */ 91 /* Caller must follow up with 'isync'. */
92 __asm__ __volatile__ ("idtlb %0\n" : : "a" (entry) ); 92 __asm__ __volatile__ ("idtlb %0\n" : : "a" (entry) );
93} 93}
94 94
95extern inline void set_itlbcfg_register (unsigned long val) 95static inline void set_itlbcfg_register (unsigned long val)
96{ 96{
97 __asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t" 97 __asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t"
98 : : "a" (val)); 98 : : "a" (val));
99} 99}
100 100
101extern inline void set_dtlbcfg_register (unsigned long val) 101static inline void set_dtlbcfg_register (unsigned long val)
102{ 102{
103 __asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t" 103 __asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t"
104 : : "a" (val)); 104 : : "a" (val));
105} 105}
106 106
107extern inline void set_ptevaddr_register (unsigned long val) 107static inline void set_ptevaddr_register (unsigned long val)
108{ 108{
109 __asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n" 109 __asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n"
110 : : "a" (val)); 110 : : "a" (val));
111} 111}
112 112
113extern inline unsigned long read_ptevaddr_register (void) 113static inline unsigned long read_ptevaddr_register (void)
114{ 114{
115 unsigned long tmp; 115 unsigned long tmp;
116 __asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp)); 116 __asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp));
117 return tmp; 117 return tmp;
118} 118}
119 119
120extern inline void write_dtlb_entry (pte_t entry, int way) 120static inline void write_dtlb_entry (pte_t entry, int way)
121{ 121{
122 __asm__ __volatile__("wdtlb %1, %0; dsync\n\t" 122 __asm__ __volatile__("wdtlb %1, %0; dsync\n\t"
123 : : "r" (way), "r" (entry) ); 123 : : "r" (way), "r" (entry) );
124} 124}
125 125
126extern inline void write_itlb_entry (pte_t entry, int way) 126static inline void write_itlb_entry (pte_t entry, int way)
127{ 127{
128 __asm__ __volatile__("witlb %1, %0; isync\n\t" 128 __asm__ __volatile__("witlb %1, %0; isync\n\t"
129 : : "r" (way), "r" (entry) ); 129 : : "r" (way), "r" (entry) );
130} 130}
131 131
132extern inline void invalidate_page_directory (void) 132static inline void invalidate_page_directory (void)
133{ 133{
134 invalidate_dtlb_entry (DTLB_WAY_PGTABLE); 134 invalidate_dtlb_entry (DTLB_WAY_PGTABLE);
135} 135}
136 136
137extern inline void invalidate_itlb_mapping (unsigned address) 137static inline void invalidate_itlb_mapping (unsigned address)
138{ 138{
139 unsigned long tlb_entry; 139 unsigned long tlb_entry;
140 while ((tlb_entry = itlb_probe (address)) & ITLB_PROBE_SUCCESS) 140 while ((tlb_entry = itlb_probe (address)) & ITLB_PROBE_SUCCESS)
141 invalidate_itlb_entry (tlb_entry); 141 invalidate_itlb_entry (tlb_entry);
142} 142}
143 143
144extern inline void invalidate_dtlb_mapping (unsigned address) 144static inline void invalidate_dtlb_mapping (unsigned address)
145{ 145{
146 unsigned long tlb_entry; 146 unsigned long tlb_entry;
147 while ((tlb_entry = dtlb_probe (address)) & DTLB_PROBE_SUCCESS) 147 while ((tlb_entry = dtlb_probe (address)) & DTLB_PROBE_SUCCESS)
@@ -165,28 +165,28 @@ extern inline void invalidate_dtlb_mapping (unsigned address)
165 * as[07..00] contain the asid 165 * as[07..00] contain the asid
166 */ 166 */
167 167
168extern inline unsigned long read_dtlb_virtual (int way) 168static inline unsigned long read_dtlb_virtual (int way)
169{ 169{
170 unsigned long tmp; 170 unsigned long tmp;
171 __asm__ __volatile__("rdtlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way)); 171 __asm__ __volatile__("rdtlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way));
172 return tmp; 172 return tmp;
173} 173}
174 174
175extern inline unsigned long read_dtlb_translation (int way) 175static inline unsigned long read_dtlb_translation (int way)
176{ 176{
177 unsigned long tmp; 177 unsigned long tmp;
178 __asm__ __volatile__("rdtlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way)); 178 __asm__ __volatile__("rdtlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way));
179 return tmp; 179 return tmp;
180} 180}
181 181
182extern inline unsigned long read_itlb_virtual (int way) 182static inline unsigned long read_itlb_virtual (int way)
183{ 183{
184 unsigned long tmp; 184 unsigned long tmp;
185 __asm__ __volatile__("ritlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way)); 185 __asm__ __volatile__("ritlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way));
186 return tmp; 186 return tmp;
187} 187}
188 188
189extern inline unsigned long read_itlb_translation (int way) 189static inline unsigned long read_itlb_translation (int way)
190{ 190{
191 unsigned long tmp; 191 unsigned long tmp;
192 __asm__ __volatile__("ritlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way)); 192 __asm__ __volatile__("ritlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way));
diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h
index ebac00469852..9d99a8e9e337 100644
--- a/include/asm-xtensa/types.h
+++ b/include/asm-xtensa/types.h
@@ -58,8 +58,6 @@ typedef unsigned long long u64;
58 58
59typedef u32 dma_addr_t; 59typedef u32 dma_addr_t;
60 60
61typedef unsigned int kmem_bufctl_t;
62
63#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
64#endif 62#endif
65 63
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h
index 35576b25c7b2..fc268ac923c0 100644
--- a/include/asm-xtensa/uaccess.h
+++ b/include/asm-xtensa/uaccess.h
@@ -211,7 +211,7 @@
211#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) 211#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
212#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) 212#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
213 213
214extern inline int verify_area(int type, const void * addr, unsigned long size) 214static inline int verify_area(int type, const void * addr, unsigned long size)
215{ 215{
216 return access_ok(type,addr,size) ? 0 : -EFAULT; 216 return access_ok(type,addr,size) ? 0 : -EFAULT;
217} 217}
@@ -464,7 +464,7 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n)
464 * success. 464 * success.
465 */ 465 */
466 466
467extern inline unsigned long 467static inline unsigned long
468__xtensa_clear_user(void *addr, unsigned long size) 468__xtensa_clear_user(void *addr, unsigned long size)
469{ 469{
470 if ( ! memset(addr, 0, size) ) 470 if ( ! memset(addr, 0, size) )
@@ -472,7 +472,7 @@ __xtensa_clear_user(void *addr, unsigned long size)
472 return 0; 472 return 0;
473} 473}
474 474
475extern inline unsigned long 475static inline unsigned long
476clear_user(void *addr, unsigned long size) 476clear_user(void *addr, unsigned long size)
477{ 477{
478 if (access_ok(VERIFY_WRITE, addr, size)) 478 if (access_ok(VERIFY_WRITE, addr, size))
@@ -486,7 +486,7 @@ clear_user(void *addr, unsigned long size)
486extern long __strncpy_user(char *, const char *, long); 486extern long __strncpy_user(char *, const char *, long);
487#define __strncpy_from_user __strncpy_user 487#define __strncpy_from_user __strncpy_user
488 488
489extern inline long 489static inline long
490strncpy_from_user(char *dst, const char *src, long count) 490strncpy_from_user(char *dst, const char *src, long count)
491{ 491{
492 if (access_ok(VERIFY_READ, src, 1)) 492 if (access_ok(VERIFY_READ, src, 1))
@@ -502,7 +502,7 @@ strncpy_from_user(char *dst, const char *src, long count)
502 */ 502 */
503extern long __strnlen_user(const char *, long); 503extern long __strnlen_user(const char *, long);
504 504
505extern inline long strnlen_user(const char *str, long len) 505static inline long strnlen_user(const char *str, long len)
506{ 506{
507 unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1; 507 unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1;
508 508
diff --git a/include/linux/8250_pci.h b/include/linux/8250_pci.h
index 5f3ab21b339b..3209dd46ea7d 100644
--- a/include/linux/8250_pci.h
+++ b/include/linux/8250_pci.h
@@ -1,2 +1,37 @@
1int pci_siig10x_fn(struct pci_dev *dev, int enable); 1/*
2int pci_siig20x_fn(struct pci_dev *dev, int enable); 2 * Definitions for PCI support.
3 */
4#define FL_BASE_MASK 0x0007
5#define FL_BASE0 0x0000
6#define FL_BASE1 0x0001
7#define FL_BASE2 0x0002
8#define FL_BASE3 0x0003
9#define FL_BASE4 0x0004
10#define FL_GET_BASE(x) (x & FL_BASE_MASK)
11
12/* Use successive BARs (PCI base address registers),
13 else use offset into some specified BAR */
14#define FL_BASE_BARS 0x0008
15
16/* do not assign an irq */
17#define FL_NOIRQ 0x0080
18
19/* Use the Base address register size to cap number of ports */
20#define FL_REGION_SZ_CAP 0x0100
21
22struct pciserial_board {
23 unsigned int flags;
24 unsigned int num_ports;
25 unsigned int base_baud;
26 unsigned int uart_offset;
27 unsigned int reg_shift;
28 unsigned int first_offset;
29};
30
31struct serial_private;
32
33struct serial_private *
34pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board);
35void pciserial_remove_ports(struct serial_private *priv);
36void pciserial_suspend_ports(struct serial_private *priv);
37void pciserial_resume_ports(struct serial_private *priv);
diff --git a/include/linux/ata.h b/include/linux/ata.h
index ca5fcadf9981..a5b74efab067 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -1,24 +1,29 @@
1 1
2/* 2/*
3 Copyright 2003-2004 Red Hat, Inc. All rights reserved. 3 * Copyright 2003-2004 Red Hat, Inc. All rights reserved.
4 Copyright 2003-2004 Jeff Garzik 4 * Copyright 2003-2004 Jeff Garzik
5 5 *
6 The contents of this file are subject to the Open 6 *
7 Software License version 1.1 that can be found at 7 * This program is free software; you can redistribute it and/or modify
8 http://www.opensource.org/licenses/osl-1.1.txt and is included herein 8 * it under the terms of the GNU General Public License as published by
9 by reference. 9 * the Free Software Foundation; either version 2, or (at your option)
10 10 * any later version.
11 Alternatively, the contents of this file may be used under the terms 11 *
12 of the GNU General Public License version 2 (the "GPL") as distributed 12 * This program is distributed in the hope that it will be useful,
13 in the kernel source COPYING file, in which case the provisions of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 the GPL are applicable instead of the above. If you wish to allow 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 the use of your version of this file only under the terms of the 15 * GNU General Public License for more details.
16 GPL and not to allow others to use your version of this file under 16 *
17 the OSL, indicate your decision by deleting the provisions above and 17 * You should have received a copy of the GNU General Public License
18 replace them with the notice and other provisions required by the GPL. 18 * along with this program; see the file COPYING. If not, write to
19 If you do not delete the provisions above, a recipient may use your 19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 version of this file under either the OSL or the GPL. 20 *
21 21 *
22 * libata documentation is available via 'make {ps|pdf}docs',
23 * as Documentation/DocBook/libata.*
24 *
25 * Hardware documentation available from http://www.t13.org/
26 *
22 */ 27 */
23 28
24#ifndef __LINUX_ATA_H__ 29#ifndef __LINUX_ATA_H__
@@ -108,6 +113,8 @@ enum {
108 113
109 /* ATA device commands */ 114 /* ATA device commands */
110 ATA_CMD_CHK_POWER = 0xE5, /* check power mode */ 115 ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
116 ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
117 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
111 ATA_CMD_EDD = 0x90, /* execute device diagnostic */ 118 ATA_CMD_EDD = 0x90, /* execute device diagnostic */
112 ATA_CMD_FLUSH = 0xE7, 119 ATA_CMD_FLUSH = 0xE7,
113 ATA_CMD_FLUSH_EXT = 0xEA, 120 ATA_CMD_FLUSH_EXT = 0xEA,
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index af1010b6dab7..93bfb0beb62a 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -11,10 +11,12 @@
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/klist.h>
15#include <linux/spinlock.h>
14 16
15struct attribute_container { 17struct attribute_container {
16 struct list_head node; 18 struct list_head node;
17 struct list_head containers; 19 struct klist containers;
18 struct class *class; 20 struct class *class;
19 struct class_device_attribute **attrs; 21 struct class_device_attribute **attrs;
20 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
@@ -62,12 +64,8 @@ int attribute_container_add_class_device_adapter(struct attribute_container *con
62 struct class_device *classdev); 64 struct class_device *classdev);
63void attribute_container_remove_attrs(struct class_device *classdev); 65void attribute_container_remove_attrs(struct class_device *classdev);
64void attribute_container_class_device_del(struct class_device *classdev); 66void attribute_container_class_device_del(struct class_device *classdev);
65 67struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
66 68struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
67
68
69
70
71struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); 69struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
72 70
73#endif 71#endif
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
new file mode 100644
index 000000000000..9a7b374c9fb4
--- /dev/null
+++ b/include/linux/auxvec.h
@@ -0,0 +1,31 @@
1#ifndef _LINUX_AUXVEC_H
2#define _LINUX_AUXVEC_H
3
4#include <asm/auxvec.h>
5
6/* Symbolic values for the entries in the auxiliary table
7 put on the initial stack */
8#define AT_NULL 0 /* end of vector */
9#define AT_IGNORE 1 /* entry should be ignored */
10#define AT_EXECFD 2 /* file descriptor of program */
11#define AT_PHDR 3 /* program headers for program */
12#define AT_PHENT 4 /* size of program header entry */
13#define AT_PHNUM 5 /* number of program headers */
14#define AT_PAGESZ 6 /* system page size */
15#define AT_BASE 7 /* base address of interpreter */
16#define AT_FLAGS 8 /* flags */
17#define AT_ENTRY 9 /* entry point of program */
18#define AT_NOTELF 10 /* program is not ELF */
19#define AT_UID 11 /* real uid */
20#define AT_EUID 12 /* effective uid */
21#define AT_GID 13 /* real gid */
22#define AT_EGID 14 /* effective gid */
23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
25#define AT_CLKTCK 17 /* frequency at which times() increments */
26
27#define AT_SECURE 23 /* secure mode boolean */
28
29#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */
30
31#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 36ef29fa0d8b..cdaf03a14a51 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -111,7 +111,6 @@ struct bio {
111 void *bi_private; 111 void *bi_private;
112 112
113 bio_destructor_t *bi_destructor; /* destructor */ 113 bio_destructor_t *bi_destructor; /* destructor */
114 struct bio_set *bi_set; /* memory pools set */
115}; 114};
116 115
117/* 116/*
@@ -280,6 +279,7 @@ extern void bioset_free(struct bio_set *);
280extern struct bio *bio_alloc(unsigned int __nocast, int); 279extern struct bio *bio_alloc(unsigned int __nocast, int);
281extern struct bio *bio_alloc_bioset(unsigned int __nocast, int, struct bio_set *); 280extern struct bio *bio_alloc_bioset(unsigned int __nocast, int, struct bio_set *);
282extern void bio_put(struct bio *); 281extern void bio_put(struct bio *);
282extern void bio_free(struct bio *, struct bio_set *);
283 283
284extern void bio_endio(struct bio *, unsigned int, int); 284extern void bio_endio(struct bio *, unsigned int, int);
285struct request_queue; 285struct request_queue;
@@ -295,7 +295,13 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
295extern int bio_get_nr_vecs(struct block_device *); 295extern int bio_get_nr_vecs(struct block_device *);
296extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 296extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
297 unsigned long, unsigned int, int); 297 unsigned long, unsigned int, int);
298struct sg_iovec;
299extern struct bio *bio_map_user_iov(struct request_queue *,
300 struct block_device *,
301 struct sg_iovec *, int, int);
298extern void bio_unmap_user(struct bio *); 302extern void bio_unmap_user(struct bio *);
303extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
304 unsigned int);
299extern void bio_set_pages_dirty(struct bio *bio); 305extern void bio_set_pages_dirty(struct bio *bio);
300extern void bio_check_pages_dirty(struct bio *bio); 306extern void bio_check_pages_dirty(struct bio *bio);
301extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 307extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 19bd8e7e11bf..aefa26fbae8a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -563,10 +563,12 @@ extern void blk_sync_queue(struct request_queue *q);
563extern void __blk_stop_queue(request_queue_t *q); 563extern void __blk_stop_queue(request_queue_t *q);
564extern void blk_run_queue(request_queue_t *); 564extern void blk_run_queue(request_queue_t *);
565extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); 565extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
566extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); 566extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int);
567extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int); 567extern int blk_rq_unmap_user(struct bio *, unsigned int);
568extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); 568extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int);
569 569extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
570extern int blk_execute_rq(request_queue_t *, struct gendisk *,
571 struct request *, int);
570static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 572static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
571{ 573{
572 return bdev->bd_disk->queue; 574 return bdev->bd_disk->queue;
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 8d139f4acf23..6b4618902d3d 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -233,6 +233,7 @@ typedef __u32 kernel_cap_t;
233/* Allow enabling/disabling tagged queuing on SCSI controllers and sending 233/* Allow enabling/disabling tagged queuing on SCSI controllers and sending
234 arbitrary SCSI commands */ 234 arbitrary SCSI commands */
235/* Allow setting encryption key on loopback filesystem */ 235/* Allow setting encryption key on loopback filesystem */
236/* Allow setting zone reclaim policy */
236 237
237#define CAP_SYS_ADMIN 21 238#define CAP_SYS_ADMIN 21
238 239
diff --git a/include/linux/compat.h b/include/linux/compat.h
index b58b7d6f2fdb..f9ca534787e2 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -18,6 +18,9 @@
18#define compat_jiffies_to_clock_t(x) \ 18#define compat_jiffies_to_clock_t(x) \
19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
20 20
21typedef __compat_uid32_t compat_uid_t;
22typedef __compat_gid32_t compat_gid_t;
23
21struct rusage; 24struct rusage;
22 25
23struct compat_itimerspec { 26struct compat_itimerspec {
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index e8904c0da686..86980c68234a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -8,7 +8,7 @@
8 * Basic handling of the devices is done in drivers/base/cpu.c 8 * Basic handling of the devices is done in drivers/base/cpu.c
9 * and system devices are handled in drivers/base/sys.c. 9 * and system devices are handled in drivers/base/sys.c.
10 * 10 *
11 * CPUs are exported via driverfs in the class/cpu/devices/ 11 * CPUs are exported via sysfs in the class/cpu/devices/
12 * directory. 12 * directory.
13 * 13 *
14 * Per-cpu interfaces can be implemented using a struct device_interface. 14 * Per-cpu interfaces can be implemented using a struct device_interface.
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 3438233305a3..24062a1dbf61 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -23,7 +23,8 @@ void cpuset_init_current_mems_allowed(void);
23void cpuset_update_current_mems_allowed(void); 23void cpuset_update_current_mems_allowed(void);
24void cpuset_restrict_to_mems_allowed(unsigned long *nodes); 24void cpuset_restrict_to_mems_allowed(unsigned long *nodes);
25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
26int cpuset_zone_allowed(struct zone *z); 26extern int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask);
27extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
27extern struct file_operations proc_cpuset_operations; 28extern struct file_operations proc_cpuset_operations;
28extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
29 30
@@ -48,7 +49,13 @@ static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
48 return 1; 49 return 1;
49} 50}
50 51
51static inline int cpuset_zone_allowed(struct zone *z) 52static inline int cpuset_zone_allowed(struct zone *z,
53 unsigned int __nocast gfp_mask)
54{
55 return 1;
56}
57
58static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
52{ 59{
53 return 1; 60 return 1;
54} 61}
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 5e2bcc636a02..3c89df6e7768 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -45,6 +45,7 @@
45#define CRYPTO_TFM_MODE_CTR 0x00000008 45#define CRYPTO_TFM_MODE_CTR 0x00000008
46 46
47#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 47#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100
48#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
48#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 49#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000
49#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 50#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
50#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 51#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 50be290d24d2..ab04b4f9b0db 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -88,8 +88,9 @@ struct dentry {
88 * negative */ 88 * negative */
89 /* 89 /*
90 * The next three fields are touched by __d_lookup. Place them here 90 * The next three fields are touched by __d_lookup. Place them here
91 * so they all fit in a 16-byte range, with 16-byte alignment. 91 * so they all fit in a cache line.
92 */ 92 */
93 struct hlist_node d_hash; /* lookup hash list */
93 struct dentry *d_parent; /* parent directory */ 94 struct dentry *d_parent; /* parent directory */
94 struct qstr d_name; 95 struct qstr d_name;
95 96
@@ -103,7 +104,6 @@ struct dentry {
103 void *d_fsdata; /* fs-specific data */ 104 void *d_fsdata; /* fs-specific data */
104 struct rcu_head d_rcu; 105 struct rcu_head d_rcu;
105 struct dcookie_struct *d_cookie; /* cookie, if any */ 106 struct dcookie_struct *d_cookie; /* cookie, if any */
106 struct hlist_node d_hash; /* lookup hash list */
107 int d_mounted; 107 int d_mounted;
108 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 108 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
109}; 109};
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
new file mode 100644
index 000000000000..007c290f74d4
--- /dev/null
+++ b/include/linux/dccp.h
@@ -0,0 +1,456 @@
1#ifndef _LINUX_DCCP_H
2#define _LINUX_DCCP_H
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7/* Structure describing an Internet (DCCP) socket address. */
8struct sockaddr_dccp {
9 __u16 sdccp_family; /* Address family */
10 __u16 sdccp_port; /* Port number */
11 __u32 sdccp_addr; /* Internet address */
12 __u32 sdccp_service; /* Service */
13 /* Pad to size of `struct sockaddr': 16 bytes . */
14 __u32 sdccp_pad;
15};
16
17/**
18 * struct dccp_hdr - generic part of DCCP packet header
19 *
20 * @dccph_sport - Relevant port on the endpoint that sent this packet
21 * @dccph_dport - Relevant port on the other endpoint
22 * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
23 * @dccph_ccval - Used by the HC-Sender CCID
24 * @dccph_cscov - Parts of the packet that are covered by the Checksum field
25 * @dccph_checksum - Internet checksum, depends on dccph_cscov
26 * @dccph_x - 0 = 24 bit sequence number, 1 = 48
27 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
28 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
29 */
30struct dccp_hdr {
31 __u16 dccph_sport,
32 dccph_dport;
33 __u8 dccph_doff;
34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u8 dccph_cscov:4,
36 dccph_ccval:4;
37#elif defined(__BIG_ENDIAN_BITFIELD)
38 __u8 dccph_ccval:4,
39 dccph_cscov:4;
40#else
41#error "Adjust your <asm/byteorder.h> defines"
42#endif
43 __u16 dccph_checksum;
44#if defined(__LITTLE_ENDIAN_BITFIELD)
45 __u32 dccph_x:1,
46 dccph_type:4,
47 dccph_reserved:3,
48 dccph_seq:24;
49#elif defined(__BIG_ENDIAN_BITFIELD)
50 __u32 dccph_reserved:3,
51 dccph_type:4,
52 dccph_x:1,
53 dccph_seq:24;
54#else
55#error "Adjust your <asm/byteorder.h> defines"
56#endif
57};
58
59/**
60 * struct dccp_hdr_ext - the low bits of a 48 bit seq packet
61 *
62 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
63 */
64struct dccp_hdr_ext {
65 __u32 dccph_seq_low;
66};
67
68/**
69 * struct dccp_hdr_request - Conection initiation request header
70 *
71 * @dccph_req_service - Service to which the client app wants to connect
72 * @dccph_req_options - list of options (must be a multiple of 32 bits
73 */
74struct dccp_hdr_request {
75 __u32 dccph_req_service;
76};
77/**
78 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
79 *
80 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
81 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
82 */
83struct dccp_hdr_ack_bits {
84 __u32 dccph_reserved1:8,
85 dccph_ack_nr_high:24;
86 __u32 dccph_ack_nr_low;
87};
88/**
89 * struct dccp_hdr_response - Conection initiation response header
90 *
91 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
92 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
93 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
94 * @dccph_resp_options - list of options (must be a multiple of 32 bits
95 */
96struct dccp_hdr_response {
97 struct dccp_hdr_ack_bits dccph_resp_ack;
98 __u32 dccph_resp_service;
99};
100
101/**
102 * struct dccp_hdr_reset - Unconditionally shut down a connection
103 *
104 * @dccph_reset_service - Echoes the Service Code on a received DCCP-Request
105 * @dccph_reset_options - list of options (must be a multiple of 32 bits
106 */
107struct dccp_hdr_reset {
108 struct dccp_hdr_ack_bits dccph_reset_ack;
109 __u8 dccph_reset_code,
110 dccph_reset_data[3];
111};
112
113enum dccp_pkt_type {
114 DCCP_PKT_REQUEST = 0,
115 DCCP_PKT_RESPONSE,
116 DCCP_PKT_DATA,
117 DCCP_PKT_ACK,
118 DCCP_PKT_DATAACK,
119 DCCP_PKT_CLOSEREQ,
120 DCCP_PKT_CLOSE,
121 DCCP_PKT_RESET,
122 DCCP_PKT_SYNC,
123 DCCP_PKT_SYNCACK,
124 DCCP_PKT_INVALID,
125};
126
127#define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID
128
129static inline unsigned int dccp_packet_hdr_len(const __u8 type)
130{
131 if (type == DCCP_PKT_DATA)
132 return 0;
133 if (type == DCCP_PKT_DATAACK ||
134 type == DCCP_PKT_ACK ||
135 type == DCCP_PKT_SYNC ||
136 type == DCCP_PKT_SYNCACK ||
137 type == DCCP_PKT_CLOSE ||
138 type == DCCP_PKT_CLOSEREQ)
139 return sizeof(struct dccp_hdr_ack_bits);
140 if (type == DCCP_PKT_REQUEST)
141 return sizeof(struct dccp_hdr_request);
142 if (type == DCCP_PKT_RESPONSE)
143 return sizeof(struct dccp_hdr_response);
144 return sizeof(struct dccp_hdr_reset);
145}
146enum dccp_reset_codes {
147 DCCP_RESET_CODE_UNSPECIFIED = 0,
148 DCCP_RESET_CODE_CLOSED,
149 DCCP_RESET_CODE_ABORTED,
150 DCCP_RESET_CODE_NO_CONNECTION,
151 DCCP_RESET_CODE_PACKET_ERROR,
152 DCCP_RESET_CODE_OPTION_ERROR,
153 DCCP_RESET_CODE_MANDATORY_ERROR,
154 DCCP_RESET_CODE_CONNECTION_REFUSED,
155 DCCP_RESET_CODE_BAD_SERVICE_CODE,
156 DCCP_RESET_CODE_TOO_BUSY,
157 DCCP_RESET_CODE_BAD_INIT_COOKIE,
158 DCCP_RESET_CODE_AGGRESSION_PENALTY,
159};
160
161/* DCCP options */
162enum {
163 DCCPO_PADDING = 0,
164 DCCPO_MANDATORY = 1,
165 DCCPO_MIN_RESERVED = 3,
166 DCCPO_MAX_RESERVED = 31,
167 DCCPO_NDP_COUNT = 37,
168 DCCPO_ACK_VECTOR_0 = 38,
169 DCCPO_ACK_VECTOR_1 = 39,
170 DCCPO_TIMESTAMP = 41,
171 DCCPO_TIMESTAMP_ECHO = 42,
172 DCCPO_ELAPSED_TIME = 43,
173 DCCPO_MAX = 45,
174 DCCPO_MIN_CCID_SPECIFIC = 128,
175 DCCPO_MAX_CCID_SPECIFIC = 255,
176};
177
178/* DCCP features */
179enum {
180 DCCPF_RESERVED = 0,
181 DCCPF_SEQUENCE_WINDOW = 3,
182 DCCPF_SEND_ACK_VECTOR = 6,
183 DCCPF_SEND_NDP_COUNT = 7,
184 /* 10-127 reserved */
185 DCCPF_MIN_CCID_SPECIFIC = 128,
186 DCCPF_MAX_CCID_SPECIFIC = 255,
187};
188
189/* DCCP socket options */
190#define DCCP_SOCKOPT_PACKET_SIZE 1
191
192#ifdef __KERNEL__
193
194#include <linux/in.h>
195#include <linux/list.h>
196#include <linux/uio.h>
197#include <linux/workqueue.h>
198
199#include <net/inet_connection_sock.h>
200#include <net/inet_timewait_sock.h>
201#include <net/sock.h>
202#include <net/tcp_states.h>
203#include <net/tcp.h>
204
205enum dccp_state {
206 DCCP_OPEN = TCP_ESTABLISHED,
207 DCCP_REQUESTING = TCP_SYN_SENT,
208 DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME:
209 This mapping is horrible, but TCP has
210 no matching state for DCCP_PARTOPEN,
211 as TCP_SYN_RECV is already used by
212 DCCP_RESPOND, why don't stop using TCP
213 mapping of states? OK, now we don't use
214 sk_stream_sendmsg anymore, so doesn't
215 seem to exist any reason for us to
216 do the TCP mapping here */
217 DCCP_LISTEN = TCP_LISTEN,
218 DCCP_RESPOND = TCP_SYN_RECV,
219 DCCP_CLOSING = TCP_CLOSING,
220 DCCP_TIME_WAIT = TCP_TIME_WAIT,
221 DCCP_CLOSED = TCP_CLOSE,
222 DCCP_MAX_STATES = TCP_MAX_STATES,
223};
224
225#define DCCP_STATE_MASK 0xf
226#define DCCP_ACTION_FIN (1<<7)
227
228enum {
229 DCCPF_OPEN = TCPF_ESTABLISHED,
230 DCCPF_REQUESTING = TCPF_SYN_SENT,
231 DCCPF_PARTOPEN = TCPF_FIN_WAIT1,
232 DCCPF_LISTEN = TCPF_LISTEN,
233 DCCPF_RESPOND = TCPF_SYN_RECV,
234 DCCPF_CLOSING = TCPF_CLOSING,
235 DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
236 DCCPF_CLOSED = TCPF_CLOSE,
237};
238
239static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
240{
241 return (struct dccp_hdr *)skb->h.raw;
242}
243
244static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
245{
246 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));
247}
248
249static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
250{
251 return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0);
252}
253
254static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb)
255{
256 const struct dccp_hdr *dh = dccp_hdr(skb);
257 return __dccp_basic_hdr_len(dh);
258}
259
260static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
261{
262 const struct dccp_hdr *dh = dccp_hdr(skb);
263#if defined(__LITTLE_ENDIAN_BITFIELD)
264 __u64 seq_nr = ntohl(dh->dccph_seq << 8);
265#elif defined(__BIG_ENDIAN_BITFIELD)
266 __u64 seq_nr = ntohl(dh->dccph_seq);
267#else
268#error "Adjust your <asm/byteorder.h> defines"
269#endif
270
271 if (dh->dccph_x != 0)
272 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low);
273
274 return seq_nr;
275}
276
277static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
278{
279 return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb));
280}
281
282static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
283{
284 return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb));
285}
286
287static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
288{
289 const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb);
290#if defined(__LITTLE_ENDIAN_BITFIELD)
291 return (((u64)ntohl(dhack->dccph_ack_nr_high << 8)) << 32) + ntohl(dhack->dccph_ack_nr_low);
292#elif defined(__BIG_ENDIAN_BITFIELD)
293 return (((u64)ntohl(dhack->dccph_ack_nr_high)) << 32) + ntohl(dhack->dccph_ack_nr_low);
294#else
295#error "Adjust your <asm/byteorder.h> defines"
296#endif
297}
298
299static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
300{
301 return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb));
302}
303
304static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
305{
306 return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb));
307}
308
309static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
310{
311 return __dccp_basic_hdr_len(dh) +
312 dccp_packet_hdr_len(dh->dccph_type);
313}
314
315static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
316{
317 return __dccp_hdr_len(dccp_hdr(skb));
318}
319
320
321/* initial values for each feature */
322#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
323/* FIXME: for now we're using CCID 3 (TFRC) */
324#define DCCPF_INITIAL_CCID 3
325#define DCCPF_INITIAL_SEND_ACK_VECTOR 0
326/* FIXME: for now we're default to 1 but it should really be 0 */
327#define DCCPF_INITIAL_SEND_NDP_COUNT 1
328
329#define DCCP_NDP_LIMIT 0xFFFFFF
330
331/**
332 * struct dccp_options - option values for a DCCP connection
333 * @dccpo_sequence_window - Sequence Window Feature (section 7.5.2)
334 * @dccpo_ccid - Congestion Control Id (CCID) (section 10)
335 * @dccpo_send_ack_vector - Send Ack Vector Feature (section 11.5)
336 * @dccpo_send_ndp_count - Send NDP Count Feature (7.7.2)
337 */
338struct dccp_options {
339 __u64 dccpo_sequence_window;
340 __u8 dccpo_ccid;
341 __u8 dccpo_send_ack_vector;
342 __u8 dccpo_send_ndp_count;
343};
344
345extern void __dccp_options_init(struct dccp_options *dccpo);
346extern void dccp_options_init(struct dccp_options *dccpo);
347extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
348
349struct dccp_request_sock {
350 struct inet_request_sock dreq_inet_rsk;
351 __u64 dreq_iss;
352 __u64 dreq_isr;
353 __u32 dreq_service;
354};
355
356static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
357{
358 return (struct dccp_request_sock *)req;
359}
360
361extern struct inet_timewait_death_row dccp_death_row;
362
363/* Read about the ECN nonce to see why it is 253 */
364#define DCCP_MAX_ACK_VECTOR_LEN 253
365
366struct dccp_options_received {
367 u32 dccpor_ndp:24,
368 dccpor_ack_vector_len:8;
369 u32 dccpor_ack_vector_idx:10;
370 /* 22 bits hole, try to pack */
371 u32 dccpor_timestamp;
372 u32 dccpor_timestamp_echo;
373 u32 dccpor_elapsed_time;
374};
375
376struct ccid;
377
378enum dccp_role {
379 DCCP_ROLE_UNDEFINED,
380 DCCP_ROLE_LISTEN,
381 DCCP_ROLE_CLIENT,
382 DCCP_ROLE_SERVER,
383};
384
385/**
386 * struct dccp_sock - DCCP socket state
387 *
388 * @dccps_swl - sequence number window low
389 * @dccps_swh - sequence number window high
390 * @dccps_awl - acknowledgement number window low
391 * @dccps_awh - acknowledgement number window high
392 * @dccps_iss - initial sequence number sent
393 * @dccps_isr - initial sequence number received
394 * @dccps_osr - first OPEN sequence number received
395 * @dccps_gss - greatest sequence number sent
396 * @dccps_gsr - greatest valid sequence number received
397 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
398 * @dccps_timestamp_time - time of latest TIMESTAMP option
399 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
400 * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
401 * @dccps_pmtu_cookie - Last pmtu seen by socket
402 * @dccps_packet_size - Set thru setsockopt
403 * @dccps_role - Role of this sock, one of %dccp_role
404 * @dccps_ndp_count - number of Non Data Packets since last data packet
405 * @dccps_hc_rx_ackpkts - receiver half connection acked packets
406 */
407struct dccp_sock {
408 /* inet_connection_sock has to be the first member of dccp_sock */
409 struct inet_connection_sock dccps_inet_connection;
410 __u64 dccps_swl;
411 __u64 dccps_swh;
412 __u64 dccps_awl;
413 __u64 dccps_awh;
414 __u64 dccps_iss;
415 __u64 dccps_isr;
416 __u64 dccps_osr;
417 __u64 dccps_gss;
418 __u64 dccps_gsr;
419 __u64 dccps_gar;
420 unsigned long dccps_service;
421 struct timeval dccps_timestamp_time;
422 __u32 dccps_timestamp_echo;
423 __u32 dccps_packet_size;
424 unsigned long dccps_ndp_count;
425 __u16 dccps_ext_header_len;
426 __u32 dccps_pmtu_cookie;
427 __u32 dccps_mss_cache;
428 struct dccp_options dccps_options;
429 struct dccp_ackpkts *dccps_hc_rx_ackpkts;
430 void *dccps_hc_rx_ccid_private;
431 void *dccps_hc_tx_ccid_private;
432 struct ccid *dccps_hc_rx_ccid;
433 struct ccid *dccps_hc_tx_ccid;
434 struct dccp_options_received dccps_options_received;
435 enum dccp_role dccps_role:2;
436};
437
438static inline struct dccp_sock *dccp_sk(const struct sock *sk)
439{
440 return (struct dccp_sock *)sk;
441}
442
443static inline const char *dccp_role(const struct sock *sk)
444{
445 switch (dccp_sk(sk)->dccps_role) {
446 case DCCP_ROLE_UNDEFINED: return "undefined";
447 case DCCP_ROLE_LISTEN: return "listen";
448 case DCCP_ROLE_SERVER: return "server";
449 case DCCP_ROLE_CLIENT: return "client";
450 }
451 return NULL;
452}
453
454#endif /* __KERNEL__ */
455
456#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 5e93e6dce9a4..c30175e8dec6 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -1,6 +1,8 @@
1#ifndef __DMI_H__ 1#ifndef __DMI_H__
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h>
5
4enum dmi_field { 6enum dmi_field {
5 DMI_NONE, 7 DMI_NONE,
6 DMI_BIOS_VENDOR, 8 DMI_BIOS_VENDOR,
@@ -16,6 +18,24 @@ enum dmi_field {
16 DMI_STRING_MAX, 18 DMI_STRING_MAX,
17}; 19};
18 20
21enum dmi_device_type {
22 DMI_DEV_TYPE_ANY = 0,
23 DMI_DEV_TYPE_OTHER,
24 DMI_DEV_TYPE_UNKNOWN,
25 DMI_DEV_TYPE_VIDEO,
26 DMI_DEV_TYPE_SCSI,
27 DMI_DEV_TYPE_ETHERNET,
28 DMI_DEV_TYPE_TOKENRING,
29 DMI_DEV_TYPE_SOUND,
30 DMI_DEV_TYPE_IPMI = -1
31};
32
33struct dmi_header {
34 u8 type;
35 u8 length;
36 u16 handle;
37};
38
19/* 39/*
20 * DMI callbacks for problem boards 40 * DMI callbacks for problem boards
21 */ 41 */
@@ -26,22 +46,32 @@ struct dmi_strmatch {
26 46
27struct dmi_system_id { 47struct dmi_system_id {
28 int (*callback)(struct dmi_system_id *); 48 int (*callback)(struct dmi_system_id *);
29 char *ident; 49 const char *ident;
30 struct dmi_strmatch matches[4]; 50 struct dmi_strmatch matches[4];
31 void *driver_data; 51 void *driver_data;
32}; 52};
33 53
34#define DMI_MATCH(a,b) { a, b } 54#define DMI_MATCH(a, b) { a, b }
55
56struct dmi_device {
57 struct list_head list;
58 int type;
59 const char *name;
60 void *device_data; /* Type specific data */
61};
35 62
36#if defined(CONFIG_X86) && !defined(CONFIG_X86_64) 63#if defined(CONFIG_X86) && !defined(CONFIG_X86_64)
37 64
38extern int dmi_check_system(struct dmi_system_id *list); 65extern int dmi_check_system(struct dmi_system_id *list);
39extern char * dmi_get_system_info(int field); 66extern char * dmi_get_system_info(int field);
40 67extern struct dmi_device * dmi_find_device(int type, const char *name,
68 struct dmi_device *from);
41#else 69#else
42 70
43static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
44static inline char * dmi_get_system_info(int field) { return NULL; } 72static inline char * dmi_get_system_info(int field) { return NULL; }
73static struct dmi_device * dmi_find_device(int type, const char *name,
74 struct dmi_device *from) { return NULL; }
45 75
46#endif 76#endif
47 77
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 73781ec165b4..c7c5dd316182 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -91,11 +91,6 @@ typedef struct {
91 91
92#define EFI_PAGE_SHIFT 12 92#define EFI_PAGE_SHIFT 12
93 93
94/*
95 * For current x86 implementations of EFI, there is
96 * additional padding in the mem descriptors. This is not
97 * the case in ia64. Need to have this fixed in the f/w.
98 */
99typedef struct { 94typedef struct {
100 u32 type; 95 u32 type;
101 u32 pad; 96 u32 pad;
@@ -103,9 +98,6 @@ typedef struct {
103 u64 virt_addr; 98 u64 virt_addr;
104 u64 num_pages; 99 u64 num_pages;
105 u64 attribute; 100 u64 attribute;
106#if defined (__i386__)
107 u64 pad1;
108#endif
109} efi_memory_desc_t; 101} efi_memory_desc_t;
110 102
111typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg); 103typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg);
@@ -240,10 +232,12 @@ typedef struct {
240} efi_system_table_t; 232} efi_system_table_t;
241 233
242struct efi_memory_map { 234struct efi_memory_map {
243 efi_memory_desc_t *phys_map; 235 void *phys_map;
244 efi_memory_desc_t *map; 236 void *map;
237 void *map_end;
245 int nr_map; 238 int nr_map;
246 unsigned long desc_version; 239 unsigned long desc_version;
240 unsigned long desc_size;
247}; 241};
248 242
249/* 243/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index f5b3ba5a317d..ff955dbf510d 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -2,6 +2,7 @@
2#define _LINUX_ELF_H 2#define _LINUX_ELF_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/auxvec.h>
5#include <asm/elf.h> 6#include <asm/elf.h>
6 7
7#ifndef elf_read_implies_exec 8#ifndef elf_read_implies_exec
@@ -158,29 +159,6 @@ typedef __s64 Elf64_Sxword;
158#define ELF64_ST_BIND(x) ELF_ST_BIND(x) 159#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
159#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) 160#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
160 161
161/* Symbolic values for the entries in the auxiliary table
162 put on the initial stack */
163#define AT_NULL 0 /* end of vector */
164#define AT_IGNORE 1 /* entry should be ignored */
165#define AT_EXECFD 2 /* file descriptor of program */
166#define AT_PHDR 3 /* program headers for program */
167#define AT_PHENT 4 /* size of program header entry */
168#define AT_PHNUM 5 /* number of program headers */
169#define AT_PAGESZ 6 /* system page size */
170#define AT_BASE 7 /* base address of interpreter */
171#define AT_FLAGS 8 /* flags */
172#define AT_ENTRY 9 /* entry point of program */
173#define AT_NOTELF 10 /* program is not ELF */
174#define AT_UID 11 /* real uid */
175#define AT_EUID 12 /* effective uid */
176#define AT_GID 13 /* real gid */
177#define AT_EGID 14 /* effective gid */
178#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
179#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
180#define AT_CLKTCK 17 /* frequency at which times() increments */
181
182#define AT_SECURE 23 /* secure mode boolean */
183
184typedef struct dynamic{ 162typedef struct dynamic{
185 Elf32_Sword d_tag; 163 Elf32_Sword d_tag;
186 union{ 164 union{
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index ce8518e658b6..4522c7186bf3 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -69,6 +69,12 @@ static inline int is_multicast_ether_addr(const u8 *addr)
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 69 return ((addr[0] != 0xff) && (0x01 & addr[0]));
70} 70}
71 71
72static inline int is_broadcast_ether_addr(const u8 *addr)
73{
74 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&
75 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
76}
77
72/** 78/**
73 * is_valid_ether_addr - Determine if the given Ethernet address is valid 79 * is_valid_ether_addr - Determine if the given Ethernet address is valid
74 * @addr: Pointer to a six-byte array containing the Ethernet address 80 * @addr: Pointer to a six-byte array containing the Ethernet address
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index a0ab26aab450..ed1440ea4c91 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -250,6 +250,12 @@ struct ethtool_stats {
250 u64 data[0]; 250 u64 data[0];
251}; 251};
252 252
253struct ethtool_perm_addr {
254 u32 cmd; /* ETHTOOL_GPERMADDR */
255 u32 size;
256 u8 data[0];
257};
258
253struct net_device; 259struct net_device;
254 260
255/* Some generic methods drivers may use in their ethtool_ops */ 261/* Some generic methods drivers may use in their ethtool_ops */
@@ -261,6 +267,8 @@ u32 ethtool_op_get_sg(struct net_device *dev);
261int ethtool_op_set_sg(struct net_device *dev, u32 data); 267int ethtool_op_set_sg(struct net_device *dev, u32 data);
262u32 ethtool_op_get_tso(struct net_device *dev); 268u32 ethtool_op_get_tso(struct net_device *dev);
263int ethtool_op_set_tso(struct net_device *dev, u32 data); 269int ethtool_op_set_tso(struct net_device *dev, u32 data);
270int ethtool_op_get_perm_addr(struct net_device *dev,
271 struct ethtool_perm_addr *addr, u8 *data);
264 272
265/** 273/**
266 * &ethtool_ops - Alter and report network device settings 274 * &ethtool_ops - Alter and report network device settings
@@ -294,7 +302,8 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);
294 * get_strings: Return a set of strings that describe the requested objects 302 * get_strings: Return a set of strings that describe the requested objects
295 * phys_id: Identify the device 303 * phys_id: Identify the device
296 * get_stats: Return statistics about the device 304 * get_stats: Return statistics about the device
297 * 305 * get_perm_addr: Gets the permanent hardware address
306 *
298 * Description: 307 * Description:
299 * 308 *
300 * get_settings: 309 * get_settings:
@@ -352,6 +361,7 @@ struct ethtool_ops {
352 int (*phys_id)(struct net_device *, u32); 361 int (*phys_id)(struct net_device *, u32);
353 int (*get_stats_count)(struct net_device *); 362 int (*get_stats_count)(struct net_device *);
354 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 363 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
364 int (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *);
355 int (*begin)(struct net_device *); 365 int (*begin)(struct net_device *);
356 void (*complete)(struct net_device *); 366 void (*complete)(struct net_device *);
357}; 367};
@@ -389,6 +399,7 @@ struct ethtool_ops {
389#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 399#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
390#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 400#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
391#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 401#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
402#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
392 403
393/* compatibility with older code */ 404/* compatibility with older code */
394#define SPARC_ETH_GSET ETHTOOL_GSET 405#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -408,6 +419,8 @@ struct ethtool_ops {
408#define SUPPORTED_FIBRE (1 << 10) 419#define SUPPORTED_FIBRE (1 << 10)
409#define SUPPORTED_BNC (1 << 11) 420#define SUPPORTED_BNC (1 << 11)
410#define SUPPORTED_10000baseT_Full (1 << 12) 421#define SUPPORTED_10000baseT_Full (1 << 12)
422#define SUPPORTED_Pause (1 << 13)
423#define SUPPORTED_Asym_Pause (1 << 14)
411 424
412/* Indicates what features are advertised by the interface. */ 425/* Indicates what features are advertised by the interface. */
413#define ADVERTISED_10baseT_Half (1 << 0) 426#define ADVERTISED_10baseT_Half (1 << 0)
@@ -423,6 +436,8 @@ struct ethtool_ops {
423#define ADVERTISED_FIBRE (1 << 10) 436#define ADVERTISED_FIBRE (1 << 10)
424#define ADVERTISED_BNC (1 << 11) 437#define ADVERTISED_BNC (1 << 11)
425#define ADVERTISED_10000baseT_Full (1 << 12) 438#define ADVERTISED_10000baseT_Full (1 << 12)
439#define ADVERTISED_Pause (1 << 13)
440#define ADVERTISED_Asym_Pause (1 << 14)
426 441
427/* The following are all involved in forcing a particular link 442/* The following are all involved in forcing a particular link
428 * mode for the device for setting things. When getting the 443 * mode for the device for setting things. When getting the
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index a657130ba03a..f7bd1c7ebefb 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -313,6 +313,9 @@ struct ext2_inode {
313#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ 313#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
314#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ 314#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
315#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ 315#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
316#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
317#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
318
316 319
317#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt 320#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
318#define set_opt(o, opt) o |= EXT2_MOUNT_##opt 321#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index c16662836c58..c0272d73ab20 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -373,6 +373,8 @@ struct ext3_inode {
373#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ 373#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
374#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ 374#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
375#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ 375#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
376#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
377#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
376 378
377/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ 379/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
378#ifndef _LINUX_EXT2_FS_H 380#ifndef _LINUX_EXT2_FS_H
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 886255b69bb9..2063c0839d4f 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -3,6 +3,9 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/types.h> 4#include <linux/types.h>
5#define FIRMWARE_NAME_MAX 30 5#define FIRMWARE_NAME_MAX 30
6#define FW_ACTION_NOHOTPLUG 0
7#define FW_ACTION_HOTPLUG 1
8
6struct firmware { 9struct firmware {
7 size_t size; 10 size_t size;
8 u8 *data; 11 u8 *data;
@@ -11,7 +14,7 @@ struct device;
11int request_firmware(const struct firmware **fw, const char *name, 14int request_firmware(const struct firmware **fw, const char *name,
12 struct device *device); 15 struct device *device);
13int request_firmware_nowait( 16int request_firmware_nowait(
14 struct module *module, 17 struct module *module, int hotplug,
15 const char *name, struct device *device, void *context, 18 const char *name, struct device *device, void *context,
16 void (*cont)(const struct firmware *fw, void *context)); 19 void (*cont)(const struct firmware *fw, void *context));
17 20
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f9adf75fd9b4..fd93ab7da905 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -69,6 +69,7 @@ extern int dir_notify_enable;
69#define READ 0 69#define READ 0
70#define WRITE 1 70#define WRITE 1
71#define READA 2 /* read-ahead - don't block if no resources */ 71#define READA 2 /* read-ahead - don't block if no resources */
72#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
72#define SPECIAL 4 /* For non-blockdevice requests in request queue */ 73#define SPECIAL 4 /* For non-blockdevice requests in request queue */
73#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 74#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
74#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 75#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
@@ -281,19 +282,9 @@ struct iattr {
281 struct timespec ia_atime; 282 struct timespec ia_atime;
282 struct timespec ia_mtime; 283 struct timespec ia_mtime;
283 struct timespec ia_ctime; 284 struct timespec ia_ctime;
284 unsigned int ia_attr_flags;
285}; 285};
286 286
287/* 287/*
288 * This is the inode attributes flag definitions
289 */
290#define ATTR_FLAG_SYNCRONOUS 1 /* Syncronous write */
291#define ATTR_FLAG_NOATIME 2 /* Don't update atime */
292#define ATTR_FLAG_APPEND 4 /* Append-only file */
293#define ATTR_FLAG_IMMUTABLE 8 /* Immutable file */
294#define ATTR_FLAG_NODIRATIME 16 /* Don't update atime for directory */
295
296/*
297 * Includes for diskquotas. 288 * Includes for diskquotas.
298 */ 289 */
299#include <linux/quota.h> 290#include <linux/quota.h>
@@ -594,7 +585,6 @@ struct file {
594 unsigned int f_uid, f_gid; 585 unsigned int f_uid, f_gid;
595 struct file_ra_state f_ra; 586 struct file_ra_state f_ra;
596 587
597 size_t f_maxcount;
598 unsigned long f_version; 588 unsigned long f_version;
599 void *f_security; 589 void *f_security;
600 590
@@ -993,8 +983,8 @@ struct inode_operations {
993 int (*rename) (struct inode *, struct dentry *, 983 int (*rename) (struct inode *, struct dentry *,
994 struct inode *, struct dentry *); 984 struct inode *, struct dentry *);
995 int (*readlink) (struct dentry *, char __user *,int); 985 int (*readlink) (struct dentry *, char __user *,int);
996 int (*follow_link) (struct dentry *, struct nameidata *); 986 void * (*follow_link) (struct dentry *, struct nameidata *);
997 void (*put_link) (struct dentry *, struct nameidata *); 987 void (*put_link) (struct dentry *, struct nameidata *, void *);
998 void (*truncate) (struct inode *); 988 void (*truncate) (struct inode *);
999 int (*permission) (struct inode *, int, struct nameidata *); 989 int (*permission) (struct inode *, int, struct nameidata *);
1000 int (*setattr) (struct dentry *, struct iattr *); 990 int (*setattr) (struct dentry *, struct iattr *);
@@ -1291,6 +1281,7 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1291/* fs/open.c */ 1281/* fs/open.c */
1292 1282
1293extern int do_truncate(struct dentry *, loff_t start); 1283extern int do_truncate(struct dentry *, loff_t start);
1284extern long do_sys_open(const char __user *filename, int flags, int mode);
1294extern struct file *filp_open(const char *, int, int); 1285extern struct file *filp_open(const char *, int, int);
1295extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1286extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1296extern int filp_close(struct file *, fl_owner_t id); 1287extern int filp_close(struct file *, fl_owner_t id);
@@ -1602,8 +1593,8 @@ extern struct file_operations generic_ro_fops;
1602extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 1593extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
1603extern int vfs_follow_link(struct nameidata *, const char *); 1594extern int vfs_follow_link(struct nameidata *, const char *);
1604extern int page_readlink(struct dentry *, char __user *, int); 1595extern int page_readlink(struct dentry *, char __user *, int);
1605extern int page_follow_link_light(struct dentry *, struct nameidata *); 1596extern void *page_follow_link_light(struct dentry *, struct nameidata *);
1606extern void page_put_link(struct dentry *, struct nameidata *); 1597extern void page_put_link(struct dentry *, struct nameidata *, void *);
1607extern int page_symlink(struct inode *inode, const char *symname, int len); 1598extern int page_symlink(struct inode *inode, const char *symname, int len);
1608extern struct inode_operations page_symlink_inode_operations; 1599extern struct inode_operations page_symlink_inode_operations;
1609extern int generic_readlink(struct dentry *, char __user *, int); 1600extern int generic_readlink(struct dentry *, char __user *, int);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 602c305c8585..03b8e7932b83 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -21,7 +21,7 @@
21 */ 21 */
22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
23 const char *old_name, const char *new_name, 23 const char *old_name, const char *new_name,
24 int isdir, struct inode *target) 24 int isdir, struct inode *target, struct inode *source)
25{ 25{
26 u32 cookie = inotify_get_cookie(); 26 u32 cookie = inotify_get_cookie();
27 27
@@ -41,6 +41,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
41 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL); 41 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL);
42 inotify_inode_is_dead(target); 42 inotify_inode_is_dead(target);
43 } 43 }
44
45 if (source) {
46 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL);
47 }
44} 48}
45 49
46/* 50/*
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 65d6cfdb6d39..10f96c31971e 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -4,14 +4,40 @@
4/* Second argument to futex syscall */ 4/* Second argument to futex syscall */
5 5
6 6
7#define FUTEX_WAIT (0) 7#define FUTEX_WAIT 0
8#define FUTEX_WAKE (1) 8#define FUTEX_WAKE 1
9#define FUTEX_FD (2) 9#define FUTEX_FD 2
10#define FUTEX_REQUEUE (3) 10#define FUTEX_REQUEUE 3
11#define FUTEX_CMP_REQUEUE (4) 11#define FUTEX_CMP_REQUEUE 4
12#define FUTEX_WAKE_OP 5
12 13
13long do_futex(unsigned long uaddr, int op, int val, 14long do_futex(unsigned long uaddr, int op, int val,
14 unsigned long timeout, unsigned long uaddr2, int val2, 15 unsigned long timeout, unsigned long uaddr2, int val2,
15 int val3); 16 int val3);
16 17
18#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
19#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
20#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
21#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */
22#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */
23
24#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
25
26#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */
27#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */
28#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */
29#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */
30#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
31#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
32
33/* FUTEX_WAKE_OP will perform atomically
34 int oldval = *(int *)UADDR2;
35 *(int *)UADDR2 = oldval OP OPARG;
36 if (oldval CMP CMPARG)
37 wake UADDR2; */
38
39#define FUTEX_OP(op, oparg, cmp, cmparg) \
40 (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
41 | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
42
17#endif 43#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7c7400137e97..4dc990f3b5cc 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -40,6 +40,7 @@ struct vm_area_struct;
40#define __GFP_ZERO 0x8000u /* Return zeroed page on success */ 40#define __GFP_ZERO 0x8000u /* Return zeroed page on success */
41#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */ 41#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
42#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */ 42#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
43#define __GFP_HARDWALL 0x40000u /* Enforce hardwall cpuset memory allocs */
43 44
44#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 45#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
45#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) 46#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
@@ -48,14 +49,15 @@ struct vm_area_struct;
48#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 49#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
49 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 50 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
50 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 51 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
51 __GFP_NOMEMALLOC|__GFP_NORECLAIM) 52 __GFP_NOMEMALLOC|__GFP_NORECLAIM|__GFP_HARDWALL)
52 53
53#define GFP_ATOMIC (__GFP_HIGH) 54#define GFP_ATOMIC (__GFP_HIGH)
54#define GFP_NOIO (__GFP_WAIT) 55#define GFP_NOIO (__GFP_WAIT)
55#define GFP_NOFS (__GFP_WAIT | __GFP_IO) 56#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
56#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS) 57#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
57#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS) 58#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
58#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM) 59#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
60 __GFP_HIGHMEM)
59 61
60/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some 62/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
61 platforms, used as appropriate on others */ 63 platforms, used as appropriate on others */
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index 9debe6bbe5f0..bab303dafd6e 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -26,8 +26,12 @@
26#include <linux/if_hippi.h> 26#include <linux/if_hippi.h>
27 27
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29extern unsigned short hippi_type_trans(struct sk_buff *skb, 29
30 struct net_device *dev); 30struct hippi_cb {
31 __u32 ifield;
32};
33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
31 35
32extern struct net_device *alloc_hippi_dev(int sizeof_priv); 36extern struct net_device *alloc_hippi_dev(int sizeof_priv);
33#endif 37#endif
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index f529d1442815..e670b0d13fe0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -70,12 +70,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
70void hugetlb_prefault_arch_hook(struct mm_struct *mm); 70void hugetlb_prefault_arch_hook(struct mm_struct *mm);
71#endif 71#endif
72 72
73#ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
74#define hugetlb_clean_stale_pgtable(pte) BUG()
75#else
76void hugetlb_clean_stale_pgtable(pte_t *pte);
77#endif
78
79#else /* !CONFIG_HUGETLB_PAGE */ 73#else /* !CONFIG_HUGETLB_PAGE */
80 74
81static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 75static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index 1b5018a965f5..7eb4004b3601 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -33,4 +33,19 @@ struct sensor_device_attribute sensor_dev_attr_##_name = { \
33 .index = _index, \ 33 .index = _index, \
34} 34}
35 35
36struct sensor_device_attribute_2 {
37 struct device_attribute dev_attr;
38 u8 index;
39 u8 nr;
40};
41#define to_sensor_dev_attr_2(_dev_attr) \
42 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
43
44#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \
45struct sensor_device_attribute_2 sensor_dev_attr_##_name = { \
46 .dev_attr = __ATTR(_name,_mode,_show,_store), \
47 .index = _index, \
48 .nr = _nr, \
49}
50
36#endif /* _LINUX_HWMON_SYSFS_H */ 51#endif /* _LINUX_HWMON_SYSFS_H */
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
new file mode 100644
index 000000000000..cd4b7a042b86
--- /dev/null
+++ b/include/linux/hwmon-vid.h
@@ -0,0 +1,45 @@
1/*
2 hwmon-vid.h - VID/VRM/VRD voltage conversions
3
4 Originally part of lm_sensors
5 Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
6 With assistance from Trent Piepho <xyzzy@speakeasy.org>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (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 General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#ifndef _LINUX_HWMON_VID_H
24#define _LINUX_HWMON_VID_H
25
26int vid_from_reg(int val, int vrm);
27int vid_which_vrm(void);
28
29/* vrm is the VRM/VRD document version multiplied by 10.
30 val is in mV to avoid floating point in the kernel.
31 Returned value is the 4-, 5- or 6-bit VID code.
32 Note that only VRM 9.x is supported for now. */
33static inline int vid_to_reg(int val, int vrm)
34{
35 switch (vrm) {
36 case 91: /* VRM 9.1 */
37 case 90: /* VRM 9.0 */
38 return ((val >= 1100) && (val <= 1850) ?
39 ((18499 - val * 10) / 25 + 5) / 10 : -1);
40 default:
41 return -1;
42 }
43}
44
45#endif /* _LINUX_HWMON_VID_H */
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
new file mode 100644
index 000000000000..0efd994c37f1
--- /dev/null
+++ b/include/linux/hwmon.h
@@ -0,0 +1,35 @@
1/*
2 hwmon.h - part of lm_sensors, Linux kernel modules for hardware monitoring
3
4 This file declares helper functions for the sysfs class "hwmon",
5 for use by sensors drivers.
6
7 Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
12*/
13
14#ifndef _HWMON_H_
15#define _HWMON_H_
16
17#include <linux/device.h>
18
19struct class_device *hwmon_device_register(struct device *dev);
20
21void hwmon_device_unregister(struct class_device *cdev);
22
23/* Scale user input to sensible values */
24static inline int SENSORS_LIMIT(long value, long low, long high)
25{
26 if (value < low)
27 return low;
28 else if (value > high)
29 return high;
30 else
31 return value;
32}
33
34#endif
35
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 33f08258f22b..44f30876a1c9 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -1,6 +1,6 @@
1/* ------------------------------------------------------------------------- */ 1/* ------------------------------------------------------------------------- */
2/* */ 2/* */
3/* i2c.h - definitions for the i2c-bus interface */ 3/* i2c-id.h - identifier values for i2c drivers and adapters */
4/* */ 4/* */
5/* ------------------------------------------------------------------------- */ 5/* ------------------------------------------------------------------------- */
6/* Copyright (C) 1995-1999 Simon G. Vogl 6/* Copyright (C) 1995-1999 Simon G. Vogl
@@ -24,16 +24,6 @@
24#define LINUX_I2C_ID_H 24#define LINUX_I2C_ID_H
25 25
26/* 26/*
27 * This file is part of the i2c-bus package and contains the identifier
28 * values for drivers, adapters and other folk populating these serial
29 * worlds.
30 *
31 * These will change often (i.e. additions) , therefore this has been
32 * separated from the functional interface definitions of the i2c api.
33 *
34 */
35
36/*
37 * ---- Driver types ----------------------------------------------------- 27 * ---- Driver types -----------------------------------------------------
38 * device id name + number function description, i2c address(es) 28 * device id name + number function description, i2c address(es)
39 * 29 *
@@ -170,151 +160,113 @@
170 160
171/* 161/*
172 * ---- Adapter types ---------------------------------------------------- 162 * ---- Adapter types ----------------------------------------------------
173 *
174 * First, we distinguish between several algorithms to access the hardware
175 * interface types, as a PCF 8584 needs other care than a bit adapter.
176 */
177
178#define I2C_ALGO_NONE 0x000000
179#define I2C_ALGO_BIT 0x010000 /* bit style adapters */
180#define I2C_ALGO_PCF 0x020000 /* PCF 8584 style adapters */
181#define I2C_ALGO_ATI 0x030000 /* ATI video card */
182#define I2C_ALGO_SMBUS 0x040000
183#define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */
184#define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */
185#define I2C_ALGO_ACB 0x070000 /* ACCESS.bus algorithm */
186#define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */
187#define I2C_ALGO_SAA7134 0x090000
188#define I2C_ALGO_MPC824X 0x0a0000 /* Motorola 8240 / 8245 */
189#define I2C_ALGO_IPMI 0x0b0000 /* IPMI dummy adapter */
190#define I2C_ALGO_IPMB 0x0c0000 /* IPMB adapter */
191#define I2C_ALGO_MPC107 0x0d0000
192#define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */
193
194#define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */
195#define I2C_ALGO_OCP 0x120000 /* IBM or otherwise On-chip I2C algorithm */
196#define I2C_ALGO_BITHS 0x130000 /* enhanced bit style adapters */
197#define I2C_ALGO_IOP3XX 0x140000 /* XSCALE IOP3XX On-chip I2C alg */
198#define I2C_ALGO_SIBYTE 0x150000 /* Broadcom SiByte SOCs */
199#define I2C_ALGO_SGI 0x160000 /* SGI algorithm */
200
201#define I2C_ALGO_USB 0x170000 /* USB algorithm */
202#define I2C_ALGO_VIRT 0x180000 /* Virtual bus adapter */
203
204#define I2C_ALGO_MV64XXX 0x190000 /* Marvell mv64xxx i2c ctlr */
205#define I2C_ALGO_PCA 0x1a0000 /* PCA 9564 style adapters */
206#define I2C_ALGO_AU1550 0x1b0000 /* Au1550 PSC algorithm */
207
208#define I2C_ALGO_EXP 0x800000 /* experimental */
209
210#define I2C_ALGO_MASK 0xff0000 /* Mask for algorithms */
211#define I2C_ALGO_SHIFT 0x10 /* right shift to get index values */
212
213#define I2C_HW_ADAPS 0x10000 /* # adapter types */
214#define I2C_HW_MASK 0xffff
215
216
217/* hw specific modules that are defined per algorithm layer
218 */ 163 */
219 164
220/* --- Bit algorithm adapters */ 165/* --- Bit algorithm adapters */
221#define I2C_HW_B_LP 0x00 /* Parallel port Philips style adapter */ 166#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */
222#define I2C_HW_B_LPC 0x01 /* Parallel port, over control reg. */ 167#define I2C_HW_B_LPC 0x010001 /* Parallel port control reg. */
223#define I2C_HW_B_SER 0x02 /* Serial line interface */ 168#define I2C_HW_B_SER 0x010002 /* Serial line interface */
224#define I2C_HW_B_ELV 0x03 /* ELV Card */ 169#define I2C_HW_B_ELV 0x010003 /* ELV Card */
225#define I2C_HW_B_VELLE 0x04 /* Vellemann K8000 */ 170#define I2C_HW_B_VELLE 0x010004 /* Vellemann K8000 */
226#define I2C_HW_B_BT848 0x05 /* BT848 video boards */ 171#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
227#define I2C_HW_B_WNV 0x06 /* Winnov Videums */ 172#define I2C_HW_B_WNV 0x010006 /* Winnov Videums */
228#define I2C_HW_B_VIA 0x07 /* Via vt82c586b */ 173#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */
229#define I2C_HW_B_HYDRA 0x08 /* Apple Hydra Mac I/O */ 174#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */
230#define I2C_HW_B_G400 0x09 /* Matrox G400 */ 175#define I2C_HW_B_G400 0x010009 /* Matrox G400 */
231#define I2C_HW_B_I810 0x0a /* Intel I810 */ 176#define I2C_HW_B_I810 0x01000a /* Intel I810 */
232#define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */ 177#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */
233#define I2C_HW_B_PPORT 0x0c /* Primitive parallel port adapter */ 178#define I2C_HW_B_PPORT 0x01000c /* Primitive parallel port adapter */
234#define I2C_HW_B_SAVG 0x0d /* Savage 4 */ 179#define I2C_HW_B_SAVG 0x01000d /* Savage 4 */
235#define I2C_HW_B_SCX200 0x0e /* Nat'l Semi SCx200 I2C */ 180#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */
236#define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */ 181#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
237#define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */ 182#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
238#define I2C_HW_B_TSUNA 0x12 /* DEC Tsunami chipset */ 183#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
239#define I2C_HW_B_FRODO 0x13 /* 2d3D, Inc. SA-1110 Development Board */ 184#define I2C_HW_B_FRODO 0x010013 /* 2d3D SA-1110 Development Board */
240#define I2C_HW_B_OMAHA 0x14 /* Omaha I2C interface (ARM) */ 185#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
241#define I2C_HW_B_GUIDE 0x15 /* Guide bit-basher */ 186#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
242#define I2C_HW_B_IXP2000 0x16 /* GPIO on IXP2000 systems */ 187#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
243#define I2C_HW_B_IXP4XX 0x17 /* GPIO on IXP4XX systems */ 188#define I2C_HW_B_IXP4XX 0x010017 /* GPIO on IXP4XX systems */
244#define I2C_HW_B_S3VIA 0x18 /* S3Via ProSavage adapter */ 189#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */
245#define I2C_HW_B_ZR36067 0x19 /* Zoran-36057/36067 based boards */ 190#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
246#define I2C_HW_B_PCILYNX 0x1a /* TI PCILynx I2C adapter */ 191#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */
247#define I2C_HW_B_CX2388x 0x1b /* connexant 2388x based tv cards */ 192#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
193#define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */
194#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */
195#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */
248 196
249/* --- PCF 8584 based algorithms */ 197/* --- PCF 8584 based algorithms */
250#define I2C_HW_P_LP 0x00 /* Parallel port interface */ 198#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
251#define I2C_HW_P_ISA 0x01 /* generic ISA Bus inteface card */ 199#define I2C_HW_P_ISA 0x020001 /* generic ISA Bus inteface card */
252#define I2C_HW_P_ELEK 0x02 /* Elektor ISA Bus inteface card */ 200#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */
253 201
254/* --- PCA 9564 based algorithms */ 202/* --- PCA 9564 based algorithms */
255#define I2C_HW_A_ISA 0x00 /* generic ISA Bus interface card */ 203#define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */
256 204
257/* --- ACPI Embedded controller algorithms */ 205/* --- ACPI Embedded controller algorithms */
258#define I2C_HW_ACPI_EC 0x00 206#define I2C_HW_ACPI_EC 0x1f0000
259 207
260/* --- MPC824x PowerPC adapters */ 208/* --- MPC824x PowerPC adapters */
261#define I2C_HW_MPC824X 0x00 /* Motorola 8240 / 8245 */ 209#define I2C_HW_MPC824X 0x100001 /* Motorola 8240 / 8245 */
262 210
263/* --- MPC8xx PowerPC adapters */ 211/* --- MPC8xx PowerPC adapters */
264#define I2C_HW_MPC8XX_EPON 0x00 /* Eponymous MPC8xx I2C adapter */ 212#define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */
265 213
266/* --- ITE based algorithms */ 214/* --- ITE based algorithms */
267#define I2C_HW_I_IIC 0x00 /* controller on the ITE */ 215#define I2C_HW_I_IIC 0x080000 /* controller on the ITE */
268 216
269/* --- PowerPC on-chip adapters */ 217/* --- PowerPC on-chip adapters */
270#define I2C_HW_OCP 0x00 /* IBM on-chip I2C adapter */ 218#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */
271 219
272/* --- Broadcom SiByte adapters */ 220/* --- Broadcom SiByte adapters */
273#define I2C_HW_SIBYTE 0x00 221#define I2C_HW_SIBYTE 0x150000
274 222
275/* --- SGI adapters */ 223/* --- SGI adapters */
276#define I2C_HW_SGI_VINO 0x00 224#define I2C_HW_SGI_VINO 0x160000
277#define I2C_HW_SGI_MACE 0x01 225#define I2C_HW_SGI_MACE 0x160001
278 226
279/* --- XSCALE on-chip adapters */ 227/* --- XSCALE on-chip adapters */
280#define I2C_HW_IOP3XX 0x00 228#define I2C_HW_IOP3XX 0x140000
281 229
282/* --- Au1550 PSC adapters adapters */ 230/* --- Au1550 PSC adapters adapters */
283#define I2C_HW_AU1550_PSC 0x00 231#define I2C_HW_AU1550_PSC 0x1b0000
284 232
285/* --- SMBus only adapters */ 233/* --- SMBus only adapters */
286#define I2C_HW_SMBUS_PIIX4 0x00 234#define I2C_HW_SMBUS_PIIX4 0x040000
287#define I2C_HW_SMBUS_ALI15X3 0x01 235#define I2C_HW_SMBUS_ALI15X3 0x040001
288#define I2C_HW_SMBUS_VIA2 0x02 236#define I2C_HW_SMBUS_VIA2 0x040002
289#define I2C_HW_SMBUS_VOODOO3 0x03 237#define I2C_HW_SMBUS_VOODOO3 0x040003
290#define I2C_HW_SMBUS_I801 0x04 238#define I2C_HW_SMBUS_I801 0x040004
291#define I2C_HW_SMBUS_AMD756 0x05 239#define I2C_HW_SMBUS_AMD756 0x040005
292#define I2C_HW_SMBUS_SIS5595 0x06 240#define I2C_HW_SMBUS_SIS5595 0x040006
293#define I2C_HW_SMBUS_ALI1535 0x07 241#define I2C_HW_SMBUS_ALI1535 0x040007
294#define I2C_HW_SMBUS_SIS630 0x08 242#define I2C_HW_SMBUS_SIS630 0x040008
295#define I2C_HW_SMBUS_SIS96X 0x09 243#define I2C_HW_SMBUS_SIS96X 0x040009
296#define I2C_HW_SMBUS_AMD8111 0x0a 244#define I2C_HW_SMBUS_AMD8111 0x04000a
297#define I2C_HW_SMBUS_SCX200 0x0b 245#define I2C_HW_SMBUS_SCX200 0x04000b
298#define I2C_HW_SMBUS_NFORCE2 0x0c 246#define I2C_HW_SMBUS_NFORCE2 0x04000c
299#define I2C_HW_SMBUS_W9968CF 0x0d 247#define I2C_HW_SMBUS_W9968CF 0x04000d
300#define I2C_HW_SMBUS_OV511 0x0e /* OV511(+) USB 1.1 webcam ICs */ 248#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
301#define I2C_HW_SMBUS_OV518 0x0f /* OV518(+) USB 1.1 webcam ICs */ 249#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
302#define I2C_HW_SMBUS_OV519 0x10 /* OV519 USB 1.1 webcam IC */ 250#define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */
303#define I2C_HW_SMBUS_OVFX2 0x11 /* Cypress/OmniVision FX2 webcam */ 251#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */
304 252
305/* --- ISA pseudo-adapter */ 253/* --- ISA pseudo-adapter */
306#define I2C_HW_ISA 0x00 254#define I2C_HW_ISA 0x050000
307 255
308/* --- IPMI pseudo-adapter */ 256/* --- IPMI pseudo-adapter */
309#define I2C_HW_IPMI 0x00 257#define I2C_HW_IPMI 0x0b0000
310 258
311/* --- IPMB adapter */ 259/* --- IPMB adapter */
312#define I2C_HW_IPMB 0x00 260#define I2C_HW_IPMB 0x0c0000
313 261
314/* --- MCP107 adapter */ 262/* --- MCP107 adapter */
315#define I2C_HW_MPC107 0x00 263#define I2C_HW_MPC107 0x0d0000
316 264
317/* --- Marvell mv64xxx i2c adapter */ 265/* --- Marvell mv64xxx i2c adapter */
318#define I2C_HW_MV64XXX 0x00 266#define I2C_HW_MV64XXX 0x190000
267
268/* --- Miscellaneous adapters */
269#define I2C_HW_SAA7146 0x060000 /* SAA7146 video decoder bus */
270#define I2C_HW_SAA7134 0x090000 /* SAA7134 video decoder bus */
319 271
320#endif /* LINUX_I2C_ID_H */ 272#endif /* LINUX_I2C_ID_H */
diff --git a/include/linux/i2c-isa.h b/include/linux/i2c-isa.h
new file mode 100644
index 000000000000..67e3598c4cec
--- /dev/null
+++ b/include/linux/i2c-isa.h
@@ -0,0 +1,36 @@
1/*
2 * i2c-isa.h - definitions for the i2c-isa pseudo-i2c-adapter interface
3 *
4 * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _LINUX_I2C_ISA_H
22#define _LINUX_I2C_ISA_H
23
24#include <linux/i2c.h>
25
26extern int i2c_isa_add_driver(struct i2c_driver *driver);
27extern int i2c_isa_del_driver(struct i2c_driver *driver);
28
29/* Detect whether we are on the isa bus. This is only useful to hybrid
30 (i2c+isa) drivers. */
31#define i2c_is_isa_adapter(adapptr) \
32 ((adapptr)->id == I2C_HW_ISA)
33#define i2c_is_isa_client(clientptr) \
34 i2c_is_isa_adapter((clientptr)->adapter)
35
36#endif /* _LINUX_I2C_ISA_H */
diff --git a/include/linux/i2c-sensor.h b/include/linux/i2c-sensor.h
deleted file mode 100644
index 21b625204956..000000000000
--- a/include/linux/i2c-sensor.h
+++ /dev/null
@@ -1,263 +0,0 @@
1/*
2 i2c-sensor.h - Part of the i2c package
3 was originally sensors.h - Part of lm_sensors, Linux kernel modules
4 for hardware monitoring
5 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef _LINUX_I2C_SENSOR_H
23#define _LINUX_I2C_SENSOR_H
24
25/* A structure containing detect information.
26 Force variables overrule all other variables; they force a detection on
27 that place. If a specific chip is given, the module blindly assumes this
28 chip type is present; if a general force (kind == 0) is given, the module
29 will still try to figure out what type of chip is present. This is useful
30 if for some reasons the detect for SMBus or ISA address space filled
31 fails.
32 probe: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values.
33 A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for
34 the ISA bus, -1 for any I2C bus), the second is the address.
35 kind: The kind of chip. 0 equals any chip.
36*/
37struct i2c_force_data {
38 unsigned short *force;
39 unsigned short kind;
40};
41
42/* A structure containing the detect information.
43 normal_i2c: filled in by the module writer. Terminated by I2C_CLIENT_ISA_END.
44 A list of I2C addresses which should normally be examined.
45 normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END.
46 A list of ISA addresses which should normally be examined.
47 probe: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values.
48 A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for
49 the ISA bus, -1 for any I2C bus), the second is the address. These
50 addresses are also probed, as if they were in the 'normal' list.
51 ignore: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values.
52 A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for
53 the ISA bus, -1 for any I2C bus), the second is the I2C address. These
54 addresses are never probed. This parameter overrules 'normal' and
55 'probe', but not the 'force' lists.
56 force_data: insmod parameters. A list, ending with an element of which
57 the force field is NULL.
58*/
59struct i2c_address_data {
60 unsigned short *normal_i2c;
61 unsigned int *normal_isa;
62 unsigned short *probe;
63 unsigned short *ignore;
64 struct i2c_force_data *forces;
65};
66
67#define SENSORS_MODULE_PARM_FORCE(name) \
68 I2C_CLIENT_MODULE_PARM(force_ ## name, \
69 "List of adapter,address pairs which are unquestionably" \
70 " assumed to contain a `" # name "' chip")
71
72
73/* This defines several insmod variables, and the addr_data structure */
74#define SENSORS_INSMOD \
75 I2C_CLIENT_MODULE_PARM(probe, \
76 "List of adapter,address pairs to scan additionally"); \
77 I2C_CLIENT_MODULE_PARM(ignore, \
78 "List of adapter,address pairs not to scan"); \
79 static struct i2c_address_data addr_data = { \
80 .normal_i2c = normal_i2c, \
81 .normal_isa = normal_isa, \
82 .probe = probe, \
83 .ignore = ignore, \
84 .forces = forces, \
85 }
86
87/* The following functions create an enum with the chip names as elements.
88 The first element of the enum is any_chip. These are the only macros
89 a module will want to use. */
90
91#define SENSORS_INSMOD_0 \
92 enum chips { any_chip }; \
93 I2C_CLIENT_MODULE_PARM(force, \
94 "List of adapter,address pairs to boldly assume " \
95 "to be present"); \
96 static struct i2c_force_data forces[] = {{force,any_chip},{NULL}}; \
97 SENSORS_INSMOD
98
99#define SENSORS_INSMOD_1(chip1) \
100 enum chips { any_chip, chip1 }; \
101 I2C_CLIENT_MODULE_PARM(force, \
102 "List of adapter,address pairs to boldly assume " \
103 "to be present"); \
104 SENSORS_MODULE_PARM_FORCE(chip1); \
105 static struct i2c_force_data forces[] = {{force,any_chip},\
106 {force_ ## chip1,chip1}, \
107 {NULL}}; \
108 SENSORS_INSMOD
109
110#define SENSORS_INSMOD_2(chip1,chip2) \
111 enum chips { any_chip, chip1, chip2 }; \
112 I2C_CLIENT_MODULE_PARM(force, \
113 "List of adapter,address pairs to boldly assume " \
114 "to be present"); \
115 SENSORS_MODULE_PARM_FORCE(chip1); \
116 SENSORS_MODULE_PARM_FORCE(chip2); \
117 static struct i2c_force_data forces[] = {{force,any_chip}, \
118 {force_ ## chip1,chip1}, \
119 {force_ ## chip2,chip2}, \
120 {NULL}}; \
121 SENSORS_INSMOD
122
123#define SENSORS_INSMOD_3(chip1,chip2,chip3) \
124 enum chips { any_chip, chip1, chip2, chip3 }; \
125 I2C_CLIENT_MODULE_PARM(force, \
126 "List of adapter,address pairs to boldly assume " \
127 "to be present"); \
128 SENSORS_MODULE_PARM_FORCE(chip1); \
129 SENSORS_MODULE_PARM_FORCE(chip2); \
130 SENSORS_MODULE_PARM_FORCE(chip3); \
131 static struct i2c_force_data forces[] = {{force,any_chip}, \
132 {force_ ## chip1,chip1}, \
133 {force_ ## chip2,chip2}, \
134 {force_ ## chip3,chip3}, \
135 {NULL}}; \
136 SENSORS_INSMOD
137
138#define SENSORS_INSMOD_4(chip1,chip2,chip3,chip4) \
139 enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
140 I2C_CLIENT_MODULE_PARM(force, \
141 "List of adapter,address pairs to boldly assume " \
142 "to be present"); \
143 SENSORS_MODULE_PARM_FORCE(chip1); \
144 SENSORS_MODULE_PARM_FORCE(chip2); \
145 SENSORS_MODULE_PARM_FORCE(chip3); \
146 SENSORS_MODULE_PARM_FORCE(chip4); \
147 static struct i2c_force_data forces[] = {{force,any_chip}, \
148 {force_ ## chip1,chip1}, \
149 {force_ ## chip2,chip2}, \
150 {force_ ## chip3,chip3}, \
151 {force_ ## chip4,chip4}, \
152 {NULL}}; \
153 SENSORS_INSMOD
154
155#define SENSORS_INSMOD_5(chip1,chip2,chip3,chip4,chip5) \
156 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
157 I2C_CLIENT_MODULE_PARM(force, \
158 "List of adapter,address pairs to boldly assume " \
159 "to be present"); \
160 SENSORS_MODULE_PARM_FORCE(chip1); \
161 SENSORS_MODULE_PARM_FORCE(chip2); \
162 SENSORS_MODULE_PARM_FORCE(chip3); \
163 SENSORS_MODULE_PARM_FORCE(chip4); \
164 SENSORS_MODULE_PARM_FORCE(chip5); \
165 static struct i2c_force_data forces[] = {{force,any_chip}, \
166 {force_ ## chip1,chip1}, \
167 {force_ ## chip2,chip2}, \
168 {force_ ## chip3,chip3}, \
169 {force_ ## chip4,chip4}, \
170 {force_ ## chip5,chip5}, \
171 {NULL}}; \
172 SENSORS_INSMOD
173
174#define SENSORS_INSMOD_6(chip1,chip2,chip3,chip4,chip5,chip6) \
175 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
176 I2C_CLIENT_MODULE_PARM(force, \
177 "List of adapter,address pairs to boldly assume " \
178 "to be present"); \
179 SENSORS_MODULE_PARM_FORCE(chip1); \
180 SENSORS_MODULE_PARM_FORCE(chip2); \
181 SENSORS_MODULE_PARM_FORCE(chip3); \
182 SENSORS_MODULE_PARM_FORCE(chip4); \
183 SENSORS_MODULE_PARM_FORCE(chip5); \
184 SENSORS_MODULE_PARM_FORCE(chip6); \
185 static struct i2c_force_data forces[] = {{force,any_chip}, \
186 {force_ ## chip1,chip1}, \
187 {force_ ## chip2,chip2}, \
188 {force_ ## chip3,chip3}, \
189 {force_ ## chip4,chip4}, \
190 {force_ ## chip5,chip5}, \
191 {force_ ## chip6,chip6}, \
192 {NULL}}; \
193 SENSORS_INSMOD
194
195#define SENSORS_INSMOD_7(chip1,chip2,chip3,chip4,chip5,chip6,chip7) \
196 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7 }; \
197 I2C_CLIENT_MODULE_PARM(force, \
198 "List of adapter,address pairs to boldly assume " \
199 "to be present"); \
200 SENSORS_MODULE_PARM_FORCE(chip1); \
201 SENSORS_MODULE_PARM_FORCE(chip2); \
202 SENSORS_MODULE_PARM_FORCE(chip3); \
203 SENSORS_MODULE_PARM_FORCE(chip4); \
204 SENSORS_MODULE_PARM_FORCE(chip5); \
205 SENSORS_MODULE_PARM_FORCE(chip6); \
206 SENSORS_MODULE_PARM_FORCE(chip7); \
207 static struct i2c_force_data forces[] = {{force,any_chip}, \
208 {force_ ## chip1,chip1}, \
209 {force_ ## chip2,chip2}, \
210 {force_ ## chip3,chip3}, \
211 {force_ ## chip4,chip4}, \
212 {force_ ## chip5,chip5}, \
213 {force_ ## chip6,chip6}, \
214 {force_ ## chip7,chip7}, \
215 {NULL}}; \
216 SENSORS_INSMOD
217
218#define SENSORS_INSMOD_8(chip1,chip2,chip3,chip4,chip5,chip6,chip7,chip8) \
219 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8 }; \
220 I2C_CLIENT_MODULE_PARM(force, \
221 "List of adapter,address pairs to boldly assume " \
222 "to be present"); \
223 SENSORS_MODULE_PARM_FORCE(chip1); \
224 SENSORS_MODULE_PARM_FORCE(chip2); \
225 SENSORS_MODULE_PARM_FORCE(chip3); \
226 SENSORS_MODULE_PARM_FORCE(chip4); \
227 SENSORS_MODULE_PARM_FORCE(chip5); \
228 SENSORS_MODULE_PARM_FORCE(chip6); \
229 SENSORS_MODULE_PARM_FORCE(chip7); \
230 SENSORS_MODULE_PARM_FORCE(chip8); \
231 static struct i2c_force_data forces[] = {{force,any_chip}, \
232 {force_ ## chip1,chip1}, \
233 {force_ ## chip2,chip2}, \
234 {force_ ## chip3,chip3}, \
235 {force_ ## chip4,chip4}, \
236 {force_ ## chip5,chip5}, \
237 {force_ ## chip6,chip6}, \
238 {force_ ## chip7,chip7}, \
239 {force_ ## chip8,chip8}, \
240 {NULL}}; \
241 SENSORS_INSMOD
242
243/* Detect function. It iterates over all possible addresses itself. For
244 SMBus addresses, it will only call found_proc if some client is connected
245 to the SMBus (unless a 'force' matched); for ISA detections, this is not
246 done. */
247extern int i2c_detect(struct i2c_adapter *adapter,
248 struct i2c_address_data *address_data,
249 int (*found_proc) (struct i2c_adapter *, int, int));
250
251
252/* This macro is used to scale user-input to sensible values in almost all
253 chip drivers. */
254static inline int SENSORS_LIMIT(long value, long low, long high)
255{
256 if (value < low)
257 return low;
258 else if (value > high)
259 return high;
260 else
261 return value;
262}
263#endif /* def _LINUX_I2C_SENSOR_H */
diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h
deleted file mode 100644
index 41d0635e0ba9..000000000000
--- a/include/linux/i2c-vid.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 i2c-vid.h - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring
4 Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
5 With assistance from Trent Piepho <xyzzy@speakeasy.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22/*
23 This file contains common code for decoding VID pins.
24 This file is #included in various chip drivers in this directory.
25 As the user is unlikely to load more than one driver which
26 includes this code we don't worry about the wasted space.
27 Reference: VRM x.y DC-DC Converter Design Guidelines,
28 available at http://developer.intel.com
29*/
30
31/*
32 AMD Opteron processors don't follow the Intel VRM spec.
33 I'm going to "make up" 2.4 as the VRM spec for the Opterons.
34 No good reason just a mnemonic for the 24x Opteron processor
35 series
36
37 Opteron VID encoding is:
38
39 00000 = 1.550 V
40 00001 = 1.525 V
41 . . . .
42 11110 = 0.800 V
43 11111 = 0.000 V (off)
44 */
45
46/*
47 Legal val values 0x00 - 0x1f; except for VRD 10.0, 0x00 - 0x3f.
48 vrm is the Intel VRM document version.
49 Note: vrm version is scaled by 10 and the return value is scaled by 1000
50 to avoid floating point in the kernel.
51*/
52
53int i2c_which_vrm(void);
54
55#define DEFAULT_VRM 82
56
57static inline int vid_from_reg(int val, int vrm)
58{
59 int vid;
60
61 switch(vrm) {
62
63 case 0:
64 return 0;
65
66 case 100: /* VRD 10.0 */
67 if((val & 0x1f) == 0x1f)
68 return 0;
69 if((val & 0x1f) <= 0x09 || val == 0x0a)
70 vid = 10875 - (val & 0x1f) * 250;
71 else
72 vid = 18625 - (val & 0x1f) * 250;
73 if(val & 0x20)
74 vid -= 125;
75 vid /= 10; /* only return 3 dec. places for now */
76 return vid;
77
78 case 24: /* Opteron processor */
79 return(val == 0x1f ? 0 : 1550 - val * 25);
80
81 case 91: /* VRM 9.1 */
82 case 90: /* VRM 9.0 */
83 return(val == 0x1f ? 0 :
84 1850 - val * 25);
85
86 case 85: /* VRM 8.5 */
87 return((val & 0x10 ? 25 : 0) +
88 ((val & 0x0f) > 0x04 ? 2050 : 1250) -
89 ((val & 0x0f) * 50));
90
91 case 84: /* VRM 8.4 */
92 val &= 0x0f;
93 /* fall through */
94 default: /* VRM 8.2 */
95 return(val == 0x1f ? 0 :
96 val & 0x10 ? 5100 - (val) * 100 :
97 2050 - (val) * 50);
98 }
99}
100
101static inline int vid_to_reg(int val, int vrm)
102{
103 switch (vrm) {
104 case 91: /* VRM 9.1 */
105 case 90: /* VRM 9.0 */
106 return ((val >= 1100) && (val <= 1850) ?
107 ((18499 - val * 10) / 25 + 5) / 10 : -1);
108 default:
109 return -1;
110 }
111}
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index be837b13f297..be35332b67e6 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -34,6 +34,13 @@
34#include <linux/device.h> /* for struct device */ 34#include <linux/device.h> /* for struct device */
35#include <asm/semaphore.h> 35#include <asm/semaphore.h>
36 36
37/* --- For i2c-isa ---------------------------------------------------- */
38
39extern void i2c_adapter_dev_release(struct device *dev);
40extern struct device_driver i2c_adapter_driver;
41extern struct class i2c_adapter_class;
42extern struct bus_type i2c_bus_type;
43
37/* --- General options ------------------------------------------------ */ 44/* --- General options ------------------------------------------------ */
38 45
39struct i2c_msg; 46struct i2c_msg;
@@ -41,7 +48,6 @@ struct i2c_algorithm;
41struct i2c_adapter; 48struct i2c_adapter;
42struct i2c_client; 49struct i2c_client;
43struct i2c_driver; 50struct i2c_driver;
44struct i2c_client_address_data;
45union i2c_smbus_data; 51union i2c_smbus_data;
46 52
47/* 53/*
@@ -143,12 +149,9 @@ struct i2c_driver {
143 */ 149 */
144struct i2c_client { 150struct i2c_client {
145 unsigned int flags; /* div., see below */ 151 unsigned int flags; /* div., see below */
146 unsigned int addr; /* chip address - NOTE: 7bit */ 152 unsigned short addr; /* chip address - NOTE: 7bit */
147 /* addresses are stored in the */ 153 /* addresses are stored in the */
148 /* _LOWER_ 7 bits of this char */ 154 /* _LOWER_ 7 bits */
149 /* addr: unsigned int to make lm_sensors i2c-isa adapter work
150 more cleanly. It does not take any more memory space, due to
151 alignment considerations */
152 struct i2c_adapter *adapter; /* the adapter we sit on */ 155 struct i2c_adapter *adapter; /* the adapter we sit on */
153 struct i2c_driver *driver; /* and our access routines */ 156 struct i2c_driver *driver; /* and our access routines */
154 int usage_count; /* How many accesses currently */ 157 int usage_count; /* How many accesses currently */
@@ -160,6 +163,11 @@ struct i2c_client {
160}; 163};
161#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 164#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
162 165
166static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
167{
168 return to_i2c_client(container_of(kobj, struct device, kobj));
169}
170
163static inline void *i2c_get_clientdata (struct i2c_client *dev) 171static inline void *i2c_get_clientdata (struct i2c_client *dev)
164{ 172{
165 return dev_get_drvdata (&dev->dev); 173 return dev_get_drvdata (&dev->dev);
@@ -170,13 +178,6 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
170 dev_set_drvdata (&dev->dev, data); 178 dev_set_drvdata (&dev->dev, data);
171} 179}
172 180
173#define I2C_DEVNAME(str) .name = str
174
175static inline char *i2c_clientname(struct i2c_client *c)
176{
177 return &c->name[0];
178}
179
180/* 181/*
181 * The following structs are for those who like to implement new bus drivers: 182 * The following structs are for those who like to implement new bus drivers:
182 * i2c_algorithm is the interface to a class of hardware solutions which can 183 * i2c_algorithm is the interface to a class of hardware solutions which can
@@ -184,9 +185,6 @@ static inline char *i2c_clientname(struct i2c_client *c)
184 * to name two of the most common. 185 * to name two of the most common.
185 */ 186 */
186struct i2c_algorithm { 187struct i2c_algorithm {
187 char name[32]; /* textual description */
188 unsigned int id;
189
190 /* If an adapter algorithm can't do I2C-level access, set master_xfer 188 /* If an adapter algorithm can't do I2C-level access, set master_xfer
191 to NULL. If an adapter algorithm can do SMBus access, set 189 to NULL. If an adapter algorithm can do SMBus access, set
192 smbus_xfer. If set to NULL, the SMBus protocol is simulated 190 smbus_xfer. If set to NULL, the SMBus protocol is simulated
@@ -214,8 +212,7 @@ struct i2c_algorithm {
214 */ 212 */
215struct i2c_adapter { 213struct i2c_adapter {
216 struct module *owner; 214 struct module *owner;
217 unsigned int id;/* == is algo->id | hwdep.struct->id, */ 215 unsigned int id;
218 /* for registered values see below */
219 unsigned int class; 216 unsigned int class;
220 struct i2c_algorithm *algo;/* the algorithm to access the bus */ 217 struct i2c_algorithm *algo;/* the algorithm to access the bus */
221 void *algo_data; 218 void *algo_data;
@@ -292,12 +289,11 @@ struct i2c_client_address_data {
292 unsigned short *normal_i2c; 289 unsigned short *normal_i2c;
293 unsigned short *probe; 290 unsigned short *probe;
294 unsigned short *ignore; 291 unsigned short *ignore;
295 unsigned short *force; 292 unsigned short **forces;
296}; 293};
297 294
298/* Internal numbers to terminate lists */ 295/* Internal numbers to terminate lists */
299#define I2C_CLIENT_END 0xfffeU 296#define I2C_CLIENT_END 0xfffeU
300#define I2C_CLIENT_ISA_END 0xfffefffeU
301 297
302/* The numbers to use to set I2C bus address */ 298/* The numbers to use to set I2C bus address */
303#define ANY_I2C_BUS 0xffff 299#define ANY_I2C_BUS 0xffff
@@ -356,10 +352,6 @@ extern int i2c_probe(struct i2c_adapter *adapter,
356 */ 352 */
357extern int i2c_control(struct i2c_client *,unsigned int, unsigned long); 353extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
358 354
359/* This call returns a unique low identifier for each registered adapter,
360 * or -1 if the adapter was not registered.
361 */
362extern int i2c_adapter_id(struct i2c_adapter *adap);
363extern struct i2c_adapter* i2c_get_adapter(int id); 355extern struct i2c_adapter* i2c_get_adapter(int id);
364extern void i2c_put_adapter(struct i2c_adapter *adap); 356extern void i2c_put_adapter(struct i2c_adapter *adap);
365 357
@@ -376,6 +368,12 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
376 return (func & i2c_get_functionality(adap)) == func; 368 return (func & i2c_get_functionality(adap)) == func;
377} 369}
378 370
371/* Return id number for a specific adapter */
372static inline int i2c_adapter_id(struct i2c_adapter *adap)
373{
374 return adap->nr;
375}
376
379/* 377/*
380 * I2C Message - used for pure i2c transaction, also from /dev interface 378 * I2C Message - used for pure i2c transaction, also from /dev interface
381 */ 379 */
@@ -510,9 +508,6 @@ union i2c_smbus_data {
510#define I2C_FUNCS 0x0705 /* Get the adapter functionality */ 508#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
511#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/ 509#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
512#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */ 510#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */
513#if 0
514#define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific address */
515#endif
516 511
517#define I2C_SMBUS 0x0720 /* SMBus-level access */ 512#define I2C_SMBUS 0x0720 /* SMBus-level access */
518 513
@@ -556,27 +551,148 @@ union i2c_smbus_data {
556 module_param_array(var, short, &var##_num, 0); \ 551 module_param_array(var, short, &var##_num, 0); \
557 MODULE_PARM_DESC(var,desc) 552 MODULE_PARM_DESC(var,desc)
558 553
559/* This is the one you want to use in your own modules */ 554#define I2C_CLIENT_MODULE_PARM_FORCE(name) \
555I2C_CLIENT_MODULE_PARM(force_##name, \
556 "List of adapter,address pairs which are " \
557 "unquestionably assumed to contain a `" \
558 # name "' chip")
559
560
561#define I2C_CLIENT_INSMOD_COMMON \
562I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
563 "additionally"); \
564I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
565 "scan"); \
566static struct i2c_client_address_data addr_data = { \
567 .normal_i2c = normal_i2c, \
568 .probe = probe, \
569 .ignore = ignore, \
570 .forces = forces, \
571}
572
573/* These are the ones you want to use in your own drivers. Pick the one
574 which matches the number of devices the driver differenciates between. */
560#define I2C_CLIENT_INSMOD \ 575#define I2C_CLIENT_INSMOD \
561 I2C_CLIENT_MODULE_PARM(probe, \
562 "List of adapter,address pairs to scan additionally"); \
563 I2C_CLIENT_MODULE_PARM(ignore, \
564 "List of adapter,address pairs not to scan"); \
565 I2C_CLIENT_MODULE_PARM(force, \ 576 I2C_CLIENT_MODULE_PARM(force, \
566 "List of adapter,address pairs to boldly assume " \ 577 "List of adapter,address pairs to boldly assume " \
567 "to be present"); \ 578 "to be present"); \
568 static struct i2c_client_address_data addr_data = { \ 579 static unsigned short *forces[] = { \
569 .normal_i2c = normal_i2c, \ 580 force, \
570 .probe = probe, \ 581 NULL \
571 .ignore = ignore, \ 582 }; \
572 .force = force, \ 583I2C_CLIENT_INSMOD_COMMON
573 } 584
574 585#define I2C_CLIENT_INSMOD_1(chip1) \
575/* Detect whether we are on the isa bus. If this returns true, all i2c 586enum chips { any_chip, chip1 }; \
576 access will fail! */ 587I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
577#define i2c_is_isa_client(clientptr) \ 588 "boldly assume to be present"); \
578 ((clientptr)->adapter->algo->id == I2C_ALGO_ISA) 589I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
579#define i2c_is_isa_adapter(adapptr) \ 590static unsigned short *forces[] = { force, force_##chip1, NULL }; \
580 ((adapptr)->algo->id == I2C_ALGO_ISA) 591I2C_CLIENT_INSMOD_COMMON
592
593#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
594enum chips { any_chip, chip1, chip2 }; \
595I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
596 "boldly assume to be present"); \
597I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
598I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
599static unsigned short *forces[] = { force, force_##chip1, \
600 force_##chip2, NULL }; \
601I2C_CLIENT_INSMOD_COMMON
602
603#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
604enum chips { any_chip, chip1, chip2, chip3 }; \
605I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
606 "boldly assume to be present"); \
607I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
608I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
609I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
610static unsigned short *forces[] = { force, force_##chip1, \
611 force_##chip2, force_##chip3, \
612 NULL }; \
613I2C_CLIENT_INSMOD_COMMON
614
615#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
616enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
617I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
618 "boldly assume to be present"); \
619I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
620I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
621I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
622I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
623static unsigned short *forces[] = { force, force_##chip1, \
624 force_##chip2, force_##chip3, \
625 force_##chip4, NULL}; \
626I2C_CLIENT_INSMOD_COMMON
627
628#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
629enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
630I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
631 "boldly assume to be present"); \
632I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
633I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
634I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
635I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
636I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
637static unsigned short *forces[] = { force, force_##chip1, \
638 force_##chip2, force_##chip3, \
639 force_##chip4, force_##chip5, \
640 NULL }; \
641I2C_CLIENT_INSMOD_COMMON
642
643#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
644enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
645I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
646 "boldly assume to be present"); \
647I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
648I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
649I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
650I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
651I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
652I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
653static unsigned short *forces[] = { force, force_##chip1, \
654 force_##chip2, force_##chip3, \
655 force_##chip4, force_##chip5, \
656 force_##chip6, NULL }; \
657I2C_CLIENT_INSMOD_COMMON
658
659#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
660enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
661 chip7 }; \
662I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
663 "boldly assume to be present"); \
664I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
665I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
666I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
667I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
668I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
669I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
670I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
671static unsigned short *forces[] = { force, force_##chip1, \
672 force_##chip2, force_##chip3, \
673 force_##chip4, force_##chip5, \
674 force_##chip6, force_##chip7, \
675 NULL }; \
676I2C_CLIENT_INSMOD_COMMON
677
678#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
679enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
680 chip7, chip8 }; \
681I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
682 "boldly assume to be present"); \
683I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
684I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
685I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
686I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
687I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
688I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
689I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
690I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
691static unsigned short *forces[] = { force, force_##chip1, \
692 force_##chip2, force_##chip3, \
693 force_##chip4, force_##chip5, \
694 force_##chip6, force_##chip7, \
695 force_##chip8, NULL }; \
696I2C_CLIENT_INSMOD_COMMON
581 697
582#endif /* _LINUX_I2C_H */ 698#endif /* _LINUX_I2C_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 92129078d4f3..a6dbb51ecd7b 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1501,4 +1501,10 @@ extern struct bus_type ide_bus_type;
1501#define ide_id_has_flush_cache_ext(id) \ 1501#define ide_id_has_flush_cache_ext(id) \
1502 (((id)->cfs_enable_2 & 0x2400) == 0x2400) 1502 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1503 1503
1504static inline int hwif_to_node(ide_hwif_t *hwif)
1505{
1506 struct pci_dev *dev = hwif->pci_dev;
1507 return dev ? pcibus_to_node(dev->bus) : -1;
1508}
1509
1504#endif /* _IDE_H */ 1510#endif /* _IDE_H */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index b5b58e9c054c..fc2d4c8225aa 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -110,6 +110,8 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
110{ 110{
111 return (struct ethhdr *)skb->mac.raw; 111 return (struct ethhdr *)skb->mac.raw;
112} 112}
113
114extern struct ctl_table ether_table[];
113#endif 115#endif
114 116
115#endif /* _LINUX_IF_ETHER_H */ 117#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_fc.h b/include/linux/if_fc.h
index 33330b458b95..376a34ea4723 100644
--- a/include/linux/if_fc.h
+++ b/include/linux/if_fc.h
@@ -44,7 +44,7 @@ struct fcllc {
44 __u8 ssap; /* source SAP */ 44 __u8 ssap; /* source SAP */
45 __u8 llc; /* LLC control field */ 45 __u8 llc; /* LLC control field */
46 __u8 protid[3]; /* protocol id */ 46 __u8 protid[3]; /* protocol id */
47 __u16 ethertype; /* ether type field */ 47 __be16 ethertype; /* ether type field */
48}; 48};
49 49
50#endif /* _LINUX_IF_FC_H */ 50#endif /* _LINUX_IF_FC_H */
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index a912818e6361..1288a161bc0b 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -85,7 +85,7 @@ struct fddi_snap_hdr
85 __u8 ssap; /* always 0xAA */ 85 __u8 ssap; /* always 0xAA */
86 __u8 ctrl; /* always 0x03 */ 86 __u8 ctrl; /* always 0x03 */
87 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ 87 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
88 __u16 ethertype; /* packet type ID field */ 88 __be16 ethertype; /* packet type ID field */
89 } __attribute__ ((packed)); 89 } __attribute__ ((packed));
90 90
91/* Define FDDI LLC frame header */ 91/* Define FDDI LLC frame header */
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 3c94b1736570..511999c7eeda 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -191,10 +191,12 @@ struct frad_local
191 int buffer; /* current buffer for S508 firmware */ 191 int buffer; /* current buffer for S508 firmware */
192}; 192};
193 193
194extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
195
196#endif /* __KERNEL__ */ 194#endif /* __KERNEL__ */
197 195
198#endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */ 196#endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
199 197
198#ifdef __KERNEL__
199extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
200#endif
201
200#endif 202#endif
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h
index c8ca72c46f76..94d31ca7d71a 100644
--- a/include/linux/if_hippi.h
+++ b/include/linux/if_hippi.h
@@ -102,9 +102,9 @@ struct hippi_fp_hdr
102#error "Please fix <asm/byteorder.h>" 102#error "Please fix <asm/byteorder.h>"
103#endif 103#endif
104#else 104#else
105 __u32 fixed; 105 __be32 fixed;
106#endif 106#endif
107 __u32 d2_size; 107 __be32 d2_size;
108} __attribute__ ((packed)); 108} __attribute__ ((packed));
109 109
110struct hippi_le_hdr 110struct hippi_le_hdr
@@ -144,7 +144,7 @@ struct hippi_snap_hdr
144 __u8 ssap; /* always 0xAA */ 144 __u8 ssap; /* always 0xAA */
145 __u8 ctrl; /* always 0x03 */ 145 __u8 ctrl; /* always 0x03 */
146 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ 146 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
147 __u16 ethertype; /* packet type ID field */ 147 __be16 ethertype; /* packet type ID field */
148} __attribute__ ((packed)); 148} __attribute__ ((packed));
149 149
150struct hippi_hdr 150struct hippi_hdr
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 3fba9e2f5427..5502f597cf0e 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -43,12 +43,16 @@ struct trh_hdr {
43}; 43};
44 44
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/config.h>
46#include <linux/skbuff.h> 47#include <linux/skbuff.h>
47 48
48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) 49static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 50{
50 return (struct trh_hdr *)skb->mac.raw; 51 return (struct trh_hdr *)skb->mac.raw;
51} 52}
53#ifdef CONFIG_SYSCTL
54extern struct ctl_table tr_table[];
55#endif
52#endif 56#endif
53 57
54/* This is an Token-Ring LLC structure */ 58/* This is an Token-Ring LLC structure */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 096a85a58ae5..88aef7b86ef4 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -77,6 +77,7 @@ struct tun_struct {
77#define TUNSETIFF _IOW('T', 202, int) 77#define TUNSETIFF _IOW('T', 202, int)
78#define TUNSETPERSIST _IOW('T', 203, int) 78#define TUNSETPERSIST _IOW('T', 203, int)
79#define TUNSETOWNER _IOW('T', 204, int) 79#define TUNSETOWNER _IOW('T', 204, int)
80#define TUNSETLINK _IOW('T', 205, int)
80 81
81/* TUNSETIFF ifr flags */ 82/* TUNSETIFF ifr flags */
82#define IFF_TUN 0x0001 83#define IFF_TUN 0x0001
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 62a9d89dfbe2..17d0c0d40b0e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -155,7 +155,6 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
155{ 155{
156 struct net_device_stats *stats; 156 struct net_device_stats *stats;
157 157
158 skb->real_dev = skb->dev;
159 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; 158 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
160 if (skb->dev == NULL) { 159 if (skb->dev == NULL) {
161 dev_kfree_skb_any(skb); 160 dev_kfree_skb_any(skb);
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 0c31ef0b5bad..28f4f3b36950 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -129,6 +129,9 @@ struct igmpv3_query {
129#include <linux/skbuff.h> 129#include <linux/skbuff.h>
130#include <linux/in.h> 130#include <linux/in.h>
131 131
132extern int sysctl_igmp_max_memberships;
133extern int sysctl_igmp_max_msf;
134
132struct ip_sf_socklist 135struct ip_sf_socklist
133{ 136{
134 unsigned int sl_max; 137 unsigned int sl_max;
diff --git a/include/linux/in.h b/include/linux/in.h
index fb88c66d748d..ba355384016a 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -32,6 +32,7 @@ enum {
32 IPPROTO_PUP = 12, /* PUP protocol */ 32 IPPROTO_PUP = 12, /* PUP protocol */
33 IPPROTO_UDP = 17, /* User Datagram Protocol */ 33 IPPROTO_UDP = 17, /* User Datagram Protocol */
34 IPPROTO_IDP = 22, /* XNS IDP protocol */ 34 IPPROTO_IDP = 22, /* XNS IDP protocol */
35 IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
35 IPPROTO_RSVP = 46, /* RSVP protocol */ 36 IPPROTO_RSVP = 46, /* RSVP protocol */
36 IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ 37 IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
37 38
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
new file mode 100644
index 000000000000..a4606e5810e5
--- /dev/null
+++ b/include/linux/inet_diag.h
@@ -0,0 +1,138 @@
1#ifndef _INET_DIAG_H_
2#define _INET_DIAG_H_ 1
3
4/* Just some random number */
5#define TCPDIAG_GETSOCK 18
6#define DCCPDIAG_GETSOCK 19
7
8#define INET_DIAG_GETSOCK_MAX 24
9
10/* Socket identity */
11struct inet_diag_sockid {
12 __u16 idiag_sport;
13 __u16 idiag_dport;
14 __u32 idiag_src[4];
15 __u32 idiag_dst[4];
16 __u32 idiag_if;
17 __u32 idiag_cookie[2];
18#define INET_DIAG_NOCOOKIE (~0U)
19};
20
21/* Request structure */
22
23struct inet_diag_req {
24 __u8 idiag_family; /* Family of addresses. */
25 __u8 idiag_src_len;
26 __u8 idiag_dst_len;
27 __u8 idiag_ext; /* Query extended information */
28
29 struct inet_diag_sockid id;
30
31 __u32 idiag_states; /* States to dump */
32 __u32 idiag_dbs; /* Tables to dump (NI) */
33};
34
35enum {
36 INET_DIAG_REQ_NONE,
37 INET_DIAG_REQ_BYTECODE,
38};
39
40#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
41
42/* Bytecode is sequence of 4 byte commands followed by variable arguments.
43 * All the commands identified by "code" are conditional jumps forward:
44 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
45 * length of the command and its arguments.
46 */
47
48struct inet_diag_bc_op {
49 unsigned char code;
50 unsigned char yes;
51 unsigned short no;
52};
53
54enum {
55 INET_DIAG_BC_NOP,
56 INET_DIAG_BC_JMP,
57 INET_DIAG_BC_S_GE,
58 INET_DIAG_BC_S_LE,
59 INET_DIAG_BC_D_GE,
60 INET_DIAG_BC_D_LE,
61 INET_DIAG_BC_AUTO,
62 INET_DIAG_BC_S_COND,
63 INET_DIAG_BC_D_COND,
64};
65
66struct inet_diag_hostcond {
67 __u8 family;
68 __u8 prefix_len;
69 int port;
70 __u32 addr[0];
71};
72
73/* Base info structure. It contains socket identity (addrs/ports/cookie)
74 * and, alas, the information shown by netstat. */
75struct inet_diag_msg {
76 __u8 idiag_family;
77 __u8 idiag_state;
78 __u8 idiag_timer;
79 __u8 idiag_retrans;
80
81 struct inet_diag_sockid id;
82
83 __u32 idiag_expires;
84 __u32 idiag_rqueue;
85 __u32 idiag_wqueue;
86 __u32 idiag_uid;
87 __u32 idiag_inode;
88};
89
90/* Extensions */
91
92enum {
93 INET_DIAG_NONE,
94 INET_DIAG_MEMINFO,
95 INET_DIAG_INFO,
96 INET_DIAG_VEGASINFO,
97 INET_DIAG_CONG,
98};
99
100#define INET_DIAG_MAX INET_DIAG_CONG
101
102
103/* INET_DIAG_MEM */
104
105struct inet_diag_meminfo {
106 __u32 idiag_rmem;
107 __u32 idiag_wmem;
108 __u32 idiag_fmem;
109 __u32 idiag_tmem;
110};
111
112/* INET_DIAG_VEGASINFO */
113
114struct tcpvegas_info {
115 __u32 tcpv_enabled;
116 __u32 tcpv_rttcnt;
117 __u32 tcpv_rtt;
118 __u32 tcpv_minrtt;
119};
120
121#ifdef __KERNEL__
122struct sock;
123struct inet_hashinfo;
124
125struct inet_diag_handler {
126 struct inet_hashinfo *idiag_hashinfo;
127 void (*idiag_get_info)(struct sock *sk,
128 struct inet_diag_msg *r,
129 void *info);
130 __u16 idiag_info_size;
131 __u16 idiag_type;
132};
133
134extern int inet_diag_register(const struct inet_diag_handler *handler);
135extern void inet_diag_unregister(const struct inet_diag_handler *handler);
136#endif /* __KERNEL__ */
137
138#endif /* _INET_DIAG_H_ */
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index a40c2bf0408e..ee5b239092ed 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -35,6 +35,7 @@ struct inotify_event {
35#define IN_CREATE 0x00000100 /* Subfile was created */ 35#define IN_CREATE 0x00000100 /* Subfile was created */
36#define IN_DELETE 0x00000200 /* Subfile was deleted */ 36#define IN_DELETE 0x00000200 /* Subfile was deleted */
37#define IN_DELETE_SELF 0x00000400 /* Self was deleted */ 37#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
38#define IN_MOVE_SELF 0x00000800 /* Self was moved */
38 39
39/* the following are legal events. they are sent as needed to any watch */ 40/* the following are legal events. they are sent as needed to any watch */
40#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ 41#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
@@ -46,6 +47,7 @@ struct inotify_event {
46#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ 47#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
47 48
48/* special flags */ 49/* special flags */
50#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
49#define IN_ISDIR 0x40000000 /* event occurred against dir */ 51#define IN_ISDIR 0x40000000 /* event occurred against dir */
50#define IN_ONESHOT 0x80000000 /* only send event once */ 52#define IN_ONESHOT 0x80000000 /* only send event once */
51 53
@@ -56,7 +58,8 @@ struct inotify_event {
56 */ 58 */
57#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ 59#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
58 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ 60 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
59 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF) 61 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
62 IN_MOVE_SELF)
60 63
61#ifdef __KERNEL__ 64#ifdef __KERNEL__
62 65
diff --git a/include/linux/input.h b/include/linux/input.h
index bdc53c6cc962..4767e5429534 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -66,6 +66,7 @@ struct input_absinfo {
66#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */ 66#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */
67#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 67#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
68#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 68#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
69#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
69 70
70#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ 71#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
71#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ 72#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */
@@ -86,6 +87,7 @@ struct input_absinfo {
86#define EV_REL 0x02 87#define EV_REL 0x02
87#define EV_ABS 0x03 88#define EV_ABS 0x03
88#define EV_MSC 0x04 89#define EV_MSC 0x04
90#define EV_SW 0x05
89#define EV_LED 0x11 91#define EV_LED 0x11
90#define EV_SND 0x12 92#define EV_SND 0x12
91#define EV_REP 0x14 93#define EV_REP 0x14
@@ -551,6 +553,20 @@ struct input_absinfo {
551#define ABS_MAX 0x3f 553#define ABS_MAX 0x3f
552 554
553/* 555/*
556 * Switch events
557 */
558
559#define SW_0 0x00
560#define SW_1 0x01
561#define SW_2 0x02
562#define SW_3 0x03
563#define SW_4 0x04
564#define SW_5 0x05
565#define SW_6 0x06
566#define SW_7 0x07
567#define SW_MAX 0x0f
568
569/*
554 * Misc events 570 * Misc events
555 */ 571 */
556 572
@@ -824,6 +840,7 @@ struct input_dev {
824 unsigned long ledbit[NBITS(LED_MAX)]; 840 unsigned long ledbit[NBITS(LED_MAX)];
825 unsigned long sndbit[NBITS(SND_MAX)]; 841 unsigned long sndbit[NBITS(SND_MAX)];
826 unsigned long ffbit[NBITS(FF_MAX)]; 842 unsigned long ffbit[NBITS(FF_MAX)];
843 unsigned long swbit[NBITS(SW_MAX)];
827 int ff_effects_max; 844 int ff_effects_max;
828 845
829 unsigned int keycodemax; 846 unsigned int keycodemax;
@@ -844,6 +861,7 @@ struct input_dev {
844 unsigned long key[NBITS(KEY_MAX)]; 861 unsigned long key[NBITS(KEY_MAX)];
845 unsigned long led[NBITS(LED_MAX)]; 862 unsigned long led[NBITS(LED_MAX)];
846 unsigned long snd[NBITS(SND_MAX)]; 863 unsigned long snd[NBITS(SND_MAX)];
864 unsigned long sw[NBITS(SW_MAX)];
847 865
848 int absmax[ABS_MAX + 1]; 866 int absmax[ABS_MAX + 1];
849 int absmin[ABS_MAX + 1]; 867 int absmin[ABS_MAX + 1];
@@ -886,6 +904,7 @@ struct input_dev {
886#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200 904#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
887#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400 905#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
888#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800 906#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
907#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
889 908
890#define INPUT_DEVICE_ID_MATCH_DEVICE\ 909#define INPUT_DEVICE_ID_MATCH_DEVICE\
891 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 910 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
@@ -906,6 +925,7 @@ struct input_device_id {
906 unsigned long ledbit[NBITS(LED_MAX)]; 925 unsigned long ledbit[NBITS(LED_MAX)];
907 unsigned long sndbit[NBITS(SND_MAX)]; 926 unsigned long sndbit[NBITS(SND_MAX)];
908 unsigned long ffbit[NBITS(FF_MAX)]; 927 unsigned long ffbit[NBITS(FF_MAX)];
928 unsigned long swbit[NBITS(SW_MAX)];
909 929
910 unsigned long driver_info; 930 unsigned long driver_info;
911}; 931};
@@ -998,6 +1018,11 @@ static inline void input_report_ff_status(struct input_dev *dev, unsigned int co
998 input_event(dev, EV_FF_STATUS, code, value); 1018 input_event(dev, EV_FF_STATUS, code, value);
999} 1019}
1000 1020
1021static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value)
1022{
1023 input_event(dev, EV_SW, code, !!value);
1024}
1025
1001static inline void input_regs(struct input_dev *dev, struct pt_regs *regs) 1026static inline void input_regs(struct input_dev *dev, struct pt_regs *regs)
1002{ 1027{
1003 dev->regs = regs; 1028 dev->regs = regs;
diff --git a/include/linux/ioctl32.h b/include/linux/ioctl32.h
index e8c4af32b3bb..948809d99917 100644
--- a/include/linux/ioctl32.h
+++ b/include/linux/ioctl32.h
@@ -14,26 +14,4 @@ struct ioctl_trans {
14 struct ioctl_trans *next; 14 struct ioctl_trans *next;
15}; 15};
16 16
17/*
18 * Register an 32bit ioctl translation handler for ioctl cmd.
19 *
20 * handler == NULL: use 64bit ioctl handler.
21 * arguments to handler: fd: file descriptor
22 * cmd: ioctl command.
23 * arg: ioctl argument
24 * struct file *file: file descriptor pointer.
25 */
26
27#ifdef CONFIG_COMPAT
28extern int __deprecated register_ioctl32_conversion(unsigned int cmd,
29 ioctl_trans_handler_t handler);
30extern int __deprecated unregister_ioctl32_conversion(unsigned int cmd);
31
32#else
33
34#define register_ioctl32_conversion(cmd, handler) ({ 0; })
35#define unregister_ioctl32_conversion(cmd) ({ 0; })
36
37#endif
38
39#endif 17#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 31e7cedd9f84..33e8a19a1a0f 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -196,6 +196,8 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
196#endif 196#endif
197#endif 197#endif
198 198
199extern int inet_sk_rebuild_header(struct sock *sk);
200
199struct iphdr { 201struct iphdr {
200#if defined(__LITTLE_ENDIAN_BITFIELD) 202#if defined(__LITTLE_ENDIAN_BITFIELD)
201 __u8 ihl:4, 203 __u8 ihl:4,
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 596ca6130159..938d55b813a5 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -35,6 +35,7 @@
35#define __LINUX_IPMI_H 35#define __LINUX_IPMI_H
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/compiler.h>
38 39
39/* 40/*
40 * This file describes an interface to an IPMI driver. You have to 41 * This file describes an interface to an IPMI driver. You have to
@@ -241,7 +242,8 @@ struct ipmi_recv_msg
241 /* The user_msg_data is the data supplied when a message was 242 /* The user_msg_data is the data supplied when a message was
242 sent, if this is a response to a sent message. If this is 243 sent, if this is a response to a sent message. If this is
243 not a response to a sent message, then user_msg_data will 244 not a response to a sent message, then user_msg_data will
244 be NULL. */ 245 be NULL. If the user above is NULL, then this will be the
246 intf. */
245 void *user_msg_data; 247 void *user_msg_data;
246 248
247 /* Call this when done with the message. It will presumably free 249 /* Call this when done with the message. It will presumably free
@@ -298,13 +300,19 @@ void ipmi_get_version(ipmi_user_t user,
298 this user, so it will affect all users of this interface. This is 300 this user, so it will affect all users of this interface. This is
299 so some initialization code can come in and do the OEM-specific 301 so some initialization code can come in and do the OEM-specific
300 things it takes to determine your address (if not the BMC) and set 302 things it takes to determine your address (if not the BMC) and set
301 it for everyone else. */ 303 it for everyone else. Note that each channel can have its own address. */
302void ipmi_set_my_address(ipmi_user_t user, 304int ipmi_set_my_address(ipmi_user_t user,
303 unsigned char address); 305 unsigned int channel,
304unsigned char ipmi_get_my_address(ipmi_user_t user); 306 unsigned char address);
305void ipmi_set_my_LUN(ipmi_user_t user, 307int ipmi_get_my_address(ipmi_user_t user,
306 unsigned char LUN); 308 unsigned int channel,
307unsigned char ipmi_get_my_LUN(ipmi_user_t user); 309 unsigned char *address);
310int ipmi_set_my_LUN(ipmi_user_t user,
311 unsigned int channel,
312 unsigned char LUN);
313int ipmi_get_my_LUN(ipmi_user_t user,
314 unsigned int channel,
315 unsigned char *LUN);
308 316
309/* 317/*
310 * Like ipmi_request, but lets you specify the number of retries and 318 * Like ipmi_request, but lets you specify the number of retries and
@@ -585,6 +593,16 @@ struct ipmi_cmdspec
585 * things it takes to determine your address (if not the BMC) and set 593 * things it takes to determine your address (if not the BMC) and set
586 * it for everyone else. You should probably leave the LUN alone. 594 * it for everyone else. You should probably leave the LUN alone.
587 */ 595 */
596struct ipmi_channel_lun_address_set
597{
598 unsigned short channel;
599 unsigned char value;
600};
601#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
602#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
603#define IPMICTL_SET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
604#define IPMICTL_GET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
605/* Legacy interfaces, these only set IPMB 0. */
588#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) 606#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
589#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) 607#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
590#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int) 608#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 6fcd6a0ade24..3c7dbc6a0a70 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -193,6 +193,11 @@ struct inet6_skb_parm {
193 193
194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
195 195
196static inline int inet6_iif(const struct sk_buff *skb)
197{
198 return IP6CB(skb)->iif;
199}
200
196struct tcp6_request_sock { 201struct tcp6_request_sock {
197 struct tcp_request_sock req; 202 struct tcp_request_sock req;
198 struct in6_addr loc_addr; 203 struct in6_addr loc_addr;
@@ -308,6 +313,36 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
308 313
309#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 314#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
310#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 315#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
316
317#include <linux/tcp.h>
318
319struct tcp6_timewait_sock {
320 struct tcp_timewait_sock tw_v6_sk;
321 struct in6_addr tw_v6_daddr;
322 struct in6_addr tw_v6_rcv_saddr;
323};
324
325static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk)
326{
327 return (struct tcp6_timewait_sock *)sk;
328}
329
330static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk)
331{
332 return likely(sk->sk_state != TCP_TIME_WAIT) ?
333 &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr;
334}
335
336static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk)
337{
338 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL;
339}
340
341static inline int inet_v6_ipv6only(const struct sock *sk)
342{
343 return likely(sk->sk_state != TCP_TIME_WAIT) ?
344 ipv6_only_sock(sk) : inet_twsk(sk)->tw_ipv6only;
345}
311#else 346#else
312#define __ipv6_only_sock(sk) 0 347#define __ipv6_only_sock(sk) 0
313#define ipv6_only_sock(sk) 0 348#define ipv6_only_sock(sk) 0
@@ -322,8 +357,19 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
322 return NULL; 357 return NULL;
323} 358}
324 359
325#endif 360#define __tcp_v6_rcv_saddr(__sk) NULL
361#define tcp_v6_rcv_saddr(__sk) NULL
362#define tcp_twsk_ipv6only(__sk) 0
363#define inet_v6_ipv6only(__sk) 0
364#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
326 365
327#endif 366#define INET6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \
367 (((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
368 ((__sk)->sk_family == AF_INET6) && \
369 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
370 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
371 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
328 372
329#endif 373#endif /* __KERNEL__ */
374
375#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 069d3b84d311..69681c3b1f05 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -32,7 +32,12 @@
32#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */ 32#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */
33#define IRQ_LEVEL 64 /* IRQ level triggered */ 33#define IRQ_LEVEL 64 /* IRQ level triggered */
34#define IRQ_MASKED 128 /* IRQ masked - shouldn't be seen again */ 34#define IRQ_MASKED 128 /* IRQ masked - shouldn't be seen again */
35#define IRQ_PER_CPU 256 /* IRQ is per CPU */ 35#if defined(ARCH_HAS_IRQ_PER_CPU)
36# define IRQ_PER_CPU 256 /* IRQ is per CPU */
37# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
38#else
39# define CHECK_IRQ_PER_CPU(var) 0
40#endif
36 41
37/* 42/*
38 * Interrupt controller descriptor. This is all we need 43 * Interrupt controller descriptor. This is all we need
@@ -71,16 +76,139 @@ typedef struct irq_desc {
71 unsigned int irq_count; /* For detecting broken interrupts */ 76 unsigned int irq_count; /* For detecting broken interrupts */
72 unsigned int irqs_unhandled; 77 unsigned int irqs_unhandled;
73 spinlock_t lock; 78 spinlock_t lock;
79#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
80 unsigned int move_irq; /* Flag need to re-target intr dest*/
81#endif
74} ____cacheline_aligned irq_desc_t; 82} ____cacheline_aligned irq_desc_t;
75 83
76extern irq_desc_t irq_desc [NR_IRQS]; 84extern irq_desc_t irq_desc [NR_IRQS];
77 85
86/* Return a pointer to the irq descriptor for IRQ. */
87static inline irq_desc_t *
88irq_descp (int irq)
89{
90 return irq_desc + irq;
91}
92
78#include <asm/hw_irq.h> /* the arch dependent stuff */ 93#include <asm/hw_irq.h> /* the arch dependent stuff */
79 94
80extern int setup_irq(unsigned int irq, struct irqaction * new); 95extern int setup_irq(unsigned int irq, struct irqaction * new);
81 96
82#ifdef CONFIG_GENERIC_HARDIRQS 97#ifdef CONFIG_GENERIC_HARDIRQS
83extern cpumask_t irq_affinity[NR_IRQS]; 98extern cpumask_t irq_affinity[NR_IRQS];
99
100#ifdef CONFIG_SMP
101static inline void set_native_irq_info(int irq, cpumask_t mask)
102{
103 irq_affinity[irq] = mask;
104}
105#else
106static inline void set_native_irq_info(int irq, cpumask_t mask)
107{
108}
109#endif
110
111#ifdef CONFIG_SMP
112
113#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
114extern cpumask_t pending_irq_cpumask[NR_IRQS];
115
116static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
117{
118 irq_desc_t *desc = irq_desc + irq;
119 unsigned long flags;
120
121 spin_lock_irqsave(&desc->lock, flags);
122 desc->move_irq = 1;
123 pending_irq_cpumask[irq] = mask;
124 spin_unlock_irqrestore(&desc->lock, flags);
125}
126
127static inline void
128move_native_irq(int irq)
129{
130 cpumask_t tmp;
131 irq_desc_t *desc = irq_descp(irq);
132
133 if (likely (!desc->move_irq))
134 return;
135
136 desc->move_irq = 0;
137
138 if (likely(cpus_empty(pending_irq_cpumask[irq])))
139 return;
140
141 if (!desc->handler->set_affinity)
142 return;
143
144 /* note - we hold the desc->lock */
145 cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
146
147 /*
148 * If there was a valid mask to work with, please
149 * do the disable, re-program, enable sequence.
150 * This is *not* particularly important for level triggered
151 * but in a edge trigger case, we might be setting rte
152 * when an active trigger is comming in. This could
153 * cause some ioapics to mal-function.
154 * Being paranoid i guess!
155 */
156 if (unlikely(!cpus_empty(tmp))) {
157 desc->handler->disable(irq);
158 desc->handler->set_affinity(irq,tmp);
159 desc->handler->enable(irq);
160 }
161 cpus_clear(pending_irq_cpumask[irq]);
162}
163
164#ifdef CONFIG_PCI_MSI
165/*
166 * Wonder why these are dummies?
167 * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
168 * counter part after translating the vector to irq info. We need to perform
169 * this operation on the real irq, when we dont use vector, i.e when
170 * pci_use_vector() is false.
171 */
172static inline void move_irq(int irq)
173{
174}
175
176static inline void set_irq_info(int irq, cpumask_t mask)
177{
178}
179
180#else // CONFIG_PCI_MSI
181
182static inline void move_irq(int irq)
183{
184 move_native_irq(irq);
185}
186
187static inline void set_irq_info(int irq, cpumask_t mask)
188{
189 set_native_irq_info(irq, mask);
190}
191#endif // CONFIG_PCI_MSI
192
193#else // CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE
194
195#define move_irq(x)
196#define move_native_irq(x)
197#define set_pending_irq(x,y)
198static inline void set_irq_info(int irq, cpumask_t mask)
199{
200 set_native_irq_info(irq, mask);
201}
202
203#endif // CONFIG_GENERIC_PENDING_IRQ
204
205#else // CONFIG_SMP
206
207#define move_irq(x)
208#define move_native_irq(x)
209
210#endif // CONFIG_SMP
211
84extern int no_irq_affinity; 212extern int no_irq_affinity;
85extern int noirqdebug_setup(char *str); 213extern int noirqdebug_setup(char *str);
86 214
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 862083eb58ab..53eaee96065b 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -150,7 +150,6 @@ typedef struct {
150#include <linux/errno.h> 150#include <linux/errno.h>
151#include <linux/fs.h> 151#include <linux/fs.h>
152#include <linux/major.h> 152#include <linux/major.h>
153#include <asm/segment.h>
154#include <asm/io.h> 153#include <asm/io.h>
155#include <linux/kernel.h> 154#include <linux/kernel.h>
156#include <linux/signal.h> 155#include <linux/signal.h>
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 593407e865b1..84321a4cac93 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -914,7 +914,6 @@ extern int journal_wipe (journal_t *, int);
914extern int journal_skip_recovery (journal_t *); 914extern int journal_skip_recovery (journal_t *);
915extern void journal_update_superblock (journal_t *, int); 915extern void journal_update_superblock (journal_t *, int);
916extern void __journal_abort_hard (journal_t *); 916extern void __journal_abort_hard (journal_t *);
917extern void __journal_abort_soft (journal_t *, int);
918extern void journal_abort (journal_t *, int); 917extern void journal_abort (journal_t *, int);
919extern int journal_errno (journal_t *); 918extern int journal_errno (journal_t *);
920extern void journal_ack_err (journal_t *); 919extern void journal_ack_err (journal_t *);
diff --git a/include/linux/klist.h b/include/linux/klist.h
index eebf5e5696ec..74071254c9d3 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -9,20 +9,25 @@
9 * This file is rleased under the GPL v2. 9 * This file is rleased under the GPL v2.
10 */ 10 */
11 11
12#ifndef _LINUX_KLIST_H
13#define _LINUX_KLIST_H
14
12#include <linux/spinlock.h> 15#include <linux/spinlock.h>
13#include <linux/completion.h> 16#include <linux/completion.h>
14#include <linux/kref.h> 17#include <linux/kref.h>
15#include <linux/list.h> 18#include <linux/list.h>
16 19
17 20struct klist_node;
18struct klist { 21struct klist {
19 spinlock_t k_lock; 22 spinlock_t k_lock;
20 struct list_head k_list; 23 struct list_head k_list;
24 void (*get)(struct klist_node *);
25 void (*put)(struct klist_node *);
21}; 26};
22 27
23 28
24extern void klist_init(struct klist * k); 29extern void klist_init(struct klist * k, void (*get)(struct klist_node *),
25 30 void (*put)(struct klist_node *));
26 31
27struct klist_node { 32struct klist_node {
28 struct klist * n_klist; 33 struct klist * n_klist;
@@ -31,8 +36,8 @@ struct klist_node {
31 struct completion n_removed; 36 struct completion n_removed;
32}; 37};
33 38
34extern void klist_add_tail(struct klist * k, struct klist_node * n); 39extern void klist_add_tail(struct klist_node * n, struct klist * k);
35extern void klist_add_head(struct klist * k, struct klist_node * n); 40extern void klist_add_head(struct klist_node * n, struct klist * k);
36 41
37extern void klist_del(struct klist_node * n); 42extern void klist_del(struct klist_node * n);
38extern void klist_remove(struct klist_node * n); 43extern void klist_remove(struct klist_node * n);
@@ -53,3 +58,4 @@ extern void klist_iter_init_node(struct klist * k, struct klist_iter * i,
53extern void klist_iter_exit(struct klist_iter * i); 58extern void klist_iter_exit(struct klist_iter * i);
54extern struct klist_node * klist_next(struct klist_iter * i); 59extern struct klist_node * klist_next(struct klist_iter * i);
55 60
61#endif
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index e050fc2d4c26..e30afdca7917 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -42,6 +42,9 @@
42#define KPROBE_REENTER 0x00000004 42#define KPROBE_REENTER 0x00000004
43#define KPROBE_HIT_SSDONE 0x00000008 43#define KPROBE_HIT_SSDONE 0x00000008
44 44
45/* Attach to insert probes on any functions which should be ignored*/
46#define __kprobes __attribute__((__section__(".kprobes.text")))
47
45struct kprobe; 48struct kprobe;
46struct pt_regs; 49struct pt_regs;
47struct kretprobe; 50struct kretprobe;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6cd9ba63563b..022105c745fc 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1,23 +1,26 @@
1/* 1/*
2 Copyright 2003-2004 Red Hat, Inc. All rights reserved. 2 * Copyright 2003-2005 Red Hat, Inc. All rights reserved.
3 Copyright 2003-2004 Jeff Garzik 3 * Copyright 2003-2005 Jeff Garzik
4 4 *
5 The contents of this file are subject to the Open 5 *
6 Software License version 1.1 that can be found at 6 * This program is free software; you can redistribute it and/or modify
7 http://www.opensource.org/licenses/osl-1.1.txt and is included herein 7 * it under the terms of the GNU General Public License as published by
8 by reference. 8 * the Free Software Foundation; either version 2, or (at your option)
9 9 * any later version.
10 Alternatively, the contents of this file may be used under the terms 10 *
11 of the GNU General Public License version 2 (the "GPL") as distributed 11 * This program is distributed in the hope that it will be useful,
12 in the kernel source COPYING file, in which case the provisions of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 the GPL are applicable instead of the above. If you wish to allow 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 the use of your version of this file only under the terms of the 14 * GNU General Public License for more details.
15 GPL and not to allow others to use your version of this file under 15 *
16 the OSL, indicate your decision by deleting the provisions above and 16 * You should have received a copy of the GNU General Public License
17 replace them with the notice and other provisions required by the GPL. 17 * along with this program; see the file COPYING. If not, write to
18 If you do not delete the provisions above, a recipient may use your 18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 version of this file under either the OSL or the GPL. 19 *
20 20 *
21 * libata documentation is available via 'make {ps|pdf}docs',
22 * as Documentation/DocBook/libata.*
23 *
21 */ 24 */
22 25
23#ifndef __LINUX_LIBATA_H__ 26#ifndef __LINUX_LIBATA_H__
@@ -37,7 +40,6 @@
37#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 40#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
38#undef ATA_IRQ_TRAP /* define to ack screaming irqs */ 41#undef ATA_IRQ_TRAP /* define to ack screaming irqs */
39#undef ATA_NDEBUG /* define to disable quick runtime checks */ 42#undef ATA_NDEBUG /* define to disable quick runtime checks */
40#undef ATA_ENABLE_ATAPI /* define to enable ATAPI support */
41#undef ATA_ENABLE_PATA /* define to enable PATA support in some 43#undef ATA_ENABLE_PATA /* define to enable PATA support in some
42 * low-level drivers */ 44 * low-level drivers */
43#undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */ 45#undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */
@@ -113,6 +115,8 @@ enum {
113 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ 115 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */
114 ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ 116 ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */
115 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 117 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */
118 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
119 * proper HSM is in place. */
116 120
117 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 121 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
118 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 122 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
@@ -363,7 +367,7 @@ struct ata_port_operations {
363 367
364 void (*host_stop) (struct ata_host_set *host_set); 368 void (*host_stop) (struct ata_host_set *host_set);
365 369
366 void (*bmdma_stop) (struct ata_port *ap); 370 void (*bmdma_stop) (struct ata_queued_cmd *qc);
367 u8 (*bmdma_status) (struct ata_port *ap); 371 u8 (*bmdma_status) (struct ata_port *ap);
368}; 372};
369 373
@@ -424,7 +428,7 @@ extern void ata_dev_id_string(u16 *id, unsigned char *s,
424extern void ata_dev_config(struct ata_port *ap, unsigned int i); 428extern void ata_dev_config(struct ata_port *ap, unsigned int i);
425extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 429extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
426extern void ata_bmdma_start (struct ata_queued_cmd *qc); 430extern void ata_bmdma_start (struct ata_queued_cmd *qc);
427extern void ata_bmdma_stop(struct ata_port *ap); 431extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
428extern u8 ata_bmdma_status(struct ata_port *ap); 432extern u8 ata_bmdma_status(struct ata_port *ap);
429extern void ata_bmdma_irq_clear(struct ata_port *ap); 433extern void ata_bmdma_irq_clear(struct ata_port *ap);
430extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); 434extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat);
@@ -445,6 +449,7 @@ struct pci_bits {
445 unsigned long val; 449 unsigned long val;
446}; 450};
447 451
452extern void ata_pci_host_stop (struct ata_host_set *host_set);
448extern struct ata_probe_ent * 453extern struct ata_probe_ent *
449ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); 454ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port);
450extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); 455extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
@@ -644,7 +649,7 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val)
644 ap->ops->scr_write(ap, reg, val); 649 ap->ops->scr_write(ap, reg, val);
645} 650}
646 651
647static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, 652static inline void scr_write_flush(struct ata_port *ap, unsigned int reg,
648 u32 val) 653 u32 val)
649{ 654{
650 ap->ops->scr_write(ap, reg, val); 655 ap->ops->scr_write(ap, reg, val);
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 338f7795d8a0..147eb01e0d4b 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -33,6 +33,13 @@
33 ALIGN; \ 33 ALIGN; \
34 name: 34 name:
35 35
36#define KPROBE_ENTRY(name) \
37 .section .kprobes.text, "ax"; \
38 .globl name; \
39 ALIGN; \
40 name:
41
42
36#endif 43#endif
37 44
38#define NORET_TYPE /**/ 45#define NORET_TYPE /**/
diff --git a/include/linux/list.h b/include/linux/list.h
index aab2db21b013..e6ec59682274 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -419,6 +419,20 @@ static inline void list_splice_init(struct list_head *list,
419 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 419 pos = n, n = list_entry(n->member.next, typeof(*n), member))
420 420
421/** 421/**
422 * list_for_each_entry_safe_continue - iterate over list of given type
423 * continuing after existing point safe against removal of list entry
424 * @pos: the type * to use as a loop counter.
425 * @n: another type * to use as temporary storage
426 * @head: the head for your list.
427 * @member: the name of the list_struct within the struct.
428 */
429#define list_for_each_entry_safe_continue(pos, n, head, member) \
430 for (pos = list_entry(pos->member.next, typeof(*pos), member), \
431 n = list_entry(pos->member.next, typeof(*pos), member); \
432 &pos->member != (head); \
433 pos = n, n = list_entry(n->member.next, typeof(*n), member))
434
435/**
422 * list_for_each_rcu - iterate over an rcu-protected list 436 * list_for_each_rcu - iterate over an rcu-protected list
423 * @pos: the &struct list_head to use as a loop counter. 437 * @pos: the &struct list_head to use as a loop counter.
424 * @head: the head for your list. 438 * @head: the head for your list.
@@ -620,6 +634,57 @@ static inline void hlist_add_after(struct hlist_node *n,
620 next->next->pprev = &next->next; 634 next->next->pprev = &next->next;
621} 635}
622 636
637/**
638 * hlist_add_before_rcu - adds the specified element to the specified hlist
639 * before the specified node while permitting racing traversals.
640 * @n: the new element to add to the hash list.
641 * @next: the existing element to add the new element before.
642 *
643 * The caller must take whatever precautions are necessary
644 * (such as holding appropriate locks) to avoid racing
645 * with another list-mutation primitive, such as hlist_add_head_rcu()
646 * or hlist_del_rcu(), running on this same list.
647 * However, it is perfectly legal to run concurrently with
648 * the _rcu list-traversal primitives, such as
649 * hlist_for_each_rcu(), used to prevent memory-consistency
650 * problems on Alpha CPUs.
651 */
652static inline void hlist_add_before_rcu(struct hlist_node *n,
653 struct hlist_node *next)
654{
655 n->pprev = next->pprev;
656 n->next = next;
657 smp_wmb();
658 next->pprev = &n->next;
659 *(n->pprev) = n;
660}
661
662/**
663 * hlist_add_after_rcu - adds the specified element to the specified hlist
664 * after the specified node while permitting racing traversals.
665 * @prev: the existing element to add the new element after.
666 * @n: the new element to add to the hash list.
667 *
668 * The caller must take whatever precautions are necessary
669 * (such as holding appropriate locks) to avoid racing
670 * with another list-mutation primitive, such as hlist_add_head_rcu()
671 * or hlist_del_rcu(), running on this same list.
672 * However, it is perfectly legal to run concurrently with
673 * the _rcu list-traversal primitives, such as
674 * hlist_for_each_rcu(), used to prevent memory-consistency
675 * problems on Alpha CPUs.
676 */
677static inline void hlist_add_after_rcu(struct hlist_node *prev,
678 struct hlist_node *n)
679{
680 n->next = prev->next;
681 n->pprev = &prev->next;
682 smp_wmb();
683 prev->next = n;
684 if (n->next)
685 n->next->pprev = &n->next;
686}
687
623#define hlist_entry(ptr, type, member) container_of(ptr,type,member) 688#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
624 689
625#define hlist_for_each(pos, head) \ 690#define hlist_for_each(pos, head) \
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8480aef10e62..94a46f38c532 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -150,6 +150,9 @@ void mpol_free_shared_policy(struct shared_policy *p);
150struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 150struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
151 unsigned long idx); 151 unsigned long idx);
152 152
153struct mempolicy *get_vma_policy(struct task_struct *task,
154 struct vm_area_struct *vma, unsigned long addr);
155
153extern void numa_default_policy(void); 156extern void numa_default_policy(void);
154extern void numa_policy_init(void); 157extern void numa_policy_init(void);
155 158
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 374b615ea9ea..9b8d0476988a 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -22,6 +22,7 @@
22#define MII_EXPANSION 0x06 /* Expansion register */ 22#define MII_EXPANSION 0x06 /* Expansion register */
23#define MII_CTRL1000 0x09 /* 1000BASE-T control */ 23#define MII_CTRL1000 0x09 /* 1000BASE-T control */
24#define MII_STAT1000 0x0a /* 1000BASE-T status */ 24#define MII_STAT1000 0x0a /* 1000BASE-T status */
25#define MII_ESTATUS 0x0f /* Extended Status */
25#define MII_DCOUNTER 0x12 /* Disconnect counter */ 26#define MII_DCOUNTER 0x12 /* Disconnect counter */
26#define MII_FCSCOUNTER 0x13 /* False carrier counter */ 27#define MII_FCSCOUNTER 0x13 /* False carrier counter */
27#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ 28#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
@@ -54,7 +55,10 @@
54#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ 55#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
55#define BMSR_RFAULT 0x0010 /* Remote fault detected */ 56#define BMSR_RFAULT 0x0010 /* Remote fault detected */
56#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ 57#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
57#define BMSR_RESV 0x07c0 /* Unused... */ 58#define BMSR_RESV 0x00c0 /* Unused... */
59#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */
60#define BMSR_100FULL2 0x0200 /* Can do 100BASE-T2 HDX */
61#define BMSR_100HALF2 0x0400 /* Can do 100BASE-T2 FDX */
58#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ 62#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
59#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ 63#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
60#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ 64#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
@@ -114,6 +118,9 @@
114#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ 118#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
115#define EXPANSION_RESV 0xffe0 /* Unused... */ 119#define EXPANSION_RESV 0xffe0 /* Unused... */
116 120
121#define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */
122#define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */
123
117/* N-way test register. */ 124/* N-way test register. */
118#define NWAYTEST_RESV1 0x00ff /* Unused... */ 125#define NWAYTEST_RESV1 0x00ff /* Unused... */
119#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ 126#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index aefedf04b9bb..18fc77f682de 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -33,6 +33,13 @@ struct mmc_csd {
33 unsigned int capacity; 33 unsigned int capacity;
34}; 34};
35 35
36struct sd_scr {
37 unsigned char sda_vsn;
38 unsigned char bus_widths;
39#define SD_SCR_BUS_WIDTH_1 (1<<0)
40#define SD_SCR_BUS_WIDTH_4 (1<<2)
41};
42
36struct mmc_host; 43struct mmc_host;
37 44
38/* 45/*
@@ -47,19 +54,27 @@ struct mmc_card {
47#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 54#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
48#define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ 55#define MMC_STATE_DEAD (1<<1) /* device no longer in stack */
49#define MMC_STATE_BAD (1<<2) /* unrecognised device */ 56#define MMC_STATE_BAD (1<<2) /* unrecognised device */
57#define MMC_STATE_SDCARD (1<<3) /* is an SD card */
58#define MMC_STATE_READONLY (1<<4) /* card is read-only */
50 u32 raw_cid[4]; /* raw card CID */ 59 u32 raw_cid[4]; /* raw card CID */
51 u32 raw_csd[4]; /* raw card CSD */ 60 u32 raw_csd[4]; /* raw card CSD */
61 u32 raw_scr[2]; /* raw card SCR */
52 struct mmc_cid cid; /* card identification */ 62 struct mmc_cid cid; /* card identification */
53 struct mmc_csd csd; /* card specific */ 63 struct mmc_csd csd; /* card specific */
64 struct sd_scr scr; /* extra SD information */
54}; 65};
55 66
56#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 67#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
57#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) 68#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD)
58#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) 69#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
70#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
71#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
59 72
60#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 73#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
61#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) 74#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
62#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) 75#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
76#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
77#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
63 78
64#define mmc_card_name(c) ((c)->cid.prod_name) 79#define mmc_card_name(c) ((c)->cid.prod_name)
65#define mmc_card_id(c) ((c)->dev.bus_id) 80#define mmc_card_id(c) ((c)->dev.bus_id)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f90f674eb3b0..6014160d9c06 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -46,16 +46,28 @@ struct mmc_ios {
46#define MMC_BUSMODE_OPENDRAIN 1 46#define MMC_BUSMODE_OPENDRAIN 1
47#define MMC_BUSMODE_PUSHPULL 2 47#define MMC_BUSMODE_PUSHPULL 2
48 48
49 unsigned char chip_select; /* SPI chip select */
50
51#define MMC_CS_DONTCARE 0
52#define MMC_CS_HIGH 1
53#define MMC_CS_LOW 2
54
49 unsigned char power_mode; /* power supply mode */ 55 unsigned char power_mode; /* power supply mode */
50 56
51#define MMC_POWER_OFF 0 57#define MMC_POWER_OFF 0
52#define MMC_POWER_UP 1 58#define MMC_POWER_UP 1
53#define MMC_POWER_ON 2 59#define MMC_POWER_ON 2
60
61 unsigned char bus_width; /* data bus width */
62
63#define MMC_BUS_WIDTH_1 0
64#define MMC_BUS_WIDTH_4 2
54}; 65};
55 66
56struct mmc_host_ops { 67struct mmc_host_ops {
57 void (*request)(struct mmc_host *host, struct mmc_request *req); 68 void (*request)(struct mmc_host *host, struct mmc_request *req);
58 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); 69 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
70 int (*get_ro)(struct mmc_host *host);
59}; 71};
60 72
61struct mmc_card; 73struct mmc_card;
@@ -63,11 +75,16 @@ struct device;
63 75
64struct mmc_host { 76struct mmc_host {
65 struct device *dev; 77 struct device *dev;
78 struct class_device class_dev;
79 int index;
66 struct mmc_host_ops *ops; 80 struct mmc_host_ops *ops;
67 unsigned int f_min; 81 unsigned int f_min;
68 unsigned int f_max; 82 unsigned int f_max;
69 u32 ocr_avail; 83 u32 ocr_avail;
70 char host_name[8]; 84
85 unsigned long caps; /* Host capabilities */
86
87#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
71 88
72 /* host specific block data */ 89 /* host specific block data */
73 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 90 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -80,6 +97,10 @@ struct mmc_host {
80 struct mmc_ios ios; /* current io bus settings */ 97 struct mmc_ios ios; /* current io bus settings */
81 u32 ocr; /* the current OCR setting */ 98 u32 ocr; /* the current OCR setting */
82 99
100 unsigned int mode; /* current card mode of host */
101#define MMC_MODE_MMC 0
102#define MMC_MODE_SD 1
103
83 struct list_head cards; /* devices attached to this host */ 104 struct list_head cards; /* devices attached to this host */
84 105
85 wait_queue_head_t wq; 106 wait_queue_head_t wq;
@@ -97,6 +118,7 @@ extern void mmc_free_host(struct mmc_host *);
97 118
98#define mmc_priv(x) ((void *)((x) + 1)) 119#define mmc_priv(x) ((void *)((x) + 1))
99#define mmc_dev(x) ((x)->dev) 120#define mmc_dev(x) ((x)->dev)
121#define mmc_hostname(x) ((x)->class_dev.class_id)
100 122
101extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 123extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
102extern int mmc_resume_host(struct mmc_host *); 124extern int mmc_resume_host(struct mmc_host *);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 0d35d4ffb360..1ab78e8d6c53 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -88,6 +88,8 @@ struct mmc_card;
88 88
89extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 89extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
90extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); 90extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
91extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int,
92 struct mmc_command *, int);
91 93
92extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card); 94extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card);
93 95
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index 896342817b97..f819cae92266 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -236,5 +236,12 @@ struct _mmc_csd {
236#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */ 236#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
237#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */ 237#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */
238 238
239
240/*
241 * SD bus widths
242 */
243#define SD_BUS_WIDTH_1 0
244#define SD_BUS_WIDTH_4 2
245
239#endif /* MMC_MMC_PROTOCOL_H */ 246#endif /* MMC_MMC_PROTOCOL_H */
240 247
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6c90461ed99f..5ed471b58f4f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -487,11 +487,27 @@ struct mem_section {
487 unsigned long section_mem_map; 487 unsigned long section_mem_map;
488}; 488};
489 489
490extern struct mem_section mem_section[NR_MEM_SECTIONS]; 490#ifdef CONFIG_SPARSEMEM_EXTREME
491#define SECTIONS_PER_ROOT (PAGE_SIZE / sizeof (struct mem_section))
492#else
493#define SECTIONS_PER_ROOT 1
494#endif
495
496#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT)
497#define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT)
498#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)
499
500#ifdef CONFIG_SPARSEMEM_EXTREME
501extern struct mem_section *mem_section[NR_SECTION_ROOTS];
502#else
503extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
504#endif
491 505
492static inline struct mem_section *__nr_to_section(unsigned long nr) 506static inline struct mem_section *__nr_to_section(unsigned long nr)
493{ 507{
494 return &mem_section[nr]; 508 if (!mem_section[SECTION_NR_TO_ROOT(nr)])
509 return NULL;
510 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
495} 511}
496 512
497/* 513/*
@@ -513,12 +529,12 @@ static inline struct page *__section_mem_map_addr(struct mem_section *section)
513 529
514static inline int valid_section(struct mem_section *section) 530static inline int valid_section(struct mem_section *section)
515{ 531{
516 return (section->section_mem_map & SECTION_MARKED_PRESENT); 532 return (section && (section->section_mem_map & SECTION_MARKED_PRESENT));
517} 533}
518 534
519static inline int section_has_mem_map(struct mem_section *section) 535static inline int section_has_mem_map(struct mem_section *section)
520{ 536{
521 return (section->section_mem_map & SECTION_HAS_MEM_MAP); 537 return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP));
522} 538}
523 539
524static inline int valid_section_nr(unsigned long nr) 540static inline int valid_section_nr(unsigned long nr)
@@ -572,6 +588,7 @@ static inline int pfn_valid(unsigned long pfn)
572void sparse_init(void); 588void sparse_init(void);
573#else 589#else
574#define sparse_init() do {} while (0) 590#define sparse_init() do {} while (0)
591#define sparse_index_init(_sec, _nid) do {} while (0)
575#endif /* CONFIG_SPARSEMEM */ 592#endif /* CONFIG_SPARSEMEM */
576 593
577#ifdef CONFIG_NODES_SPAN_OTHER_NODES 594#ifdef CONFIG_NODES_SPAN_OTHER_NODES
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index dce53ac1625d..47da39ba3f03 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Device tables which are exported to userspace via 2 * Device tables which are exported to userspace via
3 * scripts/table2alias.c. You must keep that file in sync with this 3 * scripts/mod/file2alias.c. You must keep that file in sync with this
4 * header. 4 * header.
5 */ 5 */
6 6
@@ -33,7 +33,8 @@ struct ieee1394_device_id {
33 __u32 model_id; 33 __u32 model_id;
34 __u32 specifier_id; 34 __u32 specifier_id;
35 __u32 version; 35 __u32 version;
36 kernel_ulong_t driver_data; 36 kernel_ulong_t driver_data
37 __attribute__((aligned(sizeof(kernel_ulong_t))));
37}; 38};
38 39
39 40
@@ -182,9 +183,18 @@ struct of_device_id
182 char name[32]; 183 char name[32];
183 char type[32]; 184 char type[32];
184 char compatible[128]; 185 char compatible[128];
186#if __KERNEL__
185 void *data; 187 void *data;
188#else
189 kernel_ulong_t data;
190#endif
186}; 191};
187 192
193/* VIO */
194struct vio_device_id {
195 char type[32];
196 char compat[32];
197};
188 198
189/* PCMCIA */ 199/* PCMCIA */
190 200
@@ -208,7 +218,8 @@ struct pcmcia_device_id {
208#ifdef __KERNEL__ 218#ifdef __KERNEL__
209 const char * prod_id[4]; 219 const char * prod_id[4];
210#else 220#else
211 kernel_ulong_t prod_id[4]; 221 kernel_ulong_t prod_id[4]
222 __attribute__((aligned(sizeof(kernel_ulong_t))));
212#endif 223#endif
213 224
214 /* not matched against */ 225 /* not matched against */
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 2c4c6aa643ff..903e0ab8101f 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -77,6 +77,7 @@ struct msg_msg {
77/* one msq_queue structure for each present queue on the system */ 77/* one msq_queue structure for each present queue on the system */
78struct msg_queue { 78struct msg_queue {
79 struct kern_ipc_perm q_perm; 79 struct kern_ipc_perm q_perm;
80 int q_id;
80 time_t q_stime; /* last msgsnd time */ 81 time_t q_stime; /* last msgsnd time */
81 time_t q_rtime; /* last msgrcv time */ 82 time_t q_rtime; /* last msgrcv time */
82 time_t q_ctime; /* last change time */ 83 time_t q_ctime; /* last change time */
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index 5773ea42f6e4..0b08cd692201 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -980,7 +980,7 @@
980/* I2C Registers */ 980/* I2C Registers */
981/****************************************/ 981/****************************************/
982 982
983#define MV64XXX_I2C_CTLR_NAME "mv64xxx i2c" 983#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
984#define MV64XXX_I2C_OFFSET 0xc000 984#define MV64XXX_I2C_OFFSET 0xc000
985#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020 985#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020
986 986
diff --git a/include/linux/net.h b/include/linux/net.h
index 20cb226b2268..4e981585a89a 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -84,6 +84,7 @@ enum sock_type {
84 SOCK_RAW = 3, 84 SOCK_RAW = 3,
85 SOCK_RDM = 4, 85 SOCK_RDM = 4,
86 SOCK_SEQPACKET = 5, 86 SOCK_SEQPACKET = 5,
87 SOCK_DCCP = 6,
87 SOCK_PACKET = 10, 88 SOCK_PACKET = 10,
88}; 89};
89 90
@@ -282,5 +283,15 @@ static struct proto_ops name##_ops = { \
282#define MODULE_ALIAS_NETPROTO(proto) \ 283#define MODULE_ALIAS_NETPROTO(proto) \
283 MODULE_ALIAS("net-pf-" __stringify(proto)) 284 MODULE_ALIAS("net-pf-" __stringify(proto))
284 285
286#define MODULE_ALIAS_NET_PF_PROTO(pf, proto) \
287 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto))
288
289#ifdef CONFIG_SYSCTL
290#include <linux/sysctl.h>
291extern ctl_table net_table[];
292extern int net_msg_cost;
293extern int net_msg_burst;
294#endif
295
285#endif /* __KERNEL__ */ 296#endif /* __KERNEL__ */
286#endif /* _LINUX_NET_H */ 297#endif /* _LINUX_NET_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3a0ed7f9e801..7c717907896d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -244,6 +244,7 @@ struct netdev_boot_setup {
244}; 244};
245#define NETDEV_BOOT_SETUP_MAX 8 245#define NETDEV_BOOT_SETUP_MAX 8
246 246
247extern int __init netdev_boot_setup(char *str);
247 248
248/* 249/*
249 * The DEVICE structure. 250 * The DEVICE structure.
@@ -336,6 +337,7 @@ struct net_device
336 /* Interface address info. */ 337 /* Interface address info. */
337 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 338 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
338 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ 339 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */
340 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
339 unsigned char addr_len; /* hardware address length */ 341 unsigned char addr_len; /* hardware address length */
340 unsigned short dev_id; /* for shared network cards */ 342 unsigned short dev_id; /* for shared network cards */
341 343
@@ -497,10 +499,12 @@ static inline void *netdev_priv(struct net_device *dev)
497#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) 499#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev))
498 500
499struct packet_type { 501struct packet_type {
500 __be16 type; /* This is really htons(ether_type). */ 502 __be16 type; /* This is really htons(ether_type). */
501 struct net_device *dev; /* NULL is wildcarded here */ 503 struct net_device *dev; /* NULL is wildcarded here */
502 int (*func) (struct sk_buff *, struct net_device *, 504 int (*func) (struct sk_buff *,
503 struct packet_type *); 505 struct net_device *,
506 struct packet_type *,
507 struct net_device *);
504 void *af_packet_priv; 508 void *af_packet_priv;
505 struct list_head list; 509 struct list_head list;
506}; 510};
@@ -671,6 +675,7 @@ extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
671extern void dev_init(void); 675extern void dev_init(void);
672 676
673extern int netdev_nit; 677extern int netdev_nit;
678extern int netdev_budget;
674 679
675/* Called by rtnetlink.c:rtnl_unlock() */ 680/* Called by rtnetlink.c:rtnl_unlock() */
676extern void netdev_run_todo(void); 681extern void netdev_run_todo(void);
@@ -697,19 +702,9 @@ static inline int netif_carrier_ok(const struct net_device *dev)
697 702
698extern void __netdev_watchdog_up(struct net_device *dev); 703extern void __netdev_watchdog_up(struct net_device *dev);
699 704
700static inline void netif_carrier_on(struct net_device *dev) 705extern void netif_carrier_on(struct net_device *dev);
701{
702 if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state))
703 linkwatch_fire_event(dev);
704 if (netif_running(dev))
705 __netdev_watchdog_up(dev);
706}
707 706
708static inline void netif_carrier_off(struct net_device *dev) 707extern void netif_carrier_off(struct net_device *dev);
709{
710 if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state))
711 linkwatch_fire_event(dev);
712}
713 708
714/* Hot-plugging. */ 709/* Hot-plugging. */
715static inline int netif_device_present(struct net_device *dev) 710static inline int netif_device_present(struct net_device *dev)
@@ -916,6 +911,14 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward);
916extern void net_enable_timestamp(void); 911extern void net_enable_timestamp(void);
917extern void net_disable_timestamp(void); 912extern void net_disable_timestamp(void);
918 913
914#ifdef CONFIG_PROC_FS
915extern void *dev_seq_start(struct seq_file *seq, loff_t *pos);
916extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
917extern void dev_seq_stop(struct seq_file *seq, void *v);
918#endif
919
920extern void linkwatch_run_queue(void);
921
919#endif /* __KERNEL__ */ 922#endif /* __KERNEL__ */
920 923
921#endif /* _LINUX_DEV_H */ 924#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 2e2045482cb1..be365e70ee99 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -21,10 +21,23 @@
21#define NF_STOP 5 21#define NF_STOP 5
22#define NF_MAX_VERDICT NF_STOP 22#define NF_MAX_VERDICT NF_STOP
23 23
24/* we overload the higher bits for encoding auxiliary data such as the queue
25 * number. Not nice, but better than additional function arguments. */
26#define NF_VERDICT_MASK 0x0000ffff
27#define NF_VERDICT_BITS 16
28
29#define NF_VERDICT_QMASK 0xffff0000
30#define NF_VERDICT_QBITS 16
31
32#define NF_QUEUE_NR(x) (((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK) | NF_QUEUE)
33
34/* only for userspace compatibility */
35#ifndef __KERNEL__
24/* Generic cache responses from hook functions. 36/* Generic cache responses from hook functions.
25 <= 0x2000 is used for protocol-flags. */ 37 <= 0x2000 is used for protocol-flags. */
26#define NFC_UNKNOWN 0x4000 38#define NFC_UNKNOWN 0x4000
27#define NFC_ALTERED 0x8000 39#define NFC_ALTERED 0x8000
40#endif
28 41
29#ifdef __KERNEL__ 42#ifdef __KERNEL__
30#include <linux/config.h> 43#include <linux/config.h>
@@ -101,15 +114,51 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
101 114
102extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 115extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
103 116
104typedef void nf_logfn(unsigned int hooknum, 117/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
118 * disappear once iptables is replaced with pkttables. Please DO NOT use them
119 * for any new code! */
120#define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
121#define NF_LOG_TCPOPT 0x02 /* Log TCP options */
122#define NF_LOG_IPOPT 0x04 /* Log IP options */
123#define NF_LOG_UID 0x08 /* Log UID owning local socket */
124#define NF_LOG_MASK 0x0f
125
126#define NF_LOG_TYPE_LOG 0x01
127#define NF_LOG_TYPE_ULOG 0x02
128
129struct nf_loginfo {
130 u_int8_t type;
131 union {
132 struct {
133 u_int32_t copy_len;
134 u_int16_t group;
135 u_int16_t qthreshold;
136 } ulog;
137 struct {
138 u_int8_t level;
139 u_int8_t logflags;
140 } log;
141 } u;
142};
143
144typedef void nf_logfn(unsigned int pf,
145 unsigned int hooknum,
105 const struct sk_buff *skb, 146 const struct sk_buff *skb,
106 const struct net_device *in, 147 const struct net_device *in,
107 const struct net_device *out, 148 const struct net_device *out,
149 const struct nf_loginfo *li,
108 const char *prefix); 150 const char *prefix);
109 151
152struct nf_logger {
153 struct module *me;
154 nf_logfn *logfn;
155 char *name;
156};
157
110/* Function to register/unregister log function. */ 158/* Function to register/unregister log function. */
111int nf_log_register(int pf, nf_logfn *logfn); 159int nf_log_register(int pf, struct nf_logger *logger);
112void nf_log_unregister(int pf, nf_logfn *logfn); 160int nf_log_unregister_pf(int pf);
161void nf_log_unregister_logger(struct nf_logger *logger);
113 162
114/* Calls the registered backend logging function */ 163/* Calls the registered backend logging function */
115void nf_log_packet(int pf, 164void nf_log_packet(int pf,
@@ -117,6 +166,7 @@ void nf_log_packet(int pf,
117 const struct sk_buff *skb, 166 const struct sk_buff *skb,
118 const struct net_device *in, 167 const struct net_device *in,
119 const struct net_device *out, 168 const struct net_device *out,
169 struct nf_loginfo *li,
120 const char *fmt, ...); 170 const char *fmt, ...);
121 171
122/* Activate hook; either okfn or kfree_skb called, unless a hook 172/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -175,11 +225,16 @@ int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
175 int *len); 225 int *len);
176 226
177/* Packet queuing */ 227/* Packet queuing */
178typedef int (*nf_queue_outfn_t)(struct sk_buff *skb, 228struct nf_queue_handler {
179 struct nf_info *info, void *data); 229 int (*outfn)(struct sk_buff *skb, struct nf_info *info,
230 unsigned int queuenum, void *data);
231 void *data;
232 char *name;
233};
180extern int nf_register_queue_handler(int pf, 234extern int nf_register_queue_handler(int pf,
181 nf_queue_outfn_t outfn, void *data); 235 struct nf_queue_handler *qh);
182extern int nf_unregister_queue_handler(int pf); 236extern int nf_unregister_queue_handler(int pf);
237extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh);
183extern void nf_reinject(struct sk_buff *skb, 238extern void nf_reinject(struct sk_buff *skb,
184 struct nf_info *info, 239 struct nf_info *info,
185 unsigned int verdict); 240 unsigned int verdict);
@@ -190,6 +245,27 @@ extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
190/* FIXME: Before cache is ever used, this must be implemented for real. */ 245/* FIXME: Before cache is ever used, this must be implemented for real. */
191extern void nf_invalidate_cache(int pf); 246extern void nf_invalidate_cache(int pf);
192 247
248/* Call this before modifying an existing packet: ensures it is
249 modifiable and linear to the point you care about (writable_len).
250 Returns true or false. */
251extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
252
253struct nf_queue_rerouter {
254 void (*save)(const struct sk_buff *skb, struct nf_info *info);
255 int (*reroute)(struct sk_buff **skb, const struct nf_info *info);
256 int rer_size;
257};
258
259#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
260
261extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer);
262extern int nf_unregister_queue_rerouter(int pf);
263
264#ifdef CONFIG_PROC_FS
265#include <linux/proc_fs.h>
266extern struct proc_dir_entry *proc_net_netfilter;
267#endif
268
193#else /* !CONFIG_NETFILTER */ 269#else /* !CONFIG_NETFILTER */
194#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 270#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
195static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 271static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
new file mode 100644
index 000000000000..1d5b10ae2399
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink.h
@@ -0,0 +1,169 @@
1#ifndef _NFNETLINK_H
2#define _NFNETLINK_H
3#include <linux/types.h>
4
5#ifndef __KERNEL__
6/* nfnetlink groups: Up to 32 maximum - backwards compatibility for userspace */
7#define NF_NETLINK_CONNTRACK_NEW 0x00000001
8#define NF_NETLINK_CONNTRACK_UPDATE 0x00000002
9#define NF_NETLINK_CONNTRACK_DESTROY 0x00000004
10#define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008
11#define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010
12#define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020
13#endif
14
15enum nfnetlink_groups {
16 NFNLGRP_NONE,
17#define NFNLGRP_NONE NFNLGRP_NONE
18 NFNLGRP_CONNTRACK_NEW,
19#define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW
20 NFNLGRP_CONNTRACK_UPDATE,
21#define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE
22 NFNLGRP_CONNTRACK_DESTROY,
23#define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY
24 NFNLGRP_CONNTRACK_EXP_NEW,
25#define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW
26 NFNLGRP_CONNTRACK_EXP_UPDATE,
27#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE
28 NFNLGRP_CONNTRACK_EXP_DESTROY,
29#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
30 __NFNLGRP_MAX,
31};
32#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
33
34/* Generic structure for encapsulation optional netfilter information.
35 * It is reminiscent of sockaddr, but with sa_family replaced
36 * with attribute type.
37 * ! This should someday be put somewhere generic as now rtnetlink and
38 * ! nfnetlink use the same attributes methods. - J. Schulist.
39 */
40
41struct nfattr
42{
43 u_int16_t nfa_len;
44 u_int16_t nfa_type;
45} __attribute__ ((packed));
46
47/* FIXME: Shamelessly copy and pasted from rtnetlink.h, it's time
48 * to put this in a generic file */
49
50#define NFA_ALIGNTO 4
51#define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1))
52#define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \
53 && (nfa)->nfa_len <= (len))
54#define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \
55 (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len)))
56#define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len))
57#define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len))
58#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
59#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
60#define NFA_NEST(skb, type) \
61({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \
62 NFA_PUT(skb, type, 0, NULL); \
63 __start; })
64#define NFA_NEST_END(skb, start) \
65({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \
66 (skb)->len; })
67#define NFA_NEST_CANCEL(skb, start) \
68({ if (start) \
69 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
70 -1; })
71
72/* General form of address family dependent message.
73 */
74struct nfgenmsg {
75 u_int8_t nfgen_family; /* AF_xxx */
76 u_int8_t version; /* nfnetlink version */
77 u_int16_t res_id; /* resource id */
78} __attribute__ ((packed));
79
80#define NFNETLINK_V0 0
81
82#define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \
83 + NLMSG_ALIGN(sizeof(struct nfgenmsg))))
84#define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg))
85
86/* netfilter netlink message types are split in two pieces:
87 * 8 bit subsystem, 8bit operation.
88 */
89
90#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8)
91#define NFNL_MSG_TYPE(x) (x & 0x00ff)
92
93/* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS()
94 * won't work anymore */
95#define NFNL_SUBSYS_NONE 0
96#define NFNL_SUBSYS_CTNETLINK 1
97#define NFNL_SUBSYS_CTNETLINK_EXP 2
98#define NFNL_SUBSYS_QUEUE 3
99#define NFNL_SUBSYS_ULOG 4
100#define NFNL_SUBSYS_COUNT 5
101
102#ifdef __KERNEL__
103
104#include <linux/netlink.h>
105#include <linux/capability.h>
106
107struct nfnl_callback
108{
109 int (*call)(struct sock *nl, struct sk_buff *skb,
110 struct nlmsghdr *nlh, struct nfattr *cda[], int *errp);
111 kernel_cap_t cap_required; /* capabilities required for this msg */
112 u_int16_t attr_count; /* number of nfattr's */
113};
114
115struct nfnetlink_subsystem
116{
117 const char *name;
118 __u8 subsys_id; /* nfnetlink subsystem ID */
119 __u8 cb_count; /* number of callbacks */
120 struct nfnl_callback *cb; /* callback for individual types */
121};
122
123extern void __nfa_fill(struct sk_buff *skb, int attrtype,
124 int attrlen, const void *data);
125#define NFA_PUT(skb, attrtype, attrlen, data) \
126({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
127 __nfa_fill(skb, attrtype, attrlen, data); })
128
129extern struct semaphore nfnl_sem;
130
131#define nfnl_shlock() down(&nfnl_sem)
132#define nfnl_shlock_nowait() down_trylock(&nfnl_sem)
133
134#define nfnl_shunlock() do { up(&nfnl_sem); \
135 if(nfnl && nfnl->sk_receive_queue.qlen) \
136 nfnl->sk_data_ready(nfnl, 0); \
137 } while(0)
138
139extern void nfnl_lock(void);
140extern void nfnl_unlock(void);
141
142extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
143extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
144
145extern int nfattr_parse(struct nfattr *tb[], int maxattr,
146 struct nfattr *nfa, int len);
147
148#define nfattr_parse_nested(tb, max, nfa) \
149 nfattr_parse((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa)))
150
151#define nfattr_bad_size(tb, max, cta_min) \
152({ int __i, __res = 0; \
153 for (__i=0; __i<max; __i++) \
154 if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \
155 __res = 1; \
156 break; \
157 } \
158 __res; \
159})
160
161extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
162 int echo);
163extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
164
165#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
166 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
167
168#endif /* __KERNEL__ */
169#endif /* _NFNETLINK_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
new file mode 100644
index 000000000000..5c55751c78e4
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -0,0 +1,124 @@
1#ifndef _IPCONNTRACK_NETLINK_H
2#define _IPCONNTRACK_NETLINK_H
3#include <linux/netfilter/nfnetlink.h>
4
5enum cntl_msg_types {
6 IPCTNL_MSG_CT_NEW,
7 IPCTNL_MSG_CT_GET,
8 IPCTNL_MSG_CT_DELETE,
9 IPCTNL_MSG_CT_GET_CTRZERO,
10
11 IPCTNL_MSG_MAX
12};
13
14enum ctnl_exp_msg_types {
15 IPCTNL_MSG_EXP_NEW,
16 IPCTNL_MSG_EXP_GET,
17 IPCTNL_MSG_EXP_DELETE,
18
19 IPCTNL_MSG_EXP_MAX
20};
21
22
23enum ctattr_type {
24 CTA_UNSPEC,
25 CTA_TUPLE_ORIG,
26 CTA_TUPLE_REPLY,
27 CTA_STATUS,
28 CTA_PROTOINFO,
29 CTA_HELP,
30 CTA_NAT,
31 CTA_TIMEOUT,
32 CTA_MARK,
33 CTA_COUNTERS_ORIG,
34 CTA_COUNTERS_REPLY,
35 CTA_USE,
36 CTA_ID,
37 __CTA_MAX
38};
39#define CTA_MAX (__CTA_MAX - 1)
40
41enum ctattr_tuple {
42 CTA_TUPLE_UNSPEC,
43 CTA_TUPLE_IP,
44 CTA_TUPLE_PROTO,
45 __CTA_TUPLE_MAX
46};
47#define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1)
48
49enum ctattr_ip {
50 CTA_IP_UNSPEC,
51 CTA_IP_V4_SRC,
52 CTA_IP_V4_DST,
53 CTA_IP_V6_SRC,
54 CTA_IP_V6_DST,
55 __CTA_IP_MAX
56};
57#define CTA_IP_MAX (__CTA_IP_MAX - 1)
58
59enum ctattr_l4proto {
60 CTA_PROTO_UNSPEC,
61 CTA_PROTO_NUM,
62 CTA_PROTO_SRC_PORT,
63 CTA_PROTO_DST_PORT,
64 CTA_PROTO_ICMP_ID,
65 CTA_PROTO_ICMP_TYPE,
66 CTA_PROTO_ICMP_CODE,
67 __CTA_PROTO_MAX
68};
69#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1)
70
71enum ctattr_protoinfo {
72 CTA_PROTOINFO_UNSPEC,
73 CTA_PROTOINFO_TCP_STATE,
74 __CTA_PROTOINFO_MAX
75};
76#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
77
78enum ctattr_counters {
79 CTA_COUNTERS_UNSPEC,
80 CTA_COUNTERS_PACKETS,
81 CTA_COUNTERS_BYTES,
82 __CTA_COUNTERS_MAX
83};
84#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
85
86enum ctattr_nat {
87 CTA_NAT_UNSPEC,
88 CTA_NAT_MINIP,
89 CTA_NAT_MAXIP,
90 CTA_NAT_PROTO,
91 __CTA_NAT_MAX
92};
93#define CTA_NAT_MAX (__CTA_NAT_MAX - 1)
94
95enum ctattr_protonat {
96 CTA_PROTONAT_UNSPEC,
97 CTA_PROTONAT_PORT_MIN,
98 CTA_PROTONAT_PORT_MAX,
99 __CTA_PROTONAT_MAX
100};
101#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
102
103enum ctattr_expect {
104 CTA_EXPECT_UNSPEC,
105 CTA_EXPECT_MASTER,
106 CTA_EXPECT_TUPLE,
107 CTA_EXPECT_MASK,
108 CTA_EXPECT_TIMEOUT,
109 CTA_EXPECT_ID,
110 CTA_EXPECT_HELP_NAME,
111 __CTA_EXPECT_MAX
112};
113#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1)
114
115enum ctattr_help {
116 CTA_HELP_UNSPEC,
117 CTA_HELP_NAME,
118 __CTA_HELP_MAX
119};
120#define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
121
122#define CTA_HELP_MAXNAMESIZE 32
123
124#endif /* _IPCONNTRACK_NETLINK_H */
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
new file mode 100644
index 000000000000..b04b03880595
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -0,0 +1,88 @@
1#ifndef _NFNETLINK_LOG_H
2#define _NFNETLINK_LOG_H
3
4/* This file describes the netlink messages (i.e. 'protocol packets'),
5 * and not any kind of function definitions. It is shared between kernel and
6 * userspace. Don't put kernel specific stuff in here */
7
8#include <linux/types.h>
9#include <linux/netfilter/nfnetlink.h>
10
11enum nfulnl_msg_types {
12 NFULNL_MSG_PACKET, /* packet from kernel to userspace */
13 NFULNL_MSG_CONFIG, /* connect to a particular queue */
14
15 NFULNL_MSG_MAX
16};
17
18struct nfulnl_msg_packet_hdr {
19 u_int16_t hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */
21 u_int8_t _pad;
22} __attribute__ ((packed));
23
24struct nfulnl_msg_packet_hw {
25 u_int16_t hw_addrlen;
26 u_int16_t _pad;
27 u_int8_t hw_addr[8];
28} __attribute__ ((packed));
29
30struct nfulnl_msg_packet_timestamp {
31 aligned_u64 sec;
32 aligned_u64 usec;
33} __attribute__ ((packed));
34
35#define NFULNL_PREFIXLEN 30 /* just like old log target */
36
37enum nfulnl_attr_type {
38 NFULA_UNSPEC,
39 NFULA_PACKET_HDR,
40 NFULA_MARK, /* u_int32_t nfmark */
41 NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */
42 NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */
43 NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */
44 NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */
45 NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */
46 NFULA_HWADDR, /* nfulnl_msg_packet_hw */
47 NFULA_PAYLOAD, /* opaque data payload */
48 NFULA_PREFIX, /* string prefix */
49 NFULA_UID, /* user id of socket */
50
51 __NFULA_MAX
52};
53#define NFULA_MAX (__NFULA_MAX - 1)
54
55enum nfulnl_msg_config_cmds {
56 NFULNL_CFG_CMD_NONE,
57 NFULNL_CFG_CMD_BIND,
58 NFULNL_CFG_CMD_UNBIND,
59 NFULNL_CFG_CMD_PF_BIND,
60 NFULNL_CFG_CMD_PF_UNBIND,
61};
62
63struct nfulnl_msg_config_cmd {
64 u_int8_t command; /* nfulnl_msg_config_cmds */
65} __attribute__ ((packed));
66
67struct nfulnl_msg_config_mode {
68 u_int32_t copy_range;
69 u_int8_t copy_mode;
70 u_int8_t _pad;
71} __attribute__ ((packed));
72
73enum nfulnl_attr_config {
74 NFULA_CFG_UNSPEC,
75 NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */
76 NFULA_CFG_MODE, /* nfulnl_msg_config_mode */
77 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */
78 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
79 NFULA_CFG_QTHRESH, /* u_int32_t */
80 __NFULA_CFG_MAX
81};
82#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
83
84#define NFULNL_COPY_NONE 0x00
85#define NFULNL_COPY_META 0x01
86#define NFULNL_COPY_PACKET 0x02
87
88#endif /* _NFNETLINK_LOG_H */
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
new file mode 100644
index 000000000000..9e774373244c
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -0,0 +1,89 @@
1#ifndef _NFNETLINK_QUEUE_H
2#define _NFNETLINK_QUEUE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/nfnetlink.h>
6
7enum nfqnl_msg_types {
8 NFQNL_MSG_PACKET, /* packet from kernel to userspace */
9 NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */
10 NFQNL_MSG_CONFIG, /* connect to a particular queue */
11
12 NFQNL_MSG_MAX
13};
14
15struct nfqnl_msg_packet_hdr {
16 u_int32_t packet_id; /* unique ID of packet in queue */
17 u_int16_t hw_protocol; /* hw protocol (network order) */
18 u_int8_t hook; /* netfilter hook */
19} __attribute__ ((packed));
20
21struct nfqnl_msg_packet_hw {
22 u_int16_t hw_addrlen;
23 u_int16_t _pad;
24 u_int8_t hw_addr[8];
25} __attribute__ ((packed));
26
27struct nfqnl_msg_packet_timestamp {
28 aligned_u64 sec;
29 aligned_u64 usec;
30} __attribute__ ((packed));
31
32enum nfqnl_attr_type {
33 NFQA_UNSPEC,
34 NFQA_PACKET_HDR,
35 NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */
36 NFQA_MARK, /* u_int32_t nfmark */
37 NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */
38 NFQA_IFINDEX_INDEV, /* u_int32_t ifindex */
39 NFQA_IFINDEX_OUTDEV, /* u_int32_t ifindex */
40 NFQA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */
41 NFQA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */
42 NFQA_HWADDR, /* nfqnl_msg_packet_hw */
43 NFQA_PAYLOAD, /* opaque data payload */
44
45 __NFQA_MAX
46};
47#define NFQA_MAX (__NFQA_MAX - 1)
48
49struct nfqnl_msg_verdict_hdr {
50 u_int32_t verdict;
51 u_int32_t id;
52} __attribute__ ((packed));
53
54
55enum nfqnl_msg_config_cmds {
56 NFQNL_CFG_CMD_NONE,
57 NFQNL_CFG_CMD_BIND,
58 NFQNL_CFG_CMD_UNBIND,
59 NFQNL_CFG_CMD_PF_BIND,
60 NFQNL_CFG_CMD_PF_UNBIND,
61};
62
63struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad;
66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */
67} __attribute__ ((packed));
68
69enum nfqnl_config_mode {
70 NFQNL_COPY_NONE,
71 NFQNL_COPY_META,
72 NFQNL_COPY_PACKET,
73};
74
75struct nfqnl_msg_config_params {
76 u_int32_t copy_range;
77 u_int8_t copy_mode; /* enum nfqnl_config_mode */
78} __attribute__ ((packed));
79
80
81enum nfqnl_attr_config {
82 NFQA_CFG_UNSPEC,
83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
85 __NFQA_CFG_MAX
86};
87#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
88
89#endif /* _NFNETLINK_QUEUE_H */
diff --git a/include/linux/netfilter_decnet.h b/include/linux/netfilter_decnet.h
index 3064eec9cb8e..6f425369ee29 100644
--- a/include/linux/netfilter_decnet.h
+++ b/include/linux/netfilter_decnet.h
@@ -9,6 +9,8 @@
9 9
10#include <linux/netfilter.h> 10#include <linux/netfilter.h>
11 11
12/* only for userspace compatibility */
13#ifndef __KERNEL__
12/* IP Cache bits. */ 14/* IP Cache bits. */
13/* Src IP address. */ 15/* Src IP address. */
14#define NFC_DN_SRC 0x0001 16#define NFC_DN_SRC 0x0001
@@ -18,6 +20,7 @@
18#define NFC_DN_IF_IN 0x0004 20#define NFC_DN_IF_IN 0x0004
19/* Output device. */ 21/* Output device. */
20#define NFC_DN_IF_OUT 0x0008 22#define NFC_DN_IF_OUT 0x0008
23#endif /* ! __KERNEL__ */
21 24
22/* DECnet Hooks */ 25/* DECnet Hooks */
23/* After promisc drops, checksum checks. */ 26/* After promisc drops, checksum checks. */
@@ -53,7 +56,21 @@ struct nf_dn_rtmsg {
53 56
54#define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) 57#define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg)))
55 58
59#ifndef __KERNEL__
60/* backwards compatibility for userspace */
56#define DNRMG_L1_GROUP 0x01 61#define DNRMG_L1_GROUP 0x01
57#define DNRMG_L2_GROUP 0x02 62#define DNRMG_L2_GROUP 0x02
63#endif
64
65enum {
66 DNRNG_NLGRP_NONE,
67#define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE
68 DNRNG_NLGRP_L1,
69#define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1
70 DNRNG_NLGRP_L2,
71#define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2
72 __DNRNG_NLGRP_MAX
73};
74#define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1)
58 75
59#endif /*__LINUX_DECNET_NETFILTER_H*/ 76#endif /*__LINUX_DECNET_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 3ebc36afae1a..fdc4a9527343 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -8,6 +8,8 @@
8#include <linux/config.h> 8#include <linux/config.h>
9#include <linux/netfilter.h> 9#include <linux/netfilter.h>
10 10
11/* only for userspace compatibility */
12#ifndef __KERNEL__
11/* IP Cache bits. */ 13/* IP Cache bits. */
12/* Src IP address. */ 14/* Src IP address. */
13#define NFC_IP_SRC 0x0001 15#define NFC_IP_SRC 0x0001
@@ -35,6 +37,7 @@
35#define NFC_IP_DST_PT 0x0400 37#define NFC_IP_DST_PT 0x0400
36/* Something else about the proto */ 38/* Something else about the proto */
37#define NFC_IP_PROTO_UNKNOWN 0x2000 39#define NFC_IP_PROTO_UNKNOWN 0x2000
40#endif /* ! __KERNEL__ */
38 41
39/* IP Hooks */ 42/* IP Hooks */
40/* After promisc drops, checksum checks. */ 43/* After promisc drops, checksum checks. */
@@ -77,11 +80,6 @@ enum nf_ip_hook_priorities {
77#ifdef __KERNEL__ 80#ifdef __KERNEL__
78extern int ip_route_me_harder(struct sk_buff **pskb); 81extern int ip_route_me_harder(struct sk_buff **pskb);
79 82
80/* Call this before modifying an existing IP packet: ensures it is
81 modifiable and linear to the point you care about (writable_len).
82 Returns true or false. */
83extern int skb_ip_make_writable(struct sk_buff **pskb,
84 unsigned int writable_len);
85#endif /*__KERNEL__*/ 83#endif /*__KERNEL__*/
86 84
87#endif /*__LINUX_IP_NETFILTER_H*/ 85#endif /*__LINUX_IP_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 08fe5f7d14a0..7e033e9271a8 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -65,6 +65,63 @@ enum ip_conntrack_status {
65 65
66 /* Both together */ 66 /* Both together */
67 IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), 67 IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE),
68
69 /* Connection is dying (removed from lists), can not be unset. */
70 IPS_DYING_BIT = 9,
71 IPS_DYING = (1 << IPS_DYING_BIT),
72};
73
74/* Connection tracking event bits */
75enum ip_conntrack_events
76{
77 /* New conntrack */
78 IPCT_NEW_BIT = 0,
79 IPCT_NEW = (1 << IPCT_NEW_BIT),
80
81 /* Expected connection */
82 IPCT_RELATED_BIT = 1,
83 IPCT_RELATED = (1 << IPCT_RELATED_BIT),
84
85 /* Destroyed conntrack */
86 IPCT_DESTROY_BIT = 2,
87 IPCT_DESTROY = (1 << IPCT_DESTROY_BIT),
88
89 /* Timer has been refreshed */
90 IPCT_REFRESH_BIT = 3,
91 IPCT_REFRESH = (1 << IPCT_REFRESH_BIT),
92
93 /* Status has changed */
94 IPCT_STATUS_BIT = 4,
95 IPCT_STATUS = (1 << IPCT_STATUS_BIT),
96
97 /* Update of protocol info */
98 IPCT_PROTOINFO_BIT = 5,
99 IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT),
100
101 /* Volatile protocol info */
102 IPCT_PROTOINFO_VOLATILE_BIT = 6,
103 IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT),
104
105 /* New helper for conntrack */
106 IPCT_HELPER_BIT = 7,
107 IPCT_HELPER = (1 << IPCT_HELPER_BIT),
108
109 /* Update of helper info */
110 IPCT_HELPINFO_BIT = 8,
111 IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT),
112
113 /* Volatile helper info */
114 IPCT_HELPINFO_VOLATILE_BIT = 9,
115 IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT),
116
117 /* NAT info */
118 IPCT_NATINFO_BIT = 10,
119 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
120};
121
122enum ip_conntrack_expect_events {
123 IPEXP_NEW_BIT = 0,
124 IPEXP_NEW = (1 << IPEXP_NEW_BIT),
68}; 125};
69 126
70#ifdef __KERNEL__ 127#ifdef __KERNEL__
@@ -152,6 +209,9 @@ struct ip_conntrack
152 /* Current number of expected connections */ 209 /* Current number of expected connections */
153 unsigned int expecting; 210 unsigned int expecting;
154 211
212 /* Unique ID that identifies this conntrack*/
213 unsigned int id;
214
155 /* Helper, if any. */ 215 /* Helper, if any. */
156 struct ip_conntrack_helper *helper; 216 struct ip_conntrack_helper *helper;
157 217
@@ -171,7 +231,7 @@ struct ip_conntrack
171#endif /* CONFIG_IP_NF_NAT_NEEDED */ 231#endif /* CONFIG_IP_NF_NAT_NEEDED */
172 232
173#if defined(CONFIG_IP_NF_CONNTRACK_MARK) 233#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
174 unsigned long mark; 234 u_int32_t mark;
175#endif 235#endif
176 236
177 /* Traversed often, so hopefully in different cacheline to top */ 237 /* Traversed often, so hopefully in different cacheline to top */
@@ -200,6 +260,12 @@ struct ip_conntrack_expect
200 /* Usage count. */ 260 /* Usage count. */
201 atomic_t use; 261 atomic_t use;
202 262
263 /* Unique ID */
264 unsigned int id;
265
266 /* Flags */
267 unsigned int flags;
268
203#ifdef CONFIG_IP_NF_NAT_NEEDED 269#ifdef CONFIG_IP_NF_NAT_NEEDED
204 /* This is the original per-proto part, used to map the 270 /* This is the original per-proto part, used to map the
205 * expected connection the way the recipient expects. */ 271 * expected connection the way the recipient expects. */
@@ -209,6 +275,8 @@ struct ip_conntrack_expect
209#endif 275#endif
210}; 276};
211 277
278#define IP_CT_EXPECT_PERMANENT 0x1
279
212static inline struct ip_conntrack * 280static inline struct ip_conntrack *
213tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash) 281tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash)
214{ 282{
@@ -239,7 +307,12 @@ ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
239} 307}
240 308
241/* decrement reference count on a conntrack */ 309/* decrement reference count on a conntrack */
242extern void ip_conntrack_put(struct ip_conntrack *ct); 310static inline void
311ip_conntrack_put(struct ip_conntrack *ct)
312{
313 IP_NF_ASSERT(ct);
314 nf_conntrack_put(&ct->ct_general);
315}
243 316
244/* call to create an explicit dependency on ip_conntrack. */ 317/* call to create an explicit dependency on ip_conntrack. */
245extern void need_ip_conntrack(void); 318extern void need_ip_conntrack(void);
@@ -274,12 +347,50 @@ extern void
274ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data), 347ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data),
275 void *data); 348 void *data);
276 349
350extern struct ip_conntrack_helper *
351__ip_conntrack_helper_find_byname(const char *);
352extern struct ip_conntrack_helper *
353ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple);
354extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper);
355
356extern struct ip_conntrack_protocol *
357__ip_conntrack_proto_find(u_int8_t protocol);
358extern struct ip_conntrack_protocol *
359ip_conntrack_proto_find_get(u_int8_t protocol);
360extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto);
361
362extern void ip_ct_remove_expectations(struct ip_conntrack *ct);
363
364extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *,
365 struct ip_conntrack_tuple *);
366
367extern void ip_conntrack_free(struct ip_conntrack *ct);
368
369extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
370
371extern struct ip_conntrack_expect *
372__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
373
374extern struct ip_conntrack_expect *
375ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
376
377extern struct ip_conntrack_tuple_hash *
378__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
379 const struct ip_conntrack *ignored_conntrack);
380
381extern void ip_conntrack_flush(void);
382
277/* It's confirmed if it is, or has been in the hash table. */ 383/* It's confirmed if it is, or has been in the hash table. */
278static inline int is_confirmed(struct ip_conntrack *ct) 384static inline int is_confirmed(struct ip_conntrack *ct)
279{ 385{
280 return test_bit(IPS_CONFIRMED_BIT, &ct->status); 386 return test_bit(IPS_CONFIRMED_BIT, &ct->status);
281} 387}
282 388
389static inline int is_dying(struct ip_conntrack *ct)
390{
391 return test_bit(IPS_DYING_BIT, &ct->status);
392}
393
283extern unsigned int ip_conntrack_htable_size; 394extern unsigned int ip_conntrack_htable_size;
284 395
285struct ip_conntrack_stat 396struct ip_conntrack_stat
@@ -303,6 +414,85 @@ struct ip_conntrack_stat
303 414
304#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) 415#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
305 416
417#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
418#include <linux/notifier.h>
419#include <linux/interrupt.h>
420
421struct ip_conntrack_ecache {
422 struct ip_conntrack *ct;
423 unsigned int events;
424};
425DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
426
427#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
428
429extern struct notifier_block *ip_conntrack_chain;
430extern struct notifier_block *ip_conntrack_expect_chain;
431
432static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
433{
434 return notifier_chain_register(&ip_conntrack_chain, nb);
435}
436
437static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
438{
439 return notifier_chain_unregister(&ip_conntrack_chain, nb);
440}
441
442static inline int
443ip_conntrack_expect_register_notifier(struct notifier_block *nb)
444{
445 return notifier_chain_register(&ip_conntrack_expect_chain, nb);
446}
447
448static inline int
449ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
450{
451 return notifier_chain_unregister(&ip_conntrack_expect_chain, nb);
452}
453
454extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
455extern void __ip_ct_event_cache_init(struct ip_conntrack *ct);
456
457static inline void
458ip_conntrack_event_cache(enum ip_conntrack_events event,
459 const struct sk_buff *skb)
460{
461 struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct;
462 struct ip_conntrack_ecache *ecache;
463
464 local_bh_disable();
465 ecache = &__get_cpu_var(ip_conntrack_ecache);
466 if (ct != ecache->ct)
467 __ip_ct_event_cache_init(ct);
468 ecache->events |= event;
469 local_bh_enable();
470}
471
472static inline void ip_conntrack_event(enum ip_conntrack_events event,
473 struct ip_conntrack *ct)
474{
475 if (is_confirmed(ct) && !is_dying(ct))
476 notifier_call_chain(&ip_conntrack_chain, event, ct);
477}
478
479static inline void
480ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
481 struct ip_conntrack_expect *exp)
482{
483 notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
484}
485#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
486static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
487 const struct sk_buff *skb) {}
488static inline void ip_conntrack_event(enum ip_conntrack_events event,
489 struct ip_conntrack *ct) {}
490static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {}
491static inline void
492ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
493 struct ip_conntrack_expect *exp) {}
494#endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */
495
306#ifdef CONFIG_IP_NF_NAT_NEEDED 496#ifdef CONFIG_IP_NF_NAT_NEEDED
307static inline int ip_nat_initialized(struct ip_conntrack *conntrack, 497static inline int ip_nat_initialized(struct ip_conntrack *conntrack,
308 enum ip_nat_manip_type manip) 498 enum ip_nat_manip_type manip)
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
index 694aec9b4784..907d4f5ca5dc 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h
@@ -2,6 +2,9 @@
2#define _IP_CONNTRACK_CORE_H 2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h> 3#include <linux/netfilter.h>
4 4
5#define MAX_IP_CT_PROTO 256
6extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
7
5/* This header is used to share core functionality between the 8/* This header is used to share core functionality between the
6 standalone connection tracking module, and the compatibility layer's use 9 standalone connection tracking module, and the compatibility layer's use
7 of connection tracking. */ 10 of connection tracking. */
@@ -38,12 +41,19 @@ extern int __ip_conntrack_confirm(struct sk_buff **pskb);
38/* Confirm a connection: returns NF_DROP if packet must be dropped. */ 41/* Confirm a connection: returns NF_DROP if packet must be dropped. */
39static inline int ip_conntrack_confirm(struct sk_buff **pskb) 42static inline int ip_conntrack_confirm(struct sk_buff **pskb)
40{ 43{
41 if ((*pskb)->nfct 44 struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
42 && !is_confirmed((struct ip_conntrack *)(*pskb)->nfct)) 45 int ret = NF_ACCEPT;
43 return __ip_conntrack_confirm(pskb); 46
44 return NF_ACCEPT; 47 if (ct) {
48 if (!is_confirmed(ct))
49 ret = __ip_conntrack_confirm(pskb);
50 ip_ct_deliver_cached_events(ct);
51 }
52 return ret;
45} 53}
46 54
55extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
56
47extern struct list_head *ip_conntrack_hash; 57extern struct list_head *ip_conntrack_hash;
48extern struct list_head ip_conntrack_expect_list; 58extern struct list_head ip_conntrack_expect_list;
49extern rwlock_t ip_conntrack_lock; 59extern rwlock_t ip_conntrack_lock;
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
index 3692daa93dec..8d69279ccfe4 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
@@ -24,6 +24,8 @@ struct ip_conntrack_helper
24 int (*help)(struct sk_buff **pskb, 24 int (*help)(struct sk_buff **pskb,
25 struct ip_conntrack *ct, 25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo); 26 enum ip_conntrack_info conntrackinfo);
27
28 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
27}; 29};
28 30
29extern int ip_conntrack_helper_register(struct ip_conntrack_helper *); 31extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
index e20b57c5e1b7..b6b99be8632a 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
@@ -2,6 +2,7 @@
2#ifndef _IP_CONNTRACK_PROTOCOL_H 2#ifndef _IP_CONNTRACK_PROTOCOL_H
3#define _IP_CONNTRACK_PROTOCOL_H 3#define _IP_CONNTRACK_PROTOCOL_H
4#include <linux/netfilter_ipv4/ip_conntrack.h> 4#include <linux/netfilter_ipv4/ip_conntrack.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
5 6
6struct seq_file; 7struct seq_file;
7 8
@@ -47,22 +48,22 @@ struct ip_conntrack_protocol
47 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, 48 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
48 unsigned int hooknum); 49 unsigned int hooknum);
49 50
51 /* convert protoinfo to nfnetink attributes */
52 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
53 const struct ip_conntrack *ct);
54
55 int (*tuple_to_nfattr)(struct sk_buff *skb,
56 const struct ip_conntrack_tuple *t);
57 int (*nfattr_to_tuple)(struct nfattr *tb[],
58 struct ip_conntrack_tuple *t);
59
50 /* Module (if any) which this is connected to. */ 60 /* Module (if any) which this is connected to. */
51 struct module *me; 61 struct module *me;
52}; 62};
53 63
54#define MAX_IP_CT_PROTO 256
55extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
56
57/* Protocol registration. */ 64/* Protocol registration. */
58extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); 65extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
59extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); 66extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
60
61static inline struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol)
62{
63 return ip_ct_protos[protocol];
64}
65
66/* Existing built-in protocols */ 67/* Existing built-in protocols */
67extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; 68extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
68extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; 69extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
@@ -73,6 +74,11 @@ extern int ip_conntrack_protocol_tcp_init(void);
73/* Log invalid packets */ 74/* Log invalid packets */
74extern unsigned int ip_ct_log_invalid; 75extern unsigned int ip_ct_log_invalid;
75 76
77extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
78 const struct ip_conntrack_tuple *);
79extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
80 struct ip_conntrack_tuple *);
81
76#ifdef CONFIG_SYSCTL 82#ifdef CONFIG_SYSCTL
77#ifdef DEBUG_INVALID_PACKETS 83#ifdef DEBUG_INVALID_PACKETS
78#define LOG_INVALID(proto) \ 84#define LOG_INVALID(proto) \
diff --git a/include/linux/netfilter_ipv4/ip_logging.h b/include/linux/netfilter_ipv4/ip_logging.h
deleted file mode 100644
index 0c5c52cb6589..000000000000
--- a/include/linux/netfilter_ipv4/ip_logging.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* IPv4 macros for the internal logging interface. */
2#ifndef __IP_LOGGING_H
3#define __IP_LOGGING_H
4
5#ifdef __KERNEL__
6#include <linux/socket.h>
7#include <linux/netfilter_logging.h>
8
9#define nf_log_ip_packet(pskb,hooknum,in,out,fmt,args...) \
10 nf_log_packet(AF_INET,pskb,hooknum,in,out,fmt,##args)
11
12#define nf_log_ip(pfh,len,fmt,args...) \
13 nf_log(AF_INET,pfh,len,fmt,##args)
14
15#define nf_ip_log_register(logging) nf_log_register(AF_INET,logging)
16#define nf_ip_log_unregister(logging) nf_log_unregister(AF_INET,logging)
17
18#endif /*__KERNEL__*/
19
20#endif /*__IP_LOGGING_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
index 129708c22386..ef63aa991a06 100644
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h
@@ -4,6 +4,9 @@
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/list.h> 5#include <linux/list.h>
6 6
7#include <linux/netfilter_ipv4/ip_nat.h>
8#include <linux/netfilter/nfnetlink_conntrack.h>
9
7struct iphdr; 10struct iphdr;
8struct ip_nat_range; 11struct ip_nat_range;
9 12
@@ -15,6 +18,8 @@ struct ip_nat_protocol
15 /* Protocol number. */ 18 /* Protocol number. */
16 unsigned int protonum; 19 unsigned int protonum;
17 20
21 struct module *me;
22
18 /* Translate a packet to the target according to manip type. 23 /* Translate a packet to the target according to manip type.
19 Return true if succeeded. */ 24 Return true if succeeded. */
20 int (*manip_pkt)(struct sk_buff **pskb, 25 int (*manip_pkt)(struct sk_buff **pskb,
@@ -43,19 +48,20 @@ struct ip_nat_protocol
43 48
44 unsigned int (*print_range)(char *buffer, 49 unsigned int (*print_range)(char *buffer,
45 const struct ip_nat_range *range); 50 const struct ip_nat_range *range);
46};
47 51
48#define MAX_IP_NAT_PROTO 256 52 int (*range_to_nfattr)(struct sk_buff *skb,
49extern struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; 53 const struct ip_nat_range *range);
54
55 int (*nfattr_to_range)(struct nfattr *tb[],
56 struct ip_nat_range *range);
57};
50 58
51/* Protocol registration. */ 59/* Protocol registration. */
52extern int ip_nat_protocol_register(struct ip_nat_protocol *proto); 60extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
53extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto); 61extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
54 62
55static inline struct ip_nat_protocol *ip_nat_find_proto(u_int8_t protocol) 63extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
56{ 64extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
57 return ip_nat_protos[protocol];
58}
59 65
60/* Built-in protocols. */ 66/* Built-in protocols. */
61extern struct ip_nat_protocol ip_nat_protocol_tcp; 67extern struct ip_nat_protocol ip_nat_protocol_tcp;
@@ -67,4 +73,9 @@ extern int init_protocols(void) __init;
67extern void cleanup_protocols(void); 73extern void cleanup_protocols(void);
68extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum); 74extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
69 75
76extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
77 const struct ip_nat_range *range);
78extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
79 struct ip_nat_range *range);
80
70#endif /*_IP_NAT_PROTO_H*/ 81#endif /*_IP_NAT_PROTO_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h
index fecd2a06dcd8..73b9552e6a89 100644
--- a/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ b/include/linux/netfilter_ipv4/ip_nat_rule.h
@@ -19,5 +19,10 @@ extern unsigned int
19alloc_null_binding(struct ip_conntrack *conntrack, 19alloc_null_binding(struct ip_conntrack *conntrack,
20 struct ip_nat_info *info, 20 struct ip_nat_info *info,
21 unsigned int hooknum); 21 unsigned int hooknum);
22
23extern unsigned int
24alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
25 struct ip_nat_info *info,
26 unsigned int hooknum);
22#endif 27#endif
23#endif /* _IP_NAT_RULE_H */ 28#endif /* _IP_NAT_RULE_H */
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 12ce47808e7d..d19d65cf4530 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -109,7 +109,8 @@ struct ipt_counters
109 109
110/* Values for "flag" field in struct ipt_ip (general ip structure). */ 110/* Values for "flag" field in struct ipt_ip (general ip structure). */
111#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ 111#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
112#define IPT_F_MASK 0x01 /* All possible flag bits mask. */ 112#define IPT_F_GOTO 0x02 /* Set if jump is a goto */
113#define IPT_F_MASK 0x03 /* All possible flag bits mask. */
113 114
114/* Values for "inv" field in struct ipt_ip. */ 115/* Values for "inv" field in struct ipt_ip. */
115#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ 116#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index d25f782e57d1..22d16177319b 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -1,6 +1,7 @@
1#ifndef _IPT_LOG_H 1#ifndef _IPT_LOG_H
2#define _IPT_LOG_H 2#define _IPT_LOG_H
3 3
4/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
4#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ 5#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
5#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ 6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
6#define IPT_LOG_IPOPT 0x04 /* Log IP options */ 7#define IPT_LOG_IPOPT 0x04 /* Log IP options */
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
new file mode 100644
index 000000000000..b5b2943b0c66
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
@@ -0,0 +1,16 @@
1/* iptables module for using NFQUEUE mechanism
2 *
3 * (C) 2005 Harald Welte <laforge@netfilter.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7*/
8#ifndef _IPT_NFQ_TARGET_H
9#define _IPT_NFQ_TARGET_H
10
11/* target info */
12struct ipt_NFQ_info {
13 u_int16_t queuenum;
14};
15
16#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h
new file mode 100644
index 000000000000..ee6611edc112
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_TTL.h
@@ -0,0 +1,21 @@
1/* TTL modification module for IP tables
2 * (C) 2000 by Harald Welte <laforge@netfilter.org> */
3
4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H
6
7enum {
8 IPT_TTL_SET = 0,
9 IPT_TTL_INC,
10 IPT_TTL_DEC
11};
12
13#define IPT_TTL_MAXMODE IPT_TTL_DEC
14
15struct ipt_TTL_info {
16 u_int8_t mode;
17 u_int8_t ttl;
18};
19
20
21#endif
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h
new file mode 100644
index 000000000000..9e5532f8d8ac
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_connbytes.h
@@ -0,0 +1,25 @@
1#ifndef _IPT_CONNBYTES_H
2#define _IPT_CONNBYTES_H
3
4enum ipt_connbytes_what {
5 IPT_CONNBYTES_PKTS,
6 IPT_CONNBYTES_BYTES,
7 IPT_CONNBYTES_AVGPKT,
8};
9
10enum ipt_connbytes_direction {
11 IPT_CONNBYTES_DIR_ORIGINAL,
12 IPT_CONNBYTES_DIR_REPLY,
13 IPT_CONNBYTES_DIR_BOTH,
14};
15
16struct ipt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h
new file mode 100644
index 000000000000..3cb3a522e62b
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_dccp.h
@@ -0,0 +1,23 @@
1#ifndef _IPT_DCCP_H_
2#define _IPT_DCCP_H_
3
4#define IPT_DCCP_SRC_PORTS 0x01
5#define IPT_DCCP_DEST_PORTS 0x02
6#define IPT_DCCP_TYPE 0x04
7#define IPT_DCCP_OPTION 0x08
8
9#define IPT_DCCP_VALID_FLAGS 0x0f
10
11struct ipt_dccp_info {
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21
22#endif /* _IPT_DCCP_H_ */
23
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h
new file mode 100644
index 000000000000..a265f6e44eab
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_string.h
@@ -0,0 +1,18 @@
1#ifndef _IPT_STRING_H
2#define _IPT_STRING_H
3
4#define IPT_STRING_MAX_PATTERN_SIZE 128
5#define IPT_STRING_MAX_ALGO_NAME_SIZE 16
6
7struct ipt_string_info
8{
9 u_int16_t from_offset;
10 u_int16_t to_offset;
11 char algo[IPT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[IPT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17
18#endif /*_IPT_STRING_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index bee7a5ec7c66..edcc2c6eb5c7 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -10,6 +10,8 @@
10 10
11#include <linux/netfilter.h> 11#include <linux/netfilter.h>
12 12
13/* only for userspace compatibility */
14#ifndef __KERNEL__
13/* IP Cache bits. */ 15/* IP Cache bits. */
14/* Src IP address. */ 16/* Src IP address. */
15#define NFC_IP6_SRC 0x0001 17#define NFC_IP6_SRC 0x0001
@@ -38,6 +40,7 @@
38#define NFC_IP6_DST_PT 0x0400 40#define NFC_IP6_DST_PT 0x0400
39/* Something else about the proto */ 41/* Something else about the proto */
40#define NFC_IP6_PROTO_UNKNOWN 0x2000 42#define NFC_IP6_PROTO_UNKNOWN 0x2000
43#endif /* ! __KERNEL__ */
41 44
42 45
43/* IP6 Hooks */ 46/* IP6 Hooks */
@@ -68,4 +71,7 @@ enum nf_ip6_hook_priorities {
68 NF_IP6_PRI_LAST = INT_MAX, 71 NF_IP6_PRI_LAST = INT_MAX,
69}; 72};
70 73
74extern int ipv6_netfilter_init(void);
75extern void ipv6_netfilter_fini(void);
76
71#endif /*__LINUX_IP6_NETFILTER_H*/ 77#endif /*__LINUX_IP6_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_logging.h b/include/linux/netfilter_ipv6/ip6_logging.h
deleted file mode 100644
index a0b2ee3043aa..000000000000
--- a/include/linux/netfilter_ipv6/ip6_logging.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* IPv6 macros for the nternal logging interface. */
2#ifndef __IP6_LOGGING_H
3#define __IP6_LOGGING_H
4
5#ifdef __KERNEL__
6#include <linux/socket.h>
7#include <linux/netfilter_logging.h>
8
9#define nf_log_ip6_packet(pskb,hooknum,in,out,fmt,args...) \
10 nf_log_packet(AF_INET6,pskb,hooknum,in,out,fmt,##args)
11
12#define nf_log_ip6(pfh,len,fmt,args...) \
13 nf_log(AF_INET6,pfh,len,fmt,##args)
14
15#define nf_ip6_log_register(logging) nf_log_register(AF_INET6,logging)
16#define nf_ip6_log_unregister(logging) nf_log_unregister(AF_INET6,logging)
17
18#endif /*__KERNEL__*/
19
20#endif /*__IP6_LOGGING_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index f1ce3b009853..58c72a52dc65 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -111,7 +111,8 @@ struct ip6t_counters
111#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper 111#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper
112 protocols */ 112 protocols */
113#define IP6T_F_TOS 0x02 /* Match the TOS. */ 113#define IP6T_F_TOS 0x02 /* Match the TOS. */
114#define IP6T_F_MASK 0x03 /* All possible flag bits mask. */ 114#define IP6T_F_GOTO 0x04 /* Set if jump is a goto */
115#define IP6T_F_MASK 0x07 /* All possible flag bits mask. */
115 116
116/* Values for "inv" field in struct ip6t_ip6. */ 117/* Values for "inv" field in struct ip6t_ip6. */
117#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ 118#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h
new file mode 100644
index 000000000000..afb7813d45ab
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_HL.h
@@ -0,0 +1,22 @@
1/* Hop Limit modification module for ip6tables
2 * Maciej Soltysiak <solt@dns.toxicfilms.tv>
3 * Based on HW's TTL module */
4
5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H
7
8enum {
9 IP6T_HL_SET = 0,
10 IP6T_HL_INC,
11 IP6T_HL_DEC
12};
13
14#define IP6T_HL_MAXMODE IP6T_HL_DEC
15
16struct ip6t_HL_info {
17 u_int8_t mode;
18 u_int8_t hop_limit;
19};
20
21
22#endif
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 42996a43bb39..9008ff5c40ae 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -1,6 +1,7 @@
1#ifndef _IP6T_LOG_H 1#ifndef _IP6T_LOG_H
2#define _IP6T_LOG_H 2#define _IP6T_LOG_H
3 3
4/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
4#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ 5#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
5#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ 6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */
6#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ 7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h
new file mode 100644
index 000000000000..6be6504162bb
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h
@@ -0,0 +1,18 @@
1#ifndef _IP6T_REJECT_H
2#define _IP6T_REJECT_H
3
4enum ip6t_reject_with {
5 IP6T_ICMP6_NO_ROUTE,
6 IP6T_ICMP6_ADM_PROHIBITED,
7 IP6T_ICMP6_NOT_NEIGHBOUR,
8 IP6T_ICMP6_ADDR_UNREACH,
9 IP6T_ICMP6_PORT_UNREACH,
10 IP6T_ICMP6_ECHOREPLY,
11 IP6T_TCP_RESET
12};
13
14struct ip6t_reject_info {
15 u_int32_t with; /* reject type */
16};
17
18#endif /*_IP6T_REJECT_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6552b71bfa73..167518668936 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -8,7 +8,7 @@
8#define NETLINK_W1 1 /* 1-wire subsystem */ 8#define NETLINK_W1 1 /* 1-wire subsystem */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_TCPDIAG 4 /* TCP socket monitoring */ 11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -90,6 +90,15 @@ struct nlmsgerr
90 struct nlmsghdr msg; 90 struct nlmsghdr msg;
91}; 91};
92 92
93#define NETLINK_ADD_MEMBERSHIP 1
94#define NETLINK_DROP_MEMBERSHIP 2
95#define NETLINK_PKTINFO 3
96
97struct nl_pktinfo
98{
99 __u32 group;
100};
101
93#define NET_MAJOR 36 /* Major 36 is reserved for networking */ 102#define NET_MAJOR 36 /* Major 36 is reserved for networking */
94 103
95enum { 104enum {
@@ -106,9 +115,8 @@ struct netlink_skb_parms
106{ 115{
107 struct ucred creds; /* Skb credentials */ 116 struct ucred creds; /* Skb credentials */
108 __u32 pid; 117 __u32 pid;
109 __u32 groups;
110 __u32 dst_pid; 118 __u32 dst_pid;
111 __u32 dst_groups; 119 __u32 dst_group;
112 kernel_cap_t eff_cap; 120 kernel_cap_t eff_cap;
113 __u32 loginuid; /* Login (audit) uid */ 121 __u32 loginuid; /* Login (audit) uid */
114}; 122};
@@ -117,11 +125,11 @@ struct netlink_skb_parms
117#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 125#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
118 126
119 127
120extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len)); 128extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module);
121extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 129extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
122extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 130extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
123extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 131extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
124 __u32 group, int allocation); 132 __u32 group, unsigned int __nocast allocation);
125extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 133extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
126extern int netlink_register_notifier(struct notifier_block *nb); 134extern int netlink_register_notifier(struct notifier_block *nb);
127extern int netlink_unregister_notifier(struct notifier_block *nb); 135extern int netlink_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index bcd0ac33f592..5ade54a78dbb 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/rcupdate.h>
12#include <linux/list.h> 13#include <linux/list.h>
13 14
14struct netpoll; 15struct netpoll;
@@ -26,6 +27,7 @@ struct netpoll {
26struct netpoll_info { 27struct netpoll_info {
27 spinlock_t poll_lock; 28 spinlock_t poll_lock;
28 int poll_owner; 29 int poll_owner;
30 int tries;
29 int rx_flags; 31 int rx_flags;
30 spinlock_t rx_lock; 32 spinlock_t rx_lock;
31 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
@@ -60,25 +62,31 @@ static inline int netpoll_rx(struct sk_buff *skb)
60 return ret; 62 return ret;
61} 63}
62 64
63static inline void netpoll_poll_lock(struct net_device *dev) 65static inline void *netpoll_poll_lock(struct net_device *dev)
64{ 66{
67 rcu_read_lock(); /* deal with race on ->npinfo */
65 if (dev->npinfo) { 68 if (dev->npinfo) {
66 spin_lock(&dev->npinfo->poll_lock); 69 spin_lock(&dev->npinfo->poll_lock);
67 dev->npinfo->poll_owner = smp_processor_id(); 70 dev->npinfo->poll_owner = smp_processor_id();
71 return dev->npinfo;
68 } 72 }
73 return NULL;
69} 74}
70 75
71static inline void netpoll_poll_unlock(struct net_device *dev) 76static inline void netpoll_poll_unlock(void *have)
72{ 77{
73 if (dev->npinfo) { 78 struct netpoll_info *npi = have;
74 dev->npinfo->poll_owner = -1; 79
75 spin_unlock(&dev->npinfo->poll_lock); 80 if (npi) {
81 npi->poll_owner = -1;
82 spin_unlock(&npi->poll_lock);
76 } 83 }
84 rcu_read_unlock();
77} 85}
78 86
79#else 87#else
80#define netpoll_rx(a) 0 88#define netpoll_rx(a) 0
81#define netpoll_poll_lock(a) 89#define netpoll_poll_lock(a) 0
82#define netpoll_poll_unlock(a) 90#define netpoll_poll_unlock(a)
83#endif 91#endif
84 92
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8ea249110fb0..9a6047ff1b25 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -112,7 +112,8 @@ struct nfs_inode {
112 /* 112 /*
113 * Various flags 113 * Various flags
114 */ 114 */
115 unsigned int flags; 115 unsigned long flags; /* atomic bit ops */
116 unsigned long cache_validity; /* bit mask */
116 117
117 /* 118 /*
118 * read_cache_jiffies is when we started read-caching this inode, 119 * read_cache_jiffies is when we started read-caching this inode,
@@ -174,8 +175,6 @@ struct nfs_inode {
174 /* Open contexts for shared mmap writes */ 175 /* Open contexts for shared mmap writes */
175 struct list_head open_files; 176 struct list_head open_files;
176 177
177 wait_queue_head_t nfs_i_wait;
178
179#ifdef CONFIG_NFS_V4 178#ifdef CONFIG_NFS_V4
180 struct nfs4_cached_acl *nfs4_acl; 179 struct nfs4_cached_acl *nfs4_acl;
181 /* NFSv4 state */ 180 /* NFSv4 state */
@@ -188,17 +187,21 @@ struct nfs_inode {
188}; 187};
189 188
190/* 189/*
191 * Legal inode flag values 190 * Cache validity bit flags
192 */ 191 */
193#define NFS_INO_STALE 0x0001 /* possible stale inode */ 192#define NFS_INO_INVALID_ATTR 0x0001 /* cached attrs are invalid */
194#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ 193#define NFS_INO_INVALID_DATA 0x0002 /* cached data is invalid */
195#define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ 194#define NFS_INO_INVALID_ATIME 0x0004 /* cached atime is invalid */
196#define NFS_INO_INVALID_ATTR 0x0008 /* cached attrs are invalid */ 195#define NFS_INO_INVALID_ACCESS 0x0008 /* cached access cred invalid */
197#define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ 196#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
198#define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ 197#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
199#define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ 198
200#define NFS_INO_INVALID_ACL 0x0080 /* cached acls are invalid */ 199/*
201#define NFS_INO_REVAL_PAGECACHE 0x1000 /* must revalidate pagecache */ 200 * Bit offsets in flags field
201 */
202#define NFS_INO_REVALIDATING (0) /* revalidating attrs */
203#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */
204#define NFS_INO_STALE (2) /* possible stale inode */
202 205
203static inline struct nfs_inode *NFS_I(struct inode *inode) 206static inline struct nfs_inode *NFS_I(struct inode *inode)
204{ 207{
@@ -224,8 +227,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
224#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) 227#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp)
225 228
226#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 229#define NFS_FLAGS(inode) (NFS_I(inode)->flags)
227#define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) 230#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode)))
228#define NFS_STALE(inode) (NFS_FLAGS(inode) & NFS_INO_STALE)
229 231
230#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 232#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
231 233
@@ -236,8 +238,11 @@ static inline int nfs_caches_unstable(struct inode *inode)
236 238
237static inline void NFS_CACHEINV(struct inode *inode) 239static inline void NFS_CACHEINV(struct inode *inode)
238{ 240{
239 if (!nfs_caches_unstable(inode)) 241 if (!nfs_caches_unstable(inode)) {
240 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 242 spin_lock(&inode->i_lock);
243 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS;
244 spin_unlock(&inode->i_lock);
245 }
241} 246}
242 247
243static inline int nfs_server_capable(struct inode *inode, int cap) 248static inline int nfs_server_capable(struct inode *inode, int cap)
@@ -247,7 +252,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
247 252
248static inline int NFS_USE_READDIRPLUS(struct inode *inode) 253static inline int NFS_USE_READDIRPLUS(struct inode *inode)
249{ 254{
250 return NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS; 255 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
251} 256}
252 257
253/** 258/**
@@ -292,6 +297,7 @@ extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
292extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 297extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
293extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 298extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
294extern int nfs_setattr(struct dentry *, struct iattr *); 299extern int nfs_setattr(struct dentry *, struct iattr *);
300extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
295extern void nfs_begin_attr_update(struct inode *); 301extern void nfs_begin_attr_update(struct inode *);
296extern void nfs_end_attr_update(struct inode *); 302extern void nfs_end_attr_update(struct inode *);
297extern void nfs_begin_data_update(struct inode *); 303extern void nfs_begin_data_update(struct inode *);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index f5a6695d4d21..f34767c5fc79 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -134,6 +134,7 @@ struct page_state {
134}; 134};
135 135
136extern void get_page_state(struct page_state *ret); 136extern void get_page_state(struct page_state *ret);
137extern void get_page_state_node(struct page_state *ret, int node);
137extern void get_full_page_state(struct page_state *ret); 138extern void get_full_page_state(struct page_state *ret);
138extern unsigned long __read_page_state(unsigned long offset); 139extern unsigned long __read_page_state(unsigned long offset);
139extern void __mod_page_state(unsigned long offset, unsigned long delta); 140extern void __mod_page_state(unsigned long offset, unsigned long delta);
@@ -194,6 +195,7 @@ extern void __mod_page_state(unsigned long offset, unsigned long delta);
194#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) 195#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags)
195#define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags) 196#define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags)
196#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags) 197#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags)
198#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags)
197#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) 199#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
198 200
199#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags) 201#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8621cf42b46f..bc4c40000c0d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -556,7 +556,8 @@ struct pci_dev {
556 /* keep track of device state */ 556 /* keep track of device state */
557 unsigned int is_enabled:1; /* pci_enable_device has been called */ 557 unsigned int is_enabled:1; /* pci_enable_device has been called */
558 unsigned int is_busmaster:1; /* device is busmaster */ 558 unsigned int is_busmaster:1; /* device is busmaster */
559 559 unsigned int no_msi:1; /* device may not use msi */
560
560 u32 saved_config_space[16]; /* config space saved at suspend time */ 561 u32 saved_config_space[16]; /* config space saved at suspend time */
561 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 562 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
562 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 563 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index bc4cc10fabe9..ee0ab7a5f91b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -881,7 +881,7 @@
881#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e 881#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e
882#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 882#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
883#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 883#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032
884#define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033 884#define PCI_DEVICE_ID_APPLE_UNI_N_ATA 0x0033
885#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 885#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
886#define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b 886#define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b
887#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e 887#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
@@ -1249,6 +1249,7 @@
1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E 1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1252#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x036F
1252#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 1253#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1253#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 1254#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1254#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B 1255#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B
@@ -1580,6 +1581,7 @@
1580#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 1581#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
1581#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 1582#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
1582#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 1583#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
1584#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214
1583#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 1585#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217
1584#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 1586#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
1585#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB 1587#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
@@ -1610,6 +1612,7 @@
1610#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030 1612#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030
1611#define PCI_DEVICE_ID_TOSHIBA_TX4927 0x0180 1613#define PCI_DEVICE_ID_TOSHIBA_TX4927 0x0180
1612#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 1614#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108
1615#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
1613 1616
1614#define PCI_VENDOR_ID_RICOH 0x1180 1617#define PCI_VENDOR_ID_RICOH 0x1180
1615#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 1618#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465
@@ -2143,6 +2146,10 @@
2143#define PCI_DEVICE_ID_ENE_1225 0x1225 2146#define PCI_DEVICE_ID_ENE_1225 0x1225
2144#define PCI_DEVICE_ID_ENE_1410 0x1410 2147#define PCI_DEVICE_ID_ENE_1410 0x1410
2145#define PCI_DEVICE_ID_ENE_1420 0x1420 2148#define PCI_DEVICE_ID_ENE_1420 0x1420
2149#define PCI_VENDOR_ID_CHELSIO 0x1425
2150
2151#define PCI_VENDOR_ID_MIPS 0x153f
2152#define PCI_DEVICE_ID_SOC_IT 0x0001
2146 2153
2147#define PCI_VENDOR_ID_SYBA 0x1592 2154#define PCI_VENDOR_ID_SYBA 0x1592
2148#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 2155#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782
@@ -2184,6 +2191,9 @@
2184#define PCI_VENDOR_ID_SIBYTE 0x166d 2191#define PCI_VENDOR_ID_SIBYTE 0x166d
2185#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2192#define PCI_DEVICE_ID_BCM1250_HT 0x0002
2186 2193
2194#define PCI_VENDOR_ID_NETCELL 0x169c
2195#define PCI_DEVICE_ID_REVOLUTION 0x0044
2196
2187#define PCI_VENDOR_ID_LINKSYS 0x1737 2197#define PCI_VENDOR_ID_LINKSYS 0x1737
2188#define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032 2198#define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032
2189#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 2199#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064
@@ -2281,6 +2291,11 @@
2281#define PCI_VENDOR_ID_INTEL 0x8086 2291#define PCI_VENDOR_ID_INTEL 0x8086
2282#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 2292#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
2283#define PCI_DEVICE_ID_INTEL_21145 0x0039 2293#define PCI_DEVICE_ID_INTEL_21145 0x0039
2294#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320
2295#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321
2296#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329
2297#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A
2298#define PCI_DEVICE_ID_INTEL_PXHV 0x032C
2284#define PCI_DEVICE_ID_INTEL_82375 0x0482 2299#define PCI_DEVICE_ID_INTEL_82375 0x0482
2285#define PCI_DEVICE_ID_INTEL_82424 0x0483 2300#define PCI_DEVICE_ID_INTEL_82424 0x0483
2286#define PCI_DEVICE_ID_INTEL_82378 0x0484 2301#define PCI_DEVICE_ID_INTEL_82378 0x0484
diff --git a/include/linux/phy.h b/include/linux/phy.h
new file mode 100644
index 000000000000..72cb67b66e0c
--- /dev/null
+++ b/include/linux/phy.h
@@ -0,0 +1,377 @@
1/*
2 * include/linux/phy.h
3 *
4 * Framework and drivers for configuring and reading different PHYs
5 * Based on code in sungem_phy.c and gianfar_phy.c
6 *
7 * Author: Andy Fleming
8 *
9 * Copyright (c) 2004 Freescale Semiconductor, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#ifndef __PHY_H
19#define __PHY_H
20
21#include <linux/spinlock.h>
22#include <linux/device.h>
23
24#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
25 SUPPORTED_10baseT_Full | \
26 SUPPORTED_100baseT_Half | \
27 SUPPORTED_100baseT_Full | \
28 SUPPORTED_Autoneg | \
29 SUPPORTED_TP | \
30 SUPPORTED_MII)
31
32#define PHY_GBIT_FEATURES (PHY_BASIC_FEATURES | \
33 SUPPORTED_1000baseT_Half | \
34 SUPPORTED_1000baseT_Full)
35
36/* Set phydev->irq to PHY_POLL if interrupts are not supported,
37 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if
38 * the attached driver handles the interrupt
39 */
40#define PHY_POLL -1
41#define PHY_IGNORE_INTERRUPT -2
42
43#define PHY_HAS_INTERRUPT 0x00000001
44#define PHY_HAS_MAGICANEG 0x00000002
45
46#define MII_BUS_MAX 4
47
48
49#define PHY_INIT_TIMEOUT 100000
50#define PHY_STATE_TIME 1
51#define PHY_FORCE_TIMEOUT 10
52#define PHY_AN_TIMEOUT 10
53
54#define PHY_MAX_ADDR 32
55
56/* The Bus class for PHYs. Devices which provide access to
57 * PHYs should register using this structure */
58struct mii_bus {
59 const char *name;
60 int id;
61 void *priv;
62 int (*read)(struct mii_bus *bus, int phy_id, int regnum);
63 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
64 int (*reset)(struct mii_bus *bus);
65
66 /* A lock to ensure that only one thing can read/write
67 * the MDIO bus at a time */
68 spinlock_t mdio_lock;
69
70 struct device *dev;
71
72 /* list of all PHYs on bus */
73 struct phy_device *phy_map[PHY_MAX_ADDR];
74
75 /* Pointer to an array of interrupts, each PHY's
76 * interrupt at the index matching its address */
77 int *irq;
78};
79
80#define PHY_INTERRUPT_DISABLED 0x0
81#define PHY_INTERRUPT_ENABLED 0x80000000
82
83/* PHY state machine states:
84 *
85 * DOWN: PHY device and driver are not ready for anything. probe
86 * should be called if and only if the PHY is in this state,
87 * given that the PHY device exists.
88 * - PHY driver probe function will, depending on the PHY, set
89 * the state to STARTING or READY
90 *
91 * STARTING: PHY device is coming up, and the ethernet driver is
92 * not ready. PHY drivers may set this in the probe function.
93 * If they do, they are responsible for making sure the state is
94 * eventually set to indicate whether the PHY is UP or READY,
95 * depending on the state when the PHY is done starting up.
96 * - PHY driver will set the state to READY
97 * - start will set the state to PENDING
98 *
99 * READY: PHY is ready to send and receive packets, but the
100 * controller is not. By default, PHYs which do not implement
101 * probe will be set to this state by phy_probe(). If the PHY
102 * driver knows the PHY is ready, and the PHY state is STARTING,
103 * then it sets this STATE.
104 * - start will set the state to UP
105 *
106 * PENDING: PHY device is coming up, but the ethernet driver is
107 * ready. phy_start will set this state if the PHY state is
108 * STARTING.
109 * - PHY driver will set the state to UP when the PHY is ready
110 *
111 * UP: The PHY and attached device are ready to do work.
112 * Interrupts should be started here.
113 * - timer moves to AN
114 *
115 * AN: The PHY is currently negotiating the link state. Link is
116 * therefore down for now. phy_timer will set this state when it
117 * detects the state is UP. config_aneg will set this state
118 * whenever called with phydev->autoneg set to AUTONEG_ENABLE.
119 * - If autonegotiation finishes, but there's no link, it sets
120 * the state to NOLINK.
121 * - If aneg finishes with link, it sets the state to RUNNING,
122 * and calls adjust_link
123 * - If autonegotiation did not finish after an arbitrary amount
124 * of time, autonegotiation should be tried again if the PHY
125 * supports "magic" autonegotiation (back to AN)
126 * - If it didn't finish, and no magic_aneg, move to FORCING.
127 *
128 * NOLINK: PHY is up, but not currently plugged in.
129 * - If the timer notes that the link comes back, we move to RUNNING
130 * - config_aneg moves to AN
131 * - phy_stop moves to HALTED
132 *
133 * FORCING: PHY is being configured with forced settings
134 * - if link is up, move to RUNNING
135 * - If link is down, we drop to the next highest setting, and
136 * retry (FORCING) after a timeout
137 * - phy_stop moves to HALTED
138 *
139 * RUNNING: PHY is currently up, running, and possibly sending
140 * and/or receiving packets
141 * - timer will set CHANGELINK if we're polling (this ensures the
142 * link state is polled every other cycle of this state machine,
143 * which makes it every other second)
144 * - irq will set CHANGELINK
145 * - config_aneg will set AN
146 * - phy_stop moves to HALTED
147 *
148 * CHANGELINK: PHY experienced a change in link state
149 * - timer moves to RUNNING if link
150 * - timer moves to NOLINK if the link is down
151 * - phy_stop moves to HALTED
152 *
153 * HALTED: PHY is up, but no polling or interrupts are done. Or
154 * PHY is in an error state.
155 *
156 * - phy_start moves to RESUMING
157 *
158 * RESUMING: PHY was halted, but now wants to run again.
159 * - If we are forcing, or aneg is done, timer moves to RUNNING
160 * - If aneg is not done, timer moves to AN
161 * - phy_stop moves to HALTED
162 */
163enum phy_state {
164 PHY_DOWN=0,
165 PHY_STARTING,
166 PHY_READY,
167 PHY_PENDING,
168 PHY_UP,
169 PHY_AN,
170 PHY_RUNNING,
171 PHY_NOLINK,
172 PHY_FORCING,
173 PHY_CHANGELINK,
174 PHY_HALTED,
175 PHY_RESUMING
176};
177
178/* phy_device: An instance of a PHY
179 *
180 * drv: Pointer to the driver for this PHY instance
181 * bus: Pointer to the bus this PHY is on
182 * dev: driver model device structure for this PHY
183 * phy_id: UID for this device found during discovery
184 * state: state of the PHY for management purposes
185 * dev_flags: Device-specific flags used by the PHY driver.
186 * addr: Bus address of PHY
187 * link_timeout: The number of timer firings to wait before the
188 * giving up on the current attempt at acquiring a link
189 * irq: IRQ number of the PHY's interrupt (-1 if none)
190 * phy_timer: The timer for handling the state machine
191 * phy_queue: A work_queue for the interrupt
192 * attached_dev: The attached enet driver's device instance ptr
193 * adjust_link: Callback for the enet controller to respond to
194 * changes in the link state.
195 * adjust_state: Callback for the enet driver to respond to
196 * changes in the state machine.
197 *
198 * speed, duplex, pause, supported, advertising, and
199 * autoneg are used like in mii_if_info
200 *
201 * interrupts currently only supports enabled or disabled,
202 * but could be changed in the future to support enabling
203 * and disabling specific interrupts
204 *
205 * Contains some infrastructure for polling and interrupt
206 * handling, as well as handling shifts in PHY hardware state
207 */
208struct phy_device {
209 /* Information about the PHY type */
210 /* And management functions */
211 struct phy_driver *drv;
212
213 struct mii_bus *bus;
214
215 struct device dev;
216
217 u32 phy_id;
218
219 enum phy_state state;
220
221 u32 dev_flags;
222
223 /* Bus address of the PHY (0-32) */
224 int addr;
225
226 /* forced speed & duplex (no autoneg)
227 * partner speed & duplex & pause (autoneg)
228 */
229 int speed;
230 int duplex;
231 int pause;
232 int asym_pause;
233
234 /* The most recently read link state */
235 int link;
236
237 /* Enabled Interrupts */
238 u32 interrupts;
239
240 /* Union of PHY and Attached devices' supported modes */
241 /* See mii.h for more info */
242 u32 supported;
243 u32 advertising;
244
245 int autoneg;
246
247 int link_timeout;
248
249 /* Interrupt number for this PHY
250 * -1 means no interrupt */
251 int irq;
252
253 /* private data pointer */
254 /* For use by PHYs to maintain extra state */
255 void *priv;
256
257 /* Interrupt and Polling infrastructure */
258 struct work_struct phy_queue;
259 struct timer_list phy_timer;
260
261 spinlock_t lock;
262
263 struct net_device *attached_dev;
264
265 void (*adjust_link)(struct net_device *dev);
266
267 void (*adjust_state)(struct net_device *dev);
268};
269#define to_phy_device(d) container_of(d, struct phy_device, dev)
270
271/* struct phy_driver: Driver structure for a particular PHY type
272 *
273 * phy_id: The result of reading the UID registers of this PHY
274 * type, and ANDing them with the phy_id_mask. This driver
275 * only works for PHYs with IDs which match this field
276 * name: The friendly name of this PHY type
277 * phy_id_mask: Defines the important bits of the phy_id
278 * features: A list of features (speed, duplex, etc) supported
279 * by this PHY
280 * flags: A bitfield defining certain other features this PHY
281 * supports (like interrupts)
282 *
283 * The drivers must implement config_aneg and read_status. All
284 * other functions are optional. Note that none of these
285 * functions should be called from interrupt time. The goal is
286 * for the bus read/write functions to be able to block when the
287 * bus transaction is happening, and be freed up by an interrupt
288 * (The MPC85xx has this ability, though it is not currently
289 * supported in the driver).
290 */
291struct phy_driver {
292 u32 phy_id;
293 char *name;
294 unsigned int phy_id_mask;
295 u32 features;
296 u32 flags;
297
298 /* Called to initialize the PHY,
299 * including after a reset */
300 int (*config_init)(struct phy_device *phydev);
301
302 /* Called during discovery. Used to set
303 * up device-specific structures, if any */
304 int (*probe)(struct phy_device *phydev);
305
306 /* PHY Power Management */
307 int (*suspend)(struct phy_device *phydev);
308 int (*resume)(struct phy_device *phydev);
309
310 /* Configures the advertisement and resets
311 * autonegotiation if phydev->autoneg is on,
312 * forces the speed to the current settings in phydev
313 * if phydev->autoneg is off */
314 int (*config_aneg)(struct phy_device *phydev);
315
316 /* Determines the negotiated speed and duplex */
317 int (*read_status)(struct phy_device *phydev);
318
319 /* Clears any pending interrupts */
320 int (*ack_interrupt)(struct phy_device *phydev);
321
322 /* Enables or disables interrupts */
323 int (*config_intr)(struct phy_device *phydev);
324
325 /* Clears up any memory if needed */
326 void (*remove)(struct phy_device *phydev);
327
328 struct device_driver driver;
329};
330#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
331
332int phy_read(struct phy_device *phydev, u16 regnum);
333int phy_write(struct phy_device *phydev, u16 regnum, u16 val);
334struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
335int phy_clear_interrupt(struct phy_device *phydev);
336int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
337struct phy_device * phy_attach(struct net_device *dev,
338 const char *phy_id, u32 flags);
339struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
340 void (*handler)(struct net_device *), u32 flags);
341void phy_disconnect(struct phy_device *phydev);
342void phy_detach(struct phy_device *phydev);
343void phy_start(struct phy_device *phydev);
344void phy_stop(struct phy_device *phydev);
345int phy_start_aneg(struct phy_device *phydev);
346
347int mdiobus_register(struct mii_bus *bus);
348void mdiobus_unregister(struct mii_bus *bus);
349void phy_sanitize_settings(struct phy_device *phydev);
350int phy_stop_interrupts(struct phy_device *phydev);
351
352static inline int phy_read_status(struct phy_device *phydev) {
353 return phydev->drv->read_status(phydev);
354}
355
356int genphy_config_advert(struct phy_device *phydev);
357int genphy_setup_forced(struct phy_device *phydev);
358int genphy_restart_aneg(struct phy_device *phydev);
359int genphy_config_aneg(struct phy_device *phydev);
360int genphy_update_link(struct phy_device *phydev);
361int genphy_read_status(struct phy_device *phydev);
362void phy_driver_unregister(struct phy_driver *drv);
363int phy_driver_register(struct phy_driver *new_driver);
364void phy_prepare_link(struct phy_device *phydev,
365 void (*adjust_link)(struct net_device *));
366void phy_start_machine(struct phy_device *phydev,
367 void (*handler)(struct net_device *));
368void phy_stop_machine(struct phy_device *phydev);
369int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
370int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
371int phy_mii_ioctl(struct phy_device *phydev,
372 struct mii_ioctl_data *mii_data, int cmd);
373int phy_start_interrupts(struct phy_device *phydev);
374void phy_print_status(struct phy_device *phydev);
375
376extern struct bus_type mdio_bus_type;
377#endif /* __PHY_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 36725e7c02c6..1767073df26f 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -39,9 +39,6 @@ struct pipe_inode_info {
39 39
40#define PIPE_SEM(inode) (&(inode).i_sem) 40#define PIPE_SEM(inode) (&(inode).i_sem)
41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait) 41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
42#define PIPE_BASE(inode) ((inode).i_pipe->base)
43#define PIPE_START(inode) ((inode).i_pipe->start)
44#define PIPE_LEN(inode) ((inode).i_pipe->len)
45#define PIPE_READERS(inode) ((inode).i_pipe->readers) 42#define PIPE_READERS(inode) ((inode).i_pipe->readers)
46#define PIPE_WRITERS(inode) ((inode).i_pipe->writers) 43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
47#define PIPE_WAITING_WRITERS(inode) ((inode).i_pipe->waiting_writers) 44#define PIPE_WAITING_WRITERS(inode) ((inode).i_pipe->waiting_writers)
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 7aeb208ed713..5cfb07648eca 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -186,7 +186,9 @@ extern int pm_suspend(suspend_state_t state);
186 186
187struct device; 187struct device;
188 188
189typedef u32 __bitwise pm_message_t; 189typedef struct pm_message {
190 int event;
191} pm_message_t;
190 192
191/* 193/*
192 * There are 4 important states driver can be in: 194 * There are 4 important states driver can be in:
@@ -207,9 +209,13 @@ typedef u32 __bitwise pm_message_t;
207 * or something similar soon. 209 * or something similar soon.
208 */ 210 */
209 211
210#define PMSG_FREEZE ((__force pm_message_t) 3) 212#define PM_EVENT_ON 0
211#define PMSG_SUSPEND ((__force pm_message_t) 3) 213#define PM_EVENT_FREEZE 1
212#define PMSG_ON ((__force pm_message_t) 0) 214#define PM_EVENT_SUSPEND 2
215
216#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
217#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
218#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
213 219
214struct dev_pm_info { 220struct dev_pm_info {
215 pm_message_t power_state; 221 pm_message_t power_state;
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 5ec2bd0c2848..aadbac29103c 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -443,7 +443,7 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; }
443#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) 443#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
444#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) 444#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg)
445 445
446#ifdef DEBUG 446#ifdef CONFIG_PNP_DEBUG
447#define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg) 447#define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg)
448#else 448#else
449#define pnp_dbg(format, arg...) do {} while (0) 449#define pnp_dbg(format, arg...) do {} while (0)
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index a373fc254df2..dc6f3647bfbc 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -20,6 +20,8 @@
20#define PTRACE_DETACH 0x11 20#define PTRACE_DETACH 0x11
21 21
22#define PTRACE_SYSCALL 24 22#define PTRACE_SYSCALL 24
23#define PTRACE_SYSEMU 31
24#define PTRACE_SYSEMU_SINGLESTEP 32
23 25
24/* 0x4200-0x4300 are reserved for architecture-independent additions. */ 26/* 0x4200-0x4300 are reserved for architecture-independent additions. */
25#define PTRACE_SETOPTIONS 0x4200 27#define PTRACE_SETOPTIONS 0x4200
@@ -88,6 +90,7 @@ extern void __ptrace_link(struct task_struct *child,
88 struct task_struct *new_parent); 90 struct task_struct *new_parent);
89extern void __ptrace_unlink(struct task_struct *child); 91extern void __ptrace_unlink(struct task_struct *child);
90extern void ptrace_untrace(struct task_struct *child); 92extern void ptrace_untrace(struct task_struct *child);
93extern int ptrace_may_attach(struct task_struct *task);
91 94
92static inline void ptrace_link(struct task_struct *child, 95static inline void ptrace_link(struct task_struct *child,
93 struct task_struct *new_parent) 96 struct task_struct *new_parent)
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
new file mode 100644
index 000000000000..a71123c28272
--- /dev/null
+++ b/include/linux/raid_class.h
@@ -0,0 +1,59 @@
1/*
2 */
3#include <linux/transport_class.h>
4
5struct raid_template {
6 struct transport_container raid_attrs;
7};
8
9struct raid_function_template {
10 void *cookie;
11 int (*is_raid)(struct device *);
12 void (*get_resync)(struct device *);
13 void (*get_state)(struct device *);
14};
15
16enum raid_state {
17 RAID_ACTIVE = 1,
18 RAID_DEGRADED,
19 RAID_RESYNCING,
20 RAID_OFFLINE,
21};
22
23struct raid_data {
24 struct list_head component_list;
25 int component_count;
26 int level;
27 enum raid_state state;
28 int resync;
29};
30
31#define DEFINE_RAID_ATTRIBUTE(type, attr) \
32static inline void \
33raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \
34 struct class_device *cdev = \
35 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
36 struct raid_data *rd; \
37 BUG_ON(!cdev); \
38 rd = class_get_devdata(cdev); \
39 rd->attr = value; \
40} \
41static inline type \
42raid_get_##attr(struct raid_template *r, struct device *dev) { \
43 struct class_device *cdev = \
44 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
45 struct raid_data *rd; \
46 BUG_ON(!cdev); \
47 rd = class_get_devdata(cdev); \
48 return rd->attr; \
49}
50
51DEFINE_RAID_ATTRIBUTE(int, level)
52DEFINE_RAID_ATTRIBUTE(int, resync)
53DEFINE_RAID_ATTRIBUTE(enum raid_state, state)
54
55struct raid_template *raid_class_attach(struct raid_function_template *);
56void raid_class_release(struct raid_template *);
57
58void raid_component_add(struct raid_template *, struct device *,
59 struct device *);
diff --git a/include/linux/random.h b/include/linux/random.h
index cc6703449916..7b2adb3322d5 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -59,6 +59,8 @@ extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
59 __u16 sport, __u16 dport); 59 __u16 sport, __u16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr,
61 __u16 sport, __u16 dport); 61 __u16 sport, __u16 dport);
62extern u64 secure_dccp_sequence_number(__u32 saddr, __u32 daddr,
63 __u16 sport, __u16 dport);
62 64
63#ifndef MODULE 65#ifndef MODULE
64extern struct file_operations random_fops, urandom_fops; 66extern struct file_operations random_fops, urandom_fops;
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
new file mode 100644
index 000000000000..cfafc3e76bc2
--- /dev/null
+++ b/include/linux/relayfs_fs.h
@@ -0,0 +1,255 @@
1/*
2 * linux/include/linux/relayfs_fs.h
3 *
4 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp
5 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com)
6 *
7 * RelayFS definitions and declarations
8 */
9
10#ifndef _LINUX_RELAYFS_FS_H
11#define _LINUX_RELAYFS_FS_H
12
13#include <linux/config.h>
14#include <linux/types.h>
15#include <linux/sched.h>
16#include <linux/wait.h>
17#include <linux/list.h>
18#include <linux/fs.h>
19#include <linux/poll.h>
20#include <linux/kref.h>
21
22/*
23 * Tracks changes to rchan_buf struct
24 */
25#define RELAYFS_CHANNEL_VERSION 5
26
27/*
28 * Per-cpu relay channel buffer
29 */
30struct rchan_buf
31{
32 void *start; /* start of channel buffer */
33 void *data; /* start of current sub-buffer */
34 size_t offset; /* current offset into sub-buffer */
35 size_t subbufs_produced; /* count of sub-buffers produced */
36 size_t subbufs_consumed; /* count of sub-buffers consumed */
37 struct rchan *chan; /* associated channel */
38 wait_queue_head_t read_wait; /* reader wait queue */
39 struct work_struct wake_readers; /* reader wake-up work struct */
40 struct dentry *dentry; /* channel file dentry */
41 struct kref kref; /* channel buffer refcount */
42 struct page **page_array; /* array of current buffer pages */
43 unsigned int page_count; /* number of current buffer pages */
44 unsigned int finalized; /* buffer has been finalized */
45 size_t *padding; /* padding counts per sub-buffer */
46 size_t prev_padding; /* temporary variable */
47 size_t bytes_consumed; /* bytes consumed in cur read subbuf */
48 unsigned int cpu; /* this buf's cpu */
49} ____cacheline_aligned;
50
51/*
52 * Relay channel data structure
53 */
54struct rchan
55{
56 u32 version; /* the version of this struct */
57 size_t subbuf_size; /* sub-buffer size */
58 size_t n_subbufs; /* number of sub-buffers per buffer */
59 size_t alloc_size; /* total buffer size allocated */
60 struct rchan_callbacks *cb; /* client callbacks */
61 struct kref kref; /* channel refcount */
62 void *private_data; /* for user-defined data */
63 struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */
64};
65
66/*
67 * Relayfs inode
68 */
69struct relayfs_inode_info
70{
71 struct inode vfs_inode;
72 struct rchan_buf *buf;
73};
74
75static inline struct relayfs_inode_info *RELAYFS_I(struct inode *inode)
76{
77 return container_of(inode, struct relayfs_inode_info, vfs_inode);
78}
79
80/*
81 * Relay channel client callbacks
82 */
83struct rchan_callbacks
84{
85 /*
86 * subbuf_start - called on buffer-switch to a new sub-buffer
87 * @buf: the channel buffer containing the new sub-buffer
88 * @subbuf: the start of the new sub-buffer
89 * @prev_subbuf: the start of the previous sub-buffer
90 * @prev_padding: unused space at the end of previous sub-buffer
91 *
92 * The client should return 1 to continue logging, 0 to stop
93 * logging.
94 *
95 * NOTE: subbuf_start will also be invoked when the buffer is
96 * created, so that the first sub-buffer can be initialized
97 * if necessary. In this case, prev_subbuf will be NULL.
98 *
99 * NOTE: the client can reserve bytes at the beginning of the new
100 * sub-buffer by calling subbuf_start_reserve() in this callback.
101 */
102 int (*subbuf_start) (struct rchan_buf *buf,
103 void *subbuf,
104 void *prev_subbuf,
105 size_t prev_padding);
106
107 /*
108 * buf_mapped - relayfs buffer mmap notification
109 * @buf: the channel buffer
110 * @filp: relayfs file pointer
111 *
112 * Called when a relayfs file is successfully mmapped
113 */
114 void (*buf_mapped)(struct rchan_buf *buf,
115 struct file *filp);
116
117 /*
118 * buf_unmapped - relayfs buffer unmap notification
119 * @buf: the channel buffer
120 * @filp: relayfs file pointer
121 *
122 * Called when a relayfs file is successfully unmapped
123 */
124 void (*buf_unmapped)(struct rchan_buf *buf,
125 struct file *filp);
126};
127
128/*
129 * relayfs kernel API, fs/relayfs/relay.c
130 */
131
132struct rchan *relay_open(const char *base_filename,
133 struct dentry *parent,
134 size_t subbuf_size,
135 size_t n_subbufs,
136 struct rchan_callbacks *cb);
137extern void relay_close(struct rchan *chan);
138extern void relay_flush(struct rchan *chan);
139extern void relay_subbufs_consumed(struct rchan *chan,
140 unsigned int cpu,
141 size_t consumed);
142extern void relay_reset(struct rchan *chan);
143extern int relay_buf_full(struct rchan_buf *buf);
144
145extern size_t relay_switch_subbuf(struct rchan_buf *buf,
146 size_t length);
147extern struct dentry *relayfs_create_dir(const char *name,
148 struct dentry *parent);
149extern int relayfs_remove_dir(struct dentry *dentry);
150
151/**
152 * relay_write - write data into the channel
153 * @chan: relay channel
154 * @data: data to be written
155 * @length: number of bytes to write
156 *
157 * Writes data into the current cpu's channel buffer.
158 *
159 * Protects the buffer by disabling interrupts. Use this
160 * if you might be logging from interrupt context. Try
161 * __relay_write() if you know you won't be logging from
162 * interrupt context.
163 */
164static inline void relay_write(struct rchan *chan,
165 const void *data,
166 size_t length)
167{
168 unsigned long flags;
169 struct rchan_buf *buf;
170
171 local_irq_save(flags);
172 buf = chan->buf[smp_processor_id()];
173 if (unlikely(buf->offset + length > chan->subbuf_size))
174 length = relay_switch_subbuf(buf, length);
175 memcpy(buf->data + buf->offset, data, length);
176 buf->offset += length;
177 local_irq_restore(flags);
178}
179
180/**
181 * __relay_write - write data into the channel
182 * @chan: relay channel
183 * @data: data to be written
184 * @length: number of bytes to write
185 *
186 * Writes data into the current cpu's channel buffer.
187 *
188 * Protects the buffer by disabling preemption. Use
189 * relay_write() if you might be logging from interrupt
190 * context.
191 */
192static inline void __relay_write(struct rchan *chan,
193 const void *data,
194 size_t length)
195{
196 struct rchan_buf *buf;
197
198 buf = chan->buf[get_cpu()];
199 if (unlikely(buf->offset + length > buf->chan->subbuf_size))
200 length = relay_switch_subbuf(buf, length);
201 memcpy(buf->data + buf->offset, data, length);
202 buf->offset += length;
203 put_cpu();
204}
205
206/**
207 * relay_reserve - reserve slot in channel buffer
208 * @chan: relay channel
209 * @length: number of bytes to reserve
210 *
211 * Returns pointer to reserved slot, NULL if full.
212 *
213 * Reserves a slot in the current cpu's channel buffer.
214 * Does not protect the buffer at all - caller must provide
215 * appropriate synchronization.
216 */
217static inline void *relay_reserve(struct rchan *chan, size_t length)
218{
219 void *reserved;
220 struct rchan_buf *buf = chan->buf[smp_processor_id()];
221
222 if (unlikely(buf->offset + length > buf->chan->subbuf_size)) {
223 length = relay_switch_subbuf(buf, length);
224 if (!length)
225 return NULL;
226 }
227 reserved = buf->data + buf->offset;
228 buf->offset += length;
229
230 return reserved;
231}
232
233/**
234 * subbuf_start_reserve - reserve bytes at the start of a sub-buffer
235 * @buf: relay channel buffer
236 * @length: number of bytes to reserve
237 *
238 * Helper function used to reserve bytes at the beginning of
239 * a sub-buffer in the subbuf_start() callback.
240 */
241static inline void subbuf_start_reserve(struct rchan_buf *buf,
242 size_t length)
243{
244 BUG_ON(length >= buf->chan->subbuf_size - 1);
245 buf->offset = length;
246}
247
248/*
249 * exported relayfs file operations, fs/relayfs/inode.c
250 */
251
252extern struct file_operations relayfs_file_operations;
253
254#endif /* _LINUX_RELAYFS_FS_H */
255
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 657c05ab8f9e..c231e9a08f0b 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -826,9 +826,8 @@ enum
826#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) 826#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
827#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) 827#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
828 828
829 829#ifndef __KERNEL__
830/* RTnetlink multicast groups */ 830/* RTnetlink multicast groups - backwards compatibility for userspace */
831
832#define RTMGRP_LINK 1 831#define RTMGRP_LINK 1
833#define RTMGRP_NOTIFY 2 832#define RTMGRP_NOTIFY 2
834#define RTMGRP_NEIGH 4 833#define RTMGRP_NEIGH 4
@@ -847,6 +846,43 @@ enum
847#define RTMGRP_DECnet_ROUTE 0x4000 846#define RTMGRP_DECnet_ROUTE 0x4000
848 847
849#define RTMGRP_IPV6_PREFIX 0x20000 848#define RTMGRP_IPV6_PREFIX 0x20000
849#endif
850
851/* RTnetlink multicast groups */
852enum rtnetlink_groups {
853 RTNLGRP_NONE,
854#define RTNLGRP_NONE RTNLGRP_NONE
855 RTNLGRP_LINK,
856#define RTNLGRP_LINK RTNLGRP_LINK
857 RTNLGRP_NOTIFY,
858#define RTNLGRP_NOTIFY RTNLGRP_NOTIFY
859 RTNLGRP_NEIGH,
860#define RTNLGRP_NEIGH RTNLGRP_NEIGH
861 RTNLGRP_TC,
862#define RTNLGRP_TC RTNLGRP_TC
863 RTNLGRP_IPV4_IFADDR,
864#define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR
865 RTNLGRP_IPV4_MROUTE,
866#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
867 RTNLGRP_IPV4_ROUTE,
868#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
869 RTNLGRP_IPV6_IFADDR,
870#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
871 RTNLGRP_IPV6_MROUTE,
872#define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE
873 RTNLGRP_IPV6_ROUTE,
874#define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE
875 RTNLGRP_IPV6_IFINFO,
876#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO
877 RTNLGRP_DECnet_IFADDR,
878#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR
879 RTNLGRP_DECnet_ROUTE,
880#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
881 RTNLGRP_IPV6_PREFIX,
882#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
883 __RTNLGRP_MAX
884};
885#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
850 886
851/* TC action piece */ 887/* TC action piece */
852struct tcamsg 888struct tcamsg
diff --git a/include/linux/sched.h b/include/linux/sched.h
index dec5827c7742..ea1b5f32ec5c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -35,6 +35,8 @@
35#include <linux/topology.h> 35#include <linux/topology.h>
36#include <linux/seccomp.h> 36#include <linux/seccomp.h>
37 37
38#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
39
38struct exec_domain; 40struct exec_domain;
39 41
40/* 42/*
@@ -176,6 +178,23 @@ extern void trap_init(void);
176extern void update_process_times(int user); 178extern void update_process_times(int user);
177extern void scheduler_tick(void); 179extern void scheduler_tick(void);
178 180
181#ifdef CONFIG_DETECT_SOFTLOCKUP
182extern void softlockup_tick(struct pt_regs *regs);
183extern void spawn_softlockup_task(void);
184extern void touch_softlockup_watchdog(void);
185#else
186static inline void softlockup_tick(struct pt_regs *regs)
187{
188}
189static inline void spawn_softlockup_task(void)
190{
191}
192static inline void touch_softlockup_watchdog(void)
193{
194}
195#endif
196
197
179/* Attach to any functions which should be ignored in wchan output. */ 198/* Attach to any functions which should be ignored in wchan output. */
180#define __sched __attribute__((__section__(".sched.text"))) 199#define __sched __attribute__((__section__(".sched.text")))
181/* Is this address in the __sched functions? */ 200/* Is this address in the __sched functions? */
@@ -244,7 +263,7 @@ struct mm_struct {
244 mm_counter_t _rss; 263 mm_counter_t _rss;
245 mm_counter_t _anon_rss; 264 mm_counter_t _anon_rss;
246 265
247 unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ 266 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
248 267
249 unsigned dumpable:2; 268 unsigned dumpable:2;
250 cpumask_t cpu_vm_mask; 269 cpumask_t cpu_vm_mask;
@@ -545,13 +564,6 @@ struct sched_domain {
545 564
546extern void partition_sched_domains(cpumask_t *partition1, 565extern void partition_sched_domains(cpumask_t *partition1,
547 cpumask_t *partition2); 566 cpumask_t *partition2);
548#ifdef ARCH_HAS_SCHED_DOMAIN
549/* Useful helpers that arch setup code may use. Defined in kernel/sched.c */
550extern cpumask_t cpu_isolated_map;
551extern void init_sched_build_groups(struct sched_group groups[],
552 cpumask_t span, int (*group_fn)(int cpu));
553extern void cpu_attach_domain(struct sched_domain *sd, int cpu);
554#endif /* ARCH_HAS_SCHED_DOMAIN */
555#endif /* CONFIG_SMP */ 567#endif /* CONFIG_SMP */
556 568
557 569
diff --git a/include/linux/security.h b/include/linux/security.h
index b42095a68b1c..7aab6ab7c57f 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -2727,7 +2727,8 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o
2727 return security_ops->socket_getpeersec(sock, optval, optlen, len); 2727 return security_ops->socket_getpeersec(sock, optval, optlen, len);
2728} 2728}
2729 2729
2730static inline int security_sk_alloc(struct sock *sk, int family, int priority) 2730static inline int security_sk_alloc(struct sock *sk, int family,
2731 unsigned int __nocast priority)
2731{ 2732{
2732 return security_ops->sk_alloc_security(sk, family, priority); 2733 return security_ops->sk_alloc_security(sk, family, priority);
2733} 2734}
@@ -2844,7 +2845,8 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o
2844 return -ENOPROTOOPT; 2845 return -ENOPROTOOPT;
2845} 2846}
2846 2847
2847static inline int security_sk_alloc(struct sock *sk, int family, int priority) 2848static inline int security_sk_alloc(struct sock *sk, int family,
2849 unsigned int __nocast priority)
2848{ 2850{
2849 return 0; 2851 return 0;
2850} 2852}
diff --git a/include/linux/selinux_netlink.h b/include/linux/selinux_netlink.h
index 957e6ebca4e6..bbf489decd84 100644
--- a/include/linux/selinux_netlink.h
+++ b/include/linux/selinux_netlink.h
@@ -20,10 +20,21 @@ enum {
20 SELNL_MSG_MAX 20 SELNL_MSG_MAX
21}; 21};
22 22
23/* Multicast groups */ 23#ifndef __KERNEL__
24/* Multicast groups - backwards compatiblility for userspace */
24#define SELNL_GRP_NONE 0x00000000 25#define SELNL_GRP_NONE 0x00000000
25#define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ 26#define SELNL_GRP_AVC 0x00000001 /* AVC notifications */
26#define SELNL_GRP_ALL 0xffffffff 27#define SELNL_GRP_ALL 0xffffffff
28#endif
29
30enum selinux_nlgroups {
31 SELNLGRP_NONE,
32#define SELNLGRP_NONE SELNLGRP_NONE
33 SELNLGRP_AVC,
34#define SELNLGRP_AVC SELNLGRP_AVC
35 __SELNLGRP_MAX
36};
37#define SELNLGRP_MAX (__SELNLGRP_MAX - 1)
27 38
28/* Message structures */ 39/* Message structures */
29struct selnl_msg_setenforce { 40struct selnl_msg_setenforce {
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 2d8516be9fd7..106f9757339a 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -88,6 +88,7 @@ struct sem {
88/* One sem_array data structure for each set of semaphores in the system. */ 88/* One sem_array data structure for each set of semaphores in the system. */
89struct sem_array { 89struct sem_array {
90 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */ 90 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */
91 int sem_id;
91 time_t sem_otime; /* last semop time */ 92 time_t sem_otime; /* last semop time */
92 time_t sem_ctime; /* last change time */ 93 time_t sem_ctime; /* last change time */
93 struct sem *sem_base; /* ptr to first semaphore in array */ 94 struct sem *sem_base; /* ptr to first semaphore in array */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 9f2d85284d0b..12cd9cf65e8f 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -176,10 +176,6 @@ struct serial_icounter_struct {
176#ifdef __KERNEL__ 176#ifdef __KERNEL__
177#include <linux/compiler.h> 177#include <linux/compiler.h>
178 178
179/* Export to allow PCMCIA to use this - Dave Hinds */
180extern int __deprecated register_serial(struct serial_struct *req);
181extern void __deprecated unregister_serial(int line);
182
183/* Allow architectures to override entries in serial8250_ports[] at run time: */ 179/* Allow architectures to override entries in serial8250_ports[] at run time: */
184struct uart_port; /* forward declaration */ 180struct uart_port; /* forward declaration */
185extern int early_serial_setup(struct uart_port *port); 181extern int early_serial_setup(struct uart_port *port);
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
index 2b2f35a64d75..2b9e6b9554d5 100644
--- a/include/linux/serialP.h
+++ b/include/linux/serialP.h
@@ -140,44 +140,4 @@ struct rs_multiport_struct {
140#define ALPHA_KLUDGE_MCR 0 140#define ALPHA_KLUDGE_MCR 0
141#endif 141#endif
142 142
143/*
144 * Definitions for PCI support.
145 */
146#define SPCI_FL_BASE_MASK 0x0007
147#define SPCI_FL_BASE0 0x0000
148#define SPCI_FL_BASE1 0x0001
149#define SPCI_FL_BASE2 0x0002
150#define SPCI_FL_BASE3 0x0003
151#define SPCI_FL_BASE4 0x0004
152#define SPCI_FL_GET_BASE(x) (x & SPCI_FL_BASE_MASK)
153
154#define SPCI_FL_IRQ_MASK (0x0007 << 4)
155#define SPCI_FL_IRQBASE0 (0x0000 << 4)
156#define SPCI_FL_IRQBASE1 (0x0001 << 4)
157#define SPCI_FL_IRQBASE2 (0x0002 << 4)
158#define SPCI_FL_IRQBASE3 (0x0003 << 4)
159#define SPCI_FL_IRQBASE4 (0x0004 << 4)
160#define SPCI_FL_GET_IRQBASE(x) ((x & SPCI_FL_IRQ_MASK) >> 4)
161
162/* Use successive BARs (PCI base address registers),
163 else use offset into some specified BAR */
164#define SPCI_FL_BASE_TABLE 0x0100
165
166/* Use successive entries in the irq resource table */
167#define SPCI_FL_IRQ_TABLE 0x0200
168
169/* Use the irq resource table instead of dev->irq */
170#define SPCI_FL_IRQRESOURCE 0x0400
171
172/* Use the Base address register size to cap number of ports */
173#define SPCI_FL_REGION_SZ_CAP 0x0800
174
175/* Do not use irq sharing for this device */
176#define SPCI_FL_NO_SHIRQ 0x1000
177
178/* This is a PNP device */
179#define SPCI_FL_ISPNP 0x2000
180
181#define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE|SPCI_FL_ISPNP)
182
183#endif /* _LINUX_SERIAL_H */ 143#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 3e3c1fa35b06..d8a023d804d4 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -14,6 +14,9 @@
14#include <linux/serial_core.h> 14#include <linux/serial_core.h>
15#include <linux/device.h> 15#include <linux/device.h>
16 16
17/*
18 * This is the platform device platform_data structure
19 */
17struct plat_serial8250_port { 20struct plat_serial8250_port {
18 unsigned long iobase; /* io base address */ 21 unsigned long iobase; /* io base address */
19 void __iomem *membase; /* ioremap cookie or NULL */ 22 void __iomem *membase; /* ioremap cookie or NULL */
@@ -26,4 +29,17 @@ struct plat_serial8250_port {
26 unsigned int flags; /* UPF_* flags */ 29 unsigned int flags; /* UPF_* flags */
27}; 30};
28 31
32/*
33 * This should be used by drivers which want to register
34 * their own 8250 ports without registering their own
35 * platform device. Using these will make your driver
36 * dependent on the 8250 driver.
37 */
38struct uart_port;
39
40int serial8250_register_port(struct uart_port *);
41void serial8250_unregister_port(int line);
42void serial8250_suspend_port(int line);
43void serial8250_resume_port(int line);
44
29#endif 45#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f6fca8f2f3ca..9b12fe731612 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -142,8 +142,8 @@ struct uart_ops {
142 unsigned int (*tx_empty)(struct uart_port *); 142 unsigned int (*tx_empty)(struct uart_port *);
143 void (*set_mctrl)(struct uart_port *, unsigned int mctrl); 143 void (*set_mctrl)(struct uart_port *, unsigned int mctrl);
144 unsigned int (*get_mctrl)(struct uart_port *); 144 unsigned int (*get_mctrl)(struct uart_port *);
145 void (*stop_tx)(struct uart_port *, unsigned int tty_stop); 145 void (*stop_tx)(struct uart_port *);
146 void (*start_tx)(struct uart_port *, unsigned int tty_start); 146 void (*start_tx)(struct uart_port *);
147 void (*send_xchar)(struct uart_port *, char ch); 147 void (*send_xchar)(struct uart_port *, char ch);
148 void (*stop_rx)(struct uart_port *); 148 void (*stop_rx)(struct uart_port *);
149 void (*enable_ms)(struct uart_port *); 149 void (*enable_ms)(struct uart_port *);
@@ -360,8 +360,6 @@ struct tty_driver *uart_console_device(struct console *co, int *index);
360 */ 360 */
361int uart_register_driver(struct uart_driver *uart); 361int uart_register_driver(struct uart_driver *uart);
362void uart_unregister_driver(struct uart_driver *uart); 362void uart_unregister_driver(struct uart_driver *uart);
363void __deprecated uart_unregister_port(struct uart_driver *reg, int line);
364int __deprecated uart_register_port(struct uart_driver *reg, struct uart_port *port);
365int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); 363int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
366int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); 364int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
367int uart_match_port(struct uart_port *port1, struct uart_port *port2); 365int uart_match_port(struct uart_port *port1, struct uart_port *port2);
@@ -387,11 +385,11 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
387/* 385/*
388 * The following are helper functions for the low level drivers. 386 * The following are helper functions for the low level drivers.
389 */ 387 */
390#ifdef SUPPORT_SYSRQ
391static inline int 388static inline int
392uart_handle_sysrq_char(struct uart_port *port, unsigned int ch, 389uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
393 struct pt_regs *regs) 390 struct pt_regs *regs)
394{ 391{
392#ifdef SUPPORT_SYSRQ
395 if (port->sysrq) { 393 if (port->sysrq) {
396 if (ch && time_before(jiffies, port->sysrq)) { 394 if (ch && time_before(jiffies, port->sysrq)) {
397 handle_sysrq(ch, regs, NULL); 395 handle_sysrq(ch, regs, NULL);
@@ -400,11 +398,9 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
400 } 398 }
401 port->sysrq = 0; 399 port->sysrq = 0;
402 } 400 }
401#endif
403 return 0; 402 return 0;
404} 403}
405#else
406#define uart_handle_sysrq_char(port,ch,regs) (0)
407#endif
408 404
409/* 405/*
410 * We do the SysRQ and SAK checking like this... 406 * We do the SysRQ and SAK checking like this...
@@ -468,13 +464,13 @@ uart_handle_cts_change(struct uart_port *port, unsigned int status)
468 if (tty->hw_stopped) { 464 if (tty->hw_stopped) {
469 if (status) { 465 if (status) {
470 tty->hw_stopped = 0; 466 tty->hw_stopped = 0;
471 port->ops->start_tx(port, 0); 467 port->ops->start_tx(port);
472 uart_write_wakeup(port); 468 uart_write_wakeup(port);
473 } 469 }
474 } else { 470 } else {
475 if (!status) { 471 if (!status) {
476 tty->hw_stopped = 1; 472 tty->hw_stopped = 1;
477 port->ops->stop_tx(port, 0); 473 port->ops->stop_tx(port);
478 } 474 }
479 } 475 }
480 } 476 }
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0061c9470482..da7da9c0ed1b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -155,16 +155,29 @@ struct skb_shared_info {
155#define SKB_DATAREF_SHIFT 16 155#define SKB_DATAREF_SHIFT 16
156#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 156#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
157 157
158extern struct timeval skb_tv_base;
159
160struct skb_timeval {
161 u32 off_sec;
162 u32 off_usec;
163};
164
165
166enum {
167 SKB_FCLONE_UNAVAILABLE,
168 SKB_FCLONE_ORIG,
169 SKB_FCLONE_CLONE,
170};
171
158/** 172/**
159 * struct sk_buff - socket buffer 173 * struct sk_buff - socket buffer
160 * @next: Next buffer in list 174 * @next: Next buffer in list
161 * @prev: Previous buffer in list 175 * @prev: Previous buffer in list
162 * @list: List we are on 176 * @list: List we are on
163 * @sk: Socket we are owned by 177 * @sk: Socket we are owned by
164 * @stamp: Time we arrived 178 * @tstamp: Time we arrived stored as offset to skb_tv_base
165 * @dev: Device we arrived on/are leaving by 179 * @dev: Device we arrived on/are leaving by
166 * @input_dev: Device we arrived on 180 * @input_dev: Device we arrived on
167 * @real_dev: The real device we are using
168 * @h: Transport layer header 181 * @h: Transport layer header
169 * @nh: Network layer header 182 * @nh: Network layer header
170 * @mac: Link layer header 183 * @mac: Link layer header
@@ -190,14 +203,11 @@ struct skb_shared_info {
190 * @end: End pointer 203 * @end: End pointer
191 * @destructor: Destruct function 204 * @destructor: Destruct function
192 * @nfmark: Can be used for communication between hooks 205 * @nfmark: Can be used for communication between hooks
193 * @nfcache: Cache info
194 * @nfct: Associated connection, if any 206 * @nfct: Associated connection, if any
195 * @nfctinfo: Relationship of this skb to the connection 207 * @nfctinfo: Relationship of this skb to the connection
196 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 208 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
197 * @private: Data which is private to the HIPPI implementation
198 * @tc_index: Traffic control index 209 * @tc_index: Traffic control index
199 * @tc_verd: traffic control verdict 210 * @tc_verd: traffic control verdict
200 * @tc_classid: traffic control classid
201 */ 211 */
202 212
203struct sk_buff { 213struct sk_buff {
@@ -205,12 +215,10 @@ struct sk_buff {
205 struct sk_buff *next; 215 struct sk_buff *next;
206 struct sk_buff *prev; 216 struct sk_buff *prev;
207 217
208 struct sk_buff_head *list;
209 struct sock *sk; 218 struct sock *sk;
210 struct timeval stamp; 219 struct skb_timeval tstamp;
211 struct net_device *dev; 220 struct net_device *dev;
212 struct net_device *input_dev; 221 struct net_device *input_dev;
213 struct net_device *real_dev;
214 222
215 union { 223 union {
216 struct tcphdr *th; 224 struct tcphdr *th;
@@ -252,33 +260,28 @@ struct sk_buff {
252 __u8 local_df:1, 260 __u8 local_df:1,
253 cloned:1, 261 cloned:1,
254 ip_summed:2, 262 ip_summed:2,
255 nohdr:1; 263 nohdr:1,
256 /* 3 bits spare */ 264 nfctinfo:3;
257 __u8 pkt_type; 265 __u8 pkt_type:3,
258 __u16 protocol; 266 fclone:2;
267 __be16 protocol;
259 268
260 void (*destructor)(struct sk_buff *skb); 269 void (*destructor)(struct sk_buff *skb);
261#ifdef CONFIG_NETFILTER 270#ifdef CONFIG_NETFILTER
262 unsigned long nfmark; 271 __u32 nfmark;
263 __u32 nfcache;
264 __u32 nfctinfo;
265 struct nf_conntrack *nfct; 272 struct nf_conntrack *nfct;
273#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
274 __u8 ipvs_property:1;
275#endif
266#ifdef CONFIG_BRIDGE_NETFILTER 276#ifdef CONFIG_BRIDGE_NETFILTER
267 struct nf_bridge_info *nf_bridge; 277 struct nf_bridge_info *nf_bridge;
268#endif 278#endif
269#endif /* CONFIG_NETFILTER */ 279#endif /* CONFIG_NETFILTER */
270#if defined(CONFIG_HIPPI)
271 union {
272 __u32 ifield;
273 } private;
274#endif
275#ifdef CONFIG_NET_SCHED 280#ifdef CONFIG_NET_SCHED
276 __u32 tc_index; /* traffic control index */ 281 __u16 tc_index; /* traffic control index */
277#ifdef CONFIG_NET_CLS_ACT 282#ifdef CONFIG_NET_CLS_ACT
278 __u32 tc_verd; /* traffic control verdict */ 283 __u16 tc_verd; /* traffic control verdict */
279 __u32 tc_classid; /* traffic control classid */
280#endif 284#endif
281
282#endif 285#endif
283 286
284 287
@@ -300,8 +303,20 @@ struct sk_buff {
300#include <asm/system.h> 303#include <asm/system.h>
301 304
302extern void __kfree_skb(struct sk_buff *skb); 305extern void __kfree_skb(struct sk_buff *skb);
303extern struct sk_buff *alloc_skb(unsigned int size, 306extern struct sk_buff *__alloc_skb(unsigned int size,
304 unsigned int __nocast priority); 307 unsigned int __nocast priority, int fclone);
308static inline struct sk_buff *alloc_skb(unsigned int size,
309 unsigned int __nocast priority)
310{
311 return __alloc_skb(size, priority, 0);
312}
313
314static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
315 unsigned int __nocast priority)
316{
317 return __alloc_skb(size, priority, 1);
318}
319
305extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 320extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
306 unsigned int size, 321 unsigned int size,
307 unsigned int __nocast priority); 322 unsigned int __nocast priority);
@@ -597,7 +612,6 @@ static inline void __skb_queue_head(struct sk_buff_head *list,
597{ 612{
598 struct sk_buff *prev, *next; 613 struct sk_buff *prev, *next;
599 614
600 newsk->list = list;
601 list->qlen++; 615 list->qlen++;
602 prev = (struct sk_buff *)list; 616 prev = (struct sk_buff *)list;
603 next = prev->next; 617 next = prev->next;
@@ -622,7 +636,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list,
622{ 636{
623 struct sk_buff *prev, *next; 637 struct sk_buff *prev, *next;
624 638
625 newsk->list = list;
626 list->qlen++; 639 list->qlen++;
627 next = (struct sk_buff *)list; 640 next = (struct sk_buff *)list;
628 prev = next->prev; 641 prev = next->prev;
@@ -655,7 +668,6 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
655 next->prev = prev; 668 next->prev = prev;
656 prev->next = next; 669 prev->next = next;
657 result->next = result->prev = NULL; 670 result->next = result->prev = NULL;
658 result->list = NULL;
659 } 671 }
660 return result; 672 return result;
661} 673}
@@ -664,7 +676,7 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
664/* 676/*
665 * Insert a packet on a list. 677 * Insert a packet on a list.
666 */ 678 */
667extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk); 679extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
668static inline void __skb_insert(struct sk_buff *newsk, 680static inline void __skb_insert(struct sk_buff *newsk,
669 struct sk_buff *prev, struct sk_buff *next, 681 struct sk_buff *prev, struct sk_buff *next,
670 struct sk_buff_head *list) 682 struct sk_buff_head *list)
@@ -672,24 +684,23 @@ static inline void __skb_insert(struct sk_buff *newsk,
672 newsk->next = next; 684 newsk->next = next;
673 newsk->prev = prev; 685 newsk->prev = prev;
674 next->prev = prev->next = newsk; 686 next->prev = prev->next = newsk;
675 newsk->list = list;
676 list->qlen++; 687 list->qlen++;
677} 688}
678 689
679/* 690/*
680 * Place a packet after a given packet in a list. 691 * Place a packet after a given packet in a list.
681 */ 692 */
682extern void skb_append(struct sk_buff *old, struct sk_buff *newsk); 693extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
683static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk) 694static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
684{ 695{
685 __skb_insert(newsk, old, old->next, old->list); 696 __skb_insert(newsk, old, old->next, list);
686} 697}
687 698
688/* 699/*
689 * remove sk_buff from list. _Must_ be called atomically, and with 700 * remove sk_buff from list. _Must_ be called atomically, and with
690 * the list known.. 701 * the list known..
691 */ 702 */
692extern void skb_unlink(struct sk_buff *skb); 703extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
693static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) 704static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
694{ 705{
695 struct sk_buff *next, *prev; 706 struct sk_buff *next, *prev;
@@ -698,7 +709,6 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
698 next = skb->next; 709 next = skb->next;
699 prev = skb->prev; 710 prev = skb->prev;
700 skb->next = skb->prev = NULL; 711 skb->next = skb->prev = NULL;
701 skb->list = NULL;
702 next->prev = prev; 712 next->prev = prev;
703 prev->next = next; 713 prev->next = next;
704} 714}
@@ -1213,6 +1223,8 @@ extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1213extern void skb_split(struct sk_buff *skb, 1223extern void skb_split(struct sk_buff *skb,
1214 struct sk_buff *skb1, const u32 len); 1224 struct sk_buff *skb1, const u32 len);
1215 1225
1226extern void skb_release_data(struct sk_buff *skb);
1227
1216static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1228static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1217 int len, void *buffer) 1229 int len, void *buffer)
1218{ 1230{
@@ -1230,6 +1242,42 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1230extern void skb_init(void); 1242extern void skb_init(void);
1231extern void skb_add_mtu(int mtu); 1243extern void skb_add_mtu(int mtu);
1232 1244
1245/**
1246 * skb_get_timestamp - get timestamp from a skb
1247 * @skb: skb to get stamp from
1248 * @stamp: pointer to struct timeval to store stamp in
1249 *
1250 * Timestamps are stored in the skb as offsets to a base timestamp.
1251 * This function converts the offset back to a struct timeval and stores
1252 * it in stamp.
1253 */
1254static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
1255{
1256 stamp->tv_sec = skb->tstamp.off_sec;
1257 stamp->tv_usec = skb->tstamp.off_usec;
1258 if (skb->tstamp.off_sec) {
1259 stamp->tv_sec += skb_tv_base.tv_sec;
1260 stamp->tv_usec += skb_tv_base.tv_usec;
1261 }
1262}
1263
1264/**
1265 * skb_set_timestamp - set timestamp of a skb
1266 * @skb: skb to set stamp of
1267 * @stamp: pointer to struct timeval to get stamp from
1268 *
1269 * Timestamps are stored in the skb as offsets to a base timestamp.
1270 * This function converts a struct timeval to an offset and stores
1271 * it in the skb.
1272 */
1273static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
1274{
1275 skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec;
1276 skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec;
1277}
1278
1279extern void __net_timestamp(struct sk_buff *skb);
1280
1233#ifdef CONFIG_NETFILTER 1281#ifdef CONFIG_NETFILTER
1234static inline void nf_conntrack_put(struct nf_conntrack *nfct) 1282static inline void nf_conntrack_put(struct nf_conntrack *nfct)
1235{ 1283{
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 80b2dfde2e80..42a6bea58af3 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -99,7 +99,21 @@ found:
99 return __kmalloc(size, flags); 99 return __kmalloc(size, flags);
100} 100}
101 101
102extern void *kcalloc(size_t, size_t, unsigned int __nocast); 102extern void *kzalloc(size_t, unsigned int __nocast);
103
104/**
105 * kcalloc - allocate memory for an array. The memory is set to zero.
106 * @n: number of elements.
107 * @size: element size.
108 * @flags: the type of memory to allocate.
109 */
110static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags)
111{
112 if (n != 0 && size > INT_MAX / n)
113 return NULL;
114 return kzalloc(n * size, flags);
115}
116
103extern void kfree(const void *); 117extern void kfree(const void *);
104extern unsigned int ksize(const void *); 118extern unsigned int ksize(const void *);
105 119
diff --git a/include/linux/socket.h b/include/linux/socket.h
index a5c7d96e4d2e..1739c2d5b95b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -26,6 +26,13 @@ struct __kernel_sockaddr_storage {
26#include <linux/types.h> /* pid_t */ 26#include <linux/types.h> /* pid_t */
27#include <linux/compiler.h> /* __user */ 27#include <linux/compiler.h> /* __user */
28 28
29extern int sysctl_somaxconn;
30extern void sock_init(void);
31#ifdef CONFIG_PROC_FS
32struct seq_file;
33extern void socket_seq_show(struct seq_file *seq);
34#endif
35
29typedef unsigned short sa_family_t; 36typedef unsigned short sa_family_t;
30 37
31/* 38/*
@@ -271,6 +278,8 @@ struct ucred {
271#define SOL_IRDA 266 278#define SOL_IRDA 266
272#define SOL_NETBEUI 267 279#define SOL_NETBEUI 267
273#define SOL_LLC 268 280#define SOL_LLC 268
281#define SOL_DCCP 269
282#define SOL_NETLINK 270
274 283
275/* IPX options */ 284/* IPX options */
276#define IPX_TYPE 1 285#define IPX_TYPE 1
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 768cbba617d0..f56d24734950 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -99,6 +99,8 @@
99#define SONYPI_EVENT_BATTERY_INSERT 57 99#define SONYPI_EVENT_BATTERY_INSERT 57
100#define SONYPI_EVENT_BATTERY_REMOVE 58 100#define SONYPI_EVENT_BATTERY_REMOVE 58
101#define SONYPI_EVENT_FNKEY_RELEASED 59 101#define SONYPI_EVENT_FNKEY_RELEASED 59
102#define SONYPI_EVENT_WIRELESS_ON 60
103#define SONYPI_EVENT_WIRELESS_OFF 61
102 104
103/* get/set brightness */ 105/* get/set brightness */
104#define SONYPI_IOCGBRT _IOR('v', 0, __u8) 106#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 428f59794f48..72b9af4c3fd4 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -29,7 +29,9 @@
29 * Sound core interface functions 29 * Sound core interface functions
30 */ 30 */
31 31
32struct device;
32extern int register_sound_special(struct file_operations *fops, int unit); 33extern int register_sound_special(struct file_operations *fops, int unit);
34extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev);
33extern int register_sound_mixer(struct file_operations *fops, int dev); 35extern int register_sound_mixer(struct file_operations *fops, int dev);
34extern int register_sound_midi(struct file_operations *fops, int dev); 36extern int register_sound_midi(struct file_operations *fops, int dev);
35extern int register_sound_dsp(struct file_operations *fops, int dev); 37extern int register_sound_dsp(struct file_operations *fops, int dev);
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6864063d1b9f..c4e3ea7cf154 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -60,6 +60,7 @@ struct cache_head {
60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
61 61
62struct cache_detail { 62struct cache_detail {
63 struct module * owner;
63 int hash_size; 64 int hash_size;
64 struct cache_head ** hash_table; 65 struct cache_head ** hash_table;
65 rwlock_t hash_lock; 66 rwlock_t hash_lock;
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 34ec3e8d99b3..23448d0fb5bc 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -177,6 +177,7 @@ typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem);
177struct xdr_array2_desc { 177struct xdr_array2_desc {
178 unsigned int elem_size; 178 unsigned int elem_size;
179 unsigned int array_len; 179 unsigned int array_len;
180 unsigned int array_maxlen;
180 xdr_xcode_elem_t xcode; 181 xdr_xcode_elem_t xcode;
181}; 182};
182 183
diff --git a/include/linux/swap.h b/include/linux/swap.h
index bfe3e763ccf2..3c9ff0048153 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -107,6 +107,8 @@ enum {
107 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ 107 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
108 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ 108 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
109 SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), 109 SWP_ACTIVE = (SWP_USED | SWP_WRITEOK),
110 /* add others here before... */
111 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
110}; 112};
111 113
112#define SWAP_CLUSTER_MAX 32 114#define SWAP_CLUSTER_MAX 32
@@ -116,16 +118,13 @@ enum {
116 118
117/* 119/*
118 * The in-memory structure used to track swap areas. 120 * The in-memory structure used to track swap areas.
119 * extent_list.prev points at the lowest-index extent. That list is
120 * sorted.
121 */ 121 */
122struct swap_info_struct { 122struct swap_info_struct {
123 unsigned int flags; 123 unsigned int flags;
124 spinlock_t sdev_lock; 124 int prio; /* swap priority */
125 struct file *swap_file; 125 struct file *swap_file;
126 struct block_device *bdev; 126 struct block_device *bdev;
127 struct list_head extent_list; 127 struct list_head extent_list;
128 int nr_extents;
129 struct swap_extent *curr_swap_extent; 128 struct swap_extent *curr_swap_extent;
130 unsigned old_block_size; 129 unsigned old_block_size;
131 unsigned short * swap_map; 130 unsigned short * swap_map;
@@ -133,10 +132,9 @@ struct swap_info_struct {
133 unsigned int highest_bit; 132 unsigned int highest_bit;
134 unsigned int cluster_next; 133 unsigned int cluster_next;
135 unsigned int cluster_nr; 134 unsigned int cluster_nr;
136 int prio; /* swap priority */ 135 unsigned int pages;
137 int pages; 136 unsigned int max;
138 unsigned long max; 137 unsigned int inuse_pages;
139 unsigned long inuse_pages;
140 int next; /* next entry on swap list */ 138 int next; /* next entry on swap list */
141}; 139};
142 140
@@ -222,13 +220,7 @@ extern int can_share_swap_page(struct page *);
222extern int remove_exclusive_swap_page(struct page *); 220extern int remove_exclusive_swap_page(struct page *);
223struct backing_dev_info; 221struct backing_dev_info;
224 222
225extern struct swap_list_t swap_list; 223extern spinlock_t swap_lock;
226extern spinlock_t swaplock;
227
228#define swap_list_lock() spin_lock(&swaplock)
229#define swap_list_unlock() spin_unlock(&swaplock)
230#define swap_device_lock(p) spin_lock(&p->sdev_lock)
231#define swap_device_unlock(p) spin_unlock(&p->sdev_lock)
232 224
233/* linux/mm/thrash.c */ 225/* linux/mm/thrash.c */
234extern struct mm_struct * swap_token_mm; 226extern struct mm_struct * swap_token_mm;
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index d4c7db35e708..87b9d14c710d 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -4,7 +4,7 @@
4 * the low-order bits. 4 * the low-order bits.
5 * 5 *
6 * We arrange the `type' and `offset' fields so that `type' is at the five 6 * We arrange the `type' and `offset' fields so that `type' is at the five
7 * high-order bits of the smp_entry_t and `offset' is right-aligned in the 7 * high-order bits of the swp_entry_t and `offset' is right-aligned in the
8 * remaining bits. 8 * remaining bits.
9 * 9 *
10 * swp_entry_t's are *never* stored anywhere in their arch-dependent format. 10 * swp_entry_t's are *never* stored anywhere in their arch-dependent format.
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e82be96d4906..532a6c5c24e9 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -711,6 +711,7 @@ enum {
711 DEV_RAID=4, 711 DEV_RAID=4,
712 DEV_MAC_HID=5, 712 DEV_MAC_HID=5,
713 DEV_SCSI=6, 713 DEV_SCSI=6,
714 DEV_IPMI=7,
714}; 715};
715 716
716/* /proc/sys/dev/cdrom */ 717/* /proc/sys/dev/cdrom */
@@ -776,6 +777,11 @@ enum {
776 DEV_SCSI_LOGGING_LEVEL=1, 777 DEV_SCSI_LOGGING_LEVEL=1,
777}; 778};
778 779
780/* /proc/sys/dev/ipmi */
781enum {
782 DEV_IPMI_POWEROFF_POWERCYCLE=1,
783};
784
779/* /proc/sys/abi */ 785/* /proc/sys/abi */
780enum 786enum
781{ 787{
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index e4fd82e42104..ac4ca44c75ca 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -55,24 +55,6 @@ struct tcphdr {
55 __u16 urg_ptr; 55 __u16 urg_ptr;
56}; 56};
57 57
58
59enum {
60 TCP_ESTABLISHED = 1,
61 TCP_SYN_SENT,
62 TCP_SYN_RECV,
63 TCP_FIN_WAIT1,
64 TCP_FIN_WAIT2,
65 TCP_TIME_WAIT,
66 TCP_CLOSE,
67 TCP_CLOSE_WAIT,
68 TCP_LAST_ACK,
69 TCP_LISTEN,
70 TCP_CLOSING, /* now a valid state */
71
72 TCP_MAX_STATES /* Leave at the end! */
73};
74
75#define TCP_STATE_MASK 0xF
76#define TCP_ACTION_FIN (1 << 7) 58#define TCP_ACTION_FIN (1 << 7)
77 59
78enum { 60enum {
@@ -195,8 +177,9 @@ struct tcp_info
195 177
196#include <linux/config.h> 178#include <linux/config.h>
197#include <linux/skbuff.h> 179#include <linux/skbuff.h>
198#include <linux/ip.h>
199#include <net/sock.h> 180#include <net/sock.h>
181#include <net/inet_connection_sock.h>
182#include <net/inet_timewait_sock.h>
200 183
201/* This defines a selective acknowledgement block. */ 184/* This defines a selective acknowledgement block. */
202struct tcp_sack_block { 185struct tcp_sack_block {
@@ -236,8 +219,8 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
236} 219}
237 220
238struct tcp_sock { 221struct tcp_sock {
239 /* inet_sock has to be the first member of tcp_sock */ 222 /* inet_connection_sock has to be the first member of tcp_sock */
240 struct inet_sock inet; 223 struct inet_connection_sock inet_conn;
241 int tcp_header_len; /* Bytes of tcp header to send */ 224 int tcp_header_len; /* Bytes of tcp header to send */
242 225
243/* 226/*
@@ -258,19 +241,6 @@ struct tcp_sock {
258 __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ 241 __u32 snd_sml; /* Last byte of the most recently transmitted small packet */
259 __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 242 __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
260 __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ 243 __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
261 struct tcp_bind_bucket *bind_hash;
262 /* Delayed ACK control data */
263 struct {
264 __u8 pending; /* ACK is pending */
265 __u8 quick; /* Scheduled number of quick acks */
266 __u8 pingpong; /* The session is interactive */
267 __u8 blocked; /* Delayed ACK was blocked by socket lock*/
268 __u32 ato; /* Predicted tick of soft clock */
269 unsigned long timeout; /* Currently scheduled timeout */
270 __u32 lrcvtime; /* timestamp of last received data packet*/
271 __u16 last_seg_size; /* Size of last incoming segment */
272 __u16 rcv_mss; /* MSS used for delayed ACK decisions */
273 } ack;
274 244
275 /* Data for direct copy to user */ 245 /* Data for direct copy to user */
276 struct { 246 struct {
@@ -288,19 +258,15 @@ struct tcp_sock {
288 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 258 __u32 mss_cache; /* Cached effective mss, not including SACKS */
289 __u16 xmit_size_goal; /* Goal for segmenting output packets */ 259 __u16 xmit_size_goal; /* Goal for segmenting output packets */
290 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 260 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */
291 __u8 ca_state; /* State of fast-retransmit machine */
292 __u8 retransmits; /* Number of unrecovered RTO timeouts. */
293 261
294 __u16 advmss; /* Advertised MSS */
295 __u32 window_clamp; /* Maximal window to advertise */ 262 __u32 window_clamp; /* Maximal window to advertise */
296 __u32 rcv_ssthresh; /* Current window clamp */ 263 __u32 rcv_ssthresh; /* Current window clamp */
297 264
298 __u32 frto_highmark; /* snd_nxt when RTO occurred */ 265 __u32 frto_highmark; /* snd_nxt when RTO occurred */
299 __u8 reordering; /* Packet reordering metric. */ 266 __u8 reordering; /* Packet reordering metric. */
300 __u8 frto_counter; /* Number of new acks after RTO */ 267 __u8 frto_counter; /* Number of new acks after RTO */
301 268 __u8 nonagle; /* Disable Nagle algorithm? */
302 __u8 unused; 269 __u8 keepalive_probes; /* num of allowed keep alive probes */
303 __u8 defer_accept; /* User waits for some data after accept() */
304 270
305/* RTT measurement */ 271/* RTT measurement */
306 __u32 srtt; /* smoothed round trip time << 3 */ 272 __u32 srtt; /* smoothed round trip time << 3 */
@@ -308,19 +274,13 @@ struct tcp_sock {
308 __u32 mdev_max; /* maximal mdev for the last rtt period */ 274 __u32 mdev_max; /* maximal mdev for the last rtt period */
309 __u32 rttvar; /* smoothed mdev_max */ 275 __u32 rttvar; /* smoothed mdev_max */
310 __u32 rtt_seq; /* sequence number to update rttvar */ 276 __u32 rtt_seq; /* sequence number to update rttvar */
311 __u32 rto; /* retransmit timeout */
312 277
313 __u32 packets_out; /* Packets which are "in flight" */ 278 __u32 packets_out; /* Packets which are "in flight" */
314 __u32 left_out; /* Packets which leaved network */ 279 __u32 left_out; /* Packets which leaved network */
315 __u32 retrans_out; /* Retransmitted packets out */ 280 __u32 retrans_out; /* Retransmitted packets out */
316 __u8 backoff; /* backoff */
317/* 281/*
318 * Options received (usually on last packet, some only on SYN packets). 282 * Options received (usually on last packet, some only on SYN packets).
319 */ 283 */
320 __u8 nonagle; /* Disable Nagle algorithm? */
321 __u8 keepalive_probes; /* num of allowed keep alive probes */
322
323 __u8 probes_out; /* unanswered 0 window probes */
324 struct tcp_options_received rx_opt; 284 struct tcp_options_received rx_opt;
325 285
326/* 286/*
@@ -333,11 +293,6 @@ struct tcp_sock {
333 __u32 snd_cwnd_used; 293 __u32 snd_cwnd_used;
334 __u32 snd_cwnd_stamp; 294 __u32 snd_cwnd_stamp;
335 295
336 /* Two commonly used timers in both sender and receiver paths. */
337 unsigned long timeout;
338 struct timer_list retransmit_timer; /* Resend (no ack) */
339 struct timer_list delack_timer; /* Ack delay */
340
341 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
342 297
343 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ 298 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
@@ -352,8 +307,7 @@ struct tcp_sock {
352 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 307 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
353 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 308 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
354 309
355 __u8 syn_retries; /* num of allowed syn retries */ 310 __u16 advmss; /* Advertised MSS */
356 __u8 ecn_flags; /* ECN status bits. */
357 __u16 prior_ssthresh; /* ssthresh saved at recovery start */ 311 __u16 prior_ssthresh; /* ssthresh saved at recovery start */
358 __u32 lost_out; /* Lost packets */ 312 __u32 lost_out; /* Lost packets */
359 __u32 sacked_out; /* SACK'd packets */ 313 __u32 sacked_out; /* SACK'd packets */
@@ -367,14 +321,12 @@ struct tcp_sock {
367 int undo_retrans; /* number of undoable retransmissions. */ 321 int undo_retrans; /* number of undoable retransmissions. */
368 __u32 urg_seq; /* Seq of received urgent pointer */ 322 __u32 urg_seq; /* Seq of received urgent pointer */
369 __u16 urg_data; /* Saved octet of OOB data and control flags */ 323 __u16 urg_data; /* Saved octet of OOB data and control flags */
370 __u8 pending; /* Scheduled timer event */
371 __u8 urg_mode; /* In urgent mode */ 324 __u8 urg_mode; /* In urgent mode */
325 __u8 ecn_flags; /* ECN status bits. */
372 __u32 snd_up; /* Urgent pointer */ 326 __u32 snd_up; /* Urgent pointer */
373 327
374 __u32 total_retrans; /* Total retransmits for entire connection */ 328 __u32 total_retrans; /* Total retransmits for entire connection */
375 329
376 struct request_sock_queue accept_queue; /* FIFO of established children */
377
378 unsigned int keepalive_time; /* time before keep alive takes place */ 330 unsigned int keepalive_time; /* time before keep alive takes place */
379 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 331 unsigned int keepalive_intvl; /* time interval between keep alive probes */
380 int linger2; 332 int linger2;
@@ -394,11 +346,6 @@ struct tcp_sock {
394 __u32 seq; 346 __u32 seq;
395 __u32 time; 347 __u32 time;
396 } rcvq_space; 348 } rcvq_space;
397
398 /* Pluggable TCP congestion control hook */
399 struct tcp_congestion_ops *ca_ops;
400 u32 ca_priv[16];
401#define TCP_CA_PRIV_SIZE (16*sizeof(u32))
402}; 349};
403 350
404static inline struct tcp_sock *tcp_sk(const struct sock *sk) 351static inline struct tcp_sock *tcp_sk(const struct sock *sk)
@@ -406,9 +353,18 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk)
406 return (struct tcp_sock *)sk; 353 return (struct tcp_sock *)sk;
407} 354}
408 355
409static inline void *tcp_ca(const struct tcp_sock *tp) 356struct tcp_timewait_sock {
357 struct inet_timewait_sock tw_sk;
358 __u32 tw_rcv_nxt;
359 __u32 tw_snd_nxt;
360 __u32 tw_rcv_wnd;
361 __u32 tw_ts_recent;
362 long tw_ts_recent_stamp;
363};
364
365static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
410{ 366{
411 return (void *) tp->ca_priv; 367 return (struct tcp_timewait_sock *)sk;
412} 368}
413 369
414#endif 370#endif
diff --git a/include/linux/tcp_diag.h b/include/linux/tcp_diag.h
deleted file mode 100644
index 7a5996743946..000000000000
--- a/include/linux/tcp_diag.h
+++ /dev/null
@@ -1,127 +0,0 @@
1#ifndef _TCP_DIAG_H_
2#define _TCP_DIAG_H_ 1
3
4/* Just some random number */
5#define TCPDIAG_GETSOCK 18
6
7/* Socket identity */
8struct tcpdiag_sockid
9{
10 __u16 tcpdiag_sport;
11 __u16 tcpdiag_dport;
12 __u32 tcpdiag_src[4];
13 __u32 tcpdiag_dst[4];
14 __u32 tcpdiag_if;
15 __u32 tcpdiag_cookie[2];
16#define TCPDIAG_NOCOOKIE (~0U)
17};
18
19/* Request structure */
20
21struct tcpdiagreq
22{
23 __u8 tcpdiag_family; /* Family of addresses. */
24 __u8 tcpdiag_src_len;
25 __u8 tcpdiag_dst_len;
26 __u8 tcpdiag_ext; /* Query extended information */
27
28 struct tcpdiag_sockid id;
29
30 __u32 tcpdiag_states; /* States to dump */
31 __u32 tcpdiag_dbs; /* Tables to dump (NI) */
32};
33
34enum
35{
36 TCPDIAG_REQ_NONE,
37 TCPDIAG_REQ_BYTECODE,
38};
39
40#define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE
41
42/* Bytecode is sequence of 4 byte commands followed by variable arguments.
43 * All the commands identified by "code" are conditional jumps forward:
44 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
45 * length of the command and its arguments.
46 */
47
48struct tcpdiag_bc_op
49{
50 unsigned char code;
51 unsigned char yes;
52 unsigned short no;
53};
54
55enum
56{
57 TCPDIAG_BC_NOP,
58 TCPDIAG_BC_JMP,
59 TCPDIAG_BC_S_GE,
60 TCPDIAG_BC_S_LE,
61 TCPDIAG_BC_D_GE,
62 TCPDIAG_BC_D_LE,
63 TCPDIAG_BC_AUTO,
64 TCPDIAG_BC_S_COND,
65 TCPDIAG_BC_D_COND,
66};
67
68struct tcpdiag_hostcond
69{
70 __u8 family;
71 __u8 prefix_len;
72 int port;
73 __u32 addr[0];
74};
75
76/* Base info structure. It contains socket identity (addrs/ports/cookie)
77 * and, alas, the information shown by netstat. */
78struct tcpdiagmsg
79{
80 __u8 tcpdiag_family;
81 __u8 tcpdiag_state;
82 __u8 tcpdiag_timer;
83 __u8 tcpdiag_retrans;
84
85 struct tcpdiag_sockid id;
86
87 __u32 tcpdiag_expires;
88 __u32 tcpdiag_rqueue;
89 __u32 tcpdiag_wqueue;
90 __u32 tcpdiag_uid;
91 __u32 tcpdiag_inode;
92};
93
94/* Extensions */
95
96enum
97{
98 TCPDIAG_NONE,
99 TCPDIAG_MEMINFO,
100 TCPDIAG_INFO,
101 TCPDIAG_VEGASINFO,
102 TCPDIAG_CONG,
103};
104
105#define TCPDIAG_MAX TCPDIAG_CONG
106
107
108/* TCPDIAG_MEM */
109
110struct tcpdiag_meminfo
111{
112 __u32 tcpdiag_rmem;
113 __u32 tcpdiag_wmem;
114 __u32 tcpdiag_fmem;
115 __u32 tcpdiag_tmem;
116};
117
118/* TCPDIAG_VEGASINFO */
119
120struct tcpvegas_info {
121 __u32 tcpv_enabled;
122 __u32 tcpv_rttcnt;
123 __u32 tcpv_rtt;
124 __u32 tcpv_minrtt;
125};
126
127#endif /* _TCP_DIAG_H_ */
diff --git a/include/linux/time.h b/include/linux/time.h
index 5634497ff5df..c10d4c21c183 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -97,7 +97,6 @@ extern int do_settimeofday(struct timespec *tv);
97extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 97extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
98extern void clock_was_set(void); // call when ever the clock is set 98extern void clock_was_set(void); // call when ever the clock is set
99extern int do_posix_clock_monotonic_gettime(struct timespec *tp); 99extern int do_posix_clock_monotonic_gettime(struct timespec *tp);
100extern long do_nanosleep(struct timespec *t);
101extern long do_utimes(char __user * filename, struct timeval * times); 100extern long do_utimes(char __user * filename, struct timeval * times);
102struct itimerval; 101struct itimerval;
103extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); 102extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 74fdd07d3792..7e050a2cc35b 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -260,6 +260,29 @@ extern long pps_calcnt; /* calibration intervals */
260extern long pps_errcnt; /* calibration errors */ 260extern long pps_errcnt; /* calibration errors */
261extern long pps_stbcnt; /* stability limit exceeded */ 261extern long pps_stbcnt; /* stability limit exceeded */
262 262
263/**
264 * ntp_clear - Clears the NTP state variables
265 *
266 * Must be called while holding a write on the xtime_lock
267 */
268static inline void ntp_clear(void)
269{
270 time_adjust = 0; /* stop active adjtime() */
271 time_status |= STA_UNSYNC;
272 time_maxerror = NTP_PHASE_LIMIT;
273 time_esterror = NTP_PHASE_LIMIT;
274}
275
276/**
277 * ntp_synced - Returns 1 if the NTP status is not UNSYNC
278 *
279 */
280static inline int ntp_synced(void)
281{
282 return !(time_status & STA_UNSYNC);
283}
284
285
263#ifdef CONFIG_TIME_INTERPOLATION 286#ifdef CONFIG_TIME_INTERPOLATION
264 287
265#define TIME_SOURCE_CPU 0 288#define TIME_SOURCE_CPU 0
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 0320225e96da..3df1d474e5c5 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -135,6 +135,29 @@
135} 135}
136#endif 136#endif
137 137
138/* sched_domains SD_ALLNODES_INIT for NUMA machines */
139#define SD_ALLNODES_INIT (struct sched_domain) { \
140 .span = CPU_MASK_NONE, \
141 .parent = NULL, \
142 .groups = NULL, \
143 .min_interval = 64, \
144 .max_interval = 64*num_online_cpus(), \
145 .busy_factor = 128, \
146 .imbalance_pct = 133, \
147 .cache_hot_time = (10*1000000), \
148 .cache_nice_tries = 1, \
149 .busy_idx = 3, \
150 .idle_idx = 3, \
151 .newidle_idx = 0, /* unused */ \
152 .wake_idx = 0, /* unused */ \
153 .forkexec_idx = 0, /* unused */ \
154 .per_cpu_gain = 100, \
155 .flags = SD_LOAD_BALANCE, \
156 .last_balance = jiffies, \
157 .balance_interval = 64, \
158 .nr_balance_failed = 0, \
159}
160
138#ifdef CONFIG_NUMA 161#ifdef CONFIG_NUMA
139#ifndef SD_NODE_INIT 162#ifndef SD_NODE_INIT
140#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 163#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 87d98d1faefb..1d6cc22e5f42 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -12,11 +12,16 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/attribute_container.h> 13#include <linux/attribute_container.h>
14 14
15struct transport_container;
16
15struct transport_class { 17struct transport_class {
16 struct class class; 18 struct class class;
17 int (*setup)(struct device *); 19 int (*setup)(struct transport_container *, struct device *,
18 int (*configure)(struct device *); 20 struct class_device *);
19 int (*remove)(struct device *); 21 int (*configure)(struct transport_container *, struct device *,
22 struct class_device *);
23 int (*remove)(struct transport_container *, struct device *,
24 struct class_device *);
20}; 25};
21 26
22#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \ 27#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \
diff --git a/include/linux/types.h b/include/linux/types.h
index dcb13f865df9..2b678c22ca4a 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -123,6 +123,9 @@ typedef __u64 u_int64_t;
123typedef __s64 int64_t; 123typedef __s64 int64_t;
124#endif 124#endif
125 125
126/* this is a special 64bit data type that is 8-byte aligned */
127#define aligned_u64 unsigned long long __attribute__((aligned(8)))
128
126/* 129/*
127 * The type used for indexing onto a disc or disc partition. 130 * The type used for indexing onto a disc or disc partition.
128 * If required, asm/types.h can override it and define 131 * If required, asm/types.h can override it and define
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 6409d9cf5965..b244f69ef682 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -10,6 +10,14 @@
10#define VM_MAP 0x00000004 /* vmap()ed pages */ 10#define VM_MAP 0x00000004 /* vmap()ed pages */
11/* bits [20..32] reserved for arch specific ioremap internals */ 11/* bits [20..32] reserved for arch specific ioremap internals */
12 12
13/*
14 * Maximum alignment for ioremap() regions.
15 * Can be overriden by arch-specific value.
16 */
17#ifndef IOREMAP_MAX_ORDER
18#define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */
19#endif
20
13struct vm_struct { 21struct vm_struct {
14 void *addr; 22 void *addr;
15 unsigned long size; 23 unsigned long size;
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index ae485f9c916e..a555a0f7a7b4 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 18 12.3.05 4 * Version : 19 18.3.05
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved.
@@ -69,8 +69,6 @@
69 69
70/***************************** INCLUDES *****************************/ 70/***************************** INCLUDES *****************************/
71 71
72/* To minimise problems in user space, I might remove those headers
73 * at some point. Jean II */
74#include <linux/types.h> /* for "caddr_t" et al */ 72#include <linux/types.h> /* for "caddr_t" et al */
75#include <linux/socket.h> /* for "struct sockaddr" et al */ 73#include <linux/socket.h> /* for "struct sockaddr" et al */
76#include <linux/if.h> /* for IFNAMSIZ and co... */ 74#include <linux/if.h> /* for IFNAMSIZ and co... */
@@ -82,7 +80,7 @@
82 * (there is some stuff that will be added in the future...) 80 * (there is some stuff that will be added in the future...)
83 * I just plan to increment with each new version. 81 * I just plan to increment with each new version.
84 */ 82 */
85#define WIRELESS_EXT 18 83#define WIRELESS_EXT 19
86 84
87/* 85/*
88 * Changes : 86 * Changes :
@@ -197,6 +195,15 @@
197 * related parameters (extensible up to 4096 parameter values) 195 * related parameters (extensible up to 4096 parameter values)
198 * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, 196 * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
199 * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND 197 * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
198 *
199 * V18 to V19
200 * ----------
201 * - Remove (struct iw_point *)->pointer from events and streams
202 * - Remove header includes to help user space
203 * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64
204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
200 */ 207 */
201 208
202/**************************** CONSTANTS ****************************/ 209/**************************** CONSTANTS ****************************/
@@ -322,6 +329,7 @@
322/* The first and the last (range) */ 329/* The first and the last (range) */
323#define SIOCIWFIRST 0x8B00 330#define SIOCIWFIRST 0x8B00
324#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ 331#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
332#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
325 333
326/* Even : get (world access), odd : set (root access) */ 334/* Even : get (world access), odd : set (root access) */
327#define IW_IS_SET(cmd) (!((cmd) & 0x1)) 335#define IW_IS_SET(cmd) (!((cmd) & 0x1))
@@ -366,6 +374,7 @@
366 * (struct iw_pmkid_cand) */ 374 * (struct iw_pmkid_cand) */
367 375
368#define IWEVFIRST 0x8C00 376#define IWEVFIRST 0x8C00
377#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST)
369 378
370/* ------------------------- PRIVATE INFO ------------------------- */ 379/* ------------------------- PRIVATE INFO ------------------------- */
371/* 380/*
@@ -427,12 +436,15 @@
427#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ 436#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
428 437
429/* Statistics flags (bitmask in updated) */ 438/* Statistics flags (bitmask in updated) */
430#define IW_QUAL_QUAL_UPDATED 0x1 /* Value was updated since last read */ 439#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */
431#define IW_QUAL_LEVEL_UPDATED 0x2 440#define IW_QUAL_LEVEL_UPDATED 0x02
432#define IW_QUAL_NOISE_UPDATED 0x4 441#define IW_QUAL_NOISE_UPDATED 0x04
442#define IW_QUAL_ALL_UPDATED 0x07
443#define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */
433#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ 444#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
434#define IW_QUAL_LEVEL_INVALID 0x20 445#define IW_QUAL_LEVEL_INVALID 0x20
435#define IW_QUAL_NOISE_INVALID 0x40 446#define IW_QUAL_NOISE_INVALID 0x40
447#define IW_QUAL_ALL_INVALID 0x70
436 448
437/* Frequency flags */ 449/* Frequency flags */
438#define IW_FREQ_AUTO 0x00 /* Let the driver decides */ 450#define IW_FREQ_AUTO 0x00 /* Let the driver decides */
@@ -443,7 +455,7 @@
443#define IW_MAX_ENCODING_SIZES 8 455#define IW_MAX_ENCODING_SIZES 8
444 456
445/* Maximum size of the encoding token in bytes */ 457/* Maximum size of the encoding token in bytes */
446#define IW_ENCODING_TOKEN_MAX 32 /* 256 bits (for now) */ 458#define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */
447 459
448/* Flags for encoding (along with the token) */ 460/* Flags for encoding (along with the token) */
449#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ 461#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */
@@ -1039,12 +1051,16 @@ struct iw_event
1039#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) 1051#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ)
1040#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) 1052#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32))
1041#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) 1053#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq))
1042#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point))
1043#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) 1054#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param))
1044#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) 1055#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
1045#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) 1056#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
1046 1057
1047/* Note : in the case of iw_point, the extra data will come at the 1058/* iw_point events are special. First, the payload (extra data) come at
1048 * end of the event */ 1059 * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
1060 * we omit the pointer, so start at an offset. */
1061#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
1062 (char *) NULL)
1063#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1064 IW_EV_POINT_OFF)
1049 1065
1050#endif /* _LINUX_WIRELESS_H */ 1066#endif /* _LINUX_WIRELESS_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index f0d423300d84..0fb077d68441 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -258,9 +258,27 @@ struct xfrm_usersa_flush {
258 __u8 proto; 258 __u8 proto;
259}; 259};
260 260
261#ifndef __KERNEL__
262/* backwards compatibility for userspace */
261#define XFRMGRP_ACQUIRE 1 263#define XFRMGRP_ACQUIRE 1
262#define XFRMGRP_EXPIRE 2 264#define XFRMGRP_EXPIRE 2
263#define XFRMGRP_SA 4 265#define XFRMGRP_SA 4
264#define XFRMGRP_POLICY 8 266#define XFRMGRP_POLICY 8
267#endif
268
269enum xfrm_nlgroups {
270 XFRMNLGRP_NONE,
271#define XFRMNLGRP_NONE XFRMNLGRP_NONE
272 XFRMNLGRP_ACQUIRE,
273#define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE
274 XFRMNLGRP_EXPIRE,
275#define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE
276 XFRMNLGRP_SA,
277#define XFRMNLGRP_SA XFRMNLGRP_SA
278 XFRMNLGRP_POLICY,
279#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
280 __XFRMNLGRP_MAX
281};
282#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
265 283
266#endif /* _LINUX_XFRM_H */ 284#endif /* _LINUX_XFRM_H */
diff --git a/include/media/id.h b/include/media/id.h
index a39a6423914b..801ddef301aa 100644
--- a/include/media/id.h
+++ b/include/media/id.h
@@ -34,8 +34,3 @@
34#ifndef I2C_DRIVERID_SAA6752HS 34#ifndef I2C_DRIVERID_SAA6752HS
35# define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8 35# define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8
36#endif 36#endif
37
38/* algorithms */
39#ifndef I2C_ALGO_SAA7134
40# define I2C_ALGO_SAA7134 0x090000
41#endif
diff --git a/include/net/act_api.h b/include/net/act_api.h
index ed00a995f576..b55eb7c7f033 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -63,7 +63,7 @@ struct tc_action_ops
63 __u32 type; /* TBD to match kind */ 63 __u32 type; /* TBD to match kind */
64 __u32 capab; /* capabilities includes 4 bit version */ 64 __u32 capab; /* capabilities includes 4 bit version */
65 struct module *owner; 65 struct module *owner;
66 int (*act)(struct sk_buff **, struct tc_action *); 66 int (*act)(struct sk_buff **, struct tc_action *, struct tcf_result *);
67 int (*get_stats)(struct sk_buff *, struct tc_action *); 67 int (*get_stats)(struct sk_buff *, struct tc_action *);
68 int (*dump)(struct sk_buff *, struct tc_action *,int , int); 68 int (*dump)(struct sk_buff *, struct tc_action *,int , int);
69 int (*cleanup)(struct tc_action *, int bind); 69 int (*cleanup)(struct tc_action *, int bind);
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index a0ed93672176..750e2508dd90 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -45,6 +45,7 @@ struct prefix_info {
45 45
46#ifdef __KERNEL__ 46#ifdef __KERNEL__
47 47
48#include <linux/config.h>
48#include <linux/netdevice.h> 49#include <linux/netdevice.h>
49#include <net/if_inet6.h> 50#include <net/if_inet6.h>
50#include <net/ipv6.h> 51#include <net/ipv6.h>
@@ -238,5 +239,10 @@ static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
238 addr->s6_addr32[3] == htonl(0x00000002)); 239 addr->s6_addr32[3] == htonl(0x00000002));
239} 240}
240 241
242#ifdef CONFIG_PROC_FS
243extern int if6_proc_init(void);
244extern void if6_proc_exit(void);
245#endif
246
241#endif 247#endif
242#endif 248#endif
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b60b3846b9d1..b5d785ab4a0e 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -1,5 +1,11 @@
1#ifndef __LINUX_NET_AFUNIX_H 1#ifndef __LINUX_NET_AFUNIX_H
2#define __LINUX_NET_AFUNIX_H 2#define __LINUX_NET_AFUNIX_H
3
4#include <linux/config.h>
5#include <linux/socket.h>
6#include <linux/un.h>
7#include <net/sock.h>
8
3extern void unix_inflight(struct file *fp); 9extern void unix_inflight(struct file *fp);
4extern void unix_notinflight(struct file *fp); 10extern void unix_notinflight(struct file *fp);
5extern void unix_gc(void); 11extern void unix_gc(void);
@@ -74,5 +80,14 @@ struct unix_sock {
74 wait_queue_head_t peer_wait; 80 wait_queue_head_t peer_wait;
75}; 81};
76#define unix_sk(__sk) ((struct unix_sock *)__sk) 82#define unix_sk(__sk) ((struct unix_sock *)__sk)
83
84#ifdef CONFIG_SYSCTL
85extern int sysctl_unix_max_dgram_qlen;
86extern void unix_sysctl_register(void);
87extern void unix_sysctl_unregister(void);
88#else
89static inline void unix_sysctl_register(void) {}
90static inline void unix_sysctl_unregister(void) {}
91#endif
77#endif 92#endif
78#endif 93#endif
diff --git a/include/net/arp.h b/include/net/arp.h
index a1f09fad6a52..a13e30c35f42 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl;
11 11
12extern void arp_init(void); 12extern void arp_init(void);
13extern int arp_rcv(struct sk_buff *skb, struct net_device *dev, 13extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
14 struct packet_type *pt); 14 struct packet_type *pt, struct net_device *orig_dev);
15extern int arp_find(unsigned char *haddr, struct sk_buff *skb); 15extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
16extern int arp_ioctl(unsigned int cmd, void __user *arg); 16extern int arp_ioctl(unsigned int cmd, void __user *arg);
17extern void arp_send(int type, int ptype, u32 dest_ip, 17extern void arp_send(int type, int ptype, u32 dest_ip,
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 828a3a93dda1..364b046e9f47 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -139,11 +139,25 @@ enum {
139#define AX25_DEF_DS_TIMEOUT (3 * 60 * HZ) /* DAMA timeout 3 minutes */ 139#define AX25_DEF_DS_TIMEOUT (3 * 60 * HZ) /* DAMA timeout 3 minutes */
140 140
141typedef struct ax25_uid_assoc { 141typedef struct ax25_uid_assoc {
142 struct ax25_uid_assoc *next; 142 struct hlist_node uid_node;
143 atomic_t refcount;
143 uid_t uid; 144 uid_t uid;
144 ax25_address call; 145 ax25_address call;
145} ax25_uid_assoc; 146} ax25_uid_assoc;
146 147
148#define ax25_uid_for_each(__ax25, node, list) \
149 hlist_for_each_entry(__ax25, node, list, uid_node)
150
151#define ax25_uid_hold(ax25) \
152 atomic_inc(&((ax25)->refcount))
153
154static inline void ax25_uid_put(ax25_uid_assoc *assoc)
155{
156 if (atomic_dec_and_test(&assoc->refcount)) {
157 kfree(assoc);
158 }
159}
160
147typedef struct { 161typedef struct {
148 ax25_address calls[AX25_MAX_DIGIS]; 162 ax25_address calls[AX25_MAX_DIGIS];
149 unsigned char repeated[AX25_MAX_DIGIS]; 163 unsigned char repeated[AX25_MAX_DIGIS];
@@ -243,7 +257,7 @@ extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
243 257
244/* ax25_addr.c */ 258/* ax25_addr.c */
245extern ax25_address null_ax25_address; 259extern ax25_address null_ax25_address;
246extern char *ax2asc(ax25_address *); 260extern char *ax2asc(char *buf, ax25_address *);
247extern ax25_address *asc2ax(char *); 261extern ax25_address *asc2ax(char *);
248extern int ax25cmp(ax25_address *, ax25_address *); 262extern int ax25cmp(ax25_address *, ax25_address *);
249extern int ax25digicmp(ax25_digi *, ax25_digi *); 263extern int ax25digicmp(ax25_digi *, ax25_digi *);
@@ -302,7 +316,7 @@ extern int ax25_protocol_is_registered(unsigned int);
302 316
303/* ax25_in.c */ 317/* ax25_in.c */
304extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *); 318extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
305extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *); 319extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
306 320
307/* ax25_ip.c */ 321/* ax25_ip.c */
308extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); 322extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int);
@@ -376,7 +390,7 @@ extern unsigned long ax25_display_timer(struct timer_list *);
376 390
377/* ax25_uid.c */ 391/* ax25_uid.c */
378extern int ax25_uid_policy; 392extern int ax25_uid_policy;
379extern ax25_address *ax25_findbyuid(uid_t); 393extern ax25_uid_assoc *ax25_findbyuid(uid_t);
380extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *); 394extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *);
381extern struct file_operations ax25_uid_fops; 395extern struct file_operations ax25_uid_fops;
382extern void ax25_uid_free(void); 396extern void ax25_uid_free(void);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 06b24f637026..6dfa4a61ffd0 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -131,11 +131,12 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
131 131
132/* Skb helpers */ 132/* Skb helpers */
133struct bt_skb_cb { 133struct bt_skb_cb {
134 int incoming; 134 __u8 pkt_type;
135 __u8 incoming;
135}; 136};
136#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 137#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb))
137 138
138static inline struct sk_buff *bt_skb_alloc(unsigned int len, int how) 139static inline struct sk_buff *bt_skb_alloc(unsigned int len, unsigned int __nocast how)
139{ 140{
140 struct sk_buff *skb; 141 struct sk_buff *skb;
141 142
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 6f0706f4af68..371e7d3f2e6f 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -453,6 +453,15 @@ struct inquiry_info_with_rssi {
453 __u16 clock_offset; 453 __u16 clock_offset;
454 __s8 rssi; 454 __s8 rssi;
455} __attribute__ ((packed)); 455} __attribute__ ((packed));
456struct inquiry_info_with_rssi_and_pscan_mode {
457 bdaddr_t bdaddr;
458 __u8 pscan_rep_mode;
459 __u8 pscan_period_mode;
460 __u8 pscan_mode;
461 __u8 dev_class[3];
462 __u16 clock_offset;
463 __s8 rssi;
464} __attribute__ ((packed));
456 465
457#define HCI_EV_CONN_COMPLETE 0x03 466#define HCI_EV_CONN_COMPLETE 0x03
458struct hci_ev_conn_complete { 467struct hci_ev_conn_complete {
@@ -584,6 +593,12 @@ struct hci_ev_clock_offset {
584 __u16 clock_offset; 593 __u16 clock_offset;
585} __attribute__ ((packed)); 594} __attribute__ ((packed));
586 595
596#define HCI_EV_PSCAN_REP_MODE 0x20
597struct hci_ev_pscan_rep_mode {
598 bdaddr_t bdaddr;
599 __u8 pscan_rep_mode;
600} __attribute__ ((packed));
601
587/* Internal events generated by Bluetooth stack */ 602/* Internal events generated by Bluetooth stack */
588#define HCI_EV_STACK_INTERNAL 0xFD 603#define HCI_EV_STACK_INTERNAL 0xFD
589struct hci_ev_stack_internal { 604struct hci_ev_stack_internal {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6d63a47c731b..7f933f302078 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -404,7 +404,7 @@ static inline int hci_recv_frame(struct sk_buff *skb)
404 bt_cb(skb)->incoming = 1; 404 bt_cb(skb)->incoming = 1;
405 405
406 /* Time stamp */ 406 /* Time stamp */
407 do_gettimeofday(&skb->stamp); 407 __net_timestamp(skb);
408 408
409 /* Queue frame for rx task */ 409 /* Queue frame for rx task */
410 skb_queue_tail(&hdev->rx_q, skb); 410 skb_queue_tail(&hdev->rx_q, skb);
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 13669bad00b3..ffea9d54071f 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -80,9 +80,9 @@
80#define RFCOMM_RPN_STOP_15 1 80#define RFCOMM_RPN_STOP_15 1
81 81
82#define RFCOMM_RPN_PARITY_NONE 0x0 82#define RFCOMM_RPN_PARITY_NONE 0x0
83#define RFCOMM_RPN_PARITY_ODD 0x4 83#define RFCOMM_RPN_PARITY_ODD 0x1
84#define RFCOMM_RPN_PARITY_EVEN 0x5 84#define RFCOMM_RPN_PARITY_EVEN 0x3
85#define RFCOMM_RPN_PARITY_MARK 0x6 85#define RFCOMM_RPN_PARITY_MARK 0x5
86#define RFCOMM_RPN_PARITY_SPACE 0x7 86#define RFCOMM_RPN_PARITY_SPACE 0x7
87 87
88#define RFCOMM_RPN_FLOW_NONE 0x00 88#define RFCOMM_RPN_FLOW_NONE 0x00
@@ -223,8 +223,14 @@ struct rfcomm_dlc {
223#define RFCOMM_CFC_DISABLED 0 223#define RFCOMM_CFC_DISABLED 0
224#define RFCOMM_CFC_ENABLED RFCOMM_MAX_CREDITS 224#define RFCOMM_CFC_ENABLED RFCOMM_MAX_CREDITS
225 225
226/* ---- RFCOMM SEND RPN ---- */
227int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
228 u8 bit_rate, u8 data_bits, u8 stop_bits,
229 u8 parity, u8 flow_ctrl_settings,
230 u8 xon_char, u8 xoff_char, u16 param_mask);
231
226/* ---- RFCOMM DLCs (channels) ---- */ 232/* ---- RFCOMM DLCs (channels) ---- */
227struct rfcomm_dlc *rfcomm_dlc_alloc(int prio); 233struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio);
228void rfcomm_dlc_free(struct rfcomm_dlc *d); 234void rfcomm_dlc_free(struct rfcomm_dlc *d);
229int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel); 235int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel);
230int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); 236int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
diff --git a/include/net/datalink.h b/include/net/datalink.h
index 5797ba3d2eb5..deb7ca75db48 100644
--- a/include/net/datalink.h
+++ b/include/net/datalink.h
@@ -9,7 +9,7 @@ struct datalink_proto {
9 unsigned short header_length; 9 unsigned short header_length;
10 10
11 int (*rcvfunc)(struct sk_buff *, struct net_device *, 11 int (*rcvfunc)(struct sk_buff *, struct net_device *,
12 struct packet_type *); 12 struct packet_type *, struct net_device *);
13 int (*request)(struct datalink_proto *, struct sk_buff *, 13 int (*request)(struct datalink_proto *, struct sk_buff *,
14 unsigned char *); 14 unsigned char *);
15 struct list_head node; 15 struct list_head node;
diff --git a/include/net/dn.h b/include/net/dn.h
index 5551c46db397..c1dbbd222793 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <net/tcp.h>
6#include <asm/byteorder.h> 7#include <asm/byteorder.h>
7 8
8typedef unsigned short dn_address; 9typedef unsigned short dn_address;
diff --git a/include/net/icmp.h b/include/net/icmp.h
index e5ef0d15fb45..6cdebeee5f96 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -57,4 +57,11 @@ static inline struct raw_sock *raw_sk(const struct sock *sk)
57 return (struct raw_sock *)sk; 57 return (struct raw_sock *)sk;
58} 58}
59 59
60extern int sysctl_icmp_echo_ignore_all;
61extern int sysctl_icmp_echo_ignore_broadcasts;
62extern int sysctl_icmp_ignore_bogus_error_responses;
63extern int sysctl_icmp_errors_use_inbound_ifaddr;
64extern int sysctl_icmp_ratelimit;
65extern int sysctl_icmp_ratemask;
66
60#endif /* _ICMP_H */ 67#endif /* _ICMP_H */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index db09580ad14b..dc36b1be6745 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -20,18 +20,9 @@
20 */ 20 */
21#ifndef IEEE80211_H 21#ifndef IEEE80211_H
22#define IEEE80211_H 22#define IEEE80211_H
23
24#include <linux/if_ether.h> /* ETH_ALEN */ 23#include <linux/if_ether.h> /* ETH_ALEN */
25#include <linux/kernel.h> /* ARRAY_SIZE */ 24#include <linux/kernel.h> /* ARRAY_SIZE */
26 25#include <linux/wireless.h>
27#if WIRELESS_EXT < 17
28#define IW_QUAL_QUAL_INVALID 0x10
29#define IW_QUAL_LEVEL_INVALID 0x20
30#define IW_QUAL_NOISE_INVALID 0x40
31#define IW_QUAL_QUAL_UPDATED 0x1
32#define IW_QUAL_LEVEL_UPDATED 0x2
33#define IW_QUAL_NOISE_UPDATED 0x4
34#endif
35 26
36#define IEEE80211_DATA_LEN 2304 27#define IEEE80211_DATA_LEN 2304
37/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 28/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -47,51 +38,22 @@
47#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 38#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
48 39
49struct ieee80211_hdr { 40struct ieee80211_hdr {
50 u16 frame_ctl; 41 __le16 frame_ctl;
51 u16 duration_id; 42 __le16 duration_id;
52 u8 addr1[ETH_ALEN]; 43 u8 addr1[ETH_ALEN];
53 u8 addr2[ETH_ALEN]; 44 u8 addr2[ETH_ALEN];
54 u8 addr3[ETH_ALEN]; 45 u8 addr3[ETH_ALEN];
55 u16 seq_ctl; 46 __le16 seq_ctl;
56 u8 addr4[ETH_ALEN]; 47 u8 addr4[ETH_ALEN];
57} __attribute__ ((packed)); 48} __attribute__ ((packed));
58 49
59struct ieee80211_hdr_3addr { 50struct ieee80211_hdr_3addr {
60 u16 frame_ctl; 51 __le16 frame_ctl;
61 u16 duration_id; 52 __le16 duration_id;
62 u8 addr1[ETH_ALEN]; 53 u8 addr1[ETH_ALEN];
63 u8 addr2[ETH_ALEN]; 54 u8 addr2[ETH_ALEN];
64 u8 addr3[ETH_ALEN]; 55 u8 addr3[ETH_ALEN];
65 u16 seq_ctl; 56 __le16 seq_ctl;
66} __attribute__ ((packed));
67
68enum eap_type {
69 EAP_PACKET = 0,
70 EAPOL_START,
71 EAPOL_LOGOFF,
72 EAPOL_KEY,
73 EAPOL_ENCAP_ASF_ALERT
74};
75
76static const char *eap_types[] = {
77 [EAP_PACKET] = "EAP-Packet",
78 [EAPOL_START] = "EAPOL-Start",
79 [EAPOL_LOGOFF] = "EAPOL-Logoff",
80 [EAPOL_KEY] = "EAPOL-Key",
81 [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
82};
83
84static inline const char *eap_get_type(int type)
85{
86 return (type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
87}
88
89struct eapol {
90 u8 snap[6];
91 u16 ethertype;
92 u8 version;
93 u8 type;
94 u16 length;
95} __attribute__ ((packed)); 57} __attribute__ ((packed));
96 58
97#define IEEE80211_1ADDR_LEN 10 59#define IEEE80211_1ADDR_LEN 10
@@ -104,7 +66,7 @@ struct eapol {
104#define MAX_FRAG_THRESHOLD 2346U 66#define MAX_FRAG_THRESHOLD 2346U
105 67
106/* Frame control field constants */ 68/* Frame control field constants */
107#define IEEE80211_FCTL_VERS 0x0002 69#define IEEE80211_FCTL_VERS 0x0003
108#define IEEE80211_FCTL_FTYPE 0x000c 70#define IEEE80211_FCTL_FTYPE 0x000c
109#define IEEE80211_FCTL_STYPE 0x00f0 71#define IEEE80211_FCTL_STYPE 0x00f0
110#define IEEE80211_FCTL_TODS 0x0100 72#define IEEE80211_FCTL_TODS 0x0100
@@ -112,8 +74,8 @@ struct eapol {
112#define IEEE80211_FCTL_MOREFRAGS 0x0400 74#define IEEE80211_FCTL_MOREFRAGS 0x0400
113#define IEEE80211_FCTL_RETRY 0x0800 75#define IEEE80211_FCTL_RETRY 0x0800
114#define IEEE80211_FCTL_PM 0x1000 76#define IEEE80211_FCTL_PM 0x1000
115#define IEEE80211_FCTL_MOREDATA 0x2000 77#define IEEE80211_FCTL_MOREDATA 0x2000
116#define IEEE80211_FCTL_WEP 0x4000 78#define IEEE80211_FCTL_PROTECTED 0x4000
117#define IEEE80211_FCTL_ORDER 0x8000 79#define IEEE80211_FCTL_ORDER 0x8000
118 80
119#define IEEE80211_FTYPE_MGMT 0x0000 81#define IEEE80211_FTYPE_MGMT 0x0000
@@ -132,6 +94,7 @@ struct eapol {
132#define IEEE80211_STYPE_DISASSOC 0x00A0 94#define IEEE80211_STYPE_DISASSOC 0x00A0
133#define IEEE80211_STYPE_AUTH 0x00B0 95#define IEEE80211_STYPE_AUTH 0x00B0
134#define IEEE80211_STYPE_DEAUTH 0x00C0 96#define IEEE80211_STYPE_DEAUTH 0x00C0
97#define IEEE80211_STYPE_ACTION 0x00D0
135 98
136/* control */ 99/* control */
137#define IEEE80211_STYPE_PSPOLL 0x00A0 100#define IEEE80211_STYPE_PSPOLL 0x00A0
@@ -167,8 +130,19 @@ do { if (ieee80211_debug_level & (level)) \
167#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) 130#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
168#endif /* CONFIG_IEEE80211_DEBUG */ 131#endif /* CONFIG_IEEE80211_DEBUG */
169 132
133
134/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
135
136#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
137#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
138
139/* escape_essid() is intended to be used in debug (and possibly error)
140 * messages. It should never be used for passing essid to user space. */
141const char *escape_essid(const char *essid, u8 essid_len);
142
143
170/* 144/*
171 * To use the debug system; 145 * To use the debug system:
172 * 146 *
173 * If you are defining a new debug classification, simply add it to the #define 147 * If you are defining a new debug classification, simply add it to the #define
174 * list here in the form of: 148 * list here in the form of:
@@ -184,11 +158,11 @@ do { if (ieee80211_debug_level & (level)) \
184 * 158 *
185 * To add your debug level to the list of levels seen when you perform 159 * To add your debug level to the list of levels seen when you perform
186 * 160 *
187 * % cat /proc/net/ipw/debug_level 161 * % cat /proc/net/ieee80211/debug_level
188 * 162 *
189 * you simply need to add your entry to the ipw_debug_levels array. 163 * you simply need to add your entry to the ieee80211_debug_level array.
190 * 164 *
191 * If you do not see debug_level in /proc/net/ipw then you do not have 165 * If you do not see debug_level in /proc/net/ieee80211 then you do not have
192 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration 166 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
193 * 167 *
194 */ 168 */
@@ -199,7 +173,6 @@ do { if (ieee80211_debug_level & (level)) \
199#define IEEE80211_DL_STATE (1<<3) 173#define IEEE80211_DL_STATE (1<<3)
200#define IEEE80211_DL_MGMT (1<<4) 174#define IEEE80211_DL_MGMT (1<<4)
201#define IEEE80211_DL_FRAG (1<<5) 175#define IEEE80211_DL_FRAG (1<<5)
202#define IEEE80211_DL_EAP (1<<6)
203#define IEEE80211_DL_DROP (1<<7) 176#define IEEE80211_DL_DROP (1<<7)
204 177
205#define IEEE80211_DL_TX (1<<8) 178#define IEEE80211_DL_TX (1<<8)
@@ -214,7 +187,6 @@ do { if (ieee80211_debug_level & (level)) \
214#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) 187#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
215#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) 188#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
216#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) 189#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
217#define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a)
218#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) 190#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
219#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) 191#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
220#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) 192#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
@@ -223,9 +195,9 @@ do { if (ieee80211_debug_level & (level)) \
223#include <linux/if_arp.h> /* ARPHRD_ETHER */ 195#include <linux/if_arp.h> /* ARPHRD_ETHER */
224 196
225#ifndef WIRELESS_SPY 197#ifndef WIRELESS_SPY
226#define WIRELESS_SPY // enable iwspy support 198#define WIRELESS_SPY /* enable iwspy support */
227#endif 199#endif
228#include <net/iw_handler.h> // new driver API 200#include <net/iw_handler.h> /* new driver API */
229 201
230#ifndef ETH_P_PAE 202#ifndef ETH_P_PAE
231#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 203#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
@@ -252,6 +224,7 @@ struct ieee80211_snap_hdr {
252 224
253#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) 225#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
254 226
227#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
255#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) 228#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
256#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) 229#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
257 230
@@ -264,7 +237,7 @@ struct ieee80211_snap_hdr {
264 237
265#define WLAN_AUTH_CHALLENGE_LEN 128 238#define WLAN_AUTH_CHALLENGE_LEN 128
266 239
267#define WLAN_CAPABILITY_BSS (1<<0) 240#define WLAN_CAPABILITY_ESS (1<<0)
268#define WLAN_CAPABILITY_IBSS (1<<1) 241#define WLAN_CAPABILITY_IBSS (1<<1)
269#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) 242#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
270#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) 243#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
@@ -272,34 +245,72 @@ struct ieee80211_snap_hdr {
272#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) 245#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
273#define WLAN_CAPABILITY_PBCC (1<<6) 246#define WLAN_CAPABILITY_PBCC (1<<6)
274#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) 247#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
248#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
249#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
250#define WLAN_CAPABILITY_OSSS_OFDM (1<<13)
275 251
276/* Status codes */ 252/* Status codes */
277#define WLAN_STATUS_SUCCESS 0 253enum ieee80211_statuscode {
278#define WLAN_STATUS_UNSPECIFIED_FAILURE 1 254 WLAN_STATUS_SUCCESS = 0,
279#define WLAN_STATUS_CAPS_UNSUPPORTED 10 255 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
280#define WLAN_STATUS_REASSOC_NO_ASSOC 11 256 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
281#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 257 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
282#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 258 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
283#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 259 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
284#define WLAN_STATUS_CHALLENGE_FAIL 15 260 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
285#define WLAN_STATUS_AUTH_TIMEOUT 16 261 WLAN_STATUS_CHALLENGE_FAIL = 15,
286#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 262 WLAN_STATUS_AUTH_TIMEOUT = 16,
287#define WLAN_STATUS_ASSOC_DENIED_RATES 18 263 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
288/* 802.11b */ 264 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
289#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 265 /* 802.11b */
290#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 266 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
291#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 267 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
268 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
269 /* 802.11h */
270 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
271 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
272 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
273 /* 802.11g */
274 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
275 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
276 /* 802.11i */
277 WLAN_STATUS_INVALID_IE = 40,
278 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
279 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
280 WLAN_STATUS_INVALID_AKMP = 43,
281 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
282 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
283 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
284};
292 285
293/* Reason codes */ 286/* Reason codes */
294#define WLAN_REASON_UNSPECIFIED 1 287enum ieee80211_reasoncode {
295#define WLAN_REASON_PREV_AUTH_NOT_VALID 2 288 WLAN_REASON_UNSPECIFIED = 1,
296#define WLAN_REASON_DEAUTH_LEAVING 3 289 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
297#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 290 WLAN_REASON_DEAUTH_LEAVING = 3,
298#define WLAN_REASON_DISASSOC_AP_BUSY 5 291 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
299#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 292 WLAN_REASON_DISASSOC_AP_BUSY = 5,
300#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 293 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
301#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 294 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
302#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 295 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
296 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
297 /* 802.11h */
298 WLAN_REASON_DISASSOC_BAD_POWER = 10,
299 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
300 /* 802.11i */
301 WLAN_REASON_INVALID_IE = 13,
302 WLAN_REASON_MIC_FAILURE = 14,
303 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
304 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
305 WLAN_REASON_IE_DIFFERENT = 17,
306 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
307 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
308 WLAN_REASON_INVALID_AKMP = 20,
309 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
310 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
311 WLAN_REASON_IEEE8021X_FAILED = 23,
312 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
313};
303 314
304 315
305#define IEEE80211_STATMASK_SIGNAL (1<<0) 316#define IEEE80211_STATMASK_SIGNAL (1<<0)
@@ -426,9 +437,7 @@ struct ieee80211_stats {
426 437
427struct ieee80211_device; 438struct ieee80211_device;
428 439
429#if 0 /* for later */
430#include "ieee80211_crypt.h" 440#include "ieee80211_crypt.h"
431#endif
432 441
433#define SEC_KEY_1 (1<<0) 442#define SEC_KEY_1 (1<<0)
434#define SEC_KEY_2 (1<<1) 443#define SEC_KEY_2 (1<<1)
@@ -480,17 +489,34 @@ Total: 28-2340 bytes
480#define BEACON_PROBE_SSID_ID_POSITION 12 489#define BEACON_PROBE_SSID_ID_POSITION 12
481 490
482/* Management Frame Information Element Types */ 491/* Management Frame Information Element Types */
483#define MFIE_TYPE_SSID 0 492enum ieee80211_mfie {
484#define MFIE_TYPE_RATES 1 493 MFIE_TYPE_SSID = 0,
485#define MFIE_TYPE_FH_SET 2 494 MFIE_TYPE_RATES = 1,
486#define MFIE_TYPE_DS_SET 3 495 MFIE_TYPE_FH_SET = 2,
487#define MFIE_TYPE_CF_SET 4 496 MFIE_TYPE_DS_SET = 3,
488#define MFIE_TYPE_TIM 5 497 MFIE_TYPE_CF_SET = 4,
489#define MFIE_TYPE_IBSS_SET 6 498 MFIE_TYPE_TIM = 5,
490#define MFIE_TYPE_CHALLENGE 16 499 MFIE_TYPE_IBSS_SET = 6,
491#define MFIE_TYPE_RSN 48 500 MFIE_TYPE_COUNTRY = 7,
492#define MFIE_TYPE_RATES_EX 50 501 MFIE_TYPE_HOP_PARAMS = 8,
493#define MFIE_TYPE_GENERIC 221 502 MFIE_TYPE_HOP_TABLE = 9,
503 MFIE_TYPE_REQUEST = 10,
504 MFIE_TYPE_CHALLENGE = 16,
505 MFIE_TYPE_POWER_CONSTRAINT = 32,
506 MFIE_TYPE_POWER_CAPABILITY = 33,
507 MFIE_TYPE_TPC_REQUEST = 34,
508 MFIE_TYPE_TPC_REPORT = 35,
509 MFIE_TYPE_SUPP_CHANNELS = 36,
510 MFIE_TYPE_CSA = 37,
511 MFIE_TYPE_MEASURE_REQUEST = 38,
512 MFIE_TYPE_MEASURE_REPORT = 39,
513 MFIE_TYPE_QUIET = 40,
514 MFIE_TYPE_IBSS_DFS = 41,
515 MFIE_TYPE_ERP_INFO = 42,
516 MFIE_TYPE_RSN = 48,
517 MFIE_TYPE_RATES_EX = 50,
518 MFIE_TYPE_GENERIC = 221,
519};
494 520
495struct ieee80211_info_element_hdr { 521struct ieee80211_info_element_hdr {
496 u8 id; 522 u8 id;
@@ -522,9 +548,9 @@ struct ieee80211_info_element {
522 548
523struct ieee80211_authentication { 549struct ieee80211_authentication {
524 struct ieee80211_hdr_3addr header; 550 struct ieee80211_hdr_3addr header;
525 u16 algorithm; 551 __le16 algorithm;
526 u16 transaction; 552 __le16 transaction;
527 u16 status; 553 __le16 status;
528 struct ieee80211_info_element info_element; 554 struct ieee80211_info_element info_element;
529} __attribute__ ((packed)); 555} __attribute__ ((packed));
530 556
@@ -532,23 +558,23 @@ struct ieee80211_authentication {
532struct ieee80211_probe_response { 558struct ieee80211_probe_response {
533 struct ieee80211_hdr_3addr header; 559 struct ieee80211_hdr_3addr header;
534 u32 time_stamp[2]; 560 u32 time_stamp[2];
535 u16 beacon_interval; 561 __le16 beacon_interval;
536 u16 capability; 562 __le16 capability;
537 struct ieee80211_info_element info_element; 563 struct ieee80211_info_element info_element;
538} __attribute__ ((packed)); 564} __attribute__ ((packed));
539 565
540struct ieee80211_assoc_request_frame { 566struct ieee80211_assoc_request_frame {
541 u16 capability; 567 __le16 capability;
542 u16 listen_interval; 568 __le16 listen_interval;
543 u8 current_ap[ETH_ALEN]; 569 u8 current_ap[ETH_ALEN];
544 struct ieee80211_info_element info_element; 570 struct ieee80211_info_element info_element;
545} __attribute__ ((packed)); 571} __attribute__ ((packed));
546 572
547struct ieee80211_assoc_response_frame { 573struct ieee80211_assoc_response_frame {
548 struct ieee80211_hdr_3addr header; 574 struct ieee80211_hdr_3addr header;
549 u16 capability; 575 __le16 capability;
550 u16 status; 576 __le16 status;
551 u16 aid; 577 __le16 aid;
552 struct ieee80211_info_element info_element; /* supported rates */ 578 struct ieee80211_info_element info_element; /* supported rates */
553} __attribute__ ((packed)); 579} __attribute__ ((packed));
554 580
@@ -563,7 +589,7 @@ struct ieee80211_txb {
563}; 589};
564 590
565 591
566/* SWEEP TABLE ENTRIES NUMBER*/ 592/* SWEEP TABLE ENTRIES NUMBER */
567#define MAX_SWEEP_TAB_ENTRIES 42 593#define MAX_SWEEP_TAB_ENTRIES 42
568#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 594#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
569/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs 595/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
@@ -624,8 +650,6 @@ enum ieee80211_state {
624 650
625#define DEFAULT_MAX_SCAN_AGE (15 * HZ) 651#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
626#define DEFAULT_FTS 2346 652#define DEFAULT_FTS 2346
627#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
628#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
629 653
630 654
631#define CFG_IEEE80211_RESERVE_FCS (1<<0) 655#define CFG_IEEE80211_RESERVE_FCS (1<<0)
@@ -793,8 +817,6 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv);
793extern int ieee80211_set_encryption(struct ieee80211_device *ieee); 817extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
794 818
795/* ieee80211_tx.c */ 819/* ieee80211_tx.c */
796
797
798extern int ieee80211_xmit(struct sk_buff *skb, 820extern int ieee80211_xmit(struct sk_buff *skb,
799 struct net_device *dev); 821 struct net_device *dev);
800extern void ieee80211_txb_free(struct ieee80211_txb *); 822extern void ieee80211_txb_free(struct ieee80211_txb *);
@@ -807,7 +829,7 @@ extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
807 struct ieee80211_hdr *header, 829 struct ieee80211_hdr *header,
808 struct ieee80211_rx_stats *stats); 830 struct ieee80211_rx_stats *stats);
809 831
810/* iee80211_wx.c */ 832/* ieee80211_wx.c */
811extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, 833extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
812 struct iw_request_info *info, 834 struct iw_request_info *info,
813 union iwreq_data *wrqu, char *key); 835 union iwreq_data *wrqu, char *key);
@@ -829,28 +851,5 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
829 return ieee->scans; 851 return ieee->scans;
830} 852}
831 853
832static inline const char *escape_essid(const char *essid, u8 essid_len) {
833 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
834 const char *s = essid;
835 char *d = escaped;
836
837 if (ieee80211_is_empty_essid(essid, essid_len)) {
838 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
839 return escaped;
840 }
841
842 essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
843 while (essid_len--) {
844 if (*s == '\0') {
845 *d++ = '\\';
846 *d++ = '0';
847 s++;
848 } else {
849 *d++ = *s++;
850 }
851 }
852 *d = '\0';
853 return escaped;
854}
855 854
856#endif /* IEEE80211_H */ 855#endif /* IEEE80211_H */
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
new file mode 100644
index 000000000000..b58a3bcc0dc0
--- /dev/null
+++ b/include/net/ieee80211_crypt.h
@@ -0,0 +1,86 @@
1/*
2 * Original code based on Host AP (software wireless LAN access point) driver
3 * for Intersil Prism2/2.5/3.
4 *
5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
6 * <jkmaline@cc.hut.fi>
7 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
8 *
9 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
10 * <jketreno@linux.intel.com>
11 *
12 * Copyright (c) 2004, Intel Corporation
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. See README and COPYING for
17 * more details.
18 */
19
20/*
21 * This file defines the interface to the ieee80211 crypto module.
22 */
23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H
25
26#include <linux/skbuff.h>
27
28struct ieee80211_crypto_ops {
29 const char *name;
30
31 /* init new crypto context (e.g., allocate private data space,
32 * select IV, etc.); returns NULL on failure or pointer to allocated
33 * private data on success */
34 void * (*init)(int keyidx);
35
36 /* deinitialize crypto context and free allocated private data */
37 void (*deinit)(void *priv);
38
39 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
40 * value from decrypt_mpdu is passed as the keyidx value for
41 * decrypt_msdu. skb must have enough head and tail room for the
42 * encryption; if not, error will be returned; these functions are
43 * called for all MPDUs (i.e., fragments).
44 */
45 int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv);
46 int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv);
47
48 /* These functions are called for full MSDUs, i.e. full frames.
49 * These can be NULL if full MSDU operations are not needed. */
50 int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv);
51 int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len,
52 void *priv);
53
54 int (*set_key)(void *key, int len, u8 *seq, void *priv);
55 int (*get_key)(void *key, int len, u8 *seq, void *priv);
56
57 /* procfs handler for printing out key information and possible
58 * statistics */
59 char * (*print_stats)(char *p, void *priv);
60
61 /* maximum number of bytes added by encryption; encrypt buf is
62 * allocated with extra_prefix_len bytes, copy of in_buf, and
63 * extra_postfix_len; encrypt need not use all this space, but
64 * the result must start at the beginning of the buffer and correct
65 * length must be returned */
66 int extra_prefix_len, extra_postfix_len;
67
68 struct module *owner;
69};
70
71struct ieee80211_crypt_data {
72 struct list_head list; /* delayed deletion list */
73 struct ieee80211_crypto_ops *ops;
74 void *priv;
75 atomic_t refcnt;
76};
77
78int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
79int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
80struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
81void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
82void ieee80211_crypt_deinit_handler(unsigned long);
83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
84 struct ieee80211_crypt_data **crypt);
85
86#endif
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
new file mode 100644
index 000000000000..03df3b157960
--- /dev/null
+++ b/include/net/inet6_hashtables.h
@@ -0,0 +1,130 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Authors: Lotsa people, from code originally in tcp
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef _INET6_HASHTABLES_H
15#define _INET6_HASHTABLES_H
16
17#include <linux/config.h>
18
19#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
20#include <linux/in6.h>
21#include <linux/ipv6.h>
22#include <linux/types.h>
23
24#include <net/ipv6.h>
25
26struct inet_hashinfo;
27
28/* I have no idea if this is a good hash for v6 or not. -DaveM */
29static inline int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
30 const struct in6_addr *faddr, const u16 fport,
31 const int ehash_size)
32{
33 int hashent = (lport ^ fport);
34
35 hashent ^= (laddr->s6_addr32[3] ^ faddr->s6_addr32[3]);
36 hashent ^= hashent >> 16;
37 hashent ^= hashent >> 8;
38 return (hashent & (ehash_size - 1));
39}
40
41static inline int inet6_sk_ehashfn(const struct sock *sk, const int ehash_size)
42{
43 const struct inet_sock *inet = inet_sk(sk);
44 const struct ipv6_pinfo *np = inet6_sk(sk);
45 const struct in6_addr *laddr = &np->rcv_saddr;
46 const struct in6_addr *faddr = &np->daddr;
47 const __u16 lport = inet->num;
48 const __u16 fport = inet->dport;
49 return inet6_ehashfn(laddr, lport, faddr, fport, ehash_size);
50}
51
52/*
53 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
54 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM
55 *
56 * The sockhash lock must be held as a reader here.
57 */
58static inline struct sock *
59 __inet6_lookup_established(struct inet_hashinfo *hashinfo,
60 const struct in6_addr *saddr,
61 const u16 sport,
62 const struct in6_addr *daddr,
63 const u16 hnum,
64 const int dif)
65{
66 struct sock *sk;
67 const struct hlist_node *node;
68 const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
69 /* Optimize here for direct hit, only listening connections can
70 * have wildcards anyways.
71 */
72 const int hash = inet6_ehashfn(daddr, hnum, saddr, sport,
73 hashinfo->ehash_size);
74 struct inet_ehash_bucket *head = &hashinfo->ehash[hash];
75
76 read_lock(&head->lock);
77 sk_for_each(sk, node, &head->chain) {
78 /* For IPV6 do the cheaper port and family tests first. */
79 if (INET6_MATCH(sk, saddr, daddr, ports, dif))
80 goto hit; /* You sunk my battleship! */
81 }
82 /* Must check for a TIME_WAIT'er before going to listener hash. */
83 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
84 const struct inet_timewait_sock *tw = inet_twsk(sk);
85
86 if(*((__u32 *)&(tw->tw_dport)) == ports &&
87 sk->sk_family == PF_INET6) {
88 const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk);
89
90 if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) &&
91 ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) &&
92 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
93 goto hit;
94 }
95 }
96 read_unlock(&head->lock);
97 return NULL;
98
99hit:
100 sock_hold(sk);
101 read_unlock(&head->lock);
102 return sk;
103}
104
105extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
106 const struct in6_addr *daddr,
107 const unsigned short hnum,
108 const int dif);
109
110static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo,
111 const struct in6_addr *saddr,
112 const u16 sport,
113 const struct in6_addr *daddr,
114 const u16 hnum,
115 const int dif)
116{
117 struct sock *sk = __inet6_lookup_established(hashinfo, saddr, sport,
118 daddr, hnum, dif);
119 if (sk)
120 return sk;
121
122 return inet6_lookup_listener(hashinfo, daddr, hnum, dif);
123}
124
125extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo,
126 const struct in6_addr *saddr, const u16 sport,
127 const struct in6_addr *daddr, const u16 dport,
128 const int dif);
129#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */
130#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index fbc1f4d140d8..f943306ce5ff 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -8,6 +8,11 @@ extern struct proto_ops inet_dgram_ops;
8 * INET4 prototypes used by INET6 8 * INET4 prototypes used by INET6
9 */ 9 */
10 10
11struct msghdr;
12struct sock;
13struct sockaddr;
14struct socket;
15
11extern void inet_remove_sock(struct sock *sk1); 16extern void inet_remove_sock(struct sock *sk1);
12extern void inet_put_sock(unsigned short num, 17extern void inet_put_sock(unsigned short num,
13 struct sock *sk); 18 struct sock *sk);
@@ -29,7 +34,6 @@ extern unsigned int inet_poll(struct file * file, struct socket *sock, struct p
29extern int inet_listen(struct socket *sock, int backlog); 34extern int inet_listen(struct socket *sock, int backlog);
30 35
31extern void inet_sock_destruct(struct sock *sk); 36extern void inet_sock_destruct(struct sock *sk);
32extern atomic_t inet_sock_nr;
33 37
34extern int inet_bind(struct socket *sock, 38extern int inet_bind(struct socket *sock,
35 struct sockaddr *uaddr, int addr_len); 39 struct sockaddr *uaddr, int addr_len);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
new file mode 100644
index 000000000000..651f824c1008
--- /dev/null
+++ b/include/net/inet_connection_sock.h
@@ -0,0 +1,276 @@
1/*
2 * NET Generic infrastructure for INET connection oriented protocols.
3 *
4 * Definitions for inet_connection_sock
5 *
6 * Authors: Many people, see the TCP sources
7 *
8 * From code originally in TCP
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#ifndef _INET_CONNECTION_SOCK_H
16#define _INET_CONNECTION_SOCK_H
17
18#include <linux/ip.h>
19#include <linux/string.h>
20#include <linux/timer.h>
21#include <net/request_sock.h>
22
23#define INET_CSK_DEBUG 1
24
25/* Cancel timers, when they are not required. */
26#undef INET_CSK_CLEAR_TIMERS
27
28struct inet_bind_bucket;
29struct inet_hashinfo;
30struct tcp_congestion_ops;
31
32/** inet_connection_sock - INET connection oriented sock
33 *
34 * @icsk_accept_queue: FIFO of established children
35 * @icsk_bind_hash: Bind node
36 * @icsk_timeout: Timeout
37 * @icsk_retransmit_timer: Resend (no ack)
38 * @icsk_rto: Retransmit timeout
39 * @icsk_ca_ops Pluggable congestion control hook
40 * @icsk_ca_state: Congestion control state
41 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
42 * @icsk_pending: Scheduled timer event
43 * @icsk_backoff: Backoff
44 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
45 * @icsk_probes_out: unanswered 0 window probes
46 * @icsk_ack: Delayed ACK control data
47 */
48struct inet_connection_sock {
49 /* inet_sock has to be the first member! */
50 struct inet_sock icsk_inet;
51 struct request_sock_queue icsk_accept_queue;
52 struct inet_bind_bucket *icsk_bind_hash;
53 unsigned long icsk_timeout;
54 struct timer_list icsk_retransmit_timer;
55 struct timer_list icsk_delack_timer;
56 __u32 icsk_rto;
57 struct tcp_congestion_ops *icsk_ca_ops;
58 __u8 icsk_ca_state;
59 __u8 icsk_retransmits;
60 __u8 icsk_pending;
61 __u8 icsk_backoff;
62 __u8 icsk_syn_retries;
63 __u8 icsk_probes_out;
64 /* 2 BYTES HOLE, TRY TO PACK! */
65 struct {
66 __u8 pending; /* ACK is pending */
67 __u8 quick; /* Scheduled number of quick acks */
68 __u8 pingpong; /* The session is interactive */
69 __u8 blocked; /* Delayed ACK was blocked by socket lock */
70 __u32 ato; /* Predicted tick of soft clock */
71 unsigned long timeout; /* Currently scheduled timeout */
72 __u32 lrcvtime; /* timestamp of last received data packet */
73 __u16 last_seg_size; /* Size of last incoming segment */
74 __u16 rcv_mss; /* MSS used for delayed ACK decisions */
75 } icsk_ack;
76 u32 icsk_ca_priv[16];
77#define ICSK_CA_PRIV_SIZE (16 * sizeof(u32))
78};
79
80#define ICSK_TIME_RETRANS 1 /* Retransmit timer */
81#define ICSK_TIME_DACK 2 /* Delayed ack timer */
82#define ICSK_TIME_PROBE0 3 /* Zero window probe timer */
83#define ICSK_TIME_KEEPOPEN 4 /* Keepalive timer */
84
85static inline struct inet_connection_sock *inet_csk(const struct sock *sk)
86{
87 return (struct inet_connection_sock *)sk;
88}
89
90static inline void *inet_csk_ca(const struct sock *sk)
91{
92 return (void *)inet_csk(sk)->icsk_ca_priv;
93}
94
95extern struct sock *inet_csk_clone(struct sock *sk,
96 const struct request_sock *req,
97 const unsigned int __nocast priority);
98
99enum inet_csk_ack_state_t {
100 ICSK_ACK_SCHED = 1,
101 ICSK_ACK_TIMER = 2,
102 ICSK_ACK_PUSHED = 4
103};
104
105extern void inet_csk_init_xmit_timers(struct sock *sk,
106 void (*retransmit_handler)(unsigned long),
107 void (*delack_handler)(unsigned long),
108 void (*keepalive_handler)(unsigned long));
109extern void inet_csk_clear_xmit_timers(struct sock *sk);
110
111static inline void inet_csk_schedule_ack(struct sock *sk)
112{
113 inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_SCHED;
114}
115
116static inline int inet_csk_ack_scheduled(const struct sock *sk)
117{
118 return inet_csk(sk)->icsk_ack.pending & ICSK_ACK_SCHED;
119}
120
121static inline void inet_csk_delack_init(struct sock *sk)
122{
123 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack));
124}
125
126extern void inet_csk_delete_keepalive_timer(struct sock *sk);
127extern void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout);
128
129#ifdef INET_CSK_DEBUG
130extern const char inet_csk_timer_bug_msg[];
131#endif
132
133static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what)
134{
135 struct inet_connection_sock *icsk = inet_csk(sk);
136
137 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) {
138 icsk->icsk_pending = 0;
139#ifdef INET_CSK_CLEAR_TIMERS
140 sk_stop_timer(sk, &icsk->icsk_retransmit_timer);
141#endif
142 } else if (what == ICSK_TIME_DACK) {
143 icsk->icsk_ack.blocked = icsk->icsk_ack.pending = 0;
144#ifdef INET_CSK_CLEAR_TIMERS
145 sk_stop_timer(sk, &icsk->icsk_delack_timer);
146#endif
147 }
148#ifdef INET_CSK_DEBUG
149 else {
150 pr_debug("%s", inet_csk_timer_bug_msg);
151 }
152#endif
153}
154
155/*
156 * Reset the retransmission timer
157 */
158static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
159 unsigned long when,
160 const unsigned long max_when)
161{
162 struct inet_connection_sock *icsk = inet_csk(sk);
163
164 if (when > max_when) {
165#ifdef INET_CSK_DEBUG
166 pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
167 sk, what, when, current_text_addr());
168#endif
169 when = max_when;
170 }
171
172 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) {
173 icsk->icsk_pending = what;
174 icsk->icsk_timeout = jiffies + when;
175 sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout);
176 } else if (what == ICSK_TIME_DACK) {
177 icsk->icsk_ack.pending |= ICSK_ACK_TIMER;
178 icsk->icsk_ack.timeout = jiffies + when;
179 sk_reset_timer(sk, &icsk->icsk_delack_timer, icsk->icsk_ack.timeout);
180 }
181#ifdef INET_CSK_DEBUG
182 else {
183 pr_debug("%s", inet_csk_timer_bug_msg);
184 }
185#endif
186}
187
188extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
189
190extern struct request_sock *inet_csk_search_req(const struct sock *sk,
191 struct request_sock ***prevp,
192 const __u16 rport,
193 const __u32 raddr,
194 const __u32 laddr);
195extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
196 struct sock *sk, unsigned short snum);
197
198extern struct dst_entry* inet_csk_route_req(struct sock *sk,
199 const struct request_sock *req);
200
201static inline void inet_csk_reqsk_queue_add(struct sock *sk,
202 struct request_sock *req,
203 struct sock *child)
204{
205 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child);
206}
207
208extern void inet_csk_reqsk_queue_hash_add(struct sock *sk,
209 struct request_sock *req,
210 const unsigned timeout);
211
212static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
213 struct request_sock *req)
214{
215 if (reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req) == 0)
216 inet_csk_delete_keepalive_timer(sk);
217}
218
219static inline void inet_csk_reqsk_queue_added(struct sock *sk,
220 const unsigned long timeout)
221{
222 if (reqsk_queue_added(&inet_csk(sk)->icsk_accept_queue) == 0)
223 inet_csk_reset_keepalive_timer(sk, timeout);
224}
225
226static inline int inet_csk_reqsk_queue_len(const struct sock *sk)
227{
228 return reqsk_queue_len(&inet_csk(sk)->icsk_accept_queue);
229}
230
231static inline int inet_csk_reqsk_queue_young(const struct sock *sk)
232{
233 return reqsk_queue_len_young(&inet_csk(sk)->icsk_accept_queue);
234}
235
236static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)
237{
238 return reqsk_queue_is_full(&inet_csk(sk)->icsk_accept_queue);
239}
240
241static inline void inet_csk_reqsk_queue_unlink(struct sock *sk,
242 struct request_sock *req,
243 struct request_sock **prev)
244{
245 reqsk_queue_unlink(&inet_csk(sk)->icsk_accept_queue, req, prev);
246}
247
248static inline void inet_csk_reqsk_queue_drop(struct sock *sk,
249 struct request_sock *req,
250 struct request_sock **prev)
251{
252 inet_csk_reqsk_queue_unlink(sk, req, prev);
253 inet_csk_reqsk_queue_removed(sk, req);
254 reqsk_free(req);
255}
256
257extern void inet_csk_reqsk_queue_prune(struct sock *parent,
258 const unsigned long interval,
259 const unsigned long timeout,
260 const unsigned long max_rto);
261
262extern void inet_csk_destroy_sock(struct sock *sk);
263
264/*
265 * LISTEN is a special case for poll..
266 */
267static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
268{
269 return !reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue) ?
270 (POLLIN | POLLRDNORM) : 0;
271}
272
273extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
274extern void inet_csk_listen_stop(struct sock *sk);
275
276#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
new file mode 100644
index 000000000000..646b6ea7fe26
--- /dev/null
+++ b/include/net/inet_hashtables.h
@@ -0,0 +1,427 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Authors: Lotsa people, from code originally in tcp
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef _INET_HASHTABLES_H
15#define _INET_HASHTABLES_H
16
17#include <linux/config.h>
18
19#include <linux/interrupt.h>
20#include <linux/ipv6.h>
21#include <linux/list.h>
22#include <linux/slab.h>
23#include <linux/socket.h>
24#include <linux/spinlock.h>
25#include <linux/types.h>
26#include <linux/wait.h>
27
28#include <net/inet_connection_sock.h>
29#include <net/route.h>
30#include <net/sock.h>
31#include <net/tcp_states.h>
32
33#include <asm/atomic.h>
34#include <asm/byteorder.h>
35
36/* This is for all connections with a full identity, no wildcards.
37 * New scheme, half the table is for TIME_WAIT, the other half is
38 * for the rest. I'll experiment with dynamic table growth later.
39 */
40struct inet_ehash_bucket {
41 rwlock_t lock;
42 struct hlist_head chain;
43} __attribute__((__aligned__(8)));
44
45/* There are a few simple rules, which allow for local port reuse by
46 * an application. In essence:
47 *
48 * 1) Sockets bound to different interfaces may share a local port.
49 * Failing that, goto test 2.
50 * 2) If all sockets have sk->sk_reuse set, and none of them are in
51 * TCP_LISTEN state, the port may be shared.
52 * Failing that, goto test 3.
53 * 3) If all sockets are bound to a specific inet_sk(sk)->rcv_saddr local
54 * address, and none of them are the same, the port may be
55 * shared.
56 * Failing this, the port cannot be shared.
57 *
58 * The interesting point, is test #2. This is what an FTP server does
59 * all day. To optimize this case we use a specific flag bit defined
60 * below. As we add sockets to a bind bucket list, we perform a
61 * check of: (newsk->sk_reuse && (newsk->sk_state != TCP_LISTEN))
62 * As long as all sockets added to a bind bucket pass this test,
63 * the flag bit will be set.
64 * The resulting situation is that tcp_v[46]_verify_bind() can just check
65 * for this flag bit, if it is set and the socket trying to bind has
66 * sk->sk_reuse set, we don't even have to walk the owners list at all,
67 * we return that it is ok to bind this socket to the requested local port.
68 *
69 * Sounds like a lot of work, but it is worth it. In a more naive
70 * implementation (ie. current FreeBSD etc.) the entire list of ports
71 * must be walked for each data port opened by an ftp server. Needless
72 * to say, this does not scale at all. With a couple thousand FTP
73 * users logged onto your box, isn't it nice to know that new data
74 * ports are created in O(1) time? I thought so. ;-) -DaveM
75 */
76struct inet_bind_bucket {
77 unsigned short port;
78 signed short fastreuse;
79 struct hlist_node node;
80 struct hlist_head owners;
81};
82
83#define inet_bind_bucket_for_each(tb, node, head) \
84 hlist_for_each_entry(tb, node, head, node)
85
86struct inet_bind_hashbucket {
87 spinlock_t lock;
88 struct hlist_head chain;
89};
90
91/* This is for listening sockets, thus all sockets which possess wildcards. */
92#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */
93
94struct inet_hashinfo {
95 /* This is for sockets with full identity only. Sockets here will
96 * always be without wildcards and will have the following invariant:
97 *
98 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
99 *
100 * First half of the table is for sockets not in TIME_WAIT, second half
101 * is for TIME_WAIT sockets only.
102 */
103 struct inet_ehash_bucket *ehash;
104
105 /* Ok, let's try this, I give up, we do need a local binding
106 * TCP hash as well as the others for fast bind/connect.
107 */
108 struct inet_bind_hashbucket *bhash;
109
110 int bhash_size;
111 int ehash_size;
112
113 /* All sockets in TCP_LISTEN state will be in here. This is the only
114 * table where wildcard'd TCP sockets can exist. Hash function here
115 * is just local port number.
116 */
117 struct hlist_head listening_hash[INET_LHTABLE_SIZE];
118
119 /* All the above members are written once at bootup and
120 * never written again _or_ are predominantly read-access.
121 *
122 * Now align to a new cache line as all the following members
123 * are often dirty.
124 */
125 rwlock_t lhash_lock ____cacheline_aligned;
126 atomic_t lhash_users;
127 wait_queue_head_t lhash_wait;
128 spinlock_t portalloc_lock;
129 kmem_cache_t *bind_bucket_cachep;
130 int port_rover;
131};
132
133static inline int inet_ehashfn(const __u32 laddr, const __u16 lport,
134 const __u32 faddr, const __u16 fport,
135 const int ehash_size)
136{
137 int h = (laddr ^ lport) ^ (faddr ^ fport);
138 h ^= h >> 16;
139 h ^= h >> 8;
140 return h & (ehash_size - 1);
141}
142
143static inline int inet_sk_ehashfn(const struct sock *sk, const int ehash_size)
144{
145 const struct inet_sock *inet = inet_sk(sk);
146 const __u32 laddr = inet->rcv_saddr;
147 const __u16 lport = inet->num;
148 const __u32 faddr = inet->daddr;
149 const __u16 fport = inet->dport;
150
151 return inet_ehashfn(laddr, lport, faddr, fport, ehash_size);
152}
153
154extern struct inet_bind_bucket *
155 inet_bind_bucket_create(kmem_cache_t *cachep,
156 struct inet_bind_hashbucket *head,
157 const unsigned short snum);
158extern void inet_bind_bucket_destroy(kmem_cache_t *cachep,
159 struct inet_bind_bucket *tb);
160
161static inline int inet_bhashfn(const __u16 lport, const int bhash_size)
162{
163 return lport & (bhash_size - 1);
164}
165
166extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
167 const unsigned short snum);
168
169/* These can have wildcards, don't try too hard. */
170static inline int inet_lhashfn(const unsigned short num)
171{
172 return num & (INET_LHTABLE_SIZE - 1);
173}
174
175static inline int inet_sk_listen_hashfn(const struct sock *sk)
176{
177 return inet_lhashfn(inet_sk(sk)->num);
178}
179
180/* Caller must disable local BH processing. */
181static inline void __inet_inherit_port(struct inet_hashinfo *table,
182 struct sock *sk, struct sock *child)
183{
184 const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size);
185 struct inet_bind_hashbucket *head = &table->bhash[bhash];
186 struct inet_bind_bucket *tb;
187
188 spin_lock(&head->lock);
189 tb = inet_csk(sk)->icsk_bind_hash;
190 sk_add_bind_node(child, &tb->owners);
191 inet_csk(child)->icsk_bind_hash = tb;
192 spin_unlock(&head->lock);
193}
194
195static inline void inet_inherit_port(struct inet_hashinfo *table,
196 struct sock *sk, struct sock *child)
197{
198 local_bh_disable();
199 __inet_inherit_port(table, sk, child);
200 local_bh_enable();
201}
202
203extern void inet_put_port(struct inet_hashinfo *table, struct sock *sk);
204
205extern void inet_listen_wlock(struct inet_hashinfo *hashinfo);
206
207/*
208 * - We may sleep inside this lock.
209 * - If sleeping is not required (or called from BH),
210 * use plain read_(un)lock(&inet_hashinfo.lhash_lock).
211 */
212static inline void inet_listen_lock(struct inet_hashinfo *hashinfo)
213{
214 /* read_lock synchronizes to candidates to writers */
215 read_lock(&hashinfo->lhash_lock);
216 atomic_inc(&hashinfo->lhash_users);
217 read_unlock(&hashinfo->lhash_lock);
218}
219
220static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
221{
222 if (atomic_dec_and_test(&hashinfo->lhash_users))
223 wake_up(&hashinfo->lhash_wait);
224}
225
226static inline void __inet_hash(struct inet_hashinfo *hashinfo,
227 struct sock *sk, const int listen_possible)
228{
229 struct hlist_head *list;
230 rwlock_t *lock;
231
232 BUG_TRAP(sk_unhashed(sk));
233 if (listen_possible && sk->sk_state == TCP_LISTEN) {
234 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
235 lock = &hashinfo->lhash_lock;
236 inet_listen_wlock(hashinfo);
237 } else {
238 sk->sk_hashent = inet_sk_ehashfn(sk, hashinfo->ehash_size);
239 list = &hashinfo->ehash[sk->sk_hashent].chain;
240 lock = &hashinfo->ehash[sk->sk_hashent].lock;
241 write_lock(lock);
242 }
243 __sk_add_node(sk, list);
244 sock_prot_inc_use(sk->sk_prot);
245 write_unlock(lock);
246 if (listen_possible && sk->sk_state == TCP_LISTEN)
247 wake_up(&hashinfo->lhash_wait);
248}
249
250static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk)
251{
252 if (sk->sk_state != TCP_CLOSE) {
253 local_bh_disable();
254 __inet_hash(hashinfo, sk, 1);
255 local_bh_enable();
256 }
257}
258
259static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
260{
261 rwlock_t *lock;
262
263 if (sk_unhashed(sk))
264 goto out;
265
266 if (sk->sk_state == TCP_LISTEN) {
267 local_bh_disable();
268 inet_listen_wlock(hashinfo);
269 lock = &hashinfo->lhash_lock;
270 } else {
271 struct inet_ehash_bucket *head = &hashinfo->ehash[sk->sk_hashent];
272 lock = &head->lock;
273 write_lock_bh(&head->lock);
274 }
275
276 if (__sk_del_node_init(sk))
277 sock_prot_dec_use(sk->sk_prot);
278 write_unlock_bh(lock);
279out:
280 if (sk->sk_state == TCP_LISTEN)
281 wake_up(&hashinfo->lhash_wait);
282}
283
284static inline int inet_iif(const struct sk_buff *skb)
285{
286 return ((struct rtable *)skb->dst)->rt_iif;
287}
288
289extern struct sock *__inet_lookup_listener(const struct hlist_head *head,
290 const u32 daddr,
291 const unsigned short hnum,
292 const int dif);
293
294/* Optimize the common listener case. */
295static inline struct sock *
296 inet_lookup_listener(struct inet_hashinfo *hashinfo,
297 const u32 daddr,
298 const unsigned short hnum, const int dif)
299{
300 struct sock *sk = NULL;
301 const struct hlist_head *head;
302
303 read_lock(&hashinfo->lhash_lock);
304 head = &hashinfo->listening_hash[inet_lhashfn(hnum)];
305 if (!hlist_empty(head)) {
306 const struct inet_sock *inet = inet_sk((sk = __sk_head(head)));
307
308 if (inet->num == hnum && !sk->sk_node.next &&
309 (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
310 (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
311 !sk->sk_bound_dev_if)
312 goto sherry_cache;
313 sk = __inet_lookup_listener(head, daddr, hnum, dif);
314 }
315 if (sk) {
316sherry_cache:
317 sock_hold(sk);
318 }
319 read_unlock(&hashinfo->lhash_lock);
320 return sk;
321}
322
323/* Socket demux engine toys. */
324#ifdef __BIG_ENDIAN
325#define INET_COMBINED_PORTS(__sport, __dport) \
326 (((__u32)(__sport) << 16) | (__u32)(__dport))
327#else /* __LITTLE_ENDIAN */
328#define INET_COMBINED_PORTS(__sport, __dport) \
329 (((__u32)(__dport) << 16) | (__u32)(__sport))
330#endif
331
332#if (BITS_PER_LONG == 64)
333#ifdef __BIG_ENDIAN
334#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
335 const __u64 __name = (((__u64)(__saddr)) << 32) | ((__u64)(__daddr));
336#else /* __LITTLE_ENDIAN */
337#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
338 const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr));
339#endif /* __BIG_ENDIAN */
340#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
341 (((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
342 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
343 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
344#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
345 (((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
346 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
347 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
348#else /* 32-bit arch */
349#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
350#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \
351 ((inet_sk(__sk)->daddr == (__saddr)) && \
352 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
353 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
354 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
355#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \
356 ((inet_twsk(__sk)->tw_daddr == (__saddr)) && \
357 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
358 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
359 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
360#endif /* 64-bit arch */
361
362/*
363 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we need
364 * not check it for lookups anymore, thanks Alexey. -DaveM
365 *
366 * Local BH must be disabled here.
367 */
368static inline struct sock *
369 __inet_lookup_established(struct inet_hashinfo *hashinfo,
370 const u32 saddr, const u16 sport,
371 const u32 daddr, const u16 hnum,
372 const int dif)
373{
374 INET_ADDR_COOKIE(acookie, saddr, daddr)
375 const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
376 struct sock *sk;
377 const struct hlist_node *node;
378 /* Optimize here for direct hit, only listening connections can
379 * have wildcards anyways.
380 */
381 const int hash = inet_ehashfn(daddr, hnum, saddr, sport, hashinfo->ehash_size);
382 struct inet_ehash_bucket *head = &hashinfo->ehash[hash];
383
384 read_lock(&head->lock);
385 sk_for_each(sk, node, &head->chain) {
386 if (INET_MATCH(sk, acookie, saddr, daddr, ports, dif))
387 goto hit; /* You sunk my battleship! */
388 }
389
390 /* Must check for a TIME_WAIT'er before going to listener hash. */
391 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
392 if (INET_TW_MATCH(sk, acookie, saddr, daddr, ports, dif))
393 goto hit;
394 }
395 sk = NULL;
396out:
397 read_unlock(&head->lock);
398 return sk;
399hit:
400 sock_hold(sk);
401 goto out;
402}
403
404static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
405 const u32 saddr, const u16 sport,
406 const u32 daddr, const u16 hnum,
407 const int dif)
408{
409 struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr,
410 hnum, dif);
411 return sk ? : inet_lookup_listener(hashinfo, daddr, hnum, dif);
412}
413
414static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
415 const u32 saddr, const u16 sport,
416 const u32 daddr, const u16 dport,
417 const int dif)
418{
419 struct sock *sk;
420
421 local_bh_disable();
422 sk = __inet_lookup(hashinfo, saddr, sport, daddr, ntohs(dport), dif);
423 local_bh_enable();
424
425 return sk;
426}
427#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
new file mode 100644
index 000000000000..3b070352e869
--- /dev/null
+++ b/include/net/inet_timewait_sock.h
@@ -0,0 +1,219 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for a generic INET TIMEWAIT sock
7 *
8 * From code originally in net/tcp.h
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#ifndef _INET_TIMEWAIT_SOCK_
16#define _INET_TIMEWAIT_SOCK_
17
18#include <linux/config.h>
19
20#include <linux/ip.h>
21#include <linux/list.h>
22#include <linux/timer.h>
23#include <linux/types.h>
24#include <linux/workqueue.h>
25
26#include <net/sock.h>
27#include <net/tcp_states.h>
28
29#include <asm/atomic.h>
30
31struct inet_hashinfo;
32
33#define INET_TWDR_RECYCLE_SLOTS_LOG 5
34#define INET_TWDR_RECYCLE_SLOTS (1 << INET_TWDR_RECYCLE_SLOTS_LOG)
35
36/*
37 * If time > 4sec, it is "slow" path, no recycling is required,
38 * so that we select tick to get range about 4 seconds.
39 */
40#if HZ <= 16 || HZ > 4096
41# error Unsupported: HZ <= 16 or HZ > 4096
42#elif HZ <= 32
43# define INET_TWDR_RECYCLE_TICK (5 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
44#elif HZ <= 64
45# define INET_TWDR_RECYCLE_TICK (6 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
46#elif HZ <= 128
47# define INET_TWDR_RECYCLE_TICK (7 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
48#elif HZ <= 256
49# define INET_TWDR_RECYCLE_TICK (8 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
50#elif HZ <= 512
51# define INET_TWDR_RECYCLE_TICK (9 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
52#elif HZ <= 1024
53# define INET_TWDR_RECYCLE_TICK (10 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
54#elif HZ <= 2048
55# define INET_TWDR_RECYCLE_TICK (11 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
56#else
57# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
58#endif
59
60/* TIME_WAIT reaping mechanism. */
61#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
62
63#define INET_TWDR_TWKILL_QUOTA 100
64
65struct inet_timewait_death_row {
66 /* Short-time timewait calendar */
67 int twcal_hand;
68 int twcal_jiffie;
69 struct timer_list twcal_timer;
70 struct hlist_head twcal_row[INET_TWDR_RECYCLE_SLOTS];
71
72 spinlock_t death_lock;
73 int tw_count;
74 int period;
75 u32 thread_slots;
76 struct work_struct twkill_work;
77 struct timer_list tw_timer;
78 int slot;
79 struct hlist_head cells[INET_TWDR_TWKILL_SLOTS];
80 struct inet_hashinfo *hashinfo;
81 int sysctl_tw_recycle;
82 int sysctl_max_tw_buckets;
83};
84
85extern void inet_twdr_hangman(unsigned long data);
86extern void inet_twdr_twkill_work(void *data);
87extern void inet_twdr_twcal_tick(unsigned long data);
88
89#if (BITS_PER_LONG == 64)
90#define INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES 8
91#else
92#define INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES 4
93#endif
94
95struct inet_bind_bucket;
96
97/*
98 * This is a TIME_WAIT sock. It works around the memory consumption
99 * problems of sockets in such a state on heavily loaded servers, but
100 * without violating the protocol specification.
101 */
102struct inet_timewait_sock {
103 /*
104 * Now struct sock also uses sock_common, so please just
105 * don't add nothing before this first member (__tw_common) --acme
106 */
107 struct sock_common __tw_common;
108#define tw_family __tw_common.skc_family
109#define tw_state __tw_common.skc_state
110#define tw_reuse __tw_common.skc_reuse
111#define tw_bound_dev_if __tw_common.skc_bound_dev_if
112#define tw_node __tw_common.skc_node
113#define tw_bind_node __tw_common.skc_bind_node
114#define tw_refcnt __tw_common.skc_refcnt
115#define tw_prot __tw_common.skc_prot
116 volatile unsigned char tw_substate;
117 /* 3 bits hole, try to pack */
118 unsigned char tw_rcv_wscale;
119 /* Socket demultiplex comparisons on incoming packets. */
120 /* these five are in inet_sock */
121 __u16 tw_sport;
122 __u32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES)));
123 __u32 tw_rcv_saddr;
124 __u16 tw_dport;
125 __u16 tw_num;
126 /* And these are ours. */
127 __u8 tw_ipv6only:1;
128 /* 31 bits hole, try to pack */
129 int tw_hashent;
130 int tw_timeout;
131 unsigned long tw_ttd;
132 struct inet_bind_bucket *tw_tb;
133 struct hlist_node tw_death_node;
134};
135
136static inline void inet_twsk_add_node(struct inet_timewait_sock *tw,
137 struct hlist_head *list)
138{
139 hlist_add_head(&tw->tw_node, list);
140}
141
142static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
143 struct hlist_head *list)
144{
145 hlist_add_head(&tw->tw_bind_node, list);
146}
147
148static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
149{
150 return tw->tw_death_node.pprev != NULL;
151}
152
153static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw)
154{
155 tw->tw_death_node.pprev = NULL;
156}
157
158static inline void __inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
159{
160 __hlist_del(&tw->tw_death_node);
161 inet_twsk_dead_node_init(tw);
162}
163
164static inline int inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
165{
166 if (inet_twsk_dead_hashed(tw)) {
167 __inet_twsk_del_dead_node(tw);
168 return 1;
169 }
170 return 0;
171}
172
173#define inet_twsk_for_each(tw, node, head) \
174 hlist_for_each_entry(tw, node, head, tw_node)
175
176#define inet_twsk_for_each_inmate(tw, node, jail) \
177 hlist_for_each_entry(tw, node, jail, tw_death_node)
178
179#define inet_twsk_for_each_inmate_safe(tw, node, safe, jail) \
180 hlist_for_each_entry_safe(tw, node, safe, jail, tw_death_node)
181
182static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
183{
184 return (struct inet_timewait_sock *)sk;
185}
186
187static inline u32 inet_rcv_saddr(const struct sock *sk)
188{
189 return likely(sk->sk_state != TCP_TIME_WAIT) ?
190 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
191}
192
193static inline void inet_twsk_put(struct inet_timewait_sock *tw)
194{
195 if (atomic_dec_and_test(&tw->tw_refcnt)) {
196#ifdef SOCK_REFCNT_DEBUG
197 printk(KERN_DEBUG "%s timewait_sock %p released\n",
198 tw->tw_prot->name, tw);
199#endif
200 kmem_cache_free(tw->tw_prot->twsk_slab, tw);
201 }
202}
203
204extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
205 const int state);
206
207extern void __inet_twsk_kill(struct inet_timewait_sock *tw,
208 struct inet_hashinfo *hashinfo);
209
210extern void __inet_twsk_hashdance(struct inet_timewait_sock *tw,
211 struct sock *sk,
212 struct inet_hashinfo *hashinfo);
213
214extern void inet_twsk_schedule(struct inet_timewait_sock *tw,
215 struct inet_timewait_death_row *twdr,
216 const int timeo, const int timewait_len);
217extern void inet_twsk_deschedule(struct inet_timewait_sock *tw,
218 struct inet_timewait_death_row *twdr);
219#endif /* _INET_TIMEWAIT_SOCK_ */
diff --git a/include/net/ip.h b/include/net/ip.h
index 32360bbe143f..e4563bbee6ea 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -86,7 +86,7 @@ extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
86 u32 saddr, u32 daddr, 86 u32 saddr, u32 daddr,
87 struct ip_options *opt); 87 struct ip_options *opt);
88extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, 88extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
89 struct packet_type *pt); 89 struct packet_type *pt, struct net_device *orig_dev);
90extern int ip_local_deliver(struct sk_buff *skb); 90extern int ip_local_deliver(struct sk_buff *skb);
91extern int ip_mr_input(struct sk_buff *skb); 91extern int ip_mr_input(struct sk_buff *skb);
92extern int ip_output(struct sk_buff *skb); 92extern int ip_output(struct sk_buff *skb);
@@ -140,8 +140,6 @@ struct ip_reply_arg {
140void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, 140void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
141 unsigned int len); 141 unsigned int len);
142 142
143extern int ip_finish_output(struct sk_buff *skb);
144
145struct ipv4_config 143struct ipv4_config
146{ 144{
147 int log_martians; 145 int log_martians;
@@ -165,6 +163,24 @@ extern int sysctl_local_port_range[2];
165extern int sysctl_ip_default_ttl; 163extern int sysctl_ip_default_ttl;
166extern int sysctl_ip_nonlocal_bind; 164extern int sysctl_ip_nonlocal_bind;
167 165
166/* From ip_fragment.c */
167extern int sysctl_ipfrag_high_thresh;
168extern int sysctl_ipfrag_low_thresh;
169extern int sysctl_ipfrag_time;
170extern int sysctl_ipfrag_secret_interval;
171
172/* From inetpeer.c */
173extern int inet_peer_threshold;
174extern int inet_peer_minttl;
175extern int inet_peer_maxttl;
176extern int inet_peer_gc_mintime;
177extern int inet_peer_gc_maxtime;
178
179/* From ip_output.c */
180extern int sysctl_ip_dynaddr;
181
182extern void ipfrag_init(void);
183
168#ifdef CONFIG_INET 184#ifdef CONFIG_INET
169/* The function in 2.2 was invalid, producing wrong result for 185/* The function in 2.2 was invalid, producing wrong result for
170 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ 186 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */
@@ -319,7 +335,10 @@ extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 da
319extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 335extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
320extern void ip_options_fragment(struct sk_buff *skb); 336extern void ip_options_fragment(struct sk_buff *skb);
321extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); 337extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb);
322extern int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen, int user); 338extern int ip_options_get(struct ip_options **optp,
339 unsigned char *data, int optlen);
340extern int ip_options_get_from_user(struct ip_options **optp,
341 unsigned char __user *data, int optlen);
323extern void ip_options_undo(struct ip_options * opt); 342extern void ip_options_undo(struct ip_options * opt);
324extern void ip_forward_options(struct sk_buff *skb); 343extern void ip_forward_options(struct sk_buff *skb);
325extern int ip_options_rcv_srr(struct sk_buff *skb); 344extern int ip_options_rcv_srr(struct sk_buff *skb);
@@ -350,5 +369,10 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
350 void __user *oldval, size_t __user *oldlenp, 369 void __user *oldval, size_t __user *oldlenp,
351 void __user *newval, size_t newlen, 370 void __user *newval, size_t newlen,
352 void **context); 371 void **context);
372#ifdef CONFIG_PROC_FS
373extern int ip_misc_proc_init(void);
374#endif
375
376extern struct ctl_table ipv4_table[];
353 377
354#endif /* _IP_H */ 378#endif /* _IP_H */
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f920706d526b..1f2e428ca364 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -12,7 +12,6 @@
12#include <net/flow.h> 12#include <net/flow.h>
13#include <net/ip6_fib.h> 13#include <net/ip6_fib.h>
14#include <net/sock.h> 14#include <net/sock.h>
15#include <linux/tcp.h>
16#include <linux/ip.h> 15#include <linux/ip.h>
17#include <linux/ipv6.h> 16#include <linux/ipv6.h>
18 17
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index a4208a336ac0..14de4ebd1211 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -295,4 +295,9 @@ static inline void fib_res_put(struct fib_result *res)
295#endif 295#endif
296} 296}
297 297
298#ifdef CONFIG_PROC_FS
299extern int fib_proc_init(void);
300extern void fib_proc_exit(void);
301#endif
302
298#endif /* _NET_FIB_H */ 303#endif /* _NET_FIB_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 52da5d26617a..e426641c519f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -255,7 +255,6 @@ struct ip_vs_daemon_user {
255#include <asm/atomic.h> /* for struct atomic_t */ 255#include <asm/atomic.h> /* for struct atomic_t */
256#include <linux/netdevice.h> /* for struct neighbour */ 256#include <linux/netdevice.h> /* for struct neighbour */
257#include <net/dst.h> /* for struct dst_entry */ 257#include <net/dst.h> /* for struct dst_entry */
258#include <net/tcp.h>
259#include <net/udp.h> 258#include <net/udp.h>
260#include <linux/compiler.h> 259#include <linux/compiler.h>
261 260
@@ -959,7 +958,7 @@ static __inline__ int ip_vs_todrop(void)
959 */ 958 */
960#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) 959#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK)
961 960
962extern __inline__ char ip_vs_fwd_tag(struct ip_vs_conn *cp) 961static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
963{ 962{
964 char fwd; 963 char fwd;
965 964
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 69324465e8b3..3203eaff4bd4 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -104,6 +104,7 @@ struct frag_hdr {
104 104
105#ifdef __KERNEL__ 105#ifdef __KERNEL__
106 106
107#include <linux/config.h>
107#include <net/sock.h> 108#include <net/sock.h>
108 109
109/* sysctls */ 110/* sysctls */
@@ -145,7 +146,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6);
145#define UDP6_INC_STATS(field) SNMP_INC_STATS(udp_stats_in6, field) 146#define UDP6_INC_STATS(field) SNMP_INC_STATS(udp_stats_in6, field)
146#define UDP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_stats_in6, field) 147#define UDP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_stats_in6, field)
147#define UDP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_stats_in6, field) 148#define UDP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_stats_in6, field)
148extern atomic_t inet6_sock_nr;
149 149
150int snmp6_register_dev(struct inet6_dev *idev); 150int snmp6_register_dev(struct inet6_dev *idev);
151int snmp6_unregister_dev(struct inet6_dev *idev); 151int snmp6_unregister_dev(struct inet6_dev *idev);
@@ -346,7 +346,8 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
346 346
347extern int ipv6_rcv(struct sk_buff *skb, 347extern int ipv6_rcv(struct sk_buff *skb,
348 struct net_device *dev, 348 struct net_device *dev,
349 struct packet_type *pt); 349 struct packet_type *pt,
350 struct net_device *orig_dev);
350 351
351/* 352/*
352 * upper-layer output functions 353 * upper-layer output functions
@@ -464,8 +465,38 @@ extern int sysctl_ip6frag_low_thresh;
464extern int sysctl_ip6frag_time; 465extern int sysctl_ip6frag_time;
465extern int sysctl_ip6frag_secret_interval; 466extern int sysctl_ip6frag_secret_interval;
466 467
467#endif /* __KERNEL__ */ 468extern struct proto_ops inet6_stream_ops;
468#endif /* _NET_IPV6_H */ 469extern struct proto_ops inet6_dgram_ops;
470
471extern int ip6_mc_source(int add, int omode, struct sock *sk,
472 struct group_source_req *pgsr);
473extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
474extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
475 struct group_filter __user *optval,
476 int __user *optlen);
477
478#ifdef CONFIG_PROC_FS
479extern int ac6_proc_init(void);
480extern void ac6_proc_exit(void);
481extern int raw6_proc_init(void);
482extern void raw6_proc_exit(void);
483extern int tcp6_proc_init(void);
484extern void tcp6_proc_exit(void);
485extern int udp6_proc_init(void);
486extern void udp6_proc_exit(void);
487extern int ipv6_misc_proc_init(void);
488extern void ipv6_misc_proc_exit(void);
489
490extern struct rt6_statistics rt6_stats;
491#endif
469 492
493#ifdef CONFIG_SYSCTL
494extern ctl_table ipv6_route_table[];
495extern ctl_table ipv6_icmp_table[];
470 496
497extern void ipv6_sysctl_register(void);
498extern void ipv6_sysctl_unregister(void);
499#endif
471 500
501#endif /* __KERNEL__ */
502#endif /* _NET_IPV6_H */
diff --git a/include/net/irda/irlan_filter.h b/include/net/irda/irlan_filter.h
index 3afeb6c94ea4..492dedaa8ac1 100644
--- a/include/net/irda/irlan_filter.h
+++ b/include/net/irda/irlan_filter.h
@@ -28,6 +28,6 @@
28void irlan_check_command_param(struct irlan_cb *self, char *param, 28void irlan_check_command_param(struct irlan_cb *self, char *param,
29 char *value); 29 char *value);
30void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb); 30void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb);
31int irlan_print_filter(struct seq_file *seq, int filter_type); 31void irlan_print_filter(struct seq_file *seq, int filter_type);
32 32
33#endif /* IRLAN_FILTER_H */ 33#endif /* IRLAN_FILTER_H */
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 44edd48f1234..d67c8393a343 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define the new driver API for Wireless Extensions 2 * This file define the new driver API for Wireless Extensions
3 * 3 *
4 * Version : 6 21.6.04 4 * Version : 7 18.3.05
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 2001-2004 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 2001-2005 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _IW_HANDLER_H 10#ifndef _IW_HANDLER_H
@@ -207,7 +207,7 @@
207 * will be needed... 207 * will be needed...
208 * I just plan to increment with each new version. 208 * I just plan to increment with each new version.
209 */ 209 */
210#define IW_HANDLER_VERSION 6 210#define IW_HANDLER_VERSION 7
211 211
212/* 212/*
213 * Changes : 213 * Changes :
@@ -232,6 +232,13 @@
232 * - Remove spy #ifdef, they are always on -> cleaner code 232 * - Remove spy #ifdef, they are always on -> cleaner code
233 * - Add IW_DESCR_FLAG_NOMAX flag for very large requests 233 * - Add IW_DESCR_FLAG_NOMAX flag for very large requests
234 * - Start migrating get_wireless_stats to struct iw_handler_def 234 * - Start migrating get_wireless_stats to struct iw_handler_def
235 *
236 * V6 to V7
237 * --------
238 * - Add struct ieee80211_device pointer in struct iw_public_data
239 * - Remove (struct iw_point *)->pointer from events and streams
240 * - Remove spy_offset from struct iw_handler_def
241 * - Add "check" version of event macros for ieee802.11 stack
235 */ 242 */
236 243
237/**************************** CONSTANTS ****************************/ 244/**************************** CONSTANTS ****************************/
@@ -334,9 +341,6 @@ struct iw_handler_def
334 * We will automatically export that to user space... */ 341 * We will automatically export that to user space... */
335 const struct iw_priv_args * private_args; 342 const struct iw_priv_args * private_args;
336 343
337 /* This field will be *removed* in the next version of WE */
338 long spy_offset; /* DO NOT USE */
339
340 /* New location of get_wireless_stats, to de-bloat struct net_device. 344 /* New location of get_wireless_stats, to de-bloat struct net_device.
341 * The old pointer in struct net_device will be gradually phased 345 * The old pointer in struct net_device will be gradually phased
342 * out, and drivers are encouraged to use this one... */ 346 * out, and drivers are encouraged to use this one... */
@@ -400,16 +404,21 @@ struct iw_spy_data
400/* --------------------- DEVICE WIRELESS DATA --------------------- */ 404/* --------------------- DEVICE WIRELESS DATA --------------------- */
401/* 405/*
402 * This is all the wireless data specific to a device instance that 406 * This is all the wireless data specific to a device instance that
403 * is managed by the core of Wireless Extensions. 407 * is managed by the core of Wireless Extensions or the 802.11 layer.
404 * We only keep pointer to those structures, so that a driver is free 408 * We only keep pointer to those structures, so that a driver is free
405 * to share them between instances. 409 * to share them between instances.
406 * This structure should be initialised before registering the device. 410 * This structure should be initialised before registering the device.
407 * Access to this data follow the same rules as any other struct net_device 411 * Access to this data follow the same rules as any other struct net_device
408 * data (i.e. valid as long as struct net_device exist, same locking rules). 412 * data (i.e. valid as long as struct net_device exist, same locking rules).
409 */ 413 */
414/* Forward declaration */
415struct ieee80211_device;
416/* The struct */
410struct iw_public_data { 417struct iw_public_data {
411 /* Driver enhanced spy support */ 418 /* Driver enhanced spy support */
412 struct iw_spy_data * spy_data; 419 struct iw_spy_data * spy_data;
420 /* Structure managed by the in-kernel IEEE 802.11 layer */
421 struct ieee80211_device * ieee80211;
413}; 422};
414 423
415/**************************** PROTOTYPES ****************************/ 424/**************************** PROTOTYPES ****************************/
@@ -424,7 +433,7 @@ struct iw_public_data {
424extern int dev_get_wireless_info(char * buffer, char **start, off_t offset, 433extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
425 int length); 434 int length);
426 435
427/* Handle IOCTLs, called in net/code/dev.c */ 436/* Handle IOCTLs, called in net/core/dev.c */
428extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd); 437extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd);
429 438
430/* Second : functions that may be called by driver modules */ 439/* Second : functions that may be called by driver modules */
@@ -479,7 +488,7 @@ iwe_stream_add_event(char * stream, /* Stream of events */
479 int event_len) /* Real size of payload */ 488 int event_len) /* Real size of payload */
480{ 489{
481 /* Check if it's possible */ 490 /* Check if it's possible */
482 if((stream + event_len) < ends) { 491 if(likely((stream + event_len) < ends)) {
483 iwe->len = event_len; 492 iwe->len = event_len;
484 memcpy(stream, (char *) iwe, event_len); 493 memcpy(stream, (char *) iwe, event_len);
485 stream += event_len; 494 stream += event_len;
@@ -495,14 +504,17 @@ iwe_stream_add_event(char * stream, /* Stream of events */
495static inline char * 504static inline char *
496iwe_stream_add_point(char * stream, /* Stream of events */ 505iwe_stream_add_point(char * stream, /* Stream of events */
497 char * ends, /* End of stream */ 506 char * ends, /* End of stream */
498 struct iw_event *iwe, /* Payload */ 507 struct iw_event *iwe, /* Payload length + flags */
499 char * extra) 508 char * extra) /* More payload */
500{ 509{
501 int event_len = IW_EV_POINT_LEN + iwe->u.data.length; 510 int event_len = IW_EV_POINT_LEN + iwe->u.data.length;
502 /* Check if it's possible */ 511 /* Check if it's possible */
503 if((stream + event_len) < ends) { 512 if(likely((stream + event_len) < ends)) {
504 iwe->len = event_len; 513 iwe->len = event_len;
505 memcpy(stream, (char *) iwe, IW_EV_POINT_LEN); 514 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
515 memcpy(stream + IW_EV_LCP_LEN,
516 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
517 IW_EV_POINT_LEN - IW_EV_LCP_LEN);
506 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 518 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
507 stream += event_len; 519 stream += event_len;
508 } 520 }
@@ -526,7 +538,7 @@ iwe_stream_add_value(char * event, /* Event in the stream */
526 event_len -= IW_EV_LCP_LEN; 538 event_len -= IW_EV_LCP_LEN;
527 539
528 /* Check if it's possible */ 540 /* Check if it's possible */
529 if((value + event_len) < ends) { 541 if(likely((value + event_len) < ends)) {
530 /* Add new value */ 542 /* Add new value */
531 memcpy(value, (char *) iwe + IW_EV_LCP_LEN, event_len); 543 memcpy(value, (char *) iwe + IW_EV_LCP_LEN, event_len);
532 value += event_len; 544 value += event_len;
@@ -537,4 +549,85 @@ iwe_stream_add_value(char * event, /* Event in the stream */
537 return value; 549 return value;
538} 550}
539 551
552/*------------------------------------------------------------------*/
553/*
554 * Wrapper to add an Wireless Event to a stream of events.
555 * Same as above, with explicit error check...
556 */
557static inline char *
558iwe_stream_check_add_event(char * stream, /* Stream of events */
559 char * ends, /* End of stream */
560 struct iw_event *iwe, /* Payload */
561 int event_len, /* Size of payload */
562 int * perr) /* Error report */
563{
564 /* Check if it's possible, set error if not */
565 if(likely((stream + event_len) < ends)) {
566 iwe->len = event_len;
567 memcpy(stream, (char *) iwe, event_len);
568 stream += event_len;
569 } else
570 *perr = -E2BIG;
571 return stream;
572}
573
574/*------------------------------------------------------------------*/
575/*
576 * Wrapper to add an short Wireless Event containing a pointer to a
577 * stream of events.
578 * Same as above, with explicit error check...
579 */
580static inline char *
581iwe_stream_check_add_point(char * stream, /* Stream of events */
582 char * ends, /* End of stream */
583 struct iw_event *iwe, /* Payload length + flags */
584 char * extra, /* More payload */
585 int * perr) /* Error report */
586{
587 int event_len = IW_EV_POINT_LEN + iwe->u.data.length;
588 /* Check if it's possible */
589 if(likely((stream + event_len) < ends)) {
590 iwe->len = event_len;
591 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
592 memcpy(stream + IW_EV_LCP_LEN,
593 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
594 IW_EV_POINT_LEN - IW_EV_LCP_LEN);
595 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
596 stream += event_len;
597 } else
598 *perr = -E2BIG;
599 return stream;
600}
601
602/*------------------------------------------------------------------*/
603/*
604 * Wrapper to add a value to a Wireless Event in a stream of events.
605 * Be careful, this one is tricky to use properly :
606 * At the first run, you need to have (value = event + IW_EV_LCP_LEN).
607 * Same as above, with explicit error check...
608 */
609static inline char *
610iwe_stream_check_add_value(char * event, /* Event in the stream */
611 char * value, /* Value in event */
612 char * ends, /* End of stream */
613 struct iw_event *iwe, /* Payload */
614 int event_len, /* Size of payload */
615 int * perr) /* Error report */
616{
617 /* Don't duplicate LCP */
618 event_len -= IW_EV_LCP_LEN;
619
620 /* Check if it's possible */
621 if(likely((value + event_len) < ends)) {
622 /* Add new value */
623 memcpy(value, (char *) iwe + IW_EV_LCP_LEN, event_len);
624 value += event_len;
625 /* Patch LCP */
626 iwe->len = value - event;
627 memcpy(event, (char *) iwe, IW_EV_LCP_LEN);
628 } else
629 *perr = -E2BIG;
630 return value;
631}
632
540#endif /* _IW_HANDLER_H */ 633#endif /* _IW_HANDLER_H */
diff --git a/include/net/llc.h b/include/net/llc.h
index c9aed2a8b4e2..71769a5aeef3 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -46,7 +46,8 @@ struct llc_sap {
46 unsigned char f_bit; 46 unsigned char f_bit;
47 int (*rcv_func)(struct sk_buff *skb, 47 int (*rcv_func)(struct sk_buff *skb,
48 struct net_device *dev, 48 struct net_device *dev,
49 struct packet_type *pt); 49 struct packet_type *pt,
50 struct net_device *orig_dev);
50 struct llc_addr laddr; 51 struct llc_addr laddr;
51 struct list_head node; 52 struct list_head node;
52 struct { 53 struct {
@@ -64,7 +65,7 @@ extern rwlock_t llc_sap_list_lock;
64extern unsigned char llc_station_mac_sa[ETH_ALEN]; 65extern unsigned char llc_station_mac_sa[ETH_ALEN];
65 66
66extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 67extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
67 struct packet_type *pt); 68 struct packet_type *pt, struct net_device *orig_dev);
68 69
69extern int llc_mac_hdr_init(struct sk_buff *skb, 70extern int llc_mac_hdr_init(struct sk_buff *skb,
70 unsigned char *sa, unsigned char *da); 71 unsigned char *sa, unsigned char *da);
@@ -78,7 +79,8 @@ extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
78extern struct llc_sap *llc_sap_open(unsigned char lsap, 79extern struct llc_sap *llc_sap_open(unsigned char lsap,
79 int (*rcv)(struct sk_buff *skb, 80 int (*rcv)(struct sk_buff *skb,
80 struct net_device *dev, 81 struct net_device *dev,
81 struct packet_type *pt)); 82 struct packet_type *pt,
83 struct net_device *orig_dev));
82extern void llc_sap_close(struct llc_sap *sap); 84extern void llc_sap_close(struct llc_sap *sap);
83 85
84extern struct llc_sap *llc_sap_find(unsigned char sap_value); 86extern struct llc_sap *llc_sap_find(unsigned char sap_value);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 89809891e5ab..34c07731933d 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -363,7 +363,14 @@ __neigh_lookup_errno(struct neigh_table *tbl, const void *pkey,
363 return neigh_create(tbl, pkey, dev); 363 return neigh_create(tbl, pkey, dev);
364} 364}
365 365
366#define LOCALLY_ENQUEUED -2 366struct neighbour_cb {
367 unsigned long sched_next;
368 unsigned int flags;
369};
370
371#define LOCALLY_ENQUEUED 0x1
372
373#define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb)
367 374
368#endif 375#endif
369#endif 376#endif
diff --git a/include/net/p8022.h b/include/net/p8022.h
index 3c99a86c3581..42e9fac51b31 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -4,7 +4,10 @@ extern struct datalink_proto *
4 register_8022_client(unsigned char type, 4 register_8022_client(unsigned char type,
5 int (*func)(struct sk_buff *skb, 5 int (*func)(struct sk_buff *skb,
6 struct net_device *dev, 6 struct net_device *dev,
7 struct packet_type *pt)); 7 struct packet_type *pt,
8 struct net_device *orig_dev));
8extern void unregister_8022_client(struct datalink_proto *proto); 9extern void unregister_8022_client(struct datalink_proto *proto);
9 10
11extern struct datalink_proto *make_8023_client(void);
12extern void destroy_8023_client(struct datalink_proto *dl);
10#endif 13#endif
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 4abda6aec05a..b902d24a3256 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -352,10 +352,10 @@ tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv)
352static inline int 352static inline int
353tcf_match_indev(struct sk_buff *skb, char *indev) 353tcf_match_indev(struct sk_buff *skb, char *indev)
354{ 354{
355 if (0 != indev[0]) { 355 if (indev[0]) {
356 if (NULL == skb->input_dev) 356 if (!skb->input_dev)
357 return 0; 357 return 0;
358 else if (0 != strcmp(indev, skb->input_dev->name)) 358 if (strcmp(indev, skb->input_dev->name))
359 return 0; 359 return 0;
360 } 360 }
361 361
diff --git a/include/net/psnap.h b/include/net/psnap.h
index 9c94e8f98b36..b2e01cc3fc8a 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,7 +1,7 @@
1#ifndef _NET_PSNAP_H 1#ifndef _NET_PSNAP_H
2#define _NET_PSNAP_H 2#define _NET_PSNAP_H
3 3
4extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *)); 4extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *orig_dev));
5extern void unregister_snap_client(struct datalink_proto *proto); 5extern void unregister_snap_client(struct datalink_proto *proto);
6 6
7#endif 7#endif
diff --git a/include/net/raw.h b/include/net/raw.h
index 1c411c45587a..f47917469b12 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -17,10 +17,10 @@
17#ifndef _RAW_H 17#ifndef _RAW_H
18#define _RAW_H 18#define _RAW_H
19 19
20#include <linux/config.h>
20 21
21extern struct proto raw_prot; 22extern struct proto raw_prot;
22 23
23
24extern void raw_err(struct sock *, struct sk_buff *, u32 info); 24extern void raw_err(struct sock *, struct sk_buff *, u32 info);
25extern int raw_rcv(struct sock *, struct sk_buff *); 25extern int raw_rcv(struct sock *, struct sk_buff *);
26 26
@@ -37,6 +37,11 @@ extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
37 unsigned long raddr, unsigned long laddr, 37 unsigned long raddr, unsigned long laddr,
38 int dif); 38 int dif);
39 39
40extern void raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); 40extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
41
42#ifdef CONFIG_PROC_FS
43extern int raw_proc_init(void);
44extern void raw_proc_exit(void);
45#endif
41 46
42#endif /* _RAW_H */ 47#endif /* _RAW_H */
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index 23fd9a6a221a..14476a71725e 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -7,10 +7,11 @@
7extern struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE]; 7extern struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];
8extern rwlock_t raw_v6_lock; 8extern rwlock_t raw_v6_lock;
9 9
10extern void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr); 10extern int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr);
11 11
12extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num, 12extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num,
13 struct in6_addr *loc_addr, struct in6_addr *rmt_addr); 13 struct in6_addr *loc_addr, struct in6_addr *rmt_addr,
14 int dif);
14 15
15extern int rawv6_rcv(struct sock *sk, 16extern int rawv6_rcv(struct sock *sk,
16 struct sk_buff *skb); 17 struct sk_buff *skb);
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 72fd6f5e86b1..b52cc52ffe39 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -89,6 +89,7 @@ struct listen_sock {
89 int qlen_young; 89 int qlen_young;
90 int clock_hand; 90 int clock_hand;
91 u32 hash_rnd; 91 u32 hash_rnd;
92 u32 nr_table_entries;
92 struct request_sock *syn_table[0]; 93 struct request_sock *syn_table[0];
93}; 94};
94 95
@@ -96,6 +97,7 @@ struct listen_sock {
96 * 97 *
97 * @rskq_accept_head - FIFO head of established children 98 * @rskq_accept_head - FIFO head of established children
98 * @rskq_accept_tail - FIFO tail of established children 99 * @rskq_accept_tail - FIFO tail of established children
100 * @rskq_defer_accept - User waits for some data after accept()
99 * @syn_wait_lock - serializer 101 * @syn_wait_lock - serializer
100 * 102 *
101 * %syn_wait_lock is necessary only to avoid proc interface having to grab the main 103 * %syn_wait_lock is necessary only to avoid proc interface having to grab the main
@@ -111,6 +113,8 @@ struct request_sock_queue {
111 struct request_sock *rskq_accept_head; 113 struct request_sock *rskq_accept_head;
112 struct request_sock *rskq_accept_tail; 114 struct request_sock *rskq_accept_tail;
113 rwlock_t syn_wait_lock; 115 rwlock_t syn_wait_lock;
116 u8 rskq_defer_accept;
117 /* 3 bytes hole, try to pack */
114 struct listen_sock *listen_opt; 118 struct listen_sock *listen_opt;
115}; 119};
116 120
@@ -129,11 +133,13 @@ static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock
129 return lopt; 133 return lopt;
130} 134}
131 135
132static inline void reqsk_queue_destroy(struct request_sock_queue *queue) 136static inline void __reqsk_queue_destroy(struct request_sock_queue *queue)
133{ 137{
134 kfree(reqsk_queue_yank_listen_sk(queue)); 138 kfree(reqsk_queue_yank_listen_sk(queue));
135} 139}
136 140
141extern void reqsk_queue_destroy(struct request_sock_queue *queue);
142
137static inline struct request_sock * 143static inline struct request_sock *
138 reqsk_queue_yank_acceptq(struct request_sock_queue *queue) 144 reqsk_queue_yank_acceptq(struct request_sock_queue *queue)
139{ 145{
@@ -221,17 +227,17 @@ static inline int reqsk_queue_added(struct request_sock_queue *queue)
221 return prev_qlen; 227 return prev_qlen;
222} 228}
223 229
224static inline int reqsk_queue_len(struct request_sock_queue *queue) 230static inline int reqsk_queue_len(const struct request_sock_queue *queue)
225{ 231{
226 return queue->listen_opt != NULL ? queue->listen_opt->qlen : 0; 232 return queue->listen_opt != NULL ? queue->listen_opt->qlen : 0;
227} 233}
228 234
229static inline int reqsk_queue_len_young(struct request_sock_queue *queue) 235static inline int reqsk_queue_len_young(const struct request_sock_queue *queue)
230{ 236{
231 return queue->listen_opt->qlen_young; 237 return queue->listen_opt->qlen_young;
232} 238}
233 239
234static inline int reqsk_queue_is_full(struct request_sock_queue *queue) 240static inline int reqsk_queue_is_full(const struct request_sock_queue *queue)
235{ 241{
236 return queue->listen_opt->qlen >> queue->listen_opt->max_qlen_log; 242 return queue->listen_opt->qlen >> queue->listen_opt->max_qlen_log;
237} 243}
diff --git a/include/net/route.h b/include/net/route.h
index c3cd069a9aca..dbe79ca67d31 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -105,10 +105,6 @@ struct rt_cache_stat
105 unsigned int out_hlist_search; 105 unsigned int out_hlist_search;
106}; 106};
107 107
108extern struct rt_cache_stat *rt_cache_stat;
109#define RT_CACHE_STAT_INC(field) \
110 (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
111
112extern struct ip_rt_acct *ip_rt_acct; 108extern struct ip_rt_acct *ip_rt_acct;
113 109
114struct in_device; 110struct in_device;
@@ -199,4 +195,6 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt)
199 return rt->peer; 195 return rt->peer;
200} 196}
201 197
198extern ctl_table ipv4_route_table[];
199
202#endif /* _ROUTE_H */ 200#endif /* _ROUTE_H */
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 5999e5684bbf..c51541ee0247 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -47,10 +47,10 @@
47#ifndef __sctp_constants_h__ 47#ifndef __sctp_constants_h__
48#define __sctp_constants_h__ 48#define __sctp_constants_h__
49 49
50#include <linux/tcp.h> /* For TCP states used in sctp_sock_state_t */
51#include <linux/sctp.h> 50#include <linux/sctp.h>
52#include <linux/ipv6.h> /* For ipv6hdr. */ 51#include <linux/ipv6.h> /* For ipv6hdr. */
53#include <net/sctp/user.h> 52#include <net/sctp/user.h>
53#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */
54 54
55/* Value used for stream negotiation. */ 55/* Value used for stream negotiation. */
56enum { SCTP_MAX_STREAM = 0xffff }; 56enum { SCTP_MAX_STREAM = 0xffff };
diff --git a/include/net/sock.h b/include/net/sock.h
index a1042d08becd..8c48fbecb7cf 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -88,6 +88,7 @@ do { spin_lock_init(&((__sk)->sk_lock.slock)); \
88} while(0) 88} while(0)
89 89
90struct sock; 90struct sock;
91struct proto;
91 92
92/** 93/**
93 * struct sock_common - minimal network layer representation of sockets 94 * struct sock_common - minimal network layer representation of sockets
@@ -98,10 +99,11 @@ struct sock;
98 * @skc_node: main hash linkage for various protocol lookup tables 99 * @skc_node: main hash linkage for various protocol lookup tables
99 * @skc_bind_node: bind hash linkage for various protocol lookup tables 100 * @skc_bind_node: bind hash linkage for various protocol lookup tables
100 * @skc_refcnt: reference count 101 * @skc_refcnt: reference count
102 * @skc_prot: protocol handlers inside a network family
101 * 103 *
102 * This is the minimal network layer representation of sockets, the header 104 * This is the minimal network layer representation of sockets, the header
103 * for struct sock and struct tcp_tw_bucket. 105 * for struct sock and struct inet_timewait_sock.
104 */ 106 */
105struct sock_common { 107struct sock_common {
106 unsigned short skc_family; 108 unsigned short skc_family;
107 volatile unsigned char skc_state; 109 volatile unsigned char skc_state;
@@ -110,11 +112,12 @@ struct sock_common {
110 struct hlist_node skc_node; 112 struct hlist_node skc_node;
111 struct hlist_node skc_bind_node; 113 struct hlist_node skc_bind_node;
112 atomic_t skc_refcnt; 114 atomic_t skc_refcnt;
115 struct proto *skc_prot;
113}; 116};
114 117
115/** 118/**
116 * struct sock - network layer representation of sockets 119 * struct sock - network layer representation of sockets
117 * @__sk_common: shared layout with tcp_tw_bucket 120 * @__sk_common: shared layout with inet_timewait_sock
118 * @sk_shutdown: mask of %SEND_SHUTDOWN and/or %RCV_SHUTDOWN 121 * @sk_shutdown: mask of %SEND_SHUTDOWN and/or %RCV_SHUTDOWN
119 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings 122 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings
120 * @sk_lock: synchronizer 123 * @sk_lock: synchronizer
@@ -136,11 +139,10 @@ struct sock_common {
136 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 139 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
137 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 140 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
138 * @sk_lingertime: %SO_LINGER l_linger setting 141 * @sk_lingertime: %SO_LINGER l_linger setting
139 * @sk_hashent: hash entry in several tables (e.g. tcp_ehash) 142 * @sk_hashent: hash entry in several tables (e.g. inet_hashinfo.ehash)
140 * @sk_backlog: always used with the per-socket spinlock held 143 * @sk_backlog: always used with the per-socket spinlock held
141 * @sk_callback_lock: used with the callbacks in the end of this struct 144 * @sk_callback_lock: used with the callbacks in the end of this struct
142 * @sk_error_queue: rarely used 145 * @sk_error_queue: rarely used
143 * @sk_prot: protocol handlers inside a network family
144 * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance) 146 * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance)
145 * @sk_err: last error 147 * @sk_err: last error
146 * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out' 148 * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out'
@@ -173,7 +175,7 @@ struct sock_common {
173 */ 175 */
174struct sock { 176struct sock {
175 /* 177 /*
176 * Now struct tcp_tw_bucket also uses sock_common, so please just 178 * Now struct inet_timewait_sock also uses sock_common, so please just
177 * don't add nothing before this first member (__sk_common) --acme 179 * don't add nothing before this first member (__sk_common) --acme
178 */ 180 */
179 struct sock_common __sk_common; 181 struct sock_common __sk_common;
@@ -184,6 +186,7 @@ struct sock {
184#define sk_node __sk_common.skc_node 186#define sk_node __sk_common.skc_node
185#define sk_bind_node __sk_common.skc_bind_node 187#define sk_bind_node __sk_common.skc_bind_node
186#define sk_refcnt __sk_common.skc_refcnt 188#define sk_refcnt __sk_common.skc_refcnt
189#define sk_prot __sk_common.skc_prot
187 unsigned char sk_shutdown : 2, 190 unsigned char sk_shutdown : 2,
188 sk_no_check : 2, 191 sk_no_check : 2,
189 sk_userlocks : 4; 192 sk_userlocks : 4;
@@ -218,7 +221,6 @@ struct sock {
218 struct sk_buff *tail; 221 struct sk_buff *tail;
219 } sk_backlog; 222 } sk_backlog;
220 struct sk_buff_head sk_error_queue; 223 struct sk_buff_head sk_error_queue;
221 struct proto *sk_prot;
222 struct proto *sk_prot_creator; 224 struct proto *sk_prot_creator;
223 rwlock_t sk_callback_lock; 225 rwlock_t sk_callback_lock;
224 int sk_err, 226 int sk_err,
@@ -253,28 +255,28 @@ struct sock {
253/* 255/*
254 * Hashed lists helper routines 256 * Hashed lists helper routines
255 */ 257 */
256static inline struct sock *__sk_head(struct hlist_head *head) 258static inline struct sock *__sk_head(const struct hlist_head *head)
257{ 259{
258 return hlist_entry(head->first, struct sock, sk_node); 260 return hlist_entry(head->first, struct sock, sk_node);
259} 261}
260 262
261static inline struct sock *sk_head(struct hlist_head *head) 263static inline struct sock *sk_head(const struct hlist_head *head)
262{ 264{
263 return hlist_empty(head) ? NULL : __sk_head(head); 265 return hlist_empty(head) ? NULL : __sk_head(head);
264} 266}
265 267
266static inline struct sock *sk_next(struct sock *sk) 268static inline struct sock *sk_next(const struct sock *sk)
267{ 269{
268 return sk->sk_node.next ? 270 return sk->sk_node.next ?
269 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL; 271 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL;
270} 272}
271 273
272static inline int sk_unhashed(struct sock *sk) 274static inline int sk_unhashed(const struct sock *sk)
273{ 275{
274 return hlist_unhashed(&sk->sk_node); 276 return hlist_unhashed(&sk->sk_node);
275} 277}
276 278
277static inline int sk_hashed(struct sock *sk) 279static inline int sk_hashed(const struct sock *sk)
278{ 280{
279 return sk->sk_node.pprev != NULL; 281 return sk->sk_node.pprev != NULL;
280} 282}
@@ -384,6 +386,11 @@ enum sock_flags {
384 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 386 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
385}; 387};
386 388
389static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
390{
391 nsk->sk_flags = osk->sk_flags;
392}
393
387static inline void sock_set_flag(struct sock *sk, enum sock_flags flag) 394static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
388{ 395{
389 __set_bit(flag, &sk->sk_flags); 396 __set_bit(flag, &sk->sk_flags);
@@ -549,6 +556,10 @@ struct proto {
549 kmem_cache_t *slab; 556 kmem_cache_t *slab;
550 unsigned int obj_size; 557 unsigned int obj_size;
551 558
559 kmem_cache_t *twsk_slab;
560 unsigned int twsk_obj_size;
561 atomic_t *orphan_count;
562
552 struct request_sock_ops *rsk_prot; 563 struct request_sock_ops *rsk_prot;
553 564
554 struct module *owner; 565 struct module *owner;
@@ -556,7 +567,9 @@ struct proto {
556 char name[32]; 567 char name[32];
557 568
558 struct list_head node; 569 struct list_head node;
559 570#ifdef SOCK_REFCNT_DEBUG
571 atomic_t socks;
572#endif
560 struct { 573 struct {
561 int inuse; 574 int inuse;
562 u8 __pad[SMP_CACHE_BYTES - sizeof(int)]; 575 u8 __pad[SMP_CACHE_BYTES - sizeof(int)];
@@ -566,6 +579,31 @@ struct proto {
566extern int proto_register(struct proto *prot, int alloc_slab); 579extern int proto_register(struct proto *prot, int alloc_slab);
567extern void proto_unregister(struct proto *prot); 580extern void proto_unregister(struct proto *prot);
568 581
582#ifdef SOCK_REFCNT_DEBUG
583static inline void sk_refcnt_debug_inc(struct sock *sk)
584{
585 atomic_inc(&sk->sk_prot->socks);
586}
587
588static inline void sk_refcnt_debug_dec(struct sock *sk)
589{
590 atomic_dec(&sk->sk_prot->socks);
591 printk(KERN_DEBUG "%s socket %p released, %d are still alive\n",
592 sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks));
593}
594
595static inline void sk_refcnt_debug_release(const struct sock *sk)
596{
597 if (atomic_read(&sk->sk_refcnt) != 1)
598 printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n",
599 sk->sk_prot->name, sk, atomic_read(&sk->sk_refcnt));
600}
601#else /* SOCK_REFCNT_DEBUG */
602#define sk_refcnt_debug_inc(sk) do { } while (0)
603#define sk_refcnt_debug_dec(sk) do { } while (0)
604#define sk_refcnt_debug_release(sk) do { } while (0)
605#endif /* SOCK_REFCNT_DEBUG */
606
569/* Called with local bh disabled */ 607/* Called with local bh disabled */
570static __inline__ void sock_prot_inc_use(struct proto *prot) 608static __inline__ void sock_prot_inc_use(struct proto *prot)
571{ 609{
@@ -577,6 +615,15 @@ static __inline__ void sock_prot_dec_use(struct proto *prot)
577 prot->stats[smp_processor_id()].inuse--; 615 prot->stats[smp_processor_id()].inuse--;
578} 616}
579 617
618/* With per-bucket locks this operation is not-atomic, so that
619 * this version is not worse.
620 */
621static inline void __sk_prot_rehash(struct sock *sk)
622{
623 sk->sk_prot->unhash(sk);
624 sk->sk_prot->hash(sk);
625}
626
580/* About 10 seconds */ 627/* About 10 seconds */
581#define SOCK_DESTROY_TIME (10*HZ) 628#define SOCK_DESTROY_TIME (10*HZ)
582 629
@@ -662,6 +709,12 @@ static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb)
662 sk_stream_mem_schedule(sk, skb->truesize, 1); 709 sk_stream_mem_schedule(sk, skb->truesize, 1);
663} 710}
664 711
712static inline int sk_stream_wmem_schedule(struct sock *sk, int size)
713{
714 return size <= sk->sk_forward_alloc ||
715 sk_stream_mem_schedule(sk, size, 0);
716}
717
665/* Used by processes to "lock" a socket state, so that 718/* Used by processes to "lock" a socket state, so that
666 * interrupts and bottom half handlers won't change it 719 * interrupts and bottom half handlers won't change it
667 * from under us. It essentially blocks any incoming 720 * from under us. It essentially blocks any incoming
@@ -688,6 +741,8 @@ extern struct sock *sk_alloc(int family,
688 unsigned int __nocast priority, 741 unsigned int __nocast priority,
689 struct proto *prot, int zero_it); 742 struct proto *prot, int zero_it);
690extern void sk_free(struct sock *sk); 743extern void sk_free(struct sock *sk);
744extern struct sock *sk_clone(const struct sock *sk,
745 const unsigned int __nocast priority);
691 746
692extern struct sk_buff *sock_wmalloc(struct sock *sk, 747extern struct sk_buff *sock_wmalloc(struct sock *sk,
693 unsigned long size, int force, 748 unsigned long size, int force,
@@ -981,6 +1036,16 @@ sk_dst_check(struct sock *sk, u32 cookie)
981 return dst; 1036 return dst;
982} 1037}
983 1038
1039static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1040{
1041 __sk_dst_set(sk, dst);
1042 sk->sk_route_caps = dst->dev->features;
1043 if (sk->sk_route_caps & NETIF_F_TSO) {
1044 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
1045 sk->sk_route_caps &= ~NETIF_F_TSO;
1046 }
1047}
1048
984static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) 1049static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb)
985{ 1050{
986 sk->sk_wmem_queued += skb->truesize; 1051 sk->sk_wmem_queued += skb->truesize;
@@ -1141,11 +1206,10 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1141 int hdr_len; 1206 int hdr_len;
1142 1207
1143 hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); 1208 hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header);
1144 skb = alloc_skb(size + hdr_len, gfp); 1209 skb = alloc_skb_fclone(size + hdr_len, gfp);
1145 if (skb) { 1210 if (skb) {
1146 skb->truesize += mem; 1211 skb->truesize += mem;
1147 if (sk->sk_forward_alloc >= (int)skb->truesize || 1212 if (sk_stream_wmem_schedule(sk, skb->truesize)) {
1148 sk_stream_mem_schedule(sk, skb->truesize, 0)) {
1149 skb_reserve(skb, hdr_len); 1213 skb_reserve(skb, hdr_len);
1150 return skb; 1214 return skb;
1151 } 1215 }
@@ -1168,10 +1232,8 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1168{ 1232{
1169 struct page *page = NULL; 1233 struct page *page = NULL;
1170 1234
1171 if (sk->sk_forward_alloc >= (int)PAGE_SIZE || 1235 page = alloc_pages(sk->sk_allocation, 0);
1172 sk_stream_mem_schedule(sk, PAGE_SIZE, 0)) 1236 if (!page) {
1173 page = alloc_pages(sk->sk_allocation, 0);
1174 else {
1175 sk->sk_prot->enter_memory_pressure(); 1237 sk->sk_prot->enter_memory_pressure();
1176 sk_stream_moderate_sndbuf(sk); 1238 sk_stream_moderate_sndbuf(sk);
1177 } 1239 }
@@ -1223,16 +1285,19 @@ static inline int sock_intr_errno(long timeo)
1223static __inline__ void 1285static __inline__ void
1224sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1286sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1225{ 1287{
1226 struct timeval *stamp = &skb->stamp; 1288 struct timeval stamp;
1289
1290 skb_get_timestamp(skb, &stamp);
1227 if (sock_flag(sk, SOCK_RCVTSTAMP)) { 1291 if (sock_flag(sk, SOCK_RCVTSTAMP)) {
1228 /* Race occurred between timestamp enabling and packet 1292 /* Race occurred between timestamp enabling and packet
1229 receiving. Fill in the current time for now. */ 1293 receiving. Fill in the current time for now. */
1230 if (stamp->tv_sec == 0) 1294 if (stamp.tv_sec == 0)
1231 do_gettimeofday(stamp); 1295 do_gettimeofday(&stamp);
1296 skb_set_timestamp(skb, &stamp);
1232 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval), 1297 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval),
1233 stamp); 1298 &stamp);
1234 } else 1299 } else
1235 sk->sk_stamp = *stamp; 1300 sk->sk_stamp = stamp;
1236} 1301}
1237 1302
1238/** 1303/**
@@ -1257,11 +1322,11 @@ extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1257 */ 1322 */
1258 1323
1259#if 0 1324#if 0
1260#define NETDEBUG(x) do { } while (0) 1325#define NETDEBUG(fmt, args...) do { } while (0)
1261#define LIMIT_NETDEBUG(x) do {} while(0) 1326#define LIMIT_NETDEBUG(fmt, args...) do { } while(0)
1262#else 1327#else
1263#define NETDEBUG(x) do { x; } while (0) 1328#define NETDEBUG(fmt, args...) printk(fmt,##args)
1264#define LIMIT_NETDEBUG(x) do { if (net_ratelimit()) { x; } } while(0) 1329#define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0)
1265#endif 1330#endif
1266 1331
1267/* 1332/*
@@ -1308,4 +1373,15 @@ static inline int siocdevprivate_ioctl(unsigned int fd, unsigned int cmd, unsign
1308} 1373}
1309#endif 1374#endif
1310 1375
1376extern void sk_init(void);
1377
1378#ifdef CONFIG_SYSCTL
1379extern struct ctl_table core_table[];
1380#endif
1381
1382extern int sysctl_optmem_max;
1383
1384extern __u32 sysctl_wmem_default;
1385extern __u32 sysctl_rmem_default;
1386
1311#endif /* _SOCK_H */ 1387#endif /* _SOCK_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5010f0c5a56e..97af77c4d096 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -21,360 +21,29 @@
21#define TCP_DEBUG 1 21#define TCP_DEBUG 1
22#define FASTRETRANS_DEBUG 1 22#define FASTRETRANS_DEBUG 1
23 23
24/* Cancel timers, when they are not required. */
25#undef TCP_CLEAR_TIMERS
26
27#include <linux/config.h> 24#include <linux/config.h>
28#include <linux/list.h> 25#include <linux/list.h>
29#include <linux/tcp.h> 26#include <linux/tcp.h>
30#include <linux/slab.h> 27#include <linux/slab.h>
31#include <linux/cache.h> 28#include <linux/cache.h>
32#include <linux/percpu.h> 29#include <linux/percpu.h>
30
31#include <net/inet_connection_sock.h>
32#include <net/inet_timewait_sock.h>
33#include <net/inet_hashtables.h>
33#include <net/checksum.h> 34#include <net/checksum.h>
34#include <net/request_sock.h> 35#include <net/request_sock.h>
35#include <net/sock.h> 36#include <net/sock.h>
36#include <net/snmp.h> 37#include <net/snmp.h>
37#include <net/ip.h> 38#include <net/ip.h>
38#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 39#include <net/tcp_states.h>
39#include <linux/ipv6.h>
40#endif
41#include <linux/seq_file.h>
42
43/* This is for all connections with a full identity, no wildcards.
44 * New scheme, half the table is for TIME_WAIT, the other half is
45 * for the rest. I'll experiment with dynamic table growth later.
46 */
47struct tcp_ehash_bucket {
48 rwlock_t lock;
49 struct hlist_head chain;
50} __attribute__((__aligned__(8)));
51
52/* This is for listening sockets, thus all sockets which possess wildcards. */
53#define TCP_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */
54
55/* There are a few simple rules, which allow for local port reuse by
56 * an application. In essence:
57 *
58 * 1) Sockets bound to different interfaces may share a local port.
59 * Failing that, goto test 2.
60 * 2) If all sockets have sk->sk_reuse set, and none of them are in
61 * TCP_LISTEN state, the port may be shared.
62 * Failing that, goto test 3.
63 * 3) If all sockets are bound to a specific inet_sk(sk)->rcv_saddr local
64 * address, and none of them are the same, the port may be
65 * shared.
66 * Failing this, the port cannot be shared.
67 *
68 * The interesting point, is test #2. This is what an FTP server does
69 * all day. To optimize this case we use a specific flag bit defined
70 * below. As we add sockets to a bind bucket list, we perform a
71 * check of: (newsk->sk_reuse && (newsk->sk_state != TCP_LISTEN))
72 * As long as all sockets added to a bind bucket pass this test,
73 * the flag bit will be set.
74 * The resulting situation is that tcp_v[46]_verify_bind() can just check
75 * for this flag bit, if it is set and the socket trying to bind has
76 * sk->sk_reuse set, we don't even have to walk the owners list at all,
77 * we return that it is ok to bind this socket to the requested local port.
78 *
79 * Sounds like a lot of work, but it is worth it. In a more naive
80 * implementation (ie. current FreeBSD etc.) the entire list of ports
81 * must be walked for each data port opened by an ftp server. Needless
82 * to say, this does not scale at all. With a couple thousand FTP
83 * users logged onto your box, isn't it nice to know that new data
84 * ports are created in O(1) time? I thought so. ;-) -DaveM
85 */
86struct tcp_bind_bucket {
87 unsigned short port;
88 signed short fastreuse;
89 struct hlist_node node;
90 struct hlist_head owners;
91};
92
93#define tb_for_each(tb, node, head) hlist_for_each_entry(tb, node, head, node)
94
95struct tcp_bind_hashbucket {
96 spinlock_t lock;
97 struct hlist_head chain;
98};
99
100static inline struct tcp_bind_bucket *__tb_head(struct tcp_bind_hashbucket *head)
101{
102 return hlist_entry(head->chain.first, struct tcp_bind_bucket, node);
103}
104
105static inline struct tcp_bind_bucket *tb_head(struct tcp_bind_hashbucket *head)
106{
107 return hlist_empty(&head->chain) ? NULL : __tb_head(head);
108}
109
110extern struct tcp_hashinfo {
111 /* This is for sockets with full identity only. Sockets here will
112 * always be without wildcards and will have the following invariant:
113 *
114 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
115 *
116 * First half of the table is for sockets not in TIME_WAIT, second half
117 * is for TIME_WAIT sockets only.
118 */
119 struct tcp_ehash_bucket *__tcp_ehash;
120
121 /* Ok, let's try this, I give up, we do need a local binding
122 * TCP hash as well as the others for fast bind/connect.
123 */
124 struct tcp_bind_hashbucket *__tcp_bhash;
125 40
126 int __tcp_bhash_size; 41#include <linux/seq_file.h>
127 int __tcp_ehash_size;
128
129 /* All sockets in TCP_LISTEN state will be in here. This is the only
130 * table where wildcard'd TCP sockets can exist. Hash function here
131 * is just local port number.
132 */
133 struct hlist_head __tcp_listening_hash[TCP_LHTABLE_SIZE];
134
135 /* All the above members are written once at bootup and
136 * never written again _or_ are predominantly read-access.
137 *
138 * Now align to a new cache line as all the following members
139 * are often dirty.
140 */
141 rwlock_t __tcp_lhash_lock ____cacheline_aligned;
142 atomic_t __tcp_lhash_users;
143 wait_queue_head_t __tcp_lhash_wait;
144 spinlock_t __tcp_portalloc_lock;
145} tcp_hashinfo;
146
147#define tcp_ehash (tcp_hashinfo.__tcp_ehash)
148#define tcp_bhash (tcp_hashinfo.__tcp_bhash)
149#define tcp_ehash_size (tcp_hashinfo.__tcp_ehash_size)
150#define tcp_bhash_size (tcp_hashinfo.__tcp_bhash_size)
151#define tcp_listening_hash (tcp_hashinfo.__tcp_listening_hash)
152#define tcp_lhash_lock (tcp_hashinfo.__tcp_lhash_lock)
153#define tcp_lhash_users (tcp_hashinfo.__tcp_lhash_users)
154#define tcp_lhash_wait (tcp_hashinfo.__tcp_lhash_wait)
155#define tcp_portalloc_lock (tcp_hashinfo.__tcp_portalloc_lock)
156
157extern kmem_cache_t *tcp_bucket_cachep;
158extern struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head,
159 unsigned short snum);
160extern void tcp_bucket_destroy(struct tcp_bind_bucket *tb);
161extern void tcp_bucket_unlock(struct sock *sk);
162extern int tcp_port_rover;
163
164/* These are AF independent. */
165static __inline__ int tcp_bhashfn(__u16 lport)
166{
167 return (lport & (tcp_bhash_size - 1));
168}
169
170extern void tcp_bind_hash(struct sock *sk, struct tcp_bind_bucket *tb,
171 unsigned short snum);
172
173#if (BITS_PER_LONG == 64)
174#define TCP_ADDRCMP_ALIGN_BYTES 8
175#else
176#define TCP_ADDRCMP_ALIGN_BYTES 4
177#endif
178
179/* This is a TIME_WAIT bucket. It works around the memory consumption
180 * problems of sockets in such a state on heavily loaded servers, but
181 * without violating the protocol specification.
182 */
183struct tcp_tw_bucket {
184 /*
185 * Now struct sock also uses sock_common, so please just
186 * don't add nothing before this first member (__tw_common) --acme
187 */
188 struct sock_common __tw_common;
189#define tw_family __tw_common.skc_family
190#define tw_state __tw_common.skc_state
191#define tw_reuse __tw_common.skc_reuse
192#define tw_bound_dev_if __tw_common.skc_bound_dev_if
193#define tw_node __tw_common.skc_node
194#define tw_bind_node __tw_common.skc_bind_node
195#define tw_refcnt __tw_common.skc_refcnt
196 volatile unsigned char tw_substate;
197 unsigned char tw_rcv_wscale;
198 __u16 tw_sport;
199 /* Socket demultiplex comparisons on incoming packets. */
200 /* these five are in inet_sock */
201 __u32 tw_daddr
202 __attribute__((aligned(TCP_ADDRCMP_ALIGN_BYTES)));
203 __u32 tw_rcv_saddr;
204 __u16 tw_dport;
205 __u16 tw_num;
206 /* And these are ours. */
207 int tw_hashent;
208 int tw_timeout;
209 __u32 tw_rcv_nxt;
210 __u32 tw_snd_nxt;
211 __u32 tw_rcv_wnd;
212 __u32 tw_ts_recent;
213 long tw_ts_recent_stamp;
214 unsigned long tw_ttd;
215 struct tcp_bind_bucket *tw_tb;
216 struct hlist_node tw_death_node;
217#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
218 struct in6_addr tw_v6_daddr;
219 struct in6_addr tw_v6_rcv_saddr;
220 int tw_v6_ipv6only;
221#endif
222};
223
224static __inline__ void tw_add_node(struct tcp_tw_bucket *tw,
225 struct hlist_head *list)
226{
227 hlist_add_head(&tw->tw_node, list);
228}
229
230static __inline__ void tw_add_bind_node(struct tcp_tw_bucket *tw,
231 struct hlist_head *list)
232{
233 hlist_add_head(&tw->tw_bind_node, list);
234}
235
236static inline int tw_dead_hashed(struct tcp_tw_bucket *tw)
237{
238 return tw->tw_death_node.pprev != NULL;
239}
240
241static __inline__ void tw_dead_node_init(struct tcp_tw_bucket *tw)
242{
243 tw->tw_death_node.pprev = NULL;
244}
245
246static __inline__ void __tw_del_dead_node(struct tcp_tw_bucket *tw)
247{
248 __hlist_del(&tw->tw_death_node);
249 tw_dead_node_init(tw);
250}
251
252static __inline__ int tw_del_dead_node(struct tcp_tw_bucket *tw)
253{
254 if (tw_dead_hashed(tw)) {
255 __tw_del_dead_node(tw);
256 return 1;
257 }
258 return 0;
259}
260
261#define tw_for_each(tw, node, head) \
262 hlist_for_each_entry(tw, node, head, tw_node)
263
264#define tw_for_each_inmate(tw, node, jail) \
265 hlist_for_each_entry(tw, node, jail, tw_death_node)
266
267#define tw_for_each_inmate_safe(tw, node, safe, jail) \
268 hlist_for_each_entry_safe(tw, node, safe, jail, tw_death_node)
269
270#define tcptw_sk(__sk) ((struct tcp_tw_bucket *)(__sk))
271
272static inline u32 tcp_v4_rcv_saddr(const struct sock *sk)
273{
274 return likely(sk->sk_state != TCP_TIME_WAIT) ?
275 inet_sk(sk)->rcv_saddr : tcptw_sk(sk)->tw_rcv_saddr;
276}
277
278#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
279static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk)
280{
281 return likely(sk->sk_state != TCP_TIME_WAIT) ?
282 &inet6_sk(sk)->rcv_saddr : &tcptw_sk(sk)->tw_v6_rcv_saddr;
283}
284
285static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk)
286{
287 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL;
288}
289
290#define tcptw_sk_ipv6only(__sk) (tcptw_sk(__sk)->tw_v6_ipv6only)
291
292static inline int tcp_v6_ipv6only(const struct sock *sk)
293{
294 return likely(sk->sk_state != TCP_TIME_WAIT) ?
295 ipv6_only_sock(sk) : tcptw_sk_ipv6only(sk);
296}
297#else
298# define __tcp_v6_rcv_saddr(__sk) NULL
299# define tcp_v6_rcv_saddr(__sk) NULL
300# define tcptw_sk_ipv6only(__sk) 0
301# define tcp_v6_ipv6only(__sk) 0
302#endif
303 42
304extern kmem_cache_t *tcp_timewait_cachep; 43extern struct inet_hashinfo tcp_hashinfo;
305
306static inline void tcp_tw_put(struct tcp_tw_bucket *tw)
307{
308 if (atomic_dec_and_test(&tw->tw_refcnt)) {
309#ifdef INET_REFCNT_DEBUG
310 printk(KERN_DEBUG "tw_bucket %p released\n", tw);
311#endif
312 kmem_cache_free(tcp_timewait_cachep, tw);
313 }
314}
315 44
316extern atomic_t tcp_orphan_count; 45extern atomic_t tcp_orphan_count;
317extern int tcp_tw_count;
318extern void tcp_time_wait(struct sock *sk, int state, int timeo); 46extern void tcp_time_wait(struct sock *sk, int state, int timeo);
319extern void tcp_tw_deschedule(struct tcp_tw_bucket *tw);
320
321
322/* Socket demux engine toys. */
323#ifdef __BIG_ENDIAN
324#define TCP_COMBINED_PORTS(__sport, __dport) \
325 (((__u32)(__sport)<<16) | (__u32)(__dport))
326#else /* __LITTLE_ENDIAN */
327#define TCP_COMBINED_PORTS(__sport, __dport) \
328 (((__u32)(__dport)<<16) | (__u32)(__sport))
329#endif
330
331#if (BITS_PER_LONG == 64)
332#ifdef __BIG_ENDIAN
333#define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr) \
334 __u64 __name = (((__u64)(__saddr))<<32)|((__u64)(__daddr));
335#else /* __LITTLE_ENDIAN */
336#define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr) \
337 __u64 __name = (((__u64)(__daddr))<<32)|((__u64)(__saddr));
338#endif /* __BIG_ENDIAN */
339#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
340 (((*((__u64 *)&(inet_sk(__sk)->daddr)))== (__cookie)) && \
341 ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
342 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
343#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
344 (((*((__u64 *)&(tcptw_sk(__sk)->tw_daddr))) == (__cookie)) && \
345 ((*((__u32 *)&(tcptw_sk(__sk)->tw_dport))) == (__ports)) && \
346 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
347#else /* 32-bit arch */
348#define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr)
349#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
350 ((inet_sk(__sk)->daddr == (__saddr)) && \
351 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
352 ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
353 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
354#define TCP_IPV4_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
355 ((tcptw_sk(__sk)->tw_daddr == (__saddr)) && \
356 (tcptw_sk(__sk)->tw_rcv_saddr == (__daddr)) && \
357 ((*((__u32 *)&(tcptw_sk(__sk)->tw_dport))) == (__ports)) && \
358 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
359#endif /* 64-bit arch */
360
361#define TCP_IPV6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \
362 (((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
363 ((__sk)->sk_family == AF_INET6) && \
364 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
365 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
366 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
367
368/* These can have wildcards, don't try too hard. */
369static __inline__ int tcp_lhashfn(unsigned short num)
370{
371 return num & (TCP_LHTABLE_SIZE - 1);
372}
373
374static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
375{
376 return tcp_lhashfn(inet_sk(sk)->num);
377}
378 47
379#define MAX_TCP_HEADER (128 + MAX_HEADER) 48#define MAX_TCP_HEADER (128 + MAX_HEADER)
380 49
@@ -478,33 +147,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
478 * timestamps. It must be less than 147 * timestamps. It must be less than
479 * minimal timewait lifetime. 148 * minimal timewait lifetime.
480 */ 149 */
481
482#define TCP_TW_RECYCLE_SLOTS_LOG 5
483#define TCP_TW_RECYCLE_SLOTS (1<<TCP_TW_RECYCLE_SLOTS_LOG)
484
485/* If time > 4sec, it is "slow" path, no recycling is required,
486 so that we select tick to get range about 4 seconds.
487 */
488
489#if HZ <= 16 || HZ > 4096
490# error Unsupported: HZ <= 16 or HZ > 4096
491#elif HZ <= 32
492# define TCP_TW_RECYCLE_TICK (5+2-TCP_TW_RECYCLE_SLOTS_LOG)
493#elif HZ <= 64
494# define TCP_TW_RECYCLE_TICK (6+2-TCP_TW_RECYCLE_SLOTS_LOG)
495#elif HZ <= 128
496# define TCP_TW_RECYCLE_TICK (7+2-TCP_TW_RECYCLE_SLOTS_LOG)
497#elif HZ <= 256
498# define TCP_TW_RECYCLE_TICK (8+2-TCP_TW_RECYCLE_SLOTS_LOG)
499#elif HZ <= 512
500# define TCP_TW_RECYCLE_TICK (9+2-TCP_TW_RECYCLE_SLOTS_LOG)
501#elif HZ <= 1024
502# define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG)
503#elif HZ <= 2048
504# define TCP_TW_RECYCLE_TICK (11+2-TCP_TW_RECYCLE_SLOTS_LOG)
505#else
506# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG)
507#endif
508/* 150/*
509 * TCP option 151 * TCP option
510 */ 152 */
@@ -534,22 +176,18 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
534#define TCPOLEN_SACK_BASE_ALIGNED 4 176#define TCPOLEN_SACK_BASE_ALIGNED 4
535#define TCPOLEN_SACK_PERBLOCK 8 177#define TCPOLEN_SACK_PERBLOCK 8
536 178
537#define TCP_TIME_RETRANS 1 /* Retransmit timer */
538#define TCP_TIME_DACK 2 /* Delayed ack timer */
539#define TCP_TIME_PROBE0 3 /* Zero window probe timer */
540#define TCP_TIME_KEEPOPEN 4 /* Keepalive timer */
541
542/* Flags in tp->nonagle */ 179/* Flags in tp->nonagle */
543#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ 180#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */
544#define TCP_NAGLE_CORK 2 /* Socket is corked */ 181#define TCP_NAGLE_CORK 2 /* Socket is corked */
545#define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ 182#define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */
546 183
184extern struct inet_timewait_death_row tcp_death_row;
185
547/* sysctl variables for tcp */ 186/* sysctl variables for tcp */
548extern int sysctl_tcp_timestamps; 187extern int sysctl_tcp_timestamps;
549extern int sysctl_tcp_window_scaling; 188extern int sysctl_tcp_window_scaling;
550extern int sysctl_tcp_sack; 189extern int sysctl_tcp_sack;
551extern int sysctl_tcp_fin_timeout; 190extern int sysctl_tcp_fin_timeout;
552extern int sysctl_tcp_tw_recycle;
553extern int sysctl_tcp_keepalive_time; 191extern int sysctl_tcp_keepalive_time;
554extern int sysctl_tcp_keepalive_probes; 192extern int sysctl_tcp_keepalive_probes;
555extern int sysctl_tcp_keepalive_intvl; 193extern int sysctl_tcp_keepalive_intvl;
@@ -564,7 +202,6 @@ extern int sysctl_tcp_stdurg;
564extern int sysctl_tcp_rfc1337; 202extern int sysctl_tcp_rfc1337;
565extern int sysctl_tcp_abort_on_overflow; 203extern int sysctl_tcp_abort_on_overflow;
566extern int sysctl_tcp_max_orphans; 204extern int sysctl_tcp_max_orphans;
567extern int sysctl_tcp_max_tw_buckets;
568extern int sysctl_tcp_fack; 205extern int sysctl_tcp_fack;
569extern int sysctl_tcp_reordering; 206extern int sysctl_tcp_reordering;
570extern int sysctl_tcp_ecn; 207extern int sysctl_tcp_ecn;
@@ -585,12 +222,6 @@ extern atomic_t tcp_memory_allocated;
585extern atomic_t tcp_sockets_allocated; 222extern atomic_t tcp_sockets_allocated;
586extern int tcp_memory_pressure; 223extern int tcp_memory_pressure;
587 224
588#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
589#define TCP_INET_FAMILY(fam) ((fam) == AF_INET)
590#else
591#define TCP_INET_FAMILY(fam) 1
592#endif
593
594/* 225/*
595 * Pointers to address related TCP functions 226 * Pointers to address related TCP functions
596 * (i.e. things that depend on the address family) 227 * (i.e. things that depend on the address family)
@@ -671,9 +302,6 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
671#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val) 302#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val)
672#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val) 303#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val)
673 304
674extern void tcp_put_port(struct sock *sk);
675extern void tcp_inherit_port(struct sock *sk, struct sock *child);
676
677extern void tcp_v4_err(struct sk_buff *skb, u32); 305extern void tcp_v4_err(struct sk_buff *skb, u32);
678 306
679extern void tcp_shutdown (struct sock *sk, int how); 307extern void tcp_shutdown (struct sock *sk, int how);
@@ -682,7 +310,7 @@ extern int tcp_v4_rcv(struct sk_buff *skb);
682 310
683extern int tcp_v4_remember_stamp(struct sock *sk); 311extern int tcp_v4_remember_stamp(struct sock *sk);
684 312
685extern int tcp_v4_tw_remember_stamp(struct tcp_tw_bucket *tw); 313extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
686 314
687extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, 315extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk,
688 struct msghdr *msg, size_t size); 316 struct msghdr *msg, size_t size);
@@ -704,42 +332,22 @@ extern int tcp_rcv_established(struct sock *sk,
704 332
705extern void tcp_rcv_space_adjust(struct sock *sk); 333extern void tcp_rcv_space_adjust(struct sock *sk);
706 334
707enum tcp_ack_state_t 335static inline void tcp_dec_quickack_mode(struct sock *sk,
708{ 336 const unsigned int pkts)
709 TCP_ACK_SCHED = 1,
710 TCP_ACK_TIMER = 2,
711 TCP_ACK_PUSHED= 4
712};
713
714static inline void tcp_schedule_ack(struct tcp_sock *tp)
715{ 337{
716 tp->ack.pending |= TCP_ACK_SCHED; 338 struct inet_connection_sock *icsk = inet_csk(sk);
717}
718
719static inline int tcp_ack_scheduled(struct tcp_sock *tp)
720{
721 return tp->ack.pending&TCP_ACK_SCHED;
722}
723
724static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp, unsigned int pkts)
725{
726 if (tp->ack.quick) {
727 if (pkts >= tp->ack.quick) {
728 tp->ack.quick = 0;
729 339
340 if (icsk->icsk_ack.quick) {
341 if (pkts >= icsk->icsk_ack.quick) {
342 icsk->icsk_ack.quick = 0;
730 /* Leaving quickack mode we deflate ATO. */ 343 /* Leaving quickack mode we deflate ATO. */
731 tp->ack.ato = TCP_ATO_MIN; 344 icsk->icsk_ack.ato = TCP_ATO_MIN;
732 } else 345 } else
733 tp->ack.quick -= pkts; 346 icsk->icsk_ack.quick -= pkts;
734 } 347 }
735} 348}
736 349
737extern void tcp_enter_quickack_mode(struct tcp_sock *tp); 350extern void tcp_enter_quickack_mode(struct sock *sk);
738
739static __inline__ void tcp_delack_init(struct tcp_sock *tp)
740{
741 memset(&tp->ack, 0, sizeof(tp->ack));
742}
743 351
744static inline void tcp_clear_options(struct tcp_options_received *rx_opt) 352static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
745{ 353{
@@ -755,10 +363,9 @@ enum tcp_tw_status
755}; 363};
756 364
757 365
758extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw, 366extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
759 struct sk_buff *skb, 367 struct sk_buff *skb,
760 struct tcphdr *th, 368 const struct tcphdr *th);
761 unsigned len);
762 369
763extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 370extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
764 struct request_sock *req, 371 struct request_sock *req,
@@ -773,7 +380,6 @@ extern void tcp_update_metrics(struct sock *sk);
773 380
774extern void tcp_close(struct sock *sk, 381extern void tcp_close(struct sock *sk,
775 long timeout); 382 long timeout);
776extern struct sock * tcp_accept(struct sock *sk, int flags, int *err);
777extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); 383extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait);
778 384
779extern int tcp_getsockopt(struct sock *sk, int level, 385extern int tcp_getsockopt(struct sock *sk, int level,
@@ -789,8 +395,6 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
789 size_t len, int nonblock, 395 size_t len, int nonblock,
790 int flags, int *addr_len); 396 int flags, int *addr_len);
791 397
792extern int tcp_listen_start(struct sock *sk);
793
794extern void tcp_parse_options(struct sk_buff *skb, 398extern void tcp_parse_options(struct sk_buff *skb,
795 struct tcp_options_received *opt_rx, 399 struct tcp_options_received *opt_rx,
796 int estab); 400 int estab);
@@ -799,11 +403,6 @@ extern void tcp_parse_options(struct sk_buff *skb,
799 * TCP v4 functions exported for the inet6 API 403 * TCP v4 functions exported for the inet6 API
800 */ 404 */
801 405
802extern int tcp_v4_rebuild_header(struct sock *sk);
803
804extern int tcp_v4_build_header(struct sock *sk,
805 struct sk_buff *skb);
806
807extern void tcp_v4_send_check(struct sock *sk, 406extern void tcp_v4_send_check(struct sock *sk,
808 struct tcphdr *th, int len, 407 struct tcphdr *th, int len,
809 struct sk_buff *skb); 408 struct sk_buff *skb);
@@ -855,6 +454,7 @@ extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
855extern void tcp_xmit_retransmit_queue(struct sock *); 454extern void tcp_xmit_retransmit_queue(struct sock *);
856extern void tcp_simple_retransmit(struct sock *); 455extern void tcp_simple_retransmit(struct sock *);
857extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 456extern int tcp_trim_head(struct sock *, struct sk_buff *, u32);
457extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
858 458
859extern void tcp_send_probe0(struct sock *); 459extern void tcp_send_probe0(struct sock *);
860extern void tcp_send_partial(struct sock *); 460extern void tcp_send_partial(struct sock *);
@@ -872,18 +472,15 @@ extern void tcp_cwnd_application_limited(struct sock *sk);
872 472
873/* tcp_timer.c */ 473/* tcp_timer.c */
874extern void tcp_init_xmit_timers(struct sock *); 474extern void tcp_init_xmit_timers(struct sock *);
875extern void tcp_clear_xmit_timers(struct sock *); 475static inline void tcp_clear_xmit_timers(struct sock *sk)
476{
477 inet_csk_clear_xmit_timers(sk);
478}
876 479
877extern void tcp_delete_keepalive_timer(struct sock *);
878extern void tcp_reset_keepalive_timer(struct sock *, unsigned long);
879extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 480extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
880extern unsigned int tcp_current_mss(struct sock *sk, int large); 481extern unsigned int tcp_current_mss(struct sock *sk, int large);
881 482
882#ifdef TCP_DEBUG 483/* tcp.c */
883extern const char tcp_timer_bug_msg[];
884#endif
885
886/* tcp_diag.c */
887extern void tcp_get_info(struct sock *, struct tcp_info *); 484extern void tcp_get_info(struct sock *, struct tcp_info *);
888 485
889/* Read 'sendfile()'-style from a TCP socket */ 486/* Read 'sendfile()'-style from a TCP socket */
@@ -892,72 +489,6 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
892extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 489extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
893 sk_read_actor_t recv_actor); 490 sk_read_actor_t recv_actor);
894 491
895static inline void tcp_clear_xmit_timer(struct sock *sk, int what)
896{
897 struct tcp_sock *tp = tcp_sk(sk);
898
899 switch (what) {
900 case TCP_TIME_RETRANS:
901 case TCP_TIME_PROBE0:
902 tp->pending = 0;
903
904#ifdef TCP_CLEAR_TIMERS
905 sk_stop_timer(sk, &tp->retransmit_timer);
906#endif
907 break;
908 case TCP_TIME_DACK:
909 tp->ack.blocked = 0;
910 tp->ack.pending = 0;
911
912#ifdef TCP_CLEAR_TIMERS
913 sk_stop_timer(sk, &tp->delack_timer);
914#endif
915 break;
916 default:
917#ifdef TCP_DEBUG
918 printk(tcp_timer_bug_msg);
919#endif
920 return;
921 };
922
923}
924
925/*
926 * Reset the retransmission timer
927 */
928static inline void tcp_reset_xmit_timer(struct sock *sk, int what, unsigned long when)
929{
930 struct tcp_sock *tp = tcp_sk(sk);
931
932 if (when > TCP_RTO_MAX) {
933#ifdef TCP_DEBUG
934 printk(KERN_DEBUG "reset_xmit_timer sk=%p %d when=0x%lx, caller=%p\n", sk, what, when, current_text_addr());
935#endif
936 when = TCP_RTO_MAX;
937 }
938
939 switch (what) {
940 case TCP_TIME_RETRANS:
941 case TCP_TIME_PROBE0:
942 tp->pending = what;
943 tp->timeout = jiffies+when;
944 sk_reset_timer(sk, &tp->retransmit_timer, tp->timeout);
945 break;
946
947 case TCP_TIME_DACK:
948 tp->ack.pending |= TCP_ACK_TIMER;
949 tp->ack.timeout = jiffies+when;
950 sk_reset_timer(sk, &tp->delack_timer, tp->ack.timeout);
951 break;
952
953 default:
954#ifdef TCP_DEBUG
955 printk(tcp_timer_bug_msg);
956#endif
957 return;
958 };
959}
960
961/* Initialize RCV_MSS value. 492/* Initialize RCV_MSS value.
962 * RCV_MSS is an our guess about MSS used by the peer. 493 * RCV_MSS is an our guess about MSS used by the peer.
963 * We haven't any direct information about the MSS. 494 * We haven't any direct information about the MSS.
@@ -975,7 +506,7 @@ static inline void tcp_initialize_rcv_mss(struct sock *sk)
975 hint = min(hint, TCP_MIN_RCVMSS); 506 hint = min(hint, TCP_MIN_RCVMSS);
976 hint = max(hint, TCP_MIN_MSS); 507 hint = max(hint, TCP_MIN_MSS);
977 508
978 tp->ack.rcv_mss = hint; 509 inet_csk(sk)->icsk_ack.rcv_mss = hint;
979} 510}
980 511
981static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 512static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
@@ -1110,7 +641,8 @@ static inline void tcp_packets_out_inc(struct sock *sk,
1110 641
1111 tp->packets_out += tcp_skb_pcount(skb); 642 tp->packets_out += tcp_skb_pcount(skb);
1112 if (!orig) 643 if (!orig)
1113 tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto); 644 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
645 inet_csk(sk)->icsk_rto, TCP_RTO_MAX);
1114} 646}
1115 647
1116static inline void tcp_packets_out_dec(struct tcp_sock *tp, 648static inline void tcp_packets_out_dec(struct tcp_sock *tp,
@@ -1138,29 +670,29 @@ struct tcp_congestion_ops {
1138 struct list_head list; 670 struct list_head list;
1139 671
1140 /* initialize private data (optional) */ 672 /* initialize private data (optional) */
1141 void (*init)(struct tcp_sock *tp); 673 void (*init)(struct sock *sk);
1142 /* cleanup private data (optional) */ 674 /* cleanup private data (optional) */
1143 void (*release)(struct tcp_sock *tp); 675 void (*release)(struct sock *sk);
1144 676
1145 /* return slow start threshold (required) */ 677 /* return slow start threshold (required) */
1146 u32 (*ssthresh)(struct tcp_sock *tp); 678 u32 (*ssthresh)(struct sock *sk);
1147 /* lower bound for congestion window (optional) */ 679 /* lower bound for congestion window (optional) */
1148 u32 (*min_cwnd)(struct tcp_sock *tp); 680 u32 (*min_cwnd)(struct sock *sk);
1149 /* do new cwnd calculation (required) */ 681 /* do new cwnd calculation (required) */
1150 void (*cong_avoid)(struct tcp_sock *tp, u32 ack, 682 void (*cong_avoid)(struct sock *sk, u32 ack,
1151 u32 rtt, u32 in_flight, int good_ack); 683 u32 rtt, u32 in_flight, int good_ack);
1152 /* round trip time sample per acked packet (optional) */ 684 /* round trip time sample per acked packet (optional) */
1153 void (*rtt_sample)(struct tcp_sock *tp, u32 usrtt); 685 void (*rtt_sample)(struct sock *sk, u32 usrtt);
1154 /* call before changing ca_state (optional) */ 686 /* call before changing ca_state (optional) */
1155 void (*set_state)(struct tcp_sock *tp, u8 new_state); 687 void (*set_state)(struct sock *sk, u8 new_state);
1156 /* call when cwnd event occurs (optional) */ 688 /* call when cwnd event occurs (optional) */
1157 void (*cwnd_event)(struct tcp_sock *tp, enum tcp_ca_event ev); 689 void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev);
1158 /* new value of cwnd after loss (optional) */ 690 /* new value of cwnd after loss (optional) */
1159 u32 (*undo_cwnd)(struct tcp_sock *tp); 691 u32 (*undo_cwnd)(struct sock *sk);
1160 /* hook for packet ack accounting (optional) */ 692 /* hook for packet ack accounting (optional) */
1161 void (*pkts_acked)(struct tcp_sock *tp, u32 num_acked); 693 void (*pkts_acked)(struct sock *sk, u32 num_acked);
1162 /* get info for tcp_diag (optional) */ 694 /* get info for inet_diag (optional) */
1163 void (*get_info)(struct tcp_sock *tp, u32 ext, struct sk_buff *skb); 695 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
1164 696
1165 char name[TCP_CA_NAME_MAX]; 697 char name[TCP_CA_NAME_MAX];
1166 struct module *owner; 698 struct module *owner;
@@ -1169,30 +701,34 @@ struct tcp_congestion_ops {
1169extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); 701extern int tcp_register_congestion_control(struct tcp_congestion_ops *type);
1170extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); 702extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
1171 703
1172extern void tcp_init_congestion_control(struct tcp_sock *tp); 704extern void tcp_init_congestion_control(struct sock *sk);
1173extern void tcp_cleanup_congestion_control(struct tcp_sock *tp); 705extern void tcp_cleanup_congestion_control(struct sock *sk);
1174extern int tcp_set_default_congestion_control(const char *name); 706extern int tcp_set_default_congestion_control(const char *name);
1175extern void tcp_get_default_congestion_control(char *name); 707extern void tcp_get_default_congestion_control(char *name);
1176extern int tcp_set_congestion_control(struct tcp_sock *tp, const char *name); 708extern int tcp_set_congestion_control(struct sock *sk, const char *name);
1177 709
1178extern struct tcp_congestion_ops tcp_init_congestion_ops; 710extern struct tcp_congestion_ops tcp_init_congestion_ops;
1179extern u32 tcp_reno_ssthresh(struct tcp_sock *tp); 711extern u32 tcp_reno_ssthresh(struct sock *sk);
1180extern void tcp_reno_cong_avoid(struct tcp_sock *tp, u32 ack, 712extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack,
1181 u32 rtt, u32 in_flight, int flag); 713 u32 rtt, u32 in_flight, int flag);
1182extern u32 tcp_reno_min_cwnd(struct tcp_sock *tp); 714extern u32 tcp_reno_min_cwnd(struct sock *sk);
1183extern struct tcp_congestion_ops tcp_reno; 715extern struct tcp_congestion_ops tcp_reno;
1184 716
1185static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state) 717static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
1186{ 718{
1187 if (tp->ca_ops->set_state) 719 struct inet_connection_sock *icsk = inet_csk(sk);
1188 tp->ca_ops->set_state(tp, ca_state); 720
1189 tp->ca_state = ca_state; 721 if (icsk->icsk_ca_ops->set_state)
722 icsk->icsk_ca_ops->set_state(sk, ca_state);
723 icsk->icsk_ca_state = ca_state;
1190} 724}
1191 725
1192static inline void tcp_ca_event(struct tcp_sock *tp, enum tcp_ca_event event) 726static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
1193{ 727{
1194 if (tp->ca_ops->cwnd_event) 728 const struct inet_connection_sock *icsk = inet_csk(sk);
1195 tp->ca_ops->cwnd_event(tp, event); 729
730 if (icsk->icsk_ca_ops->cwnd_event)
731 icsk->icsk_ca_ops->cwnd_event(sk, event);
1196} 732}
1197 733
1198/* This determines how many packets are "in the network" to the best 734/* This determines how many packets are "in the network" to the best
@@ -1218,9 +754,10 @@ static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
1218 * The exception is rate halving phase, when cwnd is decreasing towards 754 * The exception is rate halving phase, when cwnd is decreasing towards
1219 * ssthresh. 755 * ssthresh.
1220 */ 756 */
1221static inline __u32 tcp_current_ssthresh(struct tcp_sock *tp) 757static inline __u32 tcp_current_ssthresh(const struct sock *sk)
1222{ 758{
1223 if ((1<<tp->ca_state)&(TCPF_CA_CWR|TCPF_CA_Recovery)) 759 const struct tcp_sock *tp = tcp_sk(sk);
760 if ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_CWR | TCPF_CA_Recovery))
1224 return tp->snd_ssthresh; 761 return tp->snd_ssthresh;
1225 else 762 else
1226 return max(tp->snd_ssthresh, 763 return max(tp->snd_ssthresh,
@@ -1237,10 +774,13 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
1237} 774}
1238 775
1239/* Set slow start threshold and cwnd not falling to slow start */ 776/* Set slow start threshold and cwnd not falling to slow start */
1240static inline void __tcp_enter_cwr(struct tcp_sock *tp) 777static inline void __tcp_enter_cwr(struct sock *sk)
1241{ 778{
779 const struct inet_connection_sock *icsk = inet_csk(sk);
780 struct tcp_sock *tp = tcp_sk(sk);
781
1242 tp->undo_marker = 0; 782 tp->undo_marker = 0;
1243 tp->snd_ssthresh = tp->ca_ops->ssthresh(tp); 783 tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk);
1244 tp->snd_cwnd = min(tp->snd_cwnd, 784 tp->snd_cwnd = min(tp->snd_cwnd,
1245 tcp_packets_in_flight(tp) + 1U); 785 tcp_packets_in_flight(tp) + 1U);
1246 tp->snd_cwnd_cnt = 0; 786 tp->snd_cwnd_cnt = 0;
@@ -1249,12 +789,14 @@ static inline void __tcp_enter_cwr(struct tcp_sock *tp)
1249 TCP_ECN_queue_cwr(tp); 789 TCP_ECN_queue_cwr(tp);
1250} 790}
1251 791
1252static inline void tcp_enter_cwr(struct tcp_sock *tp) 792static inline void tcp_enter_cwr(struct sock *sk)
1253{ 793{
794 struct tcp_sock *tp = tcp_sk(sk);
795
1254 tp->prior_ssthresh = 0; 796 tp->prior_ssthresh = 0;
1255 if (tp->ca_state < TCP_CA_CWR) { 797 if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
1256 __tcp_enter_cwr(tp); 798 __tcp_enter_cwr(sk);
1257 tcp_set_ca_state(tp, TCP_CA_CWR); 799 tcp_set_ca_state(sk, TCP_CA_CWR);
1258 } 800 }
1259} 801}
1260 802
@@ -1277,8 +819,10 @@ static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss,
1277 819
1278static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 820static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
1279{ 821{
1280 if (!tp->packets_out && !tp->pending) 822 const struct inet_connection_sock *icsk = inet_csk(sk);
1281 tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto); 823 if (!tp->packets_out && !icsk->icsk_pending)
824 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
825 icsk->icsk_rto, TCP_RTO_MAX);
1282} 826}
1283 827
1284static __inline__ void tcp_push_pending_frames(struct sock *sk, 828static __inline__ void tcp_push_pending_frames(struct sock *sk,
@@ -1297,9 +841,6 @@ static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
1297 tp->snd_wl1 = seq; 841 tp->snd_wl1 = seq;
1298} 842}
1299 843
1300extern void tcp_destroy_sock(struct sock *sk);
1301
1302
1303/* 844/*
1304 * Calculate(/check) TCP checksum 845 * Calculate(/check) TCP checksum
1305 */ 846 */
@@ -1359,8 +900,10 @@ static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
1359 tp->ucopy.memory = 0; 900 tp->ucopy.memory = 0;
1360 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { 901 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
1361 wake_up_interruptible(sk->sk_sleep); 902 wake_up_interruptible(sk->sk_sleep);
1362 if (!tcp_ack_scheduled(tp)) 903 if (!inet_csk_ack_scheduled(sk))
1363 tcp_reset_xmit_timer(sk, TCP_TIME_DACK, (3*TCP_RTO_MIN)/4); 904 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
905 (3 * TCP_RTO_MIN) / 4,
906 TCP_RTO_MAX);
1364 } 907 }
1365 return 1; 908 return 1;
1366 } 909 }
@@ -1393,9 +936,9 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
1393 TCP_INC_STATS(TCP_MIB_ESTABRESETS); 936 TCP_INC_STATS(TCP_MIB_ESTABRESETS);
1394 937
1395 sk->sk_prot->unhash(sk); 938 sk->sk_prot->unhash(sk);
1396 if (tcp_sk(sk)->bind_hash && 939 if (inet_csk(sk)->icsk_bind_hash &&
1397 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) 940 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
1398 tcp_put_port(sk); 941 inet_put_port(&tcp_hashinfo, sk);
1399 /* fall through */ 942 /* fall through */
1400 default: 943 default:
1401 if (oldstate==TCP_ESTABLISHED) 944 if (oldstate==TCP_ESTABLISHED)
@@ -1422,7 +965,7 @@ static __inline__ void tcp_done(struct sock *sk)
1422 if (!sock_flag(sk, SOCK_DEAD)) 965 if (!sock_flag(sk, SOCK_DEAD))
1423 sk->sk_state_change(sk); 966 sk->sk_state_change(sk);
1424 else 967 else
1425 tcp_destroy_sock(sk); 968 inet_csk_destroy_sock(sk);
1426} 969}
1427 970
1428static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt) 971static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt)
@@ -1524,54 +1067,6 @@ static inline int tcp_full_space(const struct sock *sk)
1524 return tcp_win_from_space(sk->sk_rcvbuf); 1067 return tcp_win_from_space(sk->sk_rcvbuf);
1525} 1068}
1526 1069
1527static inline void tcp_acceptq_queue(struct sock *sk, struct request_sock *req,
1528 struct sock *child)
1529{
1530 reqsk_queue_add(&tcp_sk(sk)->accept_queue, req, sk, child);
1531}
1532
1533static inline void
1534tcp_synq_removed(struct sock *sk, struct request_sock *req)
1535{
1536 if (reqsk_queue_removed(&tcp_sk(sk)->accept_queue, req) == 0)
1537 tcp_delete_keepalive_timer(sk);
1538}
1539
1540static inline void tcp_synq_added(struct sock *sk)
1541{
1542 if (reqsk_queue_added(&tcp_sk(sk)->accept_queue) == 0)
1543 tcp_reset_keepalive_timer(sk, TCP_TIMEOUT_INIT);
1544}
1545
1546static inline int tcp_synq_len(struct sock *sk)
1547{
1548 return reqsk_queue_len(&tcp_sk(sk)->accept_queue);
1549}
1550
1551static inline int tcp_synq_young(struct sock *sk)
1552{
1553 return reqsk_queue_len_young(&tcp_sk(sk)->accept_queue);
1554}
1555
1556static inline int tcp_synq_is_full(struct sock *sk)
1557{
1558 return reqsk_queue_is_full(&tcp_sk(sk)->accept_queue);
1559}
1560
1561static inline void tcp_synq_unlink(struct tcp_sock *tp, struct request_sock *req,
1562 struct request_sock **prev)
1563{
1564 reqsk_queue_unlink(&tp->accept_queue, req, prev);
1565}
1566
1567static inline void tcp_synq_drop(struct sock *sk, struct request_sock *req,
1568 struct request_sock **prev)
1569{
1570 tcp_synq_unlink(tcp_sk(sk), req, prev);
1571 tcp_synq_removed(sk, req);
1572 reqsk_free(req);
1573}
1574
1575static __inline__ void tcp_openreq_init(struct request_sock *req, 1070static __inline__ void tcp_openreq_init(struct request_sock *req,
1576 struct tcp_options_received *rx_opt, 1071 struct tcp_options_received *rx_opt,
1577 struct sk_buff *skb) 1072 struct sk_buff *skb)
@@ -1593,27 +1088,6 @@ static __inline__ void tcp_openreq_init(struct request_sock *req,
1593 1088
1594extern void tcp_enter_memory_pressure(void); 1089extern void tcp_enter_memory_pressure(void);
1595 1090
1596extern void tcp_listen_wlock(void);
1597
1598/* - We may sleep inside this lock.
1599 * - If sleeping is not required (or called from BH),
1600 * use plain read_(un)lock(&tcp_lhash_lock).
1601 */
1602
1603static inline void tcp_listen_lock(void)
1604{
1605 /* read_lock synchronizes to candidates to writers */
1606 read_lock(&tcp_lhash_lock);
1607 atomic_inc(&tcp_lhash_users);
1608 read_unlock(&tcp_lhash_lock);
1609}
1610
1611static inline void tcp_listen_unlock(void)
1612{
1613 if (atomic_dec_and_test(&tcp_lhash_users))
1614 wake_up(&tcp_lhash_wait);
1615}
1616
1617static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1091static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1618{ 1092{
1619 return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl; 1093 return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl;
@@ -1624,12 +1098,13 @@ static inline int keepalive_time_when(const struct tcp_sock *tp)
1624 return tp->keepalive_time ? : sysctl_tcp_keepalive_time; 1098 return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
1625} 1099}
1626 1100
1627static inline int tcp_fin_time(const struct tcp_sock *tp) 1101static inline int tcp_fin_time(const struct sock *sk)
1628{ 1102{
1629 int fin_timeout = tp->linger2 ? : sysctl_tcp_fin_timeout; 1103 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
1104 const int rto = inet_csk(sk)->icsk_rto;
1630 1105
1631 if (fin_timeout < (tp->rto<<2) - (tp->rto>>1)) 1106 if (fin_timeout < (rto << 2) - (rto >> 1))
1632 fin_timeout = (tp->rto<<2) - (tp->rto>>1); 1107 fin_timeout = (rto << 2) - (rto >> 1);
1633 1108
1634 return fin_timeout; 1109 return fin_timeout;
1635} 1110}
@@ -1658,15 +1133,6 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1658 return 1; 1133 return 1;
1659} 1134}
1660 1135
1661static inline void tcp_v4_setup_caps(struct sock *sk, struct dst_entry *dst)
1662{
1663 sk->sk_route_caps = dst->dev->features;
1664 if (sk->sk_route_caps & NETIF_F_TSO) {
1665 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
1666 sk->sk_route_caps &= ~NETIF_F_TSO;
1667 }
1668}
1669
1670#define TCP_CHECK_TIMER(sk) do { } while (0) 1136#define TCP_CHECK_TIMER(sk) do { } while (0)
1671 1137
1672static inline int tcp_use_frto(const struct sock *sk) 1138static inline int tcp_use_frto(const struct sock *sk)
@@ -1718,4 +1184,16 @@ struct tcp_iter_state {
1718extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); 1184extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo);
1719extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); 1185extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo);
1720 1186
1187extern struct request_sock_ops tcp_request_sock_ops;
1188
1189extern int tcp_v4_destroy_sock(struct sock *sk);
1190
1191#ifdef CONFIG_PROC_FS
1192extern int tcp4_proc_init(void);
1193extern void tcp4_proc_exit(void);
1194#endif
1195
1196extern void tcp_v4_init(struct net_proto_family *ops);
1197extern void tcp_init(void);
1198
1721#endif /* _TCP_H */ 1199#endif /* _TCP_H */
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index 64980ee8c92a..c6b84397448d 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -88,7 +88,7 @@ static inline void TCP_ECN_check_ce(struct tcp_sock *tp, struct sk_buff *skb)
88 * it is surely retransmit. It is not in ECN RFC, 88 * it is surely retransmit. It is not in ECN RFC,
89 * but Linux follows this rule. */ 89 * but Linux follows this rule. */
90 else if (INET_ECN_is_not_ect((TCP_SKB_CB(skb)->flags))) 90 else if (INET_ECN_is_not_ect((TCP_SKB_CB(skb)->flags)))
91 tcp_enter_quickack_mode(tp); 91 tcp_enter_quickack_mode((struct sock *)tp);
92 } 92 }
93} 93}
94 94
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h
new file mode 100644
index 000000000000..b9d4176b2d15
--- /dev/null
+++ b/include/net/tcp_states.h
@@ -0,0 +1,34 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the TCP protocol sk_state field.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _LINUX_TCP_STATES_H
14#define _LINUX_TCP_STATES_H
15
16enum {
17 TCP_ESTABLISHED = 1,
18 TCP_SYN_SENT,
19 TCP_SYN_RECV,
20 TCP_FIN_WAIT1,
21 TCP_FIN_WAIT2,
22 TCP_TIME_WAIT,
23 TCP_CLOSE,
24 TCP_CLOSE_WAIT,
25 TCP_LAST_ACK,
26 TCP_LISTEN,
27 TCP_CLOSING, /* Now a valid state */
28
29 TCP_MAX_STATES /* Leave at the end! */
30};
31
32#define TCP_STATE_MASK 0xF
33
34#endif /* _LINUX_TCP_STATES_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index ac229b761dbc..107b9d791a1f 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -94,6 +94,11 @@ struct udp_iter_state {
94 struct seq_operations seq_ops; 94 struct seq_operations seq_ops;
95}; 95};
96 96
97#ifdef CONFIG_PROC_FS
97extern int udp_proc_register(struct udp_seq_afinfo *afinfo); 98extern int udp_proc_register(struct udp_seq_afinfo *afinfo);
98extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); 99extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo);
100
101extern int udp4_proc_init(void);
102extern void udp4_proc_exit(void);
103#endif
99#endif /* _UDP_H */ 104#endif /* _UDP_H */
diff --git a/include/net/x25.h b/include/net/x25.h
index 8b39b98876e8..fee62ff8c194 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -175,7 +175,7 @@ extern void x25_kill_by_neigh(struct x25_neigh *);
175 175
176/* x25_dev.c */ 176/* x25_dev.c */
177extern void x25_send_frame(struct sk_buff *, struct x25_neigh *); 177extern void x25_send_frame(struct sk_buff *, struct x25_neigh *);
178extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *); 178extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
179extern void x25_establish_link(struct x25_neigh *); 179extern void x25_establish_link(struct x25_neigh *);
180extern void x25_terminate_link(struct x25_neigh *); 180extern void x25_terminate_link(struct x25_neigh *);
181 181
diff --git a/include/net/x25device.h b/include/net/x25device.h
index d45ae883bd1d..1a318374faef 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -8,7 +8,6 @@
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
9{ 9{
10 skb->mac.raw = skb->data; 10 skb->mac.raw = skb->data;
11 skb->input_dev = skb->dev = dev;
12 skb->pkt_type = PACKET_HOST; 11 skb->pkt_type = PACKET_HOST;
13 12
14 return htons(ETH_P_X25); 13 return htons(ETH_P_X25);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 868ef88ef971..a9d0d8c5dfbf 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -818,7 +818,6 @@ extern void xfrm6_init(void);
818extern void xfrm6_fini(void); 818extern void xfrm6_fini(void);
819extern void xfrm_state_init(void); 819extern void xfrm_state_init(void);
820extern void xfrm4_state_init(void); 820extern void xfrm4_state_init(void);
821extern void xfrm4_state_fini(void);
822extern void xfrm6_state_init(void); 821extern void xfrm6_state_init(void);
823extern void xfrm6_state_fini(void); 822extern void xfrm6_state_fini(void);
824 823
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h
new file mode 100644
index 000000000000..5bf9834f7dca
--- /dev/null
+++ b/include/rdma/ib_cache.h
@@ -0,0 +1,105 @@
1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
15 *
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33 *
34 * $Id: ib_cache.h 1349 2004-12-16 21:09:43Z roland $
35 */
36
37#ifndef _IB_CACHE_H
38#define _IB_CACHE_H
39
40#include <rdma/ib_verbs.h>
41
42/**
43 * ib_get_cached_gid - Returns a cached GID table entry
44 * @device: The device to query.
45 * @port_num: The port number of the device to query.
46 * @index: The index into the cached GID table to query.
47 * @gid: The GID value found at the specified index.
48 *
49 * ib_get_cached_gid() fetches the specified GID table entry stored in
50 * the local software cache.
51 */
52int ib_get_cached_gid(struct ib_device *device,
53 u8 port_num,
54 int index,
55 union ib_gid *gid);
56
57/**
58 * ib_find_cached_gid - Returns the port number and GID table index where
59 * a specified GID value occurs.
60 * @device: The device to query.
61 * @gid: The GID value to search for.
62 * @port_num: The port number of the device where the GID value was found.
63 * @index: The index into the cached GID table where the GID was found. This
64 * parameter may be NULL.
65 *
66 * ib_find_cached_gid() searches for the specified GID value in
67 * the local software cache.
68 */
69int ib_find_cached_gid(struct ib_device *device,
70 union ib_gid *gid,
71 u8 *port_num,
72 u16 *index);
73
74/**
75 * ib_get_cached_pkey - Returns a cached PKey table entry
76 * @device: The device to query.
77 * @port_num: The port number of the device to query.
78 * @index: The index into the cached PKey table to query.
79 * @pkey: The PKey value found at the specified index.
80 *
81 * ib_get_cached_pkey() fetches the specified PKey table entry stored in
82 * the local software cache.
83 */
84int ib_get_cached_pkey(struct ib_device *device_handle,
85 u8 port_num,
86 int index,
87 u16 *pkey);
88
89/**
90 * ib_find_cached_pkey - Returns the PKey table index where a specified
91 * PKey value occurs.
92 * @device: The device to query.
93 * @port_num: The port number of the device to search for the PKey.
94 * @pkey: The PKey value to search for.
95 * @index: The index into the cached PKey table where the PKey was found.
96 *
97 * ib_find_cached_pkey() searches the specified PKey table in
98 * the local software cache.
99 */
100int ib_find_cached_pkey(struct ib_device *device,
101 u8 port_num,
102 u16 pkey,
103 u16 *index);
104
105#endif /* _IB_CACHE_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
new file mode 100644
index 000000000000..77fe9039209b
--- /dev/null
+++ b/include/rdma/ib_cm.h
@@ -0,0 +1,568 @@
1/*
2 * Copyright (c) 2004 Intel Corporation. All rights reserved.
3 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
4 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
5 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
11 * OpenIB.org BSD license below:
12 *
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
16 *
17 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer.
20 *
21 * - Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following
23 * disclaimer in the documentation and/or other materials
24 * provided with the distribution.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE.
34 *
35 * $Id: ib_cm.h 2730 2005-06-28 16:43:03Z sean.hefty $
36 */
37#if !defined(IB_CM_H)
38#define IB_CM_H
39
40#include <rdma/ib_mad.h>
41#include <rdma/ib_sa.h>
42
43enum ib_cm_state {
44 IB_CM_IDLE,
45 IB_CM_LISTEN,
46 IB_CM_REQ_SENT,
47 IB_CM_REQ_RCVD,
48 IB_CM_MRA_REQ_SENT,
49 IB_CM_MRA_REQ_RCVD,
50 IB_CM_REP_SENT,
51 IB_CM_REP_RCVD,
52 IB_CM_MRA_REP_SENT,
53 IB_CM_MRA_REP_RCVD,
54 IB_CM_ESTABLISHED,
55 IB_CM_DREQ_SENT,
56 IB_CM_DREQ_RCVD,
57 IB_CM_TIMEWAIT,
58 IB_CM_SIDR_REQ_SENT,
59 IB_CM_SIDR_REQ_RCVD
60};
61
62enum ib_cm_lap_state {
63 IB_CM_LAP_IDLE,
64 IB_CM_LAP_SENT,
65 IB_CM_LAP_RCVD,
66 IB_CM_MRA_LAP_SENT,
67 IB_CM_MRA_LAP_RCVD,
68};
69
70enum ib_cm_event_type {
71 IB_CM_REQ_ERROR,
72 IB_CM_REQ_RECEIVED,
73 IB_CM_REP_ERROR,
74 IB_CM_REP_RECEIVED,
75 IB_CM_RTU_RECEIVED,
76 IB_CM_USER_ESTABLISHED,
77 IB_CM_DREQ_ERROR,
78 IB_CM_DREQ_RECEIVED,
79 IB_CM_DREP_RECEIVED,
80 IB_CM_TIMEWAIT_EXIT,
81 IB_CM_MRA_RECEIVED,
82 IB_CM_REJ_RECEIVED,
83 IB_CM_LAP_ERROR,
84 IB_CM_LAP_RECEIVED,
85 IB_CM_APR_RECEIVED,
86 IB_CM_SIDR_REQ_ERROR,
87 IB_CM_SIDR_REQ_RECEIVED,
88 IB_CM_SIDR_REP_RECEIVED
89};
90
91enum ib_cm_data_size {
92 IB_CM_REQ_PRIVATE_DATA_SIZE = 92,
93 IB_CM_MRA_PRIVATE_DATA_SIZE = 222,
94 IB_CM_REJ_PRIVATE_DATA_SIZE = 148,
95 IB_CM_REP_PRIVATE_DATA_SIZE = 196,
96 IB_CM_RTU_PRIVATE_DATA_SIZE = 224,
97 IB_CM_DREQ_PRIVATE_DATA_SIZE = 220,
98 IB_CM_DREP_PRIVATE_DATA_SIZE = 224,
99 IB_CM_REJ_ARI_LENGTH = 72,
100 IB_CM_LAP_PRIVATE_DATA_SIZE = 168,
101 IB_CM_APR_PRIVATE_DATA_SIZE = 148,
102 IB_CM_APR_INFO_LENGTH = 72,
103 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
104 IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
105 IB_CM_SIDR_REP_INFO_LENGTH = 72
106};
107
108struct ib_cm_id;
109
110struct ib_cm_req_event_param {
111 struct ib_cm_id *listen_id;
112 struct ib_device *device;
113 u8 port;
114
115 struct ib_sa_path_rec *primary_path;
116 struct ib_sa_path_rec *alternate_path;
117
118 __be64 remote_ca_guid;
119 u32 remote_qkey;
120 u32 remote_qpn;
121 enum ib_qp_type qp_type;
122
123 u32 starting_psn;
124 u8 responder_resources;
125 u8 initiator_depth;
126 unsigned int local_cm_response_timeout:5;
127 unsigned int flow_control:1;
128 unsigned int remote_cm_response_timeout:5;
129 unsigned int retry_count:3;
130 unsigned int rnr_retry_count:3;
131 unsigned int srq:1;
132};
133
134struct ib_cm_rep_event_param {
135 __be64 remote_ca_guid;
136 u32 remote_qkey;
137 u32 remote_qpn;
138 u32 starting_psn;
139 u8 responder_resources;
140 u8 initiator_depth;
141 unsigned int target_ack_delay:5;
142 unsigned int failover_accepted:2;
143 unsigned int flow_control:1;
144 unsigned int rnr_retry_count:3;
145 unsigned int srq:1;
146};
147
148enum ib_cm_rej_reason {
149 IB_CM_REJ_NO_QP = 1,
150 IB_CM_REJ_NO_EEC = 2,
151 IB_CM_REJ_NO_RESOURCES = 3,
152 IB_CM_REJ_TIMEOUT = 4,
153 IB_CM_REJ_UNSUPPORTED = 5,
154 IB_CM_REJ_INVALID_COMM_ID = 6,
155 IB_CM_REJ_INVALID_COMM_INSTANCE = 7,
156 IB_CM_REJ_INVALID_SERVICE_ID = 8,
157 IB_CM_REJ_INVALID_TRANSPORT_TYPE = 9,
158 IB_CM_REJ_STALE_CONN = 10,
159 IB_CM_REJ_RDC_NOT_EXIST = 11,
160 IB_CM_REJ_INVALID_GID = 12,
161 IB_CM_REJ_INVALID_LID = 13,
162 IB_CM_REJ_INVALID_SL = 14,
163 IB_CM_REJ_INVALID_TRAFFIC_CLASS = 15,
164 IB_CM_REJ_INVALID_HOP_LIMIT = 16,
165 IB_CM_REJ_INVALID_PACKET_RATE = 17,
166 IB_CM_REJ_INVALID_ALT_GID = 18,
167 IB_CM_REJ_INVALID_ALT_LID = 19,
168 IB_CM_REJ_INVALID_ALT_SL = 20,
169 IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = 21,
170 IB_CM_REJ_INVALID_ALT_HOP_LIMIT = 22,
171 IB_CM_REJ_INVALID_ALT_PACKET_RATE = 23,
172 IB_CM_REJ_PORT_CM_REDIRECT = 24,
173 IB_CM_REJ_PORT_REDIRECT = 25,
174 IB_CM_REJ_INVALID_MTU = 26,
175 IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = 27,
176 IB_CM_REJ_CONSUMER_DEFINED = 28,
177 IB_CM_REJ_INVALID_RNR_RETRY = 29,
178 IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = 30,
179 IB_CM_REJ_INVALID_CLASS_VERSION = 31,
180 IB_CM_REJ_INVALID_FLOW_LABEL = 32,
181 IB_CM_REJ_INVALID_ALT_FLOW_LABEL = 33
182};
183
184struct ib_cm_rej_event_param {
185 enum ib_cm_rej_reason reason;
186 void *ari;
187 u8 ari_length;
188};
189
190struct ib_cm_mra_event_param {
191 u8 service_timeout;
192};
193
194struct ib_cm_lap_event_param {
195 struct ib_sa_path_rec *alternate_path;
196};
197
198enum ib_cm_apr_status {
199 IB_CM_APR_SUCCESS,
200 IB_CM_APR_INVALID_COMM_ID,
201 IB_CM_APR_UNSUPPORTED,
202 IB_CM_APR_REJECT,
203 IB_CM_APR_REDIRECT,
204 IB_CM_APR_IS_CURRENT,
205 IB_CM_APR_INVALID_QPN_EECN,
206 IB_CM_APR_INVALID_LID,
207 IB_CM_APR_INVALID_GID,
208 IB_CM_APR_INVALID_FLOW_LABEL,
209 IB_CM_APR_INVALID_TCLASS,
210 IB_CM_APR_INVALID_HOP_LIMIT,
211 IB_CM_APR_INVALID_PACKET_RATE,
212 IB_CM_APR_INVALID_SL
213};
214
215struct ib_cm_apr_event_param {
216 enum ib_cm_apr_status ap_status;
217 void *apr_info;
218 u8 info_len;
219};
220
221struct ib_cm_sidr_req_event_param {
222 struct ib_cm_id *listen_id;
223 struct ib_device *device;
224 u8 port;
225 u16 pkey;
226};
227
228enum ib_cm_sidr_status {
229 IB_SIDR_SUCCESS,
230 IB_SIDR_UNSUPPORTED,
231 IB_SIDR_REJECT,
232 IB_SIDR_NO_QP,
233 IB_SIDR_REDIRECT,
234 IB_SIDR_UNSUPPORTED_VERSION
235};
236
237struct ib_cm_sidr_rep_event_param {
238 enum ib_cm_sidr_status status;
239 u32 qkey;
240 u32 qpn;
241 void *info;
242 u8 info_len;
243
244};
245
246struct ib_cm_event {
247 enum ib_cm_event_type event;
248 union {
249 struct ib_cm_req_event_param req_rcvd;
250 struct ib_cm_rep_event_param rep_rcvd;
251 /* No data for RTU received events. */
252 struct ib_cm_rej_event_param rej_rcvd;
253 struct ib_cm_mra_event_param mra_rcvd;
254 struct ib_cm_lap_event_param lap_rcvd;
255 struct ib_cm_apr_event_param apr_rcvd;
256 /* No data for DREQ/DREP received events. */
257 struct ib_cm_sidr_req_event_param sidr_req_rcvd;
258 struct ib_cm_sidr_rep_event_param sidr_rep_rcvd;
259 enum ib_wc_status send_status;
260 } param;
261
262 void *private_data;
263};
264
265/**
266 * ib_cm_handler - User-defined callback to process communication events.
267 * @cm_id: Communication identifier associated with the reported event.
268 * @event: Information about the communication event.
269 *
270 * IB_CM_REQ_RECEIVED and IB_CM_SIDR_REQ_RECEIVED communication events
271 * generated as a result of listen requests result in the allocation of a
272 * new @cm_id. The new @cm_id is returned to the user through this callback.
273 * Clients are responsible for destroying the new @cm_id. For peer-to-peer
274 * IB_CM_REQ_RECEIVED and all other events, the returned @cm_id corresponds
275 * to a user's existing communication identifier.
276 *
277 * Users may not call ib_destroy_cm_id while in the context of this callback;
278 * however, returning a non-zero value instructs the communication manager to
279 * destroy the @cm_id after the callback completes.
280 */
281typedef int (*ib_cm_handler)(struct ib_cm_id *cm_id,
282 struct ib_cm_event *event);
283
284struct ib_cm_id {
285 ib_cm_handler cm_handler;
286 void *context;
287 __be64 service_id;
288 __be64 service_mask;
289 enum ib_cm_state state; /* internal CM/debug use */
290 enum ib_cm_lap_state lap_state; /* internal CM/debug use */
291 __be32 local_id;
292 __be32 remote_id;
293};
294
295/**
296 * ib_create_cm_id - Allocate a communication identifier.
297 * @cm_handler: Callback invoked to notify the user of CM events.
298 * @context: User specified context associated with the communication
299 * identifier.
300 *
301 * Communication identifiers are used to track connection states, service
302 * ID resolution requests, and listen requests.
303 */
304struct ib_cm_id *ib_create_cm_id(ib_cm_handler cm_handler,
305 void *context);
306
307/**
308 * ib_destroy_cm_id - Destroy a connection identifier.
309 * @cm_id: Connection identifier to destroy.
310 *
311 * This call blocks until the connection identifier is destroyed.
312 */
313void ib_destroy_cm_id(struct ib_cm_id *cm_id);
314
315#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL)
316#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL)
317
318/**
319 * ib_cm_listen - Initiates listening on the specified service ID for
320 * connection and service ID resolution requests.
321 * @cm_id: Connection identifier associated with the listen request.
322 * @service_id: Service identifier matched against incoming connection
323 * and service ID resolution requests. The service ID should be specified
324 * network-byte order. If set to IB_CM_ASSIGN_SERVICE_ID, the CM will
325 * assign a service ID to the caller.
326 * @service_mask: Mask applied to service ID used to listen across a
327 * range of service IDs. If set to 0, the service ID is matched
328 * exactly. This parameter is ignored if %service_id is set to
329 * IB_CM_ASSIGN_SERVICE_ID.
330 */
331int ib_cm_listen(struct ib_cm_id *cm_id,
332 __be64 service_id,
333 __be64 service_mask);
334
335struct ib_cm_req_param {
336 struct ib_sa_path_rec *primary_path;
337 struct ib_sa_path_rec *alternate_path;
338 __be64 service_id;
339 u32 qp_num;
340 enum ib_qp_type qp_type;
341 u32 starting_psn;
342 const void *private_data;
343 u8 private_data_len;
344 u8 peer_to_peer;
345 u8 responder_resources;
346 u8 initiator_depth;
347 u8 remote_cm_response_timeout;
348 u8 flow_control;
349 u8 local_cm_response_timeout;
350 u8 retry_count;
351 u8 rnr_retry_count;
352 u8 max_cm_retries;
353 u8 srq;
354};
355
356/**
357 * ib_send_cm_req - Sends a connection request to the remote node.
358 * @cm_id: Connection identifier that will be associated with the
359 * connection request.
360 * @param: Connection request information needed to establish the
361 * connection.
362 */
363int ib_send_cm_req(struct ib_cm_id *cm_id,
364 struct ib_cm_req_param *param);
365
366struct ib_cm_rep_param {
367 u32 qp_num;
368 u32 starting_psn;
369 const void *private_data;
370 u8 private_data_len;
371 u8 responder_resources;
372 u8 initiator_depth;
373 u8 target_ack_delay;
374 u8 failover_accepted;
375 u8 flow_control;
376 u8 rnr_retry_count;
377 u8 srq;
378};
379
380/**
381 * ib_send_cm_rep - Sends a connection reply in response to a connection
382 * request.
383 * @cm_id: Connection identifier that will be associated with the
384 * connection request.
385 * @param: Connection reply information needed to establish the
386 * connection.
387 */
388int ib_send_cm_rep(struct ib_cm_id *cm_id,
389 struct ib_cm_rep_param *param);
390
391/**
392 * ib_send_cm_rtu - Sends a connection ready to use message in response
393 * to a connection reply message.
394 * @cm_id: Connection identifier associated with the connection request.
395 * @private_data: Optional user-defined private data sent with the
396 * ready to use message.
397 * @private_data_len: Size of the private data buffer, in bytes.
398 */
399int ib_send_cm_rtu(struct ib_cm_id *cm_id,
400 const void *private_data,
401 u8 private_data_len);
402
403/**
404 * ib_send_cm_dreq - Sends a disconnection request for an existing
405 * connection.
406 * @cm_id: Connection identifier associated with the connection being
407 * released.
408 * @private_data: Optional user-defined private data sent with the
409 * disconnection request message.
410 * @private_data_len: Size of the private data buffer, in bytes.
411 */
412int ib_send_cm_dreq(struct ib_cm_id *cm_id,
413 const void *private_data,
414 u8 private_data_len);
415
416/**
417 * ib_send_cm_drep - Sends a disconnection reply to a disconnection request.
418 * @cm_id: Connection identifier associated with the connection being
419 * released.
420 * @private_data: Optional user-defined private data sent with the
421 * disconnection reply message.
422 * @private_data_len: Size of the private data buffer, in bytes.
423 *
424 * If the cm_id is in the correct state, the CM will transition the connection
425 * to the timewait state, even if an error occurs sending the DREP message.
426 */
427int ib_send_cm_drep(struct ib_cm_id *cm_id,
428 const void *private_data,
429 u8 private_data_len);
430
431/**
432 * ib_cm_establish - Forces a connection state to established.
433 * @cm_id: Connection identifier to transition to established.
434 *
435 * This routine should be invoked by users who receive messages on a
436 * connected QP before an RTU has been received.
437 */
438int ib_cm_establish(struct ib_cm_id *cm_id);
439
440/**
441 * ib_send_cm_rej - Sends a connection rejection message to the
442 * remote node.
443 * @cm_id: Connection identifier associated with the connection being
444 * rejected.
445 * @reason: Reason for the connection request rejection.
446 * @ari: Optional additional rejection information.
447 * @ari_length: Size of the additional rejection information, in bytes.
448 * @private_data: Optional user-defined private data sent with the
449 * rejection message.
450 * @private_data_len: Size of the private data buffer, in bytes.
451 */
452int ib_send_cm_rej(struct ib_cm_id *cm_id,
453 enum ib_cm_rej_reason reason,
454 void *ari,
455 u8 ari_length,
456 const void *private_data,
457 u8 private_data_len);
458
459/**
460 * ib_send_cm_mra - Sends a message receipt acknowledgement to a connection
461 * message.
462 * @cm_id: Connection identifier associated with the connection message.
463 * @service_timeout: The maximum time required for the sender to reply to
464 * to the connection message.
465 * @private_data: Optional user-defined private data sent with the
466 * message receipt acknowledgement.
467 * @private_data_len: Size of the private data buffer, in bytes.
468 */
469int ib_send_cm_mra(struct ib_cm_id *cm_id,
470 u8 service_timeout,
471 const void *private_data,
472 u8 private_data_len);
473
474/**
475 * ib_send_cm_lap - Sends a load alternate path request.
476 * @cm_id: Connection identifier associated with the load alternate path
477 * message.
478 * @alternate_path: A path record that identifies the alternate path to
479 * load.
480 * @private_data: Optional user-defined private data sent with the
481 * load alternate path message.
482 * @private_data_len: Size of the private data buffer, in bytes.
483 */
484int ib_send_cm_lap(struct ib_cm_id *cm_id,
485 struct ib_sa_path_rec *alternate_path,
486 const void *private_data,
487 u8 private_data_len);
488
489/**
490 * ib_cm_init_qp_attr - Initializes the QP attributes for use in transitioning
491 * to a specified QP state.
492 * @cm_id: Communication identifier associated with the QP attributes to
493 * initialize.
494 * @qp_attr: On input, specifies the desired QP state. On output, the
495 * mandatory and desired optional attributes will be set in order to
496 * modify the QP to the specified state.
497 * @qp_attr_mask: The QP attribute mask that may be used to transition the
498 * QP to the specified state.
499 *
500 * Users must set the @qp_attr->qp_state to the desired QP state. This call
501 * will set all required attributes for the given transition, along with
502 * known optional attributes. Users may override the attributes returned from
503 * this call before calling ib_modify_qp.
504 */
505int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
506 struct ib_qp_attr *qp_attr,
507 int *qp_attr_mask);
508
509/**
510 * ib_send_cm_apr - Sends an alternate path response message in response to
511 * a load alternate path request.
512 * @cm_id: Connection identifier associated with the alternate path response.
513 * @status: Reply status sent with the alternate path response.
514 * @info: Optional additional information sent with the alternate path
515 * response.
516 * @info_length: Size of the additional information, in bytes.
517 * @private_data: Optional user-defined private data sent with the
518 * alternate path response message.
519 * @private_data_len: Size of the private data buffer, in bytes.
520 */
521int ib_send_cm_apr(struct ib_cm_id *cm_id,
522 enum ib_cm_apr_status status,
523 void *info,
524 u8 info_length,
525 const void *private_data,
526 u8 private_data_len);
527
528struct ib_cm_sidr_req_param {
529 struct ib_sa_path_rec *path;
530 __be64 service_id;
531 int timeout_ms;
532 const void *private_data;
533 u8 private_data_len;
534 u8 max_cm_retries;
535 u16 pkey;
536};
537
538/**
539 * ib_send_cm_sidr_req - Sends a service ID resolution request to the
540 * remote node.
541 * @cm_id: Communication identifier that will be associated with the
542 * service ID resolution request.
543 * @param: Service ID resolution request information.
544 */
545int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
546 struct ib_cm_sidr_req_param *param);
547
548struct ib_cm_sidr_rep_param {
549 u32 qp_num;
550 u32 qkey;
551 enum ib_cm_sidr_status status;
552 const void *info;
553 u8 info_length;
554 const void *private_data;
555 u8 private_data_len;
556};
557
558/**
559 * ib_send_cm_sidr_rep - Sends a service ID resolution request to the
560 * remote node.
561 * @cm_id: Communication identifier associated with the received service ID
562 * resolution request.
563 * @param: Service ID resolution reply information.
564 */
565int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
566 struct ib_cm_sidr_rep_param *param);
567
568#endif /* IB_CM_H */
diff --git a/include/rdma/ib_fmr_pool.h b/include/rdma/ib_fmr_pool.h
new file mode 100644
index 000000000000..86b7e93f198b
--- /dev/null
+++ b/include/rdma/ib_fmr_pool.h
@@ -0,0 +1,93 @@
1/*
2 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 * $Id: ib_fmr_pool.h 2730 2005-06-28 16:43:03Z sean.hefty $
34 */
35
36#if !defined(IB_FMR_POOL_H)
37#define IB_FMR_POOL_H
38
39#include <rdma/ib_verbs.h>
40
41struct ib_fmr_pool;
42
43/**
44 * struct ib_fmr_pool_param - Parameters for creating FMR pool
45 * @max_pages_per_fmr:Maximum number of pages per map request.
46 * @access:Access flags for FMRs in pool.
47 * @pool_size:Number of FMRs to allocate for pool.
48 * @dirty_watermark:Flush is triggered when @dirty_watermark dirty
49 * FMRs are present.
50 * @flush_function:Callback called when unmapped FMRs are flushed and
51 * more FMRs are possibly available for mapping
52 * @flush_arg:Context passed to user's flush function.
53 * @cache:If set, FMRs may be reused after unmapping for identical map
54 * requests.
55 */
56struct ib_fmr_pool_param {
57 int max_pages_per_fmr;
58 enum ib_access_flags access;
59 int pool_size;
60 int dirty_watermark;
61 void (*flush_function)(struct ib_fmr_pool *pool,
62 void * arg);
63 void *flush_arg;
64 unsigned cache:1;
65};
66
67struct ib_pool_fmr {
68 struct ib_fmr *fmr;
69 struct ib_fmr_pool *pool;
70 struct list_head list;
71 struct hlist_node cache_node;
72 int ref_count;
73 int remap_count;
74 u64 io_virtual_address;
75 int page_list_len;
76 u64 page_list[0];
77};
78
79struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
80 struct ib_fmr_pool_param *params);
81
82void ib_destroy_fmr_pool(struct ib_fmr_pool *pool);
83
84int ib_flush_fmr_pool(struct ib_fmr_pool *pool);
85
86struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
87 u64 *page_list,
88 int list_len,
89 u64 *io_virtual_address);
90
91int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);
92
93#endif /* IB_FMR_POOL_H */
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
new file mode 100644
index 000000000000..fc6b1c18ffc6
--- /dev/null
+++ b/include/rdma/ib_mad.h
@@ -0,0 +1,579 @@
1/*
2 * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
3 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
4 * Copyright (c) 2004 Intel Corporation. All rights reserved.
5 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
6 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
7 *
8 * This software is available to you under a choice of one of two
9 * licenses. You may choose to be licensed under the terms of the GNU
10 * General Public License (GPL) Version 2, available from the file
11 * COPYING in the main directory of this source tree, or the
12 * OpenIB.org BSD license below:
13 *
14 * Redistribution and use in source and binary forms, with or
15 * without modification, are permitted provided that the following
16 * conditions are met:
17 *
18 * - Redistributions of source code must retain the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer.
21 *
22 * - Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials
25 * provided with the distribution.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE.
35 *
36 * $Id: ib_mad.h 2775 2005-07-02 13:42:12Z halr $
37 */
38
39#if !defined( IB_MAD_H )
40#define IB_MAD_H
41
42#include <linux/pci.h>
43
44#include <rdma/ib_verbs.h>
45
46/* Management base version */
47#define IB_MGMT_BASE_VERSION 1
48
49/* Management classes */
50#define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01
51#define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81
52#define IB_MGMT_CLASS_SUBN_ADM 0x03
53#define IB_MGMT_CLASS_PERF_MGMT 0x04
54#define IB_MGMT_CLASS_BM 0x05
55#define IB_MGMT_CLASS_DEVICE_MGMT 0x06
56#define IB_MGMT_CLASS_CM 0x07
57#define IB_MGMT_CLASS_SNMP 0x08
58#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
59#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
60
61#define IB_OPENIB_OUI (0x001405)
62
63/* Management methods */
64#define IB_MGMT_METHOD_GET 0x01
65#define IB_MGMT_METHOD_SET 0x02
66#define IB_MGMT_METHOD_GET_RESP 0x81
67#define IB_MGMT_METHOD_SEND 0x03
68#define IB_MGMT_METHOD_TRAP 0x05
69#define IB_MGMT_METHOD_REPORT 0x06
70#define IB_MGMT_METHOD_REPORT_RESP 0x86
71#define IB_MGMT_METHOD_TRAP_REPRESS 0x07
72
73#define IB_MGMT_METHOD_RESP 0x80
74
75#define IB_MGMT_MAX_METHODS 128
76
77/* RMPP information */
78#define IB_MGMT_RMPP_VERSION 1
79
80#define IB_MGMT_RMPP_TYPE_DATA 1
81#define IB_MGMT_RMPP_TYPE_ACK 2
82#define IB_MGMT_RMPP_TYPE_STOP 3
83#define IB_MGMT_RMPP_TYPE_ABORT 4
84
85#define IB_MGMT_RMPP_FLAG_ACTIVE 1
86#define IB_MGMT_RMPP_FLAG_FIRST (1<<1)
87#define IB_MGMT_RMPP_FLAG_LAST (1<<2)
88
89#define IB_MGMT_RMPP_NO_RESPTIME 0x1F
90
91#define IB_MGMT_RMPP_STATUS_SUCCESS 0
92#define IB_MGMT_RMPP_STATUS_RESX 1
93#define IB_MGMT_RMPP_STATUS_ABORT_MIN 118
94#define IB_MGMT_RMPP_STATUS_T2L 118
95#define IB_MGMT_RMPP_STATUS_BAD_LEN 119
96#define IB_MGMT_RMPP_STATUS_BAD_SEG 120
97#define IB_MGMT_RMPP_STATUS_BADT 121
98#define IB_MGMT_RMPP_STATUS_W2S 122
99#define IB_MGMT_RMPP_STATUS_S2B 123
100#define IB_MGMT_RMPP_STATUS_BAD_STATUS 124
101#define IB_MGMT_RMPP_STATUS_UNV 125
102#define IB_MGMT_RMPP_STATUS_TMR 126
103#define IB_MGMT_RMPP_STATUS_UNSPEC 127
104#define IB_MGMT_RMPP_STATUS_ABORT_MAX 127
105
106#define IB_QP0 0
107#define IB_QP1 __constant_htonl(1)
108#define IB_QP1_QKEY 0x80010000
109#define IB_QP_SET_QKEY 0x80000000
110
111struct ib_mad_hdr {
112 u8 base_version;
113 u8 mgmt_class;
114 u8 class_version;
115 u8 method;
116 __be16 status;
117 __be16 class_specific;
118 __be64 tid;
119 __be16 attr_id;
120 __be16 resv;
121 __be32 attr_mod;
122};
123
124struct ib_rmpp_hdr {
125 u8 rmpp_version;
126 u8 rmpp_type;
127 u8 rmpp_rtime_flags;
128 u8 rmpp_status;
129 __be32 seg_num;
130 __be32 paylen_newwin;
131};
132
133typedef u64 __bitwise ib_sa_comp_mask;
134
135#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n))
136
137/*
138 * ib_sa_hdr and ib_sa_mad structures must be packed because they have
139 * 64-bit fields that are only 32-bit aligned. 64-bit architectures will
140 * lay them out wrong otherwise. (And unfortunately they are sent on
141 * the wire so we can't change the layout)
142 */
143struct ib_sa_hdr {
144 __be64 sm_key;
145 __be16 attr_offset;
146 __be16 reserved;
147 ib_sa_comp_mask comp_mask;
148} __attribute__ ((packed));
149
150struct ib_mad {
151 struct ib_mad_hdr mad_hdr;
152 u8 data[232];
153};
154
155struct ib_rmpp_mad {
156 struct ib_mad_hdr mad_hdr;
157 struct ib_rmpp_hdr rmpp_hdr;
158 u8 data[220];
159};
160
161struct ib_sa_mad {
162 struct ib_mad_hdr mad_hdr;
163 struct ib_rmpp_hdr rmpp_hdr;
164 struct ib_sa_hdr sa_hdr;
165 u8 data[200];
166} __attribute__ ((packed));
167
168struct ib_vendor_mad {
169 struct ib_mad_hdr mad_hdr;
170 struct ib_rmpp_hdr rmpp_hdr;
171 u8 reserved;
172 u8 oui[3];
173 u8 data[216];
174};
175
176/**
177 * ib_mad_send_buf - MAD data buffer and work request for sends.
178 * @mad: References an allocated MAD data buffer. The size of the data
179 * buffer is specified in the @send_wr.length field.
180 * @mapping: DMA mapping information.
181 * @mad_agent: MAD agent that allocated the buffer.
182 * @context: User-controlled context fields.
183 * @send_wr: An initialized work request structure used when sending the MAD.
184 * The wr_id field of the work request is initialized to reference this
185 * data structure.
186 * @sge: A scatter-gather list referenced by the work request.
187 *
188 * Users are responsible for initializing the MAD buffer itself, with the
189 * exception of specifying the payload length field in any RMPP MAD.
190 */
191struct ib_mad_send_buf {
192 struct ib_mad *mad;
193 DECLARE_PCI_UNMAP_ADDR(mapping)
194 struct ib_mad_agent *mad_agent;
195 void *context[2];
196 struct ib_send_wr send_wr;
197 struct ib_sge sge;
198};
199
200/**
201 * ib_get_rmpp_resptime - Returns the RMPP response time.
202 * @rmpp_hdr: An RMPP header.
203 */
204static inline u8 ib_get_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr)
205{
206 return rmpp_hdr->rmpp_rtime_flags >> 3;
207}
208
209/**
210 * ib_get_rmpp_flags - Returns the RMPP flags.
211 * @rmpp_hdr: An RMPP header.
212 */
213static inline u8 ib_get_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr)
214{
215 return rmpp_hdr->rmpp_rtime_flags & 0x7;
216}
217
218/**
219 * ib_set_rmpp_resptime - Sets the response time in an RMPP header.
220 * @rmpp_hdr: An RMPP header.
221 * @rtime: The response time to set.
222 */
223static inline void ib_set_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr, u8 rtime)
224{
225 rmpp_hdr->rmpp_rtime_flags = ib_get_rmpp_flags(rmpp_hdr) | (rtime << 3);
226}
227
228/**
229 * ib_set_rmpp_flags - Sets the flags in an RMPP header.
230 * @rmpp_hdr: An RMPP header.
231 * @flags: The flags to set.
232 */
233static inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags)
234{
235 rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF1) |
236 (flags & 0x7);
237}
238
239struct ib_mad_agent;
240struct ib_mad_send_wc;
241struct ib_mad_recv_wc;
242
243/**
244 * ib_mad_send_handler - callback handler for a sent MAD.
245 * @mad_agent: MAD agent that sent the MAD.
246 * @mad_send_wc: Send work completion information on the sent MAD.
247 */
248typedef void (*ib_mad_send_handler)(struct ib_mad_agent *mad_agent,
249 struct ib_mad_send_wc *mad_send_wc);
250
251/**
252 * ib_mad_snoop_handler - Callback handler for snooping sent MADs.
253 * @mad_agent: MAD agent that snooped the MAD.
254 * @send_wr: Work request information on the sent MAD.
255 * @mad_send_wc: Work completion information on the sent MAD. Valid
256 * only for snooping that occurs on a send completion.
257 *
258 * Clients snooping MADs should not modify data referenced by the @send_wr
259 * or @mad_send_wc.
260 */
261typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent,
262 struct ib_send_wr *send_wr,
263 struct ib_mad_send_wc *mad_send_wc);
264
265/**
266 * ib_mad_recv_handler - callback handler for a received MAD.
267 * @mad_agent: MAD agent requesting the received MAD.
268 * @mad_recv_wc: Received work completion information on the received MAD.
269 *
270 * MADs received in response to a send request operation will be handed to
271 * the user after the send operation completes. All data buffers given
272 * to registered agents through this routine are owned by the receiving
273 * client, except for snooping agents. Clients snooping MADs should not
274 * modify the data referenced by @mad_recv_wc.
275 */
276typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
277 struct ib_mad_recv_wc *mad_recv_wc);
278
279/**
280 * ib_mad_agent - Used to track MAD registration with the access layer.
281 * @device: Reference to device registration is on.
282 * @qp: Reference to QP used for sending and receiving MADs.
283 * @mr: Memory region for system memory usable for DMA.
284 * @recv_handler: Callback handler for a received MAD.
285 * @send_handler: Callback handler for a sent MAD.
286 * @snoop_handler: Callback handler for snooped sent MADs.
287 * @context: User-specified context associated with this registration.
288 * @hi_tid: Access layer assigned transaction ID for this client.
289 * Unsolicited MADs sent by this client will have the upper 32-bits
290 * of their TID set to this value.
291 * @port_num: Port number on which QP is registered
292 * @rmpp_version: If set, indicates the RMPP version used by this agent.
293 */
294struct ib_mad_agent {
295 struct ib_device *device;
296 struct ib_qp *qp;
297 struct ib_mr *mr;
298 ib_mad_recv_handler recv_handler;
299 ib_mad_send_handler send_handler;
300 ib_mad_snoop_handler snoop_handler;
301 void *context;
302 u32 hi_tid;
303 u8 port_num;
304 u8 rmpp_version;
305};
306
307/**
308 * ib_mad_send_wc - MAD send completion information.
309 * @wr_id: Work request identifier associated with the send MAD request.
310 * @status: Completion status.
311 * @vendor_err: Optional vendor error information returned with a failed
312 * request.
313 */
314struct ib_mad_send_wc {
315 u64 wr_id;
316 enum ib_wc_status status;
317 u32 vendor_err;
318};
319
320/**
321 * ib_mad_recv_buf - received MAD buffer information.
322 * @list: Reference to next data buffer for a received RMPP MAD.
323 * @grh: References a data buffer containing the global route header.
324 * The data refereced by this buffer is only valid if the GRH is
325 * valid.
326 * @mad: References the start of the received MAD.
327 */
328struct ib_mad_recv_buf {
329 struct list_head list;
330 struct ib_grh *grh;
331 struct ib_mad *mad;
332};
333
334/**
335 * ib_mad_recv_wc - received MAD information.
336 * @wc: Completion information for the received data.
337 * @recv_buf: Specifies the location of the received data buffer(s).
338 * @rmpp_list: Specifies a list of RMPP reassembled received MAD buffers.
339 * @mad_len: The length of the received MAD, without duplicated headers.
340 *
341 * For received response, the wr_id field of the wc is set to the wr_id
342 * for the corresponding send request.
343 */
344struct ib_mad_recv_wc {
345 struct ib_wc *wc;
346 struct ib_mad_recv_buf recv_buf;
347 struct list_head rmpp_list;
348 int mad_len;
349};
350
351/**
352 * ib_mad_reg_req - MAD registration request
353 * @mgmt_class: Indicates which management class of MADs should be receive
354 * by the caller. This field is only required if the user wishes to
355 * receive unsolicited MADs, otherwise it should be 0.
356 * @mgmt_class_version: Indicates which version of MADs for the given
357 * management class to receive.
358 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
359 * in the range from 0x30 to 0x4f. Otherwise not used.
360 * @method_mask: The caller will receive unsolicited MADs for any method
361 * where @method_mask = 1.
362 */
363struct ib_mad_reg_req {
364 u8 mgmt_class;
365 u8 mgmt_class_version;
366 u8 oui[3];
367 DECLARE_BITMAP(method_mask, IB_MGMT_MAX_METHODS);
368};
369
370/**
371 * ib_register_mad_agent - Register to send/receive MADs.
372 * @device: The device to register with.
373 * @port_num: The port on the specified device to use.
374 * @qp_type: Specifies which QP to access. Must be either
375 * IB_QPT_SMI or IB_QPT_GSI.
376 * @mad_reg_req: Specifies which unsolicited MADs should be received
377 * by the caller. This parameter may be NULL if the caller only
378 * wishes to receive solicited responses.
379 * @rmpp_version: If set, indicates that the client will send
380 * and receive MADs that contain the RMPP header for the given version.
381 * If set to 0, indicates that RMPP is not used by this client.
382 * @send_handler: The completion callback routine invoked after a send
383 * request has completed.
384 * @recv_handler: The completion callback routine invoked for a received
385 * MAD.
386 * @context: User specified context associated with the registration.
387 */
388struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
389 u8 port_num,
390 enum ib_qp_type qp_type,
391 struct ib_mad_reg_req *mad_reg_req,
392 u8 rmpp_version,
393 ib_mad_send_handler send_handler,
394 ib_mad_recv_handler recv_handler,
395 void *context);
396
397enum ib_mad_snoop_flags {
398 /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/
399 /*IB_MAD_SNOOP_RMPP_SENDS = (1<<1),*/
400 IB_MAD_SNOOP_SEND_COMPLETIONS = (1<<2),
401 /*IB_MAD_SNOOP_RMPP_SEND_COMPLETIONS = (1<<3),*/
402 IB_MAD_SNOOP_RECVS = (1<<4)
403 /*IB_MAD_SNOOP_RMPP_RECVS = (1<<5),*/
404 /*IB_MAD_SNOOP_REDIRECTED_QPS = (1<<6)*/
405};
406
407/**
408 * ib_register_mad_snoop - Register to snoop sent and received MADs.
409 * @device: The device to register with.
410 * @port_num: The port on the specified device to use.
411 * @qp_type: Specifies which QP traffic to snoop. Must be either
412 * IB_QPT_SMI or IB_QPT_GSI.
413 * @mad_snoop_flags: Specifies information where snooping occurs.
414 * @send_handler: The callback routine invoked for a snooped send.
415 * @recv_handler: The callback routine invoked for a snooped receive.
416 * @context: User specified context associated with the registration.
417 */
418struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device,
419 u8 port_num,
420 enum ib_qp_type qp_type,
421 int mad_snoop_flags,
422 ib_mad_snoop_handler snoop_handler,
423 ib_mad_recv_handler recv_handler,
424 void *context);
425
426/**
427 * ib_unregister_mad_agent - Unregisters a client from using MAD services.
428 * @mad_agent: Corresponding MAD registration request to deregister.
429 *
430 * After invoking this routine, MAD services are no longer usable by the
431 * client on the associated QP.
432 */
433int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent);
434
435/**
436 * ib_post_send_mad - Posts MAD(s) to the send queue of the QP associated
437 * with the registered client.
438 * @mad_agent: Specifies the associated registration to post the send to.
439 * @send_wr: Specifies the information needed to send the MAD(s).
440 * @bad_send_wr: Specifies the MAD on which an error was encountered.
441 *
442 * Sent MADs are not guaranteed to complete in the order that they were posted.
443 *
444 * If the MAD requires RMPP, the data buffer should contain a single copy
445 * of the common MAD, RMPP, and class specific headers, followed by the class
446 * defined data. If the class defined data would not divide evenly into
447 * RMPP segments, then space must be allocated at the end of the referenced
448 * buffer for any required padding. To indicate the amount of class defined
449 * data being transferred, the paylen_newwin field in the RMPP header should
450 * be set to the size of the class specific header plus the amount of class
451 * defined data being transferred. The paylen_newwin field should be
452 * specified in network-byte order.
453 */
454int ib_post_send_mad(struct ib_mad_agent *mad_agent,
455 struct ib_send_wr *send_wr,
456 struct ib_send_wr **bad_send_wr);
457
458/**
459 * ib_coalesce_recv_mad - Coalesces received MAD data into a single buffer.
460 * @mad_recv_wc: Work completion information for a received MAD.
461 * @buf: User-provided data buffer to receive the coalesced buffers. The
462 * referenced buffer should be at least the size of the mad_len specified
463 * by @mad_recv_wc.
464 *
465 * This call copies a chain of received MAD segments into a single data buffer,
466 * removing duplicated headers.
467 */
468void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, void *buf);
469
470/**
471 * ib_free_recv_mad - Returns data buffers used to receive a MAD.
472 * @mad_recv_wc: Work completion information for a received MAD.
473 *
474 * Clients receiving MADs through their ib_mad_recv_handler must call this
475 * routine to return the work completion buffers to the access layer.
476 */
477void ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc);
478
479/**
480 * ib_cancel_mad - Cancels an outstanding send MAD operation.
481 * @mad_agent: Specifies the registration associated with sent MAD.
482 * @wr_id: Indicates the work request identifier of the MAD to cancel.
483 *
484 * MADs will be returned to the user through the corresponding
485 * ib_mad_send_handler.
486 */
487void ib_cancel_mad(struct ib_mad_agent *mad_agent, u64 wr_id);
488
489/**
490 * ib_modify_mad - Modifies an outstanding send MAD operation.
491 * @mad_agent: Specifies the registration associated with sent MAD.
492 * @wr_id: Indicates the work request identifier of the MAD to modify.
493 * @timeout_ms: New timeout value for sent MAD.
494 *
495 * This call will reset the timeout value for a sent MAD to the specified
496 * value.
497 */
498int ib_modify_mad(struct ib_mad_agent *mad_agent, u64 wr_id, u32 timeout_ms);
499
500/**
501 * ib_redirect_mad_qp - Registers a QP for MAD services.
502 * @qp: Reference to a QP that requires MAD services.
503 * @rmpp_version: If set, indicates that the client will send
504 * and receive MADs that contain the RMPP header for the given version.
505 * If set to 0, indicates that RMPP is not used by this client.
506 * @send_handler: The completion callback routine invoked after a send
507 * request has completed.
508 * @recv_handler: The completion callback routine invoked for a received
509 * MAD.
510 * @context: User specified context associated with the registration.
511 *
512 * Use of this call allows clients to use MAD services, such as RMPP,
513 * on user-owned QPs. After calling this routine, users may send
514 * MADs on the specified QP by calling ib_mad_post_send.
515 */
516struct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp,
517 u8 rmpp_version,
518 ib_mad_send_handler send_handler,
519 ib_mad_recv_handler recv_handler,
520 void *context);
521
522/**
523 * ib_process_mad_wc - Processes a work completion associated with a
524 * MAD sent or received on a redirected QP.
525 * @mad_agent: Specifies the registered MAD service using the redirected QP.
526 * @wc: References a work completion associated with a sent or received
527 * MAD segment.
528 *
529 * This routine is used to complete or continue processing on a MAD request.
530 * If the work completion is associated with a send operation, calling
531 * this routine is required to continue an RMPP transfer or to wait for a
532 * corresponding response, if it is a request. If the work completion is
533 * associated with a receive operation, calling this routine is required to
534 * process an inbound or outbound RMPP transfer, or to match a response MAD
535 * with its corresponding request.
536 */
537int ib_process_mad_wc(struct ib_mad_agent *mad_agent,
538 struct ib_wc *wc);
539
540/**
541 * ib_create_send_mad - Allocate and initialize a data buffer and work request
542 * for sending a MAD.
543 * @mad_agent: Specifies the registered MAD service to associate with the MAD.
544 * @remote_qpn: Specifies the QPN of the receiving node.
545 * @pkey_index: Specifies which PKey the MAD will be sent using. This field
546 * is valid only if the remote_qpn is QP 1.
547 * @ah: References the address handle used to transfer to the remote node.
548 * @rmpp_active: Indicates if the send will enable RMPP.
549 * @hdr_len: Indicates the size of the data header of the MAD. This length
550 * should include the common MAD header, RMPP header, plus any class
551 * specific header.
552 * @data_len: Indicates the size of any user-transferred data. The call will
553 * automatically adjust the allocated buffer size to account for any
554 * additional padding that may be necessary.
555 * @gfp_mask: GFP mask used for the memory allocation.
556 *
557 * This is a helper routine that may be used to allocate a MAD. Users are
558 * not required to allocate outbound MADs using this call. The returned
559 * MAD send buffer will reference a data buffer usable for sending a MAD, along
560 * with an initialized work request structure. Users may modify the returned
561 * MAD data buffer or work request before posting the send.
562 *
563 * The returned data buffer will be cleared. Users are responsible for
564 * initializing the common MAD and any class specific headers. If @rmpp_active
565 * is set, the RMPP header will be initialized for sending.
566 */
567struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
568 u32 remote_qpn, u16 pkey_index,
569 struct ib_ah *ah, int rmpp_active,
570 int hdr_len, int data_len,
571 unsigned int __nocast gfp_mask);
572
573/**
574 * ib_free_send_mad - Returns data buffers used to send a MAD.
575 * @send_buf: Previously allocated send data buffer.
576 */
577void ib_free_send_mad(struct ib_mad_send_buf *send_buf);
578
579#endif /* IB_MAD_H */
diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h
new file mode 100644
index 000000000000..f926020d6331
--- /dev/null
+++ b/include/rdma/ib_pack.h
@@ -0,0 +1,245 @@
1/*
2 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id: ib_pack.h 1349 2004-12-16 21:09:43Z roland $
33 */
34
35#ifndef IB_PACK_H
36#define IB_PACK_H
37
38#include <rdma/ib_verbs.h>
39
40enum {
41 IB_LRH_BYTES = 8,
42 IB_GRH_BYTES = 40,
43 IB_BTH_BYTES = 12,
44 IB_DETH_BYTES = 8
45};
46
47struct ib_field {
48 size_t struct_offset_bytes;
49 size_t struct_size_bytes;
50 int offset_words;
51 int offset_bits;
52 int size_bits;
53 char *field_name;
54};
55
56#define RESERVED \
57 .field_name = "reserved"
58
59/*
60 * This macro cleans up the definitions of constants for BTH opcodes.
61 * It is used to define constants such as IB_OPCODE_UD_SEND_ONLY,
62 * which becomes IB_OPCODE_UD + IB_OPCODE_SEND_ONLY, and this gives
63 * the correct value.
64 *
65 * In short, user code should use the constants defined using the
66 * macro rather than worrying about adding together other constants.
67*/
68#define IB_OPCODE(transport, op) \
69 IB_OPCODE_ ## transport ## _ ## op = \
70 IB_OPCODE_ ## transport + IB_OPCODE_ ## op
71
72enum {
73 /* transport types -- just used to define real constants */
74 IB_OPCODE_RC = 0x00,
75 IB_OPCODE_UC = 0x20,
76 IB_OPCODE_RD = 0x40,
77 IB_OPCODE_UD = 0x60,
78
79 /* operations -- just used to define real constants */
80 IB_OPCODE_SEND_FIRST = 0x00,
81 IB_OPCODE_SEND_MIDDLE = 0x01,
82 IB_OPCODE_SEND_LAST = 0x02,
83 IB_OPCODE_SEND_LAST_WITH_IMMEDIATE = 0x03,
84 IB_OPCODE_SEND_ONLY = 0x04,
85 IB_OPCODE_SEND_ONLY_WITH_IMMEDIATE = 0x05,
86 IB_OPCODE_RDMA_WRITE_FIRST = 0x06,
87 IB_OPCODE_RDMA_WRITE_MIDDLE = 0x07,
88 IB_OPCODE_RDMA_WRITE_LAST = 0x08,
89 IB_OPCODE_RDMA_WRITE_LAST_WITH_IMMEDIATE = 0x09,
90 IB_OPCODE_RDMA_WRITE_ONLY = 0x0a,
91 IB_OPCODE_RDMA_WRITE_ONLY_WITH_IMMEDIATE = 0x0b,
92 IB_OPCODE_RDMA_READ_REQUEST = 0x0c,
93 IB_OPCODE_RDMA_READ_RESPONSE_FIRST = 0x0d,
94 IB_OPCODE_RDMA_READ_RESPONSE_MIDDLE = 0x0e,
95 IB_OPCODE_RDMA_READ_RESPONSE_LAST = 0x0f,
96 IB_OPCODE_RDMA_READ_RESPONSE_ONLY = 0x10,
97 IB_OPCODE_ACKNOWLEDGE = 0x11,
98 IB_OPCODE_ATOMIC_ACKNOWLEDGE = 0x12,
99 IB_OPCODE_COMPARE_SWAP = 0x13,
100 IB_OPCODE_FETCH_ADD = 0x14,
101
102 /* real constants follow -- see comment about above IB_OPCODE()
103 macro for more details */
104
105 /* RC */
106 IB_OPCODE(RC, SEND_FIRST),
107 IB_OPCODE(RC, SEND_MIDDLE),
108 IB_OPCODE(RC, SEND_LAST),
109 IB_OPCODE(RC, SEND_LAST_WITH_IMMEDIATE),
110 IB_OPCODE(RC, SEND_ONLY),
111 IB_OPCODE(RC, SEND_ONLY_WITH_IMMEDIATE),
112 IB_OPCODE(RC, RDMA_WRITE_FIRST),
113 IB_OPCODE(RC, RDMA_WRITE_MIDDLE),
114 IB_OPCODE(RC, RDMA_WRITE_LAST),
115 IB_OPCODE(RC, RDMA_WRITE_LAST_WITH_IMMEDIATE),
116 IB_OPCODE(RC, RDMA_WRITE_ONLY),
117 IB_OPCODE(RC, RDMA_WRITE_ONLY_WITH_IMMEDIATE),
118 IB_OPCODE(RC, RDMA_READ_REQUEST),
119 IB_OPCODE(RC, RDMA_READ_RESPONSE_FIRST),
120 IB_OPCODE(RC, RDMA_READ_RESPONSE_MIDDLE),
121 IB_OPCODE(RC, RDMA_READ_RESPONSE_LAST),
122 IB_OPCODE(RC, RDMA_READ_RESPONSE_ONLY),
123 IB_OPCODE(RC, ACKNOWLEDGE),
124 IB_OPCODE(RC, ATOMIC_ACKNOWLEDGE),
125 IB_OPCODE(RC, COMPARE_SWAP),
126 IB_OPCODE(RC, FETCH_ADD),
127
128 /* UC */
129 IB_OPCODE(UC, SEND_FIRST),
130 IB_OPCODE(UC, SEND_MIDDLE),
131 IB_OPCODE(UC, SEND_LAST),
132 IB_OPCODE(UC, SEND_LAST_WITH_IMMEDIATE),
133 IB_OPCODE(UC, SEND_ONLY),
134 IB_OPCODE(UC, SEND_ONLY_WITH_IMMEDIATE),
135 IB_OPCODE(UC, RDMA_WRITE_FIRST),
136 IB_OPCODE(UC, RDMA_WRITE_MIDDLE),
137 IB_OPCODE(UC, RDMA_WRITE_LAST),
138 IB_OPCODE(UC, RDMA_WRITE_LAST_WITH_IMMEDIATE),
139 IB_OPCODE(UC, RDMA_WRITE_ONLY),
140 IB_OPCODE(UC, RDMA_WRITE_ONLY_WITH_IMMEDIATE),
141
142 /* RD */
143 IB_OPCODE(RD, SEND_FIRST),
144 IB_OPCODE(RD, SEND_MIDDLE),
145 IB_OPCODE(RD, SEND_LAST),
146 IB_OPCODE(RD, SEND_LAST_WITH_IMMEDIATE),
147 IB_OPCODE(RD, SEND_ONLY),
148 IB_OPCODE(RD, SEND_ONLY_WITH_IMMEDIATE),
149 IB_OPCODE(RD, RDMA_WRITE_FIRST),
150 IB_OPCODE(RD, RDMA_WRITE_MIDDLE),
151 IB_OPCODE(RD, RDMA_WRITE_LAST),
152 IB_OPCODE(RD, RDMA_WRITE_LAST_WITH_IMMEDIATE),
153 IB_OPCODE(RD, RDMA_WRITE_ONLY),
154 IB_OPCODE(RD, RDMA_WRITE_ONLY_WITH_IMMEDIATE),
155 IB_OPCODE(RD, RDMA_READ_REQUEST),
156 IB_OPCODE(RD, RDMA_READ_RESPONSE_FIRST),
157 IB_OPCODE(RD, RDMA_READ_RESPONSE_MIDDLE),
158 IB_OPCODE(RD, RDMA_READ_RESPONSE_LAST),
159 IB_OPCODE(RD, RDMA_READ_RESPONSE_ONLY),
160 IB_OPCODE(RD, ACKNOWLEDGE),
161 IB_OPCODE(RD, ATOMIC_ACKNOWLEDGE),
162 IB_OPCODE(RD, COMPARE_SWAP),
163 IB_OPCODE(RD, FETCH_ADD),
164
165 /* UD */
166 IB_OPCODE(UD, SEND_ONLY),
167 IB_OPCODE(UD, SEND_ONLY_WITH_IMMEDIATE)
168};
169
170enum {
171 IB_LNH_RAW = 0,
172 IB_LNH_IP = 1,
173 IB_LNH_IBA_LOCAL = 2,
174 IB_LNH_IBA_GLOBAL = 3
175};
176
177struct ib_unpacked_lrh {
178 u8 virtual_lane;
179 u8 link_version;
180 u8 service_level;
181 u8 link_next_header;
182 __be16 destination_lid;
183 __be16 packet_length;
184 __be16 source_lid;
185};
186
187struct ib_unpacked_grh {
188 u8 ip_version;
189 u8 traffic_class;
190 __be32 flow_label;
191 __be16 payload_length;
192 u8 next_header;
193 u8 hop_limit;
194 union ib_gid source_gid;
195 union ib_gid destination_gid;
196};
197
198struct ib_unpacked_bth {
199 u8 opcode;
200 u8 solicited_event;
201 u8 mig_req;
202 u8 pad_count;
203 u8 transport_header_version;
204 __be16 pkey;
205 __be32 destination_qpn;
206 u8 ack_req;
207 __be32 psn;
208};
209
210struct ib_unpacked_deth {
211 __be32 qkey;
212 __be32 source_qpn;
213};
214
215struct ib_ud_header {
216 struct ib_unpacked_lrh lrh;
217 int grh_present;
218 struct ib_unpacked_grh grh;
219 struct ib_unpacked_bth bth;
220 struct ib_unpacked_deth deth;
221 int immediate_present;
222 __be32 immediate_data;
223};
224
225void ib_pack(const struct ib_field *desc,
226 int desc_len,
227 void *structure,
228 void *buf);
229
230void ib_unpack(const struct ib_field *desc,
231 int desc_len,
232 void *buf,
233 void *structure);
234
235void ib_ud_header_init(int payload_bytes,
236 int grh_present,
237 struct ib_ud_header *header);
238
239int ib_ud_header_pack(struct ib_ud_header *header,
240 void *buf);
241
242int ib_ud_header_unpack(void *buf,
243 struct ib_ud_header *header);
244
245#endif /* IB_PACK_H */
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
new file mode 100644
index 000000000000..c022edfc49da
--- /dev/null
+++ b/include/rdma/ib_sa.h
@@ -0,0 +1,373 @@
1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 * $Id: ib_sa.h 2811 2005-07-06 18:11:43Z halr $
34 */
35
36#ifndef IB_SA_H
37#define IB_SA_H
38
39#include <linux/compiler.h>
40
41#include <rdma/ib_verbs.h>
42#include <rdma/ib_mad.h>
43
44enum {
45 IB_SA_CLASS_VERSION = 2, /* IB spec version 1.1/1.2 */
46
47 IB_SA_METHOD_GET_TABLE = 0x12,
48 IB_SA_METHOD_GET_TABLE_RESP = 0x92,
49 IB_SA_METHOD_DELETE = 0x15
50};
51
52enum ib_sa_selector {
53 IB_SA_GTE = 0,
54 IB_SA_LTE = 1,
55 IB_SA_EQ = 2,
56 /*
57 * The meaning of "best" depends on the attribute: for
58 * example, for MTU best will return the largest available
59 * MTU, while for packet life time, best will return the
60 * smallest available life time.
61 */
62 IB_SA_BEST = 3
63};
64
65enum ib_sa_rate {
66 IB_SA_RATE_2_5_GBPS = 2,
67 IB_SA_RATE_5_GBPS = 5,
68 IB_SA_RATE_10_GBPS = 3,
69 IB_SA_RATE_20_GBPS = 6,
70 IB_SA_RATE_30_GBPS = 4,
71 IB_SA_RATE_40_GBPS = 7,
72 IB_SA_RATE_60_GBPS = 8,
73 IB_SA_RATE_80_GBPS = 9,
74 IB_SA_RATE_120_GBPS = 10
75};
76
77static inline int ib_sa_rate_enum_to_int(enum ib_sa_rate rate)
78{
79 switch (rate) {
80 case IB_SA_RATE_2_5_GBPS: return 1;
81 case IB_SA_RATE_5_GBPS: return 2;
82 case IB_SA_RATE_10_GBPS: return 4;
83 case IB_SA_RATE_20_GBPS: return 8;
84 case IB_SA_RATE_30_GBPS: return 12;
85 case IB_SA_RATE_40_GBPS: return 16;
86 case IB_SA_RATE_60_GBPS: return 24;
87 case IB_SA_RATE_80_GBPS: return 32;
88 case IB_SA_RATE_120_GBPS: return 48;
89 default: return -1;
90 }
91}
92
93/*
94 * Structures for SA records are named "struct ib_sa_xxx_rec." No
95 * attempt is made to pack structures to match the physical layout of
96 * SA records in SA MADs; all packing and unpacking is handled by the
97 * SA query code.
98 *
99 * For a record with structure ib_sa_xxx_rec, the naming convention
100 * for the component mask value for field yyy is IB_SA_XXX_REC_YYY (we
101 * never use different abbreviations or otherwise change the spelling
102 * of xxx/yyy between ib_sa_xxx_rec.yyy and IB_SA_XXX_REC_YYY).
103 *
104 * Reserved rows are indicated with comments to help maintainability.
105 */
106
107/* reserved: 0 */
108/* reserved: 1 */
109#define IB_SA_PATH_REC_DGID IB_SA_COMP_MASK( 2)
110#define IB_SA_PATH_REC_SGID IB_SA_COMP_MASK( 3)
111#define IB_SA_PATH_REC_DLID IB_SA_COMP_MASK( 4)
112#define IB_SA_PATH_REC_SLID IB_SA_COMP_MASK( 5)
113#define IB_SA_PATH_REC_RAW_TRAFFIC IB_SA_COMP_MASK( 6)
114/* reserved: 7 */
115#define IB_SA_PATH_REC_FLOW_LABEL IB_SA_COMP_MASK( 8)
116#define IB_SA_PATH_REC_HOP_LIMIT IB_SA_COMP_MASK( 9)
117#define IB_SA_PATH_REC_TRAFFIC_CLASS IB_SA_COMP_MASK(10)
118#define IB_SA_PATH_REC_REVERSIBLE IB_SA_COMP_MASK(11)
119#define IB_SA_PATH_REC_NUMB_PATH IB_SA_COMP_MASK(12)
120#define IB_SA_PATH_REC_PKEY IB_SA_COMP_MASK(13)
121/* reserved: 14 */
122#define IB_SA_PATH_REC_SL IB_SA_COMP_MASK(15)
123#define IB_SA_PATH_REC_MTU_SELECTOR IB_SA_COMP_MASK(16)
124#define IB_SA_PATH_REC_MTU IB_SA_COMP_MASK(17)
125#define IB_SA_PATH_REC_RATE_SELECTOR IB_SA_COMP_MASK(18)
126#define IB_SA_PATH_REC_RATE IB_SA_COMP_MASK(19)
127#define IB_SA_PATH_REC_PACKET_LIFE_TIME_SELECTOR IB_SA_COMP_MASK(20)
128#define IB_SA_PATH_REC_PACKET_LIFE_TIME IB_SA_COMP_MASK(21)
129#define IB_SA_PATH_REC_PREFERENCE IB_SA_COMP_MASK(22)
130
131struct ib_sa_path_rec {
132 /* reserved */
133 /* reserved */
134 union ib_gid dgid;
135 union ib_gid sgid;
136 __be16 dlid;
137 __be16 slid;
138 int raw_traffic;
139 /* reserved */
140 __be32 flow_label;
141 u8 hop_limit;
142 u8 traffic_class;
143 int reversible;
144 u8 numb_path;
145 __be16 pkey;
146 /* reserved */
147 u8 sl;
148 u8 mtu_selector;
149 u8 mtu;
150 u8 rate_selector;
151 u8 rate;
152 u8 packet_life_time_selector;
153 u8 packet_life_time;
154 u8 preference;
155};
156
157#define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0)
158#define IB_SA_MCMEMBER_REC_PORT_GID IB_SA_COMP_MASK( 1)
159#define IB_SA_MCMEMBER_REC_QKEY IB_SA_COMP_MASK( 2)
160#define IB_SA_MCMEMBER_REC_MLID IB_SA_COMP_MASK( 3)
161#define IB_SA_MCMEMBER_REC_MTU_SELECTOR IB_SA_COMP_MASK( 4)
162#define IB_SA_MCMEMBER_REC_MTU IB_SA_COMP_MASK( 5)
163#define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS IB_SA_COMP_MASK( 6)
164#define IB_SA_MCMEMBER_REC_PKEY IB_SA_COMP_MASK( 7)
165#define IB_SA_MCMEMBER_REC_RATE_SELECTOR IB_SA_COMP_MASK( 8)
166#define IB_SA_MCMEMBER_REC_RATE IB_SA_COMP_MASK( 9)
167#define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME_SELECTOR IB_SA_COMP_MASK(10)
168#define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME IB_SA_COMP_MASK(11)
169#define IB_SA_MCMEMBER_REC_SL IB_SA_COMP_MASK(12)
170#define IB_SA_MCMEMBER_REC_FLOW_LABEL IB_SA_COMP_MASK(13)
171#define IB_SA_MCMEMBER_REC_HOP_LIMIT IB_SA_COMP_MASK(14)
172#define IB_SA_MCMEMBER_REC_SCOPE IB_SA_COMP_MASK(15)
173#define IB_SA_MCMEMBER_REC_JOIN_STATE IB_SA_COMP_MASK(16)
174#define IB_SA_MCMEMBER_REC_PROXY_JOIN IB_SA_COMP_MASK(17)
175
176struct ib_sa_mcmember_rec {
177 union ib_gid mgid;
178 union ib_gid port_gid;
179 __be32 qkey;
180 __be16 mlid;
181 u8 mtu_selector;
182 u8 mtu;
183 u8 traffic_class;
184 __be16 pkey;
185 u8 rate_selector;
186 u8 rate;
187 u8 packet_life_time_selector;
188 u8 packet_life_time;
189 u8 sl;
190 __be32 flow_label;
191 u8 hop_limit;
192 u8 scope;
193 u8 join_state;
194 int proxy_join;
195};
196
197/* Service Record Component Mask Sec 15.2.5.14 Ver 1.1 */
198#define IB_SA_SERVICE_REC_SERVICE_ID IB_SA_COMP_MASK( 0)
199#define IB_SA_SERVICE_REC_SERVICE_GID IB_SA_COMP_MASK( 1)
200#define IB_SA_SERVICE_REC_SERVICE_PKEY IB_SA_COMP_MASK( 2)
201/* reserved: 3 */
202#define IB_SA_SERVICE_REC_SERVICE_LEASE IB_SA_COMP_MASK( 4)
203#define IB_SA_SERVICE_REC_SERVICE_KEY IB_SA_COMP_MASK( 5)
204#define IB_SA_SERVICE_REC_SERVICE_NAME IB_SA_COMP_MASK( 6)
205#define IB_SA_SERVICE_REC_SERVICE_DATA8_0 IB_SA_COMP_MASK( 7)
206#define IB_SA_SERVICE_REC_SERVICE_DATA8_1 IB_SA_COMP_MASK( 8)
207#define IB_SA_SERVICE_REC_SERVICE_DATA8_2 IB_SA_COMP_MASK( 9)
208#define IB_SA_SERVICE_REC_SERVICE_DATA8_3 IB_SA_COMP_MASK(10)
209#define IB_SA_SERVICE_REC_SERVICE_DATA8_4 IB_SA_COMP_MASK(11)
210#define IB_SA_SERVICE_REC_SERVICE_DATA8_5 IB_SA_COMP_MASK(12)
211#define IB_SA_SERVICE_REC_SERVICE_DATA8_6 IB_SA_COMP_MASK(13)
212#define IB_SA_SERVICE_REC_SERVICE_DATA8_7 IB_SA_COMP_MASK(14)
213#define IB_SA_SERVICE_REC_SERVICE_DATA8_8 IB_SA_COMP_MASK(15)
214#define IB_SA_SERVICE_REC_SERVICE_DATA8_9 IB_SA_COMP_MASK(16)
215#define IB_SA_SERVICE_REC_SERVICE_DATA8_10 IB_SA_COMP_MASK(17)
216#define IB_SA_SERVICE_REC_SERVICE_DATA8_11 IB_SA_COMP_MASK(18)
217#define IB_SA_SERVICE_REC_SERVICE_DATA8_12 IB_SA_COMP_MASK(19)
218#define IB_SA_SERVICE_REC_SERVICE_DATA8_13 IB_SA_COMP_MASK(20)
219#define IB_SA_SERVICE_REC_SERVICE_DATA8_14 IB_SA_COMP_MASK(21)
220#define IB_SA_SERVICE_REC_SERVICE_DATA8_15 IB_SA_COMP_MASK(22)
221#define IB_SA_SERVICE_REC_SERVICE_DATA16_0 IB_SA_COMP_MASK(23)
222#define IB_SA_SERVICE_REC_SERVICE_DATA16_1 IB_SA_COMP_MASK(24)
223#define IB_SA_SERVICE_REC_SERVICE_DATA16_2 IB_SA_COMP_MASK(25)
224#define IB_SA_SERVICE_REC_SERVICE_DATA16_3 IB_SA_COMP_MASK(26)
225#define IB_SA_SERVICE_REC_SERVICE_DATA16_4 IB_SA_COMP_MASK(27)
226#define IB_SA_SERVICE_REC_SERVICE_DATA16_5 IB_SA_COMP_MASK(28)
227#define IB_SA_SERVICE_REC_SERVICE_DATA16_6 IB_SA_COMP_MASK(29)
228#define IB_SA_SERVICE_REC_SERVICE_DATA16_7 IB_SA_COMP_MASK(30)
229#define IB_SA_SERVICE_REC_SERVICE_DATA32_0 IB_SA_COMP_MASK(31)
230#define IB_SA_SERVICE_REC_SERVICE_DATA32_1 IB_SA_COMP_MASK(32)
231#define IB_SA_SERVICE_REC_SERVICE_DATA32_2 IB_SA_COMP_MASK(33)
232#define IB_SA_SERVICE_REC_SERVICE_DATA32_3 IB_SA_COMP_MASK(34)
233#define IB_SA_SERVICE_REC_SERVICE_DATA64_0 IB_SA_COMP_MASK(35)
234#define IB_SA_SERVICE_REC_SERVICE_DATA64_1 IB_SA_COMP_MASK(36)
235
236#define IB_DEFAULT_SERVICE_LEASE 0xFFFFFFFF
237
238struct ib_sa_service_rec {
239 u64 id;
240 union ib_gid gid;
241 __be16 pkey;
242 /* reserved */
243 u32 lease;
244 u8 key[16];
245 u8 name[64];
246 u8 data8[16];
247 u16 data16[8];
248 u32 data32[4];
249 u64 data64[2];
250};
251
252struct ib_sa_query;
253
254void ib_sa_cancel_query(int id, struct ib_sa_query *query);
255
256int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
257 struct ib_sa_path_rec *rec,
258 ib_sa_comp_mask comp_mask,
259 int timeout_ms, unsigned int __nocast gfp_mask,
260 void (*callback)(int status,
261 struct ib_sa_path_rec *resp,
262 void *context),
263 void *context,
264 struct ib_sa_query **query);
265
266int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
267 u8 method,
268 struct ib_sa_mcmember_rec *rec,
269 ib_sa_comp_mask comp_mask,
270 int timeout_ms, unsigned int __nocast gfp_mask,
271 void (*callback)(int status,
272 struct ib_sa_mcmember_rec *resp,
273 void *context),
274 void *context,
275 struct ib_sa_query **query);
276
277int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
278 u8 method,
279 struct ib_sa_service_rec *rec,
280 ib_sa_comp_mask comp_mask,
281 int timeout_ms, unsigned int __nocast gfp_mask,
282 void (*callback)(int status,
283 struct ib_sa_service_rec *resp,
284 void *context),
285 void *context,
286 struct ib_sa_query **sa_query);
287
288/**
289 * ib_sa_mcmember_rec_set - Start an MCMember set query
290 * @device:device to send query on
291 * @port_num: port number to send query on
292 * @rec:MCMember Record to send in query
293 * @comp_mask:component mask to send in query
294 * @timeout_ms:time to wait for response
295 * @gfp_mask:GFP mask to use for internal allocations
296 * @callback:function called when query completes, times out or is
297 * canceled
298 * @context:opaque user context passed to callback
299 * @sa_query:query context, used to cancel query
300 *
301 * Send an MCMember Set query to the SA (eg to join a multicast
302 * group). The callback function will be called when the query
303 * completes (or fails); status is 0 for a successful response, -EINTR
304 * if the query is canceled, -ETIMEDOUT is the query timed out, or
305 * -EIO if an error occurred sending the query. The resp parameter of
306 * the callback is only valid if status is 0.
307 *
308 * If the return value of ib_sa_mcmember_rec_set() is negative, it is
309 * an error code. Otherwise it is a query ID that can be used to
310 * cancel the query.
311 */
312static inline int
313ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
314 struct ib_sa_mcmember_rec *rec,
315 ib_sa_comp_mask comp_mask,
316 int timeout_ms, unsigned int __nocast gfp_mask,
317 void (*callback)(int status,
318 struct ib_sa_mcmember_rec *resp,
319 void *context),
320 void *context,
321 struct ib_sa_query **query)
322{
323 return ib_sa_mcmember_rec_query(device, port_num,
324 IB_MGMT_METHOD_SET,
325 rec, comp_mask,
326 timeout_ms, gfp_mask, callback,
327 context, query);
328}
329
330/**
331 * ib_sa_mcmember_rec_delete - Start an MCMember delete query
332 * @device:device to send query on
333 * @port_num: port number to send query on
334 * @rec:MCMember Record to send in query
335 * @comp_mask:component mask to send in query
336 * @timeout_ms:time to wait for response
337 * @gfp_mask:GFP mask to use for internal allocations
338 * @callback:function called when query completes, times out or is
339 * canceled
340 * @context:opaque user context passed to callback
341 * @sa_query:query context, used to cancel query
342 *
343 * Send an MCMember Delete query to the SA (eg to leave a multicast
344 * group). The callback function will be called when the query
345 * completes (or fails); status is 0 for a successful response, -EINTR
346 * if the query is canceled, -ETIMEDOUT is the query timed out, or
347 * -EIO if an error occurred sending the query. The resp parameter of
348 * the callback is only valid if status is 0.
349 *
350 * If the return value of ib_sa_mcmember_rec_delete() is negative, it
351 * is an error code. Otherwise it is a query ID that can be used to
352 * cancel the query.
353 */
354static inline int
355ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
356 struct ib_sa_mcmember_rec *rec,
357 ib_sa_comp_mask comp_mask,
358 int timeout_ms, unsigned int __nocast gfp_mask,
359 void (*callback)(int status,
360 struct ib_sa_mcmember_rec *resp,
361 void *context),
362 void *context,
363 struct ib_sa_query **query)
364{
365 return ib_sa_mcmember_rec_query(device, port_num,
366 IB_SA_METHOD_DELETE,
367 rec, comp_mask,
368 timeout_ms, gfp_mask, callback,
369 context, query);
370}
371
372
373#endif /* IB_SA_H */
diff --git a/include/rdma/ib_smi.h b/include/rdma/ib_smi.h
new file mode 100644
index 000000000000..87f60737f695
--- /dev/null
+++ b/include/rdma/ib_smi.h
@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
3 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
4 * Copyright (c) 2004 Intel Corporation. All rights reserved.
5 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
6 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
7 *
8 * This software is available to you under a choice of one of two
9 * licenses. You may choose to be licensed under the terms of the GNU
10 * General Public License (GPL) Version 2, available from the file
11 * COPYING in the main directory of this source tree, or the
12 * OpenIB.org BSD license below:
13 *
14 * Redistribution and use in source and binary forms, with or
15 * without modification, are permitted provided that the following
16 * conditions are met:
17 *
18 * - Redistributions of source code must retain the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer.
21 *
22 * - Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials
25 * provided with the distribution.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE.
35 *
36 * $Id: ib_smi.h 1389 2004-12-27 22:56:47Z roland $
37 */
38
39#if !defined( IB_SMI_H )
40#define IB_SMI_H
41
42#include <rdma/ib_mad.h>
43
44#define IB_SMP_DATA_SIZE 64
45#define IB_SMP_MAX_PATH_HOPS 64
46
47struct ib_smp {
48 u8 base_version;
49 u8 mgmt_class;
50 u8 class_version;
51 u8 method;
52 __be16 status;
53 u8 hop_ptr;
54 u8 hop_cnt;
55 __be64 tid;
56 __be16 attr_id;
57 __be16 resv;
58 __be32 attr_mod;
59 __be64 mkey;
60 __be16 dr_slid;
61 __be16 dr_dlid;
62 u8 reserved[28];
63 u8 data[IB_SMP_DATA_SIZE];
64 u8 initial_path[IB_SMP_MAX_PATH_HOPS];
65 u8 return_path[IB_SMP_MAX_PATH_HOPS];
66} __attribute__ ((packed));
67
68#define IB_SMP_DIRECTION __constant_htons(0x8000)
69
70/* Subnet management attributes */
71#define IB_SMP_ATTR_NOTICE __constant_htons(0x0002)
72#define IB_SMP_ATTR_NODE_DESC __constant_htons(0x0010)
73#define IB_SMP_ATTR_NODE_INFO __constant_htons(0x0011)
74#define IB_SMP_ATTR_SWITCH_INFO __constant_htons(0x0012)
75#define IB_SMP_ATTR_GUID_INFO __constant_htons(0x0014)
76#define IB_SMP_ATTR_PORT_INFO __constant_htons(0x0015)
77#define IB_SMP_ATTR_PKEY_TABLE __constant_htons(0x0016)
78#define IB_SMP_ATTR_SL_TO_VL_TABLE __constant_htons(0x0017)
79#define IB_SMP_ATTR_VL_ARB_TABLE __constant_htons(0x0018)
80#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE __constant_htons(0x0019)
81#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE __constant_htons(0x001A)
82#define IB_SMP_ATTR_MCAST_FORWARD_TABLE __constant_htons(0x001B)
83#define IB_SMP_ATTR_SM_INFO __constant_htons(0x0020)
84#define IB_SMP_ATTR_VENDOR_DIAG __constant_htons(0x0030)
85#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031)
86#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00)
87
88static inline u8
89ib_get_smp_direction(struct ib_smp *smp)
90{
91 return ((smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
92}
93
94#endif /* IB_SMI_H */
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
new file mode 100644
index 000000000000..72182d16778b
--- /dev/null
+++ b/include/rdma/ib_user_cm.h
@@ -0,0 +1,328 @@
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id: ib_user_cm.h 2576 2005-06-09 17:00:30Z libor $
33 */
34
35#ifndef IB_USER_CM_H
36#define IB_USER_CM_H
37
38#include <linux/types.h>
39
40#define IB_USER_CM_ABI_VERSION 1
41
42enum {
43 IB_USER_CM_CMD_CREATE_ID,
44 IB_USER_CM_CMD_DESTROY_ID,
45 IB_USER_CM_CMD_ATTR_ID,
46
47 IB_USER_CM_CMD_LISTEN,
48 IB_USER_CM_CMD_ESTABLISH,
49
50 IB_USER_CM_CMD_SEND_REQ,
51 IB_USER_CM_CMD_SEND_REP,
52 IB_USER_CM_CMD_SEND_RTU,
53 IB_USER_CM_CMD_SEND_DREQ,
54 IB_USER_CM_CMD_SEND_DREP,
55 IB_USER_CM_CMD_SEND_REJ,
56 IB_USER_CM_CMD_SEND_MRA,
57 IB_USER_CM_CMD_SEND_LAP,
58 IB_USER_CM_CMD_SEND_APR,
59 IB_USER_CM_CMD_SEND_SIDR_REQ,
60 IB_USER_CM_CMD_SEND_SIDR_REP,
61
62 IB_USER_CM_CMD_EVENT,
63};
64/*
65 * command ABI structures.
66 */
67struct ib_ucm_cmd_hdr {
68 __u32 cmd;
69 __u16 in;
70 __u16 out;
71};
72
73struct ib_ucm_create_id {
74 __u64 response;
75};
76
77struct ib_ucm_create_id_resp {
78 __u32 id;
79};
80
81struct ib_ucm_destroy_id {
82 __u32 id;
83};
84
85struct ib_ucm_attr_id {
86 __u64 response;
87 __u32 id;
88};
89
90struct ib_ucm_attr_id_resp {
91 __be64 service_id;
92 __be64 service_mask;
93 __be32 local_id;
94 __be32 remote_id;
95};
96
97struct ib_ucm_listen {
98 __be64 service_id;
99 __be64 service_mask;
100 __u32 id;
101};
102
103struct ib_ucm_establish {
104 __u32 id;
105};
106
107struct ib_ucm_private_data {
108 __u64 data;
109 __u32 id;
110 __u8 len;
111 __u8 reserved[3];
112};
113
114struct ib_ucm_path_rec {
115 __u8 dgid[16];
116 __u8 sgid[16];
117 __be16 dlid;
118 __be16 slid;
119 __u32 raw_traffic;
120 __be32 flow_label;
121 __u32 reversible;
122 __u32 mtu;
123 __be16 pkey;
124 __u8 hop_limit;
125 __u8 traffic_class;
126 __u8 numb_path;
127 __u8 sl;
128 __u8 mtu_selector;
129 __u8 rate_selector;
130 __u8 rate;
131 __u8 packet_life_time_selector;
132 __u8 packet_life_time;
133 __u8 preference;
134};
135
136struct ib_ucm_req {
137 __u32 id;
138 __u32 qpn;
139 __u32 qp_type;
140 __u32 psn;
141 __be64 sid;
142 __u64 data;
143 __u64 primary_path;
144 __u64 alternate_path;
145 __u8 len;
146 __u8 peer_to_peer;
147 __u8 responder_resources;
148 __u8 initiator_depth;
149 __u8 remote_cm_response_timeout;
150 __u8 flow_control;
151 __u8 local_cm_response_timeout;
152 __u8 retry_count;
153 __u8 rnr_retry_count;
154 __u8 max_cm_retries;
155 __u8 srq;
156 __u8 reserved[1];
157};
158
159struct ib_ucm_rep {
160 __u64 data;
161 __u32 id;
162 __u32 qpn;
163 __u32 psn;
164 __u8 len;
165 __u8 responder_resources;
166 __u8 initiator_depth;
167 __u8 target_ack_delay;
168 __u8 failover_accepted;
169 __u8 flow_control;
170 __u8 rnr_retry_count;
171 __u8 srq;
172};
173
174struct ib_ucm_info {
175 __u32 id;
176 __u32 status;
177 __u64 info;
178 __u64 data;
179 __u8 info_len;
180 __u8 data_len;
181 __u8 reserved[2];
182};
183
184struct ib_ucm_mra {
185 __u64 data;
186 __u32 id;
187 __u8 len;
188 __u8 timeout;
189 __u8 reserved[2];
190};
191
192struct ib_ucm_lap {
193 __u64 path;
194 __u64 data;
195 __u32 id;
196 __u8 len;
197 __u8 reserved[3];
198};
199
200struct ib_ucm_sidr_req {
201 __u32 id;
202 __u32 timeout;
203 __be64 sid;
204 __u64 data;
205 __u64 path;
206 __u16 pkey;
207 __u8 len;
208 __u8 max_cm_retries;
209};
210
211struct ib_ucm_sidr_rep {
212 __u32 id;
213 __u32 qpn;
214 __u32 qkey;
215 __u32 status;
216 __u64 info;
217 __u64 data;
218 __u8 info_len;
219 __u8 data_len;
220 __u8 reserved[2];
221};
222/*
223 * event notification ABI structures.
224 */
225struct ib_ucm_event_get {
226 __u64 response;
227 __u64 data;
228 __u64 info;
229 __u8 data_len;
230 __u8 info_len;
231 __u8 reserved[2];
232};
233
234struct ib_ucm_req_event_resp {
235 __u32 listen_id;
236 /* device */
237 /* port */
238 struct ib_ucm_path_rec primary_path;
239 struct ib_ucm_path_rec alternate_path;
240 __be64 remote_ca_guid;
241 __u32 remote_qkey;
242 __u32 remote_qpn;
243 __u32 qp_type;
244 __u32 starting_psn;
245 __u8 responder_resources;
246 __u8 initiator_depth;
247 __u8 local_cm_response_timeout;
248 __u8 flow_control;
249 __u8 remote_cm_response_timeout;
250 __u8 retry_count;
251 __u8 rnr_retry_count;
252 __u8 srq;
253};
254
255struct ib_ucm_rep_event_resp {
256 __be64 remote_ca_guid;
257 __u32 remote_qkey;
258 __u32 remote_qpn;
259 __u32 starting_psn;
260 __u8 responder_resources;
261 __u8 initiator_depth;
262 __u8 target_ack_delay;
263 __u8 failover_accepted;
264 __u8 flow_control;
265 __u8 rnr_retry_count;
266 __u8 srq;
267 __u8 reserved[1];
268};
269
270struct ib_ucm_rej_event_resp {
271 __u32 reason;
272 /* ari in ib_ucm_event_get info field. */
273};
274
275struct ib_ucm_mra_event_resp {
276 __u8 timeout;
277 __u8 reserved[3];
278};
279
280struct ib_ucm_lap_event_resp {
281 struct ib_ucm_path_rec path;
282};
283
284struct ib_ucm_apr_event_resp {
285 __u32 status;
286 /* apr info in ib_ucm_event_get info field. */
287};
288
289struct ib_ucm_sidr_req_event_resp {
290 __u32 listen_id;
291 /* device */
292 /* port */
293 __u16 pkey;
294 __u8 reserved[2];
295};
296
297struct ib_ucm_sidr_rep_event_resp {
298 __u32 status;
299 __u32 qkey;
300 __u32 qpn;
301 /* info in ib_ucm_event_get info field. */
302};
303
304#define IB_UCM_PRES_DATA 0x01
305#define IB_UCM_PRES_INFO 0x02
306#define IB_UCM_PRES_PRIMARY 0x04
307#define IB_UCM_PRES_ALTERNATE 0x08
308
309struct ib_ucm_event_resp {
310 __u32 id;
311 __u32 event;
312 __u32 present;
313 union {
314 struct ib_ucm_req_event_resp req_resp;
315 struct ib_ucm_rep_event_resp rep_resp;
316 struct ib_ucm_rej_event_resp rej_resp;
317 struct ib_ucm_mra_event_resp mra_resp;
318 struct ib_ucm_lap_event_resp lap_resp;
319 struct ib_ucm_apr_event_resp apr_resp;
320
321 struct ib_ucm_sidr_req_event_resp sidr_req_resp;
322 struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
323
324 __u32 send_status;
325 } u;
326};
327
328#endif /* IB_USER_CM_H */
diff --git a/include/rdma/ib_user_mad.h b/include/rdma/ib_user_mad.h
new file mode 100644
index 000000000000..44537aa32e62
--- /dev/null
+++ b/include/rdma/ib_user_mad.h
@@ -0,0 +1,137 @@
1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 * $Id: ib_user_mad.h 2814 2005-07-06 19:14:09Z halr $
34 */
35
36#ifndef IB_USER_MAD_H
37#define IB_USER_MAD_H
38
39#include <linux/types.h>
40#include <linux/ioctl.h>
41
42/*
43 * Increment this value if any changes that break userspace ABI
44 * compatibility are made.
45 */
46#define IB_USER_MAD_ABI_VERSION 5
47
48/*
49 * Make sure that all structs defined in this file remain laid out so
50 * that they pack the same way on 32-bit and 64-bit architectures (to
51 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
52 */
53
54/**
55 * ib_user_mad_hdr - MAD packet header
56 * @id - ID of agent MAD received with/to be sent with
57 * @status - 0 on successful receive, ETIMEDOUT if no response
58 * received (transaction ID in data[] will be set to TID of original
59 * request) (ignored on send)
60 * @timeout_ms - Milliseconds to wait for response (unset on receive)
61 * @retries - Number of automatic retries to attempt
62 * @qpn - Remote QP number received from/to be sent to
63 * @qkey - Remote Q_Key to be sent with (unset on receive)
64 * @lid - Remote lid received from/to be sent to
65 * @sl - Service level received with/to be sent with
66 * @path_bits - Local path bits received with/to be sent with
67 * @grh_present - If set, GRH was received/should be sent
68 * @gid_index - Local GID index to send with (unset on receive)
69 * @hop_limit - Hop limit in GRH
70 * @traffic_class - Traffic class in GRH
71 * @gid - Remote GID in GRH
72 * @flow_label - Flow label in GRH
73 */
74struct ib_user_mad_hdr {
75 __u32 id;
76 __u32 status;
77 __u32 timeout_ms;
78 __u32 retries;
79 __u32 length;
80 __be32 qpn;
81 __be32 qkey;
82 __be16 lid;
83 __u8 sl;
84 __u8 path_bits;
85 __u8 grh_present;
86 __u8 gid_index;
87 __u8 hop_limit;
88 __u8 traffic_class;
89 __u8 gid[16];
90 __be32 flow_label;
91};
92
93/**
94 * ib_user_mad - MAD packet
95 * @hdr - MAD packet header
96 * @data - Contents of MAD
97 *
98 */
99struct ib_user_mad {
100 struct ib_user_mad_hdr hdr;
101 __u8 data[0];
102};
103
104/**
105 * ib_user_mad_reg_req - MAD registration request
106 * @id - Set by the kernel; used to identify agent in future requests.
107 * @qpn - Queue pair number; must be 0 or 1.
108 * @method_mask - The caller will receive unsolicited MADs for any method
109 * where @method_mask = 1.
110 * @mgmt_class - Indicates which management class of MADs should be receive
111 * by the caller. This field is only required if the user wishes to
112 * receive unsolicited MADs, otherwise it should be 0.
113 * @mgmt_class_version - Indicates which version of MADs for the given
114 * management class to receive.
115 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
116 * in the range from 0x30 to 0x4f. Otherwise not used.
117 * @rmpp_version: If set, indicates the RMPP version used.
118 *
119 */
120struct ib_user_mad_reg_req {
121 __u32 id;
122 __u32 method_mask[4];
123 __u8 qpn;
124 __u8 mgmt_class;
125 __u8 mgmt_class_version;
126 __u8 oui[3];
127 __u8 rmpp_version;
128};
129
130#define IB_IOCTL_MAGIC 0x1b
131
132#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
133 struct ib_user_mad_reg_req)
134
135#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32)
136
137#endif /* IB_USER_MAD_H */
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
new file mode 100644
index 000000000000..7ebb01c8f996
--- /dev/null
+++ b/include/rdma/ib_user_verbs.h
@@ -0,0 +1,422 @@
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Cisco Systems. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $
34 */
35
36#ifndef IB_USER_VERBS_H
37#define IB_USER_VERBS_H
38
39#include <linux/types.h>
40
41/*
42 * Increment this value if any changes that break userspace ABI
43 * compatibility are made.
44 */
45#define IB_USER_VERBS_ABI_VERSION 1
46
47enum {
48 IB_USER_VERBS_CMD_QUERY_PARAMS,
49 IB_USER_VERBS_CMD_GET_CONTEXT,
50 IB_USER_VERBS_CMD_QUERY_DEVICE,
51 IB_USER_VERBS_CMD_QUERY_PORT,
52 IB_USER_VERBS_CMD_QUERY_GID,
53 IB_USER_VERBS_CMD_QUERY_PKEY,
54 IB_USER_VERBS_CMD_ALLOC_PD,
55 IB_USER_VERBS_CMD_DEALLOC_PD,
56 IB_USER_VERBS_CMD_CREATE_AH,
57 IB_USER_VERBS_CMD_MODIFY_AH,
58 IB_USER_VERBS_CMD_QUERY_AH,
59 IB_USER_VERBS_CMD_DESTROY_AH,
60 IB_USER_VERBS_CMD_REG_MR,
61 IB_USER_VERBS_CMD_REG_SMR,
62 IB_USER_VERBS_CMD_REREG_MR,
63 IB_USER_VERBS_CMD_QUERY_MR,
64 IB_USER_VERBS_CMD_DEREG_MR,
65 IB_USER_VERBS_CMD_ALLOC_MW,
66 IB_USER_VERBS_CMD_BIND_MW,
67 IB_USER_VERBS_CMD_DEALLOC_MW,
68 IB_USER_VERBS_CMD_CREATE_CQ,
69 IB_USER_VERBS_CMD_RESIZE_CQ,
70 IB_USER_VERBS_CMD_DESTROY_CQ,
71 IB_USER_VERBS_CMD_POLL_CQ,
72 IB_USER_VERBS_CMD_PEEK_CQ,
73 IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
74 IB_USER_VERBS_CMD_CREATE_QP,
75 IB_USER_VERBS_CMD_QUERY_QP,
76 IB_USER_VERBS_CMD_MODIFY_QP,
77 IB_USER_VERBS_CMD_DESTROY_QP,
78 IB_USER_VERBS_CMD_POST_SEND,
79 IB_USER_VERBS_CMD_POST_RECV,
80 IB_USER_VERBS_CMD_ATTACH_MCAST,
81 IB_USER_VERBS_CMD_DETACH_MCAST,
82 IB_USER_VERBS_CMD_CREATE_SRQ,
83 IB_USER_VERBS_CMD_MODIFY_SRQ,
84 IB_USER_VERBS_CMD_QUERY_SRQ,
85 IB_USER_VERBS_CMD_DESTROY_SRQ,
86 IB_USER_VERBS_CMD_POST_SRQ_RECV
87};
88
89/*
90 * Make sure that all structs defined in this file remain laid out so
91 * that they pack the same way on 32-bit and 64-bit architectures (to
92 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
93 * In particular do not use pointer types -- pass pointers in __u64
94 * instead.
95 */
96
97struct ib_uverbs_async_event_desc {
98 __u64 element;
99 __u32 event_type; /* enum ib_event_type */
100 __u32 reserved;
101};
102
103struct ib_uverbs_comp_event_desc {
104 __u64 cq_handle;
105};
106
107/*
108 * All commands from userspace should start with a __u32 command field
109 * followed by __u16 in_words and out_words fields (which give the
110 * length of the command block and response buffer if any in 32-bit
111 * words). The kernel driver will read these fields first and read
112 * the rest of the command struct based on these value.
113 */
114
115struct ib_uverbs_cmd_hdr {
116 __u32 command;
117 __u16 in_words;
118 __u16 out_words;
119};
120
121/*
122 * No driver_data for "query params" command, since this is intended
123 * to be a core function with no possible device dependence.
124 */
125struct ib_uverbs_query_params {
126 __u64 response;
127};
128
129struct ib_uverbs_query_params_resp {
130 __u32 num_cq_events;
131};
132
133struct ib_uverbs_get_context {
134 __u64 response;
135 __u64 cq_fd_tab;
136 __u64 driver_data[0];
137};
138
139struct ib_uverbs_get_context_resp {
140 __u32 async_fd;
141 __u32 reserved;
142};
143
144struct ib_uverbs_query_device {
145 __u64 response;
146 __u64 driver_data[0];
147};
148
149struct ib_uverbs_query_device_resp {
150 __u64 fw_ver;
151 __be64 node_guid;
152 __be64 sys_image_guid;
153 __u64 max_mr_size;
154 __u64 page_size_cap;
155 __u32 vendor_id;
156 __u32 vendor_part_id;
157 __u32 hw_ver;
158 __u32 max_qp;
159 __u32 max_qp_wr;
160 __u32 device_cap_flags;
161 __u32 max_sge;
162 __u32 max_sge_rd;
163 __u32 max_cq;
164 __u32 max_cqe;
165 __u32 max_mr;
166 __u32 max_pd;
167 __u32 max_qp_rd_atom;
168 __u32 max_ee_rd_atom;
169 __u32 max_res_rd_atom;
170 __u32 max_qp_init_rd_atom;
171 __u32 max_ee_init_rd_atom;
172 __u32 atomic_cap;
173 __u32 max_ee;
174 __u32 max_rdd;
175 __u32 max_mw;
176 __u32 max_raw_ipv6_qp;
177 __u32 max_raw_ethy_qp;
178 __u32 max_mcast_grp;
179 __u32 max_mcast_qp_attach;
180 __u32 max_total_mcast_qp_attach;
181 __u32 max_ah;
182 __u32 max_fmr;
183 __u32 max_map_per_fmr;
184 __u32 max_srq;
185 __u32 max_srq_wr;
186 __u32 max_srq_sge;
187 __u16 max_pkeys;
188 __u8 local_ca_ack_delay;
189 __u8 phys_port_cnt;
190 __u8 reserved[4];
191};
192
193struct ib_uverbs_query_port {
194 __u64 response;
195 __u8 port_num;
196 __u8 reserved[7];
197 __u64 driver_data[0];
198};
199
200struct ib_uverbs_query_port_resp {
201 __u32 port_cap_flags;
202 __u32 max_msg_sz;
203 __u32 bad_pkey_cntr;
204 __u32 qkey_viol_cntr;
205 __u32 gid_tbl_len;
206 __u16 pkey_tbl_len;
207 __u16 lid;
208 __u16 sm_lid;
209 __u8 state;
210 __u8 max_mtu;
211 __u8 active_mtu;
212 __u8 lmc;
213 __u8 max_vl_num;
214 __u8 sm_sl;
215 __u8 subnet_timeout;
216 __u8 init_type_reply;
217 __u8 active_width;
218 __u8 active_speed;
219 __u8 phys_state;
220 __u8 reserved[3];
221};
222
223struct ib_uverbs_query_gid {
224 __u64 response;
225 __u8 port_num;
226 __u8 index;
227 __u8 reserved[6];
228 __u64 driver_data[0];
229};
230
231struct ib_uverbs_query_gid_resp {
232 __u8 gid[16];
233};
234
235struct ib_uverbs_query_pkey {
236 __u64 response;
237 __u8 port_num;
238 __u8 index;
239 __u8 reserved[6];
240 __u64 driver_data[0];
241};
242
243struct ib_uverbs_query_pkey_resp {
244 __u16 pkey;
245 __u16 reserved;
246};
247
248struct ib_uverbs_alloc_pd {
249 __u64 response;
250 __u64 driver_data[0];
251};
252
253struct ib_uverbs_alloc_pd_resp {
254 __u32 pd_handle;
255};
256
257struct ib_uverbs_dealloc_pd {
258 __u32 pd_handle;
259};
260
261struct ib_uverbs_reg_mr {
262 __u64 response;
263 __u64 start;
264 __u64 length;
265 __u64 hca_va;
266 __u32 pd_handle;
267 __u32 access_flags;
268 __u64 driver_data[0];
269};
270
271struct ib_uverbs_reg_mr_resp {
272 __u32 mr_handle;
273 __u32 lkey;
274 __u32 rkey;
275};
276
277struct ib_uverbs_dereg_mr {
278 __u32 mr_handle;
279};
280
281struct ib_uverbs_create_cq {
282 __u64 response;
283 __u64 user_handle;
284 __u32 cqe;
285 __u32 event_handler;
286 __u64 driver_data[0];
287};
288
289struct ib_uverbs_create_cq_resp {
290 __u32 cq_handle;
291 __u32 cqe;
292};
293
294struct ib_uverbs_destroy_cq {
295 __u32 cq_handle;
296};
297
298struct ib_uverbs_create_qp {
299 __u64 response;
300 __u64 user_handle;
301 __u32 pd_handle;
302 __u32 send_cq_handle;
303 __u32 recv_cq_handle;
304 __u32 srq_handle;
305 __u32 max_send_wr;
306 __u32 max_recv_wr;
307 __u32 max_send_sge;
308 __u32 max_recv_sge;
309 __u32 max_inline_data;
310 __u8 sq_sig_all;
311 __u8 qp_type;
312 __u8 is_srq;
313 __u8 reserved;
314 __u64 driver_data[0];
315};
316
317struct ib_uverbs_create_qp_resp {
318 __u32 qp_handle;
319 __u32 qpn;
320};
321
322/*
323 * This struct needs to remain a multiple of 8 bytes to keep the
324 * alignment of the modify QP parameters.
325 */
326struct ib_uverbs_qp_dest {
327 __u8 dgid[16];
328 __u32 flow_label;
329 __u16 dlid;
330 __u16 reserved;
331 __u8 sgid_index;
332 __u8 hop_limit;
333 __u8 traffic_class;
334 __u8 sl;
335 __u8 src_path_bits;
336 __u8 static_rate;
337 __u8 is_global;
338 __u8 port_num;
339};
340
341struct ib_uverbs_modify_qp {
342 struct ib_uverbs_qp_dest dest;
343 struct ib_uverbs_qp_dest alt_dest;
344 __u32 qp_handle;
345 __u32 attr_mask;
346 __u32 qkey;
347 __u32 rq_psn;
348 __u32 sq_psn;
349 __u32 dest_qp_num;
350 __u32 qp_access_flags;
351 __u16 pkey_index;
352 __u16 alt_pkey_index;
353 __u8 qp_state;
354 __u8 cur_qp_state;
355 __u8 path_mtu;
356 __u8 path_mig_state;
357 __u8 en_sqd_async_notify;
358 __u8 max_rd_atomic;
359 __u8 max_dest_rd_atomic;
360 __u8 min_rnr_timer;
361 __u8 port_num;
362 __u8 timeout;
363 __u8 retry_cnt;
364 __u8 rnr_retry;
365 __u8 alt_port_num;
366 __u8 alt_timeout;
367 __u8 reserved[2];
368 __u64 driver_data[0];
369};
370
371struct ib_uverbs_modify_qp_resp {
372};
373
374struct ib_uverbs_destroy_qp {
375 __u32 qp_handle;
376};
377
378struct ib_uverbs_attach_mcast {
379 __u8 gid[16];
380 __u32 qp_handle;
381 __u16 mlid;
382 __u16 reserved;
383 __u64 driver_data[0];
384};
385
386struct ib_uverbs_detach_mcast {
387 __u8 gid[16];
388 __u32 qp_handle;
389 __u16 mlid;
390 __u16 reserved;
391 __u64 driver_data[0];
392};
393
394struct ib_uverbs_create_srq {
395 __u64 response;
396 __u64 user_handle;
397 __u32 pd_handle;
398 __u32 max_wr;
399 __u32 max_sge;
400 __u32 srq_limit;
401 __u64 driver_data[0];
402};
403
404struct ib_uverbs_create_srq_resp {
405 __u32 srq_handle;
406};
407
408struct ib_uverbs_modify_srq {
409 __u32 srq_handle;
410 __u32 attr_mask;
411 __u32 max_wr;
412 __u32 max_sge;
413 __u32 srq_limit;
414 __u32 reserved;
415 __u64 driver_data[0];
416};
417
418struct ib_uverbs_destroy_srq {
419 __u32 srq_handle;
420};
421
422#endif /* IB_USER_VERBS_H */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
new file mode 100644
index 000000000000..e16cf94870f2
--- /dev/null
+++ b/include/rdma/ib_verbs.h
@@ -0,0 +1,1461 @@
1/*
2 * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
3 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
4 * Copyright (c) 2004 Intel Corporation. All rights reserved.
5 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
6 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
7 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
8 * Copyright (c) 2005 Cisco Systems. All rights reserved.
9 *
10 * This software is available to you under a choice of one of two
11 * licenses. You may choose to be licensed under the terms of the GNU
12 * General Public License (GPL) Version 2, available from the file
13 * COPYING in the main directory of this source tree, or the
14 * OpenIB.org BSD license below:
15 *
16 * Redistribution and use in source and binary forms, with or
17 * without modification, are permitted provided that the following
18 * conditions are met:
19 *
20 * - Redistributions of source code must retain the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer.
23 *
24 * - Redistributions in binary form must reproduce the above
25 * copyright notice, this list of conditions and the following
26 * disclaimer in the documentation and/or other materials
27 * provided with the distribution.
28 *
29 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
33 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
34 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
35 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36 * SOFTWARE.
37 *
38 * $Id: ib_verbs.h 1349 2004-12-16 21:09:43Z roland $
39 */
40
41#if !defined(IB_VERBS_H)
42#define IB_VERBS_H
43
44#include <linux/types.h>
45#include <linux/device.h>
46
47#include <asm/atomic.h>
48#include <asm/scatterlist.h>
49#include <asm/uaccess.h>
50
51union ib_gid {
52 u8 raw[16];
53 struct {
54 __be64 subnet_prefix;
55 __be64 interface_id;
56 } global;
57};
58
59enum ib_node_type {
60 IB_NODE_CA = 1,
61 IB_NODE_SWITCH,
62 IB_NODE_ROUTER
63};
64
65enum ib_device_cap_flags {
66 IB_DEVICE_RESIZE_MAX_WR = 1,
67 IB_DEVICE_BAD_PKEY_CNTR = (1<<1),
68 IB_DEVICE_BAD_QKEY_CNTR = (1<<2),
69 IB_DEVICE_RAW_MULTI = (1<<3),
70 IB_DEVICE_AUTO_PATH_MIG = (1<<4),
71 IB_DEVICE_CHANGE_PHY_PORT = (1<<5),
72 IB_DEVICE_UD_AV_PORT_ENFORCE = (1<<6),
73 IB_DEVICE_CURR_QP_STATE_MOD = (1<<7),
74 IB_DEVICE_SHUTDOWN_PORT = (1<<8),
75 IB_DEVICE_INIT_TYPE = (1<<9),
76 IB_DEVICE_PORT_ACTIVE_EVENT = (1<<10),
77 IB_DEVICE_SYS_IMAGE_GUID = (1<<11),
78 IB_DEVICE_RC_RNR_NAK_GEN = (1<<12),
79 IB_DEVICE_SRQ_RESIZE = (1<<13),
80 IB_DEVICE_N_NOTIFY_CQ = (1<<14),
81};
82
83enum ib_atomic_cap {
84 IB_ATOMIC_NONE,
85 IB_ATOMIC_HCA,
86 IB_ATOMIC_GLOB
87};
88
89struct ib_device_attr {
90 u64 fw_ver;
91 __be64 node_guid;
92 __be64 sys_image_guid;
93 u64 max_mr_size;
94 u64 page_size_cap;
95 u32 vendor_id;
96 u32 vendor_part_id;
97 u32 hw_ver;
98 int max_qp;
99 int max_qp_wr;
100 int device_cap_flags;
101 int max_sge;
102 int max_sge_rd;
103 int max_cq;
104 int max_cqe;
105 int max_mr;
106 int max_pd;
107 int max_qp_rd_atom;
108 int max_ee_rd_atom;
109 int max_res_rd_atom;
110 int max_qp_init_rd_atom;
111 int max_ee_init_rd_atom;
112 enum ib_atomic_cap atomic_cap;
113 int max_ee;
114 int max_rdd;
115 int max_mw;
116 int max_raw_ipv6_qp;
117 int max_raw_ethy_qp;
118 int max_mcast_grp;
119 int max_mcast_qp_attach;
120 int max_total_mcast_qp_attach;
121 int max_ah;
122 int max_fmr;
123 int max_map_per_fmr;
124 int max_srq;
125 int max_srq_wr;
126 int max_srq_sge;
127 u16 max_pkeys;
128 u8 local_ca_ack_delay;
129};
130
131enum ib_mtu {
132 IB_MTU_256 = 1,
133 IB_MTU_512 = 2,
134 IB_MTU_1024 = 3,
135 IB_MTU_2048 = 4,
136 IB_MTU_4096 = 5
137};
138
139static inline int ib_mtu_enum_to_int(enum ib_mtu mtu)
140{
141 switch (mtu) {
142 case IB_MTU_256: return 256;
143 case IB_MTU_512: return 512;
144 case IB_MTU_1024: return 1024;
145 case IB_MTU_2048: return 2048;
146 case IB_MTU_4096: return 4096;
147 default: return -1;
148 }
149}
150
151enum ib_port_state {
152 IB_PORT_NOP = 0,
153 IB_PORT_DOWN = 1,
154 IB_PORT_INIT = 2,
155 IB_PORT_ARMED = 3,
156 IB_PORT_ACTIVE = 4,
157 IB_PORT_ACTIVE_DEFER = 5
158};
159
160enum ib_port_cap_flags {
161 IB_PORT_SM = 1 << 1,
162 IB_PORT_NOTICE_SUP = 1 << 2,
163 IB_PORT_TRAP_SUP = 1 << 3,
164 IB_PORT_OPT_IPD_SUP = 1 << 4,
165 IB_PORT_AUTO_MIGR_SUP = 1 << 5,
166 IB_PORT_SL_MAP_SUP = 1 << 6,
167 IB_PORT_MKEY_NVRAM = 1 << 7,
168 IB_PORT_PKEY_NVRAM = 1 << 8,
169 IB_PORT_LED_INFO_SUP = 1 << 9,
170 IB_PORT_SM_DISABLED = 1 << 10,
171 IB_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
172 IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
173 IB_PORT_CM_SUP = 1 << 16,
174 IB_PORT_SNMP_TUNNEL_SUP = 1 << 17,
175 IB_PORT_REINIT_SUP = 1 << 18,
176 IB_PORT_DEVICE_MGMT_SUP = 1 << 19,
177 IB_PORT_VENDOR_CLASS_SUP = 1 << 20,
178 IB_PORT_DR_NOTICE_SUP = 1 << 21,
179 IB_PORT_CAP_MASK_NOTICE_SUP = 1 << 22,
180 IB_PORT_BOOT_MGMT_SUP = 1 << 23,
181 IB_PORT_LINK_LATENCY_SUP = 1 << 24,
182 IB_PORT_CLIENT_REG_SUP = 1 << 25
183};
184
185enum ib_port_width {
186 IB_WIDTH_1X = 1,
187 IB_WIDTH_4X = 2,
188 IB_WIDTH_8X = 4,
189 IB_WIDTH_12X = 8
190};
191
192static inline int ib_width_enum_to_int(enum ib_port_width width)
193{
194 switch (width) {
195 case IB_WIDTH_1X: return 1;
196 case IB_WIDTH_4X: return 4;
197 case IB_WIDTH_8X: return 8;
198 case IB_WIDTH_12X: return 12;
199 default: return -1;
200 }
201}
202
203struct ib_port_attr {
204 enum ib_port_state state;
205 enum ib_mtu max_mtu;
206 enum ib_mtu active_mtu;
207 int gid_tbl_len;
208 u32 port_cap_flags;
209 u32 max_msg_sz;
210 u32 bad_pkey_cntr;
211 u32 qkey_viol_cntr;
212 u16 pkey_tbl_len;
213 u16 lid;
214 u16 sm_lid;
215 u8 lmc;
216 u8 max_vl_num;
217 u8 sm_sl;
218 u8 subnet_timeout;
219 u8 init_type_reply;
220 u8 active_width;
221 u8 active_speed;
222 u8 phys_state;
223};
224
225enum ib_device_modify_flags {
226 IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1
227};
228
229struct ib_device_modify {
230 u64 sys_image_guid;
231};
232
233enum ib_port_modify_flags {
234 IB_PORT_SHUTDOWN = 1,
235 IB_PORT_INIT_TYPE = (1<<2),
236 IB_PORT_RESET_QKEY_CNTR = (1<<3)
237};
238
239struct ib_port_modify {
240 u32 set_port_cap_mask;
241 u32 clr_port_cap_mask;
242 u8 init_type;
243};
244
245enum ib_event_type {
246 IB_EVENT_CQ_ERR,
247 IB_EVENT_QP_FATAL,
248 IB_EVENT_QP_REQ_ERR,
249 IB_EVENT_QP_ACCESS_ERR,
250 IB_EVENT_COMM_EST,
251 IB_EVENT_SQ_DRAINED,
252 IB_EVENT_PATH_MIG,
253 IB_EVENT_PATH_MIG_ERR,
254 IB_EVENT_DEVICE_FATAL,
255 IB_EVENT_PORT_ACTIVE,
256 IB_EVENT_PORT_ERR,
257 IB_EVENT_LID_CHANGE,
258 IB_EVENT_PKEY_CHANGE,
259 IB_EVENT_SM_CHANGE,
260 IB_EVENT_SRQ_ERR,
261 IB_EVENT_SRQ_LIMIT_REACHED,
262 IB_EVENT_QP_LAST_WQE_REACHED
263};
264
265struct ib_event {
266 struct ib_device *device;
267 union {
268 struct ib_cq *cq;
269 struct ib_qp *qp;
270 struct ib_srq *srq;
271 u8 port_num;
272 } element;
273 enum ib_event_type event;
274};
275
276struct ib_event_handler {
277 struct ib_device *device;
278 void (*handler)(struct ib_event_handler *, struct ib_event *);
279 struct list_head list;
280};
281
282#define INIT_IB_EVENT_HANDLER(_ptr, _device, _handler) \
283 do { \
284 (_ptr)->device = _device; \
285 (_ptr)->handler = _handler; \
286 INIT_LIST_HEAD(&(_ptr)->list); \
287 } while (0)
288
289struct ib_global_route {
290 union ib_gid dgid;
291 u32 flow_label;
292 u8 sgid_index;
293 u8 hop_limit;
294 u8 traffic_class;
295};
296
297struct ib_grh {
298 __be32 version_tclass_flow;
299 __be16 paylen;
300 u8 next_hdr;
301 u8 hop_limit;
302 union ib_gid sgid;
303 union ib_gid dgid;
304};
305
306enum {
307 IB_MULTICAST_QPN = 0xffffff
308};
309
310#define IB_LID_PERMISSIVE __constant_htons(0xFFFF)
311
312enum ib_ah_flags {
313 IB_AH_GRH = 1
314};
315
316struct ib_ah_attr {
317 struct ib_global_route grh;
318 u16 dlid;
319 u8 sl;
320 u8 src_path_bits;
321 u8 static_rate;
322 u8 ah_flags;
323 u8 port_num;
324};
325
326enum ib_wc_status {
327 IB_WC_SUCCESS,
328 IB_WC_LOC_LEN_ERR,
329 IB_WC_LOC_QP_OP_ERR,
330 IB_WC_LOC_EEC_OP_ERR,
331 IB_WC_LOC_PROT_ERR,
332 IB_WC_WR_FLUSH_ERR,
333 IB_WC_MW_BIND_ERR,
334 IB_WC_BAD_RESP_ERR,
335 IB_WC_LOC_ACCESS_ERR,
336 IB_WC_REM_INV_REQ_ERR,
337 IB_WC_REM_ACCESS_ERR,
338 IB_WC_REM_OP_ERR,
339 IB_WC_RETRY_EXC_ERR,
340 IB_WC_RNR_RETRY_EXC_ERR,
341 IB_WC_LOC_RDD_VIOL_ERR,
342 IB_WC_REM_INV_RD_REQ_ERR,
343 IB_WC_REM_ABORT_ERR,
344 IB_WC_INV_EECN_ERR,
345 IB_WC_INV_EEC_STATE_ERR,
346 IB_WC_FATAL_ERR,
347 IB_WC_RESP_TIMEOUT_ERR,
348 IB_WC_GENERAL_ERR
349};
350
351enum ib_wc_opcode {
352 IB_WC_SEND,
353 IB_WC_RDMA_WRITE,
354 IB_WC_RDMA_READ,
355 IB_WC_COMP_SWAP,
356 IB_WC_FETCH_ADD,
357 IB_WC_BIND_MW,
358/*
359 * Set value of IB_WC_RECV so consumers can test if a completion is a
360 * receive by testing (opcode & IB_WC_RECV).
361 */
362 IB_WC_RECV = 1 << 7,
363 IB_WC_RECV_RDMA_WITH_IMM
364};
365
366enum ib_wc_flags {
367 IB_WC_GRH = 1,
368 IB_WC_WITH_IMM = (1<<1)
369};
370
371struct ib_wc {
372 u64 wr_id;
373 enum ib_wc_status status;
374 enum ib_wc_opcode opcode;
375 u32 vendor_err;
376 u32 byte_len;
377 __be32 imm_data;
378 u32 qp_num;
379 u32 src_qp;
380 int wc_flags;
381 u16 pkey_index;
382 u16 slid;
383 u8 sl;
384 u8 dlid_path_bits;
385 u8 port_num; /* valid only for DR SMPs on switches */
386};
387
388enum ib_cq_notify {
389 IB_CQ_SOLICITED,
390 IB_CQ_NEXT_COMP
391};
392
393enum ib_srq_attr_mask {
394 IB_SRQ_MAX_WR = 1 << 0,
395 IB_SRQ_LIMIT = 1 << 1,
396};
397
398struct ib_srq_attr {
399 u32 max_wr;
400 u32 max_sge;
401 u32 srq_limit;
402};
403
404struct ib_srq_init_attr {
405 void (*event_handler)(struct ib_event *, void *);
406 void *srq_context;
407 struct ib_srq_attr attr;
408};
409
410struct ib_qp_cap {
411 u32 max_send_wr;
412 u32 max_recv_wr;
413 u32 max_send_sge;
414 u32 max_recv_sge;
415 u32 max_inline_data;
416};
417
418enum ib_sig_type {
419 IB_SIGNAL_ALL_WR,
420 IB_SIGNAL_REQ_WR
421};
422
423enum ib_qp_type {
424 /*
425 * IB_QPT_SMI and IB_QPT_GSI have to be the first two entries
426 * here (and in that order) since the MAD layer uses them as
427 * indices into a 2-entry table.
428 */
429 IB_QPT_SMI,
430 IB_QPT_GSI,
431
432 IB_QPT_RC,
433 IB_QPT_UC,
434 IB_QPT_UD,
435 IB_QPT_RAW_IPV6,
436 IB_QPT_RAW_ETY
437};
438
439struct ib_qp_init_attr {
440 void (*event_handler)(struct ib_event *, void *);
441 void *qp_context;
442 struct ib_cq *send_cq;
443 struct ib_cq *recv_cq;
444 struct ib_srq *srq;
445 struct ib_qp_cap cap;
446 enum ib_sig_type sq_sig_type;
447 enum ib_qp_type qp_type;
448 u8 port_num; /* special QP types only */
449};
450
451enum ib_rnr_timeout {
452 IB_RNR_TIMER_655_36 = 0,
453 IB_RNR_TIMER_000_01 = 1,
454 IB_RNR_TIMER_000_02 = 2,
455 IB_RNR_TIMER_000_03 = 3,
456 IB_RNR_TIMER_000_04 = 4,
457 IB_RNR_TIMER_000_06 = 5,
458 IB_RNR_TIMER_000_08 = 6,
459 IB_RNR_TIMER_000_12 = 7,
460 IB_RNR_TIMER_000_16 = 8,
461 IB_RNR_TIMER_000_24 = 9,
462 IB_RNR_TIMER_000_32 = 10,
463 IB_RNR_TIMER_000_48 = 11,
464 IB_RNR_TIMER_000_64 = 12,
465 IB_RNR_TIMER_000_96 = 13,
466 IB_RNR_TIMER_001_28 = 14,
467 IB_RNR_TIMER_001_92 = 15,
468 IB_RNR_TIMER_002_56 = 16,
469 IB_RNR_TIMER_003_84 = 17,
470 IB_RNR_TIMER_005_12 = 18,
471 IB_RNR_TIMER_007_68 = 19,
472 IB_RNR_TIMER_010_24 = 20,
473 IB_RNR_TIMER_015_36 = 21,
474 IB_RNR_TIMER_020_48 = 22,
475 IB_RNR_TIMER_030_72 = 23,
476 IB_RNR_TIMER_040_96 = 24,
477 IB_RNR_TIMER_061_44 = 25,
478 IB_RNR_TIMER_081_92 = 26,
479 IB_RNR_TIMER_122_88 = 27,
480 IB_RNR_TIMER_163_84 = 28,
481 IB_RNR_TIMER_245_76 = 29,
482 IB_RNR_TIMER_327_68 = 30,
483 IB_RNR_TIMER_491_52 = 31
484};
485
486enum ib_qp_attr_mask {
487 IB_QP_STATE = 1,
488 IB_QP_CUR_STATE = (1<<1),
489 IB_QP_EN_SQD_ASYNC_NOTIFY = (1<<2),
490 IB_QP_ACCESS_FLAGS = (1<<3),
491 IB_QP_PKEY_INDEX = (1<<4),
492 IB_QP_PORT = (1<<5),
493 IB_QP_QKEY = (1<<6),
494 IB_QP_AV = (1<<7),
495 IB_QP_PATH_MTU = (1<<8),
496 IB_QP_TIMEOUT = (1<<9),
497 IB_QP_RETRY_CNT = (1<<10),
498 IB_QP_RNR_RETRY = (1<<11),
499 IB_QP_RQ_PSN = (1<<12),
500 IB_QP_MAX_QP_RD_ATOMIC = (1<<13),
501 IB_QP_ALT_PATH = (1<<14),
502 IB_QP_MIN_RNR_TIMER = (1<<15),
503 IB_QP_SQ_PSN = (1<<16),
504 IB_QP_MAX_DEST_RD_ATOMIC = (1<<17),
505 IB_QP_PATH_MIG_STATE = (1<<18),
506 IB_QP_CAP = (1<<19),
507 IB_QP_DEST_QPN = (1<<20)
508};
509
510enum ib_qp_state {
511 IB_QPS_RESET,
512 IB_QPS_INIT,
513 IB_QPS_RTR,
514 IB_QPS_RTS,
515 IB_QPS_SQD,
516 IB_QPS_SQE,
517 IB_QPS_ERR
518};
519
520enum ib_mig_state {
521 IB_MIG_MIGRATED,
522 IB_MIG_REARM,
523 IB_MIG_ARMED
524};
525
526struct ib_qp_attr {
527 enum ib_qp_state qp_state;
528 enum ib_qp_state cur_qp_state;
529 enum ib_mtu path_mtu;
530 enum ib_mig_state path_mig_state;
531 u32 qkey;
532 u32 rq_psn;
533 u32 sq_psn;
534 u32 dest_qp_num;
535 int qp_access_flags;
536 struct ib_qp_cap cap;
537 struct ib_ah_attr ah_attr;
538 struct ib_ah_attr alt_ah_attr;
539 u16 pkey_index;
540 u16 alt_pkey_index;
541 u8 en_sqd_async_notify;
542 u8 sq_draining;
543 u8 max_rd_atomic;
544 u8 max_dest_rd_atomic;
545 u8 min_rnr_timer;
546 u8 port_num;
547 u8 timeout;
548 u8 retry_cnt;
549 u8 rnr_retry;
550 u8 alt_port_num;
551 u8 alt_timeout;
552};
553
554enum ib_wr_opcode {
555 IB_WR_RDMA_WRITE,
556 IB_WR_RDMA_WRITE_WITH_IMM,
557 IB_WR_SEND,
558 IB_WR_SEND_WITH_IMM,
559 IB_WR_RDMA_READ,
560 IB_WR_ATOMIC_CMP_AND_SWP,
561 IB_WR_ATOMIC_FETCH_AND_ADD
562};
563
564enum ib_send_flags {
565 IB_SEND_FENCE = 1,
566 IB_SEND_SIGNALED = (1<<1),
567 IB_SEND_SOLICITED = (1<<2),
568 IB_SEND_INLINE = (1<<3)
569};
570
571struct ib_sge {
572 u64 addr;
573 u32 length;
574 u32 lkey;
575};
576
577struct ib_send_wr {
578 struct ib_send_wr *next;
579 u64 wr_id;
580 struct ib_sge *sg_list;
581 int num_sge;
582 enum ib_wr_opcode opcode;
583 int send_flags;
584 __be32 imm_data;
585 union {
586 struct {
587 u64 remote_addr;
588 u32 rkey;
589 } rdma;
590 struct {
591 u64 remote_addr;
592 u64 compare_add;
593 u64 swap;
594 u32 rkey;
595 } atomic;
596 struct {
597 struct ib_ah *ah;
598 struct ib_mad_hdr *mad_hdr;
599 u32 remote_qpn;
600 u32 remote_qkey;
601 int timeout_ms; /* valid for MADs only */
602 int retries; /* valid for MADs only */
603 u16 pkey_index; /* valid for GSI only */
604 u8 port_num; /* valid for DR SMPs on switch only */
605 } ud;
606 } wr;
607};
608
609struct ib_recv_wr {
610 struct ib_recv_wr *next;
611 u64 wr_id;
612 struct ib_sge *sg_list;
613 int num_sge;
614};
615
616enum ib_access_flags {
617 IB_ACCESS_LOCAL_WRITE = 1,
618 IB_ACCESS_REMOTE_WRITE = (1<<1),
619 IB_ACCESS_REMOTE_READ = (1<<2),
620 IB_ACCESS_REMOTE_ATOMIC = (1<<3),
621 IB_ACCESS_MW_BIND = (1<<4)
622};
623
624struct ib_phys_buf {
625 u64 addr;
626 u64 size;
627};
628
629struct ib_mr_attr {
630 struct ib_pd *pd;
631 u64 device_virt_addr;
632 u64 size;
633 int mr_access_flags;
634 u32 lkey;
635 u32 rkey;
636};
637
638enum ib_mr_rereg_flags {
639 IB_MR_REREG_TRANS = 1,
640 IB_MR_REREG_PD = (1<<1),
641 IB_MR_REREG_ACCESS = (1<<2)
642};
643
644struct ib_mw_bind {
645 struct ib_mr *mr;
646 u64 wr_id;
647 u64 addr;
648 u32 length;
649 int send_flags;
650 int mw_access_flags;
651};
652
653struct ib_fmr_attr {
654 int max_pages;
655 int max_maps;
656 u8 page_size;
657};
658
659struct ib_ucontext {
660 struct ib_device *device;
661 struct list_head pd_list;
662 struct list_head mr_list;
663 struct list_head mw_list;
664 struct list_head cq_list;
665 struct list_head qp_list;
666 struct list_head srq_list;
667 struct list_head ah_list;
668 spinlock_t lock;
669};
670
671struct ib_uobject {
672 u64 user_handle; /* handle given to us by userspace */
673 struct ib_ucontext *context; /* associated user context */
674 struct list_head list; /* link to context's list */
675 u32 id; /* index into kernel idr */
676};
677
678struct ib_umem {
679 unsigned long user_base;
680 unsigned long virt_base;
681 size_t length;
682 int offset;
683 int page_size;
684 int writable;
685 struct list_head chunk_list;
686};
687
688struct ib_umem_chunk {
689 struct list_head list;
690 int nents;
691 int nmap;
692 struct scatterlist page_list[0];
693};
694
695struct ib_udata {
696 void __user *inbuf;
697 void __user *outbuf;
698 size_t inlen;
699 size_t outlen;
700};
701
702#define IB_UMEM_MAX_PAGE_CHUNK \
703 ((PAGE_SIZE - offsetof(struct ib_umem_chunk, page_list)) / \
704 ((void *) &((struct ib_umem_chunk *) 0)->page_list[1] - \
705 (void *) &((struct ib_umem_chunk *) 0)->page_list[0]))
706
707struct ib_umem_object {
708 struct ib_uobject uobject;
709 struct ib_umem umem;
710};
711
712struct ib_pd {
713 struct ib_device *device;
714 struct ib_uobject *uobject;
715 atomic_t usecnt; /* count all resources */
716};
717
718struct ib_ah {
719 struct ib_device *device;
720 struct ib_pd *pd;
721 struct ib_uobject *uobject;
722};
723
724typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
725
726struct ib_cq {
727 struct ib_device *device;
728 struct ib_uobject *uobject;
729 ib_comp_handler comp_handler;
730 void (*event_handler)(struct ib_event *, void *);
731 void * cq_context;
732 int cqe;
733 atomic_t usecnt; /* count number of work queues */
734};
735
736struct ib_srq {
737 struct ib_device *device;
738 struct ib_pd *pd;
739 struct ib_uobject *uobject;
740 void (*event_handler)(struct ib_event *, void *);
741 void *srq_context;
742 atomic_t usecnt;
743};
744
745struct ib_qp {
746 struct ib_device *device;
747 struct ib_pd *pd;
748 struct ib_cq *send_cq;
749 struct ib_cq *recv_cq;
750 struct ib_srq *srq;
751 struct ib_uobject *uobject;
752 void (*event_handler)(struct ib_event *, void *);
753 void *qp_context;
754 u32 qp_num;
755 enum ib_qp_type qp_type;
756};
757
758struct ib_mr {
759 struct ib_device *device;
760 struct ib_pd *pd;
761 struct ib_uobject *uobject;
762 u32 lkey;
763 u32 rkey;
764 atomic_t usecnt; /* count number of MWs */
765};
766
767struct ib_mw {
768 struct ib_device *device;
769 struct ib_pd *pd;
770 struct ib_uobject *uobject;
771 u32 rkey;
772};
773
774struct ib_fmr {
775 struct ib_device *device;
776 struct ib_pd *pd;
777 struct list_head list;
778 u32 lkey;
779 u32 rkey;
780};
781
782struct ib_mad;
783struct ib_grh;
784
785enum ib_process_mad_flags {
786 IB_MAD_IGNORE_MKEY = 1,
787 IB_MAD_IGNORE_BKEY = 2,
788 IB_MAD_IGNORE_ALL = IB_MAD_IGNORE_MKEY | IB_MAD_IGNORE_BKEY
789};
790
791enum ib_mad_result {
792 IB_MAD_RESULT_FAILURE = 0, /* (!SUCCESS is the important flag) */
793 IB_MAD_RESULT_SUCCESS = 1 << 0, /* MAD was successfully processed */
794 IB_MAD_RESULT_REPLY = 1 << 1, /* Reply packet needs to be sent */
795 IB_MAD_RESULT_CONSUMED = 1 << 2 /* Packet consumed: stop processing */
796};
797
798#define IB_DEVICE_NAME_MAX 64
799
800struct ib_cache {
801 rwlock_t lock;
802 struct ib_event_handler event_handler;
803 struct ib_pkey_cache **pkey_cache;
804 struct ib_gid_cache **gid_cache;
805};
806
807struct ib_device {
808 struct device *dma_device;
809
810 char name[IB_DEVICE_NAME_MAX];
811
812 struct list_head event_handler_list;
813 spinlock_t event_handler_lock;
814
815 struct list_head core_list;
816 struct list_head client_data_list;
817 spinlock_t client_data_lock;
818
819 struct ib_cache cache;
820
821 u32 flags;
822
823 int (*query_device)(struct ib_device *device,
824 struct ib_device_attr *device_attr);
825 int (*query_port)(struct ib_device *device,
826 u8 port_num,
827 struct ib_port_attr *port_attr);
828 int (*query_gid)(struct ib_device *device,
829 u8 port_num, int index,
830 union ib_gid *gid);
831 int (*query_pkey)(struct ib_device *device,
832 u8 port_num, u16 index, u16 *pkey);
833 int (*modify_device)(struct ib_device *device,
834 int device_modify_mask,
835 struct ib_device_modify *device_modify);
836 int (*modify_port)(struct ib_device *device,
837 u8 port_num, int port_modify_mask,
838 struct ib_port_modify *port_modify);
839 struct ib_ucontext * (*alloc_ucontext)(struct ib_device *device,
840 struct ib_udata *udata);
841 int (*dealloc_ucontext)(struct ib_ucontext *context);
842 int (*mmap)(struct ib_ucontext *context,
843 struct vm_area_struct *vma);
844 struct ib_pd * (*alloc_pd)(struct ib_device *device,
845 struct ib_ucontext *context,
846 struct ib_udata *udata);
847 int (*dealloc_pd)(struct ib_pd *pd);
848 struct ib_ah * (*create_ah)(struct ib_pd *pd,
849 struct ib_ah_attr *ah_attr);
850 int (*modify_ah)(struct ib_ah *ah,
851 struct ib_ah_attr *ah_attr);
852 int (*query_ah)(struct ib_ah *ah,
853 struct ib_ah_attr *ah_attr);
854 int (*destroy_ah)(struct ib_ah *ah);
855 struct ib_srq * (*create_srq)(struct ib_pd *pd,
856 struct ib_srq_init_attr *srq_init_attr,
857 struct ib_udata *udata);
858 int (*modify_srq)(struct ib_srq *srq,
859 struct ib_srq_attr *srq_attr,
860 enum ib_srq_attr_mask srq_attr_mask);
861 int (*query_srq)(struct ib_srq *srq,
862 struct ib_srq_attr *srq_attr);
863 int (*destroy_srq)(struct ib_srq *srq);
864 int (*post_srq_recv)(struct ib_srq *srq,
865 struct ib_recv_wr *recv_wr,
866 struct ib_recv_wr **bad_recv_wr);
867 struct ib_qp * (*create_qp)(struct ib_pd *pd,
868 struct ib_qp_init_attr *qp_init_attr,
869 struct ib_udata *udata);
870 int (*modify_qp)(struct ib_qp *qp,
871 struct ib_qp_attr *qp_attr,
872 int qp_attr_mask);
873 int (*query_qp)(struct ib_qp *qp,
874 struct ib_qp_attr *qp_attr,
875 int qp_attr_mask,
876 struct ib_qp_init_attr *qp_init_attr);
877 int (*destroy_qp)(struct ib_qp *qp);
878 int (*post_send)(struct ib_qp *qp,
879 struct ib_send_wr *send_wr,
880 struct ib_send_wr **bad_send_wr);
881 int (*post_recv)(struct ib_qp *qp,
882 struct ib_recv_wr *recv_wr,
883 struct ib_recv_wr **bad_recv_wr);
884 struct ib_cq * (*create_cq)(struct ib_device *device, int cqe,
885 struct ib_ucontext *context,
886 struct ib_udata *udata);
887 int (*destroy_cq)(struct ib_cq *cq);
888 int (*resize_cq)(struct ib_cq *cq, int *cqe);
889 int (*poll_cq)(struct ib_cq *cq, int num_entries,
890 struct ib_wc *wc);
891 int (*peek_cq)(struct ib_cq *cq, int wc_cnt);
892 int (*req_notify_cq)(struct ib_cq *cq,
893 enum ib_cq_notify cq_notify);
894 int (*req_ncomp_notif)(struct ib_cq *cq,
895 int wc_cnt);
896 struct ib_mr * (*get_dma_mr)(struct ib_pd *pd,
897 int mr_access_flags);
898 struct ib_mr * (*reg_phys_mr)(struct ib_pd *pd,
899 struct ib_phys_buf *phys_buf_array,
900 int num_phys_buf,
901 int mr_access_flags,
902 u64 *iova_start);
903 struct ib_mr * (*reg_user_mr)(struct ib_pd *pd,
904 struct ib_umem *region,
905 int mr_access_flags,
906 struct ib_udata *udata);
907 int (*query_mr)(struct ib_mr *mr,
908 struct ib_mr_attr *mr_attr);
909 int (*dereg_mr)(struct ib_mr *mr);
910 int (*rereg_phys_mr)(struct ib_mr *mr,
911 int mr_rereg_mask,
912 struct ib_pd *pd,
913 struct ib_phys_buf *phys_buf_array,
914 int num_phys_buf,
915 int mr_access_flags,
916 u64 *iova_start);
917 struct ib_mw * (*alloc_mw)(struct ib_pd *pd);
918 int (*bind_mw)(struct ib_qp *qp,
919 struct ib_mw *mw,
920 struct ib_mw_bind *mw_bind);
921 int (*dealloc_mw)(struct ib_mw *mw);
922 struct ib_fmr * (*alloc_fmr)(struct ib_pd *pd,
923 int mr_access_flags,
924 struct ib_fmr_attr *fmr_attr);
925 int (*map_phys_fmr)(struct ib_fmr *fmr,
926 u64 *page_list, int list_len,
927 u64 iova);
928 int (*unmap_fmr)(struct list_head *fmr_list);
929 int (*dealloc_fmr)(struct ib_fmr *fmr);
930 int (*attach_mcast)(struct ib_qp *qp,
931 union ib_gid *gid,
932 u16 lid);
933 int (*detach_mcast)(struct ib_qp *qp,
934 union ib_gid *gid,
935 u16 lid);
936 int (*process_mad)(struct ib_device *device,
937 int process_mad_flags,
938 u8 port_num,
939 struct ib_wc *in_wc,
940 struct ib_grh *in_grh,
941 struct ib_mad *in_mad,
942 struct ib_mad *out_mad);
943
944 struct module *owner;
945 struct class_device class_dev;
946 struct kobject ports_parent;
947 struct list_head port_list;
948
949 enum {
950 IB_DEV_UNINITIALIZED,
951 IB_DEV_REGISTERED,
952 IB_DEV_UNREGISTERED
953 } reg_state;
954
955 u8 node_type;
956 u8 phys_port_cnt;
957};
958
959struct ib_client {
960 char *name;
961 void (*add) (struct ib_device *);
962 void (*remove)(struct ib_device *);
963
964 struct list_head list;
965};
966
967struct ib_device *ib_alloc_device(size_t size);
968void ib_dealloc_device(struct ib_device *device);
969
970int ib_register_device (struct ib_device *device);
971void ib_unregister_device(struct ib_device *device);
972
973int ib_register_client (struct ib_client *client);
974void ib_unregister_client(struct ib_client *client);
975
976void *ib_get_client_data(struct ib_device *device, struct ib_client *client);
977void ib_set_client_data(struct ib_device *device, struct ib_client *client,
978 void *data);
979
980static inline int ib_copy_from_udata(void *dest, struct ib_udata *udata, size_t len)
981{
982 return copy_from_user(dest, udata->inbuf, len) ? -EFAULT : 0;
983}
984
985static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len)
986{
987 return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0;
988}
989
990int ib_register_event_handler (struct ib_event_handler *event_handler);
991int ib_unregister_event_handler(struct ib_event_handler *event_handler);
992void ib_dispatch_event(struct ib_event *event);
993
994int ib_query_device(struct ib_device *device,
995 struct ib_device_attr *device_attr);
996
997int ib_query_port(struct ib_device *device,
998 u8 port_num, struct ib_port_attr *port_attr);
999
1000int ib_query_gid(struct ib_device *device,
1001 u8 port_num, int index, union ib_gid *gid);
1002
1003int ib_query_pkey(struct ib_device *device,
1004 u8 port_num, u16 index, u16 *pkey);
1005
1006int ib_modify_device(struct ib_device *device,
1007 int device_modify_mask,
1008 struct ib_device_modify *device_modify);
1009
1010int ib_modify_port(struct ib_device *device,
1011 u8 port_num, int port_modify_mask,
1012 struct ib_port_modify *port_modify);
1013
1014/**
1015 * ib_alloc_pd - Allocates an unused protection domain.
1016 * @device: The device on which to allocate the protection domain.
1017 *
1018 * A protection domain object provides an association between QPs, shared
1019 * receive queues, address handles, memory regions, and memory windows.
1020 */
1021struct ib_pd *ib_alloc_pd(struct ib_device *device);
1022
1023/**
1024 * ib_dealloc_pd - Deallocates a protection domain.
1025 * @pd: The protection domain to deallocate.
1026 */
1027int ib_dealloc_pd(struct ib_pd *pd);
1028
1029/**
1030 * ib_create_ah - Creates an address handle for the given address vector.
1031 * @pd: The protection domain associated with the address handle.
1032 * @ah_attr: The attributes of the address vector.
1033 *
1034 * The address handle is used to reference a local or global destination
1035 * in all UD QP post sends.
1036 */
1037struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
1038
1039/**
1040 * ib_create_ah_from_wc - Creates an address handle associated with the
1041 * sender of the specified work completion.
1042 * @pd: The protection domain associated with the address handle.
1043 * @wc: Work completion information associated with a received message.
1044 * @grh: References the received global route header. This parameter is
1045 * ignored unless the work completion indicates that the GRH is valid.
1046 * @port_num: The outbound port number to associate with the address.
1047 *
1048 * The address handle is used to reference a local or global destination
1049 * in all UD QP post sends.
1050 */
1051struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, struct ib_wc *wc,
1052 struct ib_grh *grh, u8 port_num);
1053
1054/**
1055 * ib_modify_ah - Modifies the address vector associated with an address
1056 * handle.
1057 * @ah: The address handle to modify.
1058 * @ah_attr: The new address vector attributes to associate with the
1059 * address handle.
1060 */
1061int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
1062
1063/**
1064 * ib_query_ah - Queries the address vector associated with an address
1065 * handle.
1066 * @ah: The address handle to query.
1067 * @ah_attr: The address vector attributes associated with the address
1068 * handle.
1069 */
1070int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
1071
1072/**
1073 * ib_destroy_ah - Destroys an address handle.
1074 * @ah: The address handle to destroy.
1075 */
1076int ib_destroy_ah(struct ib_ah *ah);
1077
1078/**
1079 * ib_create_srq - Creates a SRQ associated with the specified protection
1080 * domain.
1081 * @pd: The protection domain associated with the SRQ.
1082 * @srq_init_attr: A list of initial attributes required to create the SRQ.
1083 *
1084 * srq_attr->max_wr and srq_attr->max_sge are read the determine the
1085 * requested size of the SRQ, and set to the actual values allocated
1086 * on return. If ib_create_srq() succeeds, then max_wr and max_sge
1087 * will always be at least as large as the requested values.
1088 */
1089struct ib_srq *ib_create_srq(struct ib_pd *pd,
1090 struct ib_srq_init_attr *srq_init_attr);
1091
1092/**
1093 * ib_modify_srq - Modifies the attributes for the specified SRQ.
1094 * @srq: The SRQ to modify.
1095 * @srq_attr: On input, specifies the SRQ attributes to modify. On output,
1096 * the current values of selected SRQ attributes are returned.
1097 * @srq_attr_mask: A bit-mask used to specify which attributes of the SRQ
1098 * are being modified.
1099 *
1100 * The mask may contain IB_SRQ_MAX_WR to resize the SRQ and/or
1101 * IB_SRQ_LIMIT to set the SRQ's limit and request notification when
1102 * the number of receives queued drops below the limit.
1103 */
1104int ib_modify_srq(struct ib_srq *srq,
1105 struct ib_srq_attr *srq_attr,
1106 enum ib_srq_attr_mask srq_attr_mask);
1107
1108/**
1109 * ib_query_srq - Returns the attribute list and current values for the
1110 * specified SRQ.
1111 * @srq: The SRQ to query.
1112 * @srq_attr: The attributes of the specified SRQ.
1113 */
1114int ib_query_srq(struct ib_srq *srq,
1115 struct ib_srq_attr *srq_attr);
1116
1117/**
1118 * ib_destroy_srq - Destroys the specified SRQ.
1119 * @srq: The SRQ to destroy.
1120 */
1121int ib_destroy_srq(struct ib_srq *srq);
1122
1123/**
1124 * ib_post_srq_recv - Posts a list of work requests to the specified SRQ.
1125 * @srq: The SRQ to post the work request on.
1126 * @recv_wr: A list of work requests to post on the receive queue.
1127 * @bad_recv_wr: On an immediate failure, this parameter will reference
1128 * the work request that failed to be posted on the QP.
1129 */
1130static inline int ib_post_srq_recv(struct ib_srq *srq,
1131 struct ib_recv_wr *recv_wr,
1132 struct ib_recv_wr **bad_recv_wr)
1133{
1134 return srq->device->post_srq_recv(srq, recv_wr, bad_recv_wr);
1135}
1136
1137/**
1138 * ib_create_qp - Creates a QP associated with the specified protection
1139 * domain.
1140 * @pd: The protection domain associated with the QP.
1141 * @qp_init_attr: A list of initial attributes required to create the QP.
1142 */
1143struct ib_qp *ib_create_qp(struct ib_pd *pd,
1144 struct ib_qp_init_attr *qp_init_attr);
1145
1146/**
1147 * ib_modify_qp - Modifies the attributes for the specified QP and then
1148 * transitions the QP to the given state.
1149 * @qp: The QP to modify.
1150 * @qp_attr: On input, specifies the QP attributes to modify. On output,
1151 * the current values of selected QP attributes are returned.
1152 * @qp_attr_mask: A bit-mask used to specify which attributes of the QP
1153 * are being modified.
1154 */
1155int ib_modify_qp(struct ib_qp *qp,
1156 struct ib_qp_attr *qp_attr,
1157 int qp_attr_mask);
1158
1159/**
1160 * ib_query_qp - Returns the attribute list and current values for the
1161 * specified QP.
1162 * @qp: The QP to query.
1163 * @qp_attr: The attributes of the specified QP.
1164 * @qp_attr_mask: A bit-mask used to select specific attributes to query.
1165 * @qp_init_attr: Additional attributes of the selected QP.
1166 *
1167 * The qp_attr_mask may be used to limit the query to gathering only the
1168 * selected attributes.
1169 */
1170int ib_query_qp(struct ib_qp *qp,
1171 struct ib_qp_attr *qp_attr,
1172 int qp_attr_mask,
1173 struct ib_qp_init_attr *qp_init_attr);
1174
1175/**
1176 * ib_destroy_qp - Destroys the specified QP.
1177 * @qp: The QP to destroy.
1178 */
1179int ib_destroy_qp(struct ib_qp *qp);
1180
1181/**
1182 * ib_post_send - Posts a list of work requests to the send queue of
1183 * the specified QP.
1184 * @qp: The QP to post the work request on.
1185 * @send_wr: A list of work requests to post on the send queue.
1186 * @bad_send_wr: On an immediate failure, this parameter will reference
1187 * the work request that failed to be posted on the QP.
1188 */
1189static inline int ib_post_send(struct ib_qp *qp,
1190 struct ib_send_wr *send_wr,
1191 struct ib_send_wr **bad_send_wr)
1192{
1193 return qp->device->post_send(qp, send_wr, bad_send_wr);
1194}
1195
1196/**
1197 * ib_post_recv - Posts a list of work requests to the receive queue of
1198 * the specified QP.
1199 * @qp: The QP to post the work request on.
1200 * @recv_wr: A list of work requests to post on the receive queue.
1201 * @bad_recv_wr: On an immediate failure, this parameter will reference
1202 * the work request that failed to be posted on the QP.
1203 */
1204static inline int ib_post_recv(struct ib_qp *qp,
1205 struct ib_recv_wr *recv_wr,
1206 struct ib_recv_wr **bad_recv_wr)
1207{
1208 return qp->device->post_recv(qp, recv_wr, bad_recv_wr);
1209}
1210
1211/**
1212 * ib_create_cq - Creates a CQ on the specified device.
1213 * @device: The device on which to create the CQ.
1214 * @comp_handler: A user-specified callback that is invoked when a
1215 * completion event occurs on the CQ.
1216 * @event_handler: A user-specified callback that is invoked when an
1217 * asynchronous event not associated with a completion occurs on the CQ.
1218 * @cq_context: Context associated with the CQ returned to the user via
1219 * the associated completion and event handlers.
1220 * @cqe: The minimum size of the CQ.
1221 *
1222 * Users can examine the cq structure to determine the actual CQ size.
1223 */
1224struct ib_cq *ib_create_cq(struct ib_device *device,
1225 ib_comp_handler comp_handler,
1226 void (*event_handler)(struct ib_event *, void *),
1227 void *cq_context, int cqe);
1228
1229/**
1230 * ib_resize_cq - Modifies the capacity of the CQ.
1231 * @cq: The CQ to resize.
1232 * @cqe: The minimum size of the CQ.
1233 *
1234 * Users can examine the cq structure to determine the actual CQ size.
1235 */
1236int ib_resize_cq(struct ib_cq *cq, int cqe);
1237
1238/**
1239 * ib_destroy_cq - Destroys the specified CQ.
1240 * @cq: The CQ to destroy.
1241 */
1242int ib_destroy_cq(struct ib_cq *cq);
1243
1244/**
1245 * ib_poll_cq - poll a CQ for completion(s)
1246 * @cq:the CQ being polled
1247 * @num_entries:maximum number of completions to return
1248 * @wc:array of at least @num_entries &struct ib_wc where completions
1249 * will be returned
1250 *
1251 * Poll a CQ for (possibly multiple) completions. If the return value
1252 * is < 0, an error occurred. If the return value is >= 0, it is the
1253 * number of completions returned. If the return value is
1254 * non-negative and < num_entries, then the CQ was emptied.
1255 */
1256static inline int ib_poll_cq(struct ib_cq *cq, int num_entries,
1257 struct ib_wc *wc)
1258{
1259 return cq->device->poll_cq(cq, num_entries, wc);
1260}
1261
1262/**
1263 * ib_peek_cq - Returns the number of unreaped completions currently
1264 * on the specified CQ.
1265 * @cq: The CQ to peek.
1266 * @wc_cnt: A minimum number of unreaped completions to check for.
1267 *
1268 * If the number of unreaped completions is greater than or equal to wc_cnt,
1269 * this function returns wc_cnt, otherwise, it returns the actual number of
1270 * unreaped completions.
1271 */
1272int ib_peek_cq(struct ib_cq *cq, int wc_cnt);
1273
1274/**
1275 * ib_req_notify_cq - Request completion notification on a CQ.
1276 * @cq: The CQ to generate an event for.
1277 * @cq_notify: If set to %IB_CQ_SOLICITED, completion notification will
1278 * occur on the next solicited event. If set to %IB_CQ_NEXT_COMP,
1279 * notification will occur on the next completion.
1280 */
1281static inline int ib_req_notify_cq(struct ib_cq *cq,
1282 enum ib_cq_notify cq_notify)
1283{
1284 return cq->device->req_notify_cq(cq, cq_notify);
1285}
1286
1287/**
1288 * ib_req_ncomp_notif - Request completion notification when there are
1289 * at least the specified number of unreaped completions on the CQ.
1290 * @cq: The CQ to generate an event for.
1291 * @wc_cnt: The number of unreaped completions that should be on the
1292 * CQ before an event is generated.
1293 */
1294static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt)
1295{
1296 return cq->device->req_ncomp_notif ?
1297 cq->device->req_ncomp_notif(cq, wc_cnt) :
1298 -ENOSYS;
1299}
1300
1301/**
1302 * ib_get_dma_mr - Returns a memory region for system memory that is
1303 * usable for DMA.
1304 * @pd: The protection domain associated with the memory region.
1305 * @mr_access_flags: Specifies the memory access rights.
1306 */
1307struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
1308
1309/**
1310 * ib_reg_phys_mr - Prepares a virtually addressed memory region for use
1311 * by an HCA.
1312 * @pd: The protection domain associated assigned to the registered region.
1313 * @phys_buf_array: Specifies a list of physical buffers to use in the
1314 * memory region.
1315 * @num_phys_buf: Specifies the size of the phys_buf_array.
1316 * @mr_access_flags: Specifies the memory access rights.
1317 * @iova_start: The offset of the region's starting I/O virtual address.
1318 */
1319struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd,
1320 struct ib_phys_buf *phys_buf_array,
1321 int num_phys_buf,
1322 int mr_access_flags,
1323 u64 *iova_start);
1324
1325/**
1326 * ib_rereg_phys_mr - Modifies the attributes of an existing memory region.
1327 * Conceptually, this call performs the functions deregister memory region
1328 * followed by register physical memory region. Where possible,
1329 * resources are reused instead of deallocated and reallocated.
1330 * @mr: The memory region to modify.
1331 * @mr_rereg_mask: A bit-mask used to indicate which of the following
1332 * properties of the memory region are being modified.
1333 * @pd: If %IB_MR_REREG_PD is set in mr_rereg_mask, this field specifies
1334 * the new protection domain to associated with the memory region,
1335 * otherwise, this parameter is ignored.
1336 * @phys_buf_array: If %IB_MR_REREG_TRANS is set in mr_rereg_mask, this
1337 * field specifies a list of physical buffers to use in the new
1338 * translation, otherwise, this parameter is ignored.
1339 * @num_phys_buf: If %IB_MR_REREG_TRANS is set in mr_rereg_mask, this
1340 * field specifies the size of the phys_buf_array, otherwise, this
1341 * parameter is ignored.
1342 * @mr_access_flags: If %IB_MR_REREG_ACCESS is set in mr_rereg_mask, this
1343 * field specifies the new memory access rights, otherwise, this
1344 * parameter is ignored.
1345 * @iova_start: The offset of the region's starting I/O virtual address.
1346 */
1347int ib_rereg_phys_mr(struct ib_mr *mr,
1348 int mr_rereg_mask,
1349 struct ib_pd *pd,
1350 struct ib_phys_buf *phys_buf_array,
1351 int num_phys_buf,
1352 int mr_access_flags,
1353 u64 *iova_start);
1354
1355/**
1356 * ib_query_mr - Retrieves information about a specific memory region.
1357 * @mr: The memory region to retrieve information about.
1358 * @mr_attr: The attributes of the specified memory region.
1359 */
1360int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
1361
1362/**
1363 * ib_dereg_mr - Deregisters a memory region and removes it from the
1364 * HCA translation table.
1365 * @mr: The memory region to deregister.
1366 */
1367int ib_dereg_mr(struct ib_mr *mr);
1368
1369/**
1370 * ib_alloc_mw - Allocates a memory window.
1371 * @pd: The protection domain associated with the memory window.
1372 */
1373struct ib_mw *ib_alloc_mw(struct ib_pd *pd);
1374
1375/**
1376 * ib_bind_mw - Posts a work request to the send queue of the specified
1377 * QP, which binds the memory window to the given address range and
1378 * remote access attributes.
1379 * @qp: QP to post the bind work request on.
1380 * @mw: The memory window to bind.
1381 * @mw_bind: Specifies information about the memory window, including
1382 * its address range, remote access rights, and associated memory region.
1383 */
1384static inline int ib_bind_mw(struct ib_qp *qp,
1385 struct ib_mw *mw,
1386 struct ib_mw_bind *mw_bind)
1387{
1388 /* XXX reference counting in corresponding MR? */
1389 return mw->device->bind_mw ?
1390 mw->device->bind_mw(qp, mw, mw_bind) :
1391 -ENOSYS;
1392}
1393
1394/**
1395 * ib_dealloc_mw - Deallocates a memory window.
1396 * @mw: The memory window to deallocate.
1397 */
1398int ib_dealloc_mw(struct ib_mw *mw);
1399
1400/**
1401 * ib_alloc_fmr - Allocates a unmapped fast memory region.
1402 * @pd: The protection domain associated with the unmapped region.
1403 * @mr_access_flags: Specifies the memory access rights.
1404 * @fmr_attr: Attributes of the unmapped region.
1405 *
1406 * A fast memory region must be mapped before it can be used as part of
1407 * a work request.
1408 */
1409struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd,
1410 int mr_access_flags,
1411 struct ib_fmr_attr *fmr_attr);
1412
1413/**
1414 * ib_map_phys_fmr - Maps a list of physical pages to a fast memory region.
1415 * @fmr: The fast memory region to associate with the pages.
1416 * @page_list: An array of physical pages to map to the fast memory region.
1417 * @list_len: The number of pages in page_list.
1418 * @iova: The I/O virtual address to use with the mapped region.
1419 */
1420static inline int ib_map_phys_fmr(struct ib_fmr *fmr,
1421 u64 *page_list, int list_len,
1422 u64 iova)
1423{
1424 return fmr->device->map_phys_fmr(fmr, page_list, list_len, iova);
1425}
1426
1427/**
1428 * ib_unmap_fmr - Removes the mapping from a list of fast memory regions.
1429 * @fmr_list: A linked list of fast memory regions to unmap.
1430 */
1431int ib_unmap_fmr(struct list_head *fmr_list);
1432
1433/**
1434 * ib_dealloc_fmr - Deallocates a fast memory region.
1435 * @fmr: The fast memory region to deallocate.
1436 */
1437int ib_dealloc_fmr(struct ib_fmr *fmr);
1438
1439/**
1440 * ib_attach_mcast - Attaches the specified QP to a multicast group.
1441 * @qp: QP to attach to the multicast group. The QP must be type
1442 * IB_QPT_UD.
1443 * @gid: Multicast group GID.
1444 * @lid: Multicast group LID in host byte order.
1445 *
1446 * In order to send and receive multicast packets, subnet
1447 * administration must have created the multicast group and configured
1448 * the fabric appropriately. The port associated with the specified
1449 * QP must also be a member of the multicast group.
1450 */
1451int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
1452
1453/**
1454 * ib_detach_mcast - Detaches the specified QP from a multicast group.
1455 * @qp: QP to detach from the multicast group.
1456 * @gid: Multicast group GID.
1457 * @lid: Multicast group LID in host byte order.
1458 */
1459int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
1460
1461#endif /* IB_VERBS_H */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 9957f16dcc5d..bed4b7c9be99 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -51,12 +51,16 @@ struct scsi_cmnd {
51 * printk's to use ->pid, so that we can kill this field. 51 * printk's to use ->pid, so that we can kill this field.
52 */ 52 */
53 unsigned long serial_number; 53 unsigned long serial_number;
54 /*
55 * This is set to jiffies as it was when the command was first
56 * allocated. It is used to time how long the command has
57 * been outstanding
58 */
59 unsigned long jiffies_at_alloc;
54 60
55 int retries; 61 int retries;
56 int allowed; 62 int allowed;
57 int timeout_per_command; 63 int timeout_per_command;
58 int timeout_total;
59 int timeout;
60 64
61 unsigned char cmd_len; 65 unsigned char cmd_len;
62 unsigned char old_cmd_len; 66 unsigned char old_cmd_len;
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 12e90934a7a8..b090a11d7e1c 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -3,8 +3,10 @@
3 3
4struct scsi_cmnd; 4struct scsi_cmnd;
5struct scsi_request; 5struct scsi_request;
6struct scsi_sense_hdr;
6 7
7extern void scsi_print_command(struct scsi_cmnd *); 8extern void scsi_print_command(struct scsi_cmnd *);
9extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
8extern void __scsi_print_command(unsigned char *); 10extern void __scsi_print_command(unsigned char *);
9extern void scsi_print_sense(const char *, struct scsi_cmnd *); 11extern void scsi_print_sense(const char *, struct scsi_cmnd *);
10extern void scsi_print_req_sense(const char *, struct scsi_request *); 12extern void scsi_print_req_sense(const char *, struct scsi_request *);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 835af8ecbb7c..da63722c0123 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -8,8 +8,17 @@
8 8
9struct request_queue; 9struct request_queue;
10struct scsi_cmnd; 10struct scsi_cmnd;
11struct scsi_mode_data;
12struct scsi_lun; 11struct scsi_lun;
12struct scsi_sense_hdr;
13
14struct scsi_mode_data {
15 __u32 length;
16 __u16 block_descriptor_length;
17 __u8 medium_type;
18 __u8 device_specific;
19 __u8 header_length;
20 __u8 longlba:1;
21};
13 22
14/* 23/*
15 * sdev state: If you alter this, you also need to alter scsi_sysfs.c 24 * sdev state: If you alter this, you also need to alter scsi_sysfs.c
@@ -228,7 +237,8 @@ extern int scsi_set_medium_removal(struct scsi_device *, char);
228 237
229extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, 238extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
230 unsigned char *buffer, int len, int timeout, 239 unsigned char *buffer, int len, int timeout,
231 int retries, struct scsi_mode_data *data); 240 int retries, struct scsi_mode_data *data,
241 struct scsi_sense_hdr *);
232extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, 242extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
233 int retries); 243 int retries);
234extern int scsi_device_set_state(struct scsi_device *sdev, 244extern int scsi_device_set_state(struct scsi_device *sdev,
@@ -247,6 +257,14 @@ extern void int_to_scsilun(unsigned int, struct scsi_lun *);
247extern const char *scsi_device_state_name(enum scsi_device_state); 257extern const char *scsi_device_state_name(enum scsi_device_state);
248extern int scsi_is_sdev_device(const struct device *); 258extern int scsi_is_sdev_device(const struct device *);
249extern int scsi_is_target_device(const struct device *); 259extern int scsi_is_target_device(const struct device *);
260extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
261 int data_direction, void *buffer, unsigned bufflen,
262 unsigned char *sense, int timeout, int retries,
263 int flag);
264extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
265 int data_direction, void *buffer, unsigned bufflen,
266 struct scsi_sense_hdr *, int timeout, int retries);
267
250static inline int scsi_device_online(struct scsi_device *sdev) 268static inline int scsi_device_online(struct scsi_device *sdev)
251{ 269{
252 return sdev->sdev_state != SDEV_OFFLINE; 270 return sdev->sdev_state != SDEV_OFFLINE;
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 80557f879e3e..fabd879c2f2e 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -26,10 +26,15 @@ struct scsi_sense_hdr { /* See SPC-3 section 4.5 */
26 u8 additional_length; /* always 0 for fixed sense format */ 26 u8 additional_length; /* always 0 for fixed sense format */
27}; 27};
28 28
29static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr)
30{
31 if (!sshdr)
32 return 0;
33
34 return (sshdr->response_code & 0x70) == 0x70;
35}
36
29 37
30extern void scsi_add_timer(struct scsi_cmnd *, int,
31 void (*)(struct scsi_cmnd *));
32extern int scsi_delete_timer(struct scsi_cmnd *);
33extern void scsi_report_bus_reset(struct Scsi_Host *, int); 38extern void scsi_report_bus_reset(struct Scsi_Host *, int);
34extern void scsi_report_device_reset(struct Scsi_Host *, int, int); 39extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
35extern int scsi_block_when_processing_errors(struct scsi_device *); 40extern int scsi_block_when_processing_errors(struct scsi_device *);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 81d5234f6771..916144be208b 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -429,12 +429,15 @@ struct scsi_host_template {
429}; 429};
430 430
431/* 431/*
432 * shost states 432 * shost state: If you alter this, you also need to alter scsi_sysfs.c
433 * (for the ascii descriptions) and the state model enforcer:
434 * scsi_host_set_state()
433 */ 435 */
434enum { 436enum scsi_host_state {
435 SHOST_ADD, 437 SHOST_CREATED = 1,
436 SHOST_DEL, 438 SHOST_RUNNING,
437 SHOST_CANCEL, 439 SHOST_CANCEL,
440 SHOST_DEL,
438 SHOST_RECOVERY, 441 SHOST_RECOVERY,
439}; 442};
440 443
@@ -464,12 +467,10 @@ struct Scsi_Host {
464 struct task_struct * ehandler; /* Error recovery thread. */ 467 struct task_struct * ehandler; /* Error recovery thread. */
465 struct semaphore * eh_wait; /* The error recovery thread waits 468 struct semaphore * eh_wait; /* The error recovery thread waits
466 on this. */ 469 on this. */
467 struct completion * eh_notify; /* wait for eh to begin or end */
468 struct semaphore * eh_action; /* Wait for specific actions on the 470 struct semaphore * eh_action; /* Wait for specific actions on the
469 host. */ 471 host. */
470 unsigned int eh_active:1; /* Indicates the eh thread is awake and active if 472 unsigned int eh_active:1; /* Indicates the eh thread is awake and active if
471 this is true. */ 473 this is true. */
472 unsigned int eh_kill:1; /* set when killing the eh thread */
473 wait_queue_head_t host_wait; 474 wait_queue_head_t host_wait;
474 struct scsi_host_template *hostt; 475 struct scsi_host_template *hostt;
475 struct scsi_transport_template *transportt; 476 struct scsi_transport_template *transportt;
@@ -575,7 +576,7 @@ struct Scsi_Host {
575 unsigned int irq; 576 unsigned int irq;
576 577
577 578
578 unsigned long shost_state; 579 enum scsi_host_state shost_state;
579 580
580 /* ldm bits */ 581 /* ldm bits */
581 struct device shost_gendev; 582 struct device shost_gendev;
@@ -633,6 +634,7 @@ extern void scsi_remove_host(struct Scsi_Host *);
633extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); 634extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
634extern void scsi_host_put(struct Scsi_Host *t); 635extern void scsi_host_put(struct Scsi_Host *t);
635extern struct Scsi_Host *scsi_host_lookup(unsigned short); 636extern struct Scsi_Host *scsi_host_lookup(unsigned short);
637extern const char *scsi_host_state_name(enum scsi_host_state);
636 638
637extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 639extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
638 640
@@ -646,6 +648,15 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost)
646 return shost->shost_gendev.parent; 648 return shost->shost_gendev.parent;
647} 649}
648 650
651/**
652 * scsi_host_scan_allowed - Is scanning of this host allowed
653 * @shost: Pointer to Scsi_Host.
654 **/
655static inline int scsi_host_scan_allowed(struct Scsi_Host *shost)
656{
657 return shost->shost_state == SHOST_RUNNING;
658}
659
649extern void scsi_unblock_requests(struct Scsi_Host *); 660extern void scsi_unblock_requests(struct Scsi_Host *);
650extern void scsi_block_requests(struct Scsi_Host *); 661extern void scsi_block_requests(struct Scsi_Host *);
651 662
@@ -663,5 +674,6 @@ extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *);
663/* legacy interfaces */ 674/* legacy interfaces */
664extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); 675extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int);
665extern void scsi_unregister(struct Scsi_Host *); 676extern void scsi_unregister(struct Scsi_Host *);
677extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state);
666 678
667#endif /* _SCSI_SCSI_HOST_H */ 679#endif /* _SCSI_SCSI_HOST_H */
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h
index 98719407d554..6a140020d7cb 100644
--- a/include/scsi/scsi_request.h
+++ b/include/scsi/scsi_request.h
@@ -54,20 +54,4 @@ extern void scsi_do_req(struct scsi_request *, const void *cmnd,
54 void *buffer, unsigned bufflen, 54 void *buffer, unsigned bufflen,
55 void (*done) (struct scsi_cmnd *), 55 void (*done) (struct scsi_cmnd *),
56 int timeout, int retries); 56 int timeout, int retries);
57
58struct scsi_mode_data {
59 __u32 length;
60 __u16 block_descriptor_length;
61 __u8 medium_type;
62 __u8 device_specific;
63 __u8 header_length;
64 __u8 longlba:1;
65};
66
67extern int __scsi_mode_sense(struct scsi_request *SRpnt, int dbd,
68 int modepage, unsigned char *buffer, int len,
69 int timeout, int retries,
70 struct scsi_mode_data *data);
71
72
73#endif /* _SCSI_SCSI_REQUEST_H */ 57#endif /* _SCSI_SCSI_REQUEST_H */
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index a4f1837a33b1..f6e0bb484c63 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -29,6 +29,14 @@ struct scsi_transport_template {
29 struct transport_container target_attrs; 29 struct transport_container target_attrs;
30 struct transport_container device_attrs; 30 struct transport_container device_attrs;
31 31
32 /*
33 * If set, call target_parent prior to allocating a scsi_target,
34 * so we get the appropriate parent for the target. This function
35 * is required for transports like FC and iSCSI that do not put the
36 * scsi_target under scsi_host.
37 */
38 struct device *(*target_parent)(struct Scsi_Host *, int, uint);
39
32 /* The size of the specific transport attribute structure (a 40 /* The size of the specific transport attribute structure (a
33 * space of this size will be left at the end of the 41 * space of this size will be left at the end of the
34 * scsi_* structure */ 42 * scsi_* structure */
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index a30d6cd4c0e8..6bdc4afb2483 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -39,6 +39,7 @@ struct spi_transport_attrs {
39 unsigned int rd_strm:1; /* Read streaming enabled */ 39 unsigned int rd_strm:1; /* Read streaming enabled */
40 unsigned int rti:1; /* Retain Training Information */ 40 unsigned int rti:1; /* Retain Training Information */
41 unsigned int pcomp_en:1;/* Precompensation enabled */ 41 unsigned int pcomp_en:1;/* Precompensation enabled */
42 unsigned int hold_mcs:1;/* Hold Margin Control Settings */
42 unsigned int initial_dv:1; /* DV done to this target yet */ 43 unsigned int initial_dv:1; /* DV done to this target yet */
43 unsigned long flags; /* flags field for drivers to use */ 44 unsigned long flags; /* flags field for drivers to use */
44 /* Device Properties fields */ 45 /* Device Properties fields */
@@ -78,6 +79,7 @@ struct spi_host_attrs {
78#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) 79#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm)
79#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) 80#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti)
80#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en) 81#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en)
82#define spi_hold_mcs(x) (((struct spi_transport_attrs *)&(x)->starget_data)->hold_mcs)
81#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv) 83#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv)
82 84
83#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync) 85#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync)
@@ -114,8 +116,11 @@ struct spi_function_template {
114 void (*set_rti)(struct scsi_target *, int); 116 void (*set_rti)(struct scsi_target *, int);
115 void (*get_pcomp_en)(struct scsi_target *); 117 void (*get_pcomp_en)(struct scsi_target *);
116 void (*set_pcomp_en)(struct scsi_target *, int); 118 void (*set_pcomp_en)(struct scsi_target *, int);
119 void (*get_hold_mcs)(struct scsi_target *);
120 void (*set_hold_mcs)(struct scsi_target *, int);
117 void (*get_signalling)(struct Scsi_Host *); 121 void (*get_signalling)(struct Scsi_Host *);
118 void (*set_signalling)(struct Scsi_Host *, enum spi_signal_type); 122 void (*set_signalling)(struct Scsi_Host *, enum spi_signal_type);
123 int (*deny_binding)(struct scsi_target *);
119 /* The driver sets these to tell the transport class it 124 /* The driver sets these to tell the transport class it
120 * wants the attributes displayed in sysfs. If the show_ flag 125 * wants the attributes displayed in sysfs. If the show_ flag
121 * is not set, the attribute will be private to the transport 126 * is not set, the attribute will be private to the transport
@@ -130,6 +135,7 @@ struct spi_function_template {
130 unsigned long show_rd_strm:1; 135 unsigned long show_rd_strm:1;
131 unsigned long show_rti:1; 136 unsigned long show_rti:1;
132 unsigned long show_pcomp_en:1; 137 unsigned long show_pcomp_en:1;
138 unsigned long show_hold_mcs:1;
133}; 139};
134 140
135struct scsi_transport_template *spi_attach_transport(struct spi_function_template *); 141struct scsi_transport_template *spi_attach_transport(struct spi_function_template *);
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 1309c12b8f71..2857cf0472df 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/device.h>
29#include "pcm.h" 30#include "pcm.h"
30#include "control.h" 31#include "control.h"
31#include "info.h" 32#include "info.h"
@@ -374,6 +375,9 @@
374#define AC97_HAS_NO_PC_BEEP (1<<12) /* no PC Beep volume */ 375#define AC97_HAS_NO_PC_BEEP (1<<12) /* no PC Beep volume */
375#define AC97_HAS_NO_VIDEO (1<<13) /* no Video volume */ 376#define AC97_HAS_NO_VIDEO (1<<13) /* no Video volume */
376#define AC97_HAS_NO_CD (1<<14) /* no CD volume */ 377#define AC97_HAS_NO_CD (1<<14) /* no CD volume */
378#define AC97_HAS_NO_MIC (1<<15) /* no MIC volume */
379#define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */
380#define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */
377 381
378/* rates indexes */ 382/* rates indexes */
379#define AC97_RATES_FRONT_DAC 0 383#define AC97_RATES_FRONT_DAC 0
@@ -520,6 +524,7 @@ struct _snd_ac97 {
520 /* jack-sharing info */ 524 /* jack-sharing info */
521 unsigned char indep_surround; 525 unsigned char indep_surround;
522 unsigned char channel_mode; 526 unsigned char channel_mode;
527 struct device dev;
523}; 528};
524 529
525/* conditions */ 530/* conditions */
@@ -599,4 +604,8 @@ struct ac97_enum {
599 unsigned short mask; 604 unsigned short mask;
600 const char **texts; 605 const char **texts;
601}; 606};
607
608/* ad hoc AC97 device driver access */
609extern struct bus_type ac97_bus_type;
610
602#endif /* __SOUND_AC97_CODEC_H */ 611#endif /* __SOUND_AC97_CODEC_H */
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index 395978e375cf..ca2e0e4fa937 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -138,6 +138,7 @@ struct _snd_ad1816a {
138 spinlock_t lock; 138 spinlock_t lock;
139 139
140 unsigned short mode; 140 unsigned short mode;
141 unsigned int clock_freq;
141 142
142 snd_card_t *card; 143 snd_card_t *card;
143 snd_pcm_t *pcm; 144 snd_pcm_t *pcm;
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 9974f83cca44..8e552d627fa5 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -560,7 +560,7 @@ enum {
560 * Timer section - /dev/snd/timer 560 * Timer section - /dev/snd/timer
561 */ 561 */
562 562
563#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4) 563#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
564 564
565enum sndrv_timer_class { 565enum sndrv_timer_class {
566 SNDRV_TIMER_CLASS_NONE = -1, 566 SNDRV_TIMER_CLASS_NONE = -1,
@@ -693,11 +693,15 @@ enum sndrv_timer_event {
693 SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ 693 SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
694 SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ 694 SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
695 SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ 695 SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
696 SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
697 SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
696 /* master timer events for slave timer instances */ 698 /* master timer events for slave timer instances */
697 SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, 699 SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
698 SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, 700 SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
699 SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, 701 SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
700 SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, 702 SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
703 SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
704 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
701}; 705};
702 706
703struct sndrv_timer_tread { 707struct sndrv_timer_tread {
diff --git a/include/sound/core.h b/include/sound/core.h
index 38b357fc8958..3dc41fd5c54d 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -291,12 +291,14 @@ void snd_memory_done(void);
291int snd_memory_info_init(void); 291int snd_memory_info_init(void);
292int snd_memory_info_done(void); 292int snd_memory_info_done(void);
293void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags); 293void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags);
294void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags);
294void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags); 295void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags);
295void snd_hidden_kfree(const void *obj); 296void snd_hidden_kfree(const void *obj);
296void *snd_hidden_vmalloc(unsigned long size); 297void *snd_hidden_vmalloc(unsigned long size);
297void snd_hidden_vfree(void *obj); 298void snd_hidden_vfree(void *obj);
298char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags); 299char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags);
299#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) 300#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
301#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
300#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) 302#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
301#define kfree(obj) snd_hidden_kfree(obj) 303#define kfree(obj) snd_hidden_kfree(obj)
302#define vmalloc(size) snd_hidden_vmalloc(size) 304#define vmalloc(size) snd_hidden_vmalloc(size)
@@ -360,11 +362,13 @@ int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd);
360 362
361/* isadma.c */ 363/* isadma.c */
362 364
365#ifdef CONFIG_ISA_DMA_API
363#define DMA_MODE_NO_ENABLE 0x0100 366#define DMA_MODE_NO_ENABLE 0x0100
364 367
365void snd_dma_program(unsigned long dma, unsigned long addr, unsigned int size, unsigned short mode); 368void snd_dma_program(unsigned long dma, unsigned long addr, unsigned int size, unsigned short mode);
366void snd_dma_disable(unsigned long dma); 369void snd_dma_disable(unsigned long dma);
367unsigned int snd_dma_pointer(unsigned long dma, unsigned int size); 370unsigned int snd_dma_pointer(unsigned long dma, unsigned int size);
371#endif
368 372
369/* misc.c */ 373/* misc.c */
370 374
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 182dd276ee74..9b94510eda60 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1748,7 +1748,7 @@ int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
1748int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1748int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
1749int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1749int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
1750int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1750int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
1751int snd_cs46xx_mixer(cs46xx_t *chip); 1751int snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device);
1752int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi); 1752int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi);
1753int snd_cs46xx_start_dsp(cs46xx_t *chip); 1753int snd_cs46xx_start_dsp(cs46xx_t *chip);
1754int snd_cs46xx_gameport(cs46xx_t *chip); 1754int snd_cs46xx_gameport(cs46xx_t *chip);
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index c2ef3f023687..4e3993dfcefe 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1178,7 +1178,7 @@ int snd_p16v_free(emu10k1_t * emu);
1178int snd_p16v_mixer(emu10k1_t * emu); 1178int snd_p16v_mixer(emu10k1_t * emu);
1179int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1179int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
1180int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1180int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
1181int snd_emu10k1_mixer(emu10k1_t * emu); 1181int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device);
1182int snd_emu10k1_timer(emu10k1_t * emu, int device); 1182int snd_emu10k1_timer(emu10k1_t * emu, int device);
1183int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep); 1183int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep);
1184 1184
diff --git a/include/sound/gus.h b/include/sound/gus.h
index b4b461ca173d..7000d9d9199d 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -512,13 +512,13 @@ extern void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg);
512 512
513extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 513extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data);
514extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg); 514extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg);
515extern inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg) 515static inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg)
516{ 516{
517 return snd_gf1_look8(gus, reg | 0x80); 517 return snd_gf1_look8(gus, reg | 0x80);
518} 518}
519extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 519extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data);
520extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg); 520extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg);
521extern inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg) 521static inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg)
522{ 522{
523 return snd_gf1_look16(gus, reg | 0x80); 523 return snd_gf1_look16(gus, reg | 0x80);
524} 524}
@@ -532,12 +532,12 @@ extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg);
532extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 532extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data);
533extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg); 533extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg);
534extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 534extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data);
535extern inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg) 535static inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg)
536{ 536{
537 return snd_gf1_i_look8(gus, reg | 0x80); 537 return snd_gf1_i_look8(gus, reg | 0x80);
538} 538}
539extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg); 539extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg);
540extern inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg) 540static inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg)
541{ 541{
542 return snd_gf1_i_look16(gus, reg | 0x80); 542 return snd_gf1_i_look16(gus, reg | 0x80);
543} 543}
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index d935417575b5..389e8ebe9c19 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -379,7 +379,6 @@ struct _snd_pcm_substream {
379 unsigned int dma_buf_id; 379 unsigned int dma_buf_id;
380 size_t dma_max; 380 size_t dma_max;
381 /* -- hardware operations -- */ 381 /* -- hardware operations -- */
382 unsigned int open_flag: 1; /* lowlevel device has been opened */
383 snd_pcm_ops_t *ops; 382 snd_pcm_ops_t *ops;
384 /* -- runtime information -- */ 383 /* -- runtime information -- */
385 snd_pcm_runtime_t *runtime; 384 snd_pcm_runtime_t *runtime;
@@ -904,7 +903,7 @@ int snd_pcm_format_unsigned(snd_pcm_format_t format);
904int snd_pcm_format_linear(snd_pcm_format_t format); 903int snd_pcm_format_linear(snd_pcm_format_t format);
905int snd_pcm_format_little_endian(snd_pcm_format_t format); 904int snd_pcm_format_little_endian(snd_pcm_format_t format);
906int snd_pcm_format_big_endian(snd_pcm_format_t format); 905int snd_pcm_format_big_endian(snd_pcm_format_t format);
907/** 906/*
908 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian 907 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
909 * @format: the format to check 908 * @format: the format to check
910 * 909 *
diff --git a/include/sound/version.h b/include/sound/version.h
index c085136f391f..8d19bfabb7e0 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.9b" 2#define CONFIG_SND_VERSION "1.0.10rc1"
3#define CONFIG_SND_DATE " (Thu Jul 28 12:20:13 2005 UTC)" 3#define CONFIG_SND_DATE " (Tue Aug 30 05:31:08 2005 UTC)"
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index 4b570684a6aa..9a3c1e6c820a 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -295,6 +295,7 @@ struct _snd_ymfpci_pcm {
295 unsigned int running: 1; 295 unsigned int running: 1;
296 unsigned int output_front: 1; 296 unsigned int output_front: 1;
297 unsigned int output_rear: 1; 297 unsigned int output_rear: 1;
298 unsigned int update_pcm_vol;
298 u32 period_size; /* cached from runtime->period_size */ 299 u32 period_size; /* cached from runtime->period_size */
299 u32 buffer_size; /* cached from runtime->buffer_size */ 300 u32 buffer_size; /* cached from runtime->buffer_size */
300 u32 period_pos; 301 u32 period_pos;
@@ -367,6 +368,11 @@ struct _snd_ymfpci {
367 int mode_dup4ch; 368 int mode_dup4ch;
368 int rear_opened; 369 int rear_opened;
369 int spdif_opened; 370 int spdif_opened;
371 struct {
372 u16 left;
373 u16 right;
374 snd_kcontrol_t *ctl;
375 } pcm_mixer[32];
370 376
371 spinlock_t reg_lock; 377 spinlock_t reg_lock;
372 spinlock_t voice_lock; 378 spinlock_t voice_lock;
diff --git a/include/video/pmag-ba-fb.h b/include/video/pmag-ba-fb.h
index cebef073b9a3..fceb6c0f6583 100644
--- a/include/video/pmag-ba-fb.h
+++ b/include/video/pmag-ba-fb.h
@@ -1,24 +1,27 @@
1/* 1/*
2 * linux/drivers/video/pmag-ba-fb.h 2 * linux/include/video/pmag-ba-fb.h
3 * 3 *
4 * TurboChannel PMAG-BA framebuffer card support, 4 * TURBOchannel PMAG-BA Color Frame Buffer (CFB) card support,
5 * Copyright (C) 1999,2000,2001 by 5 * Copyright (C) 1999, 2000, 2001 by
6 * Michael Engel <engel@unix-ag.org>, 6 * Michael Engel <engel@unix-ag.org>,
7 * Karsten Merker <merker@linuxtag.org> 7 * Karsten Merker <merker@linuxtag.org>
8 * This file is subject to the terms and conditions of the GNU General 8 * Copyright (c) 2005 Maciej W. Rozycki
9 * Public License. See the file COPYING in the main directory of this 9 *
10 * archive for more details. 10 * This file is subject to the terms and conditions of the GNU General
11 */ 11 * Public License. See the file COPYING in the main directory of this
12 12 * archive for more details.
13/*
14 * Bt459 RAM DAC register base offset (rel. to TC slot base address)
15 */ 13 */
16 14
17#define PMAG_BA_BT459_OFFSET 0x00200000 15/* IOmem resource offsets. */
18 16#define PMAG_BA_FBMEM 0x000000 /* frame buffer */
19/* 17#define PMAG_BA_BT459 0x200000 /* Bt459 RAMDAC */
20 * Begin of PMAG-BA framebuffer memory relative to TC slot address, 18#define PMAG_BA_IRQ 0x300000 /* IRQ acknowledge */
21 * resolution is 1024x864x8 19#define PMAG_BA_ROM 0x380000 /* REX option ROM */
22 */ 20#define PMAG_BA_BT438 0x380000 /* Bt438 clock chip reset */
21#define PMAG_BA_SIZE 0x400000 /* address space size */
23 22
24#define PMAG_BA_ONBOARD_FBMEM_OFFSET 0x00000000 23/* Bt459 register offsets, byte-wide registers. */
24#define BT459_ADDR_LO 0x0 /* address low */
25#define BT459_ADDR_HI 0x4 /* address high */
26#define BT459_DATA 0x8 /* data window register */
27#define BT459_CMAP 0xc /* color map window register */
diff --git a/include/video/pmagb-b-fb.h b/include/video/pmagb-b-fb.h
index 87b81a555139..7539b9087a80 100644
--- a/include/video/pmagb-b-fb.h
+++ b/include/video/pmagb-b-fb.h
@@ -1,32 +1,58 @@
1/* 1/*
2 * linux/drivers/video/pmagb-b-fb.h 2 * linux/include/video/pmagb-b-fb.h
3 * 3 *
4 * TurboChannel PMAGB-B framebuffer card support, 4 * TURBOchannel PMAGB-B Smart Frame Buffer (SFB) card support,
5 * Copyright (C) 1999, 2000, 2001 by 5 * Copyright (C) 1999, 2000, 2001 by
6 * Michael Engel <engel@unix-ag.org> and 6 * Michael Engel <engel@unix-ag.org> and
7 * Karsten Merker <merker@linuxtag.org> 7 * Karsten Merker <merker@linuxtag.org>
8 * This file is subject to the terms and conditions of the GNU General 8 * Copyright (c) 2005 Maciej W. Rozycki
9 * Public License. See the file COPYING in the main directory of this 9 *
10 * archive for more details. 10 * This file is subject to the terms and conditions of the GNU General
11 * Public License. See the file COPYING in the main directory of this
12 * archive for more details.
11 */ 13 */
12 14
15/* IOmem resource offsets. */
16#define PMAGB_B_ROM 0x000000 /* REX option ROM */
17#define PMAGB_B_SFB 0x100000 /* SFB ASIC */
18#define PMAGB_B_GP0 0x140000 /* general purpose output 0 */
19#define PMAGB_B_GP1 0x180000 /* general purpose output 1 */
20#define PMAGB_B_BT459 0x1c0000 /* Bt459 RAMDAC */
21#define PMAGB_B_FBMEM 0x200000 /* frame buffer */
22#define PMAGB_B_SIZE 0x400000 /* address space size */
13 23
14/* 24/* IOmem register offsets. */
15 * Bt459 RAM DAC register base offset (rel. to TC slot base address) 25#define SFB_REG_VID_HOR 0x64 /* video horizontal setup */
16 */ 26#define SFB_REG_VID_VER 0x68 /* video vertical setup */
17#define PMAGB_B_BT459_OFFSET 0x001C0000 27#define SFB_REG_VID_BASE 0x6c /* video base address */
28#define SFB_REG_TCCLK_COUNT 0x78 /* TURBOchannel clock count */
29#define SFB_REG_VIDCLK_COUNT 0x7c /* video clock count */
18 30
19/* 31/* Video horizontal setup register constants. All bits are r/w. */
20 * Begin of PMAGB-B framebuffer memory, resolution is configurable: 32#define SFB_VID_HOR_BP_SHIFT 0x15 /* back porch */
21 * 1024x864x8 or 1280x1024x8, settable by jumper on the card 33#define SFB_VID_HOR_BP_MASK 0x7f
22 */ 34#define SFB_VID_HOR_SYN_SHIFT 0x0e /* sync pulse */
23#define PMAGB_B_ONBOARD_FBMEM_OFFSET 0x00201000 35#define SFB_VID_HOR_SYN_MASK 0x7f
36#define SFB_VID_HOR_FP_SHIFT 0x09 /* front porch */
37#define SFB_VID_HOR_FP_MASK 0x1f
38#define SFB_VID_HOR_PIX_SHIFT 0x00 /* active video */
39#define SFB_VID_HOR_PIX_MASK 0x1ff
24 40
25/* 41/* Video vertical setup register constants. All bits are r/w. */
26 * Bt459 register offsets, byte-wide registers 42#define SFB_VID_VER_BP_SHIFT 0x16 /* back porch */
27 */ 43#define SFB_VID_VER_BP_MASK 0x3f
44#define SFB_VID_VER_SYN_SHIFT 0x10 /* sync pulse */
45#define SFB_VID_VER_SYN_MASK 0x3f
46#define SFB_VID_VER_FP_SHIFT 0x0b /* front porch */
47#define SFB_VID_VER_FP_MASK 0x1f
48#define SFB_VID_VER_SL_SHIFT 0x00 /* active scan lines */
49#define SFB_VID_VER_SL_MASK 0x7ff
50
51/* Video base address register constants. All bits are r/w. */
52#define SFB_VID_BASE_MASK 0x1ff /* video base row address */
28 53
29#define BT459_ADR_LOW BT459_OFFSET + 0x00 /* addr. low */ 54/* Bt459 register offsets, byte-wide registers. */
30#define BT459_ADR_HIGH BT459_OFFSET + 0x04 /* addr. high */ 55#define BT459_ADDR_LO 0x0 /* address low */
31#define BT459_DATA BT459_OFFSET + 0x08 /* r/w data */ 56#define BT459_ADDR_HI 0x4 /* address high */
32#define BT459_CMAP BT459_OFFSET + 0x0C /* color map */ 57#define BT459_DATA 0x8 /* data window register */
58#define BT459_CMAP 0xc /* color map window register */
diff --git a/include/video/w100fb.h b/include/video/w100fb.h
index bd548c2b47c4..e6da2d7ded8c 100644
--- a/include/video/w100fb.h
+++ b/include/video/w100fb.h
@@ -1,21 +1,149 @@
1/* 1/*
2 * Support for the w100 frame buffer. 2 * Support for the w100 frame buffer.
3 * 3 *
4 * Copyright (c) 2004 Richard Purdie 4 * Copyright (c) 2004-2005 Richard Purdie
5 * Copyright (c) 2005 Ian Molton
5 * 6 *
6 * 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
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
9 */ 10 */
10 11
12#define W100_GPIO_PORT_A 0
13#define W100_GPIO_PORT_B 1
14
15#define CLK_SRC_XTAL 0
16#define CLK_SRC_PLL 1
17
18struct w100fb_par;
19
20unsigned long w100fb_gpio_read(int port);
21void w100fb_gpio_write(int port, unsigned long value);
22
23/* LCD Specific Routines and Config */
24struct w100_tg_info {
25 void (*change)(struct w100fb_par*);
26 void (*suspend)(struct w100fb_par*);
27 void (*resume)(struct w100fb_par*);
28};
29
30/* General Platform Specific w100 Register Values */
31struct w100_gen_regs {
32 unsigned long lcd_format;
33 unsigned long lcdd_cntl1;
34 unsigned long lcdd_cntl2;
35 unsigned long genlcd_cntl1;
36 unsigned long genlcd_cntl2;
37 unsigned long genlcd_cntl3;
38};
39
40struct w100_gpio_regs {
41 unsigned long init_data1;
42 unsigned long init_data2;
43 unsigned long gpio_dir1;
44 unsigned long gpio_oe1;
45 unsigned long gpio_dir2;
46 unsigned long gpio_oe2;
47};
48
49/* Optional External Memory Configuration */
50struct w100_mem_info {
51 unsigned long ext_cntl;
52 unsigned long sdram_mode_reg;
53 unsigned long ext_timing_cntl;
54 unsigned long io_cntl;
55 unsigned int size;
56};
57
58struct w100_bm_mem_info {
59 unsigned long ext_mem_bw;
60 unsigned long offset;
61 unsigned long ext_timing_ctl;
62 unsigned long ext_cntl;
63 unsigned long mode_reg;
64 unsigned long io_cntl;
65 unsigned long config;
66};
67
68/* LCD Mode definition */
69struct w100_mode {
70 unsigned int xres;
71 unsigned int yres;
72 unsigned short left_margin;
73 unsigned short right_margin;
74 unsigned short upper_margin;
75 unsigned short lower_margin;
76 unsigned long crtc_ss;
77 unsigned long crtc_ls;
78 unsigned long crtc_gs;
79 unsigned long crtc_vpos_gs;
80 unsigned long crtc_rev;
81 unsigned long crtc_dclk;
82 unsigned long crtc_gclk;
83 unsigned long crtc_goe;
84 unsigned long crtc_ps1_active;
85 char pll_freq;
86 char fast_pll_freq;
87 int sysclk_src;
88 int sysclk_divider;
89 int pixclk_src;
90 int pixclk_divider;
91 int pixclk_divider_rotated;
92};
93
94struct w100_pll_info {
95 uint16_t freq; /* desired Fout for PLL (Mhz) */
96 uint8_t M; /* input divider */
97 uint8_t N_int; /* VCO multiplier */
98 uint8_t N_fac; /* VCO multiplier fractional part */
99 uint8_t tfgoal;
100 uint8_t lock_time;
101};
102
103/* Initial Video mode orientation flags */
104#define INIT_MODE_ROTATED 0x1
105#define INIT_MODE_FLIPPED 0x2
106
11/* 107/*
12 * This structure describes the machine which we are running on. 108 * This structure describes the machine which we are running on.
13 * It is set by machine specific code and used in the probe routine 109 * It is set by machine specific code and used in the probe routine
14 * of drivers/video/w100fb.c 110 * of drivers/video/w100fb.c
15 */ 111 */
16
17struct w100fb_mach_info { 112struct w100fb_mach_info {
18 void (*w100fb_ssp_send)(u8 adrs, u8 data); 113 /* General Platform Specific Registers */
19 int comadj; 114 struct w100_gen_regs *regs;
20 int phadadj; 115 /* Table of modes the LCD is capable of */
116 struct w100_mode *modelist;
117 unsigned int num_modes;
118 /* Hooks for any platform specific tg/lcd code (optional) */
119 struct w100_tg_info *tg;
120 /* External memory definition (if present) */
121 struct w100_mem_info *mem;
122 /* Additional External memory definition (if present) */
123 struct w100_bm_mem_info *bm_mem;
124 /* GPIO definitions (optional) */
125 struct w100_gpio_regs *gpio;
126 /* Initial Mode flags */
127 unsigned int init_mode;
128 /* Xtal Frequency */
129 unsigned int xtal_freq;
130 /* Enable Xtal input doubler (1 == enable) */
131 unsigned int xtal_dbl;
132};
133
134/* General frame buffer data structure */
135struct w100fb_par {
136 unsigned int chip_id;
137 unsigned int xres;
138 unsigned int yres;
139 unsigned int extmem_active;
140 unsigned int flip;
141 unsigned int blanked;
142 unsigned int fastpll_mode;
143 unsigned long hsync_len;
144 struct w100_mode *mode;
145 struct w100_pll_info *pll_table;
146 struct w100fb_mach_info *mach;
147 uint32_t *saved_intmem;
148 uint32_t *saved_extmem;
21}; 149};