aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/processor.h2
-rw-r--r--include/asm-alpha/atomic.h2
-rw-r--r--include/asm-alpha/pci.h1
-rw-r--r--include/asm-alpha/pgalloc.h8
-rw-r--r--include/asm-alpha/socket.h2
-rw-r--r--include/asm-alpha/tlb.h4
-rw-r--r--include/asm-alpha/tlbflush.h7
-rw-r--r--include/asm-alpha/unistd.h1
-rw-r--r--include/asm-arm/arch-at91/at91_mci.h2
-rw-r--r--include/asm-arm/arch-at91/at91rm9200.h5
-rw-r--r--include/asm-arm/arch-at91/at91sam9260.h7
-rw-r--r--include/asm-arm/arch-at91/at91sam9261.h4
-rw-r--r--include/asm-arm/arch-at91/at91sam9263.h4
-rw-r--r--include/asm-arm/arch-at91/at91sam9rl.h5
-rw-r--r--include/asm-arm/arch-at91/board.h3
-rw-r--r--include/asm-arm/arch-at91/uncompress.h32
-rw-r--r--include/asm-arm/arch-ixp4xx/cpu.h15
-rw-r--r--include/asm-arm/arch-ixp4xx/dsmg600.h7
-rw-r--r--include/asm-arm/arch-ixp4xx/hardware.h6
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/ixp4xx-regs.h70
-rw-r--r--include/asm-arm/arch-ixp4xx/nas100d.h18
-rw-r--r--include/asm-arm/arch-ixp4xx/npe.h39
-rw-r--r--include/asm-arm/arch-ixp4xx/nslu2.h21
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h21
-rw-r--r--include/asm-arm/arch-ixp4xx/qmgr.h126
-rw-r--r--include/asm-arm/arch-ixp4xx/uncompress.h2
-rw-r--r--include/asm-arm/arch-omap/eac.h1
-rw-r--r--include/asm-arm/arch-omap/omap-alsa.h1
-rw-r--r--include/asm-arm/arch-pxa/audio.h1
-rw-r--r--include/asm-arm/arch-pxa/gpio.h48
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h47
-rw-r--r--include/asm-arm/arch-pxa/pxa3xx-regs.h13
-rw-r--r--include/asm-arm/arch-realview/board-eb.h171
-rw-r--r--include/asm-arm/arch-realview/entry-macro.S3
-rw-r--r--include/asm-arm/arch-realview/hardware.h1
-rw-r--r--include/asm-arm/arch-realview/irqs.h105
-rw-r--r--include/asm-arm/arch-realview/platform.h170
-rw-r--r--include/asm-arm/arch-realview/scu.h4
-rw-r--r--include/asm-arm/arch-realview/uncompress.h2
-rw-r--r--include/asm-arm/arch-versatile/irqs.h4
-rw-r--r--include/asm-arm/hardware/arm_twd.h7
-rw-r--r--include/asm-arm/hardware/it8152.h2
-rw-r--r--include/asm-arm/kexec.h3
-rw-r--r--include/asm-arm/mach/udc_pxa2xx.h4
-rw-r--r--include/asm-arm/pgalloc.h10
-rw-r--r--include/asm-arm/smp.h21
-rw-r--r--include/asm-arm/socket.h2
-rw-r--r--include/asm-arm/tlb.h4
-rw-r--r--include/asm-avr32/arch-at32ap/at32ap700x.h2
-rw-r--r--include/asm-avr32/arch-at32ap/gpio.h34
-rw-r--r--include/asm-avr32/arch-at32ap/irq.h4
-rw-r--r--include/asm-avr32/pgalloc.h6
-rw-r--r--include/asm-avr32/socket.h2
-rw-r--r--include/asm-avr32/unistd.h2
-rw-r--r--include/asm-blackfin/socket.h3
-rw-r--r--include/asm-cris/bitops.h7
-rw-r--r--include/asm-cris/pgalloc.h6
-rw-r--r--include/asm-cris/socket.h2
-rw-r--r--include/asm-frv/atomic.h2
-rw-r--r--include/asm-frv/bitops.h2
-rw-r--r--include/asm-frv/cacheflush.h2
-rw-r--r--include/asm-frv/dma-mapping.h10
-rw-r--r--include/asm-frv/highmem.h2
-rw-r--r--include/asm-frv/mem-layout.h2
-rw-r--r--include/asm-frv/page.h4
-rw-r--r--include/asm-frv/pgalloc.h8
-rw-r--r--include/asm-frv/pgtable.h4
-rw-r--r--include/asm-frv/scatterlist.h10
-rw-r--r--include/asm-frv/socket.h2
-rw-r--r--include/asm-frv/unistd.h2
-rw-r--r--include/asm-generic/4level-fixup.h2
-rw-r--r--include/asm-generic/gpio.h98
-rw-r--r--include/asm-generic/pgtable-nopmd.h2
-rw-r--r--include/asm-generic/pgtable-nopud.h2
-rw-r--r--include/asm-generic/rtc.h11
-rw-r--r--include/asm-generic/tlb.h2
-rw-r--r--include/asm-h8300/socket.h2
-rw-r--r--include/asm-ia64/bitops.h50
-rw-r--r--include/asm-ia64/compat.h2
-rw-r--r--include/asm-ia64/gcc_intrin.h2
-rw-r--r--include/asm-ia64/mca.h6
-rw-r--r--include/asm-ia64/mca_asm.h3
-rw-r--r--include/asm-ia64/percpu.h35
-rw-r--r--include/asm-ia64/pgalloc.h16
-rw-r--r--include/asm-ia64/processor.h5
-rw-r--r--include/asm-ia64/sal.h14
-rw-r--r--include/asm-ia64/socket.h2
-rw-r--r--include/asm-m32r/irq.h2
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_pld.h4
-rw-r--r--include/asm-m32r/pgalloc.h10
-rw-r--r--include/asm-m32r/socket.h2
-rw-r--r--include/asm-m32r/unistd.h2
-rw-r--r--include/asm-m68k/macintosh.h2
-rw-r--r--include/asm-m68k/motorola_pgalloc.h10
-rw-r--r--include/asm-m68k/socket.h2
-rw-r--r--include/asm-m68k/sun3_pgalloc.h8
-rw-r--r--include/asm-m68knommu/bitops.h2
-rw-r--r--include/asm-m68knommu/cacheflush.h2
-rw-r--r--include/asm-m68knommu/commproc.h2
-rw-r--r--include/asm-m68knommu/delay.h2
-rw-r--r--include/asm-m68knommu/m5249sim.h4
-rw-r--r--include/asm-m68knommu/m5307sim.h12
-rw-r--r--include/asm-m68knommu/m5407sim.h12
-rw-r--r--include/asm-m68knommu/m68360_regs.h2
-rw-r--r--include/asm-m68knommu/mcfcache.h2
-rw-r--r--include/asm-m68knommu/mcfne.h27
-rw-r--r--include/asm-m68knommu/mcfsim.h4
-rw-r--r--include/asm-m68knommu/mcftimer.h2
-rw-r--r--include/asm-m68knommu/mcfuart.h7
-rw-r--r--include/asm-m68knommu/system.h17
-rw-r--r--include/asm-mips/compat.h2
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h1
-rw-r--r--include/asm-mips/mach-excite/excite_fpga.h2
-rw-r--r--include/asm-mips/mach-wrppmc/mach-gt64120.h2
-rw-r--r--include/asm-mips/pgalloc.h12
-rw-r--r--include/asm-mips/processor.h2
-rw-r--r--include/asm-mips/sgi/ip22.h2
-rw-r--r--include/asm-mips/sn/sn0/hubio.h2
-rw-r--r--include/asm-mips/socket.h2
-rw-r--r--include/asm-parisc/compat.h2
-rw-r--r--include/asm-parisc/elf.h2
-rw-r--r--include/asm-parisc/linkage.h2
-rw-r--r--include/asm-parisc/pgalloc.h10
-rw-r--r--include/asm-parisc/processor.h3
-rw-r--r--include/asm-parisc/socket.h2
-rw-r--r--include/asm-parisc/tlb.h4
-rw-r--r--include/asm-parisc/vga.h2
-rw-r--r--include/asm-powerpc/compat.h2
-rw-r--r--include/asm-powerpc/cputable.h2
-rw-r--r--include/asm-powerpc/iommu.h12
-rw-r--r--include/asm-powerpc/mediabay.h8
-rw-r--r--include/asm-powerpc/nvram.h3
-rw-r--r--include/asm-powerpc/oprofile_impl.h2
-rw-r--r--include/asm-powerpc/percpu.h31
-rw-r--r--include/asm-powerpc/pgalloc-32.h10
-rw-r--r--include/asm-powerpc/pgalloc-64.h10
-rw-r--r--include/asm-powerpc/processor.h3
-rw-r--r--include/asm-powerpc/reg.h4
-rw-r--r--include/asm-powerpc/reg_booke.h62
-rw-r--r--include/asm-powerpc/reg_fsl_emb.h72
-rw-r--r--include/asm-powerpc/socket.h2
-rw-r--r--include/asm-powerpc/systbl.h2
-rw-r--r--include/asm-powerpc/vio.h2
-rw-r--r--include/asm-ppc/pgalloc.h10
-rw-r--r--include/asm-s390/bitops.h558
-rw-r--r--include/asm-s390/cacheflush.h4
-rw-r--r--include/asm-s390/ccwgroup.h2
-rw-r--r--include/asm-s390/compat.h2
-rw-r--r--include/asm-s390/percpu.h42
-rw-r--r--include/asm-s390/pgalloc.h14
-rw-r--r--include/asm-s390/pgtable.h12
-rw-r--r--include/asm-s390/processor.h3
-rw-r--r--include/asm-s390/socket.h2
-rw-r--r--include/asm-s390/tlb.h8
-rw-r--r--include/asm-sh/pgalloc.h8
-rw-r--r--include/asm-sh/socket.h2
-rw-r--r--include/asm-sh/unistd_32.h2
-rw-r--r--include/asm-sh/unistd_64.h2
-rw-r--r--include/asm-sparc/pgalloc.h12
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc64/compat.h2
-rw-r--r--include/asm-sparc64/percpu.h22
-rw-r--r--include/asm-sparc64/pgalloc.h8
-rw-r--r--include/asm-sparc64/socket.h1
-rw-r--r--include/asm-sparc64/tlb.h4
-rw-r--r--include/asm-um/a.out.h4
-rw-r--r--include/asm-um/current.h23
-rw-r--r--include/asm-um/elf-i386.h28
-rw-r--r--include/asm-um/elf-x86_64.h8
-rw-r--r--include/asm-um/fixmap.h6
-rw-r--r--include/asm-um/ldt.h4
-rw-r--r--include/asm-um/linkage.h6
-rw-r--r--include/asm-um/mmu_context.h7
-rw-r--r--include/asm-um/page.h6
-rw-r--r--include/asm-um/param.h2
-rw-r--r--include/asm-um/pgalloc.h8
-rw-r--r--include/asm-um/pgtable-2level.h3
-rw-r--r--include/asm-um/pgtable-3level.h35
-rw-r--r--include/asm-um/pgtable.h100
-rw-r--r--include/asm-um/processor-generic.h13
-rw-r--r--include/asm-um/processor-i386.h1
-rw-r--r--include/asm-um/thread_info.h11
-rw-r--r--include/asm-um/tlb.h122
-rw-r--r--include/asm-um/uaccess.h10
-rw-r--r--include/asm-v850/socket.h2
-rw-r--r--include/asm-x86/asm.h7
-rw-r--r--include/asm-x86/bitops_64.h16
-rw-r--r--include/asm-x86/bugs.h2
-rw-r--r--include/asm-x86/compat.h2
-rw-r--r--include/asm-x86/cpu.h3
-rw-r--r--include/asm-x86/cpufeature.h14
-rw-r--r--include/asm-x86/e820_64.h4
-rw-r--r--include/asm-x86/efi.h4
-rw-r--r--include/asm-x86/futex.h29
-rw-r--r--include/asm-x86/highmem.h10
-rw-r--r--include/asm-x86/hw_irq_32.h2
-rw-r--r--include/asm-x86/i387.h16
-rw-r--r--include/asm-x86/io_32.h25
-rw-r--r--include/asm-x86/mach-numaq/mach_apic.h2
-rw-r--r--include/asm-x86/mach-voyager/do_timer.h1
-rw-r--r--include/asm-x86/msr.h10
-rw-r--r--include/asm-x86/page.h4
-rw-r--r--include/asm-x86/page_64.h3
-rw-r--r--include/asm-x86/pgalloc_32.h34
-rw-r--r--include/asm-x86/pgalloc_64.h10
-rw-r--r--include/asm-x86/pgtable-3level.h26
-rw-r--r--include/asm-x86/pgtable.h4
-rw-r--r--include/asm-x86/pgtable_32.h10
-rw-r--r--include/asm-x86/pgtable_64.h7
-rw-r--r--include/asm-x86/socket.h2
-rw-r--r--include/asm-x86/string_32.h8
-rw-r--r--include/asm-x86/system.h23
-rw-r--r--include/asm-x86/thread_info_64.h4
-rw-r--r--include/asm-x86/uaccess_32.h18
-rw-r--r--include/asm-x86/uaccess_64.h10
-rw-r--r--include/asm-x86/unistd_32.h4
-rw-r--r--include/asm-x86/unistd_64.h9
-rw-r--r--include/asm-x86/vm86.h1
-rw-r--r--include/asm-xtensa/pgalloc.h6
-rw-r--r--include/asm-xtensa/socket.h2
-rw-r--r--include/asm-xtensa/tlb.h2
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/agp_backend.h1
-rw-r--r--include/linux/agpgart.h1
-rw-r--r--include/linux/atmel_serial.h127
-rw-r--r--include/linux/audit.h13
-rw-r--r--include/linux/blkdev.h16
-rw-r--r--include/linux/capability.h251
-rw-r--r--include/linux/cdrom.h14
-rw-r--r--include/linux/chio.h2
-rw-r--r--include/linux/compat.h7
-rw-r--r--include/linux/completion.h1
-rw-r--r--include/linux/cyclades.h2
-rw-r--r--include/linux/cycx_x25.h2
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/device.h17
-rw-r--r--include/linux/dma-mapping.h34
-rw-r--r--include/linux/dmaengine.h2
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fs.h3
-rw-r--r--include/linux/futex.h10
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/hdreg.h6
-rw-r--r--include/linux/hdsmart.h2
-rw-r--r--include/linux/highmem.h52
-rw-r--r--include/linux/hrtimer.h14
-rw-r--r--include/linux/hw_random.h10
-rw-r--r--include/linux/i2c/pca9539.h18
-rw-r--r--include/linux/i2c/pcf857x.h45
-rw-r--r--include/linux/ide.h131
-rw-r--r--include/linux/ieee80211.h6
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--include/linux/init.h3
-rw-r--r--include/linux/init_task.h21
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/iommu-helper.h7
-rw-r--r--include/linux/ipv6.h12
-rw-r--r--include/linux/latency.h25
-rw-r--r--include/linux/leds.h10
-rw-r--r--include/linux/lguest_launcher.h9
-rw-r--r--include/linux/llc.h4
-rw-r--r--include/linux/lockd/lockd.h9
-rw-r--r--include/linux/lockd/xdr.h4
-rw-r--r--include/linux/miscdevice.h10
-rw-r--r--include/linux/mm.h38
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mod_devicetable.h3
-rw-r--r--include/linux/mutex.h5
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h6
-rw-r--r--include/linux/netfilter/x_tables.h28
-rw-r--r--include/linux/netfilter/xt_conntrack.h30
-rw-r--r--include/linux/netfilter/xt_hashlimit.h37
-rw-r--r--include/linux/netfilter/xt_owner.h4
-rw-r--r--include/linux/netfilter_arp/arp_tables.h5
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h5
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs_fs.h9
-rw-r--r--include/linux/nfs_mount.h2
-rw-r--r--include/linux/nfsd/Kbuild1
-rw-r--r--include/linux/nfsd/auth.h27
-rw-r--r--include/linux/nfsd/cache.h4
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/nfsd/nfsd.h5
-rw-r--r--include/linux/nfsd/syscall.h1
-rw-r--r--include/linux/nfsd/xdr.h14
-rw-r--r--include/linux/nfsd/xdr3.h16
-rw-r--r--include/linux/nfsd/xdr4.h2
-rw-r--r--include/linux/nfsd_idmap.h11
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/nubus.h4
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/page-flags.h42
-rw-r--r--include/linux/pagemap.h14
-rw-r--r--include/linux/pci-acpi.h11
-rw-r--r--include/linux/pci.h378
-rw-r--r--include/linux/pci_ids.h17
-rw-r--r--include/linux/pda_power.h1
-rw-r--r--include/linux/percpu.h4
-rw-r--r--include/linux/pfkeyv2.h6
-rw-r--r--include/linux/phy.h5
-rw-r--r--include/linux/pkt_cls.h53
-rw-r--r--include/linux/pkt_sched.h5
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_qos_params.h25
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/power_supply.h13
-rw-r--r--include/linux/prctl.h4
-rw-r--r--include/linux/proc_fs.h3
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/reboot.h2
-rw-r--r--include/linux/reiserfs_fs_sb.h2
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/rtnetlink.h12
-rw-r--r--include/linux/sched.h55
-rw-r--r--include/linux/security.h26
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/signalfd.h2
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/slub_def.h15
-rw-r--r--include/linux/sm501-regs.h2
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/spi/mcp23s08.h24
-rw-r--r--include/linux/spinlock_api_up.h2
-rw-r--r--include/linux/sunrpc/cache.h4
-rw-r--r--include/linux/sunrpc/clnt.h4
-rw-r--r--include/linux/sunrpc/debug.h2
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/svc.h10
-rw-r--r--include/linux/sunrpc/svc_rdma.h262
-rw-r--r--include/linux/sunrpc/svc_xprt.h159
-rw-r--r--include/linux/sunrpc/svcsock.h43
-rw-r--r--include/linux/sunrpc/xdr.h3
-rw-r--r--include/linux/suspend.h57
-rw-r--r--include/linux/suspend_ioctls.h32
-rw-r--r--include/linux/swap.h35
-rw-r--r--include/linux/swapops.h6
-rw-r--r--include/linux/syscalls.h7
-rw-r--r--include/linux/sysctl.h7
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h1
-rw-r--r--include/linux/thread_info.h1
-rw-r--r--include/linux/tick.h4
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/types.h2
-rw-r--r--include/linux/usb.h209
-rw-r--r--include/linux/usb/Kbuild11
-rw-r--r--include/linux/usb/audio.h14
-rw-r--r--include/linux/usb/cdc.h16
-rw-r--r--include/linux/usb/g_printer.h31
-rw-r--r--include/linux/usb/gadget.h123
-rw-r--r--include/linux/usb/gadgetfs.h27
-rw-r--r--include/linux/usb/iowarrior.h25
-rw-r--r--include/linux/usb/isp116x.h2
-rw-r--r--include/linux/usb/midi.h26
-rw-r--r--include/linux/usb/net2280.h32
-rw-r--r--include/linux/usb/otg.h2
-rw-r--r--include/linux/usb/rndis_host.h274
-rw-r--r--include/linux/usb/serial.h160
-rw-r--r--include/linux/usb/sl811.h6
-rw-r--r--include/linux/usb/usbnet.h214
-rw-r--r--include/linux/usb_usual.h5
-rw-r--r--include/linux/usbdevice_fs.h2
-rw-r--r--include/linux/virtio.h19
-rw-r--r--include/linux/virtio_balloon.h18
-rw-r--r--include/linux/virtio_blk.h22
-rw-r--r--include/linux/virtio_config.h104
-rw-r--r--include/linux/virtio_net.h32
-rw-r--r--include/linux/virtio_pci.h57
-rw-r--r--include/linux/virtio_ring.h14
-rw-r--r--include/linux/vmalloc.h6
-rw-r--r--include/linux/wait.h68
-rw-r--r--include/linux/wireless.h2
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xattr.h1
-rw-r--r--include/linux/xfrm.h8
-rw-r--r--include/media/rds.h2
-rw-r--r--include/net/arp.h8
-rw-r--r--include/net/esp.h54
-rw-r--r--include/net/if_inet6.h6
-rw-r--r--include/net/inet6_hashtables.h19
-rw-r--r--include/net/inet_connection_sock.h8
-rw-r--r--include/net/inet_hashtables.h104
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip_fib.h12
-rw-r--r--include/net/ipv6.h6
-rw-r--r--include/net/net_namespace.h4
-rw-r--r--include/net/netfilter/nf_conntrack.h15
-rw-r--r--include/net/netfilter/nf_conntrack_core.h6
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h25
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h17
-rw-r--r--include/net/netfilter/nf_log.h2
-rw-r--r--include/net/netlabel.h47
-rw-r--r--include/net/netns/ipv4.h6
-rw-r--r--include/net/netns/ipv6.h5
-rw-r--r--include/net/netns/x_tables.h10
-rw-r--r--include/net/pkt_cls.h6
-rw-r--r--include/net/raw.h5
-rw-r--r--include/net/route.h3
-rw-r--r--include/net/sock.h5
-rw-r--r--include/net/xfrm.h16
-rw-r--r--include/pcmcia/cs.h8
-rw-r--r--include/pcmcia/cs_types.h1
-rw-r--r--include/pcmcia/ss.h6
-rw-r--r--include/scsi/scsi_transport_fc.h2
-rw-r--r--include/sound/ad1848.h2
-rw-r--r--include/sound/ainstr_fm.h134
-rw-r--r--include/sound/ainstr_gf1.h229
-rw-r--r--include/sound/ainstr_iw.h384
-rw-r--r--include/sound/ainstr_simple.h159
-rw-r--r--include/sound/ak4xxx-adda.h2
-rw-r--r--include/sound/asequencer.h242
-rw-r--r--include/sound/asound.h34
-rw-r--r--include/sound/asound_fm.h19
-rw-r--r--include/sound/core.h10
-rw-r--r--include/sound/cs4231-regs.h2
-rw-r--r--include/sound/cs46xx.h3
-rw-r--r--include/sound/driver.h52
-rw-r--r--include/sound/emu10k1.h231
-rw-r--r--include/sound/gus.h63
-rw-r--r--include/sound/info.h2
-rw-r--r--include/sound/opl3.h78
-rw-r--r--include/sound/pcm.h18
-rw-r--r--include/sound/seq_instr.h110
-rw-r--r--include/sound/soc-dapm.h29
-rw-r--r--include/sound/soc.h67
-rw-r--r--include/sound/tea575x-tuner.h1
-rw-r--r--include/sound/trident.h22
-rw-r--r--include/sound/version.h4
435 files changed, 5468 insertions, 4243 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 9512f0456ad1..d970f7f99549 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -85,7 +85,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
85#endif 85#endif
86 86
87/* 87/*
88 * ACPI Memory managment 88 * ACPI Memory management
89 */ 89 */
90void *acpi_allocate(u32 size); 90void *acpi_allocate(u32 size);
91 91
@@ -335,6 +335,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state);
335 335
336acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); 336acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void);
337 337
338acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
339
338acpi_status acpi_leave_sleep_state(u8 sleep_state); 340acpi_status acpi_leave_sleep_state(u8 sleep_state);
339 341
340#endif /* __ACXFACE_H__ */ 342#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 76411b1fc4fd..6e253b5b0f3b 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -182,7 +182,7 @@ struct acpi_processor_throttling {
182/* Limit Interface */ 182/* Limit Interface */
183 183
184struct acpi_processor_lx { 184struct acpi_processor_lx {
185 int px; /* performace state */ 185 int px; /* performance state */
186 int tx; /* throttle level */ 186 int tx; /* throttle level */
187}; 187};
188 188
diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h
index f5cb7b878af2..ca88e54dec93 100644
--- a/include/asm-alpha/atomic.h
+++ b/include/asm-alpha/atomic.h
@@ -100,7 +100,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
100/* 100/*
101 * Same as above, but return the result value 101 * Same as above, but return the result value
102 */ 102 */
103static __inline__ long atomic_add_return(int i, atomic_t * v) 103static inline int atomic_add_return(int i, atomic_t *v)
104{ 104{
105 long temp, result; 105 long temp, result;
106 smp_mb(); 106 smp_mb();
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 30ee7669b19f..d5b10ef64364 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -4,6 +4,7 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/dma-mapping.h>
7#include <asm/scatterlist.h> 8#include <asm/scatterlist.h>
8#include <asm/machvec.h> 9#include <asm/machvec.h>
9 10
diff --git a/include/asm-alpha/pgalloc.h b/include/asm-alpha/pgalloc.h
index 471864e8d4c3..fdbedacc7375 100644
--- a/include/asm-alpha/pgalloc.h
+++ b/include/asm-alpha/pgalloc.h
@@ -31,7 +31,7 @@ pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
31extern pgd_t *pgd_alloc(struct mm_struct *mm); 31extern pgd_t *pgd_alloc(struct mm_struct *mm);
32 32
33static inline void 33static inline void
34pgd_free(pgd_t *pgd) 34pgd_free(struct mm_struct *mm, pgd_t *pgd)
35{ 35{
36 free_page((unsigned long)pgd); 36 free_page((unsigned long)pgd);
37} 37}
@@ -44,7 +44,7 @@ pmd_alloc_one(struct mm_struct *mm, unsigned long address)
44} 44}
45 45
46static inline void 46static inline void
47pmd_free(pmd_t *pmd) 47pmd_free(struct mm_struct *mm, pmd_t *pmd)
48{ 48{
49 free_page((unsigned long)pmd); 49 free_page((unsigned long)pmd);
50} 50}
@@ -52,7 +52,7 @@ pmd_free(pmd_t *pmd)
52extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 52extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
53 53
54static inline void 54static inline void
55pte_free_kernel(pte_t *pte) 55pte_free_kernel(struct mm_struct *mm, pte_t *pte)
56{ 56{
57 free_page((unsigned long)pte); 57 free_page((unsigned long)pte);
58} 58}
@@ -67,7 +67,7 @@ pte_alloc_one(struct mm_struct *mm, unsigned long addr)
67} 67}
68 68
69static inline void 69static inline void
70pte_free(struct page *page) 70pte_free(struct mm_struct *mm, struct page *page)
71{ 71{
72 __free_page(page); 72 __free_page(page);
73} 73}
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index 1fede7f92860..08c979319929 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -60,4 +60,6 @@
60#define SO_SECURITY_ENCRYPTION_TRANSPORT 20 60#define SO_SECURITY_ENCRYPTION_TRANSPORT 20
61#define SO_SECURITY_ENCRYPTION_NETWORK 21 61#define SO_SECURITY_ENCRYPTION_NETWORK 21
62 62
63#define SO_MARK 36
64
63#endif /* _ASM_SOCKET_H */ 65#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-alpha/tlb.h b/include/asm-alpha/tlb.h
index aa91335533e0..c13636575fba 100644
--- a/include/asm-alpha/tlb.h
+++ b/include/asm-alpha/tlb.h
@@ -9,7 +9,7 @@
9 9
10#include <asm-generic/tlb.h> 10#include <asm-generic/tlb.h>
11 11
12#define __pte_free_tlb(tlb,pte) pte_free(pte) 12#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
13#define __pmd_free_tlb(tlb,pmd) pmd_free(pmd) 13#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
14 14
15#endif 15#endif
diff --git a/include/asm-alpha/tlbflush.h b/include/asm-alpha/tlbflush.h
index eefab3fb51ae..9d87aaa08c0d 100644
--- a/include/asm-alpha/tlbflush.h
+++ b/include/asm-alpha/tlbflush.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/compiler.h> 5#include <asm/compiler.h>
6#include <asm/pgalloc.h>
6 7
7#ifndef __EXTERN_INLINE 8#ifndef __EXTERN_INLINE
8#define __EXTERN_INLINE extern inline 9#define __EXTERN_INLINE extern inline
@@ -141,6 +142,10 @@ extern void flush_tlb_range(struct vm_area_struct *, unsigned long,
141 142
142#endif /* CONFIG_SMP */ 143#endif /* CONFIG_SMP */
143 144
144#define flush_tlb_kernel_range(start, end) flush_tlb_all() 145static inline void flush_tlb_kernel_range(unsigned long start,
146 unsigned long end)
147{
148 flush_tlb_all();
149}
145 150
146#endif /* _ALPHA_TLBFLUSH_H */ 151#endif /* _ALPHA_TLBFLUSH_H */
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 29bf2fdc91c0..5b5c17485942 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -442,7 +442,6 @@
442#define __ARCH_WANT_OLD_READDIR 442#define __ARCH_WANT_OLD_READDIR
443#define __ARCH_WANT_STAT64 443#define __ARCH_WANT_STAT64
444#define __ARCH_WANT_SYS_GETHOSTNAME 444#define __ARCH_WANT_SYS_GETHOSTNAME
445#define __ARCH_WANT_SYS_SOCKETCALL
446#define __ARCH_WANT_SYS_FADVISE64 445#define __ARCH_WANT_SYS_FADVISE64
447#define __ARCH_WANT_SYS_GETPGRP 446#define __ARCH_WANT_SYS_GETPGRP
448#define __ARCH_WANT_SYS_OLD_GETRLIMIT 447#define __ARCH_WANT_SYS_OLD_GETRLIMIT
diff --git a/include/asm-arm/arch-at91/at91_mci.h b/include/asm-arm/arch-at91/at91_mci.h
index c2e11cc374ba..1551fc24eb43 100644
--- a/include/asm-arm/arch-at91/at91_mci.h
+++ b/include/asm-arm/arch-at91/at91_mci.h
@@ -89,7 +89,7 @@
89#define AT91_MCI_ENDRX (1 << 6) /* End of RX Buffer */ 89#define AT91_MCI_ENDRX (1 << 6) /* End of RX Buffer */
90#define AT91_MCI_ENDTX (1 << 7) /* End fo TX Buffer */ 90#define AT91_MCI_ENDTX (1 << 7) /* End fo TX Buffer */
91#define AT91_MCI_SDIOIRQA (1 << 8) /* SDIO Interrupt for Slot A */ 91#define AT91_MCI_SDIOIRQA (1 << 8) /* SDIO Interrupt for Slot A */
92#define At91_MCI_SDIOIRQB (1 << 9) /* SDIO Interrupt for Slot B [AT91RM9200 only] */ 92#define AT91_MCI_SDIOIRQB (1 << 9) /* SDIO Interrupt for Slot B */
93#define AT91_MCI_RXBUFF (1 << 14) /* RX Buffer Full */ 93#define AT91_MCI_RXBUFF (1 << 14) /* RX Buffer Full */
94#define AT91_MCI_TXBUFE (1 << 15) /* TX Buffer Empty */ 94#define AT91_MCI_TXBUFE (1 << 15) /* TX Buffer Empty */
95#define AT91_MCI_RINDE (1 << 16) /* Response Index Error */ 95#define AT91_MCI_RINDE (1 << 16) /* Response Index Error */
diff --git a/include/asm-arm/arch-at91/at91rm9200.h b/include/asm-arm/arch-at91/at91rm9200.h
index 802891a9cd81..e8fc0b1c33f4 100644
--- a/include/asm-arm/arch-at91/at91rm9200.h
+++ b/include/asm-arm/arch-at91/at91rm9200.h
@@ -93,6 +93,11 @@
93#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */ 93#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */
94#define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ 94#define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */
95 95
96#define AT91_USART0 AT91RM9200_BASE_US0
97#define AT91_USART1 AT91RM9200_BASE_US1
98#define AT91_USART2 AT91RM9200_BASE_US2
99#define AT91_USART3 AT91RM9200_BASE_US3
100
96#define AT91_MATRIX 0 /* not supported */ 101#define AT91_MATRIX 0 /* not supported */
97 102
98/* 103/*
diff --git a/include/asm-arm/arch-at91/at91sam9260.h b/include/asm-arm/arch-at91/at91sam9260.h
index 0427f8698c07..c8934fe34dc5 100644
--- a/include/asm-arm/arch-at91/at91sam9260.h
+++ b/include/asm-arm/arch-at91/at91sam9260.h
@@ -99,6 +99,13 @@
99#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) 99#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
100#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) 100#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
101 101
102#define AT91_USART0 AT91SAM9260_BASE_US0
103#define AT91_USART1 AT91SAM9260_BASE_US1
104#define AT91_USART2 AT91SAM9260_BASE_US2
105#define AT91_USART3 AT91SAM9260_BASE_US3
106#define AT91_USART4 AT91SAM9260_BASE_US4
107#define AT91_USART5 AT91SAM9260_BASE_US5
108
102 109
103/* 110/*
104 * Internal Memory. 111 * Internal Memory.
diff --git a/include/asm-arm/arch-at91/at91sam9261.h b/include/asm-arm/arch-at91/at91sam9261.h
index 9eb459570330..c7c4778dac49 100644
--- a/include/asm-arm/arch-at91/at91sam9261.h
+++ b/include/asm-arm/arch-at91/at91sam9261.h
@@ -84,6 +84,10 @@
84#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) 84#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
85#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) 85#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
86 86
87#define AT91_USART0 AT91SAM9261_BASE_US0
88#define AT91_USART1 AT91SAM9261_BASE_US1
89#define AT91_USART2 AT91SAM9261_BASE_US2
90
87 91
88/* 92/*
89 * Internal Memory. 93 * Internal Memory.
diff --git a/include/asm-arm/arch-at91/at91sam9263.h b/include/asm-arm/arch-at91/at91sam9263.h
index 115c47ac7ebb..018a647311da 100644
--- a/include/asm-arm/arch-at91/at91sam9263.h
+++ b/include/asm-arm/arch-at91/at91sam9263.h
@@ -101,6 +101,10 @@
101#define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS) 101#define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS)
102#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) 102#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
103 103
104#define AT91_USART0 AT91SAM9263_BASE_US0
105#define AT91_USART1 AT91SAM9263_BASE_US1
106#define AT91_USART2 AT91SAM9263_BASE_US2
107
104#define AT91_SMC AT91_SMC0 108#define AT91_SMC AT91_SMC0
105 109
106/* 110/*
diff --git a/include/asm-arm/arch-at91/at91sam9rl.h b/include/asm-arm/arch-at91/at91sam9rl.h
index 8a9708a370c6..16d2832f6c0a 100644
--- a/include/asm-arm/arch-at91/at91sam9rl.h
+++ b/include/asm-arm/arch-at91/at91sam9rl.h
@@ -94,6 +94,11 @@
94#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) 94#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
95#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) 95#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS)
96 96
97#define AT91_USART0 AT91SAM9RL_BASE_US0
98#define AT91_USART1 AT91SAM9RL_BASE_US1
99#define AT91_USART2 AT91SAM9RL_BASE_US2
100#define AT91_USART3 AT91SAM9RL_BASE_US3
101
97 102
98/* 103/*
99 * Internal Memory. 104 * Internal Memory.
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index 55b07bd5316c..dc189f01c5b3 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -40,7 +40,8 @@
40 /* USB Device */ 40 /* USB Device */
41struct at91_udc_data { 41struct at91_udc_data {
42 u8 vbus_pin; /* high == host powering us */ 42 u8 vbus_pin; /* high == host powering us */
43 u8 pullup_pin; /* high == D+ pulled up */ 43 u8 pullup_pin; /* active == D+ pulled up */
44 u8 pullup_active_low; /* true == pullup_pin is active low */
44}; 45};
45extern void __init at91_add_device_udc(struct at91_udc_data *data); 46extern void __init at91_add_device_udc(struct at91_udc_data *data);
46 47
diff --git a/include/asm-arm/arch-at91/uncompress.h b/include/asm-arm/arch-at91/uncompress.h
index 272a7e0dc6cf..f5636a8f6132 100644
--- a/include/asm-arm/arch-at91/uncompress.h
+++ b/include/asm-arm/arch-at91/uncompress.h
@@ -22,7 +22,23 @@
22#define __ASM_ARCH_UNCOMPRESS_H 22#define __ASM_ARCH_UNCOMPRESS_H
23 23
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/arch/at91_dbgu.h> 25#include <linux/atmel_serial.h>
26
27#if defined(CONFIG_AT91_EARLY_DBGU)
28#define UART_OFFSET (AT91_DBGU + AT91_BASE_SYS)
29#elif defined(CONFIG_AT91_EARLY_USART0)
30#define UART_OFFSET AT91_USART0
31#elif defined(CONFIG_AT91_EARLY_USART1)
32#define UART_OFFSET AT91_USART1
33#elif defined(CONFIG_AT91_EARLY_USART2)
34#define UART_OFFSET AT91_USART2
35#elif defined(CONFIG_AT91_EARLY_USART3)
36#define UART_OFFSET AT91_USART3
37#elif defined(CONFIG_AT91_EARLY_USART4)
38#define UART_OFFSET AT91_USART4
39#elif defined(CONFIG_AT91_EARLY_USART5)
40#define UART_OFFSET AT91_USART5
41#endif
26 42
27/* 43/*
28 * The following code assumes the serial port has already been 44 * The following code assumes the serial port has already been
@@ -33,22 +49,22 @@
33 */ 49 */
34static void putc(int c) 50static void putc(int c)
35{ 51{
36#ifdef AT91_DBGU 52#ifdef UART_OFFSET
37 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ 53 void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */
38 54
39 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) 55 while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXRDY))
40 barrier(); 56 barrier();
41 __raw_writel(c, sys + AT91_DBGU_THR); 57 __raw_writel(c, sys + ATMEL_US_THR);
42#endif 58#endif
43} 59}
44 60
45static inline void flush(void) 61static inline void flush(void)
46{ 62{
47#ifdef AT91_DBGU 63#ifdef UART_OFFSET
48 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ 64 void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */
49 65
50 /* wait for transmission to complete */ 66 /* wait for transmission to complete */
51 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) 67 while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
52 barrier(); 68 barrier();
53#endif 69#endif
54} 70}
diff --git a/include/asm-arm/arch-ixp4xx/cpu.h b/include/asm-arm/arch-ixp4xx/cpu.h
index d2523b326c6c..2fa3d6b8dbb8 100644
--- a/include/asm-arm/arch-ixp4xx/cpu.h
+++ b/include/asm-arm/arch-ixp4xx/cpu.h
@@ -28,4 +28,19 @@ extern unsigned int processor_id;
28#define cpu_is_ixp46x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \ 28#define cpu_is_ixp46x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \
29 IXP465_PROCESSOR_ID_VALUE) 29 IXP465_PROCESSOR_ID_VALUE)
30 30
31static inline u32 ixp4xx_read_feature_bits(void)
32{
33 unsigned int val = ~*IXP4XX_EXP_CFG2;
34 val &= ~IXP4XX_FEATURE_RESERVED;
35 if (!cpu_is_ixp46x())
36 val &= ~IXP4XX_FEATURE_IXP46X_ONLY;
37
38 return val;
39}
40
41static inline void ixp4xx_write_feature_bits(u32 value)
42{
43 *IXP4XX_EXP_CFG2 = ~value;
44}
45
31#endif /* _ASM_ARCH_CPU_H */ 46#endif /* _ASM_ARCH_CPU_H */
diff --git a/include/asm-arm/arch-ixp4xx/dsmg600.h b/include/asm-arm/arch-ixp4xx/dsmg600.h
index a19605ad240d..b7673e171abe 100644
--- a/include/asm-arm/arch-ixp4xx/dsmg600.h
+++ b/include/asm-arm/arch-ixp4xx/dsmg600.h
@@ -40,18 +40,13 @@
40/* Buttons */ 40/* Buttons */
41 41
42#define DSMG600_PB_GPIO 15 /* power button */ 42#define DSMG600_PB_GPIO 15 /* power button */
43#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO)
44
45#define DSMG600_RB_GPIO 3 /* reset button */ 43#define DSMG600_RB_GPIO 3 /* reset button */
46 44
47#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3 45/* Power control */
48 46
49#define DSMG600_PO_GPIO 2 /* power off */ 47#define DSMG600_PO_GPIO 2 /* power off */
50 48
51/* LEDs */ 49/* LEDs */
52 50
53#define DSMG600_LED_PWR_GPIO 0 51#define DSMG600_LED_PWR_GPIO 0
54#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR_GPIO)
55
56#define DSMG600_LED_WLAN_GPIO 14 52#define DSMG600_LED_WLAN_GPIO 14
57#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO)
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
index 297ceda08b61..73e8dc36f6a4 100644
--- a/include/asm-arm/arch-ixp4xx/hardware.h
+++ b/include/asm-arm/arch-ixp4xx/hardware.h
@@ -27,13 +27,13 @@
27 27
28#define pcibios_assign_all_busses() 1 28#define pcibios_assign_all_busses() 1
29 29
30/* Register locations and bits */
31#include "ixp4xx-regs.h"
32
30#ifndef __ASSEMBLER__ 33#ifndef __ASSEMBLER__
31#include <asm/arch/cpu.h> 34#include <asm/arch/cpu.h>
32#endif 35#endif
33 36
34/* Register locations and bits */
35#include "ixp4xx-regs.h"
36
37/* Platform helper functions and definitions */ 37/* Platform helper functions and definitions */
38#include "platform.h" 38#include "platform.h"
39 39
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index 9c5d2357aff3..de181ce958db 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_ARM_ARCH_IO_H 13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H 14#define __ASM_ARM_ARCH_IO_H
15 15
16#include <linux/bitops.h>
17
16#include <asm/hardware.h> 18#include <asm/hardware.h>
17 19
18#define IO_SPACE_LIMIT 0xffff0000 20#define IO_SPACE_LIMIT 0xffff0000
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index 5d949d763a91..68aca8554f5a 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -15,10 +15,6 @@
15 * 15 *
16 */ 16 */
17 17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif
21
22#ifndef _ASM_ARM_IXP4XX_H_ 18#ifndef _ASM_ARM_IXP4XX_H_
23#define _ASM_ARM_IXP4XX_H_ 19#define _ASM_ARM_IXP4XX_H_
24 20
@@ -587,24 +583,56 @@
587#define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */ 583#define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */
588#define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */ 584#define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */
589 585
590#define USIR0_IR0 (1 << 0) /* Interrup request ep 0 */ 586#define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */
591#define USIR0_IR1 (1 << 1) /* Interrup request ep 1 */ 587#define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */
592#define USIR0_IR2 (1 << 2) /* Interrup request ep 2 */ 588#define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */
593#define USIR0_IR3 (1 << 3) /* Interrup request ep 3 */ 589#define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */
594#define USIR0_IR4 (1 << 4) /* Interrup request ep 4 */ 590#define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */
595#define USIR0_IR5 (1 << 5) /* Interrup request ep 5 */ 591#define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */
596#define USIR0_IR6 (1 << 6) /* Interrup request ep 6 */ 592#define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */
597#define USIR0_IR7 (1 << 7) /* Interrup request ep 7 */ 593#define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */
598 594
599#define USIR1_IR8 (1 << 0) /* Interrup request ep 8 */ 595#define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */
600#define USIR1_IR9 (1 << 1) /* Interrup request ep 9 */ 596#define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */
601#define USIR1_IR10 (1 << 2) /* Interrup request ep 10 */ 597#define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */
602#define USIR1_IR11 (1 << 3) /* Interrup request ep 11 */ 598#define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */
603#define USIR1_IR12 (1 << 4) /* Interrup request ep 12 */ 599#define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */
604#define USIR1_IR13 (1 << 5) /* Interrup request ep 13 */ 600#define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */
605#define USIR1_IR14 (1 << 6) /* Interrup request ep 14 */ 601#define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */
606#define USIR1_IR15 (1 << 7) /* Interrup request ep 15 */ 602#define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */
607 603
608#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ 604#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
609 605
606/* "fuse" bits of IXP_EXP_CFG2 */
607#define IXP4XX_FEATURE_RCOMP (1 << 0)
608#define IXP4XX_FEATURE_USB_DEVICE (1 << 1)
609#define IXP4XX_FEATURE_HASH (1 << 2)
610#define IXP4XX_FEATURE_AES (1 << 3)
611#define IXP4XX_FEATURE_DES (1 << 4)
612#define IXP4XX_FEATURE_HDLC (1 << 5)
613#define IXP4XX_FEATURE_AAL (1 << 6)
614#define IXP4XX_FEATURE_HSS (1 << 7)
615#define IXP4XX_FEATURE_UTOPIA (1 << 8)
616#define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9)
617#define IXP4XX_FEATURE_NPEC_ETH (1 << 10)
618#define IXP4XX_FEATURE_RESET_NPEA (1 << 11)
619#define IXP4XX_FEATURE_RESET_NPEB (1 << 12)
620#define IXP4XX_FEATURE_RESET_NPEC (1 << 13)
621#define IXP4XX_FEATURE_PCI (1 << 14)
622#define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15)
623#define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16)
624#define IXP4XX_FEATURE_USB_HOST (1 << 18)
625#define IXP4XX_FEATURE_NPEA_ETH (1 << 19)
626#define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20)
627#define IXP4XX_FEATURE_RSA (1 << 21)
628#define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22)
629#define IXP4XX_FEATURE_RESERVED (0xFF << 24)
630
631#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \
632 IXP4XX_FEATURE_USB_HOST | \
633 IXP4XX_FEATURE_NPEA_ETH | \
634 IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \
635 IXP4XX_FEATURE_RSA | \
636 IXP4XX_FEATURE_XSCALE_MAX_FREQ)
637
610#endif 638#endif
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h
index 131e0a1d0df3..98d937897bce 100644
--- a/include/asm-arm/arch-ixp4xx/nas100d.h
+++ b/include/asm-arm/arch-ixp4xx/nas100d.h
@@ -38,15 +38,15 @@
38 38
39/* Buttons */ 39/* Buttons */
40 40
41#define NAS100D_PB_GPIO 14 41#define NAS100D_PB_GPIO 14 /* power button */
42#define NAS100D_RB_GPIO 4 42#define NAS100D_RB_GPIO 4 /* reset button */
43
44/* Power control */
45
43#define NAS100D_PO_GPIO 12 /* power off */ 46#define NAS100D_PO_GPIO 12 /* power off */
44 47
45#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 48/* LEDs */
46#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4
47 49
48/* 50#define NAS100D_LED_WLAN_GPIO 0
49#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO) 51#define NAS100D_LED_DISK_GPIO 3
50#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO) 52#define NAS100D_LED_PWR_GPIO 15
51#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO)
52*/
diff --git a/include/asm-arm/arch-ixp4xx/npe.h b/include/asm-arm/arch-ixp4xx/npe.h
new file mode 100644
index 000000000000..37d0511689dc
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/npe.h
@@ -0,0 +1,39 @@
1#ifndef __IXP4XX_NPE_H
2#define __IXP4XX_NPE_H
3
4#include <linux/kernel.h>
5
6extern const char *npe_names[];
7
8struct npe_regs {
9 u32 exec_addr, exec_data, exec_status_cmd, exec_count;
10 u32 action_points[4];
11 u32 watchpoint_fifo, watch_count;
12 u32 profile_count;
13 u32 messaging_status, messaging_control;
14 u32 mailbox_status, /*messaging_*/ in_out_fifo;
15};
16
17struct npe {
18 struct resource *mem_res;
19 struct npe_regs __iomem *regs;
20 u32 regs_phys;
21 int id;
22 int valid;
23};
24
25
26static inline const char *npe_name(struct npe *npe)
27{
28 return npe_names[npe->id];
29}
30
31int npe_running(struct npe *npe);
32int npe_send_message(struct npe *npe, const void *msg, const char *what);
33int npe_recv_message(struct npe *npe, void *msg, const char *what);
34int npe_send_recv_message(struct npe *npe, void *msg, const char *what);
35int npe_load_firmware(struct npe *npe, const char *name, struct device *dev);
36struct npe *npe_request(int id);
37void npe_release(struct npe *npe);
38
39#endif /* __IXP4XX_NPE_H */
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h
index 850fdc5b45da..714bbc65126a 100644
--- a/include/asm-arm/arch-ixp4xx/nslu2.h
+++ b/include/asm-arm/arch-ixp4xx/nslu2.h
@@ -39,34 +39,17 @@
39 39
40/* Buttons */ 40/* Buttons */
41 41
42#define NSLU2_PB_GPIO 5 42#define NSLU2_PB_GPIO 5 /* power button */
43#define NSLU2_PO_GPIO 8 /* power off */ 43#define NSLU2_PO_GPIO 8 /* power off */
44#define NSLU2_RB_GPIO 12 44#define NSLU2_RB_GPIO 12 /* reset button */
45
46#define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5
47#define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12
48
49#define NSLU2_PB_BM (1L << NSLU2_PB_GPIO)
50#define NSLU2_PO_BM (1L << NSLU2_PO_GPIO)
51#define NSLU2_RB_BM (1L << NSLU2_RB_GPIO)
52 45
53/* Buzzer */ 46/* Buzzer */
54 47
55#define NSLU2_GPIO_BUZZ 4 48#define NSLU2_GPIO_BUZZ 4
56#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ)
57 49
58/* LEDs */ 50/* LEDs */
59 51
60#define NSLU2_LED_RED_GPIO 0 52#define NSLU2_LED_RED_GPIO 0
61#define NSLU2_LED_GRN_GPIO 1 53#define NSLU2_LED_GRN_GPIO 1
62
63#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO)
64#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO)
65
66#define NSLU2_LED_DISK1_GPIO 3 54#define NSLU2_LED_DISK1_GPIO 3
67#define NSLU2_LED_DISK2_GPIO 2 55#define NSLU2_LED_DISK2_GPIO 2
68
69#define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO)
70#define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO)
71
72
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 2ce28e3fd325..a1f2b5404db1 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -91,6 +91,27 @@ struct ixp4xx_pata_data {
91 91
92struct sys_timer; 92struct sys_timer;
93 93
94#define IXP4XX_ETH_NPEA 0x00
95#define IXP4XX_ETH_NPEB 0x10
96#define IXP4XX_ETH_NPEC 0x20
97
98/* Information about built-in Ethernet MAC interfaces */
99struct eth_plat_info {
100 u8 phy; /* MII PHY ID, 0 - 31 */
101 u8 rxq; /* configurable, currently 0 - 31 only */
102 u8 txreadyq;
103 u8 hwaddr[6];
104};
105
106/* Information about built-in HSS (synchronous serial) interfaces */
107struct hss_plat_info {
108 int (*set_clock)(int port, unsigned int clock_type);
109 int (*open)(int port, void *pdev,
110 void (*set_carrier_cb)(void *pdev, int carrier));
111 void (*close)(int port, void *pdev);
112 u8 txreadyq;
113};
114
94/* 115/*
95 * Frequency of clock used for primary clocksource 116 * Frequency of clock used for primary clocksource
96 */ 117 */
diff --git a/include/asm-arm/arch-ixp4xx/qmgr.h b/include/asm-arm/arch-ixp4xx/qmgr.h
new file mode 100644
index 000000000000..1e52b95cede5
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/qmgr.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
7 */
8
9#ifndef IXP4XX_QMGR_H
10#define IXP4XX_QMGR_H
11
12#include <linux/io.h>
13#include <linux/kernel.h>
14
15#define HALF_QUEUES 32
16#define QUEUES 64 /* only 32 lower queues currently supported */
17#define MAX_QUEUE_LENGTH 4 /* in dwords */
18
19#define QUEUE_STAT1_EMPTY 1 /* queue status bits */
20#define QUEUE_STAT1_NEARLY_EMPTY 2
21#define QUEUE_STAT1_NEARLY_FULL 4
22#define QUEUE_STAT1_FULL 8
23#define QUEUE_STAT2_UNDERFLOW 1
24#define QUEUE_STAT2_OVERFLOW 2
25
26#define QUEUE_WATERMARK_0_ENTRIES 0
27#define QUEUE_WATERMARK_1_ENTRY 1
28#define QUEUE_WATERMARK_2_ENTRIES 2
29#define QUEUE_WATERMARK_4_ENTRIES 3
30#define QUEUE_WATERMARK_8_ENTRIES 4
31#define QUEUE_WATERMARK_16_ENTRIES 5
32#define QUEUE_WATERMARK_32_ENTRIES 6
33#define QUEUE_WATERMARK_64_ENTRIES 7
34
35/* queue interrupt request conditions */
36#define QUEUE_IRQ_SRC_EMPTY 0
37#define QUEUE_IRQ_SRC_NEARLY_EMPTY 1
38#define QUEUE_IRQ_SRC_NEARLY_FULL 2
39#define QUEUE_IRQ_SRC_FULL 3
40#define QUEUE_IRQ_SRC_NOT_EMPTY 4
41#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5
42#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL 6
43#define QUEUE_IRQ_SRC_NOT_FULL 7
44
45struct qmgr_regs {
46 u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */
47 u32 stat1[4]; /* 0x400 - 0x40F */
48 u32 stat2[2]; /* 0x410 - 0x417 */
49 u32 statne_h; /* 0x418 - queue nearly empty */
50 u32 statf_h; /* 0x41C - queue full */
51 u32 irqsrc[4]; /* 0x420 - 0x42F IRC source */
52 u32 irqen[2]; /* 0x430 - 0x437 IRQ enabled */
53 u32 irqstat[2]; /* 0x438 - 0x43F - IRQ access only */
54 u32 reserved[1776];
55 u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */
56};
57
58void qmgr_set_irq(unsigned int queue, int src,
59 void (*handler)(void *pdev), void *pdev);
60void qmgr_enable_irq(unsigned int queue);
61void qmgr_disable_irq(unsigned int queue);
62
63/* request_ and release_queue() must be called from non-IRQ context */
64int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
65 unsigned int nearly_empty_watermark,
66 unsigned int nearly_full_watermark);
67void qmgr_release_queue(unsigned int queue);
68
69
70static inline void qmgr_put_entry(unsigned int queue, u32 val)
71{
72 extern struct qmgr_regs __iomem *qmgr_regs;
73 __raw_writel(val, &qmgr_regs->acc[queue][0]);
74}
75
76static inline u32 qmgr_get_entry(unsigned int queue)
77{
78 extern struct qmgr_regs __iomem *qmgr_regs;
79 return __raw_readl(&qmgr_regs->acc[queue][0]);
80}
81
82static inline int qmgr_get_stat1(unsigned int queue)
83{
84 extern struct qmgr_regs __iomem *qmgr_regs;
85 return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
86 >> ((queue & 7) << 2)) & 0xF;
87}
88
89static inline int qmgr_get_stat2(unsigned int queue)
90{
91 extern struct qmgr_regs __iomem *qmgr_regs;
92 return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
93 >> ((queue & 0xF) << 1)) & 0x3;
94}
95
96static inline int qmgr_stat_empty(unsigned int queue)
97{
98 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY);
99}
100
101static inline int qmgr_stat_nearly_empty(unsigned int queue)
102{
103 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY);
104}
105
106static inline int qmgr_stat_nearly_full(unsigned int queue)
107{
108 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL);
109}
110
111static inline int qmgr_stat_full(unsigned int queue)
112{
113 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_FULL);
114}
115
116static inline int qmgr_stat_underflow(unsigned int queue)
117{
118 return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW);
119}
120
121static inline int qmgr_stat_overflow(unsigned int queue)
122{
123 return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW);
124}
125
126#endif
diff --git a/include/asm-arm/arch-ixp4xx/uncompress.h b/include/asm-arm/arch-ixp4xx/uncompress.h
index f7a35b78823f..34ef48fe327e 100644
--- a/include/asm-arm/arch-ixp4xx/uncompress.h
+++ b/include/asm-arm/arch-ixp4xx/uncompress.h
@@ -13,7 +13,7 @@
13#ifndef _ARCH_UNCOMPRESS_H_ 13#ifndef _ARCH_UNCOMPRESS_H_
14#define _ARCH_UNCOMPRESS_H_ 14#define _ARCH_UNCOMPRESS_H_
15 15
16#include <asm/hardware.h> 16#include "ixp4xx-regs.h"
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <linux/serial_reg.h> 18#include <linux/serial_reg.h>
19 19
diff --git a/include/asm-arm/arch-omap/eac.h b/include/asm-arm/arch-omap/eac.h
index 6662cb02bafc..ccee3b0700b3 100644
--- a/include/asm-arm/arch-omap/eac.h
+++ b/include/asm-arm/arch-omap/eac.h
@@ -31,7 +31,6 @@
31#include <asm/arch/hardware.h> 31#include <asm/arch/hardware.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33 33
34#include <sound/driver.h>
35#include <sound/core.h> 34#include <sound/core.h>
36 35
37/* master codec clock source */ 36/* master codec clock source */
diff --git a/include/asm-arm/arch-omap/omap-alsa.h b/include/asm-arm/arch-omap/omap-alsa.h
index fcaf44c14714..faa0ed23d4ba 100644
--- a/include/asm-arm/arch-omap/omap-alsa.h
+++ b/include/asm-arm/arch-omap/omap-alsa.h
@@ -40,7 +40,6 @@
40#ifndef __OMAP_ALSA_H 40#ifndef __OMAP_ALSA_H
41#define __OMAP_ALSA_H 41#define __OMAP_ALSA_H
42 42
43#include <sound/driver.h>
44#include <asm/arch/dma.h> 43#include <asm/arch/dma.h>
45#include <sound/core.h> 44#include <sound/core.h>
46#include <sound/pcm.h> 45#include <sound/pcm.h>
diff --git a/include/asm-arm/arch-pxa/audio.h b/include/asm-arm/arch-pxa/audio.h
index 17eccd720136..52bbe3bc25e1 100644
--- a/include/asm-arm/arch-pxa/audio.h
+++ b/include/asm-arm/arch-pxa/audio.h
@@ -1,7 +1,6 @@
1#ifndef __ASM_ARCH_AUDIO_H__ 1#ifndef __ASM_ARCH_AUDIO_H__
2#define __ASM_ARCH_AUDIO_H__ 2#define __ASM_ARCH_AUDIO_H__
3 3
4#include <sound/driver.h>
5#include <sound/core.h> 4#include <sound/core.h>
6#include <sound/pcm.h> 5#include <sound/pcm.h>
7 6
diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h
index 9dbc2dc794f7..bdbf5f9ffdd5 100644
--- a/include/asm-arm/arch-pxa/gpio.h
+++ b/include/asm-arm/arch-pxa/gpio.h
@@ -28,43 +28,35 @@
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/hardware.h> 29#include <asm/hardware.h>
30 30
31static inline int gpio_request(unsigned gpio, const char *label) 31#include <asm-generic/gpio.h>
32{
33 return 0;
34}
35 32
36static inline void gpio_free(unsigned gpio)
37{
38 return;
39}
40 33
41extern int gpio_direction_input(unsigned gpio); 34/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
42extern int gpio_direction_output(unsigned gpio, int value); 35 * Those cases currently cause holes in the GPIO number space.
36 */
37#define NR_BUILTIN_GPIO 128
43 38
44static inline int __gpio_get_value(unsigned gpio) 39static inline int gpio_get_value(unsigned gpio)
45{ 40{
46 return GPLR(gpio) & GPIO_bit(gpio); 41 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
42 return GPLR(gpio) & GPIO_bit(gpio);
43 else
44 return __gpio_get_value(gpio);
47} 45}
48 46
49#define gpio_get_value(gpio) \ 47static inline void gpio_set_value(unsigned gpio, int value)
50 (__builtin_constant_p(gpio) ? \
51 __gpio_get_value(gpio) : \
52 pxa_gpio_get_value(gpio))
53
54static inline void __gpio_set_value(unsigned gpio, int value)
55{ 48{
56 if (value) 49 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
57 GPSR(gpio) = GPIO_bit(gpio); 50 if (value)
58 else 51 GPSR(gpio) = GPIO_bit(gpio);
59 GPCR(gpio) = GPIO_bit(gpio); 52 else
53 GPCR(gpio) = GPIO_bit(gpio);
54 } else {
55 __gpio_set_value(gpio, value);
56 }
60} 57}
61 58
62#define gpio_set_value(gpio,value) \ 59#define gpio_cansleep __gpio_cansleep
63 (__builtin_constant_p(gpio) ? \
64 __gpio_set_value(gpio, value) : \
65 pxa_gpio_set_value(gpio, value))
66
67#include <asm-generic/gpio.h> /* cansleep wrappers */
68 60
69#define gpio_to_irq(gpio) IRQ_GPIO(gpio) 61#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
70#define irq_to_gpio(irq) IRQ_TO_GPIO(irq) 62#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 442494d71f12..ac175b4d10cb 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -737,25 +737,25 @@
737 737
738#define USIR0 __REG(0x40600058) /* UDC Status Interrupt Register 0 */ 738#define USIR0 __REG(0x40600058) /* UDC Status Interrupt Register 0 */
739 739
740#define USIR0_IR0 (1 << 0) /* Interrup request ep 0 */ 740#define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */
741#define USIR0_IR1 (1 << 1) /* Interrup request ep 1 */ 741#define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */
742#define USIR0_IR2 (1 << 2) /* Interrup request ep 2 */ 742#define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */
743#define USIR0_IR3 (1 << 3) /* Interrup request ep 3 */ 743#define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */
744#define USIR0_IR4 (1 << 4) /* Interrup request ep 4 */ 744#define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */
745#define USIR0_IR5 (1 << 5) /* Interrup request ep 5 */ 745#define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */
746#define USIR0_IR6 (1 << 6) /* Interrup request ep 6 */ 746#define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */
747#define USIR0_IR7 (1 << 7) /* Interrup request ep 7 */ 747#define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */
748 748
749#define USIR1 __REG(0x4060005C) /* UDC Status Interrupt Register 1 */ 749#define USIR1 __REG(0x4060005C) /* UDC Status Interrupt Register 1 */
750 750
751#define USIR1_IR8 (1 << 0) /* Interrup request ep 8 */ 751#define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */
752#define USIR1_IR9 (1 << 1) /* Interrup request ep 9 */ 752#define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */
753#define USIR1_IR10 (1 << 2) /* Interrup request ep 10 */ 753#define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */
754#define USIR1_IR11 (1 << 3) /* Interrup request ep 11 */ 754#define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */
755#define USIR1_IR12 (1 << 4) /* Interrup request ep 12 */ 755#define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */
756#define USIR1_IR13 (1 << 5) /* Interrup request ep 13 */ 756#define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */
757#define USIR1_IR14 (1 << 6) /* Interrup request ep 14 */ 757#define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */
758#define USIR1_IR15 (1 << 7) /* Interrup request ep 15 */ 758#define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */
759 759
760#elif defined(CONFIG_PXA27x) 760#elif defined(CONFIG_PXA27x)
761 761
@@ -1020,7 +1020,7 @@
1020#define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */ 1020#define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */
1021#define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */ 1021#define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */
1022 1022
1023#define ICCR0_AME (1 << 7) /* Adress match enable */ 1023#define ICCR0_AME (1 << 7) /* Address match enable */
1024#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */ 1024#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */
1025#define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */ 1025#define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */
1026#define ICCR0_RXE (1 << 4) /* Receive enable */ 1026#define ICCR0_RXE (1 << 4) /* Receive enable */
@@ -1131,6 +1131,19 @@
1131 * General Purpose I/O 1131 * General Purpose I/O
1132 */ 1132 */
1133 1133
1134#define GPIO0_BASE ((void __iomem *)io_p2v(0x40E00000))
1135#define GPIO1_BASE ((void __iomem *)io_p2v(0x40E00004))
1136#define GPIO2_BASE ((void __iomem *)io_p2v(0x40E00008))
1137#define GPIO3_BASE ((void __iomem *)io_p2v(0x40E00100))
1138
1139#define GPLR_OFFSET 0x00
1140#define GPDR_OFFSET 0x0C
1141#define GPSR_OFFSET 0x18
1142#define GPCR_OFFSET 0x24
1143#define GRER_OFFSET 0x30
1144#define GFER_OFFSET 0x3C
1145#define GEDR_OFFSET 0x48
1146
1134#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */ 1147#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */
1135#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */ 1148#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */
1136#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */ 1149#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */
diff --git a/include/asm-arm/arch-pxa/pxa3xx-regs.h b/include/asm-arm/arch-pxa/pxa3xx-regs.h
index 66d54119757c..8e1b3ead827f 100644
--- a/include/asm-arm/arch-pxa/pxa3xx-regs.h
+++ b/include/asm-arm/arch-pxa/pxa3xx-regs.h
@@ -12,6 +12,19 @@
12 12
13#ifndef __ASM_ARCH_PXA3XX_REGS_H 13#ifndef __ASM_ARCH_PXA3XX_REGS_H
14#define __ASM_ARCH_PXA3XX_REGS_H 14#define __ASM_ARCH_PXA3XX_REGS_H
15/*
16 * Service Power Management Unit (MPMU)
17 */
18#define PMCR __REG(0x40F50000) /* Power Manager Control Register */
19#define PSR __REG(0x40F50004) /* Power Manager S2 Status Register */
20#define PSPR __REG(0x40F50008) /* Power Manager Scratch Pad Register */
21#define PCFR __REG(0x40F5000C) /* Power Manager General Configuration Register */
22#define PWER __REG(0x40F50010) /* Power Manager Wake-up Enable Register */
23#define PWSR __REG(0x40F50014) /* Power Manager Wake-up Status Register */
24#define PECR __REG(0x40F50018) /* Power Manager EXT_WAKEUP[1:0] Control Register */
25#define DCDCSR __REG(0x40F50080) /* DC-DC Controller Status Register */
26#define PVCR __REG(0x40F50100) /* Power Manager Voltage Change Control Register */
27#define PCMD(x) __REG(0x40F50110 + ((x) << 2))
15 28
16/* 29/*
17 * Slave Power Managment Unit 30 * Slave Power Managment Unit
diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h
new file mode 100644
index 000000000000..3e437b7f425a
--- /dev/null
+++ b/include/asm-arm/arch-realview/board-eb.h
@@ -0,0 +1,171 @@
1/*
2 * include/asm-arm/arch-realview/board-eb.h
3 *
4 * Copyright (C) 2007 ARM Limited
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 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#ifndef __ASM_ARCH_BOARD_EB_H
22#define __ASM_ARCH_BOARD_EB_H
23
24#include <asm/arch/platform.h>
25
26/*
27 * RealView EB + ARM11MPCore peripheral addresses
28 */
29#ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB
30#define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */
31#define REALVIEW_EB11MP_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */
32#define REALVIEW_EB11MP_TWD_BASE 0x10100700
33#define REALVIEW_EB11MP_TWD_SIZE 0x00000100
34#define REALVIEW_EB11MP_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */
35#define REALVIEW_EB11MP_L220_BASE 0x10102000 /* L220 registers */
36#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */
37#else
38#define REALVIEW_EB11MP_SCU_BASE 0x1F000000 /* SCU registers */
39#define REALVIEW_EB11MP_GIC_CPU_BASE 0x1F000100 /* Generic interrupt controller CPU interface */
40#define REALVIEW_EB11MP_TWD_BASE 0x1F000700
41#define REALVIEW_EB11MP_TWD_SIZE 0x00000100
42#define REALVIEW_EB11MP_GIC_DIST_BASE 0x1F001000 /* Generic interrupt controller distributor */
43#define REALVIEW_EB11MP_L220_BASE 0x1F002000 /* L220 registers */
44#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0x74 /* Register offset for MPCore sysctl */
45#endif
46
47#define IRQ_EB_GIC_START 32
48
49/*
50 * RealView EB interrupt sources
51 */
52#define IRQ_EB_WDOG (IRQ_EB_GIC_START + 0) /* Watchdog timer */
53#define IRQ_EB_SOFT (IRQ_EB_GIC_START + 1) /* Software interrupt */
54#define IRQ_EB_COMMRx (IRQ_EB_GIC_START + 2) /* Debug Comm Rx interrupt */
55#define IRQ_EB_COMMTx (IRQ_EB_GIC_START + 3) /* Debug Comm Tx interrupt */
56#define IRQ_EB_TIMER0_1 (IRQ_EB_GIC_START + 4) /* Timer 0 and 1 */
57#define IRQ_EB_TIMER2_3 (IRQ_EB_GIC_START + 5) /* Timer 2 and 3 */
58#define IRQ_EB_GPIO0 (IRQ_EB_GIC_START + 6) /* GPIO 0 */
59#define IRQ_EB_GPIO1 (IRQ_EB_GIC_START + 7) /* GPIO 1 */
60#define IRQ_EB_GPIO2 (IRQ_EB_GIC_START + 8) /* GPIO 2 */
61 /* 9 reserved */
62#define IRQ_EB_RTC (IRQ_EB_GIC_START + 10) /* Real Time Clock */
63#define IRQ_EB_SSP (IRQ_EB_GIC_START + 11) /* Synchronous Serial Port */
64#define IRQ_EB_UART0 (IRQ_EB_GIC_START + 12) /* UART 0 on development chip */
65#define IRQ_EB_UART1 (IRQ_EB_GIC_START + 13) /* UART 1 on development chip */
66#define IRQ_EB_UART2 (IRQ_EB_GIC_START + 14) /* UART 2 on development chip */
67#define IRQ_EB_UART3 (IRQ_EB_GIC_START + 15) /* UART 3 on development chip */
68#define IRQ_EB_SCI (IRQ_EB_GIC_START + 16) /* Smart Card Interface */
69#define IRQ_EB_MMCI0A (IRQ_EB_GIC_START + 17) /* Multimedia Card 0A */
70#define IRQ_EB_MMCI0B (IRQ_EB_GIC_START + 18) /* Multimedia Card 0B */
71#define IRQ_EB_AACI (IRQ_EB_GIC_START + 19) /* Audio Codec */
72#define IRQ_EB_KMI0 (IRQ_EB_GIC_START + 20) /* Keyboard/Mouse port 0 */
73#define IRQ_EB_KMI1 (IRQ_EB_GIC_START + 21) /* Keyboard/Mouse port 1 */
74#define IRQ_EB_CHARLCD (IRQ_EB_GIC_START + 22) /* Character LCD */
75#define IRQ_EB_CLCD (IRQ_EB_GIC_START + 23) /* CLCD controller */
76#define IRQ_EB_DMA (IRQ_EB_GIC_START + 24) /* DMA controller */
77#define IRQ_EB_PWRFAIL (IRQ_EB_GIC_START + 25) /* Power failure */
78#define IRQ_EB_PISMO (IRQ_EB_GIC_START + 26) /* PISMO interface */
79#define IRQ_EB_DoC (IRQ_EB_GIC_START + 27) /* Disk on Chip memory controller */
80#define IRQ_EB_ETH (IRQ_EB_GIC_START + 28) /* Ethernet controller */
81#define IRQ_EB_USB (IRQ_EB_GIC_START + 29) /* USB controller */
82#define IRQ_EB_TSPEN (IRQ_EB_GIC_START + 30) /* Touchscreen pen */
83#define IRQ_EB_TSKPAD (IRQ_EB_GIC_START + 31) /* Touchscreen keypad */
84
85/*
86 * RealView EB + ARM11MPCore interrupt sources (primary GIC on the core tile)
87 */
88#define IRQ_EB11MP_AACI (IRQ_EB_GIC_START + 0)
89#define IRQ_EB11MP_TIMER0_1 (IRQ_EB_GIC_START + 1)
90#define IRQ_EB11MP_TIMER2_3 (IRQ_EB_GIC_START + 2)
91#define IRQ_EB11MP_USB (IRQ_EB_GIC_START + 3)
92#define IRQ_EB11MP_UART0 (IRQ_EB_GIC_START + 4)
93#define IRQ_EB11MP_UART1 (IRQ_EB_GIC_START + 5)
94#define IRQ_EB11MP_RTC (IRQ_EB_GIC_START + 6)
95#define IRQ_EB11MP_KMI0 (IRQ_EB_GIC_START + 7)
96#define IRQ_EB11MP_KMI1 (IRQ_EB_GIC_START + 8)
97#define IRQ_EB11MP_ETH (IRQ_EB_GIC_START + 9)
98#define IRQ_EB11MP_EB_IRQ1 (IRQ_EB_GIC_START + 10) /* main GIC */
99#define IRQ_EB11MP_EB_IRQ2 (IRQ_EB_GIC_START + 11) /* tile GIC */
100#define IRQ_EB11MP_EB_FIQ1 (IRQ_EB_GIC_START + 12) /* main GIC */
101#define IRQ_EB11MP_EB_FIQ2 (IRQ_EB_GIC_START + 13) /* tile GIC */
102#define IRQ_EB11MP_MMCI0A (IRQ_EB_GIC_START + 14)
103#define IRQ_EB11MP_MMCI0B (IRQ_EB_GIC_START + 15)
104
105#define IRQ_EB11MP_PMU_CPU0 (IRQ_EB_GIC_START + 17)
106#define IRQ_EB11MP_PMU_CPU1 (IRQ_EB_GIC_START + 18)
107#define IRQ_EB11MP_PMU_CPU2 (IRQ_EB_GIC_START + 19)
108#define IRQ_EB11MP_PMU_CPU3 (IRQ_EB_GIC_START + 20)
109#define IRQ_EB11MP_PMU_SCU0 (IRQ_EB_GIC_START + 21)
110#define IRQ_EB11MP_PMU_SCU1 (IRQ_EB_GIC_START + 22)
111#define IRQ_EB11MP_PMU_SCU2 (IRQ_EB_GIC_START + 23)
112#define IRQ_EB11MP_PMU_SCU3 (IRQ_EB_GIC_START + 24)
113#define IRQ_EB11MP_PMU_SCU4 (IRQ_EB_GIC_START + 25)
114#define IRQ_EB11MP_PMU_SCU5 (IRQ_EB_GIC_START + 26)
115#define IRQ_EB11MP_PMU_SCU6 (IRQ_EB_GIC_START + 27)
116#define IRQ_EB11MP_PMU_SCU7 (IRQ_EB_GIC_START + 28)
117
118#define IRQ_EB11MP_L220_EVENT (IRQ_EB_GIC_START + 29)
119#define IRQ_EB11MP_L220_SLAVE (IRQ_EB_GIC_START + 30)
120#define IRQ_EB11MP_L220_DECODE (IRQ_EB_GIC_START + 31)
121
122#define IRQ_EB11MP_UART2 -1
123#define IRQ_EB11MP_UART3 -1
124#define IRQ_EB11MP_CLCD -1
125#define IRQ_EB11MP_DMA -1
126#define IRQ_EB11MP_WDOG -1
127#define IRQ_EB11MP_GPIO0 -1
128#define IRQ_EB11MP_GPIO1 -1
129#define IRQ_EB11MP_GPIO2 -1
130#define IRQ_EB11MP_SCI -1
131#define IRQ_EB11MP_SSP -1
132
133#define NR_GIC_EB11MP 2
134
135/*
136 * Only define NR_IRQS if less than NR_IRQS_EB
137 */
138#define NR_IRQS_EB (IRQ_EB_GIC_START + 96)
139
140#if defined(CONFIG_MACH_REALVIEW_EB) \
141 && (!defined(NR_IRQS) || (NR_IRQS < NR_IRQS_EB))
142#undef NR_IRQS
143#define NR_IRQS NR_IRQS_EB
144#endif
145
146#if defined(CONFIG_REALVIEW_EB_ARM11MP) \
147 && (!defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_EB11MP))
148#undef MAX_GIC_NR
149#define MAX_GIC_NR NR_GIC_EB11MP
150#endif
151
152/*
153 * Core tile identification (REALVIEW_SYS_PROCID)
154 */
155#define REALVIEW_EB_PROC_MASK 0xFF000000
156#define REALVIEW_EB_PROC_ARM7TDMI 0x00000000
157#define REALVIEW_EB_PROC_ARM9 0x02000000
158#define REALVIEW_EB_PROC_ARM11 0x04000000
159#define REALVIEW_EB_PROC_ARM11MP 0x06000000
160
161#define check_eb_proc(proc_type) \
162 ((readl(__io_address(REALVIEW_SYS_PROCID)) & REALVIEW_EB_PROC_MASK) \
163 == proc_type)
164
165#ifdef CONFIG_REALVIEW_EB_ARM11MP
166#define core_tile_eb11mp() check_eb_proc(REALVIEW_EB_PROC_ARM11MP)
167#else
168#define core_tile_eb11mp() 0
169#endif
170
171#endif /* __ASM_ARCH_BOARD_EB_H */
diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S
index 3b4e2076603a..cd26306d8e57 100644
--- a/include/asm-arm/arch-realview/entry-macro.S
+++ b/include/asm-arm/arch-realview/entry-macro.S
@@ -14,7 +14,8 @@
14 .endm 14 .endm
15 15
16 .macro get_irqnr_preamble, base, tmp 16 .macro get_irqnr_preamble, base, tmp
17 ldr \base, =IO_ADDRESS(REALVIEW_GIC_CPU_BASE) 17 ldr \base, =gic_cpu_base_addr
18 ldr \base, [\base]
18 .endm 19 .endm
19 20
20 .macro arch_ret_to_user, tmp1, tmp2 21 .macro arch_ret_to_user, tmp1, tmp2
diff --git a/include/asm-arm/arch-realview/hardware.h b/include/asm-arm/arch-realview/hardware.h
index aa78fe087ab2..bad8d7ce9bfe 100644
--- a/include/asm-arm/arch-realview/hardware.h
+++ b/include/asm-arm/arch-realview/hardware.h
@@ -23,7 +23,6 @@
23#define __ASM_ARCH_HARDWARE_H 23#define __ASM_ARCH_HARDWARE_H
24 24
25#include <asm/sizes.h> 25#include <asm/sizes.h>
26#include <asm/arch/platform.h>
27 26
28/* macro to get at IO space when running virtually */ 27/* macro to get at IO space when running virtually */
29#define IO_ADDRESS(x) ((((x) & 0x0effffff) | (((x) >> 4) & 0x0f000000)) + 0xf0000000) 28#define IO_ADDRESS(x) ((((x) & 0x0effffff) | (((x) >> 4) & 0x0f000000)) + 0xf0000000)
diff --git a/include/asm-arm/arch-realview/irqs.h b/include/asm-arm/arch-realview/irqs.h
index 5a5db56f86b8..ad0c911002fc 100644
--- a/include/asm-arm/arch-realview/irqs.h
+++ b/include/asm-arm/arch-realview/irqs.h
@@ -19,103 +19,18 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#include <asm/arch/platform.h> 22#ifndef __ASM_ARCH_IRQS_H
23#define __ASM_ARCH_IRQS_H
23 24
24#define IRQ_LOCALTIMER 29 25#include <asm/arch/board-eb.h>
25#define IRQ_LOCALWDOG 30
26 26
27/* 27#define IRQ_LOCALTIMER 29
28 * IRQ interrupts definitions are the same the INT definitions 28#define IRQ_LOCALWDOG 30
29 * held within platform.h
30 */
31#define IRQ_GIC_START 32
32#define IRQ_WDOGINT (IRQ_GIC_START + INT_WDOGINT)
33#define IRQ_SOFTINT (IRQ_GIC_START + INT_SOFTINT)
34#define IRQ_COMMRx (IRQ_GIC_START + INT_COMMRx)
35#define IRQ_COMMTx (IRQ_GIC_START + INT_COMMTx)
36#define IRQ_TIMERINT0_1 (IRQ_GIC_START + INT_TIMERINT0_1)
37#define IRQ_TIMERINT2_3 (IRQ_GIC_START + INT_TIMERINT2_3)
38#define IRQ_GPIOINT0 (IRQ_GIC_START + INT_GPIOINT0)
39#define IRQ_GPIOINT1 (IRQ_GIC_START + INT_GPIOINT1)
40#define IRQ_GPIOINT2 (IRQ_GIC_START + INT_GPIOINT2)
41#define IRQ_GPIOINT3 (IRQ_GIC_START + INT_GPIOINT3)
42#define IRQ_RTCINT (IRQ_GIC_START + INT_RTCINT)
43#define IRQ_SSPINT (IRQ_GIC_START + INT_SSPINT)
44#define IRQ_UARTINT0 (IRQ_GIC_START + INT_UARTINT0)
45#define IRQ_UARTINT1 (IRQ_GIC_START + INT_UARTINT1)
46#define IRQ_UARTINT2 (IRQ_GIC_START + INT_UARTINT2)
47#define IRQ_UART3 (IRQ_GIC_START + INT_UARTINT3)
48#define IRQ_SCIINT (IRQ_GIC_START + INT_SCIINT)
49#define IRQ_CLCDINT (IRQ_GIC_START + INT_CLCDINT)
50#define IRQ_DMAINT (IRQ_GIC_START + INT_DMAINT)
51#define IRQ_PWRFAILINT (IRQ_GIC_START + INT_PWRFAILINT)
52#define IRQ_MBXINT (IRQ_GIC_START + INT_MBXINT)
53#define IRQ_GNDINT (IRQ_GIC_START + INT_GNDINT)
54#define IRQ_MMCI0B (IRQ_GIC_START + INT_MMCI0B)
55#define IRQ_MMCI1B (IRQ_GIC_START + INT_MMCI1B)
56#define IRQ_KMI0 (IRQ_GIC_START + INT_KMI0)
57#define IRQ_KMI1 (IRQ_GIC_START + INT_KMI1)
58#define IRQ_SCI3 (IRQ_GIC_START + INT_SCI3)
59#define IRQ_CLCD (IRQ_GIC_START + INT_CLCD)
60#define IRQ_TOUCH (IRQ_GIC_START + INT_TOUCH)
61#define IRQ_KEYPAD (IRQ_GIC_START + INT_KEYPAD)
62#define IRQ_DoC (IRQ_GIC_START + INT_DoC)
63#define IRQ_MMCI0A (IRQ_GIC_START + INT_MMCI0A)
64#define IRQ_MMCI1A (IRQ_GIC_START + INT_MMCI1A)
65#define IRQ_AACI (IRQ_GIC_START + INT_AACI)
66#define IRQ_ETH (IRQ_GIC_START + INT_ETH)
67#define IRQ_USB (IRQ_GIC_START + INT_USB)
68#define IRQ_PMU_CPU0 (IRQ_GIC_START + INT_PMU_CPU0)
69#define IRQ_PMU_CPU1 (IRQ_GIC_START + INT_PMU_CPU1)
70#define IRQ_PMU_CPU2 (IRQ_GIC_START + INT_PMU_CPU2)
71#define IRQ_PMU_CPU3 (IRQ_GIC_START + INT_PMU_CPU3)
72#define IRQ_PMU_SCU0 (IRQ_GIC_START + INT_PMU_SCU0)
73#define IRQ_PMU_SCU1 (IRQ_GIC_START + INT_PMU_SCU1)
74#define IRQ_PMU_SCU2 (IRQ_GIC_START + INT_PMU_SCU2)
75#define IRQ_PMU_SCU3 (IRQ_GIC_START + INT_PMU_SCU3)
76#define IRQ_PMU_SCU4 (IRQ_GIC_START + INT_PMU_SCU4)
77#define IRQ_PMU_SCU5 (IRQ_GIC_START + INT_PMU_SCU5)
78#define IRQ_PMU_SCU6 (IRQ_GIC_START + INT_PMU_SCU6)
79#define IRQ_PMU_SCU7 (IRQ_GIC_START + INT_PMU_SCU7)
80 29
81#define IRQ_EB_IRQ1 (IRQ_GIC_START + INT_EB_IRQ1) 30#define IRQ_GIC_START 32
82#define IRQ_EB_IRQ2 (IRQ_GIC_START + INT_EB_IRQ2)
83 31
84#define IRQMASK_WDOGINT INTMASK_WDOGINT 32#ifndef NR_IRQS
85#define IRQMASK_SOFTINT INTMASK_SOFTINT 33#error "NR_IRQS not defined by the board-specific files"
86#define IRQMASK_COMMRx INTMASK_COMMRx 34#endif
87#define IRQMASK_COMMTx INTMASK_COMMTx
88#define IRQMASK_TIMERINT0_1 INTMASK_TIMERINT0_1
89#define IRQMASK_TIMERINT2_3 INTMASK_TIMERINT2_3
90#define IRQMASK_GPIOINT0 INTMASK_GPIOINT0
91#define IRQMASK_GPIOINT1 INTMASK_GPIOINT1
92#define IRQMASK_GPIOINT2 INTMASK_GPIOINT2
93#define IRQMASK_GPIOINT3 INTMASK_GPIOINT3
94#define IRQMASK_RTCINT INTMASK_RTCINT
95#define IRQMASK_SSPINT INTMASK_SSPINT
96#define IRQMASK_UARTINT0 INTMASK_UARTINT0
97#define IRQMASK_UARTINT1 INTMASK_UARTINT1
98#define IRQMASK_UARTINT2 INTMASK_UARTINT2
99#define IRQMASK_SCIINT INTMASK_SCIINT
100#define IRQMASK_CLCDINT INTMASK_CLCDINT
101#define IRQMASK_DMAINT INTMASK_DMAINT
102#define IRQMASK_PWRFAILINT INTMASK_PWRFAILINT
103#define IRQMASK_MBXINT INTMASK_MBXINT
104#define IRQMASK_GNDINT INTMASK_GNDINT
105#define IRQMASK_MMCI0B INTMASK_MMCI0B
106#define IRQMASK_MMCI1B INTMASK_MMCI1B
107#define IRQMASK_KMI0 INTMASK_KMI0
108#define IRQMASK_KMI1 INTMASK_KMI1
109#define IRQMASK_SCI3 INTMASK_SCI3
110#define IRQMASK_UART3 INTMASK_UART3
111#define IRQMASK_CLCD INTMASK_CLCD
112#define IRQMASK_TOUCH INTMASK_TOUCH
113#define IRQMASK_KEYPAD INTMASK_KEYPAD
114#define IRQMASK_DoC INTMASK_DoC
115#define IRQMASK_MMCI0A INTMASK_MMCI0A
116#define IRQMASK_MMCI1A INTMASK_MMCI1A
117#define IRQMASK_AACI INTMASK_AACI
118#define IRQMASK_ETH INTMASK_ETH
119#define IRQMASK_USB INTMASK_USB
120 35
121#define NR_IRQS (IRQ_GIC_START + 96) 36#endif
diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h
index 6e0eab95a3a2..4fd351b5e4a2 100644
--- a/include/asm-arm/arch-realview/platform.h
+++ b/include/asm-arm/arch-realview/platform.h
@@ -18,8 +18,8 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#ifndef __address_h 21#ifndef __ASM_ARCH_PLATFORM_H
22#define __address_h 1 22#define __ASM_ARCH_PLATFORM_H
23 23
24/* 24/*
25 * Memory definitions 25 * Memory definitions
@@ -81,11 +81,12 @@
81#define REALVIEW_SYS_24MHz_OFFSET 0x5C 81#define REALVIEW_SYS_24MHz_OFFSET 0x5C
82#define REALVIEW_SYS_MISC_OFFSET 0x60 82#define REALVIEW_SYS_MISC_OFFSET 0x60
83#define REALVIEW_SYS_IOSEL_OFFSET 0x70 83#define REALVIEW_SYS_IOSEL_OFFSET 0x70
84#define REALVIEW_SYS_TEST_OSC0_OFFSET 0x80 84#define REALVIEW_SYS_PROCID_OFFSET 0x84
85#define REALVIEW_SYS_TEST_OSC1_OFFSET 0x84 85#define REALVIEW_SYS_TEST_OSC0_OFFSET 0xC0
86#define REALVIEW_SYS_TEST_OSC2_OFFSET 0x88 86#define REALVIEW_SYS_TEST_OSC1_OFFSET 0xC4
87#define REALVIEW_SYS_TEST_OSC3_OFFSET 0x8C 87#define REALVIEW_SYS_TEST_OSC2_OFFSET 0xC8
88#define REALVIEW_SYS_TEST_OSC4_OFFSET 0x90 88#define REALVIEW_SYS_TEST_OSC3_OFFSET 0xCC
89#define REALVIEW_SYS_TEST_OSC4_OFFSET 0xD0
89 90
90#define REALVIEW_SYS_BASE 0x10000000 91#define REALVIEW_SYS_BASE 0x10000000
91#define REALVIEW_SYS_ID (REALVIEW_SYS_BASE + REALVIEW_SYS_ID_OFFSET) 92#define REALVIEW_SYS_ID (REALVIEW_SYS_BASE + REALVIEW_SYS_ID_OFFSET)
@@ -114,6 +115,7 @@
114#define REALVIEW_SYS_24MHz (REALVIEW_SYS_BASE + REALVIEW_SYS_24MHz_OFFSET) 115#define REALVIEW_SYS_24MHz (REALVIEW_SYS_BASE + REALVIEW_SYS_24MHz_OFFSET)
115#define REALVIEW_SYS_MISC (REALVIEW_SYS_BASE + REALVIEW_SYS_MISC_OFFSET) 116#define REALVIEW_SYS_MISC (REALVIEW_SYS_BASE + REALVIEW_SYS_MISC_OFFSET)
116#define REALVIEW_SYS_IOSEL (REALVIEW_SYS_BASE + REALVIEW_SYS_IOSEL_OFFSET) 117#define REALVIEW_SYS_IOSEL (REALVIEW_SYS_BASE + REALVIEW_SYS_IOSEL_OFFSET)
118#define REALVIEW_SYS_PROCID (REALVIEW_SYS_BASE + REALVIEW_SYS_PROCID_OFFSET)
117#define REALVIEW_SYS_TEST_OSC0 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC0_OFFSET) 119#define REALVIEW_SYS_TEST_OSC0 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC0_OFFSET)
118#define REALVIEW_SYS_TEST_OSC1 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC1_OFFSET) 120#define REALVIEW_SYS_TEST_OSC1 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC1_OFFSET)
119#define REALVIEW_SYS_TEST_OSC2 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC2_OFFSET) 121#define REALVIEW_SYS_TEST_OSC2 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC2_OFFSET)
@@ -203,30 +205,8 @@
203 /* Reserved 0x1001A000 - 0x1001FFFF */ 205 /* Reserved 0x1001A000 - 0x1001FFFF */
204#define REALVIEW_CLCD_BASE 0x10020000 /* CLCD */ 206#define REALVIEW_CLCD_BASE 0x10020000 /* CLCD */
205#define REALVIEW_DMAC_BASE 0x10030000 /* DMA controller */ 207#define REALVIEW_DMAC_BASE 0x10030000 /* DMA controller */
206#ifndef CONFIG_REALVIEW_MPCORE
207#define REALVIEW_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ 208#define REALVIEW_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */
208#define REALVIEW_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ 209#define REALVIEW_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */
209#else
210#ifdef CONFIG_REALVIEW_MPCORE_REVB
211#define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */
212#define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */
213#define REALVIEW_TWD_BASE 0x10100700
214#define REALVIEW_TWD_SIZE 0x00000100
215#define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */
216#define REALVIEW_MPCORE_L220_BASE 0x10102000 /* L220 registers */
217#define REALVIEW_MPCORE_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */
218#else
219#define REALVIEW_MPCORE_SCU_BASE 0x1F000000 /* SCU registers */
220#define REALVIEW_GIC_CPU_BASE 0x1F000100 /* Generic interrupt controller CPU interface */
221#define REALVIEW_TWD_BASE 0x1F000700
222#define REALVIEW_TWD_SIZE 0x00000100
223#define REALVIEW_GIC_DIST_BASE 0x1F001000 /* Generic interrupt controller distributor */
224#define REALVIEW_MPCORE_L220_BASE 0x1F002000 /* L220 registers */
225#define REALVIEW_MPCORE_SYS_PLD_CTRL1 0x74 /* Register offset for MPCore sysctl */
226#endif
227#define REALVIEW_GIC1_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */
228#define REALVIEW_GIC1_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */
229#endif
230#define REALVIEW_SMC_BASE 0x10080000 /* SMC */ 210#define REALVIEW_SMC_BASE 0x10080000 /* SMC */
231 /* Reserved 0x10090000 - 0x100EFFFF */ 211 /* Reserved 0x10090000 - 0x100EFFFF */
232 212
@@ -283,134 +263,6 @@
283#define REALVIEW_INTREG_OFFSET 0x8 /* Interrupt control */ 263#define REALVIEW_INTREG_OFFSET 0x8 /* Interrupt control */
284#define REALVIEW_DECODE_OFFSET 0xC /* Fitted logic modules */ 264#define REALVIEW_DECODE_OFFSET 0xC /* Fitted logic modules */
285 265
286/* ------------------------------------------------------------------------
287 * Interrupts - bit assignment (primary)
288 * ------------------------------------------------------------------------
289 */
290#ifndef CONFIG_REALVIEW_MPCORE
291#define INT_WDOGINT 0 /* Watchdog timer */
292#define INT_SOFTINT 1 /* Software interrupt */
293#define INT_COMMRx 2 /* Debug Comm Rx interrupt */
294#define INT_COMMTx 3 /* Debug Comm Tx interrupt */
295#define INT_TIMERINT0_1 4 /* Timer 0 and 1 */
296#define INT_TIMERINT2_3 5 /* Timer 2 and 3 */
297#define INT_GPIOINT0 6 /* GPIO 0 */
298#define INT_GPIOINT1 7 /* GPIO 1 */
299#define INT_GPIOINT2 8 /* GPIO 2 */
300/* 9 reserved */
301#define INT_RTCINT 10 /* Real Time Clock */
302#define INT_SSPINT 11 /* Synchronous Serial Port */
303#define INT_UARTINT0 12 /* UART 0 on development chip */
304#define INT_UARTINT1 13 /* UART 1 on development chip */
305#define INT_UARTINT2 14 /* UART 2 on development chip */
306#define INT_UARTINT3 15 /* UART 3 on development chip */
307#define INT_SCIINT 16 /* Smart Card Interface */
308#define INT_MMCI0A 17 /* Multimedia Card 0A */
309#define INT_MMCI0B 18 /* Multimedia Card 0B */
310#define INT_AACI 19 /* Audio Codec */
311#define INT_KMI0 20 /* Keyboard/Mouse port 0 */
312#define INT_KMI1 21 /* Keyboard/Mouse port 1 */
313#define INT_CHARLCD 22 /* Character LCD */
314#define INT_CLCDINT 23 /* CLCD controller */
315#define INT_DMAINT 24 /* DMA controller */
316#define INT_PWRFAILINT 25 /* Power failure */
317#define INT_PISMO 26
318#define INT_DoC 27 /* Disk on Chip memory controller */
319#define INT_ETH 28 /* Ethernet controller */
320#define INT_USB 29 /* USB controller */
321#define INT_TSPENINT 30 /* Touchscreen pen */
322#define INT_TSKPADINT 31 /* Touchscreen keypad */
323
324#else
325
326#define MAX_GIC_NR 2
327
328#define INT_AACI 0
329#define INT_TIMERINT0_1 1
330#define INT_TIMERINT2_3 2
331#define INT_USB 3
332#define INT_UARTINT0 4
333#define INT_UARTINT1 5
334#define INT_RTCINT 6
335#define INT_KMI0 7
336#define INT_KMI1 8
337#define INT_ETH 9
338#define INT_EB_IRQ1 10 /* main GIC */
339#define INT_EB_IRQ2 11 /* tile GIC */
340#define INT_EB_FIQ1 12 /* main GIC */
341#define INT_EB_FIQ2 13 /* tile GIC */
342#define INT_MMCI0A 14
343#define INT_MMCI0B 15
344
345#define INT_PMU_CPU0 17
346#define INT_PMU_CPU1 18
347#define INT_PMU_CPU2 19
348#define INT_PMU_CPU3 20
349#define INT_PMU_SCU0 21
350#define INT_PMU_SCU1 22
351#define INT_PMU_SCU2 23
352#define INT_PMU_SCU3 24
353#define INT_PMU_SCU4 25
354#define INT_PMU_SCU5 26
355#define INT_PMU_SCU6 27
356#define INT_PMU_SCU7 28
357
358#define INT_L220_EVENT 29
359#define INT_L220_SLAVE 30
360#define INT_L220_DECODE 31
361
362#define INT_UARTINT2 -1
363#define INT_UARTINT3 -1
364#define INT_CLCDINT -1
365#define INT_DMAINT -1
366#define INT_WDOGINT -1
367#define INT_GPIOINT0 -1
368#define INT_GPIOINT1 -1
369#define INT_GPIOINT2 -1
370#define INT_SCIINT -1
371#define INT_SSPINT -1
372#endif
373
374/*
375 * Interrupt bit positions
376 *
377 */
378#define INTMASK_WDOGINT (1 << INT_WDOGINT)
379#define INTMASK_SOFTINT (1 << INT_SOFTINT)
380#define INTMASK_COMMRx (1 << INT_COMMRx)
381#define INTMASK_COMMTx (1 << INT_COMMTx)
382#define INTMASK_TIMERINT0_1 (1 << INT_TIMERINT0_1)
383#define INTMASK_TIMERINT2_3 (1 << INT_TIMERINT2_3)
384#define INTMASK_GPIOINT0 (1 << INT_GPIOINT0)
385#define INTMASK_GPIOINT1 (1 << INT_GPIOINT1)
386#define INTMASK_GPIOINT2 (1 << INT_GPIOINT2)
387#define INTMASK_RTCINT (1 << INT_RTCINT)
388#define INTMASK_SSPINT (1 << INT_SSPINT)
389#define INTMASK_UARTINT0 (1 << INT_UARTINT0)
390#define INTMASK_UARTINT1 (1 << INT_UARTINT1)
391#define INTMASK_UARTINT2 (1 << INT_UARTINT2)
392#define INTMASK_UARTINT3 (1 << INT_UARTINT3)
393#define INTMASK_SCIINT (1 << INT_SCIINT)
394#define INTMASK_MMCI0A (1 << INT_MMCI0A)
395#define INTMASK_MMCI0B (1 << INT_MMCI0B)
396#define INTMASK_AACI (1 << INT_AACI)
397#define INTMASK_KMI0 (1 << INT_KMI0)
398#define INTMASK_KMI1 (1 << INT_KMI1)
399#define INTMASK_CHARLCD (1 << INT_CHARLCD)
400#define INTMASK_CLCDINT (1 << INT_CLCDINT)
401#define INTMASK_DMAINT (1 << INT_DMAINT)
402#define INTMASK_PWRFAILINT (1 << INT_PWRFAILINT)
403#define INTMASK_PISMO (1 << INT_PISMO)
404#define INTMASK_DoC (1 << INT_DoC)
405#define INTMASK_ETH (1 << INT_ETH)
406#define INTMASK_USB (1 << INT_USB)
407#define INTMASK_TSPENINT (1 << INT_TSPENINT)
408#define INTMASK_TSKPADINT (1 << INT_TSKPADINT)
409
410#define MAXIRQNUM 31
411#define MAXFIQNUM 31
412#define MAXSWINUM 31
413
414/* 266/*
415 * Application Flash 267 * Application Flash
416 * 268 *
@@ -463,6 +315,4 @@
463#define REALVIEW_CSR_BASE 0x10000000 315#define REALVIEW_CSR_BASE 0x10000000
464#define REALVIEW_CSR_SIZE 0x10000000 316#define REALVIEW_CSR_SIZE 0x10000000
465 317
466#endif 318#endif /* __ASM_ARCH_PLATFORM_H */
467
468/* END */
diff --git a/include/asm-arm/arch-realview/scu.h b/include/asm-arm/arch-realview/scu.h
index cc293640178e..08b3db883c36 100644
--- a/include/asm-arm/arch-realview/scu.h
+++ b/include/asm-arm/arch-realview/scu.h
@@ -1,8 +1,8 @@
1#ifndef __ASMARM_ARCH_SCU_H 1#ifndef __ASMARM_ARCH_SCU_H
2#define __ASMARM_ARCH_SCU_H 2#define __ASMARM_ARCH_SCU_H
3 3
4#include <asm/arch/platform.h> 4#include <asm/arch/board-eb.h>
5 5
6#define SCU_BASE REALVIEW_MPCORE_SCU_BASE 6#define SCU_BASE REALVIEW_EB11MP_SCU_BASE
7 7
8#endif 8#endif
diff --git a/include/asm-arm/arch-realview/uncompress.h b/include/asm-arm/arch-realview/uncompress.h
index f05631d76743..3d5c2db07a26 100644
--- a/include/asm-arm/arch-realview/uncompress.h
+++ b/include/asm-arm/arch-realview/uncompress.h
@@ -19,6 +19,8 @@
19 */ 19 */
20#include <asm/hardware.h> 20#include <asm/hardware.h>
21 21
22#include <asm/arch/platform.h>
23
22#define AMBA_UART_DR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x00)) 24#define AMBA_UART_DR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x00))
23#define AMBA_UART_LCRH (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x2c)) 25#define AMBA_UART_LCRH (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x2c))
24#define AMBA_UART_CR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x30)) 26#define AMBA_UART_CR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x30))
diff --git a/include/asm-arm/arch-versatile/irqs.h b/include/asm-arm/arch-versatile/irqs.h
index 745aa841b31a..f7263b99403b 100644
--- a/include/asm-arm/arch-versatile/irqs.h
+++ b/include/asm-arm/arch-versatile/irqs.h
@@ -22,7 +22,7 @@
22#include <asm/arch/platform.h> 22#include <asm/arch/platform.h>
23 23
24/* 24/*
25 * IRQ interrupts definitions are the same the INT definitions 25 * IRQ interrupts definitions are the same as the INT definitions
26 * held within platform.h 26 * held within platform.h
27 */ 27 */
28#define IRQ_VIC_START 0 28#define IRQ_VIC_START 0
@@ -94,7 +94,7 @@
94#define IRQMASK_VICSOURCE31 INTMASK_VICSOURCE31 94#define IRQMASK_VICSOURCE31 INTMASK_VICSOURCE31
95 95
96/* 96/*
97 * FIQ interrupts definitions are the same the INT definitions. 97 * FIQ interrupts definitions are the same as the INT definitions.
98 */ 98 */
99#define FIQ_WDOGINT INT_WDOGINT 99#define FIQ_WDOGINT INT_WDOGINT
100#define FIQ_SOFTINT INT_SOFTINT 100#define FIQ_SOFTINT INT_SOFTINT
diff --git a/include/asm-arm/hardware/arm_twd.h b/include/asm-arm/hardware/arm_twd.h
index 131d5b40e072..e521b70713c8 100644
--- a/include/asm-arm/hardware/arm_twd.h
+++ b/include/asm-arm/hardware/arm_twd.h
@@ -1,7 +1,7 @@
1#ifndef __ASM_HARDWARE_TWD_H 1#ifndef __ASM_HARDWARE_TWD_H
2#define __ASM_HARDWARE_TWD_H 2#define __ASM_HARDWARE_TWD_H
3 3
4#define TWD_TIMER_LOAD 0x00 4#define TWD_TIMER_LOAD 0x00
5#define TWD_TIMER_COUNTER 0x04 5#define TWD_TIMER_COUNTER 0x04
6#define TWD_TIMER_CONTROL 0x08 6#define TWD_TIMER_CONTROL 0x08
7#define TWD_TIMER_INTSTAT 0x0C 7#define TWD_TIMER_INTSTAT 0x0C
@@ -13,4 +13,9 @@
13#define TWD_WDOG_RESETSTAT 0x30 13#define TWD_WDOG_RESETSTAT 0x30
14#define TWD_WDOG_DISABLE 0x34 14#define TWD_WDOG_DISABLE 0x34
15 15
16#define TWD_TIMER_CONTROL_ENABLE (1 << 0)
17#define TWD_TIMER_CONTROL_ONESHOT (0 << 1)
18#define TWD_TIMER_CONTROL_PERIODIC (1 << 1)
19#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)
20
16#endif 21#endif
diff --git a/include/asm-arm/hardware/it8152.h b/include/asm-arm/hardware/it8152.h
index aaebb61aca48..74b5fff7f575 100644
--- a/include/asm-arm/hardware/it8152.h
+++ b/include/asm-arm/hardware/it8152.h
@@ -42,7 +42,7 @@ extern unsigned long it8152_base_address;
42#define IT8152_GPIO_GPDR __REG_IT8152(0x3f00500) 42#define IT8152_GPIO_GPDR __REG_IT8152(0x3f00500)
43 43
44/* 44/*
45 Interrup contoler per register summary: 45 Interrupt controller per register summary:
46 --------------------------------------- 46 ---------------------------------------
47 LCDNIRR: 47 LCDNIRR:
48 IT8152_LD_IRQ(8) PCICLK stop 48 IT8152_LD_IRQ(8) PCICLK stop
diff --git a/include/asm-arm/kexec.h b/include/asm-arm/kexec.h
index 46dcc4d0b9bd..1ee17b6951d0 100644
--- a/include/asm-arm/kexec.h
+++ b/include/asm-arm/kexec.h
@@ -16,6 +16,9 @@
16 16
17#define KEXEC_BOOT_PARAMS_SIZE 1536 17#define KEXEC_BOOT_PARAMS_SIZE 1536
18 18
19#define KEXEC_ARM_ATAGS_OFFSET 0x1000
20#define KEXEC_ARM_ZIMAGE_OFFSET 0x8000
21
19#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
20 23
21struct kimage; 24struct kimage;
diff --git a/include/asm-arm/mach/udc_pxa2xx.h b/include/asm-arm/mach/udc_pxa2xx.h
index ff0a95715a07..f9f3606986c2 100644
--- a/include/asm-arm/mach/udc_pxa2xx.h
+++ b/include/asm-arm/mach/udc_pxa2xx.h
@@ -16,10 +16,12 @@ struct pxa2xx_udc_mach_info {
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ 16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17 17
18 /* Boards following the design guidelines in the developer's manual, 18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane 19 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number 20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits. 21 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
22 * Note that sometimes the signals go through inverters...
22 */ 23 */
24 bool gpio_vbus_inverted;
23 u16 gpio_vbus; /* high == vbus present */ 25 u16 gpio_vbus; /* high == vbus present */
24 u16 gpio_pullup; /* high == pullup activated */ 26 u16 gpio_pullup; /* high == pullup activated */
25}; 27};
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h
index 4d4394552911..fb6c6e3222bd 100644
--- a/include/asm-arm/pgalloc.h
+++ b/include/asm-arm/pgalloc.h
@@ -27,14 +27,14 @@
27 * Since we have only two-level page tables, these are trivial 27 * Since we have only two-level page tables, these are trivial
28 */ 28 */
29#define pmd_alloc_one(mm,addr) ({ BUG(); ((pmd_t *)2); }) 29#define pmd_alloc_one(mm,addr) ({ BUG(); ((pmd_t *)2); })
30#define pmd_free(pmd) do { } while (0) 30#define pmd_free(mm, pmd) do { } while (0)
31#define pgd_populate(mm,pmd,pte) BUG() 31#define pgd_populate(mm,pmd,pte) BUG()
32 32
33extern pgd_t *get_pgd_slow(struct mm_struct *mm); 33extern pgd_t *get_pgd_slow(struct mm_struct *mm);
34extern void free_pgd_slow(pgd_t *pgd); 34extern void free_pgd_slow(struct mm_struct *mm, pgd_t *pgd);
35 35
36#define pgd_alloc(mm) get_pgd_slow(mm) 36#define pgd_alloc(mm) get_pgd_slow(mm)
37#define pgd_free(pgd) free_pgd_slow(pgd) 37#define pgd_free(mm, pgd) free_pgd_slow(mm, pgd)
38 38
39/* 39/*
40 * Allocate one PTE table. 40 * Allocate one PTE table.
@@ -83,7 +83,7 @@ pte_alloc_one(struct mm_struct *mm, unsigned long addr)
83/* 83/*
84 * Free one PTE table. 84 * Free one PTE table.
85 */ 85 */
86static inline void pte_free_kernel(pte_t *pte) 86static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
87{ 87{
88 if (pte) { 88 if (pte) {
89 pte -= PTRS_PER_PTE; 89 pte -= PTRS_PER_PTE;
@@ -91,7 +91,7 @@ static inline void pte_free_kernel(pte_t *pte)
91 } 91 }
92} 92}
93 93
94static inline void pte_free(struct page *pte) 94static inline void pte_free(struct mm_struct *mm, struct page *pte)
95{ 95{
96 __free_page(pte); 96 __free_page(pte);
97} 97}
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h
index f67acce387e7..af99636db400 100644
--- a/include/asm-arm/smp.h
+++ b/include/asm-arm/smp.h
@@ -61,6 +61,11 @@ extern void smp_cross_call(cpumask_t callmap);
61extern void smp_send_timer(void); 61extern void smp_send_timer(void);
62 62
63/* 63/*
64 * Broadcast a clock event to other CPUs.
65 */
66extern void smp_timer_broadcast(cpumask_t mask);
67
68/*
64 * Boot a secondary CPU, and assign it the specified idle task. 69 * Boot a secondary CPU, and assign it the specified idle task.
65 * This also gives us the initial stack to use for this CPU. 70 * This also gives us the initial stack to use for this CPU.
66 */ 71 */
@@ -96,11 +101,12 @@ extern void platform_cpu_die(unsigned int cpu);
96extern int platform_cpu_kill(unsigned int cpu); 101extern int platform_cpu_kill(unsigned int cpu);
97extern void platform_cpu_enable(unsigned int cpu); 102extern void platform_cpu_enable(unsigned int cpu);
98 103
99#ifdef CONFIG_LOCAL_TIMERS
100/* 104/*
101 * Setup a local timer interrupt for a CPU. 105 * Local timer interrupt handling function (can be IPI'ed).
102 */ 106 */
103extern void local_timer_setup(unsigned int cpu); 107extern void local_timer_interrupt(void);
108
109#ifdef CONFIG_LOCAL_TIMERS
104 110
105/* 111/*
106 * Stop a local timer interrupt. 112 * Stop a local timer interrupt.
@@ -114,10 +120,6 @@ extern int local_timer_ack(void);
114 120
115#else 121#else
116 122
117static inline void local_timer_setup(unsigned int cpu)
118{
119}
120
121static inline void local_timer_stop(unsigned int cpu) 123static inline void local_timer_stop(unsigned int cpu)
122{ 124{
123} 125}
@@ -125,6 +127,11 @@ static inline void local_timer_stop(unsigned int cpu)
125#endif 127#endif
126 128
127/* 129/*
130 * Setup a local timer interrupt for a CPU.
131 */
132extern void local_timer_setup(unsigned int cpu);
133
134/*
128 * show local interrupt info 135 * show local interrupt info
129 */ 136 */
130extern void show_local_irqs(struct seq_file *); 137extern void show_local_irqs(struct seq_file *);
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 65a1a64bf934..6817be9573a6 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/tlb.h b/include/asm-arm/tlb.h
index cb740025d413..36bd402a21cb 100644
--- a/include/asm-arm/tlb.h
+++ b/include/asm-arm/tlb.h
@@ -85,8 +85,8 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
85} 85}
86 86
87#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) 87#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page)
88#define pte_free_tlb(tlb,ptep) pte_free(ptep) 88#define pte_free_tlb(tlb, ptep) pte_free((tlb)->mm, ptep)
89#define pmd_free_tlb(tlb,pmdp) pmd_free(pmdp) 89#define pmd_free_tlb(tlb, pmdp) pmd_free((tlb)->mm, pmdp)
90 90
91#define tlb_migrate_finish(mm) do { } while (0) 91#define tlb_migrate_finish(mm) do { } while (0)
92 92
diff --git a/include/asm-avr32/arch-at32ap/at32ap700x.h b/include/asm-avr32/arch-at32ap/at32ap700x.h
index 99684d6f3967..31e48b0e7324 100644
--- a/include/asm-avr32/arch-at32ap/at32ap700x.h
+++ b/include/asm-avr32/arch-at32ap/at32ap700x.h
@@ -13,8 +13,6 @@
13#define GPIO_PERIPH_A 0 13#define GPIO_PERIPH_A 0
14#define GPIO_PERIPH_B 1 14#define GPIO_PERIPH_B 1
15 15
16#define NR_GPIO_CONTROLLERS 4
17
18/* 16/*
19 * Pin numbers identifying specific GPIO pins on the chip. They can 17 * Pin numbers identifying specific GPIO pins on the chip. They can
20 * also be converted to IRQ numbers by passing them through 18 * also be converted to IRQ numbers by passing them through
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h
index af7f9535bab3..0180f584ef03 100644
--- a/include/asm-avr32/arch-at32ap/gpio.h
+++ b/include/asm-avr32/arch-at32ap/gpio.h
@@ -5,20 +5,36 @@
5#include <asm/irq.h> 5#include <asm/irq.h>
6 6
7 7
8/* Arch-neutral GPIO API */ 8/* Some GPIO chips can manage IRQs; some can't. The exact numbers can
9int __must_check gpio_request(unsigned int gpio, const char *label); 9 * be changed if needed, but for the moment they're not configurable.
10void gpio_free(unsigned int gpio); 10 */
11#define ARCH_NR_GPIOS (NR_GPIO_IRQS + 2 * 32)
11 12
12int gpio_direction_input(unsigned int gpio);
13int gpio_direction_output(unsigned int gpio, int value);
14int gpio_get_value(unsigned int gpio);
15void gpio_set_value(unsigned int gpio, int value);
16 13
17#include <asm-generic/gpio.h> /* cansleep wrappers */ 14/* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */
15#include <asm-generic/gpio.h>
16
17static inline int gpio_get_value(unsigned int gpio)
18{
19 return __gpio_get_value(gpio);
20}
21
22static inline void gpio_set_value(unsigned int gpio, int value)
23{
24 __gpio_set_value(gpio, value);
25}
26
27static inline int gpio_cansleep(unsigned int gpio)
28{
29 return __gpio_cansleep(gpio);
30}
31
18 32
19static inline int gpio_to_irq(unsigned int gpio) 33static inline int gpio_to_irq(unsigned int gpio)
20{ 34{
21 return gpio + GPIO_IRQ_BASE; 35 if (gpio < NR_GPIO_IRQS)
36 return gpio + GPIO_IRQ_BASE;
37 return -EINVAL;
22} 38}
23 39
24static inline int irq_to_gpio(unsigned int irq) 40static inline int irq_to_gpio(unsigned int irq)
diff --git a/include/asm-avr32/arch-at32ap/irq.h b/include/asm-avr32/arch-at32ap/irq.h
index 5adffab9a577..608e350368c7 100644
--- a/include/asm-avr32/arch-at32ap/irq.h
+++ b/include/asm-avr32/arch-at32ap/irq.h
@@ -3,11 +3,11 @@
3 3
4#define EIM_IRQ_BASE NR_INTERNAL_IRQS 4#define EIM_IRQ_BASE NR_INTERNAL_IRQS
5#define NR_EIM_IRQS 32 5#define NR_EIM_IRQS 32
6
7#define AT32_EXTINT(n) (EIM_IRQ_BASE + (n)) 6#define AT32_EXTINT(n) (EIM_IRQ_BASE + (n))
8 7
9#define GPIO_IRQ_BASE (EIM_IRQ_BASE + NR_EIM_IRQS) 8#define GPIO_IRQ_BASE (EIM_IRQ_BASE + NR_EIM_IRQS)
10#define NR_GPIO_IRQS (5 * 32) 9#define NR_GPIO_CTLR (5 /*internal*/ + 1 /*external*/)
10#define NR_GPIO_IRQS (NR_GPIO_CTLR * 32)
11 11
12#define NR_IRQS (GPIO_IRQ_BASE + NR_GPIO_IRQS) 12#define NR_IRQS (GPIO_IRQ_BASE + NR_GPIO_IRQS)
13 13
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h
index 0e680f47209f..b77e364b4c44 100644
--- a/include/asm-avr32/pgalloc.h
+++ b/include/asm-avr32/pgalloc.h
@@ -30,7 +30,7 @@ static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
30 return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL); 30 return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL);
31} 31}
32 32
33static inline void pgd_free(pgd_t *pgd) 33static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
34{ 34{
35 kfree(pgd); 35 kfree(pgd);
36} 36}
@@ -55,12 +55,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
55 return pte; 55 return pte;
56} 56}
57 57
58static inline void pte_free_kernel(pte_t *pte) 58static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
59{ 59{
60 free_page((unsigned long)pte); 60 free_page((unsigned long)pte);
61} 61}
62 62
63static inline void pte_free(struct page *pte) 63static inline void pte_free(struct mm_struct *mm, struct page *pte)
64{ 64{
65 __free_page(pte); 65 __free_page(pte);
66} 66}
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index a0d0507a5034..35863f260929 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* __ASM_AVR32_SOCKET_H */ 57#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h
index de09009593f8..89861a27543e 100644
--- a/include/asm-avr32/unistd.h
+++ b/include/asm-avr32/unistd.h
@@ -297,7 +297,7 @@
297 297
298#define __NR_utimensat 278 298#define __NR_utimensat 278
299#define __NR_signalfd 279 299#define __NR_signalfd 279
300#define __NR_timerfd 280 300/* 280 was __NR_timerfd */
301#define __NR_eventfd 281 301#define __NR_eventfd 281
302 302
303#ifdef __KERNEL__ 303#ifdef __KERNEL__
diff --git a/include/asm-blackfin/socket.h b/include/asm-blackfin/socket.h
index 5213c9652186..2ca702e44d47 100644
--- a/include/asm-blackfin/socket.h
+++ b/include/asm-blackfin/socket.h
@@ -50,4 +50,7 @@
50#define SO_PASSSEC 34 50#define SO_PASSSEC 34
51#define SO_TIMESTAMPNS 35 51#define SO_TIMESTAMPNS 35
52#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 52#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
53
54#define SO_MARK 36
55
53#endif /* _ASM_SOCKET_H */ 56#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index e2f49c27ed29..75ea6e096483 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -24,13 +24,6 @@
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25 25
26/* 26/*
27 * Some hacks to defeat gcc over-optimizations..
28 */
29struct __dummy { unsigned long a[100]; };
30#define ADDR (*(struct __dummy *) addr)
31#define CONST_ADDR (*(const struct __dummy *) addr)
32
33/*
34 * set_bit - Atomically set a bit in memory 27 * set_bit - Atomically set a bit in memory
35 * @nr: the bit to set 28 * @nr: the bit to set
36 * @addr: the address to start counting from 29 * @addr: the address to start counting from
diff --git a/include/asm-cris/pgalloc.h b/include/asm-cris/pgalloc.h
index deaddfe79bbc..8ddd66f81773 100644
--- a/include/asm-cris/pgalloc.h
+++ b/include/asm-cris/pgalloc.h
@@ -16,7 +16,7 @@ static inline pgd_t *pgd_alloc (struct mm_struct *mm)
16 return (pgd_t *)get_zeroed_page(GFP_KERNEL); 16 return (pgd_t *)get_zeroed_page(GFP_KERNEL);
17} 17}
18 18
19static inline void pgd_free (pgd_t *pgd) 19static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
20{ 20{
21 free_page((unsigned long)pgd); 21 free_page((unsigned long)pgd);
22} 22}
@@ -34,12 +34,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add
34 return pte; 34 return pte;
35} 35}
36 36
37static inline void pte_free_kernel(pte_t *pte) 37static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
38{ 38{
39 free_page((unsigned long)pte); 39 free_page((unsigned long)pte);
40} 40}
41 41
42static inline void pte_free(struct page *pte) 42static inline void pte_free(struct mm_struct *mm, struct page *pte)
43{ 43{
44 __free_page(pte); 44 __free_page(pte);
45} 45}
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 5b18dfdf1748..9df0ca82f5de 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -54,6 +54,8 @@
54#define SO_TIMESTAMPNS 35 54#define SO_TIMESTAMPNS 35
55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
56 56
57#define SO_MARK 36
58
57#endif /* _ASM_SOCKET_H */ 59#endif /* _ASM_SOCKET_H */
58 60
59 61
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
index d425d8d0ad77..6ec494a5bc5a 100644
--- a/include/asm-frv/atomic.h
+++ b/include/asm-frv/atomic.h
@@ -1,7 +1,7 @@
1/* atomic.h: atomic operation emulation for FR-V 1/* atomic.h: atomic operation emulation for FR-V
2 * 2 *
3 * For an explanation of how atomic ops work in this arch, see: 3 * For an explanation of how atomic ops work in this arch, see:
4 * Documentation/fujitsu/frv/atomic-ops.txt 4 * Documentation/frv/atomic-ops.txt
5 * 5 *
6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com) 7 * Written by David Howells (dhowells@redhat.com)
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index e29de7131b79..5f86b876b298 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -1,7 +1,7 @@
1/* bitops.h: bit operations for the Fujitsu FR-V CPUs 1/* bitops.h: bit operations for the Fujitsu FR-V CPUs
2 * 2 *
3 * For an explanation of how atomic ops work in this arch, see: 3 * For an explanation of how atomic ops work in this arch, see:
4 * Documentation/fujitsu/frv/atomic-ops.txt 4 * Documentation/frv/atomic-ops.txt
5 * 5 *
6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com) 7 * Written by David Howells (dhowells@redhat.com)
diff --git a/include/asm-frv/cacheflush.h b/include/asm-frv/cacheflush.h
index 02500405a6fb..432a69e7f3d4 100644
--- a/include/asm-frv/cacheflush.h
+++ b/include/asm-frv/cacheflush.h
@@ -29,7 +29,7 @@
29#define flush_dcache_mmap_unlock(mapping) do {} while(0) 29#define flush_dcache_mmap_unlock(mapping) do {} while(0)
30 30
31/* 31/*
32 * physically-indexed cache managment 32 * physically-indexed cache management
33 * - see arch/frv/lib/cache.S 33 * - see arch/frv/lib/cache.S
34 */ 34 */
35extern void frv_dcache_writeback(unsigned long start, unsigned long size); 35extern void frv_dcache_writeback(unsigned long start, unsigned long size);
diff --git a/include/asm-frv/dma-mapping.h b/include/asm-frv/dma-mapping.h
index bcb2df68496e..2e8966ca030d 100644
--- a/include/asm-frv/dma-mapping.h
+++ b/include/asm-frv/dma-mapping.h
@@ -17,16 +17,6 @@ void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle
17void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); 17void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle);
18 18
19/* 19/*
20 * These macros should be used after a pci_map_sg call has been done
21 * to get bus addresses of each of the SG entries and their lengths.
22 * You should only work with the number of sg entries pci_map_sg
23 * returns, or alternatively stop on the first sg_dma_len(sg) which
24 * is 0.
25 */
26#define sg_dma_address(sg) ((sg)->dma_address)
27#define sg_dma_len(sg) ((sg)->length)
28
29/*
30 * Map a single buffer of the indicated size for DMA in streaming mode. 20 * Map a single buffer of the indicated size for DMA in streaming mode.
31 * The 32-bit bus address to use is returned. 21 * The 32-bit bus address to use is returned.
32 * 22 *
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
index ff4d6cdeb152..26cefcde5cee 100644
--- a/include/asm-frv/highmem.h
+++ b/include/asm-frv/highmem.h
@@ -4,7 +4,7 @@
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-i386/highmem.h 5 * - Derived from include/asm-i386/highmem.h
6 * 6 *
7 * See Documentation/fujitsu/frv/mmu-layout.txt for more information. 7 * See Documentation/frv/mmu-layout.txt for more information.
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h
index aaf2a773d9d3..83532252b8be 100644
--- a/include/asm-frv/mem-layout.h
+++ b/include/asm-frv/mem-layout.h
@@ -39,7 +39,7 @@
39 39
40#ifdef CONFIG_MMU 40#ifdef CONFIG_MMU
41 41
42/* see Documentation/fujitsu/frv/mmu-layout.txt */ 42/* see Documentation/frv/mmu-layout.txt */
43#define KERNEL_LOWMEM_START __UL(0xc0000000) 43#define KERNEL_LOWMEM_START __UL(0xc0000000)
44#define KERNEL_LOWMEM_END __UL(0xd0000000) 44#define KERNEL_LOWMEM_END __UL(0xd0000000)
45#define VMALLOC_START __UL(0xd0000000) 45#define VMALLOC_START __UL(0xd0000000)
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index 213d92fd652a..bd9bd2d9cc78 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -76,10 +76,6 @@ extern unsigned long max_pfn;
76 76
77#endif /* __ASSEMBLY__ */ 77#endif /* __ASSEMBLY__ */
78 78
79#ifdef CONFIG_CONTIGUOUS_PAGE_ALLOC
80#define WANT_PAGE_VIRTUAL 1
81#endif
82
83#include <asm-generic/memory_model.h> 79#include <asm-generic/memory_model.h>
84#include <asm-generic/page.h> 80#include <asm-generic/page.h>
85 81
diff --git a/include/asm-frv/pgalloc.h b/include/asm-frv/pgalloc.h
index ce982a6c610f..e89620ef08ca 100644
--- a/include/asm-frv/pgalloc.h
+++ b/include/asm-frv/pgalloc.h
@@ -31,18 +31,18 @@ do { \
31 */ 31 */
32 32
33extern pgd_t *pgd_alloc(struct mm_struct *); 33extern pgd_t *pgd_alloc(struct mm_struct *);
34extern void pgd_free(pgd_t *); 34extern void pgd_free(struct mm_struct *mm, pgd_t *);
35 35
36extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); 36extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
37 37
38extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); 38extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
39 39
40static inline void pte_free_kernel(pte_t *pte) 40static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
41{ 41{
42 free_page((unsigned long)pte); 42 free_page((unsigned long)pte);
43} 43}
44 44
45static inline void pte_free(struct page *pte) 45static inline void pte_free(struct mm_struct *mm, struct page *pte)
46{ 46{
47 __free_page(pte); 47 __free_page(pte);
48} 48}
@@ -55,7 +55,7 @@ static inline void pte_free(struct page *pte)
55 * (In the PAE case we free the pmds as part of the pgd.) 55 * (In the PAE case we free the pmds as part of the pgd.)
56 */ 56 */
57#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *) 2); }) 57#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *) 2); })
58#define pmd_free(x) do { } while (0) 58#define pmd_free(mm, x) do { } while (0)
59#define __pmd_free_tlb(tlb,x) do { } while (0) 59#define __pmd_free_tlb(tlb,x) do { } while (0)
60 60
61#endif /* CONFIG_MMU */ 61#endif /* CONFIG_MMU */
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 147e995bec24..6c0682ed5fc9 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -93,7 +93,7 @@ extern unsigned long empty_zero_page;
93 93
94/* 94/*
95 * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry) 95 * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry)
96 * [see Documentation/fujitsu/frv/mmu-layout.txt] 96 * [see Documentation/frv/mmu-layout.txt]
97 * 97 *
98 * Page Directory: 98 * Page Directory:
99 * - Size: 16KB 99 * - Size: 16KB
@@ -226,7 +226,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
226 * inside the pgd, so has no extra memory associated with it. 226 * inside the pgd, so has no extra memory associated with it.
227 */ 227 */
228#define pud_alloc_one(mm, address) NULL 228#define pud_alloc_one(mm, address) NULL
229#define pud_free(x) do { } while (0) 229#define pud_free(mm, x) do { } while (0)
230#define __pud_free_tlb(tlb, x) do { } while (0) 230#define __pud_free_tlb(tlb, x) do { } while (0)
231 231
232/* 232/*
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
index 2e7143b5a7ad..4bca8a28546c 100644
--- a/include/asm-frv/scatterlist.h
+++ b/include/asm-frv/scatterlist.h
@@ -31,6 +31,16 @@ struct scatterlist {
31 unsigned int length; 31 unsigned int length;
32}; 32};
33 33
34/*
35 * These macros should be used after a pci_map_sg call has been done
36 * to get bus addresses of each of the SG entries and their lengths.
37 * You should only work with the number of sg entries pci_map_sg
38 * returns, or alternatively stop on the first sg_dma_len(sg) which
39 * is 0.
40 */
41#define sg_dma_address(sg) ((sg)->dma_address)
42#define sg_dma_len(sg) ((sg)->length)
43
34#define ISA_DMA_THRESHOLD (0xffffffffUL) 44#define ISA_DMA_THRESHOLD (0xffffffffUL)
35 45
36#endif /* !_ASM_SCATTERLIST_H */ 46#endif /* !_ASM_SCATTERLIST_H */
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index a823befd11dd..e51ca67b9356 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -52,5 +52,7 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
56 58
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index cd84f1771e34..e8c986667532 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -328,7 +328,7 @@
328#define __NR_epoll_pwait 319 328#define __NR_epoll_pwait 319
329#define __NR_utimensat 320 329#define __NR_utimensat 320
330#define __NR_signalfd 321 330#define __NR_signalfd 321
331#define __NR_timerfd 322 331/* #define __NR_timerfd 322 removed */
332#define __NR_eventfd 323 332#define __NR_eventfd 323
333#define __NR_fallocate 324 333#define __NR_fallocate 324
334 334
diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h
index 7b88d3931e34..9d40e879f99e 100644
--- a/include/asm-generic/4level-fixup.h
+++ b/include/asm-generic/4level-fixup.h
@@ -28,7 +28,7 @@
28 28
29#undef pud_free_tlb 29#undef pud_free_tlb
30#define pud_free_tlb(tlb, x) do { } while (0) 30#define pud_free_tlb(tlb, x) do { } while (0)
31#define pud_free(x) do { } while (0) 31#define pud_free(mm, x) do { } while (0)
32#define __pud_free_tlb(tlb, x) do { } while (0) 32#define __pud_free_tlb(tlb, x) do { } while (0)
33 33
34#undef pud_addr_end 34#undef pud_addr_end
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 2d0aab1d8611..f29a502f4a6c 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,6 +1,102 @@
1#ifndef _ASM_GENERIC_GPIO_H 1#ifndef _ASM_GENERIC_GPIO_H
2#define _ASM_GENERIC_GPIO_H 2#define _ASM_GENERIC_GPIO_H
3 3
4#ifdef CONFIG_HAVE_GPIO_LIB
5
6/* Platforms may implement their GPIO interface with library code,
7 * at a small performance cost for non-inlined operations and some
8 * extra memory (for code and for per-GPIO table entries).
9 *
10 * While the GPIO programming interface defines valid GPIO numbers
11 * to be in the range 0..MAX_INT, this library restricts them to the
12 * smaller range 0..ARCH_NR_GPIOS.
13 */
14
15#ifndef ARCH_NR_GPIOS
16#define ARCH_NR_GPIOS 256
17#endif
18
19struct seq_file;
20
21/**
22 * struct gpio_chip - abstract a GPIO controller
23 * @label: for diagnostics
24 * @direction_input: configures signal "offset" as input, or returns error
25 * @get: returns value for signal "offset"; for output signals this
26 * returns either the value actually sensed, or zero
27 * @direction_output: configures signal "offset" as output, or returns error
28 * @set: assigns output value for signal "offset"
29 * @dbg_show: optional routine to show contents in debugfs; default code
30 * will be used when this is omitted, but custom code can show extra
31 * state (such as pullup/pulldown configuration).
32 * @base: identifies the first GPIO number handled by this chip; or, if
33 * negative during registration, requests dynamic ID allocation.
34 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
35 * handled is (base + ngpio - 1).
36 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
37 * must while accessing GPIO expander chips over I2C or SPI
38 *
39 * A gpio_chip can help platforms abstract various sources of GPIOs so
40 * they can all be accessed through a common programing interface.
41 * Example sources would be SOC controllers, FPGAs, multifunction
42 * chips, dedicated GPIO expanders, and so on.
43 *
44 * Each chip controls a number of signals, identified in method calls
45 * by "offset" values in the range 0..(@ngpio - 1). When those signals
46 * are referenced through calls like gpio_get_value(gpio), the offset
47 * is calculated by subtracting @base from the gpio number.
48 */
49struct gpio_chip {
50 char *label;
51
52 int (*direction_input)(struct gpio_chip *chip,
53 unsigned offset);
54 int (*get)(struct gpio_chip *chip,
55 unsigned offset);
56 int (*direction_output)(struct gpio_chip *chip,
57 unsigned offset, int value);
58 void (*set)(struct gpio_chip *chip,
59 unsigned offset, int value);
60 void (*dbg_show)(struct seq_file *s,
61 struct gpio_chip *chip);
62 int base;
63 u16 ngpio;
64 unsigned can_sleep:1;
65};
66
67extern const char *gpiochip_is_requested(struct gpio_chip *chip,
68 unsigned offset);
69
70/* add/remove chips */
71extern int gpiochip_add(struct gpio_chip *chip);
72extern int __must_check gpiochip_remove(struct gpio_chip *chip);
73
74
75/* Always use the library code for GPIO management calls,
76 * or when sleeping may be involved.
77 */
78extern int gpio_request(unsigned gpio, const char *label);
79extern void gpio_free(unsigned gpio);
80
81extern int gpio_direction_input(unsigned gpio);
82extern int gpio_direction_output(unsigned gpio, int value);
83
84extern int gpio_get_value_cansleep(unsigned gpio);
85extern void gpio_set_value_cansleep(unsigned gpio, int value);
86
87
88/* A platform's <asm/gpio.h> code may want to inline the I/O calls when
89 * the GPIO is constant and refers to some always-present controller,
90 * giving direct access to chip registers and tight bitbanging loops.
91 */
92extern int __gpio_get_value(unsigned gpio);
93extern void __gpio_set_value(unsigned gpio, int value);
94
95extern int __gpio_cansleep(unsigned gpio);
96
97
98#else
99
4/* platforms that don't directly support access to GPIOs through I2C, SPI, 100/* platforms that don't directly support access to GPIOs through I2C, SPI,
5 * or other blocking infrastructure can use these wrappers. 101 * or other blocking infrastructure can use these wrappers.
6 */ 102 */
@@ -22,4 +118,6 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
22 gpio_set_value(gpio, value); 118 gpio_set_value(gpio, value);
23} 119}
24 120
121#endif
122
25#endif /* _ASM_GENERIC_GPIO_H */ 123#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index 29ff5d84d8c3..087325ede76c 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -54,7 +54,7 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
54 * inside the pud, so has no extra memory associated with it. 54 * inside the pud, so has no extra memory associated with it.
55 */ 55 */
56#define pmd_alloc_one(mm, address) NULL 56#define pmd_alloc_one(mm, address) NULL
57#define pmd_free(x) do { } while (0) 57#define pmd_free(mm, x) do { } while (0)
58#define __pmd_free_tlb(tlb, x) do { } while (0) 58#define __pmd_free_tlb(tlb, x) do { } while (0)
59 59
60#undef pmd_addr_end 60#undef pmd_addr_end
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h
index 566464500558..87cf449a6df3 100644
--- a/include/asm-generic/pgtable-nopud.h
+++ b/include/asm-generic/pgtable-nopud.h
@@ -51,7 +51,7 @@ static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
51 * inside the pgd, so has no extra memory associated with it. 51 * inside the pgd, so has no extra memory associated with it.
52 */ 52 */
53#define pud_alloc_one(mm, address) NULL 53#define pud_alloc_one(mm, address) NULL
54#define pud_free(x) do { } while (0) 54#define pud_free(mm, x) do { } while (0)
55#define __pud_free_tlb(tlb, x) do { } while (0) 55#define __pud_free_tlb(tlb, x) do { } while (0)
56 56
57#undef pud_addr_end 57#undef pud_addr_end
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index d3238f1f70a6..dd1bed860e64 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -35,10 +35,11 @@
35static inline unsigned char rtc_is_updating(void) 35static inline unsigned char rtc_is_updating(void)
36{ 36{
37 unsigned char uip; 37 unsigned char uip;
38 unsigned long flags;
38 39
39 spin_lock_irq(&rtc_lock); 40 spin_lock_irqsave(&rtc_lock, flags);
40 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); 41 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
41 spin_unlock_irq(&rtc_lock); 42 spin_unlock_irqrestore(&rtc_lock, flags);
42 return uip; 43 return uip;
43} 44}
44 45
@@ -46,6 +47,8 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
46{ 47{
47 unsigned long uip_watchdog = jiffies; 48 unsigned long uip_watchdog = jiffies;
48 unsigned char ctrl; 49 unsigned char ctrl;
50 unsigned long flags;
51
49#ifdef CONFIG_MACH_DECSTATION 52#ifdef CONFIG_MACH_DECSTATION
50 unsigned int real_year; 53 unsigned int real_year;
51#endif 54#endif
@@ -72,7 +75,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
72 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated 75 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
73 * by the RTC when initially set to a non-zero value. 76 * by the RTC when initially set to a non-zero value.
74 */ 77 */
75 spin_lock_irq(&rtc_lock); 78 spin_lock_irqsave(&rtc_lock, flags);
76 time->tm_sec = CMOS_READ(RTC_SECONDS); 79 time->tm_sec = CMOS_READ(RTC_SECONDS);
77 time->tm_min = CMOS_READ(RTC_MINUTES); 80 time->tm_min = CMOS_READ(RTC_MINUTES);
78 time->tm_hour = CMOS_READ(RTC_HOURS); 81 time->tm_hour = CMOS_READ(RTC_HOURS);
@@ -83,7 +86,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
83 real_year = CMOS_READ(RTC_DEC_YEAR); 86 real_year = CMOS_READ(RTC_DEC_YEAR);
84#endif 87#endif
85 ctrl = CMOS_READ(RTC_CONTROL); 88 ctrl = CMOS_READ(RTC_CONTROL);
86 spin_unlock_irq(&rtc_lock); 89 spin_unlock_irqrestore(&rtc_lock, flags);
87 90
88 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 91 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
89 { 92 {
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 6ce9f3ab928d..f490e43a90b9 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -14,7 +14,7 @@
14#define _ASM_GENERIC__TLB_H 14#define _ASM_GENERIC__TLB_H
15 15
16#include <linux/swap.h> 16#include <linux/swap.h>
17#include <linux/quicklist.h> 17#include <asm/pgalloc.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19 19
20/* 20/*
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index 39911d8c9684..da2520dbf254 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index a1b9719f5fbb..953d3df9dd22 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -122,38 +122,40 @@ clear_bit_unlock (int nr, volatile void *addr)
122} 122}
123 123
124/** 124/**
125 * __clear_bit_unlock - Non-atomically clear a bit with release 125 * __clear_bit_unlock - Non-atomically clears a bit in memory with release
126 * @nr: Bit to clear
127 * @addr: Address to start counting from
126 * 128 *
127 * This is like clear_bit_unlock, but the implementation uses a store 129 * Similarly to clear_bit_unlock, the implementation uses a store
128 * with release semantics. See also __raw_spin_unlock(). 130 * with release semantics. See also __raw_spin_unlock().
129 */ 131 */
130static __inline__ void 132static __inline__ void
131__clear_bit_unlock(int nr, volatile void *addr) 133__clear_bit_unlock(int nr, void *addr)
132{ 134{
133 __u32 mask, new; 135 __u32 * const m = (__u32 *) addr + (nr >> 5);
134 volatile __u32 *m; 136 __u32 const new = *m & ~(1 << (nr & 31));
135 137
136 m = (volatile __u32 *)addr + (nr >> 5);
137 mask = ~(1 << (nr & 31));
138 new = *m & mask;
139 barrier();
140 ia64_st4_rel_nta(m, new); 138 ia64_st4_rel_nta(m, new);
141} 139}
142 140
143/** 141/**
144 * __clear_bit - Clears a bit in memory (non-atomic version) 142 * __clear_bit - Clears a bit in memory (non-atomic version)
143 * @nr: the bit to clear
144 * @addr: the address to start counting from
145 *
146 * Unlike clear_bit(), this function is non-atomic and may be reordered.
147 * If it's called on the same region of memory simultaneously, the effect
148 * may be that only one operation succeeds.
145 */ 149 */
146static __inline__ void 150static __inline__ void
147__clear_bit (int nr, volatile void *addr) 151__clear_bit (int nr, volatile void *addr)
148{ 152{
149 volatile __u32 *p = (__u32 *) addr + (nr >> 5); 153 *((__u32 *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
150 __u32 m = 1 << (nr & 31);
151 *p &= ~m;
152} 154}
153 155
154/** 156/**
155 * change_bit - Toggle a bit in memory 157 * change_bit - Toggle a bit in memory
156 * @nr: Bit to clear 158 * @nr: Bit to toggle
157 * @addr: Address to start counting from 159 * @addr: Address to start counting from
158 * 160 *
159 * change_bit() is atomic and may not be reordered. 161 * change_bit() is atomic and may not be reordered.
@@ -178,7 +180,7 @@ change_bit (int nr, volatile void *addr)
178 180
179/** 181/**
180 * __change_bit - Toggle a bit in memory 182 * __change_bit - Toggle a bit in memory
181 * @nr: the bit to set 183 * @nr: the bit to toggle
182 * @addr: the address to start counting from 184 * @addr: the address to start counting from
183 * 185 *
184 * Unlike change_bit(), this function is non-atomic and may be reordered. 186 * Unlike change_bit(), this function is non-atomic and may be reordered.
@@ -197,7 +199,7 @@ __change_bit (int nr, volatile void *addr)
197 * @addr: Address to count from 199 * @addr: Address to count from
198 * 200 *
199 * This operation is atomic and cannot be reordered. 201 * This operation is atomic and cannot be reordered.
200 * It also implies a memory barrier. 202 * It also implies the acquisition side of the memory barrier.
201 */ 203 */
202static __inline__ int 204static __inline__ int
203test_and_set_bit (int nr, volatile void *addr) 205test_and_set_bit (int nr, volatile void *addr)
@@ -247,11 +249,11 @@ __test_and_set_bit (int nr, volatile void *addr)
247 249
248/** 250/**
249 * test_and_clear_bit - Clear a bit and return its old value 251 * test_and_clear_bit - Clear a bit and return its old value
250 * @nr: Bit to set 252 * @nr: Bit to clear
251 * @addr: Address to count from 253 * @addr: Address to count from
252 * 254 *
253 * This operation is atomic and cannot be reordered. 255 * This operation is atomic and cannot be reordered.
254 * It also implies a memory barrier. 256 * It also implies the acquisition side of the memory barrier.
255 */ 257 */
256static __inline__ int 258static __inline__ int
257test_and_clear_bit (int nr, volatile void *addr) 259test_and_clear_bit (int nr, volatile void *addr)
@@ -272,7 +274,7 @@ test_and_clear_bit (int nr, volatile void *addr)
272 274
273/** 275/**
274 * __test_and_clear_bit - Clear a bit and return its old value 276 * __test_and_clear_bit - Clear a bit and return its old value
275 * @nr: Bit to set 277 * @nr: Bit to clear
276 * @addr: Address to count from 278 * @addr: Address to count from
277 * 279 *
278 * This operation is non-atomic and can be reordered. 280 * This operation is non-atomic and can be reordered.
@@ -292,11 +294,11 @@ __test_and_clear_bit(int nr, volatile void * addr)
292 294
293/** 295/**
294 * test_and_change_bit - Change a bit and return its old value 296 * test_and_change_bit - Change a bit and return its old value
295 * @nr: Bit to set 297 * @nr: Bit to change
296 * @addr: Address to count from 298 * @addr: Address to count from
297 * 299 *
298 * This operation is atomic and cannot be reordered. 300 * This operation is atomic and cannot be reordered.
299 * It also implies a memory barrier. 301 * It also implies the acquisition side of the memory barrier.
300 */ 302 */
301static __inline__ int 303static __inline__ int
302test_and_change_bit (int nr, volatile void *addr) 304test_and_change_bit (int nr, volatile void *addr)
@@ -315,8 +317,12 @@ test_and_change_bit (int nr, volatile void *addr)
315 return (old & bit) != 0; 317 return (old & bit) != 0;
316} 318}
317 319
318/* 320/**
319 * WARNING: non atomic version. 321 * __test_and_change_bit - Change a bit and return its old value
322 * @nr: Bit to change
323 * @addr: Address to count from
324 *
325 * This operation is non-atomic and can be reordered.
320 */ 326 */
321static __inline__ int 327static __inline__ int
322__test_and_change_bit (int nr, void *addr) 328__test_and_change_bit (int nr, void *addr)
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h
index 0f6e5264ab8f..dfcf75b8426d 100644
--- a/include/asm-ia64/compat.h
+++ b/include/asm-ia64/compat.h
@@ -181,7 +181,7 @@ struct compat_shmid64_ds {
181/* 181/*
182 * A pointer passed in from user mode. This should not be used for syscall parameters, 182 * A pointer passed in from user mode. This should not be used for syscall parameters,
183 * just declare them as pointers because the syscall entry code will have appropriately 183 * just declare them as pointers because the syscall entry code will have appropriately
184 * comverted them already. 184 * converted them already.
185 */ 185 */
186typedef u32 compat_uptr_t; 186typedef u32 compat_uptr_t;
187 187
diff --git a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
index 5b6665c754c9..de2ed2cbdd84 100644
--- a/include/asm-ia64/gcc_intrin.h
+++ b/include/asm-ia64/gcc_intrin.h
@@ -24,7 +24,9 @@
24extern void ia64_bad_param_for_setreg (void); 24extern void ia64_bad_param_for_setreg (void);
25extern void ia64_bad_param_for_getreg (void); 25extern void ia64_bad_param_for_getreg (void);
26 26
27#ifdef __KERNEL__
27register unsigned long ia64_r13 asm ("r13") __used; 28register unsigned long ia64_r13 asm ("r13") __used;
29#endif
28 30
29#define ia64_setreg(regnum, val) \ 31#define ia64_setreg(regnum, val) \
30({ \ 32({ \
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index 823553bf12e6..f1663aa94a52 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -3,9 +3,9 @@
3 * Purpose: Machine check handling specific defines 3 * Purpose: Machine check handling specific defines
4 * 4 *
5 * Copyright (C) 1999, 2004 Silicon Graphics, Inc. 5 * Copyright (C) 1999, 2004 Silicon Graphics, Inc.
6 * Copyright (C) Vijay Chander (vijay@engr.sgi.com) 6 * Copyright (C) Vijay Chander <vijay@engr.sgi.com>
7 * Copyright (C) Srinivasa Thirumalachar (sprasad@engr.sgi.com) 7 * Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com>
8 * Copyright (C) Russ Anderson (rja@sgi.com) 8 * Copyright (C) Russ Anderson <rja@sgi.com>
9 */ 9 */
10 10
11#ifndef _ASM_IA64_MCA_H 11#ifndef _ASM_IA64_MCA_H
diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h
index 76203f9a8718..dd2a5b134390 100644
--- a/include/asm-ia64/mca_asm.h
+++ b/include/asm-ia64/mca_asm.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * File: mca_asm.h 2 * File: mca_asm.h
3 * Purpose: Machine check handling specific defines
3 * 4 *
4 * Copyright (C) 1999 Silicon Graphics, Inc. 5 * Copyright (C) 1999 Silicon Graphics, Inc.
5 * Copyright (C) Vijay Chander (vijay@engr.sgi.com) 6 * Copyright (C) Vijay Chander <vijay@engr.sgi.com>
6 * Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com> 7 * Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com>
7 * Copyright (C) 2000 Hewlett-Packard Co. 8 * Copyright (C) 2000 Hewlett-Packard Co.
8 * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> 9 * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
index 0095bcf79848..77f30b664b4e 100644
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -15,38 +15,20 @@
15 15
16#include <linux/threads.h> 16#include <linux/threads.h>
17 17
18#ifdef CONFIG_SMP
19
18#ifdef HAVE_MODEL_SMALL_ATTRIBUTE 20#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
19# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__))) 21# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
20#endif 22#endif
21 23
22#define DECLARE_PER_CPU(type, name) \ 24#define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
23 extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
24
25/*
26 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
27 * external routine, to avoid include-hell.
28 */
29#ifdef CONFIG_SMP
30
31extern unsigned long __per_cpu_offset[NR_CPUS];
32#define per_cpu_offset(x) (__per_cpu_offset[x])
33
34/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
35DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
36 25
37#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
38#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
39#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
40
41extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
42extern void setup_per_cpu_areas (void);
43extern void *per_cpu_init(void); 26extern void *per_cpu_init(void);
44 27
45#else /* ! SMP */ 28#else /* ! SMP */
46 29
47#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 30#define PER_CPU_ATTRIBUTES __attribute__((__section__(".data.percpu")))
48#define __get_cpu_var(var) per_cpu__##var 31
49#define __raw_get_cpu_var(var) per_cpu__##var
50#define per_cpu_init() (__phys_per_cpu_start) 32#define per_cpu_init() (__phys_per_cpu_start)
51 33
52#endif /* SMP */ 34#endif /* SMP */
@@ -57,7 +39,12 @@ extern void *per_cpu_init(void);
57 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly 39 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
58 * more efficient. 40 * more efficient.
59 */ 41 */
60#define __ia64_per_cpu_var(var) (per_cpu__##var) 42#define __ia64_per_cpu_var(var) per_cpu__##var
43
44#include <asm-generic/percpu.h>
45
46/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
47DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
61 48
62#endif /* !__ASSEMBLY__ */ 49#endif /* !__ASSEMBLY__ */
63 50
diff --git a/include/asm-ia64/pgalloc.h b/include/asm-ia64/pgalloc.h
index 67552cad5173..556d988123ac 100644
--- a/include/asm-ia64/pgalloc.h
+++ b/include/asm-ia64/pgalloc.h
@@ -27,7 +27,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
27 return quicklist_alloc(0, GFP_KERNEL, NULL); 27 return quicklist_alloc(0, GFP_KERNEL, NULL);
28} 28}
29 29
30static inline void pgd_free(pgd_t * pgd) 30static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
31{ 31{
32 quicklist_free(0, NULL, pgd); 32 quicklist_free(0, NULL, pgd);
33} 33}
@@ -44,11 +44,11 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
44 return quicklist_alloc(0, GFP_KERNEL, NULL); 44 return quicklist_alloc(0, GFP_KERNEL, NULL);
45} 45}
46 46
47static inline void pud_free(pud_t * pud) 47static inline void pud_free(struct mm_struct *mm, pud_t *pud)
48{ 48{
49 quicklist_free(0, NULL, pud); 49 quicklist_free(0, NULL, pud);
50} 50}
51#define __pud_free_tlb(tlb, pud) pud_free(pud) 51#define __pud_free_tlb(tlb, pud) pud_free((tlb)->mm, pud)
52#endif /* CONFIG_PGTABLE_4 */ 52#endif /* CONFIG_PGTABLE_4 */
53 53
54static inline void 54static inline void
@@ -62,12 +62,12 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
62 return quicklist_alloc(0, GFP_KERNEL, NULL); 62 return quicklist_alloc(0, GFP_KERNEL, NULL);
63} 63}
64 64
65static inline void pmd_free(pmd_t * pmd) 65static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
66{ 66{
67 quicklist_free(0, NULL, pmd); 67 quicklist_free(0, NULL, pmd);
68} 68}
69 69
70#define __pmd_free_tlb(tlb, pmd) pmd_free(pmd) 70#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
71 71
72static inline void 72static inline void
73pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte) 73pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
@@ -94,12 +94,12 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
94 return quicklist_alloc(0, GFP_KERNEL, NULL); 94 return quicklist_alloc(0, GFP_KERNEL, NULL);
95} 95}
96 96
97static inline void pte_free(struct page *pte) 97static inline void pte_free(struct mm_struct *mm, struct page *pte)
98{ 98{
99 quicklist_free_page(0, NULL, pte); 99 quicklist_free_page(0, NULL, pte);
100} 100}
101 101
102static inline void pte_free_kernel(pte_t * pte) 102static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
103{ 103{
104 quicklist_free(0, NULL, pte); 104 quicklist_free(0, NULL, pte);
105} 105}
@@ -109,6 +109,6 @@ static inline void check_pgt_cache(void)
109 quicklist_trim(0, NULL, 25, 16); 109 quicklist_trim(0, NULL, 25, 16);
110} 110}
111 111
112#define __pte_free_tlb(tlb, pte) pte_free(pte) 112#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
113 113
114#endif /* _ASM_IA64_PGALLOC_H */ 114#endif /* _ASM_IA64_PGALLOC_H */
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index be3b0ae43270..741f7ecb986a 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -31,7 +31,8 @@
31 * each (assuming 8KB page size), for a total of 8TB of user virtual 31 * each (assuming 8KB page size), for a total of 8TB of user virtual
32 * address space. 32 * address space.
33 */ 33 */
34#define TASK_SIZE (current->thread.task_size) 34#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
35#define TASK_SIZE TASK_SIZE_OF(current)
35 36
36/* 37/*
37 * This decides where the kernel will search for a free chunk of vm 38 * This decides where the kernel will search for a free chunk of vm
@@ -472,7 +473,7 @@ ia64_set_psr (__u64 psr)
472{ 473{
473 ia64_stop(); 474 ia64_stop();
474 ia64_setreg(_IA64_REG_PSR_L, psr); 475 ia64_setreg(_IA64_REG_PSR_L, psr);
475 ia64_srlz_d(); 476 ia64_srlz_i();
476} 477}
477 478
478/* 479/*
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index 1f5412d6f9bb..2251118894ae 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -649,17 +649,6 @@ typedef struct err_rec {
649 * Now define a couple of inline functions for improved type checking 649 * Now define a couple of inline functions for improved type checking
650 * and convenience. 650 * and convenience.
651 */ 651 */
652static inline long
653ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
654 unsigned long *drift_info)
655{
656 struct ia64_sal_retval isrv;
657
658 SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
659 *ticks_per_second = isrv.v0;
660 *drift_info = isrv.v1;
661 return isrv.status;
662}
663 652
664extern s64 ia64_sal_cache_flush (u64 cache_type); 653extern s64 ia64_sal_cache_flush (u64 cache_type);
665extern void __init check_sal_cache_flush (void); 654extern void __init check_sal_cache_flush (void);
@@ -841,6 +830,9 @@ extern int ia64_sal_oemcall_nolock(struct ia64_sal_retval *, u64, u64, u64,
841 u64, u64, u64, u64, u64); 830 u64, u64, u64, u64, u64);
842extern int ia64_sal_oemcall_reentrant(struct ia64_sal_retval *, u64, u64, u64, 831extern int ia64_sal_oemcall_reentrant(struct ia64_sal_retval *, u64, u64, u64,
843 u64, u64, u64, u64, u64); 832 u64, u64, u64, u64, u64);
833extern long
834ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
835 unsigned long *drift_info);
844#ifdef CONFIG_HOTPLUG_CPU 836#ifdef CONFIG_HOTPLUG_CPU
845/* 837/*
846 * System Abstraction Layer Specification 838 * System Abstraction Layer Specification
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index 9e42ce43cfbe..d5ef0aa3e312 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -61,4 +61,6 @@
61#define SO_TIMESTAMPNS 35 61#define SO_TIMESTAMPNS 35
62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
63 63
64#define SO_MARK 36
65
64#endif /* _ASM_IA64_SOCKET_H */ 66#endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h
index 2f93f4743add..242028b4d86a 100644
--- a/include/asm-m32r/irq.h
+++ b/include/asm-m32r/irq.h
@@ -3,7 +3,7 @@
3#define _ASM_M32R_IRQ_H 3#define _ASM_M32R_IRQ_H
4 4
5 5
6#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_USRV) 6#if defined(CONFIG_PLAT_USRV)
7/* 7/*
8 * IRQ definitions for M32700UT 8 * IRQ definitions for M32700UT
9 * M32700 Chip: 64 interrupts 9 * M32700 Chip: 64 interrupts
diff --git a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h
index d39121279a1a..57623beb44cb 100644
--- a/include/asm-m32r/m32700ut/m32700ut_pld.h
+++ b/include/asm-m32r/m32700ut/m32700ut_pld.h
@@ -13,9 +13,7 @@
13 * this archive for more details. 13 * this archive for more details.
14 */ 14 */
15 15
16#if defined(CONFIG_PLAT_M32700UT_Alpha) 16#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV)
17#define PLD_PLAT_BASE 0x08c00000
18#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV)
19#define PLD_PLAT_BASE 0x04c00000 17#define PLD_PLAT_BASE 0x04c00000
20#else 18#else
21#error "no platform configuration" 19#error "no platform configuration"
diff --git a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h
index 943ba63c1ebc..e5921adfad1b 100644
--- a/include/asm-m32r/pgalloc.h
+++ b/include/asm-m32r/pgalloc.h
@@ -24,7 +24,7 @@ static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
24 return pgd; 24 return pgd;
25} 25}
26 26
27static __inline__ void pgd_free(pgd_t *pgd) 27static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
28{ 28{
29 free_page((unsigned long)pgd); 29 free_page((unsigned long)pgd);
30} 30}
@@ -46,17 +46,17 @@ static __inline__ struct page *pte_alloc_one(struct mm_struct *mm,
46 return pte; 46 return pte;
47} 47}
48 48
49static __inline__ void pte_free_kernel(pte_t *pte) 49static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
50{ 50{
51 free_page((unsigned long)pte); 51 free_page((unsigned long)pte);
52} 52}
53 53
54static __inline__ void pte_free(struct page *pte) 54static inline void pte_free(struct mm_struct *mm, struct page *pte)
55{ 55{
56 __free_page(pte); 56 __free_page(pte);
57} 57}
58 58
59#define __pte_free_tlb(tlb, pte) pte_free((pte)) 59#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
60 60
61/* 61/*
62 * allocating and freeing a pmd is trivial: the 1-entry pmd is 62 * allocating and freeing a pmd is trivial: the 1-entry pmd is
@@ -65,7 +65,7 @@ static __inline__ void pte_free(struct page *pte)
65 */ 65 */
66 66
67#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) 67#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
68#define pmd_free(x) do { } while (0) 68#define pmd_free(mm, x) do { } while (0)
69#define __pmd_free_tlb(tlb, x) do { } while (0) 69#define __pmd_free_tlb(tlb, x) do { } while (0)
70#define pgd_populate(mm, pmd, pte) BUG() 70#define pgd_populate(mm, pmd, pte) BUG()
71 71
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 793d5d30c850..9a0e20012224 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_M32R_SOCKET_H */ 57#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index f467eac9ba70..cf701c933249 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -327,7 +327,7 @@
327#define __NR_epoll_pwait 319 327#define __NR_epoll_pwait 319
328#define __NR_utimensat 320 328#define __NR_utimensat 320
329#define __NR_signalfd 321 329#define __NR_signalfd 321
330#define __NR_timerfd 322 330/* #define __NR_timerfd 322 removed */
331#define __NR_eventfd 323 331#define __NR_eventfd 323
332#define __NR_fallocate 324 332#define __NR_fallocate 324
333 333
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h
index 27d11da2b479..28b0f49ee521 100644
--- a/include/asm-m68k/macintosh.h
+++ b/include/asm-m68k/macintosh.h
@@ -14,8 +14,6 @@ extern void mac_init_IRQ(void);
14extern int mac_irq_pending(unsigned int); 14extern int mac_irq_pending(unsigned int);
15extern void mac_identify(void); 15extern void mac_identify(void);
16extern void mac_report_hardware(void); 16extern void mac_report_hardware(void);
17extern void mac_debugging_penguin(int);
18extern void mac_boom(int);
19 17
20/* 18/*
21 * Floppy driver magic hook - probably shouldnt be here 19 * Floppy driver magic hook - probably shouldnt be here
diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h
index 5158412cd54d..500ec9b8b189 100644
--- a/include/asm-m68k/motorola_pgalloc.h
+++ b/include/asm-m68k/motorola_pgalloc.h
@@ -22,7 +22,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long ad
22 return pte; 22 return pte;
23} 23}
24 24
25static inline void pte_free_kernel(pte_t *pte) 25static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
26{ 26{
27 cache_page(pte); 27 cache_page(pte);
28 free_page((unsigned long) pte); 28 free_page((unsigned long) pte);
@@ -47,7 +47,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add
47 return page; 47 return page;
48} 48}
49 49
50static inline void pte_free(struct page *page) 50static inline void pte_free(struct mm_struct *mm, struct page *page)
51{ 51{
52 cache_page(kmap(page)); 52 cache_page(kmap(page));
53 kunmap(page); 53 kunmap(page);
@@ -67,7 +67,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
67 return get_pointer_table(); 67 return get_pointer_table();
68} 68}
69 69
70static inline int pmd_free(pmd_t *pmd) 70static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
71{ 71{
72 return free_pointer_table(pmd); 72 return free_pointer_table(pmd);
73} 73}
@@ -78,9 +78,9 @@ static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
78} 78}
79 79
80 80
81static inline void pgd_free(pgd_t *pgd) 81static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
82{ 82{
83 pmd_free((pmd_t *)pgd); 83 pmd_free(mm, (pmd_t *)pgd);
84} 84}
85 85
86static inline pgd_t *pgd_alloc(struct mm_struct *mm) 86static inline pgd_t *pgd_alloc(struct mm_struct *mm)
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index 6d21b90863ad..dbc64e92c41a 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h
index fd8241117649..a5a91e72714b 100644
--- a/include/asm-m68k/sun3_pgalloc.h
+++ b/include/asm-m68k/sun3_pgalloc.h
@@ -21,12 +21,12 @@ extern const char bad_pmd_string[];
21#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) 21#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); })
22 22
23 23
24static inline void pte_free_kernel(pte_t * pte) 24static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
25{ 25{
26 free_page((unsigned long) pte); 26 free_page((unsigned long) pte);
27} 27}
28 28
29static inline void pte_free(struct page *page) 29static inline void pte_free(struct mm_struct *mm, struct page *page)
30{ 30{
31 __free_page(page); 31 __free_page(page);
32} 32}
@@ -72,10 +72,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
72 * allocating and freeing a pmd is trivial: the 1-entry pmd is 72 * allocating and freeing a pmd is trivial: the 1-entry pmd is
73 * inside the pgd, so has no extra memory associated with it. 73 * inside the pgd, so has no extra memory associated with it.
74 */ 74 */
75#define pmd_free(x) do { } while (0) 75#define pmd_free(mm, x) do { } while (0)
76#define __pmd_free_tlb(tlb, x) do { } while (0) 76#define __pmd_free_tlb(tlb, x) do { } while (0)
77 77
78static inline void pgd_free(pgd_t * pgd) 78static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
79{ 79{
80 free_page((unsigned long) pgd); 80 free_page((unsigned long) pgd);
81} 81}
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index f43afe1fc3b3..c142fbf2f376 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -262,7 +262,7 @@ static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned lon
262 * tmp = __swab32(*(p++)); 262 * tmp = __swab32(*(p++));
263 * tmp |= ~0UL >> (32-offset); 263 * tmp |= ~0UL >> (32-offset);
264 * 264 *
265 * but this would decrease preformance, so we change the 265 * but this would decrease performance, so we change the
266 * shift: 266 * shift:
267 */ 267 */
268 tmp = *(p++); 268 tmp = *(p++);
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index 163dcb1a9689..29bc0aad2ebc 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -53,7 +53,7 @@ static inline void __flush_cache_all(void)
53#endif /* CONFIG_M5407 */ 53#endif /* CONFIG_M5407 */
54#if defined(CONFIG_M527x) || defined(CONFIG_M528x) 54#if defined(CONFIG_M527x) || defined(CONFIG_M528x)
55 __asm__ __volatile__ ( 55 __asm__ __volatile__ (
56 "movel #0x81400100, %%d0\n\t" 56 "movel #0x81000200, %%d0\n\t"
57 "movec %%d0, %%CACR\n\t" 57 "movec %%d0, %%CACR\n\t"
58 "nop\n\t" 58 "nop\n\t"
59 : : : "d0" ); 59 : : : "d0" );
diff --git a/include/asm-m68knommu/commproc.h b/include/asm-m68knommu/commproc.h
index 0161ebb5d883..36e870b468ef 100644
--- a/include/asm-m68knommu/commproc.h
+++ b/include/asm-m68knommu/commproc.h
@@ -715,7 +715,7 @@ extern void cpm_install_handler(int vec, void (*handler)(void *), void *dev_id);
715#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */ 715#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
716#define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */ 716#define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
717#define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */ 717#define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
718#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */ 718#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */
719#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */ 719#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
720#define CICR_IEN ((uint)0x00000080) /* Int. enable */ 720#define CICR_IEN ((uint)0x00000080) /* Int. enable */
721#define CICR_SPS ((uint)0x00000001) /* SCC Spread */ 721#define CICR_SPS ((uint)0x00000001) /* SCC Spread */
diff --git a/include/asm-m68knommu/delay.h b/include/asm-m68knommu/delay.h
index 04a20fd051cf..55cbd6294ab6 100644
--- a/include/asm-m68knommu/delay.h
+++ b/include/asm-m68knommu/delay.h
@@ -68,7 +68,7 @@ static inline void _udelay(unsigned long usecs)
68/* 68/*
69 * Moved the udelay() function into library code, no longer inlined. 69 * Moved the udelay() function into library code, no longer inlined.
70 * I had to change the algorithm because we are overflowing now on 70 * I had to change the algorithm because we are overflowing now on
71 * the faster ColdFire parts. The code is a little biger, so it makes 71 * the faster ColdFire parts. The code is a little bigger, so it makes
72 * sense to library it. 72 * sense to library it.
73 */ 73 */
74extern void udelay(unsigned long usecs); 74extern void udelay(unsigned long usecs);
diff --git a/include/asm-m68knommu/m5249sim.h b/include/asm-m68knommu/m5249sim.h
index 399814f0b219..366eb8602d2f 100644
--- a/include/asm-m68knommu/m5249sim.h
+++ b/include/asm-m68knommu/m5249sim.h
@@ -43,10 +43,10 @@
43#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 43#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */
44#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 44#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */
45#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 45#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */
46#define MCFSIM_CSAR2 0x98 /* CS 2 Adress reg (r/w) */ 46#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */
47#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 47#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */
48#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 48#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */
49#define MCFSIM_CSAR3 0xa4 /* CS 3 Adress reg (r/w) */ 49#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */
50#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 50#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */
51#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 51#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */
52 52
diff --git a/include/asm-m68knommu/m5307sim.h b/include/asm-m68knommu/m5307sim.h
index d3ce550f6ef4..5886728409c0 100644
--- a/include/asm-m68knommu/m5307sim.h
+++ b/include/asm-m68knommu/m5307sim.h
@@ -64,22 +64,22 @@
64#define MCFSIM_CSMR7 0xda /* CS 7 Mask reg (r/w) */ 64#define MCFSIM_CSMR7 0xda /* CS 7 Mask reg (r/w) */
65#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 65#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */
66#else 66#else
67#define MCFSIM_CSAR2 0x98 /* CS 2 Adress reg (r/w) */ 67#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */
68#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 68#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */
69#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 69#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */
70#define MCFSIM_CSAR3 0xa4 /* CS 3 Adress reg (r/w) */ 70#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */
71#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 71#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */
72#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 72#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */
73#define MCFSIM_CSAR4 0xb0 /* CS 4 Adress reg (r/w) */ 73#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */
74#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 74#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */
75#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 75#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */
76#define MCFSIM_CSAR5 0xbc /* CS 5 Adress reg (r/w) */ 76#define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */
77#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ 77#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */
78#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 78#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */
79#define MCFSIM_CSAR6 0xc8 /* CS 6 Adress reg (r/w) */ 79#define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */
80#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ 80#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */
81#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 81#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */
82#define MCFSIM_CSAR7 0xd4 /* CS 7 Adress reg (r/w) */ 82#define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */
83#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ 83#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */
84#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 84#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */
85#endif /* CONFIG_OLDMASK */ 85#endif /* CONFIG_OLDMASK */
diff --git a/include/asm-m68knommu/m5407sim.h b/include/asm-m68knommu/m5407sim.h
index 75dcdacdb298..cc22c4a53005 100644
--- a/include/asm-m68knommu/m5407sim.h
+++ b/include/asm-m68knommu/m5407sim.h
@@ -48,22 +48,22 @@
48#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 48#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */
49#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 49#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */
50 50
51#define MCFSIM_CSAR2 0x98 /* CS 2 Adress reg (r/w) */ 51#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */
52#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 52#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */
53#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 53#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */
54#define MCFSIM_CSAR3 0xa4 /* CS 3 Adress reg (r/w) */ 54#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */
55#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 55#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */
56#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 56#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */
57#define MCFSIM_CSAR4 0xb0 /* CS 4 Adress reg (r/w) */ 57#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */
58#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 58#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */
59#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 59#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */
60#define MCFSIM_CSAR5 0xbc /* CS 5 Adress reg (r/w) */ 60#define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */
61#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ 61#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */
62#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 62#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */
63#define MCFSIM_CSAR6 0xc8 /* CS 6 Adress reg (r/w) */ 63#define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */
64#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ 64#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */
65#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 65#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */
66#define MCFSIM_CSAR7 0xd4 /* CS 7 Adress reg (r/w) */ 66#define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */
67#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ 67#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */
68#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 68#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */
69 69
diff --git a/include/asm-m68knommu/m68360_regs.h b/include/asm-m68knommu/m68360_regs.h
index a3f8cc8a4a84..d57217ca4f27 100644
--- a/include/asm-m68knommu/m68360_regs.h
+++ b/include/asm-m68knommu/m68360_regs.h
@@ -138,7 +138,7 @@
138#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */ 138#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
139#define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */ 139#define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
140 140
141#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */ 141#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */
142#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */ 142#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
143#define CICR_VBA_MASK ((uint)0x000000e0) /* Vector Base Address */ 143#define CICR_VBA_MASK ((uint)0x000000e0) /* Vector Base Address */
144#define CICR_SPS ((uint)0x00000001) /* SCC Spread */ 144#define CICR_SPS ((uint)0x00000001) /* SCC Spread */
diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h
index 7b61a8a529f5..c042634fadaa 100644
--- a/include/asm-m68knommu/mcfcache.h
+++ b/include/asm-m68knommu/mcfcache.h
@@ -60,7 +60,7 @@
60 nop 60 nop
61 movel #0x0000c020, %d0 /* Set SDRAM cached only */ 61 movel #0x0000c020, %d0 /* Set SDRAM cached only */
62 movec %d0, %ACR0 62 movec %d0, %ACR0
63 movel #0xff00c000, %d0 /* Cache Flash also */ 63 movel #0x00000000, %d0 /* No other regions cached */
64 movec %d0, %ACR1 64 movec %d0, %ACR1
65 movel #0x80000200, %d0 /* Setup cache mask */ 65 movel #0x80000200, %d0 /* Setup cache mask */
66 movec %d0, %CACR /* Enable cache */ 66 movec %d0, %CACR /* Enable cache */
diff --git a/include/asm-m68knommu/mcfne.h b/include/asm-m68knommu/mcfne.h
index c920ccdb61fe..431f63aadd0e 100644
--- a/include/asm-m68knommu/mcfne.h
+++ b/include/asm-m68knommu/mcfne.h
@@ -60,17 +60,6 @@
60#define NE2000_BYTE volatile unsigned char 60#define NE2000_BYTE volatile unsigned char
61#endif 61#endif
62 62
63#if defined(CONFIG_CFV240)
64#define NE2000_ADDR 0x40010000
65#define NE2000_ADDR1 0x40010001
66#define NE2000_ODDOFFSET 0x00000000
67#define NE2000_IRQ 1
68#define NE2000_IRQ_VECTOR 0x19
69#define NE2000_IRQ_PRIORITY 2
70#define NE2000_IRQ_LEVEL 1
71#define NE2000_BYTE volatile unsigned char
72#endif
73
74#if defined(CONFIG_M5307C3) 63#if defined(CONFIG_M5307C3)
75#define NE2000_ADDR 0x40000300 64#define NE2000_ADDR 0x40000300
76#define NE2000_ODDOFFSET 0x00010000 65#define NE2000_ODDOFFSET 0x00010000
@@ -173,13 +162,8 @@ void ne2000_outsw(unsigned int addr, void *vbuf, unsigned long len);
173 * On most NE2000 implementations on ColdFire boards the chip is 162 * On most NE2000 implementations on ColdFire boards the chip is
174 * mapped in kinda funny, due to its ISA heritage. 163 * mapped in kinda funny, due to its ISA heritage.
175 */ 164 */
176#ifdef CONFIG_CFV240
177#define NE2000_PTR(addr) (NE2000_ADDR + ((addr & 0x3f) << 1) + 1)
178#define NE2000_DATA_PTR(addr) (NE2000_ADDR + ((addr & 0x3f) << 1))
179#else
180#define NE2000_PTR(addr) ((addr&0x1)?(NE2000_ODDOFFSET+addr-1):(addr)) 165#define NE2000_PTR(addr) ((addr&0x1)?(NE2000_ODDOFFSET+addr-1):(addr))
181#define NE2000_DATA_PTR(addr) (addr) 166#define NE2000_DATA_PTR(addr) (addr)
182#endif
183 167
184 168
185void ne2000_outb(unsigned int val, unsigned int addr) 169void ne2000_outb(unsigned int val, unsigned int addr)
@@ -285,17 +269,6 @@ void ne2000_irqsetup(int irq)
285} 269}
286#endif 270#endif
287 271
288#if defined(CONFIG_CFV240)
289void ne2000_irqsetup(int irq)
290{
291 volatile unsigned char *icrp;
292
293 icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_ICR1);
294 *icrp = MCFSIM_ICR_LEVEL1 | MCFSIM_ICR_PRI2 | MCFSIM_ICR_AUTOVEC;
295 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_EINT1);
296}
297#endif
298
299#if defined(CONFIG_M5206e) && defined(CONFIG_NETtel) 272#if defined(CONFIG_M5206e) && defined(CONFIG_NETtel)
300void ne2000_irqsetup(int irq) 273void ne2000_irqsetup(int irq)
301{ 274{
diff --git a/include/asm-m68knommu/mcfsim.h b/include/asm-m68knommu/mcfsim.h
index 1074ae717f74..da3f2ceff3a4 100644
--- a/include/asm-m68knommu/mcfsim.h
+++ b/include/asm-m68knommu/mcfsim.h
@@ -17,9 +17,7 @@
17 * Include 5204, 5206/e, 5235, 5249, 5270/5271, 5272, 5280/5282, 17 * Include 5204, 5206/e, 5235, 5249, 5270/5271, 5272, 5280/5282,
18 * 5307 or 5407 specific addresses. 18 * 5307 or 5407 specific addresses.
19 */ 19 */
20#if defined(CONFIG_M5204) 20#if defined(CONFIG_M5206) || defined(CONFIG_M5206e)
21#include <asm/m5204sim.h>
22#elif defined(CONFIG_M5206) || defined(CONFIG_M5206e)
23#include <asm/m5206sim.h> 21#include <asm/m5206sim.h>
24#elif defined(CONFIG_M520x) 22#elif defined(CONFIG_M520x)
25#include <asm/m520xsim.h> 23#include <asm/m520xsim.h>
diff --git a/include/asm-m68knommu/mcftimer.h b/include/asm-m68knommu/mcftimer.h
index 6f4d796e03db..0f90f6d2227a 100644
--- a/include/asm-m68knommu/mcftimer.h
+++ b/include/asm-m68knommu/mcftimer.h
@@ -16,7 +16,7 @@
16/* 16/*
17 * Get address specific defines for this ColdFire member. 17 * Get address specific defines for this ColdFire member.
18 */ 18 */
19#if defined(CONFIG_M5204) || defined(CONFIG_M5206) || defined(CONFIG_M5206e) 19#if defined(CONFIG_M5206) || defined(CONFIG_M5206e)
20#define MCFTIMER_BASE1 0x100 /* Base address of TIMER1 */ 20#define MCFTIMER_BASE1 0x100 /* Base address of TIMER1 */
21#define MCFTIMER_BASE2 0x120 /* Base address of TIMER2 */ 21#define MCFTIMER_BASE2 0x120 /* Base address of TIMER2 */
22#elif defined(CONFIG_M5272) 22#elif defined(CONFIG_M5272)
diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h
index 873d0805219c..ef2293873612 100644
--- a/include/asm-m68knommu/mcfuart.h
+++ b/include/asm-m68knommu/mcfuart.h
@@ -12,7 +12,6 @@
12#define mcfuart_h 12#define mcfuart_h
13/****************************************************************************/ 13/****************************************************************************/
14 14
15
16/* 15/*
17 * Define the base address of the UARTS within the MBAR address 16 * Define the base address of the UARTS within the MBAR address
18 * space. 17 * space.
@@ -20,7 +19,7 @@
20#if defined(CONFIG_M5272) 19#if defined(CONFIG_M5272)
21#define MCFUART_BASE1 0x100 /* Base address of UART1 */ 20#define MCFUART_BASE1 0x100 /* Base address of UART1 */
22#define MCFUART_BASE2 0x140 /* Base address of UART2 */ 21#define MCFUART_BASE2 0x140 /* Base address of UART2 */
23#elif defined(CONFIG_M5204) || defined(CONFIG_M5206) || defined(CONFIG_M5206e) 22#elif defined(CONFIG_M5206) || defined(CONFIG_M5206e)
24#if defined(CONFIG_NETtel) 23#if defined(CONFIG_NETtel)
25#define MCFUART_BASE1 0x180 /* Base address of UART1 */ 24#define MCFUART_BASE1 0x180 /* Base address of UART1 */
26#define MCFUART_BASE2 0x140 /* Base address of UART2 */ 25#define MCFUART_BASE2 0x140 /* Base address of UART2 */
@@ -33,7 +32,7 @@
33#define MCFUART_BASE2 0x240 /* Base address of UART2 */ 32#define MCFUART_BASE2 0x240 /* Base address of UART2 */
34#define MCFUART_BASE3 0x280 /* Base address of UART3 */ 33#define MCFUART_BASE3 0x280 /* Base address of UART3 */
35#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) 34#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407)
36#if defined(CONFIG_NETtel) || defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) 35#if defined(CONFIG_NETtel) || defined(CONFIG_SECUREEDGEMP3)
37#define MCFUART_BASE1 0x200 /* Base address of UART1 */ 36#define MCFUART_BASE1 0x200 /* Base address of UART1 */
38#define MCFUART_BASE2 0x1c0 /* Base address of UART2 */ 37#define MCFUART_BASE2 0x1c0 /* Base address of UART2 */
39#else 38#else
@@ -72,7 +71,7 @@ struct mcf_platform_uart {
72#define MCFUART_UTB 0x0c /* Transmit Buffer (w) */ 71#define MCFUART_UTB 0x0c /* Transmit Buffer (w) */
73#define MCFUART_UIPCR 0x10 /* Input Port Change (r) */ 72#define MCFUART_UIPCR 0x10 /* Input Port Change (r) */
74#define MCFUART_UACR 0x10 /* Auxiliary Control (w) */ 73#define MCFUART_UACR 0x10 /* Auxiliary Control (w) */
75#define MCFUART_UISR 0x14 /* Interrup Status (r) */ 74#define MCFUART_UISR 0x14 /* Interrupt Status (r) */
76#define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */ 75#define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */
77#define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */ 76#define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */
78#define MCFUART_UBG2 0x1c /* Baud Rate LSB (r/w) */ 77#define MCFUART_UBG2 0x1c /* Baud Rate LSB (r/w) */
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index 15b4c7d45c94..ee2dc07bae0e 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -207,23 +207,6 @@ cmpxchg(volatile int *p, int old, int new)
207} 207}
208 208
209 209
210#ifdef CONFIG_M68332
211#define HARD_RESET_NOW() ({ \
212 local_irq_disable(); \
213 asm(" \
214 movew #0x0000, 0xfffa6a; \
215 reset; \
216 /*movew #0x1557, 0xfffa44;*/ \
217 /*movew #0x0155, 0xfffa46;*/ \
218 moveal #0, %a0; \
219 movec %a0, %vbr; \
220 moveal 0, %sp; \
221 moveal 4, %a0; \
222 jmp (%a0); \
223 "); \
224})
225#endif
226
227#if defined( CONFIG_M68328 ) || defined( CONFIG_M68EZ328 ) || \ 210#if defined( CONFIG_M68328 ) || defined( CONFIG_M68EZ328 ) || \
228 defined (CONFIG_M68360) || defined( CONFIG_M68VZ328 ) 211 defined (CONFIG_M68360) || defined( CONFIG_M68VZ328 )
229#define HARD_RESET_NOW() ({ \ 212#define HARD_RESET_NOW() ({ \
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 568c76cdd900..ac5d541368e9 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -128,7 +128,7 @@ typedef u32 compat_sigset_word;
128 * A pointer passed in from user mode. This should not 128 * A pointer passed in from user mode. This should not
129 * be used for syscall parameters, just declare them 129 * be used for syscall parameters, just declare them
130 * as pointers because the syscall entry code will have 130 * as pointers because the syscall entry code will have
131 * appropriately comverted them already. 131 * appropriately converted them already.
132 */ 132 */
133typedef u32 compat_uptr_t; 133typedef u32 compat_uptr_t;
134 134
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index aef0edbfe4c6..e4fe26c160ba 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -74,7 +74,6 @@ typedef struct
74 struct dbdma_cmd *dma_table_cpu; 74 struct dbdma_cmd *dma_table_cpu;
75 dma_addr_t dma_table_dma; 75 dma_addr_t dma_table_dma;
76#endif 76#endif
77 struct device *dev;
78 int irq; 77 int irq;
79 u32 regbase; 78 u32 regbase;
80#ifdef CONFIG_PM 79#ifdef CONFIG_PM
diff --git a/include/asm-mips/mach-excite/excite_fpga.h b/include/asm-mips/mach-excite/excite_fpga.h
index 38fcda703a0b..0a1ef69bece7 100644
--- a/include/asm-mips/mach-excite/excite_fpga.h
+++ b/include/asm-mips/mach-excite/excite_fpga.h
@@ -3,7 +3,7 @@
3 3
4 4
5/** 5/**
6 * Adress alignment of the individual FPGA bytes. 6 * Address alignment of the individual FPGA bytes.
7 * The address arrangement of the individual bytes of the FPGA is two 7 * The address arrangement of the individual bytes of the FPGA is two
8 * byte aligned at the embedded MK2 platform. 8 * byte aligned at the embedded MK2 platform.
9 */ 9 */
diff --git a/include/asm-mips/mach-wrppmc/mach-gt64120.h b/include/asm-mips/mach-wrppmc/mach-gt64120.h
index 00d8bf6164a9..83746b84a5ec 100644
--- a/include/asm-mips/mach-wrppmc/mach-gt64120.h
+++ b/include/asm-mips/mach-wrppmc/mach-gt64120.h
@@ -45,7 +45,7 @@
45#define GT_PCI_IO_SIZE 0x02000000UL 45#define GT_PCI_IO_SIZE 0x02000000UL
46 46
47/* 47/*
48 * PCI interrupts will come in on either the INTA or INTD interrups lines, 48 * PCI interrupts will come in on either the INTA or INTD interrupt lines,
49 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our 49 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our
50 * boards, they all either come in on IntD or they all come in on IntA, they 50 * boards, they all either come in on IntD or they all come in on IntA, they
51 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the 51 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
index 81b72122207a..c4efeced8396 100644
--- a/include/asm-mips/pgalloc.h
+++ b/include/asm-mips/pgalloc.h
@@ -58,7 +58,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
58 return ret; 58 return ret;
59} 59}
60 60
61static inline void pgd_free(pgd_t *pgd) 61static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
62{ 62{
63 free_pages((unsigned long)pgd, PGD_ORDER); 63 free_pages((unsigned long)pgd, PGD_ORDER);
64} 64}
@@ -85,12 +85,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
85 return pte; 85 return pte;
86} 86}
87 87
88static inline void pte_free_kernel(pte_t *pte) 88static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
89{ 89{
90 free_pages((unsigned long)pte, PTE_ORDER); 90 free_pages((unsigned long)pte, PTE_ORDER);
91} 91}
92 92
93static inline void pte_free(struct page *pte) 93static inline void pte_free(struct mm_struct *mm, struct page *pte)
94{ 94{
95 __free_pages(pte, PTE_ORDER); 95 __free_pages(pte, PTE_ORDER);
96} 96}
@@ -103,7 +103,7 @@ static inline void pte_free(struct page *pte)
103 * allocating and freeing a pmd is trivial: the 1-entry pmd is 103 * allocating and freeing a pmd is trivial: the 1-entry pmd is
104 * inside the pgd, so has no extra memory associated with it. 104 * inside the pgd, so has no extra memory associated with it.
105 */ 105 */
106#define pmd_free(x) do { } while (0) 106#define pmd_free(mm, x) do { } while (0)
107#define __pmd_free_tlb(tlb, x) do { } while (0) 107#define __pmd_free_tlb(tlb, x) do { } while (0)
108 108
109#endif 109#endif
@@ -120,12 +120,12 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
120 return pmd; 120 return pmd;
121} 121}
122 122
123static inline void pmd_free(pmd_t *pmd) 123static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
124{ 124{
125 free_pages((unsigned long)pmd, PMD_ORDER); 125 free_pages((unsigned long)pmd, PMD_ORDER);
126} 126}
127 127
128#define __pmd_free_tlb(tlb, x) pmd_free(x) 128#define __pmd_free_tlb(tlb, x) pmd_free((tlb)->mm, x)
129 129
130#endif 130#endif
131 131
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 83bc94534084..36f42de59409 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -65,6 +65,8 @@ extern unsigned int vced_count, vcei_count;
65#define TASK_UNMAPPED_BASE \ 65#define TASK_UNMAPPED_BASE \
66 (test_thread_flag(TIF_32BIT_ADDR) ? \ 66 (test_thread_flag(TIF_32BIT_ADDR) ? \
67 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3)) 67 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
68#define TASK_SIZE_OF(tsk) \
69 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE)
68#endif 70#endif
69 71
70#define NUM_FPU_REGS 32 72#define NUM_FPU_REGS 32
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
index f4981c4f16bb..c0501f91719b 100644
--- a/include/asm-mips/sgi/ip22.h
+++ b/include/asm-mips/sgi/ip22.h
@@ -15,7 +15,7 @@
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 interrupts
19 * are not supported this way. Driver is supposed to allocate HPC/MC 19 * are not supported this way. Driver is supposed to allocate HPC/MC
20 * interrupt as shareable and then look to proper status bit (see 20 * interrupt as shareable and then look to proper status bit (see
21 * HAL2 driver). This will prevent many complications, trust me ;-) 21 * HAL2 driver). This will prevent many complications, trust me ;-)
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h
index ef91b3363554..0187895e556c 100644
--- a/include/asm-mips/sn/sn0/hubio.h
+++ b/include/asm-mips/sn/sn0/hubio.h
@@ -338,7 +338,7 @@ typedef union io_perf_cnt {
338#define IIO_IFDR 0x400398 /* IOQ FIFO Depth */ 338#define IIO_IFDR 0x400398 /* IOQ FIFO Depth */
339#define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */ 339#define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */
340#define IIO_IMMR IIO_IIAP 340#define IIO_IMMR IIO_IIAP
341#define IIO_ICMR 0x4003a8 /* CRB Managment Register */ 341#define IIO_ICMR 0x4003a8 /* CRB Management Register */
342#define IIO_ICCR 0x4003b0 /* CRB Control Register */ 342#define IIO_ICCR 0x4003b0 /* CRB Control Register */
343#define IIO_ICTO 0x4003b8 /* CRB Time Out Register */ 343#define IIO_ICTO 0x4003b8 /* CRB Time Out Register */
344#define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */ 344#define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 95945689b1c6..63f60254d308 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -73,6 +73,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
73#define SO_TIMESTAMPNS 35 73#define SO_TIMESTAMPNS 35
74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
75 75
76#define SO_MARK 36
77
76#ifdef __KERNEL__ 78#ifdef __KERNEL__
77 79
78/** sock_type - Socket types 80/** sock_type - Socket types
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 5a85d1b025c8..7f32611a7a5e 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -132,7 +132,7 @@ typedef u32 compat_sigset_word;
132 * A pointer passed in from user mode. This should not 132 * A pointer passed in from user mode. This should not
133 * be used for syscall parameters, just declare them 133 * be used for syscall parameters, just declare them
134 * as pointers because the syscall entry code will have 134 * as pointers because the syscall entry code will have
135 * appropriately comverted them already. 135 * appropriately converted them already.
136 */ 136 */
137typedef u32 compat_uptr_t; 137typedef u32 compat_uptr_t;
138 138
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h
index f628ac7de83d..8e7946a141de 100644
--- a/include/asm-parisc/elf.h
+++ b/include/asm-parisc/elf.h
@@ -28,7 +28,7 @@
28#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ 28#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
29#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ 29#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
30 30
31/* Additional section indeces. */ 31/* Additional section indices. */
32 32
33#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared 33#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
34 symbols in ANSI C. */ 34 symbols in ANSI C. */
diff --git a/include/asm-parisc/linkage.h b/include/asm-parisc/linkage.h
index ad8cd0d069ea..0b19a7242d0c 100644
--- a/include/asm-parisc/linkage.h
+++ b/include/asm-parisc/linkage.h
@@ -8,7 +8,7 @@
8 8
9/* 9/*
10 * In parisc assembly a semicolon marks a comment while a 10 * In parisc assembly a semicolon marks a comment while a
11 * exclamation mark is used to seperate independent lines. 11 * exclamation mark is used to separate independent lines.
12 */ 12 */
13#ifdef __ASSEMBLY__ 13#ifdef __ASSEMBLY__
14 14
diff --git a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h
index 1af1a41e0723..aab66f1bea14 100644
--- a/include/asm-parisc/pgalloc.h
+++ b/include/asm-parisc/pgalloc.h
@@ -43,7 +43,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
43 return actual_pgd; 43 return actual_pgd;
44} 44}
45 45
46static inline void pgd_free(pgd_t *pgd) 46static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
47{ 47{
48#ifdef CONFIG_64BIT 48#ifdef CONFIG_64BIT
49 pgd -= PTRS_PER_PGD; 49 pgd -= PTRS_PER_PGD;
@@ -70,7 +70,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
70 return pmd; 70 return pmd;
71} 71}
72 72
73static inline void pmd_free(pmd_t *pmd) 73static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
74{ 74{
75#ifdef CONFIG_64BIT 75#ifdef CONFIG_64BIT
76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) 76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
@@ -91,7 +91,7 @@ static inline void pmd_free(pmd_t *pmd)
91 */ 91 */
92 92
93#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) 93#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
94#define pmd_free(x) do { } while (0) 94#define pmd_free(mm, x) do { } while (0)
95#define pgd_populate(mm, pmd, pte) BUG() 95#define pgd_populate(mm, pmd, pte) BUG()
96 96
97#endif 97#endif
@@ -130,12 +130,12 @@ pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
130 return pte; 130 return pte;
131} 131}
132 132
133static inline void pte_free_kernel(pte_t *pte) 133static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
134{ 134{
135 free_page((unsigned long)pte); 135 free_page((unsigned long)pte);
136} 136}
137 137
138#define pte_free(page) pte_free_kernel(page_address(page)) 138#define pte_free(mm, page) pte_free_kernel(page_address(page))
139 139
140#define check_pgt_cache() do { } while (0) 140#define check_pgt_cache() do { } while (0)
141 141
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index 6b294fb07a23..3bb06e898fde 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -32,7 +32,8 @@
32#endif 32#endif
33#define current_text_addr() ({ void *pc; current_ia(pc); pc; }) 33#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
34 34
35#define TASK_SIZE (current->thread.task_size) 35#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
36#define TASK_SIZE TASK_SIZE_OF(current)
36#define TASK_UNMAPPED_BASE (current->thread.map_base) 37#define TASK_UNMAPPED_BASE (current->thread.map_base)
37 38
38#define DEFAULT_TASK_SIZE32 (0xFFF00000UL) 39#define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index 99e868f6a8f5..69a7a0d30b02 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -52,4 +52,6 @@
52#define SO_PEERSEC 0x401d 52#define SO_PEERSEC 0x401d
53#define SO_PASSSEC 0x401e 53#define SO_PASSSEC 0x401e
54 54
55#define SO_MARK 0x401f
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-parisc/tlb.h b/include/asm-parisc/tlb.h
index 33107a248e1f..383b1db310ee 100644
--- a/include/asm-parisc/tlb.h
+++ b/include/asm-parisc/tlb.h
@@ -21,7 +21,7 @@ do { if (!(tlb)->fullmm) \
21 21
22#include <asm-generic/tlb.h> 22#include <asm-generic/tlb.h>
23 23
24#define __pmd_free_tlb(tlb, pmd) pmd_free(pmd) 24#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
25#define __pte_free_tlb(tlb, pte) pte_free(pte) 25#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
26 26
27#endif 27#endif
diff --git a/include/asm-parisc/vga.h b/include/asm-parisc/vga.h
index 154a84c843a7..171399a88ca6 100644
--- a/include/asm-parisc/vga.h
+++ b/include/asm-parisc/vga.h
@@ -3,4 +3,4 @@
3 3
4/* nothing */ 4/* nothing */
5 5
6#endif __ASM_PARISC_VGA_H__ 6#endif /* __ASM_PARISC_VGA_H__ */
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index 64ab1ddbdf85..d811a8cd7b58 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -119,7 +119,7 @@ typedef u32 compat_sigset_word;
119 * A pointer passed in from user mode. This should not 119 * A pointer passed in from user mode. This should not
120 * be used for syscall parameters, just declare them 120 * be used for syscall parameters, just declare them
121 * as pointers because the syscall entry code will have 121 * as pointers because the syscall entry code will have
122 * appropriately comverted them already. 122 * appropriately converted them already.
123 */ 123 */
124typedef u32 compat_uptr_t; 124typedef u32 compat_uptr_t;
125 125
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 528ef183c221..1e79673b7316 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -46,7 +46,7 @@ enum powerpc_oprofile_type {
46 PPC_OPROFILE_RS64 = 1, 46 PPC_OPROFILE_RS64 = 1,
47 PPC_OPROFILE_POWER4 = 2, 47 PPC_OPROFILE_POWER4 = 2,
48 PPC_OPROFILE_G4 = 3, 48 PPC_OPROFILE_G4 = 3,
49 PPC_OPROFILE_BOOKE = 4, 49 PPC_OPROFILE_FSL_EMB = 4,
50 PPC_OPROFILE_CELL = 5, 50 PPC_OPROFILE_CELL = 5,
51 PPC_OPROFILE_PA6T = 6, 51 PPC_OPROFILE_PA6T = 6,
52}; 52};
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 7a3cef785abd..852e15f51a1e 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -79,19 +79,19 @@ extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
79extern struct iommu_table *iommu_init_table(struct iommu_table * tbl, 79extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
80 int nid); 80 int nid);
81 81
82extern int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist, 82extern int iommu_map_sg(struct device *dev, struct scatterlist *sglist,
83 int nelems, unsigned long mask, 83 int nelems, unsigned long mask,
84 enum dma_data_direction direction); 84 enum dma_data_direction direction);
85extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 85extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
86 int nelems, enum dma_data_direction direction); 86 int nelems, enum dma_data_direction direction);
87 87
88extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 88extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
89 dma_addr_t *dma_handle, unsigned long mask, 89 size_t size, dma_addr_t *dma_handle,
90 gfp_t flag, int node); 90 unsigned long mask, gfp_t flag, int node);
91extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, 91extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
92 void *vaddr, dma_addr_t dma_handle); 92 void *vaddr, dma_addr_t dma_handle);
93extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, 93extern dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
94 size_t size, unsigned long mask, 94 void *vaddr, size_t size, unsigned long mask,
95 enum dma_data_direction direction); 95 enum dma_data_direction direction);
96extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, 96extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
97 size_t size, enum dma_data_direction direction); 97 size_t size, enum dma_data_direction direction);
diff --git a/include/asm-powerpc/mediabay.h b/include/asm-powerpc/mediabay.h
index 9daa3252d7b6..de83fe196309 100644
--- a/include/asm-powerpc/mediabay.h
+++ b/include/asm-powerpc/mediabay.h
@@ -18,14 +18,14 @@
18#define MB_NO 7 /* media bay contains nothing */ 18#define MB_NO 7 /* media bay contains nothing */
19 19
20int check_media_bay(struct device_node *which_bay, int what); 20int check_media_bay(struct device_node *which_bay, int what);
21int check_media_bay_by_base(unsigned long base, int what);
22 21
23/* Number of bays in the machine or 0 */ 22/* Number of bays in the machine or 0 */
24extern int media_bay_count; 23extern int media_bay_count;
25 24
26/* called by pmac-ide.c to register IDE controller for media bay */ 25int check_media_bay_by_base(unsigned long base, int what);
27extern int media_bay_set_ide_infos(struct device_node* which_bay, 26/* called by IDE PMAC host driver to register IDE controller for media bay */
28 unsigned long base, int irq, int index); 27int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base,
28 int irq, int index);
29 29
30#endif /* __KERNEL__ */ 30#endif /* __KERNEL__ */
31#endif /* _PPC_MEDIABAY_H */ 31#endif /* _PPC_MEDIABAY_H */
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h
index 4e7059cc6113..efde5ac82f7b 100644
--- a/include/asm-powerpc/nvram.h
+++ b/include/asm-powerpc/nvram.h
@@ -58,6 +58,9 @@ struct nvram_header {
58}; 58};
59 59
60#ifdef __KERNEL__ 60#ifdef __KERNEL__
61
62#include <linux/list.h>
63
61struct nvram_partition { 64struct nvram_partition {
62 struct list_head partition; 65 struct list_head partition;
63 struct nvram_header header; 66 struct nvram_header header;
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 938fefb4c4bc..95035c602ba6 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -54,7 +54,7 @@ struct op_powerpc_model {
54 int num_counters; 54 int num_counters;
55}; 55};
56 56
57extern struct op_powerpc_model op_model_fsl_booke; 57extern struct op_powerpc_model op_model_fsl_emb;
58extern struct op_powerpc_model op_model_rs64; 58extern struct op_powerpc_model op_model_rs64;
59extern struct op_powerpc_model op_model_power4; 59extern struct op_powerpc_model op_model_power4;
60extern struct op_powerpc_model op_model_7450; 60extern struct op_powerpc_model op_model_7450;
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index cc1cbf656b02..ccb0523eb3b4 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -13,37 +13,12 @@
13#include <asm/paca.h> 13#include <asm/paca.h>
14 14
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset) 15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset() get_paca()->data_offset 16#define __my_cpu_offset get_paca()->data_offset
17#define per_cpu_offset(x) (__per_cpu_offset(x)) 17#define per_cpu_offset(x) (__per_cpu_offset(x))
18 18
19/* var is in discarded region: offset to particular copy we want */ 19#endif /* CONFIG_SMP */
20#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 20#endif /* __powerpc64__ */
21#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
22#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset))
23 21
24/* A macro to avoid #include hell... */
25#define percpu_modcopy(pcpudst, src, size) \
26do { \
27 unsigned int __i; \
28 for_each_possible_cpu(__i) \
29 memcpy((pcpudst)+__per_cpu_offset(__i), \
30 (src), (size)); \
31} while (0)
32
33extern void setup_per_cpu_areas(void);
34
35#else /* ! SMP */
36
37#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
38#define __get_cpu_var(var) per_cpu__##var
39#define __raw_get_cpu_var(var) per_cpu__##var
40
41#endif /* SMP */
42
43#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
44
45#else
46#include <asm-generic/percpu.h> 22#include <asm-generic/percpu.h>
47#endif
48 23
49#endif /* _ASM_POWERPC_PERCPU_H_ */ 24#endif /* _ASM_POWERPC_PERCPU_H_ */
diff --git a/include/asm-powerpc/pgalloc-32.h b/include/asm-powerpc/pgalloc-32.h
index e1307432163c..c162a4c37b39 100644
--- a/include/asm-powerpc/pgalloc-32.h
+++ b/include/asm-powerpc/pgalloc-32.h
@@ -6,14 +6,14 @@
6extern void __bad_pte(pmd_t *pmd); 6extern void __bad_pte(pmd_t *pmd);
7 7
8extern pgd_t *pgd_alloc(struct mm_struct *mm); 8extern pgd_t *pgd_alloc(struct mm_struct *mm);
9extern void pgd_free(pgd_t *pgd); 9extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
10 10
11/* 11/*
12 * We don't have any real pmd's, and this code never triggers because 12 * We don't have any real pmd's, and this code never triggers because
13 * the pgd will always be present.. 13 * the pgd will always be present..
14 */ 14 */
15/* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */ 15/* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */
16#define pmd_free(x) do { } while (0) 16#define pmd_free(mm, x) do { } while (0)
17#define __pmd_free_tlb(tlb,x) do { } while (0) 17#define __pmd_free_tlb(tlb,x) do { } while (0)
18/* #define pgd_populate(mm, pmd, pte) BUG() */ 18/* #define pgd_populate(mm, pmd, pte) BUG() */
19 19
@@ -31,10 +31,10 @@ extern void pgd_free(pgd_t *pgd);
31 31
32extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 32extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
33extern struct page *pte_alloc_one(struct mm_struct *mm, unsigned long addr); 33extern struct page *pte_alloc_one(struct mm_struct *mm, unsigned long addr);
34extern void pte_free_kernel(pte_t *pte); 34extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte);
35extern void pte_free(struct page *pte); 35extern void pte_free(struct mm_struct *mm, struct page *pte);
36 36
37#define __pte_free_tlb(tlb, pte) pte_free((pte)) 37#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
38 38
39#define check_pgt_cache() do { } while (0) 39#define check_pgt_cache() do { } while (0)
40 40
diff --git a/include/asm-powerpc/pgalloc-64.h b/include/asm-powerpc/pgalloc-64.h
index 43214c8085b7..5afae8593931 100644
--- a/include/asm-powerpc/pgalloc-64.h
+++ b/include/asm-powerpc/pgalloc-64.h
@@ -29,7 +29,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
29 return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL); 29 return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL);
30} 30}
31 31
32static inline void pgd_free(pgd_t *pgd) 32static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
33{ 33{
34 subpage_prot_free(pgd); 34 subpage_prot_free(pgd);
35 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); 35 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd);
@@ -45,7 +45,7 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
45 GFP_KERNEL|__GFP_REPEAT); 45 GFP_KERNEL|__GFP_REPEAT);
46} 46}
47 47
48static inline void pud_free(pud_t *pud) 48static inline void pud_free(struct mm_struct *mm, pud_t *pud)
49{ 49{
50 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); 50 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud);
51} 51}
@@ -81,7 +81,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
81 GFP_KERNEL|__GFP_REPEAT); 81 GFP_KERNEL|__GFP_REPEAT);
82} 82}
83 83
84static inline void pmd_free(pmd_t *pmd) 84static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
85{ 85{
86 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); 86 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd);
87} 87}
@@ -99,12 +99,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
99 return pte ? virt_to_page(pte) : NULL; 99 return pte ? virt_to_page(pte) : NULL;
100} 100}
101 101
102static inline void pte_free_kernel(pte_t *pte) 102static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
103{ 103{
104 free_page((unsigned long)pte); 104 free_page((unsigned long)pte);
105} 105}
106 106
107static inline void pte_free(struct page *ptepage) 107static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
108{ 108{
109 __free_page(ptepage); 109 __free_page(ptepage);
110} 110}
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index dba7c948189d..1f4765d6546f 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -99,8 +99,9 @@ extern struct task_struct *last_task_used_spe;
99 */ 99 */
100#define TASK_SIZE_USER32 (0x0000000100000000UL - (1*PAGE_SIZE)) 100#define TASK_SIZE_USER32 (0x0000000100000000UL - (1*PAGE_SIZE))
101 101
102#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ 102#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \
103 TASK_SIZE_USER32 : TASK_SIZE_USER64) 103 TASK_SIZE_USER32 : TASK_SIZE_USER64)
104#define TASK_SIZE TASK_SIZE_OF(current)
104 105
105/* This decides where the kernel will search for a free chunk of vm 106/* This decides where the kernel will search for a free chunk of vm
106 * space during mmap's. 107 * space during mmap's.
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 2408a29507e5..0d6238987df8 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -18,6 +18,10 @@
18#include <asm/reg_booke.h> 18#include <asm/reg_booke.h>
19#endif /* CONFIG_BOOKE || CONFIG_40x */ 19#endif /* CONFIG_BOOKE || CONFIG_40x */
20 20
21#ifdef CONFIG_FSL_EMB_PERFMON
22#include <asm/reg_fsl_emb.h>
23#endif
24
21#ifdef CONFIG_8xx 25#ifdef CONFIG_8xx
22#include <asm/reg_8xx.h> 26#include <asm/reg_8xx.h>
23#endif /* CONFIG_8xx */ 27#endif /* CONFIG_8xx */
diff --git a/include/asm-powerpc/reg_booke.h b/include/asm-powerpc/reg_booke.h
index 0405ef479814..cf54a3f31753 100644
--- a/include/asm-powerpc/reg_booke.h
+++ b/include/asm-powerpc/reg_booke.h
@@ -9,68 +9,6 @@
9#ifndef __ASM_POWERPC_REG_BOOKE_H__ 9#ifndef __ASM_POWERPC_REG_BOOKE_H__
10#define __ASM_POWERPC_REG_BOOKE_H__ 10#define __ASM_POWERPC_REG_BOOKE_H__
11 11
12#ifndef __ASSEMBLY__
13/* Performance Monitor Registers */
14#define mfpmr(rn) ({unsigned int rval; \
15 asm volatile("mfpmr %0," __stringify(rn) \
16 : "=r" (rval)); rval;})
17#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
18#endif /* __ASSEMBLY__ */
19
20/* Freescale Book E Performance Monitor APU Registers */
21#define PMRN_PMC0 0x010 /* Performance Monitor Counter 0 */
22#define PMRN_PMC1 0x011 /* Performance Monitor Counter 1 */
23#define PMRN_PMC2 0x012 /* Performance Monitor Counter 1 */
24#define PMRN_PMC3 0x013 /* Performance Monitor Counter 1 */
25#define PMRN_PMLCA0 0x090 /* PM Local Control A0 */
26#define PMRN_PMLCA1 0x091 /* PM Local Control A1 */
27#define PMRN_PMLCA2 0x092 /* PM Local Control A2 */
28#define PMRN_PMLCA3 0x093 /* PM Local Control A3 */
29
30#define PMLCA_FC 0x80000000 /* Freeze Counter */
31#define PMLCA_FCS 0x40000000 /* Freeze in Supervisor */
32#define PMLCA_FCU 0x20000000 /* Freeze in User */
33#define PMLCA_FCM1 0x10000000 /* Freeze when PMM==1 */
34#define PMLCA_FCM0 0x08000000 /* Freeze when PMM==0 */
35#define PMLCA_CE 0x04000000 /* Condition Enable */
36
37#define PMLCA_EVENT_MASK 0x007f0000 /* Event field */
38#define PMLCA_EVENT_SHIFT 16
39
40#define PMRN_PMLCB0 0x110 /* PM Local Control B0 */
41#define PMRN_PMLCB1 0x111 /* PM Local Control B1 */
42#define PMRN_PMLCB2 0x112 /* PM Local Control B2 */
43#define PMRN_PMLCB3 0x113 /* PM Local Control B3 */
44
45#define PMLCB_THRESHMUL_MASK 0x0700 /* Threshhold Multiple Field */
46#define PMLCB_THRESHMUL_SHIFT 8
47
48#define PMLCB_THRESHOLD_MASK 0x003f /* Threshold Field */
49#define PMLCB_THRESHOLD_SHIFT 0
50
51#define PMRN_PMGC0 0x190 /* PM Global Control 0 */
52
53#define PMGC0_FAC 0x80000000 /* Freeze all Counters */
54#define PMGC0_PMIE 0x40000000 /* Interrupt Enable */
55#define PMGC0_FCECE 0x20000000 /* Freeze countes on
56 Enabled Condition or
57 Event */
58
59#define PMRN_UPMC0 0x000 /* User Performance Monitor Counter 0 */
60#define PMRN_UPMC1 0x001 /* User Performance Monitor Counter 1 */
61#define PMRN_UPMC2 0x002 /* User Performance Monitor Counter 1 */
62#define PMRN_UPMC3 0x003 /* User Performance Monitor Counter 1 */
63#define PMRN_UPMLCA0 0x080 /* User PM Local Control A0 */
64#define PMRN_UPMLCA1 0x081 /* User PM Local Control A1 */
65#define PMRN_UPMLCA2 0x082 /* User PM Local Control A2 */
66#define PMRN_UPMLCA3 0x083 /* User PM Local Control A3 */
67#define PMRN_UPMLCB0 0x100 /* User PM Local Control B0 */
68#define PMRN_UPMLCB1 0x101 /* User PM Local Control B1 */
69#define PMRN_UPMLCB2 0x102 /* User PM Local Control B2 */
70#define PMRN_UPMLCB3 0x103 /* User PM Local Control B3 */
71#define PMRN_UPMGC0 0x180 /* User PM Global Control 0 */
72
73
74/* Machine State Register (MSR) Fields */ 12/* Machine State Register (MSR) Fields */
75#define MSR_UCLE (1<<26) /* User-mode cache lock enable */ 13#define MSR_UCLE (1<<26) /* User-mode cache lock enable */
76#define MSR_SPE (1<<25) /* Enable SPE */ 14#define MSR_SPE (1<<25) /* Enable SPE */
diff --git a/include/asm-powerpc/reg_fsl_emb.h b/include/asm-powerpc/reg_fsl_emb.h
new file mode 100644
index 000000000000..1e180a594589
--- /dev/null
+++ b/include/asm-powerpc/reg_fsl_emb.h
@@ -0,0 +1,72 @@
1/*
2 * Contains register definitions for the Freescale Embedded Performance
3 * Monitor.
4 */
5#ifdef __KERNEL__
6#ifndef __ASM_POWERPC_REG_FSL_EMB_H__
7#define __ASM_POWERPC_REG_FSL_EMB_H__
8
9#ifndef __ASSEMBLY__
10/* Performance Monitor Registers */
11#define mfpmr(rn) ({unsigned int rval; \
12 asm volatile("mfpmr %0," __stringify(rn) \
13 : "=r" (rval)); rval;})
14#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
15#endif /* __ASSEMBLY__ */
16
17/* Freescale Book E Performance Monitor APU Registers */
18#define PMRN_PMC0 0x010 /* Performance Monitor Counter 0 */
19#define PMRN_PMC1 0x011 /* Performance Monitor Counter 1 */
20#define PMRN_PMC2 0x012 /* Performance Monitor Counter 1 */
21#define PMRN_PMC3 0x013 /* Performance Monitor Counter 1 */
22#define PMRN_PMLCA0 0x090 /* PM Local Control A0 */
23#define PMRN_PMLCA1 0x091 /* PM Local Control A1 */
24#define PMRN_PMLCA2 0x092 /* PM Local Control A2 */
25#define PMRN_PMLCA3 0x093 /* PM Local Control A3 */
26
27#define PMLCA_FC 0x80000000 /* Freeze Counter */
28#define PMLCA_FCS 0x40000000 /* Freeze in Supervisor */
29#define PMLCA_FCU 0x20000000 /* Freeze in User */
30#define PMLCA_FCM1 0x10000000 /* Freeze when PMM==1 */
31#define PMLCA_FCM0 0x08000000 /* Freeze when PMM==0 */
32#define PMLCA_CE 0x04000000 /* Condition Enable */
33
34#define PMLCA_EVENT_MASK 0x007f0000 /* Event field */
35#define PMLCA_EVENT_SHIFT 16
36
37#define PMRN_PMLCB0 0x110 /* PM Local Control B0 */
38#define PMRN_PMLCB1 0x111 /* PM Local Control B1 */
39#define PMRN_PMLCB2 0x112 /* PM Local Control B2 */
40#define PMRN_PMLCB3 0x113 /* PM Local Control B3 */
41
42#define PMLCB_THRESHMUL_MASK 0x0700 /* Threshhold Multiple Field */
43#define PMLCB_THRESHMUL_SHIFT 8
44
45#define PMLCB_THRESHOLD_MASK 0x003f /* Threshold Field */
46#define PMLCB_THRESHOLD_SHIFT 0
47
48#define PMRN_PMGC0 0x190 /* PM Global Control 0 */
49
50#define PMGC0_FAC 0x80000000 /* Freeze all Counters */
51#define PMGC0_PMIE 0x40000000 /* Interrupt Enable */
52#define PMGC0_FCECE 0x20000000 /* Freeze countes on
53 Enabled Condition or
54 Event */
55
56#define PMRN_UPMC0 0x000 /* User Performance Monitor Counter 0 */
57#define PMRN_UPMC1 0x001 /* User Performance Monitor Counter 1 */
58#define PMRN_UPMC2 0x002 /* User Performance Monitor Counter 1 */
59#define PMRN_UPMC3 0x003 /* User Performance Monitor Counter 1 */
60#define PMRN_UPMLCA0 0x080 /* User PM Local Control A0 */
61#define PMRN_UPMLCA1 0x081 /* User PM Local Control A1 */
62#define PMRN_UPMLCA2 0x082 /* User PM Local Control A2 */
63#define PMRN_UPMLCA3 0x083 /* User PM Local Control A3 */
64#define PMRN_UPMLCB0 0x100 /* User PM Local Control B0 */
65#define PMRN_UPMLCB1 0x101 /* User PM Local Control B1 */
66#define PMRN_UPMLCB2 0x102 /* User PM Local Control B2 */
67#define PMRN_UPMLCB3 0x103 /* User PM Local Control B3 */
68#define PMRN_UPMGC0 0x180 /* User PM Global Control 0 */
69
70
71#endif /* __ASM_POWERPC_REG_FSL_EMB_H__ */
72#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index 403e9fde2eb5..f5a4e168e498 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -59,4 +59,6 @@
59#define SO_TIMESTAMPNS 35 59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61 61
62#define SO_MARK 36
63
62#endif /* _ASM_POWERPC_SOCKET_H */ 64#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 0c8b0d679139..e996521fb3a6 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -309,7 +309,7 @@ SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait) 309COMPAT_SYS(epoll_pwait)
310COMPAT_SYS_SPU(utimensat) 310COMPAT_SYS_SPU(utimensat)
311COMPAT_SYS_SPU(signalfd) 311COMPAT_SYS_SPU(signalfd)
312COMPAT_SYS_SPU(timerfd) 312SYSCALL(ni_syscall)
313SYSCALL_SPU(eventfd) 313SYSCALL_SPU(eventfd)
314COMPAT_SYS_SPU(sync_file_range2) 314COMPAT_SYS_SPU(sync_file_range2)
315COMPAT_SYS(fallocate) 315COMPAT_SYS(fallocate)
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 9204c15839c5..56512a968dab 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -66,7 +66,7 @@ extern void __devinit vio_unregister_device(struct vio_dev *dev);
66 66
67struct device_node; 67struct device_node;
68 68
69extern struct vio_dev * __devinit vio_register_device_node( 69extern struct vio_dev *vio_register_device_node(
70 struct device_node *node_vdev); 70 struct device_node *node_vdev);
71extern const void *vio_get_attribute(struct vio_dev *vdev, char *which, 71extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,
72 int *length); 72 int *length);
diff --git a/include/asm-ppc/pgalloc.h b/include/asm-ppc/pgalloc.h
index 44d88a98e87c..7c39a95829c7 100644
--- a/include/asm-ppc/pgalloc.h
+++ b/include/asm-ppc/pgalloc.h
@@ -7,14 +7,14 @@
7extern void __bad_pte(pmd_t *pmd); 7extern void __bad_pte(pmd_t *pmd);
8 8
9extern pgd_t *pgd_alloc(struct mm_struct *mm); 9extern pgd_t *pgd_alloc(struct mm_struct *mm);
10extern void pgd_free(pgd_t *pgd); 10extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
11 11
12/* 12/*
13 * We don't have any real pmd's, and this code never triggers because 13 * We don't have any real pmd's, and this code never triggers because
14 * the pgd will always be present.. 14 * the pgd will always be present..
15 */ 15 */
16#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) 16#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); })
17#define pmd_free(x) do { } while (0) 17#define pmd_free(mm, x) do { } while (0)
18#define __pmd_free_tlb(tlb,x) do { } while (0) 18#define __pmd_free_tlb(tlb,x) do { } while (0)
19#define pgd_populate(mm, pmd, pte) BUG() 19#define pgd_populate(mm, pmd, pte) BUG()
20 20
@@ -32,10 +32,10 @@ extern void pgd_free(pgd_t *pgd);
32 32
33extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 33extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
34extern struct page *pte_alloc_one(struct mm_struct *mm, unsigned long addr); 34extern struct page *pte_alloc_one(struct mm_struct *mm, unsigned long addr);
35extern void pte_free_kernel(pte_t *pte); 35extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte);
36extern void pte_free(struct page *pte); 36extern void pte_free(struct mm_struct *mm, struct page *pte);
37 37
38#define __pte_free_tlb(tlb, pte) pte_free((pte)) 38#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
39 39
40#define check_pgt_cache() do { } while (0) 40#define check_pgt_cache() do { } while (0)
41 41
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index dba6fecad0be..882db054110c 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -440,242 +440,256 @@ __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
440 __test_bit((nr),(addr)) ) 440 __test_bit((nr),(addr)) )
441 441
442/* 442/*
443 * ffz = Find First Zero in word. Undefined if no zero exists, 443 * Optimized find bit helper functions.
444 * so code should check against ~0UL first..
445 */ 444 */
446static inline unsigned long ffz(unsigned long word) 445
446/**
447 * __ffz_word_loop - find byte offset of first long != -1UL
448 * @addr: pointer to array of unsigned long
449 * @size: size of the array in bits
450 */
451static inline unsigned long __ffz_word_loop(const unsigned long *addr,
452 unsigned long size)
447{ 453{
448 unsigned long bit = 0; 454 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
455 unsigned long bytes = 0;
449 456
457 asm volatile(
458#ifndef __s390x__
459 " ahi %1,31\n"
460 " srl %1,5\n"
461 "0: c %2,0(%0,%3)\n"
462 " jne 1f\n"
463 " la %0,4(%0)\n"
464 " brct %1,0b\n"
465 "1:\n"
466#else
467 " aghi %1,63\n"
468 " srlg %1,%1,6\n"
469 "0: cg %2,0(%0,%3)\n"
470 " jne 1f\n"
471 " la %0,8(%0)\n"
472 " brct %1,0b\n"
473 "1:\n"
474#endif
475 : "+a" (bytes), "+d" (size)
476 : "d" (-1UL), "a" (addr), "m" (*(addrtype *) addr)
477 : "cc" );
478 return bytes;
479}
480
481/**
482 * __ffs_word_loop - find byte offset of first long != 0UL
483 * @addr: pointer to array of unsigned long
484 * @size: size of the array in bits
485 */
486static inline unsigned long __ffs_word_loop(const unsigned long *addr,
487 unsigned long size)
488{
489 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
490 unsigned long bytes = 0;
491
492 asm volatile(
493#ifndef __s390x__
494 " ahi %1,31\n"
495 " srl %1,5\n"
496 "0: c %2,0(%0,%3)\n"
497 " jne 1f\n"
498 " la %0,4(%0)\n"
499 " brct %1,0b\n"
500 "1:\n"
501#else
502 " aghi %1,63\n"
503 " srlg %1,%1,6\n"
504 "0: cg %2,0(%0,%3)\n"
505 " jne 1f\n"
506 " la %0,8(%0)\n"
507 " brct %1,0b\n"
508 "1:\n"
509#endif
510 : "+a" (bytes), "+a" (size)
511 : "d" (0UL), "a" (addr), "m" (*(addrtype *) addr)
512 : "cc" );
513 return bytes;
514}
515
516/**
517 * __ffz_word - add number of the first unset bit
518 * @nr: base value the bit number is added to
519 * @word: the word that is searched for unset bits
520 */
521static inline unsigned long __ffz_word(unsigned long nr, unsigned long word)
522{
450#ifdef __s390x__ 523#ifdef __s390x__
451 if (likely((word & 0xffffffff) == 0xffffffff)) { 524 if (likely((word & 0xffffffff) == 0xffffffff)) {
452 word >>= 32; 525 word >>= 32;
453 bit += 32; 526 nr += 32;
454 } 527 }
455#endif 528#endif
456 if (likely((word & 0xffff) == 0xffff)) { 529 if (likely((word & 0xffff) == 0xffff)) {
457 word >>= 16; 530 word >>= 16;
458 bit += 16; 531 nr += 16;
459 } 532 }
460 if (likely((word & 0xff) == 0xff)) { 533 if (likely((word & 0xff) == 0xff)) {
461 word >>= 8; 534 word >>= 8;
462 bit += 8; 535 nr += 8;
463 } 536 }
464 return bit + _zb_findmap[word & 0xff]; 537 return nr + _zb_findmap[(unsigned char) word];
465} 538}
466 539
467/* 540/**
468 * __ffs = find first bit in word. Undefined if no bit exists, 541 * __ffs_word - add number of the first set bit
469 * so code should check against 0UL first.. 542 * @nr: base value the bit number is added to
543 * @word: the word that is searched for set bits
470 */ 544 */
471static inline unsigned long __ffs (unsigned long word) 545static inline unsigned long __ffs_word(unsigned long nr, unsigned long word)
472{ 546{
473 unsigned long bit = 0;
474
475#ifdef __s390x__ 547#ifdef __s390x__
476 if (likely((word & 0xffffffff) == 0)) { 548 if (likely((word & 0xffffffff) == 0)) {
477 word >>= 32; 549 word >>= 32;
478 bit += 32; 550 nr += 32;
479 } 551 }
480#endif 552#endif
481 if (likely((word & 0xffff) == 0)) { 553 if (likely((word & 0xffff) == 0)) {
482 word >>= 16; 554 word >>= 16;
483 bit += 16; 555 nr += 16;
484 } 556 }
485 if (likely((word & 0xff) == 0)) { 557 if (likely((word & 0xff) == 0)) {
486 word >>= 8; 558 word >>= 8;
487 bit += 8; 559 nr += 8;
488 } 560 }
489 return bit + _sb_findmap[word & 0xff]; 561 return nr + _sb_findmap[(unsigned char) word];
490} 562}
491 563
492/*
493 * Find-bit routines..
494 */
495 564
496#ifndef __s390x__ 565/**
566 * __load_ulong_be - load big endian unsigned long
567 * @p: pointer to array of unsigned long
568 * @offset: byte offset of source value in the array
569 */
570static inline unsigned long __load_ulong_be(const unsigned long *p,
571 unsigned long offset)
572{
573 p = (unsigned long *)((unsigned long) p + offset);
574 return *p;
575}
497 576
498static inline int 577/**
499find_first_zero_bit(const unsigned long * addr, unsigned long size) 578 * __load_ulong_le - load little endian unsigned long
579 * @p: pointer to array of unsigned long
580 * @offset: byte offset of source value in the array
581 */
582static inline unsigned long __load_ulong_le(const unsigned long *p,
583 unsigned long offset)
500{ 584{
501 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 585 unsigned long word;
502 unsigned long cmp, count;
503 unsigned int res;
504 586
505 if (!size) 587 p = (unsigned long *)((unsigned long) p + offset);
506 return 0; 588#ifndef __s390x__
507 asm volatile( 589 asm volatile(
508 " lhi %1,-1\n" 590 " ic %0,0(%1)\n"
509 " lr %2,%3\n" 591 " icm %0,2,1(%1)\n"
510 " slr %0,%0\n" 592 " icm %0,4,2(%1)\n"
511 " ahi %2,31\n" 593 " icm %0,8,3(%1)"
512 " srl %2,5\n" 594 : "=&d" (word) : "a" (p), "m" (*p) : "cc");
513 "0: c %1,0(%0,%4)\n" 595#else
514 " jne 1f\n" 596 asm volatile(
515 " la %0,4(%0)\n" 597 " lrvg %0,%1"
516 " brct %2,0b\n" 598 : "=d" (word) : "m" (*p) );
517 " lr %0,%3\n" 599#endif
518 " j 4f\n" 600 return word;
519 "1: l %2,0(%0,%4)\n"
520 " sll %0,3\n"
521 " lhi %1,0xff\n"
522 " tml %2,0xffff\n"
523 " jno 2f\n"
524 " ahi %0,16\n"
525 " srl %2,16\n"
526 "2: tml %2,0x00ff\n"
527 " jno 3f\n"
528 " ahi %0,8\n"
529 " srl %2,8\n"
530 "3: nr %2,%1\n"
531 " ic %2,0(%2,%5)\n"
532 " alr %0,%2\n"
533 "4:"
534 : "=&a" (res), "=&d" (cmp), "=&a" (count)
535 : "a" (size), "a" (addr), "a" (&_zb_findmap),
536 "m" (*(addrtype *) addr) : "cc");
537 return (res < size) ? res : size;
538} 601}
539 602
540static inline int 603/*
541find_first_bit(const unsigned long * addr, unsigned long size) 604 * The various find bit functions.
605 */
606
607/*
608 * ffz - find first zero in word.
609 * @word: The word to search
610 *
611 * Undefined if no zero exists, so code should check against ~0UL first.
612 */
613static inline unsigned long ffz(unsigned long word)
542{ 614{
543 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 615 return __ffz_word(0, word);
544 unsigned long cmp, count; 616}
545 unsigned int res;
546 617
547 if (!size) 618/**
548 return 0; 619 * __ffs - find first bit in word.
549 asm volatile( 620 * @word: The word to search
550 " slr %1,%1\n" 621 *
551 " lr %2,%3\n" 622 * Undefined if no bit exists, so code should check against 0 first.
552 " slr %0,%0\n" 623 */
553 " ahi %2,31\n" 624static inline unsigned long __ffs (unsigned long word)
554 " srl %2,5\n" 625{
555 "0: c %1,0(%0,%4)\n" 626 return __ffs_word(0, word);
556 " jne 1f\n"
557 " la %0,4(%0)\n"
558 " brct %2,0b\n"
559 " lr %0,%3\n"
560 " j 4f\n"
561 "1: l %2,0(%0,%4)\n"
562 " sll %0,3\n"
563 " lhi %1,0xff\n"
564 " tml %2,0xffff\n"
565 " jnz 2f\n"
566 " ahi %0,16\n"
567 " srl %2,16\n"
568 "2: tml %2,0x00ff\n"
569 " jnz 3f\n"
570 " ahi %0,8\n"
571 " srl %2,8\n"
572 "3: nr %2,%1\n"
573 " ic %2,0(%2,%5)\n"
574 " alr %0,%2\n"
575 "4:"
576 : "=&a" (res), "=&d" (cmp), "=&a" (count)
577 : "a" (size), "a" (addr), "a" (&_sb_findmap),
578 "m" (*(addrtype *) addr) : "cc");
579 return (res < size) ? res : size;
580} 627}
581 628
582#else /* __s390x__ */ 629/**
630 * ffs - find first bit set
631 * @x: the word to search
632 *
633 * This is defined the same way as
634 * the libc and compiler builtin ffs routines, therefore
635 * differs in spirit from the above ffz (man ffs).
636 */
637static inline int ffs(int x)
638{
639 if (!x)
640 return 0;
641 return __ffs_word(1, x);
642}
583 643
584static inline unsigned long 644/**
585find_first_zero_bit(const unsigned long * addr, unsigned long size) 645 * find_first_zero_bit - find the first zero bit in a memory region
646 * @addr: The address to start the search at
647 * @size: The maximum size to search
648 *
649 * Returns the bit-number of the first zero bit, not the number of the byte
650 * containing a bit.
651 */
652static inline unsigned long find_first_zero_bit(const unsigned long *addr,
653 unsigned long size)
586{ 654{
587 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 655 unsigned long bytes, bits;
588 unsigned long res, cmp, count;
589 656
590 if (!size) 657 if (!size)
591 return 0; 658 return 0;
592 asm volatile( 659 bytes = __ffz_word_loop(addr, size);
593 " lghi %1,-1\n" 660 bits = __ffz_word(bytes*8, __load_ulong_be(addr, bytes));
594 " lgr %2,%3\n" 661 return (bits < size) ? bits : size;
595 " slgr %0,%0\n" 662}
596 " aghi %2,63\n" 663
597 " srlg %2,%2,6\n" 664/**
598 "0: cg %1,0(%0,%4)\n" 665 * find_first_bit - find the first set bit in a memory region
599 " jne 1f\n" 666 * @addr: The address to start the search at
600 " la %0,8(%0)\n" 667 * @size: The maximum size to search
601 " brct %2,0b\n" 668 *
602 " lgr %0,%3\n" 669 * Returns the bit-number of the first set bit, not the number of the byte
603 " j 5f\n" 670 * containing a bit.
604 "1: lg %2,0(%0,%4)\n" 671 */
605 " sllg %0,%0,3\n" 672static inline unsigned long find_first_bit(const unsigned long * addr,
606 " clr %2,%1\n" 673 unsigned long size)
607 " jne 2f\n"
608 " aghi %0,32\n"
609 " srlg %2,%2,32\n"
610 "2: lghi %1,0xff\n"
611 " tmll %2,0xffff\n"
612 " jno 3f\n"
613 " aghi %0,16\n"
614 " srl %2,16\n"
615 "3: tmll %2,0x00ff\n"
616 " jno 4f\n"
617 " aghi %0,8\n"
618 " srl %2,8\n"
619 "4: ngr %2,%1\n"
620 " ic %2,0(%2,%5)\n"
621 " algr %0,%2\n"
622 "5:"
623 : "=&a" (res), "=&d" (cmp), "=&a" (count)
624 : "a" (size), "a" (addr), "a" (&_zb_findmap),
625 "m" (*(addrtype *) addr) : "cc");
626 return (res < size) ? res : size;
627}
628
629static inline unsigned long
630find_first_bit(const unsigned long * addr, unsigned long size)
631{ 674{
632 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 675 unsigned long bytes, bits;
633 unsigned long res, cmp, count;
634 676
635 if (!size) 677 if (!size)
636 return 0; 678 return 0;
637 asm volatile( 679 bytes = __ffs_word_loop(addr, size);
638 " slgr %1,%1\n" 680 bits = __ffs_word(bytes*8, __load_ulong_be(addr, bytes));
639 " lgr %2,%3\n" 681 return (bits < size) ? bits : size;
640 " slgr %0,%0\n"
641 " aghi %2,63\n"
642 " srlg %2,%2,6\n"
643 "0: cg %1,0(%0,%4)\n"
644 " jne 1f\n"
645 " aghi %0,8\n"
646 " brct %2,0b\n"
647 " lgr %0,%3\n"
648 " j 5f\n"
649 "1: lg %2,0(%0,%4)\n"
650 " sllg %0,%0,3\n"
651 " clr %2,%1\n"
652 " jne 2f\n"
653 " aghi %0,32\n"
654 " srlg %2,%2,32\n"
655 "2: lghi %1,0xff\n"
656 " tmll %2,0xffff\n"
657 " jnz 3f\n"
658 " aghi %0,16\n"
659 " srl %2,16\n"
660 "3: tmll %2,0x00ff\n"
661 " jnz 4f\n"
662 " aghi %0,8\n"
663 " srl %2,8\n"
664 "4: ngr %2,%1\n"
665 " ic %2,0(%2,%5)\n"
666 " algr %0,%2\n"
667 "5:"
668 : "=&a" (res), "=&d" (cmp), "=&a" (count)
669 : "a" (size), "a" (addr), "a" (&_sb_findmap),
670 "m" (*(addrtype *) addr) : "cc");
671 return (res < size) ? res : size;
672} 682}
673 683
674#endif /* __s390x__ */ 684/**
675 685 * find_next_zero_bit - find the first zero bit in a memory region
676static inline int 686 * @addr: The address to base the search on
677find_next_zero_bit (const unsigned long * addr, unsigned long size, 687 * @offset: The bitnumber to start searching at
678 unsigned long offset) 688 * @size: The maximum size to search
689 */
690static inline int find_next_zero_bit (const unsigned long * addr,
691 unsigned long size,
692 unsigned long offset)
679{ 693{
680 const unsigned long *p; 694 const unsigned long *p;
681 unsigned long bit, set; 695 unsigned long bit, set;
@@ -688,10 +702,10 @@ find_next_zero_bit (const unsigned long * addr, unsigned long size,
688 p = addr + offset / __BITOPS_WORDSIZE; 702 p = addr + offset / __BITOPS_WORDSIZE;
689 if (bit) { 703 if (bit) {
690 /* 704 /*
691 * s390 version of ffz returns __BITOPS_WORDSIZE 705 * __ffz_word returns __BITOPS_WORDSIZE
692 * if no zero bit is present in the word. 706 * if no zero bit is present in the word.
693 */ 707 */
694 set = ffz(*p >> bit) + bit; 708 set = __ffz_word(0, *p >> bit) + bit;
695 if (set >= size) 709 if (set >= size)
696 return size + offset; 710 return size + offset;
697 if (set < __BITOPS_WORDSIZE) 711 if (set < __BITOPS_WORDSIZE)
@@ -703,9 +717,15 @@ find_next_zero_bit (const unsigned long * addr, unsigned long size,
703 return offset + find_first_zero_bit(p, size); 717 return offset + find_first_zero_bit(p, size);
704} 718}
705 719
706static inline int 720/**
707find_next_bit (const unsigned long * addr, unsigned long size, 721 * find_next_bit - find the first set bit in a memory region
708 unsigned long offset) 722 * @addr: The address to base the search on
723 * @offset: The bitnumber to start searching at
724 * @size: The maximum size to search
725 */
726static inline int find_next_bit (const unsigned long * addr,
727 unsigned long size,
728 unsigned long offset)
709{ 729{
710 const unsigned long *p; 730 const unsigned long *p;
711 unsigned long bit, set; 731 unsigned long bit, set;
@@ -718,10 +738,10 @@ find_next_bit (const unsigned long * addr, unsigned long size,
718 p = addr + offset / __BITOPS_WORDSIZE; 738 p = addr + offset / __BITOPS_WORDSIZE;
719 if (bit) { 739 if (bit) {
720 /* 740 /*
721 * s390 version of __ffs returns __BITOPS_WORDSIZE 741 * __ffs_word returns __BITOPS_WORDSIZE
722 * if no one bit is present in the word. 742 * if no one bit is present in the word.
723 */ 743 */
724 set = __ffs(*p & (~0UL << bit)); 744 set = __ffs_word(0, *p & (~0UL << bit));
725 if (set >= size) 745 if (set >= size)
726 return size + offset; 746 return size + offset;
727 if (set < __BITOPS_WORDSIZE) 747 if (set < __BITOPS_WORDSIZE)
@@ -744,8 +764,6 @@ static inline int sched_find_first_bit(unsigned long *b)
744 return find_first_bit(b, 140); 764 return find_first_bit(b, 140);
745} 765}
746 766
747#include <asm-generic/bitops/ffs.h>
748
749#include <asm-generic/bitops/fls.h> 767#include <asm-generic/bitops/fls.h>
750#include <asm-generic/bitops/fls64.h> 768#include <asm-generic/bitops/fls64.h>
751 769
@@ -772,108 +790,23 @@ static inline int sched_find_first_bit(unsigned long *b)
772 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 790 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
773#define ext2_test_bit(nr, addr) \ 791#define ext2_test_bit(nr, addr) \
774 test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 792 test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
775#define ext2_find_next_bit(addr, size, off) \
776 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
777 793
778#ifndef __s390x__ 794static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size)
779
780static inline int
781ext2_find_first_zero_bit(void *vaddr, unsigned int size)
782{ 795{
783 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 796 unsigned long bytes, bits;
784 unsigned long cmp, count;
785 unsigned int res;
786 797
787 if (!size) 798 if (!size)
788 return 0; 799 return 0;
789 asm volatile( 800 bytes = __ffz_word_loop(vaddr, size);
790 " lhi %1,-1\n" 801 bits = __ffz_word(bytes*8, __load_ulong_le(vaddr, bytes));
791 " lr %2,%3\n" 802 return (bits < size) ? bits : size;
792 " ahi %2,31\n"
793 " srl %2,5\n"
794 " slr %0,%0\n"
795 "0: cl %1,0(%0,%4)\n"
796 " jne 1f\n"
797 " ahi %0,4\n"
798 " brct %2,0b\n"
799 " lr %0,%3\n"
800 " j 4f\n"
801 "1: l %2,0(%0,%4)\n"
802 " sll %0,3\n"
803 " ahi %0,24\n"
804 " lhi %1,0xff\n"
805 " tmh %2,0xffff\n"
806 " jo 2f\n"
807 " ahi %0,-16\n"
808 " srl %2,16\n"
809 "2: tml %2,0xff00\n"
810 " jo 3f\n"
811 " ahi %0,-8\n"
812 " srl %2,8\n"
813 "3: nr %2,%1\n"
814 " ic %2,0(%2,%5)\n"
815 " alr %0,%2\n"
816 "4:"
817 : "=&a" (res), "=&d" (cmp), "=&a" (count)
818 : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
819 "m" (*(addrtype *) vaddr) : "cc");
820 return (res < size) ? res : size;
821} 803}
822 804
823#else /* __s390x__ */ 805static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
824 806 unsigned long offset)
825static inline unsigned long
826ext2_find_first_zero_bit(void *vaddr, unsigned long size)
827{
828 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
829 unsigned long res, cmp, count;
830
831 if (!size)
832 return 0;
833 asm volatile(
834 " lghi %1,-1\n"
835 " lgr %2,%3\n"
836 " aghi %2,63\n"
837 " srlg %2,%2,6\n"
838 " slgr %0,%0\n"
839 "0: clg %1,0(%0,%4)\n"
840 " jne 1f\n"
841 " aghi %0,8\n"
842 " brct %2,0b\n"
843 " lgr %0,%3\n"
844 " j 5f\n"
845 "1: cl %1,0(%0,%4)\n"
846 " jne 2f\n"
847 " aghi %0,4\n"
848 "2: l %2,0(%0,%4)\n"
849 " sllg %0,%0,3\n"
850 " aghi %0,24\n"
851 " lghi %1,0xff\n"
852 " tmlh %2,0xffff\n"
853 " jo 3f\n"
854 " aghi %0,-16\n"
855 " srl %2,16\n"
856 "3: tmll %2,0xff00\n"
857 " jo 4f\n"
858 " aghi %0,-8\n"
859 " srl %2,8\n"
860 "4: ngr %2,%1\n"
861 " ic %2,0(%2,%5)\n"
862 " algr %0,%2\n"
863 "5:"
864 : "=&a" (res), "=&d" (cmp), "=&a" (count)
865 : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
866 "m" (*(addrtype *) vaddr) : "cc");
867 return (res < size) ? res : size;
868}
869
870#endif /* __s390x__ */
871
872static inline int
873ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
874{ 807{
875 unsigned long *addr = vaddr, *p; 808 unsigned long *addr = vaddr, *p;
876 unsigned long word, bit, set; 809 unsigned long bit, set;
877 810
878 if (offset >= size) 811 if (offset >= size)
879 return size; 812 return size;
@@ -882,23 +815,11 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
882 size -= offset; 815 size -= offset;
883 p = addr + offset / __BITOPS_WORDSIZE; 816 p = addr + offset / __BITOPS_WORDSIZE;
884 if (bit) { 817 if (bit) {
885#ifndef __s390x__
886 asm volatile(
887 " ic %0,0(%1)\n"
888 " icm %0,2,1(%1)\n"
889 " icm %0,4,2(%1)\n"
890 " icm %0,8,3(%1)"
891 : "=&a" (word) : "a" (p), "m" (*p) : "cc");
892#else
893 asm volatile(
894 " lrvg %0,%1"
895 : "=a" (word) : "m" (*p) );
896#endif
897 /* 818 /*
898 * s390 version of ffz returns __BITOPS_WORDSIZE 819 * s390 version of ffz returns __BITOPS_WORDSIZE
899 * if no zero bit is present in the word. 820 * if no zero bit is present in the word.
900 */ 821 */
901 set = ffz(word >> bit) + bit; 822 set = ffz(__load_ulong_le(p, 0) >> bit) + bit;
902 if (set >= size) 823 if (set >= size)
903 return size + offset; 824 return size + offset;
904 if (set < __BITOPS_WORDSIZE) 825 if (set < __BITOPS_WORDSIZE)
@@ -910,6 +831,47 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
910 return offset + ext2_find_first_zero_bit(p, size); 831 return offset + ext2_find_first_zero_bit(p, size);
911} 832}
912 833
834static inline unsigned long ext2_find_first_bit(void *vaddr,
835 unsigned long size)
836{
837 unsigned long bytes, bits;
838
839 if (!size)
840 return 0;
841 bytes = __ffs_word_loop(vaddr, size);
842 bits = __ffs_word(bytes*8, __load_ulong_le(vaddr, bytes));
843 return (bits < size) ? bits : size;
844}
845
846static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
847 unsigned long offset)
848{
849 unsigned long *addr = vaddr, *p;
850 unsigned long bit, set;
851
852 if (offset >= size)
853 return size;
854 bit = offset & (__BITOPS_WORDSIZE - 1);
855 offset -= bit;
856 size -= offset;
857 p = addr + offset / __BITOPS_WORDSIZE;
858 if (bit) {
859 /*
860 * s390 version of ffz returns __BITOPS_WORDSIZE
861 * if no zero bit is present in the word.
862 */
863 set = ffs(__load_ulong_le(p, 0) >> bit) + bit;
864 if (set >= size)
865 return size + offset;
866 if (set < __BITOPS_WORDSIZE)
867 return set + offset;
868 offset += __BITOPS_WORDSIZE;
869 size -= __BITOPS_WORDSIZE;
870 p++;
871 }
872 return offset + ext2_find_first_bit(p, size);
873}
874
913#include <asm-generic/bitops/minix.h> 875#include <asm-generic/bitops/minix.h>
914 876
915#endif /* __KERNEL__ */ 877#endif /* __KERNEL__ */
diff --git a/include/asm-s390/cacheflush.h b/include/asm-s390/cacheflush.h
index f7cade8083f3..49d5af916d01 100644
--- a/include/asm-s390/cacheflush.h
+++ b/include/asm-s390/cacheflush.h
@@ -24,4 +24,8 @@
24#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 24#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
25 memcpy(dst, src, len) 25 memcpy(dst, src, len)
26 26
27#ifdef CONFIG_DEBUG_PAGEALLOC
28void kernel_map_pages(struct page *page, int numpages, int enable);
29#endif
30
27#endif /* _S390_CACHEFLUSH_H */ 31#endif /* _S390_CACHEFLUSH_H */
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index 7109c7cab87e..289053ef5e60 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -37,6 +37,7 @@ struct ccwgroup_device {
37 * @remove: function called on remove 37 * @remove: function called on remove
38 * @set_online: function called when device is set online 38 * @set_online: function called when device is set online
39 * @set_offline: function called when device is set offline 39 * @set_offline: function called when device is set offline
40 * @shutdown: function called when device is shut down
40 * @driver: embedded driver structure 41 * @driver: embedded driver structure
41 */ 42 */
42struct ccwgroup_driver { 43struct ccwgroup_driver {
@@ -49,6 +50,7 @@ struct ccwgroup_driver {
49 void (*remove) (struct ccwgroup_device *); 50 void (*remove) (struct ccwgroup_device *);
50 int (*set_online) (struct ccwgroup_device *); 51 int (*set_online) (struct ccwgroup_device *);
51 int (*set_offline) (struct ccwgroup_device *); 52 int (*set_offline) (struct ccwgroup_device *);
53 void (*shutdown)(struct ccwgroup_device *);
52 54
53 struct device_driver driver; 55 struct device_driver driver;
54}; 56};
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h
index 7f4ad623f7d5..de065b32381a 100644
--- a/include/asm-s390/compat.h
+++ b/include/asm-s390/compat.h
@@ -149,7 +149,7 @@ typedef u32 compat_sigset_word;
149 * A pointer passed in from user mode. This should not 149 * A pointer passed in from user mode. This should not
150 * be used for syscall parameters, just declare them 150 * be used for syscall parameters, just declare them
151 * as pointers because the syscall entry code will have 151 * as pointers because the syscall entry code will have
152 * appropriately comverted them already. 152 * appropriately converted them already.
153 */ 153 */
154typedef u32 compat_uptr_t; 154typedef u32 compat_uptr_t;
155 155
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 2d676a873858..408d60b4f75b 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -13,49 +13,25 @@
13 */ 13 */
14#if defined(__s390x__) && defined(MODULE) 14#if defined(__s390x__) && defined(MODULE)
15 15
16#define __reloc_hide(var,offset) (*({ \ 16#define SHIFT_PERCPU_PTR(ptr,offset) (({ \
17 extern int simple_identifier_##var(void); \ 17 extern int simple_identifier_##var(void); \
18 unsigned long *__ptr; \ 18 unsigned long *__ptr; \
19 asm ( "larl %0,per_cpu__"#var"@GOTENT" \ 19 asm ( "larl %0, %1@GOTENT" \
20 : "=a" (__ptr) : "X" (per_cpu__##var) ); \ 20 : "=a" (__ptr) : "X" (ptr) ); \
21 (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) 21 (typeof(ptr))((*__ptr) + (offset)); }))
22 22
23#else 23#else
24 24
25#define __reloc_hide(var, offset) (*({ \ 25#define SHIFT_PERCPU_PTR(ptr, offset) (({ \
26 extern int simple_identifier_##var(void); \ 26 extern int simple_identifier_##var(void); \
27 unsigned long __ptr; \ 27 unsigned long __ptr; \
28 asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ 28 asm ( "" : "=a" (__ptr) : "0" (ptr) ); \
29 (typeof(&per_cpu__##var)) (__ptr + (offset)); })) 29 (typeof(ptr)) (__ptr + (offset)); }))
30 30
31#endif 31#endif
32 32
33#ifdef CONFIG_SMP 33#define __my_cpu_offset S390_lowcore.percpu_offset
34 34
35extern unsigned long __per_cpu_offset[NR_CPUS]; 35#include <asm-generic/percpu.h>
36
37#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
38#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
39#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
40#define per_cpu_offset(x) (__per_cpu_offset[x])
41
42/* A macro to avoid #include hell... */
43#define percpu_modcopy(pcpudst, src, size) \
44do { \
45 unsigned int __i; \
46 for_each_possible_cpu(__i) \
47 memcpy((pcpudst)+__per_cpu_offset[__i], \
48 (src), (size)); \
49} while (0)
50
51#else /* ! SMP */
52
53#define __get_cpu_var(var) __reloc_hide(var,0)
54#define __raw_get_cpu_var(var) __reloc_hide(var,0)
55#define per_cpu(var,cpu) __reloc_hide(var,0)
56
57#endif /* SMP */
58
59#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
60 36
61#endif /* __ARCH_S390_PERCPU__ */ 37#endif /* __ARCH_S390_PERCPU__ */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 709dd1740956..6f6619ba8980 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -57,10 +57,10 @@ static inline unsigned long pgd_entry_type(struct mm_struct *mm)
57} 57}
58 58
59#define pud_alloc_one(mm,address) ({ BUG(); ((pud_t *)2); }) 59#define pud_alloc_one(mm,address) ({ BUG(); ((pud_t *)2); })
60#define pud_free(x) do { } while (0) 60#define pud_free(mm, x) do { } while (0)
61 61
62#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) 62#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); })
63#define pmd_free(x) do { } while (0) 63#define pmd_free(mm, x) do { } while (0)
64 64
65#define pgd_populate(mm, pgd, pud) BUG() 65#define pgd_populate(mm, pgd, pud) BUG()
66#define pgd_populate_kernel(mm, pgd, pud) BUG() 66#define pgd_populate_kernel(mm, pgd, pud) BUG()
@@ -76,7 +76,7 @@ static inline unsigned long pgd_entry_type(struct mm_struct *mm)
76} 76}
77 77
78#define pud_alloc_one(mm,address) ({ BUG(); ((pud_t *)2); }) 78#define pud_alloc_one(mm,address) ({ BUG(); ((pud_t *)2); })
79#define pud_free(x) do { } while (0) 79#define pud_free(mm, x) do { } while (0)
80 80
81static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) 81static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
82{ 82{
@@ -85,7 +85,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
85 crst_table_init(crst, _SEGMENT_ENTRY_EMPTY); 85 crst_table_init(crst, _SEGMENT_ENTRY_EMPTY);
86 return (pmd_t *) crst; 86 return (pmd_t *) crst;
87} 87}
88#define pmd_free(pmd) crst_table_free((unsigned long *) pmd) 88#define pmd_free(mm, pmd) crst_table_free((unsigned long *)pmd)
89 89
90#define pgd_populate(mm, pgd, pud) BUG() 90#define pgd_populate(mm, pgd, pud) BUG()
91#define pgd_populate_kernel(mm, pgd, pud) BUG() 91#define pgd_populate_kernel(mm, pgd, pud) BUG()
@@ -115,7 +115,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
115 crst_table_init(crst, pgd_entry_type(mm)); 115 crst_table_init(crst, pgd_entry_type(mm));
116 return (pgd_t *) crst; 116 return (pgd_t *) crst;
117} 117}
118#define pgd_free(pgd) crst_table_free((unsigned long *) pgd) 118#define pgd_free(mm, pgd) crst_table_free((unsigned long *) pgd)
119 119
120static inline void 120static inline void
121pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) 121pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
@@ -151,9 +151,9 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
151#define pte_alloc_one(mm, vmaddr) \ 151#define pte_alloc_one(mm, vmaddr) \
152 virt_to_page(page_table_alloc(s390_noexec)) 152 virt_to_page(page_table_alloc(s390_noexec))
153 153
154#define pte_free_kernel(pte) \ 154#define pte_free_kernel(mm, pte) \
155 page_table_free((unsigned long *) pte) 155 page_table_free((unsigned long *) pte)
156#define pte_free(pte) \ 156#define pte_free(mm, pte) \
157 page_table_free((unsigned long *) page_to_phys((struct page *) pte)) 157 page_table_free((unsigned long *) page_to_phys((struct page *) pte))
158 158
159#endif /* _S390_PGALLOC_H */ 159#endif /* _S390_PGALLOC_H */
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 79b9eab1a0c7..3f520754e71c 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -115,15 +115,21 @@ extern char empty_zero_page[PAGE_SIZE];
115#ifndef __s390x__ 115#ifndef __s390x__
116#define VMALLOC_START 0x78000000UL 116#define VMALLOC_START 0x78000000UL
117#define VMALLOC_END 0x7e000000UL 117#define VMALLOC_END 0x7e000000UL
118#define VMEM_MAP_MAX 0x80000000UL 118#define VMEM_MAP_END 0x80000000UL
119#else /* __s390x__ */ 119#else /* __s390x__ */
120#define VMALLOC_START 0x3e000000000UL 120#define VMALLOC_START 0x3e000000000UL
121#define VMALLOC_END 0x3e040000000UL 121#define VMALLOC_END 0x3e040000000UL
122#define VMEM_MAP_MAX 0x40000000000UL 122#define VMEM_MAP_END 0x40000000000UL
123#endif /* __s390x__ */ 123#endif /* __s390x__ */
124 124
125/*
126 * VMEM_MAX_PHYS is the highest physical address that can be added to the 1:1
127 * mapping. This needs to be calculated at compile time since the size of the
128 * VMEM_MAP is static but the size of struct page can change.
129 */
130#define VMEM_MAX_PHYS min(VMALLOC_START, ((VMEM_MAP_END - VMALLOC_END) / \
131 sizeof(struct page) * PAGE_SIZE) & ~((16 << 20) - 1))
125#define VMEM_MAP ((struct page *) VMALLOC_END) 132#define VMEM_MAP ((struct page *) VMALLOC_END)
126#define VMEM_MAP_SIZE ((VMALLOC_START / PAGE_SIZE) * sizeof(struct page))
127 133
128/* 134/*
129 * A 31 bit pagetable entry of S390 has following format: 135 * A 31 bit pagetable entry of S390 has following format:
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index c86b982aef5a..4f744609cd11 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -70,8 +70,9 @@ extern int get_cpu_capability(unsigned int *);
70 70
71#else /* __s390x__ */ 71#else /* __s390x__ */
72 72
73# define TASK_SIZE (test_thread_flag(TIF_31BIT) ? \ 73# define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_31BIT) ? \
74 (0x80000000UL) : (0x40000000000UL)) 74 (0x80000000UL) : (0x40000000000UL))
75# define TASK_SIZE TASK_SIZE_OF(current)
75# define TASK_UNMAPPED_BASE (TASK_SIZE / 2) 76# define TASK_UNMAPPED_BASE (TASK_SIZE / 2)
76# define DEFAULT_TASK_SIZE (0x40000000000UL) 77# define DEFAULT_TASK_SIZE (0x40000000000UL)
77 78
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 1161ebe3dec9..c786ab623b2d 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -60,4 +60,6 @@
60#define SO_TIMESTAMPNS 35 60#define SO_TIMESTAMPNS 35
61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
62 62
63#define SO_MARK 36
64
63#endif /* _ASM_SOCKET_H */ 65#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-s390/tlb.h b/include/asm-s390/tlb.h
index 618693cfc10f..985de2b88279 100644
--- a/include/asm-s390/tlb.h
+++ b/include/asm-s390/tlb.h
@@ -65,9 +65,9 @@ static inline void tlb_flush_mmu(struct mmu_gather *tlb,
65 if (!tlb->fullmm && (tlb->nr_ptes > 0 || tlb->nr_pmds < TLB_NR_PTRS)) 65 if (!tlb->fullmm && (tlb->nr_ptes > 0 || tlb->nr_pmds < TLB_NR_PTRS))
66 __tlb_flush_mm(tlb->mm); 66 __tlb_flush_mm(tlb->mm);
67 while (tlb->nr_ptes > 0) 67 while (tlb->nr_ptes > 0)
68 pte_free(tlb->array[--tlb->nr_ptes]); 68 pte_free(tlb->mm, tlb->array[--tlb->nr_ptes]);
69 while (tlb->nr_pmds < TLB_NR_PTRS) 69 while (tlb->nr_pmds < TLB_NR_PTRS)
70 pmd_free((pmd_t *) tlb->array[tlb->nr_pmds++]); 70 pmd_free(tlb->mm, (pmd_t *) tlb->array[tlb->nr_pmds++]);
71} 71}
72 72
73static inline void tlb_finish_mmu(struct mmu_gather *tlb, 73static inline void tlb_finish_mmu(struct mmu_gather *tlb,
@@ -102,7 +102,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, struct page *page)
102 if (tlb->nr_ptes >= tlb->nr_pmds) 102 if (tlb->nr_ptes >= tlb->nr_pmds)
103 tlb_flush_mmu(tlb, 0, 0); 103 tlb_flush_mmu(tlb, 0, 0);
104 } else 104 } else
105 pte_free(page); 105 pte_free(tlb->mm, page);
106} 106}
107 107
108/* 108/*
@@ -117,7 +117,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
117 if (tlb->nr_ptes >= tlb->nr_pmds) 117 if (tlb->nr_ptes >= tlb->nr_pmds)
118 tlb_flush_mmu(tlb, 0, 0); 118 tlb_flush_mmu(tlb, 0, 0);
119 } else 119 } else
120 pmd_free(pmd); 120 pmd_free(tlb->mm, pmd);
121#endif 121#endif
122} 122}
123 123
diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h
index 18b613c57cf5..59ca16d77a1d 100644
--- a/include/asm-sh/pgalloc.h
+++ b/include/asm-sh/pgalloc.h
@@ -36,7 +36,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
36 return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor); 36 return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor);
37} 37}
38 38
39static inline void pgd_free(pgd_t *pgd) 39static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
40{ 40{
41 quicklist_free(QUICK_PGD, NULL, pgd); 41 quicklist_free(QUICK_PGD, NULL, pgd);
42} 42}
@@ -54,12 +54,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
54 return pg ? virt_to_page(pg) : NULL; 54 return pg ? virt_to_page(pg) : NULL;
55} 55}
56 56
57static inline void pte_free_kernel(pte_t *pte) 57static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
58{ 58{
59 quicklist_free(QUICK_PT, NULL, pte); 59 quicklist_free(QUICK_PT, NULL, pte);
60} 60}
61 61
62static inline void pte_free(struct page *pte) 62static inline void pte_free(struct mm_struct *mm, struct page *pte)
63{ 63{
64 quicklist_free_page(QUICK_PT, NULL, pte); 64 quicklist_free_page(QUICK_PT, NULL, pte);
65} 65}
@@ -71,7 +71,7 @@ static inline void pte_free(struct page *pte)
71 * inside the pgd, so has no extra memory associated with it. 71 * inside the pgd, so has no extra memory associated with it.
72 */ 72 */
73 73
74#define pmd_free(x) do { } while (0) 74#define pmd_free(mm, x) do { } while (0)
75#define __pmd_free_tlb(tlb,x) do { } while (0) 75#define __pmd_free_tlb(tlb,x) do { } while (0)
76 76
77static inline void check_pgt_cache(void) 77static inline void check_pgt_cache(void)
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
index c48d6fc9da38..6d4bf6512959 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* __ASM_SH_SOCKET_H */ 57#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sh/unistd_32.h b/include/asm-sh/unistd_32.h
index b182b1cb05fd..433fd1b48fa2 100644
--- a/include/asm-sh/unistd_32.h
+++ b/include/asm-sh/unistd_32.h
@@ -330,7 +330,7 @@
330#define __NR_epoll_pwait 319 330#define __NR_epoll_pwait 319
331#define __NR_utimensat 320 331#define __NR_utimensat 320
332#define __NR_signalfd 321 332#define __NR_signalfd 321
333#define __NR_timerfd 322 333/* #define __NR_timerfd 322 removed */
334#define __NR_eventfd 323 334#define __NR_eventfd 323
335#define __NR_fallocate 324 335#define __NR_fallocate 324
336 336
diff --git a/include/asm-sh/unistd_64.h b/include/asm-sh/unistd_64.h
index 944511882cac..108d2ba897fe 100644
--- a/include/asm-sh/unistd_64.h
+++ b/include/asm-sh/unistd_64.h
@@ -370,7 +370,7 @@
370#define __NR_epoll_pwait 347 370#define __NR_epoll_pwait 347
371#define __NR_utimensat 348 371#define __NR_utimensat 348
372#define __NR_signalfd 349 372#define __NR_signalfd 349
373#define __NR_timerfd 350 373/* #define __NR_timerfd 350 removed */
374#define __NR_eventfd 351 374#define __NR_eventfd 351
375#define __NR_fallocate 352 375#define __NR_fallocate 352
376 376
diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h
index a449cd4912d1..b5fbdd36447f 100644
--- a/include/asm-sparc/pgalloc.h
+++ b/include/asm-sparc/pgalloc.h
@@ -32,7 +32,7 @@ BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void)
32BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) 32BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *)
33#define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd) 33#define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd)
34 34
35#define pgd_free(pgd) free_pgd_fast(pgd) 35#define pgd_free(mm, pgd) free_pgd_fast(pgd)
36#define pgd_alloc(mm) get_pgd_fast() 36#define pgd_alloc(mm) get_pgd_fast()
37 37
38BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) 38BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *)
@@ -45,8 +45,8 @@ BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long)
45BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *) 45BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *)
46#define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd) 46#define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd)
47 47
48#define pmd_free(pmd) free_pmd_fast(pmd) 48#define pmd_free(mm, pmd) free_pmd_fast(pmd)
49#define __pmd_free_tlb(tlb, pmd) pmd_free(pmd) 49#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
50 50
51BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *) 51BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *)
52#define pmd_populate(MM, PMD, PTE) BTFIXUP_CALL(pmd_populate)(PMD, PTE) 52#define pmd_populate(MM, PMD, PTE) BTFIXUP_CALL(pmd_populate)(PMD, PTE)
@@ -59,10 +59,10 @@ BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long
59#define pte_alloc_one_kernel(mm, addr) BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr) 59#define pte_alloc_one_kernel(mm, addr) BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr)
60 60
61BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *) 61BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *)
62#define pte_free_kernel(pte) BTFIXUP_CALL(free_pte_fast)(pte) 62#define pte_free_kernel(mm, pte) BTFIXUP_CALL(free_pte_fast)(pte)
63 63
64BTFIXUPDEF_CALL(void, pte_free, struct page *) 64BTFIXUPDEF_CALL(void, pte_free, struct page *)
65#define pte_free(pte) BTFIXUP_CALL(pte_free)(pte) 65#define pte_free(mm, pte) BTFIXUP_CALL(pte_free)(pte)
66#define __pte_free_tlb(tlb, pte) pte_free(pte) 66#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
67 67
68#endif /* _SPARC_PGALLOC_H */ 68#endif /* _SPARC_PGALLOC_H */
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index 7c1423997cf0..2e2bd0b7c8e3 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -52,6 +52,8 @@
52#define SO_TIMESTAMPNS 0x0021 52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 0x0022
56
55/* Security levels - as per NRL IPv6 - don't actually do anything */ 57/* Security levels - as per NRL IPv6 - don't actually do anything */
56#define SO_SECURITY_AUTHENTICATION 0x5001 58#define SO_SECURITY_AUTHENTICATION 0x5001
57#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 59#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
index 01fe6682b405..f260b58f5ce9 100644
--- a/include/asm-sparc64/compat.h
+++ b/include/asm-sparc64/compat.h
@@ -152,7 +152,7 @@ typedef u32 compat_sigset_word;
152 * A pointer passed in from user mode. This should not 152 * A pointer passed in from user mode. This should not
153 * be used for syscall parameters, just declare them 153 * be used for syscall parameters, just declare them
154 * as pointers because the syscall entry code will have 154 * as pointers because the syscall entry code will have
155 * appropriately comverted them already. 155 * appropriately converted them already.
156 */ 156 */
157typedef u32 compat_uptr_t; 157typedef u32 compat_uptr_t;
158 158
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index c7e52decba98..bee64593023e 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -7,7 +7,6 @@ register unsigned long __local_per_cpu_offset asm("g5");
7 7
8#ifdef CONFIG_SMP 8#ifdef CONFIG_SMP
9 9
10#define setup_per_cpu_areas() do { } while (0)
11extern void real_setup_per_cpu_areas(void); 10extern void real_setup_per_cpu_areas(void);
12 11
13extern unsigned long __per_cpu_base; 12extern unsigned long __per_cpu_base;
@@ -16,29 +15,14 @@ extern unsigned long __per_cpu_shift;
16 (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift)) 15 (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift))
17#define per_cpu_offset(x) (__per_cpu_offset(x)) 16#define per_cpu_offset(x) (__per_cpu_offset(x))
18 17
19/* var is in discarded region: offset to particular copy we want */ 18#define __my_cpu_offset __local_per_cpu_offset
20#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 19
21#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
22#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
23
24/* A macro to avoid #include hell... */
25#define percpu_modcopy(pcpudst, src, size) \
26do { \
27 unsigned int __i; \
28 for_each_possible_cpu(__i) \
29 memcpy((pcpudst)+__per_cpu_offset(__i), \
30 (src), (size)); \
31} while (0)
32#else /* ! SMP */ 20#else /* ! SMP */
33 21
34#define real_setup_per_cpu_areas() do { } while (0) 22#define real_setup_per_cpu_areas() do { } while (0)
35 23
36#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
37#define __get_cpu_var(var) per_cpu__##var
38#define __raw_get_cpu_var(var) per_cpu__##var
39
40#endif /* SMP */ 24#endif /* SMP */
41 25
42#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 26#include <asm-generic/percpu.h>
43 27
44#endif /* __ARCH_SPARC64_PERCPU__ */ 28#endif /* __ARCH_SPARC64_PERCPU__ */
diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
index 5d66b858a965..b48f73c2274e 100644
--- a/include/asm-sparc64/pgalloc.h
+++ b/include/asm-sparc64/pgalloc.h
@@ -20,7 +20,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
20 return quicklist_alloc(0, GFP_KERNEL, NULL); 20 return quicklist_alloc(0, GFP_KERNEL, NULL);
21} 21}
22 22
23static inline void pgd_free(pgd_t *pgd) 23static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
24{ 24{
25 quicklist_free(0, NULL, pgd); 25 quicklist_free(0, NULL, pgd);
26} 26}
@@ -32,7 +32,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
32 return quicklist_alloc(0, GFP_KERNEL, NULL); 32 return quicklist_alloc(0, GFP_KERNEL, NULL);
33} 33}
34 34
35static inline void pmd_free(pmd_t *pmd) 35static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
36{ 36{
37 quicklist_free(0, NULL, pmd); 37 quicklist_free(0, NULL, pmd);
38} 38}
@@ -50,12 +50,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
50 return pg ? virt_to_page(pg) : NULL; 50 return pg ? virt_to_page(pg) : NULL;
51} 51}
52 52
53static inline void pte_free_kernel(pte_t *pte) 53static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
54{ 54{
55 quicklist_free(0, NULL, pte); 55 quicklist_free(0, NULL, pte);
56} 56}
57 57
58static inline void pte_free(struct page *ptepage) 58static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
59{ 59{
60 quicklist_free_page(0, NULL, ptepage); 60 quicklist_free_page(0, NULL, ptepage);
61} 61}
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 986441dcb8f0..44a625af6e31 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -57,4 +57,5 @@
57#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 57#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
58#define SO_SECURITY_ENCRYPTION_NETWORK 0x5004 58#define SO_SECURITY_ENCRYPTION_NETWORK 0x5004
59 59
60#define SO_MARK 0x0022
60#endif /* _ASM_SOCKET_H */ 61#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h
index 349d1d3e9c27..ec81cdedef2c 100644
--- a/include/asm-sparc64/tlb.h
+++ b/include/asm-sparc64/tlb.h
@@ -100,8 +100,8 @@ static inline void tlb_remove_page(struct mmu_gather *mp, struct page *page)
100} 100}
101 101
102#define tlb_remove_tlb_entry(mp,ptep,addr) do { } while (0) 102#define tlb_remove_tlb_entry(mp,ptep,addr) do { } while (0)
103#define pte_free_tlb(mp,ptepage) pte_free(ptepage) 103#define pte_free_tlb(mp, ptepage) pte_free((mp)->mm, ptepage)
104#define pmd_free_tlb(mp,pmdp) pmd_free(pmdp) 104#define pmd_free_tlb(mp, pmdp) pmd_free((mp)->mm, pmdp)
105#define pud_free_tlb(tlb,pudp) __pud_free_tlb(tlb,pudp) 105#define pud_free_tlb(tlb,pudp) __pud_free_tlb(tlb,pudp)
106 106
107#define tlb_migrate_finish(mm) do { } while (0) 107#define tlb_migrate_finish(mm) do { } while (0)
diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h
index 9281dd8eb334..f42ff14577fa 100644
--- a/include/asm-um/a.out.h
+++ b/include/asm-um/a.out.h
@@ -13,11 +13,9 @@
13 13
14extern unsigned long stacksizelim; 14extern unsigned long stacksizelim;
15 15
16extern unsigned long host_task_size;
17
18#define STACK_ROOM (stacksizelim) 16#define STACK_ROOM (stacksizelim)
19 17
20#define STACK_TOP task_size 18#define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE)
21 19
22#define STACK_TOP_MAX STACK_TOP 20#define STACK_TOP_MAX STACK_TOP
23 21
diff --git a/include/asm-um/current.h b/include/asm-um/current.h
index 8fd72f69ce65..c2191d9aa03d 100644
--- a/include/asm-um/current.h
+++ b/include/asm-um/current.h
@@ -1,32 +1,13 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __UM_CURRENT_H 6#ifndef __UM_CURRENT_H
7#define __UM_CURRENT_H 7#define __UM_CURRENT_H
8 8
9#ifndef __ASSEMBLY__
10
11#include "asm/page.h"
12#include "linux/thread_info.h" 9#include "linux/thread_info.h"
13 10
14#define current (current_thread_info()->task) 11#define current (current_thread_info()->task)
15 12
16/*Backward compatibility - it's used inside arch/um.*/
17#define current_thread current_thread_info()
18
19#endif /* __ASSEMBLY__ */
20
21#endif 13#endif
22
23/*
24 * Overrides for Emacs so that we follow Linus's tabbing style.
25 * Emacs will notice this stuff at the end of the file and automatically
26 * adjust the settings for this buffer only. This must remain at the end
27 * of the file.
28 * ---------------------------------------------------------------------------
29 * Local variables:
30 * c-file-style: "linux"
31 * End:
32 */
diff --git a/include/asm-um/elf-i386.h b/include/asm-um/elf-i386.h
index ca94a136dfe8..23d6893e8617 100644
--- a/include/asm-um/elf-i386.h
+++ b/include/asm-um/elf-i386.h
@@ -1,11 +1,11 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5#ifndef __UM_ELF_I386_H 5#ifndef __UM_ELF_I386_H
6#define __UM_ELF_I386_H 6#define __UM_ELF_I386_H
7 7
8#include <linux/sched.h> 8#include <asm/user.h>
9#include "skas.h" 9#include "skas.h"
10 10
11#define R_386_NONE 0 11#define R_386_NONE 0
@@ -46,7 +46,7 @@ typedef struct user_i387_struct elf_fpregset_t;
46 PT_REGS_EDI(regs) = 0; \ 46 PT_REGS_EDI(regs) = 0; \
47 PT_REGS_EBP(regs) = 0; \ 47 PT_REGS_EBP(regs) = 0; \
48 PT_REGS_EAX(regs) = 0; \ 48 PT_REGS_EAX(regs) = 0; \
49} while(0) 49} while (0)
50 50
51#define USE_ELF_CORE_DUMP 51#define USE_ELF_CORE_DUMP
52#define ELF_EXEC_PAGESIZE 4096 52#define ELF_EXEC_PAGESIZE 4096
@@ -74,14 +74,9 @@ typedef struct user_i387_struct elf_fpregset_t;
74 pr_reg[14] = PT_REGS_EFLAGS(regs); \ 74 pr_reg[14] = PT_REGS_EFLAGS(regs); \
75 pr_reg[15] = PT_REGS_SP(regs); \ 75 pr_reg[15] = PT_REGS_SP(regs); \
76 pr_reg[16] = PT_REGS_SS(regs); \ 76 pr_reg[16] = PT_REGS_SS(regs); \
77} while(0); 77} while (0);
78 78
79static inline int elf_core_copy_fpregs(struct task_struct *t, 79extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
80 elf_fpregset_t *fpu)
81{
82 int cpu = ((struct thread_info *) t->stack)->cpu;
83 return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu);
84}
85 80
86#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) 81#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
87 82
@@ -91,7 +86,7 @@ extern long elf_aux_hwcap;
91extern char * elf_aux_platform; 86extern char * elf_aux_platform;
92#define ELF_PLATFORM (elf_aux_platform) 87#define ELF_PLATFORM (elf_aux_platform)
93 88
94#define SET_PERSONALITY(ex, ibcs2) do ; while(0) 89#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
95 90
96extern unsigned long vsyscall_ehdr; 91extern unsigned long vsyscall_ehdr;
97extern unsigned long vsyscall_end; 92extern unsigned long vsyscall_end;
@@ -166,14 +161,3 @@ if ( vsyscall_ehdr ) { \
166} 161}
167 162
168#endif 163#endif
169
170/*
171 * Overrides for Emacs so that we follow Linus's tabbing style.
172 * Emacs will notice this stuff at the end of the file and automatically
173 * adjust the settings for this buffer only. This must remain at the end
174 * of the file.
175 * ---------------------------------------------------------------------------
176 * Local variables:
177 * c-file-style: "linux"
178 * End:
179 */
diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h
index 3c9d543eb61e..3b2d5224a7e1 100644
--- a/include/asm-um/elf-x86_64.h
+++ b/include/asm-um/elf-x86_64.h
@@ -7,7 +7,6 @@
7#ifndef __UM_ELF_X86_64_H 7#ifndef __UM_ELF_X86_64_H
8#define __UM_ELF_X86_64_H 8#define __UM_ELF_X86_64_H
9 9
10#include <linux/sched.h>
11#include <asm/user.h> 10#include <asm/user.h>
12#include "skas.h" 11#include "skas.h"
13 12
@@ -96,12 +95,7 @@ typedef struct user_i387_struct elf_fpregset_t;
96 (pr_reg)[25] = 0; \ 95 (pr_reg)[25] = 0; \
97 (pr_reg)[26] = 0; 96 (pr_reg)[26] = 0;
98 97
99static inline int elf_core_copy_fpregs(struct task_struct *t, 98extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
100 elf_fpregset_t *fpu)
101{
102 int cpu = current_thread->cpu;
103 return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu);
104}
105 99
106#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) 100#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
107 101
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h
index d352a35cfafb..89a87c18b927 100644
--- a/include/asm-um/fixmap.h
+++ b/include/asm-um/fixmap.h
@@ -1,9 +1,10 @@
1#ifndef __UM_FIXMAP_H 1#ifndef __UM_FIXMAP_H
2#define __UM_FIXMAP_H 2#define __UM_FIXMAP_H
3 3
4#include <asm/system.h>
4#include <asm/kmap_types.h> 5#include <asm/kmap_types.h>
5#include <asm/archparam.h> 6#include <asm/archparam.h>
6#include <asm/elf.h> 7#include <asm/page.h>
7 8
8/* 9/*
9 * Here we define all the compile-time 'special' virtual 10 * Here we define all the compile-time 'special' virtual
@@ -55,9 +56,8 @@ extern void __set_fixmap (enum fixed_addresses idx,
55 * the start of the fixmap, and leave one page empty 56 * the start of the fixmap, and leave one page empty
56 * at the top of mem.. 57 * at the top of mem..
57 */ 58 */
58extern unsigned long get_kmem_end(void);
59 59
60#define FIXADDR_TOP (get_kmem_end() - 0x2000) 60#define FIXADDR_TOP (CONFIG_TOP_ADDR - 2 * PAGE_SIZE)
61#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 61#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
62#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 62#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
63 63
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h
index b2553f3e87eb..52af512f5e7d 100644
--- a/include/asm-um/ldt.h
+++ b/include/asm-um/ldt.h
@@ -8,7 +8,7 @@
8#ifndef __ASM_LDT_H 8#ifndef __ASM_LDT_H
9#define __ASM_LDT_H 9#define __ASM_LDT_H
10 10
11#include "asm/semaphore.h" 11#include <linux/mutex.h>
12#include "asm/host_ldt.h" 12#include "asm/host_ldt.h"
13 13
14extern void ldt_host_info(void); 14extern void ldt_host_info(void);
@@ -27,7 +27,7 @@ struct ldt_entry {
27 27
28typedef struct uml_ldt { 28typedef struct uml_ldt {
29 int entry_count; 29 int entry_count;
30 struct semaphore semaphore; 30 struct mutex lock;
31 union { 31 union {
32 struct ldt_entry * pages[LDT_PAGES_MAX]; 32 struct ldt_entry * pages[LDT_PAGES_MAX];
33 struct ldt_entry entries[LDT_DIRECT_ENTRIES]; 33 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
diff --git a/include/asm-um/linkage.h b/include/asm-um/linkage.h
index cdb3024a699a..7dfce37adc8b 100644
--- a/include/asm-um/linkage.h
+++ b/include/asm-um/linkage.h
@@ -3,10 +3,4 @@
3 3
4#include "asm/arch/linkage.h" 4#include "asm/arch/linkage.h"
5 5
6
7/* <linux/linkage.h> will pick sane defaults */
8#ifdef CONFIG_GPROF
9#undef fastcall
10#endif
11
12#endif 6#endif
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index 5f3b863aef9a..6686fc524ca1 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -6,11 +6,12 @@
6#ifndef __UM_MMU_CONTEXT_H 6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H 7#define __UM_MMU_CONTEXT_H
8 8
9#include <asm-generic/mm_hooks.h>
10
11#include "linux/sched.h" 9#include "linux/sched.h"
12#include "um_mmu.h" 10#include "um_mmu.h"
13 11
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm);
14
14#define get_mmu_context(task) do ; while(0) 15#define get_mmu_context(task) do ; while(0)
15#define activate_context(tsk) do ; while(0) 16#define activate_context(tsk) do ; while(0)
16 17
@@ -30,6 +31,8 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
30 */ 31 */
31 if (old != new && (current->flags & PF_BORROWED_MM)) 32 if (old != new && (current->flags & PF_BORROWED_MM))
32 __switch_mm(&new->context.id); 33 __switch_mm(&new->context.id);
34
35 arch_dup_mmap(old, new);
33} 36}
34 37
35static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 38static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 4b424c75fca5..fe2374d705d1 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -30,7 +30,7 @@ struct page;
30#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT) 30#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT)
31 31
32typedef struct { unsigned long pte_low, pte_high; } pte_t; 32typedef struct { unsigned long pte_low, pte_high; } pte_t;
33typedef struct { unsigned long long pmd; } pmd_t; 33typedef struct { unsigned long pmd; } pmd_t;
34typedef struct { unsigned long pgd; } pgd_t; 34typedef struct { unsigned long pgd; } pgd_t;
35#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32)) 35#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32))
36 36
@@ -106,8 +106,8 @@ extern unsigned long uml_physmem;
106#define __pa(virt) to_phys((void *) (unsigned long) (virt)) 106#define __pa(virt) to_phys((void *) (unsigned long) (virt))
107#define __va(phys) to_virt((unsigned long) (phys)) 107#define __va(phys) to_virt((unsigned long) (phys))
108 108
109#define phys_to_pfn(p) ((p) >> PAGE_SHIFT) 109#define phys_to_pfn(p) ((pfn_t) ((p) >> PAGE_SHIFT))
110#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 110#define pfn_to_phys(pfn) ((phys_t) ((pfn) << PAGE_SHIFT))
111 111
112#define pfn_valid(pfn) ((pfn) < max_mapnr) 112#define pfn_valid(pfn) ((pfn) < max_mapnr)
113#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) 113#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
diff --git a/include/asm-um/param.h b/include/asm-um/param.h
index f914e7d67b01..4cd4a226f8c1 100644
--- a/include/asm-um/param.h
+++ b/include/asm-um/param.h
@@ -10,7 +10,7 @@
10#define MAXHOSTNAMELEN 64 /* max length of hostname */ 10#define MAXHOSTNAMELEN 64 /* max length of hostname */
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#define HZ 100 13#define HZ CONFIG_HZ
14#define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 14#define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ 15#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
16#endif 16#endif
diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h
index 14904876e8fb..4f3e62b02861 100644
--- a/include/asm-um/pgalloc.h
+++ b/include/asm-um/pgalloc.h
@@ -23,17 +23,17 @@
23 * Allocate and free page tables. 23 * Allocate and free page tables.
24 */ 24 */
25extern pgd_t *pgd_alloc(struct mm_struct *); 25extern pgd_t *pgd_alloc(struct mm_struct *);
26extern void pgd_free(pgd_t *pgd); 26extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
27 27
28extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); 28extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
29extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); 29extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
30 30
31static inline void pte_free_kernel(pte_t *pte) 31static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
32{ 32{
33 free_page((unsigned long) pte); 33 free_page((unsigned long) pte);
34} 34}
35 35
36static inline void pte_free(struct page *pte) 36static inline void pte_free(struct mm_struct *mm, struct page *pte)
37{ 37{
38 __free_page(pte); 38 __free_page(pte);
39} 39}
@@ -42,7 +42,7 @@ static inline void pte_free(struct page *pte)
42 42
43#ifdef CONFIG_3_LEVEL_PGTABLES 43#ifdef CONFIG_3_LEVEL_PGTABLES
44 44
45static inline void pmd_free(pmd_t *pmd) 45static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
46{ 46{
47 free_page((unsigned long)pmd); 47 free_page((unsigned long)pmd);
48} 48}
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
index 172a75fde512..f534b73e753e 100644
--- a/include/asm-um/pgtable-2level.h
+++ b/include/asm-um/pgtable-2level.h
@@ -41,9 +41,6 @@ static inline void pgd_mkuptodate(pgd_t pgd) { }
41#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))
42#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))
43 43
44#define pmd_page_vaddr(pmd) \
45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
46
47/* 44/*
48 * Bits 0 through 4 are taken 45 * Bits 0 through 4 are taken
49 */ 46 */
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
index 3ebafbaacb24..0446f456b428 100644
--- a/include/asm-um/pgtable-3level.h
+++ b/include/asm-um/pgtable-3level.h
@@ -11,7 +11,11 @@
11 11
12/* PGDIR_SHIFT determines what a third-level page table entry can map */ 12/* PGDIR_SHIFT determines what a third-level page table entry can map */
13 13
14#ifdef CONFIG_64BIT
14#define PGDIR_SHIFT 30 15#define PGDIR_SHIFT 30
16#else
17#define PGDIR_SHIFT 31
18#endif
15#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 19#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
16#define PGDIR_MASK (~(PGDIR_SIZE-1)) 20#define PGDIR_MASK (~(PGDIR_SIZE-1))
17 21
@@ -28,9 +32,15 @@
28 */ 32 */
29 33
30#define PTRS_PER_PTE 512 34#define PTRS_PER_PTE 512
35#ifdef CONFIG_64BIT
31#define PTRS_PER_PMD 512 36#define PTRS_PER_PMD 512
32#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
33#define PTRS_PER_PGD 512 37#define PTRS_PER_PGD 512
38#else
39#define PTRS_PER_PMD 1024
40#define PTRS_PER_PGD 1024
41#endif
42
43#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
34#define FIRST_USER_ADDRESS 0 44#define FIRST_USER_ADDRESS 0
35 45
36#define pte_ERROR(e) \ 46#define pte_ERROR(e) \
@@ -49,7 +59,12 @@
49#define pud_populate(mm, pud, pmd) \ 59#define pud_populate(mm, pud, pmd) \
50 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) 60 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
51 61
62#ifdef CONFIG_64BIT
52#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) 63#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval))
64#else
65#define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
66#endif
67
53static inline int pgd_newpage(pgd_t pgd) 68static inline int pgd_newpage(pgd_t pgd)
54{ 69{
55 return(pgd_val(pgd) & _PAGE_NEWPAGE); 70 return(pgd_val(pgd) & _PAGE_NEWPAGE);
@@ -57,17 +72,14 @@ static inline int pgd_newpage(pgd_t pgd)
57 72
58static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } 73static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
59 74
75#ifdef CONFIG_64BIT
60#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) 76#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
77#else
78#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
79#endif
61 80
62static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) 81struct mm_struct;
63{ 82extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
64 pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL);
65
66 if(pmd)
67 memset(pmd, 0, PAGE_SIZE);
68
69 return pmd;
70}
71 83
72static inline void pud_clear (pud_t *pud) 84static inline void pud_clear (pud_t *pud)
73{ 85{
@@ -75,8 +87,7 @@ static inline void pud_clear (pud_t *pud)
75} 87}
76 88
77#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) 89#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK)
78#define pud_page_vaddr(pud) \ 90#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK))
79 ((struct page *) __va(pud_val(pud) & PAGE_MASK))
80 91
81/* Find an entry in the second-level page table.. */ 92/* Find an entry in the second-level page table.. */
82#define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ 93#define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index 830fc6e5d49d..4102b443e925 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright 2003 PathScale, Inc. 3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgtable.h 4 * Derived from include/asm-i386/pgtable.h
5 * Licensed under the GPL 5 * Licensed under the GPL
@@ -8,11 +8,7 @@
8#ifndef __UM_PGTABLE_H 8#ifndef __UM_PGTABLE_H
9#define __UM_PGTABLE_H 9#define __UM_PGTABLE_H
10 10
11#include "linux/sched.h" 11#include <asm/fixmap.h>
12#include "linux/linkage.h"
13#include "asm/processor.h"
14#include "asm/page.h"
15#include "asm/fixmap.h"
16 12
17#define _PAGE_PRESENT 0x001 13#define _PAGE_PRESENT 0x001
18#define _PAGE_NEWPAGE 0x002 14#define _PAGE_NEWPAGE 0x002
@@ -34,22 +30,11 @@
34 30
35extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 31extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
36 32
37extern void *um_virt_to_phys(struct task_struct *task, unsigned long virt,
38 pte_t *pte_out);
39
40/* zero page used for uninitialized stuff */ 33/* zero page used for uninitialized stuff */
41extern unsigned long *empty_zero_page; 34extern unsigned long *empty_zero_page;
42 35
43#define pgtable_cache_init() do ; while (0) 36#define pgtable_cache_init() do ; while (0)
44 37
45/*
46 * pgd entries used up by user/kernel:
47 */
48
49#define USER_PGD_PTRS (TASK_SIZE >> PGDIR_SHIFT)
50#define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
51
52#ifndef __ASSEMBLY__
53/* Just any arbitrary offset to the start of the vmalloc VM area: the 38/* Just any arbitrary offset to the start of the vmalloc VM area: the
54 * current 8MB value just means that there will be a 8MB "hole" after the 39 * current 8MB value just means that there will be a 8MB "hole" after the
55 * physical memory until the kernel virtual memory starts. That means that 40 * physical memory until the kernel virtual memory starts. That means that
@@ -62,16 +47,12 @@ extern unsigned long end_iomem;
62 47
63#define VMALLOC_OFFSET (__va_space) 48#define VMALLOC_OFFSET (__va_space)
64#define VMALLOC_START ((end_iomem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) 49#define VMALLOC_START ((end_iomem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
65
66#ifdef CONFIG_HIGHMEM 50#ifdef CONFIG_HIGHMEM
67# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) 51# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
68#else 52#else
69# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) 53# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
70#endif 54#endif
71 55
72#define REGION_SHIFT (sizeof(pte_t) * 8 - 4)
73#define REGION_MASK (((unsigned long) 0xf) << REGION_SHIFT)
74
75#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) 56#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
76#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 57#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
77#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 58#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -81,11 +62,12 @@ extern unsigned long end_iomem;
81#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) 62#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
82#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) 63#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
83#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) 64#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
84#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED)
85 65
86/* 66/*
87 * The i386 can't do page protection for execute, and considers that the same are read. 67 * The i386 can't do page protection for execute, and considers that the same
88 * Also, write permissions imply read permissions. This is the closest we can get.. 68 * are read.
69 * Also, write permissions imply read permissions. This is the closest we can
70 * get..
89 */ 71 */
90#define __P000 PAGE_NONE 72#define __P000 PAGE_NONE
91#define __P001 PAGE_READONLY 73#define __P001 PAGE_READONLY
@@ -106,40 +88,16 @@ extern unsigned long end_iomem;
106#define __S111 PAGE_SHARED 88#define __S111 PAGE_SHARED
107 89
108/* 90/*
109 * Define this if things work differently on an i386 and an i486:
110 * it will (on an i486) warn about kernel memory accesses that are
111 * done without a 'access_ok(VERIFY_WRITE,..)'
112 */
113#undef TEST_VERIFY_AREA
114
115/* page table for 0-4MB for everybody */
116extern unsigned long pg0[1024];
117
118/*
119 * ZERO_PAGE is a global shared page that is always zero: used 91 * ZERO_PAGE is a global shared page that is always zero: used
120 * for zero-mapped memory areas etc.. 92 * for zero-mapped memory areas etc..
121 */ 93 */
122
123#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) 94#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
124 95
125/* number of bits that fit into a memory pointer */
126#define BITS_PER_PTR (8*sizeof(unsigned long))
127
128/* to align the pointer to a pointer address */
129#define PTR_MASK (~(sizeof(void*)-1))
130
131/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
132/* 64-bit machines, beware! SRB. */
133#define SIZEOF_PTR_LOG2 3
134
135/* to find an entry in a page-table */
136#define PAGE_PTR(address) \
137((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
138
139#define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE)) 96#define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE))
140 97
141#define pmd_none(x) (!((unsigned long)pmd_val(x) & ~_PAGE_NEWPAGE)) 98#define pmd_none(x) (!((unsigned long)pmd_val(x) & ~_PAGE_NEWPAGE))
142#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) 99#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
100
143#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) 101#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
144#define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0) 102#define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0)
145 103
@@ -149,14 +107,9 @@ extern unsigned long pg0[1024];
149#define pud_newpage(x) (pud_val(x) & _PAGE_NEWPAGE) 107#define pud_newpage(x) (pud_val(x) & _PAGE_NEWPAGE)
150#define pud_mkuptodate(x) (pud_val(x) &= ~_PAGE_NEWPAGE) 108#define pud_mkuptodate(x) (pud_val(x) &= ~_PAGE_NEWPAGE)
151 109
152#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
153
154#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK) 110#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK)
155 111
156#define pte_page(x) pfn_to_page(pte_pfn(x)) 112#define pte_page(x) pfn_to_page(pte_pfn(x))
157#define pte_address(x) (__va(pte_val(x) & PAGE_MASK))
158#define mk_phys(a, r) ((a) + (((unsigned long) r) << REGION_SHIFT))
159#define phys_addr(p) ((p) & ~REGION_MASK)
160 113
161#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE)) 114#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE))
162 115
@@ -309,7 +262,8 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
309 262
310#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) 263#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
311#define __virt_to_page(virt) phys_to_page(__pa(virt)) 264#define __virt_to_page(virt) phys_to_page(__pa(virt))
312#define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) 265#define page_to_phys(page) pfn_to_phys((pfn_t) page_to_pfn(page))
266#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
313 267
314#define mk_pte(page, pgprot) \ 268#define mk_pte(page, pgprot) \
315 ({ pte_t pte; \ 269 ({ pte_t pte; \
@@ -325,8 +279,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
325 return pte; 279 return pte;
326} 280}
327 281
328#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
329
330/* 282/*
331 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] 283 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
332 * 284 *
@@ -335,8 +287,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
335 */ 287 */
336#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 288#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
337 289
338#define pgd_index_k(addr) pgd_index(addr)
339
340/* 290/*
341 * pgd_offset() returns a (pgd_t *) 291 * pgd_offset() returns a (pgd_t *)
342 * pgd_index() is used get the offset into the pgd page's array of pgd_t's; 292 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
@@ -355,8 +305,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
355 * this macro returns the index of the entry in the pmd page which would 305 * this macro returns the index of the entry in the pmd page which would
356 * control the given virtual address 306 * control the given virtual address
357 */ 307 */
308#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
358#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 309#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
359 310
311#define pmd_page_vaddr(pmd) \
312 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
313
360/* 314/*
361 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] 315 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
362 * 316 *
@@ -372,6 +326,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
372#define pte_unmap(pte) do { } while (0) 326#define pte_unmap(pte) do { } while (0)
373#define pte_unmap_nested(pte) do { } while (0) 327#define pte_unmap_nested(pte) do { } while (0)
374 328
329struct mm_struct;
330extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
331
375#define update_mmu_cache(vma,address,pte) do ; while (0) 332#define update_mmu_cache(vma,address,pte) do ; while (0)
376 333
377/* Encode and de-code a swap entry */ 334/* Encode and de-code a swap entry */
@@ -388,29 +345,4 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
388 345
389#include <asm-generic/pgtable.h> 346#include <asm-generic/pgtable.h>
390 347
391#include <asm-generic/pgtable-nopud.h>
392
393#ifdef CONFIG_HIGHMEM
394/* Clear a kernel PTE and flush it from the TLB */
395#define kpte_clear_flush(ptep, vaddr) \
396do { \
397 pte_clear(&init_mm, vaddr, ptep); \
398 __flush_tlb_one(vaddr); \
399} while (0)
400#endif 348#endif
401
402#endif
403#endif
404
405#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
406
407/*
408 * Overrides for Emacs so that we follow Linus's tabbing style.
409 * Emacs will notice this stuff at the end of the file and automatically
410 * adjust the settings for this buffer only. This must remain at the end
411 * of the file.
412 * ---------------------------------------------------------------------------
413 * Local variables:
414 * c-file-style: "linux"
415 * End:
416 */
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index 78c0599cc80c..b7d9a16a7451 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -11,6 +11,7 @@ struct pt_regs;
11struct task_struct; 11struct task_struct;
12 12
13#include "asm/ptrace.h" 13#include "asm/ptrace.h"
14#include "asm/pgtable.h"
14#include "registers.h" 15#include "registers.h"
15#include "sysdep/archsetjmp.h" 16#include "sysdep/archsetjmp.h"
16 17
@@ -26,7 +27,6 @@ struct thread_struct {
26 * as of 2.6.11). 27 * as of 2.6.11).
27 */ 28 */
28 int forking; 29 int forking;
29 int nsyscalls;
30 struct pt_regs regs; 30 struct pt_regs regs;
31 int singlestep_syscall; 31 int singlestep_syscall;
32 void *fault_addr; 32 void *fault_addr;
@@ -58,7 +58,6 @@ struct thread_struct {
58#define INIT_THREAD \ 58#define INIT_THREAD \
59{ \ 59{ \
60 .forking = 0, \ 60 .forking = 0, \
61 .nsyscalls = 0, \
62 .regs = EMPTY_REGS, \ 61 .regs = EMPTY_REGS, \
63 .fault_addr = NULL, \ 62 .fault_addr = NULL, \
64 .prev_sched = NULL, \ 63 .prev_sched = NULL, \
@@ -68,10 +67,6 @@ struct thread_struct {
68 .request = { 0 } \ 67 .request = { 0 } \
69} 68}
70 69
71typedef struct {
72 unsigned long seg;
73} mm_segment_t;
74
75extern struct task_struct *alloc_task_struct(void); 70extern struct task_struct *alloc_task_struct(void);
76 71
77static inline void release_thread(struct task_struct *task) 72static inline void release_thread(struct task_struct *task)
@@ -97,9 +92,7 @@ static inline void mm_copy_segments(struct mm_struct *from_mm,
97/* 92/*
98 * User space process size: 3GB (default). 93 * User space process size: 3GB (default).
99 */ 94 */
100extern unsigned long task_size; 95#define TASK_SIZE (CONFIG_TOP_ADDR & PGDIR_MASK)
101
102#define TASK_SIZE (task_size)
103 96
104/* This decides where the kernel will search for a free chunk of vm 97/* This decides where the kernel will search for a free chunk of vm
105 * space during mmap's. 98 * space during mmap's.
@@ -128,6 +121,6 @@ extern struct cpuinfo_um cpu_data[];
128 121
129 122
130#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) 123#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
131#define get_wchan(p) (0) 124extern unsigned long get_wchan(struct task_struct *p);
132 125
133#endif 126#endif
diff --git a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h
index 595f1c3e1e40..a2b7fe13fe1e 100644
--- a/include/asm-um/processor-i386.h
+++ b/include/asm-um/processor-i386.h
@@ -10,7 +10,6 @@
10#include "asm/host_ldt.h" 10#include "asm/host_ldt.h"
11#include "asm/segment.h" 11#include "asm/segment.h"
12 12
13extern int host_has_xmm;
14extern int host_has_cmov; 13extern int host_has_cmov;
15 14
16/* include faultinfo structure */ 15/* include faultinfo structure */
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
index 6e5fd5c892d0..356b83e2c22e 100644
--- a/include/asm-um/thread_info.h
+++ b/include/asm-um/thread_info.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -8,8 +8,9 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11#include <asm/processor.h>
12#include <asm/types.h> 11#include <asm/types.h>
12#include <asm/page.h>
13#include <asm/uaccess.h>
13 14
14struct thread_info { 15struct thread_info {
15 struct task_struct *task; /* main task structure */ 16 struct task_struct *task; /* main task structure */
@@ -75,8 +76,8 @@ static inline struct thread_info *current_thread_info(void)
75#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 76#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
76#define TIF_SIGPENDING 1 /* signal pending */ 77#define TIF_SIGPENDING 1 /* signal pending */
77#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 78#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
78#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling 79#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
79 * TIF_NEED_RESCHED 80 * TIF_NEED_RESCHED
80 */ 81 */
81#define TIF_RESTART_BLOCK 4 82#define TIF_RESTART_BLOCK 4
82#define TIF_MEMDIE 5 83#define TIF_MEMDIE 5
diff --git a/include/asm-um/tlb.h b/include/asm-um/tlb.h
index c640033bc1fd..39fc475df6c9 100644
--- a/include/asm-um/tlb.h
+++ b/include/asm-um/tlb.h
@@ -1,6 +1,126 @@
1#ifndef __UM_TLB_H 1#ifndef __UM_TLB_H
2#define __UM_TLB_H 2#define __UM_TLB_H
3 3
4#include <asm/arch/tlb.h> 4#include <linux/swap.h>
5#include <asm/percpu.h>
6#include <asm/pgalloc.h>
7#include <asm/tlbflush.h>
8
9#define tlb_start_vma(tlb, vma) do { } while (0)
10#define tlb_end_vma(tlb, vma) do { } while (0)
11#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
12
13/* struct mmu_gather is an opaque type used by the mm code for passing around
14 * any data needed by arch specific code for tlb_remove_page.
15 */
16struct mmu_gather {
17 struct mm_struct *mm;
18 unsigned int need_flush; /* Really unmapped some ptes? */
19 unsigned long start;
20 unsigned long end;
21 unsigned int fullmm; /* non-zero means full mm flush */
22};
23
24/* Users of the generic TLB shootdown code must declare this storage space. */
25DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
26
27static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
28 unsigned long address)
29{
30 if (tlb->start > address)
31 tlb->start = address;
32 if (tlb->end < address + PAGE_SIZE)
33 tlb->end = address + PAGE_SIZE;
34}
35
36static inline void init_tlb_gather(struct mmu_gather *tlb)
37{
38 tlb->need_flush = 0;
39
40 tlb->start = TASK_SIZE;
41 tlb->end = 0;
42
43 if (tlb->fullmm) {
44 tlb->start = 0;
45 tlb->end = TASK_SIZE;
46 }
47}
48
49/* tlb_gather_mmu
50 * Return a pointer to an initialized struct mmu_gather.
51 */
52static inline struct mmu_gather *
53tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
54{
55 struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
56
57 tlb->mm = mm;
58 tlb->fullmm = full_mm_flush;
59
60 init_tlb_gather(tlb);
61
62 return tlb;
63}
64
65extern void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
66 unsigned long end);
67
68static inline void
69tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
70{
71 if (!tlb->need_flush)
72 return;
73
74 flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end);
75 init_tlb_gather(tlb);
76}
77
78/* tlb_finish_mmu
79 * Called at the end of the shootdown operation to free up any resources
80 * that were required.
81 */
82static inline void
83tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
84{
85 tlb_flush_mmu(tlb, start, end);
86
87 /* keep the page table cache within bounds */
88 check_pgt_cache();
89
90 put_cpu_var(mmu_gathers);
91}
92
93/* tlb_remove_page
94 * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)),
95 * while handling the additional races in SMP caused by other CPUs
96 * caching valid mappings in their TLBs.
97 */
98static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
99{
100 tlb->need_flush = 1;
101 free_page_and_swap_cache(page);
102 return;
103}
104
105/**
106 * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
107 *
108 * Record the fact that pte's were really umapped in ->need_flush, so we can
109 * later optimise away the tlb invalidate. This helps when userspace is
110 * unmapping already-unmapped pages, which happens quite a lot.
111 */
112#define tlb_remove_tlb_entry(tlb, ptep, address) \
113 do { \
114 tlb->need_flush = 1; \
115 __tlb_remove_tlb_entry(tlb, ptep, address); \
116 } while (0)
117
118#define pte_free_tlb(tlb, ptep) __pte_free_tlb(tlb, ptep)
119
120#define pud_free_tlb(tlb, pudp) __pud_free_tlb(tlb, pudp)
121
122#define pmd_free_tlb(tlb, pmdp) __pmd_free_tlb(tlb, pmdp)
123
124#define tlb_migrate_finish(mm) do {} while (0)
5 125
6#endif 126#endif
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h
index 077032d4fc47..b9a895d6fa1d 100644
--- a/include/asm-um/uaccess.h
+++ b/include/asm-um/uaccess.h
@@ -6,7 +6,15 @@
6#ifndef __UM_UACCESS_H 6#ifndef __UM_UACCESS_H
7#define __UM_UACCESS_H 7#define __UM_UACCESS_H
8 8
9#include "linux/sched.h" 9#include <asm/errno.h>
10#include <asm/processor.h>
11
12/* thread_info has a mm_segment_t in it, so put the definition up here */
13typedef struct {
14 unsigned long seg;
15} mm_segment_t;
16
17#include "linux/thread_info.h"
10 18
11#define VERIFY_READ 0 19#define VERIFY_READ 0
12#define VERIFY_WRITE 1 20#define VERIFY_WRITE 1
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index a4c2493b025f..e199a2bf12aa 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* __V850_SOCKET_H__ */ 57#endif /* __V850_SOCKET_H__ */
diff --git a/include/asm-x86/asm.h b/include/asm-x86/asm.h
index 1a6980a60fc6..90dec0c23646 100644
--- a/include/asm-x86/asm.h
+++ b/include/asm-x86/asm.h
@@ -29,4 +29,11 @@
29 29
30#endif /* CONFIG_X86_32 */ 30#endif /* CONFIG_X86_32 */
31 31
32/* Exception table entry */
33# define _ASM_EXTABLE(from,to) \
34 " .section __ex_table,\"a\"\n" \
35 _ASM_ALIGN "\n" \
36 _ASM_PTR #from "," #to "\n" \
37 " .previous\n"
38
32#endif /* _ASM_X86_ASM_H */ 39#endif /* _ASM_X86_ASM_H */
diff --git a/include/asm-x86/bitops_64.h b/include/asm-x86/bitops_64.h
index 48adbf56ca60..aaf15194d536 100644
--- a/include/asm-x86/bitops_64.h
+++ b/include/asm-x86/bitops_64.h
@@ -37,12 +37,6 @@ static inline long __scanbit(unsigned long val, unsigned long max)
37 ((off)+(__scanbit(~(((*(unsigned long *)addr)) >> (off)),(size)-(off)))) : \ 37 ((off)+(__scanbit(~(((*(unsigned long *)addr)) >> (off)),(size)-(off)))) : \
38 find_next_zero_bit(addr,size,off))) 38 find_next_zero_bit(addr,size,off)))
39 39
40/*
41 * Find string of zero bits in a bitmap. -1 when not found.
42 */
43extern unsigned long
44find_next_zero_string(unsigned long *bitmap, long start, long nbits, int len);
45
46static inline void set_bit_string(unsigned long *bitmap, unsigned long i, 40static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
47 int len) 41 int len)
48{ 42{
@@ -53,16 +47,6 @@ static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
53 } 47 }
54} 48}
55 49
56static inline void __clear_bit_string(unsigned long *bitmap, unsigned long i,
57 int len)
58{
59 unsigned long end = i + len;
60 while (i < end) {
61 __clear_bit(i, bitmap);
62 i++;
63 }
64}
65
66/** 50/**
67 * ffz - find first zero in word. 51 * ffz - find first zero in word.
68 * @word: The word to search 52 * @word: The word to search
diff --git a/include/asm-x86/bugs.h b/include/asm-x86/bugs.h
index 3fcc30dc0731..021cbdd5f258 100644
--- a/include/asm-x86/bugs.h
+++ b/include/asm-x86/bugs.h
@@ -2,6 +2,6 @@
2#define _ASM_X86_BUGS_H 2#define _ASM_X86_BUGS_H
3 3
4extern void check_bugs(void); 4extern void check_bugs(void);
5extern int ppro_with_ram_bug(void); 5int ppro_with_ram_bug(void);
6 6
7#endif /* _ASM_X86_BUGS_H */ 7#endif /* _ASM_X86_BUGS_H */
diff --git a/include/asm-x86/compat.h b/include/asm-x86/compat.h
index b270ee04959e..d3e8f3e87ee8 100644
--- a/include/asm-x86/compat.h
+++ b/include/asm-x86/compat.h
@@ -190,7 +190,7 @@ typedef struct user_regs_struct32 compat_elf_gregset_t;
190 * A pointer passed in from user mode. This should not 190 * A pointer passed in from user mode. This should not
191 * be used for syscall parameters, just declare them 191 * be used for syscall parameters, just declare them
192 * as pointers because the syscall entry code will have 192 * as pointers because the syscall entry code will have
193 * appropriately comverted them already. 193 * appropriately converted them already.
194 */ 194 */
195typedef u32 compat_uptr_t; 195typedef u32 compat_uptr_t;
196 196
diff --git a/include/asm-x86/cpu.h b/include/asm-x86/cpu.h
index 85ece5f10e9e..73f2ea84fd74 100644
--- a/include/asm-x86/cpu.h
+++ b/include/asm-x86/cpu.h
@@ -10,8 +10,9 @@
10struct x86_cpu { 10struct x86_cpu {
11 struct cpu cpu; 11 struct cpu cpu;
12}; 12};
13extern int arch_register_cpu(int num); 13
14#ifdef CONFIG_HOTPLUG_CPU 14#ifdef CONFIG_HOTPLUG_CPU
15extern int arch_register_cpu(int num);
15extern void arch_unregister_cpu(int); 16extern void arch_unregister_cpu(int);
16#endif 17#endif
17 18
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h
index 3fb7dfa7fc91..065e92966c7c 100644
--- a/include/asm-x86/cpufeature.h
+++ b/include/asm-x86/cpufeature.h
@@ -4,9 +4,6 @@
4#ifndef _ASM_X86_CPUFEATURE_H 4#ifndef _ASM_X86_CPUFEATURE_H
5#define _ASM_X86_CPUFEATURE_H 5#define _ASM_X86_CPUFEATURE_H
6 6
7#ifndef __ASSEMBLY__
8#include <linux/bitops.h>
9#endif
10#include <asm/required-features.h> 7#include <asm/required-features.h>
11 8
12#define NCAPINTS 8 /* N 32-bit words worth of info */ 9#define NCAPINTS 8 /* N 32-bit words worth of info */
@@ -49,6 +46,7 @@
49#define X86_FEATURE_MP (1*32+19) /* MP Capable. */ 46#define X86_FEATURE_MP (1*32+19) /* MP Capable. */
50#define X86_FEATURE_NX (1*32+20) /* Execute Disable */ 47#define X86_FEATURE_NX (1*32+20) /* Execute Disable */
51#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ 48#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
49#define X86_FEATURE_GBPAGES (1*32+26) /* GB pages */
52#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ 50#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
53#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ 51#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
54#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ 52#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
@@ -115,6 +113,13 @@
115 */ 113 */
116#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ 114#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
117 115
116#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
117
118#include <linux/bitops.h>
119
120extern const char * const x86_cap_flags[NCAPINTS*32];
121extern const char * const x86_power_flags[32];
122
118#define cpu_has(c, bit) \ 123#define cpu_has(c, bit) \
119 (__builtin_constant_p(bit) && \ 124 (__builtin_constant_p(bit) && \
120 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ 125 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
@@ -175,6 +180,7 @@
175#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) 180#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
176#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) 181#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
177#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) 182#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
183#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
178 184
179#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) 185#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
180# define cpu_has_invlpg 1 186# define cpu_has_invlpg 1
@@ -204,4 +210,6 @@
204 210
205#endif /* CONFIG_X86_64 */ 211#endif /* CONFIG_X86_64 */
206 212
213#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
214
207#endif /* _ASM_X86_CPUFEATURE_H */ 215#endif /* _ASM_X86_CPUFEATURE_H */
diff --git a/include/asm-x86/e820_64.h b/include/asm-x86/e820_64.h
index 51e4170f9ca5..a560c4f5d500 100644
--- a/include/asm-x86/e820_64.h
+++ b/include/asm-x86/e820_64.h
@@ -15,7 +15,7 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17extern unsigned long find_e820_area(unsigned long start, unsigned long end, 17extern unsigned long find_e820_area(unsigned long start, unsigned long end,
18 unsigned size); 18 unsigned size, unsigned long align);
19extern void add_memory_region(unsigned long start, unsigned long size, 19extern void add_memory_region(unsigned long start, unsigned long size,
20 int type); 20 int type);
21extern void setup_memory_region(void); 21extern void setup_memory_region(void);
@@ -41,7 +41,7 @@ extern void finish_e820_parsing(void);
41extern struct e820map e820; 41extern struct e820map e820;
42extern void update_e820(void); 42extern void update_e820(void);
43 43
44extern void reserve_early(unsigned long start, unsigned long end); 44extern void reserve_early(unsigned long start, unsigned long end, char *name);
45extern void early_res_to_bootmem(void); 45extern void early_res_to_bootmem(void);
46 46
47#endif/*!__ASSEMBLY__*/ 47#endif/*!__ASSEMBLY__*/
diff --git a/include/asm-x86/efi.h b/include/asm-x86/efi.h
index 9c68a1f098d8..ea9734b74aca 100644
--- a/include/asm-x86/efi.h
+++ b/include/asm-x86/efi.h
@@ -33,7 +33,7 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
33#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ 33#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
34 efi_call_virt(f, a1, a2, a3, a4, a5, a6) 34 efi_call_virt(f, a1, a2, a3, a4, a5, a6)
35 35
36#define efi_ioremap(addr, size) ioremap(addr, size) 36#define efi_ioremap(addr, size) ioremap_cache(addr, size)
37 37
38#else /* !CONFIG_X86_32 */ 38#else /* !CONFIG_X86_32 */
39 39
@@ -86,7 +86,7 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
86 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 86 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
87 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) 87 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
88 88
89extern void *efi_ioremap(unsigned long offset, unsigned long size); 89extern void *efi_ioremap(unsigned long addr, unsigned long size);
90 90
91#endif /* CONFIG_X86_32 */ 91#endif /* CONFIG_X86_32 */
92 92
diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h
index 62828d63f1b1..cd9f894dd2d7 100644
--- a/include/asm-x86/futex.h
+++ b/include/asm-x86/futex.h
@@ -17,11 +17,8 @@
17"2: .section .fixup,\"ax\"\n \ 17"2: .section .fixup,\"ax\"\n \
183: mov %3, %1\n \ 183: mov %3, %1\n \
19 jmp 2b\n \ 19 jmp 2b\n \
20 .previous\n \ 20 .previous\n" \
21 .section __ex_table,\"a\"\n \ 21 _ASM_EXTABLE(1b,3b) \
22 .align 8\n" \
23 _ASM_PTR "1b,3b\n \
24 .previous" \
25 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \ 22 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
26 : "i" (-EFAULT), "0" (oparg), "1" (0)) 23 : "i" (-EFAULT), "0" (oparg), "1" (0))
27 24
@@ -30,16 +27,14 @@
30"1: movl %2, %0\n \ 27"1: movl %2, %0\n \
31 movl %0, %3\n" \ 28 movl %0, %3\n" \
32 insn "\n" \ 29 insn "\n" \
33"2: " LOCK_PREFIX "cmpxchgl %3, %2\n \ 30"2: lock; cmpxchgl %3, %2\n \
34 jnz 1b\n \ 31 jnz 1b\n \
353: .section .fixup,\"ax\"\n \ 323: .section .fixup,\"ax\"\n \
364: mov %5, %1\n \ 334: mov %5, %1\n \
37 jmp 3b\n \ 34 jmp 3b\n \
38 .previous\n \ 35 .previous\n" \
39 .section __ex_table,\"a\"\n \ 36 _ASM_EXTABLE(1b,4b) \
40 .align 8\n" \ 37 _ASM_EXTABLE(2b,4b) \
41 _ASM_PTR "1b,4b,2b,4b\n \
42 .previous" \
43 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \ 38 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \
44 "=&r" (tem) \ 39 "=&r" (tem) \
45 : "r" (oparg), "i" (-EFAULT), "1" (0)) 40 : "r" (oparg), "i" (-EFAULT), "1" (0))
@@ -72,7 +67,7 @@ futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
72 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 67 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
73 break; 68 break;
74 case FUTEX_OP_ADD: 69 case FUTEX_OP_ADD:
75 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval, 70 __futex_atomic_op1("lock; xaddl %0, %2", ret, oldval,
76 uaddr, oparg); 71 uaddr, oparg);
77 break; 72 break;
78 case FUTEX_OP_OR: 73 case FUTEX_OP_OR:
@@ -111,18 +106,12 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
111 return -EFAULT; 106 return -EFAULT;
112 107
113 __asm__ __volatile__( 108 __asm__ __volatile__(
114 "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n" 109 "1: lock; cmpxchgl %3, %1 \n"
115
116 "2: .section .fixup, \"ax\" \n" 110 "2: .section .fixup, \"ax\" \n"
117 "3: mov %2, %0 \n" 111 "3: mov %2, %0 \n"
118 " jmp 2b \n" 112 " jmp 2b \n"
119 " .previous \n" 113 " .previous \n"
120 114 _ASM_EXTABLE(1b,3b)
121 " .section __ex_table, \"a\" \n"
122 " .align 8 \n"
123 _ASM_PTR " 1b,3b \n"
124 " .previous \n"
125
126 : "=a" (oldval), "+m" (*uaddr) 115 : "=a" (oldval), "+m" (*uaddr)
127 : "i" (-EFAULT), "r" (newval), "0" (oldval) 116 : "i" (-EFAULT), "r" (newval), "0" (oldval)
128 : "memory" 117 : "memory"
diff --git a/include/asm-x86/highmem.h b/include/asm-x86/highmem.h
index 13cdcd66fff2..479767c9195f 100644
--- a/include/asm-x86/highmem.h
+++ b/include/asm-x86/highmem.h
@@ -38,11 +38,6 @@ extern pte_t *pkmap_page_table;
38 * easily, subsequent pte tables have to be allocated in one physical 38 * easily, subsequent pte tables have to be allocated in one physical
39 * chunk of RAM. 39 * chunk of RAM.
40 */ 40 */
41#ifdef CONFIG_X86_PAE
42#define LAST_PKMAP 512
43#else
44#define LAST_PKMAP 1024
45#endif
46/* 41/*
47 * Ordering is: 42 * Ordering is:
48 * 43 *
@@ -58,13 +53,12 @@ extern pte_t *pkmap_page_table;
58 * VMALLOC_START 53 * VMALLOC_START
59 * high_memory 54 * high_memory
60 */ 55 */
61#define PKMAP_BASE ( (FIXADDR_BOOT_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK )
62#define LAST_PKMAP_MASK (LAST_PKMAP-1) 56#define LAST_PKMAP_MASK (LAST_PKMAP-1)
63#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 57#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
64#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 58#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
65 59
66extern void * FASTCALL(kmap_high(struct page *page)); 60extern void *kmap_high(struct page *page);
67extern void FASTCALL(kunmap_high(struct page *page)); 61extern void kunmap_high(struct page *page);
68 62
69void *kmap(struct page *page); 63void *kmap(struct page *page);
70void kunmap(struct page *page); 64void kunmap(struct page *page);
diff --git a/include/asm-x86/hw_irq_32.h b/include/asm-x86/hw_irq_32.h
index 6d65fbb6358b..ea88054e03f3 100644
--- a/include/asm-x86/hw_irq_32.h
+++ b/include/asm-x86/hw_irq_32.h
@@ -47,7 +47,7 @@ void enable_8259A_irq(unsigned int irq);
47int i8259A_irq_pending(unsigned int irq); 47int i8259A_irq_pending(unsigned int irq);
48void make_8259A_irq(unsigned int irq); 48void make_8259A_irq(unsigned int irq);
49void init_8259A(int aeoi); 49void init_8259A(int aeoi);
50void FASTCALL(send_IPI_self(int vector)); 50void send_IPI_self(int vector);
51void init_VISWS_APIC_irqs(void); 51void init_VISWS_APIC_irqs(void);
52void setup_IO_APIC(void); 52void setup_IO_APIC(void);
53void disable_IO_APIC(void); 53void disable_IO_APIC(void);
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
index ba8105ca822b..6b1895ccd6b7 100644
--- a/include/asm-x86/i387.h
+++ b/include/asm-x86/i387.h
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/regset.h> 15#include <linux/regset.h>
16#include <asm/asm.h>
16#include <asm/processor.h> 17#include <asm/processor.h>
17#include <asm/sigcontext.h> 18#include <asm/sigcontext.h>
18#include <asm/user.h> 19#include <asm/user.h>
@@ -41,10 +42,7 @@ static inline void tolerant_fwait(void)
41{ 42{
42 asm volatile("1: fwait\n" 43 asm volatile("1: fwait\n"
43 "2:\n" 44 "2:\n"
44 " .section __ex_table,\"a\"\n" 45 _ASM_EXTABLE(1b,2b));
45 " .align 8\n"
46 " .quad 1b,2b\n"
47 " .previous\n");
48} 46}
49 47
50static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) 48static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
@@ -57,10 +55,7 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
57 "3: movl $-1,%[err]\n" 55 "3: movl $-1,%[err]\n"
58 " jmp 2b\n" 56 " jmp 2b\n"
59 ".previous\n" 57 ".previous\n"
60 ".section __ex_table,\"a\"\n" 58 _ASM_EXTABLE(1b,3b)
61 " .align 8\n"
62 " .quad 1b,3b\n"
63 ".previous"
64 : [err] "=r" (err) 59 : [err] "=r" (err)
65#if 0 /* See comment in __save_init_fpu() below. */ 60#if 0 /* See comment in __save_init_fpu() below. */
66 : [fx] "r" (fx), "m" (*fx), "0" (0)); 61 : [fx] "r" (fx), "m" (*fx), "0" (0));
@@ -99,10 +94,7 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
99 "3: movl $-1,%[err]\n" 94 "3: movl $-1,%[err]\n"
100 " jmp 2b\n" 95 " jmp 2b\n"
101 ".previous\n" 96 ".previous\n"
102 ".section __ex_table,\"a\"\n" 97 _ASM_EXTABLE(1b,3b)
103 " .align 8\n"
104 " .quad 1b,3b\n"
105 ".previous"
106 : [err] "=r" (err), "=m" (*fx) 98 : [err] "=r" (err), "=m" (*fx)
107#if 0 /* See comment in __fxsave_clear() below. */ 99#if 0 /* See comment in __fxsave_clear() below. */
108 : [fx] "r" (fx), "0" (0)); 100 : [fx] "r" (fx), "0" (0));
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
index 586d7aa54ceb..58d2c45cd0b1 100644
--- a/include/asm-x86/io_32.h
+++ b/include/asm-x86/io_32.h
@@ -275,29 +275,6 @@ static inline void slow_down_io(void) {
275 275
276#endif 276#endif
277 277
278#ifdef CONFIG_X86_NUMAQ
279extern void *xquad_portio; /* Where the IO area was mapped */
280#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port)
281#define __BUILDIO(bwl,bw,type) \
282static inline void out##bwl##_quad(unsigned type value, int port, int quad) { \
283 if (xquad_portio) \
284 write##bwl(value, XQUAD_PORT_ADDR(port, quad)); \
285 else \
286 out##bwl##_local(value, port); \
287} \
288static inline void out##bwl(unsigned type value, int port) { \
289 out##bwl##_quad(value, port, 0); \
290} \
291static inline unsigned type in##bwl##_quad(int port, int quad) { \
292 if (xquad_portio) \
293 return read##bwl(XQUAD_PORT_ADDR(port, quad)); \
294 else \
295 return in##bwl##_local(port); \
296} \
297static inline unsigned type in##bwl(int port) { \
298 return in##bwl##_quad(port, 0); \
299}
300#else
301#define __BUILDIO(bwl,bw,type) \ 278#define __BUILDIO(bwl,bw,type) \
302static inline void out##bwl(unsigned type value, int port) { \ 279static inline void out##bwl(unsigned type value, int port) { \
303 out##bwl##_local(value, port); \ 280 out##bwl##_local(value, port); \
@@ -305,8 +282,6 @@ static inline void out##bwl(unsigned type value, int port) { \
305static inline unsigned type in##bwl(int port) { \ 282static inline unsigned type in##bwl(int port) { \
306 return in##bwl##_local(port); \ 283 return in##bwl##_local(port); \
307} 284}
308#endif
309
310 285
311#define BUILDIO(bwl,bw,type) \ 286#define BUILDIO(bwl,bw,type) \
312static inline void out##bwl##_local(unsigned type value, int port) { \ 287static inline void out##bwl##_local(unsigned type value, int port) { \
diff --git a/include/asm-x86/mach-numaq/mach_apic.h b/include/asm-x86/mach-numaq/mach_apic.h
index 17e183bd39c1..3b637fac890b 100644
--- a/include/asm-x86/mach-numaq/mach_apic.h
+++ b/include/asm-x86/mach-numaq/mach_apic.h
@@ -109,6 +109,8 @@ static inline int mpc_apic_id(struct mpc_config_processor *m,
109 return logical_apicid; 109 return logical_apicid;
110} 110}
111 111
112extern void *xquad_portio;
113
112static inline void setup_portio_remap(void) 114static inline void setup_portio_remap(void)
113{ 115{
114 int num_quads = num_online_nodes(); 116 int num_quads = num_online_nodes();
diff --git a/include/asm-x86/mach-voyager/do_timer.h b/include/asm-x86/mach-voyager/do_timer.h
index bc2b58926308..9e5a459fd15b 100644
--- a/include/asm-x86/mach-voyager/do_timer.h
+++ b/include/asm-x86/mach-voyager/do_timer.h
@@ -6,7 +6,6 @@
6 6
7/** 7/**
8 * do_timer_interrupt_hook - hook into timer tick 8 * do_timer_interrupt_hook - hook into timer tick
9 * @regs: standard registers from interrupt
10 * 9 *
11 * Call the pit clock event handler. see asm/i8253.h 10 * Call the pit clock event handler. see asm/i8253.h
12 **/ 11 **/
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index 204a8a30fecf..3ca29ebebbb1 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -57,10 +57,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
57 ".section .fixup,\"ax\"\n\t" 57 ".section .fixup,\"ax\"\n\t"
58 "3: mov %3,%0 ; jmp 1b\n\t" 58 "3: mov %3,%0 ; jmp 1b\n\t"
59 ".previous\n\t" 59 ".previous\n\t"
60 ".section __ex_table,\"a\"\n" 60 _ASM_EXTABLE(2b,3b)
61 _ASM_ALIGN "\n\t"
62 _ASM_PTR " 2b,3b\n\t"
63 ".previous"
64 : "=r" (*err), EAX_EDX_RET(val, low, high) 61 : "=r" (*err), EAX_EDX_RET(val, low, high)
65 : "c" (msr), "i" (-EFAULT)); 62 : "c" (msr), "i" (-EFAULT));
66 return EAX_EDX_VAL(val, low, high); 63 return EAX_EDX_VAL(val, low, high);
@@ -81,10 +78,7 @@ static inline int native_write_msr_safe(unsigned int msr,
81 ".section .fixup,\"ax\"\n\t" 78 ".section .fixup,\"ax\"\n\t"
82 "3: mov %4,%0 ; jmp 1b\n\t" 79 "3: mov %4,%0 ; jmp 1b\n\t"
83 ".previous\n\t" 80 ".previous\n\t"
84 ".section __ex_table,\"a\"\n" 81 _ASM_EXTABLE(2b,3b)
85 _ASM_ALIGN "\n\t"
86 _ASM_PTR " 2b,3b\n\t"
87 ".previous"
88 : "=a" (err) 82 : "=a" (err)
89 : "c" (msr), "0" (low), "d" (high), 83 : "c" (msr), "0" (low), "d" (high),
90 "i" (-EFAULT)); 84 "i" (-EFAULT));
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index c8b30efeed85..1cb7c51bc296 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -13,8 +13,8 @@
13#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) 13#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK)
14#define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK)) 14#define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK))
15 15
16#define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT) 16#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
17#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) 17#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
18 18
19#define HPAGE_SHIFT PMD_SHIFT 19#define HPAGE_SHIFT PMD_SHIFT
20#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 20#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
index c1ac42d8707f..dcf0c0746075 100644
--- a/include/asm-x86/page_64.h
+++ b/include/asm-x86/page_64.h
@@ -23,6 +23,9 @@
23#define MCE_STACK 5 23#define MCE_STACK 5
24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ 24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
25 25
26#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
27#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
28
26#define __PAGE_OFFSET _AC(0xffff810000000000, UL) 29#define __PAGE_OFFSET _AC(0xffff810000000000, UL)
27 30
28#define __PHYSICAL_START CONFIG_PHYSICAL_START 31#define __PHYSICAL_START CONFIG_PHYSICAL_START
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h
index 10c2b452e64c..bab12718a913 100644
--- a/include/asm-x86/pgalloc_32.h
+++ b/include/asm-x86/pgalloc_32.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/threads.h> 4#include <linux/threads.h>
5#include <linux/mm.h> /* for struct page */ 5#include <linux/mm.h> /* for struct page */
6#include <linux/pagemap.h>
6#include <asm/tlb.h> 7#include <asm/tlb.h>
7#include <asm-generic/tlb.h> 8#include <asm-generic/tlb.h>
8 9
@@ -35,27 +36,23 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
35 * Allocate and free page tables. 36 * Allocate and free page tables.
36 */ 37 */
37extern pgd_t *pgd_alloc(struct mm_struct *); 38extern pgd_t *pgd_alloc(struct mm_struct *);
38extern void pgd_free(pgd_t *pgd); 39extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
39 40
40extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); 41extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
41extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); 42extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
42 43
43static inline void pte_free_kernel(pte_t *pte) 44static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
44{ 45{
45 free_page((unsigned long)pte); 46 free_page((unsigned long)pte);
46} 47}
47 48
48static inline void pte_free(struct page *pte) 49static inline void pte_free(struct mm_struct *mm, struct page *pte)
49{ 50{
50 __free_page(pte); 51 __free_page(pte);
51} 52}
52 53
53 54
54static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte) 55extern void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte);
55{
56 paravirt_release_pt(page_to_pfn(pte));
57 tlb_remove_page(tlb, pte);
58}
59 56
60#ifdef CONFIG_X86_PAE 57#ifdef CONFIG_X86_PAE
61/* 58/*
@@ -66,24 +63,13 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
66 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 63 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
67} 64}
68 65
69static inline void pmd_free(pmd_t *pmd) 66static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
70{ 67{
71 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 68 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
72 free_page((unsigned long)pmd); 69 free_page((unsigned long)pmd);
73} 70}
74 71
75static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) 72extern void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd);
76{
77 /* This is called just after the pmd has been detached from
78 the pgd, which requires a full tlb flush to be recognized
79 by the CPU. Rather than incurring multiple tlb flushes
80 while the address space is being pulled down, make the tlb
81 gathering machinery do a full flush when we're done. */
82 tlb->fullmm = 1;
83
84 paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
85 tlb_remove_page(tlb, virt_to_page(pmd));
86}
87 73
88static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) 74static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
89{ 75{
@@ -94,8 +80,10 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
94 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT)); 80 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
95 81
96 /* 82 /*
97 * Pentium-II erratum A13: in PAE mode we explicitly have to flush 83 * According to Intel App note "TLBs, Paging-Structure Caches,
98 * the TLB via cr3 if the top-level pgd is changed... 84 * and Their Invalidation", April 2007, document 317080-001,
85 * section 8.1: in PAE mode we explicitly have to flush the
86 * TLB via cr3 if the top-level pgd is changed...
99 */ 87 */
100 if (mm == current->active_mm) 88 if (mm == current->active_mm)
101 write_cr3(read_cr3()); 89 write_cr3(read_cr3());
diff --git a/include/asm-x86/pgalloc_64.h b/include/asm-x86/pgalloc_64.h
index 8bb564687860..315314ce4bfb 100644
--- a/include/asm-x86/pgalloc_64.h
+++ b/include/asm-x86/pgalloc_64.h
@@ -17,7 +17,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
17 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); 17 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
18} 18}
19 19
20static inline void pmd_free(pmd_t *pmd) 20static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
21{ 21{
22 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 22 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
23 free_page((unsigned long)pmd); 23 free_page((unsigned long)pmd);
@@ -33,7 +33,7 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
33 return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 33 return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
34} 34}
35 35
36static inline void pud_free (pud_t *pud) 36static inline void pud_free(struct mm_struct *mm, pud_t *pud)
37{ 37{
38 BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); 38 BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
39 free_page((unsigned long)pud); 39 free_page((unsigned long)pud);
@@ -77,7 +77,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
77 return pgd; 77 return pgd;
78} 78}
79 79
80static inline void pgd_free(pgd_t *pgd) 80static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
81{ 81{
82 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1)); 82 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
83 pgd_list_del(pgd); 83 pgd_list_del(pgd);
@@ -100,13 +100,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add
100/* Should really implement gc for free page table pages. This could be 100/* Should really implement gc for free page table pages. This could be
101 done with a reference count in struct page. */ 101 done with a reference count in struct page. */
102 102
103static inline void pte_free_kernel(pte_t *pte) 103static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
104{ 104{
105 BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); 105 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
106 free_page((unsigned long)pte); 106 free_page((unsigned long)pte);
107} 107}
108 108
109static inline void pte_free(struct page *pte) 109static inline void pte_free(struct mm_struct *mm, struct page *pte)
110{ 110{
111 __free_page(pte); 111 __free_page(pte);
112} 112}
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h
index a195c3e757b9..1d763eec740f 100644
--- a/include/asm-x86/pgtable-3level.h
+++ b/include/asm-x86/pgtable-3level.h
@@ -93,26 +93,22 @@ static inline void native_pmd_clear(pmd_t *pmd)
93 93
94static inline void pud_clear(pud_t *pudp) 94static inline void pud_clear(pud_t *pudp)
95{ 95{
96 unsigned long pgd;
97
96 set_pud(pudp, __pud(0)); 98 set_pud(pudp, __pud(0));
97 99
98 /* 100 /*
99 * In principle we need to do a cr3 reload here to make sure 101 * According to Intel App note "TLBs, Paging-Structure Caches,
100 * the processor recognizes the changed pgd. In practice, all 102 * and Their Invalidation", April 2007, document 317080-001,
101 * the places where pud_clear() gets called are followed by 103 * section 8.1: in PAE mode we explicitly have to flush the
102 * full tlb flushes anyway, so we can defer the cost here. 104 * TLB via cr3 if the top-level pgd is changed...
103 *
104 * Specifically:
105 *
106 * mm/memory.c:free_pmd_range() - immediately after the
107 * pud_clear() it does a pmd_free_tlb(). We change the
108 * mmu_gather structure to do a full tlb flush (which has the
109 * effect of reloading cr3) when the pagetable free is
110 * complete.
111 * 105 *
112 * arch/x86/mm/hugetlbpage.c:huge_pmd_unshare() - the call to 106 * Make sure the pud entry we're updating is within the
113 * this is followed by a flush_tlb_range, which on x86 does a 107 * current pgd to avoid unnecessary TLB flushes.
114 * full tlb flush.
115 */ 108 */
109 pgd = read_cr3();
110 if (__pa(pudp) >= pgd && __pa(pudp) < (pgd + sizeof(pgd_t)*PTRS_PER_PGD))
111 write_cr3(pgd);
116} 112}
117 113
118#define pud_page(pud) \ 114#define pud_page(pud) \
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index cd2524f07452..44c0a4f1b1eb 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -13,10 +13,12 @@
13#define _PAGE_BIT_DIRTY 6 13#define _PAGE_BIT_DIRTY 6
14#define _PAGE_BIT_FILE 6 14#define _PAGE_BIT_FILE 6
15#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ 15#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */
16#define _PAGE_BIT_PAT 7 /* on 4KB pages */
16#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ 17#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */
17#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ 18#define _PAGE_BIT_UNUSED1 9 /* available for programmer */
18#define _PAGE_BIT_UNUSED2 10 19#define _PAGE_BIT_UNUSED2 10
19#define _PAGE_BIT_UNUSED3 11 20#define _PAGE_BIT_UNUSED3 11
21#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
20#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ 22#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
21 23
22/* 24/*
@@ -36,6 +38,8 @@
36#define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1) 38#define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1)
37#define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2) 39#define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2)
38#define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3) 40#define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3)
41#define _PAGE_PAT (_AC(1, L)<<_PAGE_BIT_PAT)
42#define _PAGE_PAT_LARGE (_AC(1, L)<<_PAGE_BIT_PAT_LARGE)
39 43
40#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 44#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
41#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX) 45#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX)
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index 21e70fbf1dae..80dd438642f6 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -66,6 +66,14 @@ void paging_init(void);
66#define VMALLOC_OFFSET (8*1024*1024) 66#define VMALLOC_OFFSET (8*1024*1024)
67#define VMALLOC_START (((unsigned long) high_memory + \ 67#define VMALLOC_START (((unsigned long) high_memory + \
68 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1)) 68 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1))
69#ifdef CONFIG_X86_PAE
70#define LAST_PKMAP 512
71#else
72#define LAST_PKMAP 1024
73#endif
74
75#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
76
69#ifdef CONFIG_HIGHMEM 77#ifdef CONFIG_HIGHMEM
70# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) 78# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
71#else 79#else
@@ -148,6 +156,8 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
148 */ 156 */
149#define pgd_offset_k(address) pgd_offset(&init_mm, address) 157#define pgd_offset_k(address) pgd_offset(&init_mm, address)
150 158
159static inline int pud_large(pud_t pud) { return 0; }
160
151/* 161/*
152 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] 162 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
153 * 163 *
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index 6e615a103c2f..bd4740a60f29 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -21,7 +21,6 @@ extern pgd_t init_level4_pgt[];
21#define swapper_pg_dir init_level4_pgt 21#define swapper_pg_dir init_level4_pgt
22 22
23extern void paging_init(void); 23extern void paging_init(void);
24extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
25 24
26#endif /* !__ASSEMBLY__ */ 25#endif /* !__ASSEMBLY__ */
27 26
@@ -199,6 +198,12 @@ static inline unsigned long pmd_bad(pmd_t pmd)
199#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) 198#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address))
200#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) 199#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT)
201 200
201static inline int pud_large(pud_t pte)
202{
203 return (pud_val(pte) & (_PAGE_PSE|_PAGE_PRESENT)) ==
204 (_PAGE_PSE|_PAGE_PRESENT);
205}
206
202/* PMD - Level 2 access */ 207/* PMD - Level 2 access */
203#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) 208#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
204#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 209#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
diff --git a/include/asm-x86/socket.h b/include/asm-x86/socket.h
index 99ca648b94c5..80af9c4ccad7 100644
--- a/include/asm-x86/socket.h
+++ b/include/asm-x86/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86/string_32.h b/include/asm-x86/string_32.h
index 55bfa308f900..c5d13a86dea7 100644
--- a/include/asm-x86/string_32.h
+++ b/include/asm-x86/string_32.h
@@ -213,14 +213,14 @@ static __always_inline void * __constant_c_and_count_memset(void * s, unsigned l
213 case 0: 213 case 0:
214 return s; 214 return s;
215 case 1: 215 case 1:
216 *(unsigned char *)s = pattern; 216 *(unsigned char *)s = pattern & 0xff;
217 return s; 217 return s;
218 case 2: 218 case 2:
219 *(unsigned short *)s = pattern; 219 *(unsigned short *)s = pattern & 0xffff;
220 return s; 220 return s;
221 case 3: 221 case 3:
222 *(unsigned short *)s = pattern; 222 *(unsigned short *)s = pattern & 0xffff;
223 *(2+(unsigned char *)s) = pattern; 223 *(2+(unsigned char *)s) = pattern & 0xff;
224 return s; 224 return s;
225 case 4: 225 case 4:
226 *(unsigned long *)s = pattern; 226 *(unsigned long *)s = pattern;
diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h
index ee32ef9367f4..9cff02ffe6c2 100644
--- a/include/asm-x86/system.h
+++ b/include/asm-x86/system.h
@@ -20,8 +20,8 @@
20#ifdef CONFIG_X86_32 20#ifdef CONFIG_X86_32
21 21
22struct task_struct; /* one of the stranger aspects of C forward declarations */ 22struct task_struct; /* one of the stranger aspects of C forward declarations */
23extern struct task_struct *FASTCALL(__switch_to(struct task_struct *prev, 23struct task_struct *__switch_to(struct task_struct *prev,
24 struct task_struct *next)); 24 struct task_struct *next);
25 25
26/* 26/*
27 * Saving eflags is important. It switches not only IOPL between tasks, 27 * Saving eflags is important. It switches not only IOPL between tasks,
@@ -130,10 +130,7 @@ extern void load_gs_index(unsigned);
130 "movl %k1, %%" #seg "\n\t" \ 130 "movl %k1, %%" #seg "\n\t" \
131 "jmp 2b\n" \ 131 "jmp 2b\n" \
132 ".previous\n" \ 132 ".previous\n" \
133 ".section __ex_table,\"a\"\n\t" \ 133 _ASM_EXTABLE(1b,3b) \
134 _ASM_ALIGN "\n\t" \
135 _ASM_PTR " 1b,3b\n" \
136 ".previous" \
137 : :"r" (value), "r" (0)) 134 : :"r" (value), "r" (0))
138 135
139 136
@@ -214,12 +211,10 @@ static inline unsigned long native_read_cr4_safe(void)
214 /* This could fault if %cr4 does not exist. In x86_64, a cr4 always 211 /* This could fault if %cr4 does not exist. In x86_64, a cr4 always
215 * exists, so it will never fail. */ 212 * exists, so it will never fail. */
216#ifdef CONFIG_X86_32 213#ifdef CONFIG_X86_32
217 asm volatile("1: mov %%cr4, %0 \n" 214 asm volatile("1: mov %%cr4, %0\n"
218 "2: \n" 215 "2:\n"
219 ".section __ex_table,\"a\" \n" 216 _ASM_EXTABLE(1b,2b)
220 ".long 1b,2b \n" 217 : "=r" (val), "=m" (__force_order) : "0" (0));
221 ".previous \n"
222 : "=r" (val), "=m" (__force_order) : "0" (0));
223#else 218#else
224 val = native_read_cr4(); 219 val = native_read_cr4();
225#endif 220#endif
@@ -276,9 +271,9 @@ static inline void native_wbinvd(void)
276 271
277#endif /* __KERNEL__ */ 272#endif /* __KERNEL__ */
278 273
279static inline void clflush(void *__p) 274static inline void clflush(volatile void *__p)
280{ 275{
281 asm volatile("clflush %0" : "+m" (*(char __force *)__p)); 276 asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p));
282} 277}
283 278
284#define nop() __asm__ __volatile__ ("nop") 279#define nop() __asm__ __volatile__ ("nop")
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index 9b531ea015a8..6c9b214b8fc3 100644
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -123,8 +123,8 @@ static inline struct thread_info *stack_thread_info(void)
123#define TIF_FREEZE 23 /* is freezing for suspend */ 123#define TIF_FREEZE 23 /* is freezing for suspend */
124#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ 124#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */
125#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */ 125#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */
126#define TIF_DS_AREA_MSR 25 /* uses thread_struct.ds_area_msr */ 126#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */
127#define TIF_BTS_TRACE_TS 26 /* record scheduling event timestamps */ 127#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */
128 128
129#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 129#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
130#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 130#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
diff --git a/include/asm-x86/uaccess_32.h b/include/asm-x86/uaccess_32.h
index d2a4f7be9c2c..fcc570ec4fee 100644
--- a/include/asm-x86/uaccess_32.h
+++ b/include/asm-x86/uaccess_32.h
@@ -8,6 +8,7 @@
8#include <linux/thread_info.h> 8#include <linux/thread_info.h>
9#include <linux/prefetch.h> 9#include <linux/prefetch.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <asm/asm.h>
11#include <asm/page.h> 12#include <asm/page.h>
12 13
13#define VERIFY_READ 0 14#define VERIFY_READ 0
@@ -287,11 +288,8 @@ extern void __put_user_8(void);
287 "4: movl %3,%0\n" \ 288 "4: movl %3,%0\n" \
288 " jmp 3b\n" \ 289 " jmp 3b\n" \
289 ".previous\n" \ 290 ".previous\n" \
290 ".section __ex_table,\"a\"\n" \ 291 _ASM_EXTABLE(1b,4b) \
291 " .align 4\n" \ 292 _ASM_EXTABLE(2b,4b) \
292 " .long 1b,4b\n" \
293 " .long 2b,4b\n" \
294 ".previous" \
295 : "=r"(err) \ 293 : "=r"(err) \
296 : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err)) 294 : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err))
297 295
@@ -338,10 +336,7 @@ struct __large_struct { unsigned long buf[100]; };
338 "3: movl %3,%0\n" \ 336 "3: movl %3,%0\n" \
339 " jmp 2b\n" \ 337 " jmp 2b\n" \
340 ".previous\n" \ 338 ".previous\n" \
341 ".section __ex_table,\"a\"\n" \ 339 _ASM_EXTABLE(1b,3b) \
342 " .align 4\n" \
343 " .long 1b,3b\n" \
344 ".previous" \
345 : "=r"(err) \ 340 : "=r"(err) \
346 : ltype (x), "m"(__m(addr)), "i"(errret), "0"(err)) 341 : ltype (x), "m"(__m(addr)), "i"(errret), "0"(err))
347 342
@@ -378,10 +373,7 @@ do { \
378 " xor"itype" %"rtype"1,%"rtype"1\n" \ 373 " xor"itype" %"rtype"1,%"rtype"1\n" \
379 " jmp 2b\n" \ 374 " jmp 2b\n" \
380 ".previous\n" \ 375 ".previous\n" \
381 ".section __ex_table,\"a\"\n" \ 376 _ASM_EXTABLE(1b,3b) \
382 " .align 4\n" \
383 " .long 1b,3b\n" \
384 ".previous" \
385 : "=r"(err), ltype (x) \ 377 : "=r"(err), ltype (x) \
386 : "m"(__m(addr)), "i"(errret), "0"(err)) 378 : "m"(__m(addr)), "i"(errret), "0"(err))
387 379
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h
index 31d794702719..b87eb4ba8f9d 100644
--- a/include/asm-x86/uaccess_64.h
+++ b/include/asm-x86/uaccess_64.h
@@ -181,10 +181,7 @@ struct __large_struct { unsigned long buf[100]; };
181 "3: mov %3,%0\n" \ 181 "3: mov %3,%0\n" \
182 " jmp 2b\n" \ 182 " jmp 2b\n" \
183 ".previous\n" \ 183 ".previous\n" \
184 ".section __ex_table,\"a\"\n" \ 184 _ASM_EXTABLE(1b,3b) \
185 " .align 8\n" \
186 " .quad 1b,3b\n" \
187 ".previous" \
188 : "=r"(err) \ 185 : "=r"(err) \
189 : ltype (x), "m"(__m(addr)), "i"(errno), "0"(err)) 186 : ltype (x), "m"(__m(addr)), "i"(errno), "0"(err))
190 187
@@ -226,10 +223,7 @@ do { \
226 " xor"itype" %"rtype"1,%"rtype"1\n" \ 223 " xor"itype" %"rtype"1,%"rtype"1\n" \
227 " jmp 2b\n" \ 224 " jmp 2b\n" \
228 ".previous\n" \ 225 ".previous\n" \
229 ".section __ex_table,\"a\"\n" \ 226 _ASM_EXTABLE(1b,3b) \
230 " .align 8\n" \
231 " .quad 1b,3b\n" \
232 ".previous" \
233 : "=r"(err), ltype (x) \ 227 : "=r"(err), ltype (x) \
234 : "m"(__m(addr)), "i"(errno), "0"(err)) 228 : "m"(__m(addr)), "i"(errno), "0"(err))
235 229
diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h
index 8d8f9b5adbb9..984123a68f7c 100644
--- a/include/asm-x86/unistd_32.h
+++ b/include/asm-x86/unistd_32.h
@@ -327,9 +327,11 @@
327#define __NR_epoll_pwait 319 327#define __NR_epoll_pwait 319
328#define __NR_utimensat 320 328#define __NR_utimensat 320
329#define __NR_signalfd 321 329#define __NR_signalfd 321
330#define __NR_timerfd 322 330#define __NR_timerfd_create 322
331#define __NR_eventfd 323 331#define __NR_eventfd 323
332#define __NR_fallocate 324 332#define __NR_fallocate 324
333#define __NR_timerfd_settime 325
334#define __NR_timerfd_gettime 326
333 335
334#ifdef __KERNEL__ 336#ifdef __KERNEL__
335 337
diff --git a/include/asm-x86/unistd_64.h b/include/asm-x86/unistd_64.h
index 5ff4d3e24c34..3883ceb54ef5 100644
--- a/include/asm-x86/unistd_64.h
+++ b/include/asm-x86/unistd_64.h
@@ -629,12 +629,17 @@ __SYSCALL(__NR_utimensat, sys_utimensat)
629__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) 629__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
630#define __NR_signalfd 282 630#define __NR_signalfd 282
631__SYSCALL(__NR_signalfd, sys_signalfd) 631__SYSCALL(__NR_signalfd, sys_signalfd)
632#define __NR_timerfd 283 632#define __NR_timerfd_create 283
633__SYSCALL(__NR_timerfd, sys_timerfd) 633__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
634#define __NR_eventfd 284 634#define __NR_eventfd 284
635__SYSCALL(__NR_eventfd, sys_eventfd) 635__SYSCALL(__NR_eventfd, sys_eventfd)
636#define __NR_fallocate 285 636#define __NR_fallocate 285
637__SYSCALL(__NR_fallocate, sys_fallocate) 637__SYSCALL(__NR_fallocate, sys_fallocate)
638#define __NR_timerfd_settime 286
639__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
640#define __NR_timerfd_gettime 287
641__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
642
638 643
639#ifndef __NO_STUBS 644#ifndef __NO_STUBS
640#define __ARCH_WANT_OLD_READDIR 645#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-x86/vm86.h b/include/asm-x86/vm86.h
index a5edf517b992..c92fe4af52e8 100644
--- a/include/asm-x86/vm86.h
+++ b/include/asm-x86/vm86.h
@@ -195,6 +195,7 @@ struct kernel_vm86_struct {
195 195
196void handle_vm86_fault(struct kernel_vm86_regs *, long); 196void handle_vm86_fault(struct kernel_vm86_regs *, long);
197int handle_vm86_trap(struct kernel_vm86_regs *, long, int); 197int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
198struct pt_regs *save_v86_state(struct kernel_vm86_regs *);
198 199
199struct task_struct; 200struct task_struct;
200void release_vm86_irqs(struct task_struct *); 201void release_vm86_irqs(struct task_struct *);
diff --git a/include/asm-xtensa/pgalloc.h b/include/asm-xtensa/pgalloc.h
index 3e5b56525102..1d51ba5463f9 100644
--- a/include/asm-xtensa/pgalloc.h
+++ b/include/asm-xtensa/pgalloc.h
@@ -31,7 +31,7 @@ pgd_alloc(struct mm_struct *mm)
31 return (pgd_t*) __get_free_pages(GFP_KERNEL | __GFP_ZERO, PGD_ORDER); 31 return (pgd_t*) __get_free_pages(GFP_KERNEL | __GFP_ZERO, PGD_ORDER);
32} 32}
33 33
34static inline void pgd_free(pgd_t *pgd) 34static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
35{ 35{
36 free_page((unsigned long)pgd); 36 free_page((unsigned long)pgd);
37} 37}
@@ -52,12 +52,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
52 return virt_to_page(pte_alloc_one_kernel(mm, addr)); 52 return virt_to_page(pte_alloc_one_kernel(mm, addr));
53} 53}
54 54
55static inline void pte_free_kernel(pte_t *pte) 55static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
56{ 56{
57 kmem_cache_free(pgtable_cache, pte); 57 kmem_cache_free(pgtable_cache, pte);
58} 58}
59 59
60static inline void pte_free(struct page *page) 60static inline void pte_free(struct mm_struct *mm, struct page *page)
61{ 61{
62 kmem_cache_free(pgtable_cache, page_address(page)); 62 kmem_cache_free(pgtable_cache, page_address(page));
63} 63}
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index 1f5aeacb9da2..6100682b1da2 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -63,4 +63,6 @@
63#define SO_TIMESTAMPNS 35 63#define SO_TIMESTAMPNS 35
64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
65 65
66#define SO_MARK 36
67
66#endif /* _XTENSA_SOCKET_H */ 68#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-xtensa/tlb.h b/include/asm-xtensa/tlb.h
index 4830232017af..31c220faca02 100644
--- a/include/asm-xtensa/tlb.h
+++ b/include/asm-xtensa/tlb.h
@@ -42,6 +42,6 @@
42 42
43#include <asm-generic/tlb.h> 43#include <asm-generic/tlb.h>
44 44
45#define __pte_free_tlb(tlb,pte) pte_free(pte) 45#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
46 46
47#endif /* _XTENSA_TLB_H */ 47#endif /* _XTENSA_TLB_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 85b2482cc736..93631229fd5c 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -143,6 +143,7 @@ header-y += snmp.h
143header-y += sockios.h 143header-y += sockios.h
144header-y += som.h 144header-y += som.h
145header-y += sound.h 145header-y += sound.h
146header-y += suspend_ioctls.h
146header-y += taskstats.h 147header-y += taskstats.h
147header-y += telephony.h 148header-y += telephony.h
148header-y += termios.h 149header-y += termios.h
@@ -218,6 +219,7 @@ unifdef-y += i2c-dev.h
218unifdef-y += icmp.h 219unifdef-y += icmp.h
219unifdef-y += icmpv6.h 220unifdef-y += icmpv6.h
220unifdef-y += if_addr.h 221unifdef-y += if_addr.h
222unifdef-y += if_addrlabel.h
221unifdef-y += if_arp.h 223unifdef-y += if_arp.h
222unifdef-y += if_bridge.h 224unifdef-y += if_bridge.h
223unifdef-y += if_ec.h 225unifdef-y += if_ec.h
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index abc521cfb084..03e34547d489 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -109,6 +109,7 @@ extern int agp_unbind_memory(struct agp_memory *);
109extern void agp_enable(struct agp_bridge_data *, u32); 109extern void agp_enable(struct agp_bridge_data *, u32);
110extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); 110extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
111extern void agp_backend_release(struct agp_bridge_data *); 111extern void agp_backend_release(struct agp_bridge_data *);
112extern void agp_flush_chipset(struct agp_bridge_data *);
112 113
113#endif /* __KERNEL__ */ 114#endif /* __KERNEL__ */
114#endif /* _AGP_BACKEND_H */ 115#endif /* _AGP_BACKEND_H */
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 09fbf7e5a6cb..62aef589eb94 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -38,6 +38,7 @@
38#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) 38#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) 39#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
40#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) 40#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
41#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
41 42
42#define AGP_DEVICE "/dev/agpgart" 43#define AGP_DEVICE "/dev/agpgart"
43 44
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
new file mode 100644
index 000000000000..fd6833764d72
--- /dev/null
+++ b/include/linux/atmel_serial.h
@@ -0,0 +1,127 @@
1/*
2 * include/linux/atmel_serial.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USART registers.
8 * Based on AT91RM9200 datasheet revision E.
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
16#ifndef ATMEL_SERIAL_H
17#define ATMEL_SERIAL_H
18
19#define ATMEL_US_CR 0x00 /* Control Register */
20#define ATMEL_US_RSTRX (1 << 2) /* Reset Receiver */
21#define ATMEL_US_RSTTX (1 << 3) /* Reset Transmitter */
22#define ATMEL_US_RXEN (1 << 4) /* Receiver Enable */
23#define ATMEL_US_RXDIS (1 << 5) /* Receiver Disable */
24#define ATMEL_US_TXEN (1 << 6) /* Transmitter Enable */
25#define ATMEL_US_TXDIS (1 << 7) /* Transmitter Disable */
26#define ATMEL_US_RSTSTA (1 << 8) /* Reset Status Bits */
27#define ATMEL_US_STTBRK (1 << 9) /* Start Break */
28#define ATMEL_US_STPBRK (1 << 10) /* Stop Break */
29#define ATMEL_US_STTTO (1 << 11) /* Start Time-out */
30#define ATMEL_US_SENDA (1 << 12) /* Send Address */
31#define ATMEL_US_RSTIT (1 << 13) /* Reset Iterations */
32#define ATMEL_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */
33#define ATMEL_US_RETTO (1 << 15) /* Rearm Time-out */
34#define ATMEL_US_DTREN (1 << 16) /* Data Terminal Ready Enable [AT91RM9200 only] */
35#define ATMEL_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable [AT91RM9200 only] */
36#define ATMEL_US_RTSEN (1 << 18) /* Request To Send Enable */
37#define ATMEL_US_RTSDIS (1 << 19) /* Request To Send Disable */
38
39#define ATMEL_US_MR 0x04 /* Mode Register */
40#define ATMEL_US_USMODE (0xf << 0) /* Mode of the USART */
41#define ATMEL_US_USMODE_NORMAL 0
42#define ATMEL_US_USMODE_RS485 1
43#define ATMEL_US_USMODE_HWHS 2
44#define ATMEL_US_USMODE_MODEM 3
45#define ATMEL_US_USMODE_ISO7816_T0 4
46#define ATMEL_US_USMODE_ISO7816_T1 6
47#define ATMEL_US_USMODE_IRDA 8
48#define ATMEL_US_USCLKS (3 << 4) /* Clock Selection */
49#define ATMEL_US_USCLKS_MCK (0 << 4)
50#define ATMEL_US_USCLKS_MCK_DIV8 (1 << 4)
51#define ATMEL_US_USCLKS_SCK (3 << 4)
52#define ATMEL_US_CHRL (3 << 6) /* Character Length */
53#define ATMEL_US_CHRL_5 (0 << 6)
54#define ATMEL_US_CHRL_6 (1 << 6)
55#define ATMEL_US_CHRL_7 (2 << 6)
56#define ATMEL_US_CHRL_8 (3 << 6)
57#define ATMEL_US_SYNC (1 << 8) /* Synchronous Mode Select */
58#define ATMEL_US_PAR (7 << 9) /* Parity Type */
59#define ATMEL_US_PAR_EVEN (0 << 9)
60#define ATMEL_US_PAR_ODD (1 << 9)
61#define ATMEL_US_PAR_SPACE (2 << 9)
62#define ATMEL_US_PAR_MARK (3 << 9)
63#define ATMEL_US_PAR_NONE (4 << 9)
64#define ATMEL_US_PAR_MULTI_DROP (6 << 9)
65#define ATMEL_US_NBSTOP (3 << 12) /* Number of Stop Bits */
66#define ATMEL_US_NBSTOP_1 (0 << 12)
67#define ATMEL_US_NBSTOP_1_5 (1 << 12)
68#define ATMEL_US_NBSTOP_2 (2 << 12)
69#define ATMEL_US_CHMODE (3 << 14) /* Channel Mode */
70#define ATMEL_US_CHMODE_NORMAL (0 << 14)
71#define ATMEL_US_CHMODE_ECHO (1 << 14)
72#define ATMEL_US_CHMODE_LOC_LOOP (2 << 14)
73#define ATMEL_US_CHMODE_REM_LOOP (3 << 14)
74#define ATMEL_US_MSBF (1 << 16) /* Bit Order */
75#define ATMEL_US_MODE9 (1 << 17) /* 9-bit Character Length */
76#define ATMEL_US_CLKO (1 << 18) /* Clock Output Select */
77#define ATMEL_US_OVER (1 << 19) /* Oversampling Mode */
78#define ATMEL_US_INACK (1 << 20) /* Inhibit Non Acknowledge */
79#define ATMEL_US_DSNACK (1 << 21) /* Disable Successive NACK */
80#define ATMEL_US_MAX_ITER (7 << 24) /* Max Iterations */
81#define ATMEL_US_FILTER (1 << 28) /* Infrared Receive Line Filter */
82
83#define ATMEL_US_IER 0x08 /* Interrupt Enable Register */
84#define ATMEL_US_RXRDY (1 << 0) /* Receiver Ready */
85#define ATMEL_US_TXRDY (1 << 1) /* Transmitter Ready */
86#define ATMEL_US_RXBRK (1 << 2) /* Break Received / End of Break */
87#define ATMEL_US_ENDRX (1 << 3) /* End of Receiver Transfer */
88#define ATMEL_US_ENDTX (1 << 4) /* End of Transmitter Transfer */
89#define ATMEL_US_OVRE (1 << 5) /* Overrun Error */
90#define ATMEL_US_FRAME (1 << 6) /* Framing Error */
91#define ATMEL_US_PARE (1 << 7) /* Parity Error */
92#define ATMEL_US_TIMEOUT (1 << 8) /* Receiver Time-out */
93#define ATMEL_US_TXEMPTY (1 << 9) /* Transmitter Empty */
94#define ATMEL_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */
95#define ATMEL_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */
96#define ATMEL_US_RXBUFF (1 << 12) /* Reception Buffer Full */
97#define ATMEL_US_NACK (1 << 13) /* Non Acknowledge */
98#define ATMEL_US_RIIC (1 << 16) /* Ring Indicator Input Change [AT91RM9200 only] */
99#define ATMEL_US_DSRIC (1 << 17) /* Data Set Ready Input Change [AT91RM9200 only] */
100#define ATMEL_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change [AT91RM9200 only] */
101#define ATMEL_US_CTSIC (1 << 19) /* Clear to Send Input Change */
102#define ATMEL_US_RI (1 << 20) /* RI */
103#define ATMEL_US_DSR (1 << 21) /* DSR */
104#define ATMEL_US_DCD (1 << 22) /* DCD */
105#define ATMEL_US_CTS (1 << 23) /* CTS */
106
107#define ATMEL_US_IDR 0x0c /* Interrupt Disable Register */
108#define ATMEL_US_IMR 0x10 /* Interrupt Mask Register */
109#define ATMEL_US_CSR 0x14 /* Channel Status Register */
110#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */
111#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */
112#define ATMEL_US_SYNH (1 << 15) /* Transmit/Receive Sync [AT91SAM9261 only] */
113
114#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */
115#define ATMEL_US_CD (0xffff << 0) /* Clock Divider */
116
117#define ATMEL_US_RTOR 0x24 /* Receiver Time-out Register */
118#define ATMEL_US_TO (0xffff << 0) /* Time-out Value */
119
120#define ATMEL_US_TTGR 0x28 /* Transmitter Timeguard Register */
121#define ATMEL_US_TG (0xff << 0) /* Timeguard Value */
122
123#define ATMEL_US_FIDI 0x40 /* FI DI Ratio Register */
124#define ATMEL_US_NER 0x44 /* Number of Errors Register */
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126
127#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index bdd6f5de5fc4..97153027207a 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -98,6 +98,7 @@
98#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ 98#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
99#define AUDIT_OBJ_PID 1318 /* ptrace target */ 99#define AUDIT_OBJ_PID 1318 /* ptrace target */
100#define AUDIT_TTY 1319 /* Input on an administrative TTY */ 100#define AUDIT_TTY 1319 /* Input on an administrative TTY */
101#define AUDIT_EOE 1320 /* End of multi-record event */
101 102
102#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 103#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
103#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 104#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -409,7 +410,8 @@ extern unsigned int audit_serial(void);
409extern void auditsc_get_stamp(struct audit_context *ctx, 410extern void auditsc_get_stamp(struct audit_context *ctx,
410 struct timespec *t, unsigned int *serial); 411 struct timespec *t, unsigned int *serial);
411extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 412extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
412extern uid_t audit_get_loginuid(struct audit_context *ctx); 413#define audit_get_loginuid(t) ((t)->loginuid)
414#define audit_get_sessionid(t) ((t)->sessionid)
413extern void audit_log_task_context(struct audit_buffer *ab); 415extern void audit_log_task_context(struct audit_buffer *ab);
414extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 416extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
415extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 417extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
@@ -488,7 +490,8 @@ extern int audit_signals;
488#define audit_inode_child(d,i,p) do { ; } while (0) 490#define audit_inode_child(d,i,p) do { ; } while (0)
489#define audit_core_dumps(i) do { ; } while (0) 491#define audit_core_dumps(i) do { ; } while (0)
490#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 492#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
491#define audit_get_loginuid(c) ({ -1; }) 493#define audit_get_loginuid(t) (-1)
494#define audit_get_sessionid(t) (-1)
492#define audit_log_task_context(b) do { ; } while (0) 495#define audit_log_task_context(b) do { ; } while (0)
493#define audit_ipc_obj(i) ({ 0; }) 496#define audit_ipc_obj(i) ({ 0; })
494#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 497#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
@@ -522,9 +525,11 @@ extern void audit_log_end(struct audit_buffer *ab);
522extern void audit_log_hex(struct audit_buffer *ab, 525extern void audit_log_hex(struct audit_buffer *ab,
523 const unsigned char *buf, 526 const unsigned char *buf,
524 size_t len); 527 size_t len);
525extern const char * audit_log_untrustedstring(struct audit_buffer *ab, 528extern int audit_string_contains_control(const char *string,
529 size_t len);
530extern void audit_log_untrustedstring(struct audit_buffer *ab,
526 const char *string); 531 const char *string);
527extern const char * audit_log_n_untrustedstring(struct audit_buffer *ab, 532extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
528 size_t n, 533 size_t n,
529 const char *string); 534 const char *string);
530extern void audit_log_d_path(struct audit_buffer *ab, 535extern void audit_log_d_path(struct audit_buffer *ab,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e18d4192f6e8..90392a9d7a9c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -39,7 +39,6 @@ void exit_io_context(void);
39struct io_context *get_io_context(gfp_t gfp_flags, int node); 39struct io_context *get_io_context(gfp_t gfp_flags, int node);
40struct io_context *alloc_io_context(gfp_t gfp_flags, int node); 40struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
41void copy_io_context(struct io_context **pdst, struct io_context **psrc); 41void copy_io_context(struct io_context **pdst, struct io_context **psrc);
42void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
43 42
44struct request; 43struct request;
45typedef void (rq_end_io_fn)(struct request *, int); 44typedef void (rq_end_io_fn)(struct request *, int);
@@ -655,15 +654,18 @@ static inline void blk_run_address_space(struct address_space *mapping)
655 * blk_end_request() for parts of the original function. 654 * blk_end_request() for parts of the original function.
656 * This prevents code duplication in drivers. 655 * This prevents code duplication in drivers.
657 */ 656 */
658extern int blk_end_request(struct request *rq, int error, int nr_bytes); 657extern int blk_end_request(struct request *rq, int error,
659extern int __blk_end_request(struct request *rq, int error, int nr_bytes); 658 unsigned int nr_bytes);
660extern int blk_end_bidi_request(struct request *rq, int error, int nr_bytes, 659extern int __blk_end_request(struct request *rq, int error,
661 int bidi_bytes); 660 unsigned int nr_bytes);
661extern int blk_end_bidi_request(struct request *rq, int error,
662 unsigned int nr_bytes, unsigned int bidi_bytes);
662extern void end_request(struct request *, int); 663extern void end_request(struct request *, int);
663extern void end_queued_request(struct request *, int); 664extern void end_queued_request(struct request *, int);
664extern void end_dequeued_request(struct request *, int); 665extern void end_dequeued_request(struct request *, int);
665extern int blk_end_request_callback(struct request *rq, int error, int nr_bytes, 666extern int blk_end_request_callback(struct request *rq, int error,
666 int (drv_callback)(struct request *)); 667 unsigned int nr_bytes,
668 int (drv_callback)(struct request *));
667extern void blk_complete_request(struct request *); 669extern void blk_complete_request(struct request *);
668 670
669/* 671/*
diff --git a/include/linux/capability.h b/include/linux/capability.h
index bb017edffd56..7d50ff6d269f 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -14,7 +14,6 @@
14#define _LINUX_CAPABILITY_H 14#define _LINUX_CAPABILITY_H
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/compiler.h>
18 17
19struct task_struct; 18struct task_struct;
20 19
@@ -23,13 +22,20 @@ struct task_struct;
23 kernel might be somewhat backwards compatible, but don't bet on 22 kernel might be somewhat backwards compatible, but don't bet on
24 it. */ 23 it. */
25 24
26/* XXX - Note, cap_t, is defined by POSIX to be an "opaque" pointer to 25/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
27 a set of three capability sets. The transposition of 3*the 26 a set of three capability sets. The transposition of 3*the
28 following structure to such a composite is better handled in a user 27 following structure to such a composite is better handled in a user
29 library since the draft standard requires the use of malloc/free 28 library since the draft standard requires the use of malloc/free
30 etc.. */ 29 etc.. */
31 30
32#define _LINUX_CAPABILITY_VERSION 0x19980330 31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1
33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026
35#define _LINUX_CAPABILITY_U32S_2 2
36
37#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_2
38#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_2
33 39
34typedef struct __user_cap_header_struct { 40typedef struct __user_cap_header_struct {
35 __u32 version; 41 __u32 version;
@@ -42,41 +48,42 @@ typedef struct __user_cap_data_struct {
42 __u32 inheritable; 48 __u32 inheritable;
43} __user *cap_user_data_t; 49} __user *cap_user_data_t;
44 50
51
45#define XATTR_CAPS_SUFFIX "capability" 52#define XATTR_CAPS_SUFFIX "capability"
46#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX 53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
47 54
48#define XATTR_CAPS_SZ (3*sizeof(__le32))
49#define VFS_CAP_REVISION_MASK 0xFF000000 55#define VFS_CAP_REVISION_MASK 0xFF000000
56#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
57#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
58
50#define VFS_CAP_REVISION_1 0x01000000 59#define VFS_CAP_REVISION_1 0x01000000
60#define VFS_CAP_U32_1 1
61#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
51 62
52#define VFS_CAP_REVISION VFS_CAP_REVISION_1 63#define VFS_CAP_REVISION_2 0x02000000
64#define VFS_CAP_U32_2 2
65#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
66
67#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
68#define VFS_CAP_U32 VFS_CAP_U32_2
69#define VFS_CAP_REVISION VFS_CAP_REVISION_2
53 70
54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
55#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
56 71
57struct vfs_cap_data { 72struct vfs_cap_data {
58 __u32 magic_etc; /* Little endian */ 73 __le32 magic_etc; /* Little endian */
59 __u32 permitted; /* Little endian */ 74 struct {
60 __u32 inheritable; /* Little endian */ 75 __le32 permitted; /* Little endian */
76 __le32 inheritable; /* Little endian */
77 } data[VFS_CAP_U32];
61}; 78};
62 79
63#ifdef __KERNEL__ 80#ifdef __KERNEL__
64 81
65/* #define STRICT_CAP_T_TYPECHECKS */
66
67#ifdef STRICT_CAP_T_TYPECHECKS
68
69typedef struct kernel_cap_struct { 82typedef struct kernel_cap_struct {
70 __u32 cap; 83 __u32 cap[_LINUX_CAPABILITY_U32S];
71} kernel_cap_t; 84} kernel_cap_t;
72 85
73#else 86#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
74
75typedef __u32 kernel_cap_t;
76
77#endif
78
79#define _USER_CAP_HEADER_SIZE (2*sizeof(__u32))
80#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) 87#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
81 88
82#endif 89#endif
@@ -119,10 +126,6 @@ typedef __u32 kernel_cap_t;
119 126
120#define CAP_FSETID 4 127#define CAP_FSETID 4
121 128
122/* Used to decide between falling back on the old suser() or fsuser(). */
123
124#define CAP_FS_MASK 0x1f
125
126/* Overrides the restriction that the real or effective user ID of a 129/* Overrides the restriction that the real or effective user ID of a
127 process sending a signal must match the real or effective user ID 130 process sending a signal must match the real or effective user ID
128 of the process receiving the signal. */ 131 of the process receiving the signal. */
@@ -145,8 +148,14 @@ typedef __u32 kernel_cap_t;
145 ** Linux-specific capabilities 148 ** Linux-specific capabilities
146 **/ 149 **/
147 150
148/* Transfer any capability in your permitted set to any pid, 151/* Without VFS support for capabilities:
149 remove any capability in your permitted set from any pid */ 152 * Transfer any capability in your permitted set to any pid,
153 * remove any capability in your permitted set from any pid
154 * With VFS support for capabilities (neither of above, but)
155 * Add any capability from current's capability bounding set
156 * to the current process' inheritable set
157 * Allow taking bits out of capability bounding set
158 */
150 159
151#define CAP_SETPCAP 8 160#define CAP_SETPCAP 8
152 161
@@ -195,7 +204,6 @@ typedef __u32 kernel_cap_t;
195#define CAP_IPC_OWNER 15 204#define CAP_IPC_OWNER 15
196 205
197/* Insert and remove kernel modules - modify kernel without limit */ 206/* Insert and remove kernel modules - modify kernel without limit */
198/* Modify cap_bset */
199#define CAP_SYS_MODULE 16 207#define CAP_SYS_MODULE 16
200 208
201/* Allow ioperm/iopl access */ 209/* Allow ioperm/iopl access */
@@ -307,74 +315,183 @@ typedef __u32 kernel_cap_t;
307 315
308#define CAP_SETFCAP 31 316#define CAP_SETFCAP 31
309 317
318/* Override MAC access.
319 The base kernel enforces no MAC policy.
320 An LSM may enforce a MAC policy, and if it does and it chooses
321 to implement capability based overrides of that policy, this is
322 the capability it should use to do so. */
323
324#define CAP_MAC_OVERRIDE 32
325
326/* Allow MAC configuration or state changes.
327 The base kernel requires no MAC configuration.
328 An LSM may enforce a MAC policy, and if it does and it chooses
329 to implement capability based checks on modifications to that
330 policy or the data required to maintain it, this is the
331 capability it should use to do so. */
332
333#define CAP_MAC_ADMIN 33
334
335#define CAP_LAST_CAP CAP_MAC_ADMIN
336
337#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
338
339/*
340 * Bit location of each capability (used by user-space library and kernel)
341 */
342
343#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
344#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */
345
310#ifdef __KERNEL__ 346#ifdef __KERNEL__
311 347
312/* 348/*
313 * Internal kernel functions only 349 * Internal kernel functions only
314 */ 350 */
315 351
316#ifdef STRICT_CAP_T_TYPECHECKS 352#define CAP_FOR_EACH_U32(__capi) \
353 for (__capi = 0; __capi < _LINUX_CAPABILITY_U32S; ++__capi)
354
355# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \
356 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \
357 | CAP_TO_MASK(CAP_DAC_READ_SEARCH) \
358 | CAP_TO_MASK(CAP_FOWNER) \
359 | CAP_TO_MASK(CAP_FSETID))
360
361# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE))
362
363#if _LINUX_CAPABILITY_U32S != 2
364# error Fix up hand-coded capability macro initializers
365#else /* HAND-CODED capability initializers */
366
367# define CAP_EMPTY_SET {{ 0, 0 }}
368# define CAP_FULL_SET {{ ~0, ~0 }}
369# define CAP_INIT_EFF_SET {{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }}
370# define CAP_FS_SET {{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } }
371# define CAP_NFSD_SET {{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
372 CAP_FS_MASK_B1 } }
373
374#endif /* _LINUX_CAPABILITY_U32S != 2 */
375
376#define CAP_INIT_INH_SET CAP_EMPTY_SET
377
378# define cap_clear(c) do { (c) = __cap_empty_set; } while (0)
379# define cap_set_full(c) do { (c) = __cap_full_set; } while (0)
380# define cap_set_init_eff(c) do { (c) = __cap_init_eff_set; } while (0)
381
382#define cap_raise(c, flag) ((c).cap[CAP_TO_INDEX(flag)] |= CAP_TO_MASK(flag))
383#define cap_lower(c, flag) ((c).cap[CAP_TO_INDEX(flag)] &= ~CAP_TO_MASK(flag))
384#define cap_raised(c, flag) ((c).cap[CAP_TO_INDEX(flag)] & CAP_TO_MASK(flag))
385
386#define CAP_BOP_ALL(c, a, b, OP) \
387do { \
388 unsigned __capi; \
389 CAP_FOR_EACH_U32(__capi) { \
390 c.cap[__capi] = a.cap[__capi] OP b.cap[__capi]; \
391 } \
392} while (0)
393
394#define CAP_UOP_ALL(c, a, OP) \
395do { \
396 unsigned __capi; \
397 CAP_FOR_EACH_U32(__capi) { \
398 c.cap[__capi] = OP a.cap[__capi]; \
399 } \
400} while (0)
401
402static inline kernel_cap_t cap_combine(const kernel_cap_t a,
403 const kernel_cap_t b)
404{
405 kernel_cap_t dest;
406 CAP_BOP_ALL(dest, a, b, |);
407 return dest;
408}
317 409
318#define to_cap_t(x) { x } 410static inline kernel_cap_t cap_intersect(const kernel_cap_t a,
319#define cap_t(x) (x).cap 411 const kernel_cap_t b)
412{
413 kernel_cap_t dest;
414 CAP_BOP_ALL(dest, a, b, &);
415 return dest;
416}
320 417
321#else 418static inline kernel_cap_t cap_drop(const kernel_cap_t a,
419 const kernel_cap_t drop)
420{
421 kernel_cap_t dest;
422 CAP_BOP_ALL(dest, a, drop, &~);
423 return dest;
424}
322 425
323#define to_cap_t(x) (x) 426static inline kernel_cap_t cap_invert(const kernel_cap_t c)
324#define cap_t(x) (x) 427{
428 kernel_cap_t dest;
429 CAP_UOP_ALL(dest, c, ~);
430 return dest;
431}
325 432
326#endif 433static inline int cap_isclear(const kernel_cap_t a)
434{
435 unsigned __capi;
436 CAP_FOR_EACH_U32(__capi) {
437 if (a.cap[__capi] != 0)
438 return 0;
439 }
440 return 1;
441}
327 442
328#define CAP_EMPTY_SET to_cap_t(0) 443static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
329#define CAP_FULL_SET to_cap_t(~0) 444{
330#define CAP_INIT_EFF_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP)) 445 kernel_cap_t dest;
331#define CAP_INIT_INH_SET to_cap_t(0) 446 dest = cap_drop(a, set);
447 return cap_isclear(dest);
448}
332 449
333#define CAP_TO_MASK(x) (1 << (x)) 450/* Used to decide between falling back on the old suser() or fsuser(). */
334#define cap_raise(c, flag) (cap_t(c) |= CAP_TO_MASK(flag))
335#define cap_lower(c, flag) (cap_t(c) &= ~CAP_TO_MASK(flag))
336#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag))
337 451
338static inline kernel_cap_t cap_combine(kernel_cap_t a, kernel_cap_t b) 452static inline int cap_is_fs_cap(int cap)
339{ 453{
340 kernel_cap_t dest; 454 const kernel_cap_t __cap_fs_set = CAP_FS_SET;
341 cap_t(dest) = cap_t(a) | cap_t(b); 455 return !!(CAP_TO_MASK(cap) & __cap_fs_set.cap[CAP_TO_INDEX(cap)]);
342 return dest;
343} 456}
344 457
345static inline kernel_cap_t cap_intersect(kernel_cap_t a, kernel_cap_t b) 458static inline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a)
346{ 459{
347 kernel_cap_t dest; 460 const kernel_cap_t __cap_fs_set = CAP_FS_SET;
348 cap_t(dest) = cap_t(a) & cap_t(b); 461 return cap_drop(a, __cap_fs_set);
349 return dest;
350} 462}
351 463
352static inline kernel_cap_t cap_drop(kernel_cap_t a, kernel_cap_t drop) 464static inline kernel_cap_t cap_raise_fs_set(const kernel_cap_t a,
465 const kernel_cap_t permitted)
353{ 466{
354 kernel_cap_t dest; 467 const kernel_cap_t __cap_fs_set = CAP_FS_SET;
355 cap_t(dest) = cap_t(a) & ~cap_t(drop); 468 return cap_combine(a,
356 return dest; 469 cap_intersect(permitted, __cap_fs_set));
357} 470}
358 471
359static inline kernel_cap_t cap_invert(kernel_cap_t c) 472static inline kernel_cap_t cap_drop_nfsd_set(const kernel_cap_t a)
360{ 473{
361 kernel_cap_t dest; 474 const kernel_cap_t __cap_fs_set = CAP_NFSD_SET;
362 cap_t(dest) = ~cap_t(c); 475 return cap_drop(a, __cap_fs_set);
363 return dest;
364} 476}
365 477
366#define cap_isclear(c) (!cap_t(c)) 478static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
367#define cap_issubset(a,set) (!(cap_t(a) & ~cap_t(set))) 479 const kernel_cap_t permitted)
368 480{
369#define cap_clear(c) do { cap_t(c) = 0; } while(0) 481 const kernel_cap_t __cap_nfsd_set = CAP_NFSD_SET;
370#define cap_set_full(c) do { cap_t(c) = ~0; } while(0) 482 return cap_combine(a,
371#define cap_mask(c,mask) do { cap_t(c) &= cap_t(mask); } while(0) 483 cap_intersect(permitted, __cap_nfsd_set));
484}
372 485
373#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) 486extern const kernel_cap_t __cap_empty_set;
487extern const kernel_cap_t __cap_full_set;
488extern const kernel_cap_t __cap_init_eff_set;
374 489
375int capable(int cap); 490int capable(int cap);
376int __capable(struct task_struct *t, int cap); 491int __capable(struct task_struct *t, int cap);
377 492
493extern long cap_prctl_drop(unsigned long cap);
494
378#endif /* __KERNEL__ */ 495#endif /* __KERNEL__ */
379 496
380#endif /* !_LINUX_CAPABILITY_H */ 497#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index fcdc11b9609b..a5cd2047624e 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -1187,6 +1187,20 @@ struct media_event_desc {
1187 1187
1188extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med); 1188extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med);
1189 1189
1190static inline void lba_to_msf(int lba, u8 *m, u8 *s, u8 *f)
1191{
1192 lba += CD_MSF_OFFSET;
1193 lba &= 0xffffff; /* negative lbas use only 24 bits */
1194 *m = lba / (CD_SECS * CD_FRAMES);
1195 lba %= (CD_SECS * CD_FRAMES);
1196 *s = lba / CD_FRAMES;
1197 *f = lba % CD_FRAMES;
1198}
1199
1200static inline int msf_to_lba(u8 m, u8 s, u8 f)
1201{
1202 return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
1203}
1190#endif /* End of kernel only stuff */ 1204#endif /* End of kernel only stuff */
1191 1205
1192#endif /* _LINUX_CDROM_H */ 1206#endif /* _LINUX_CDROM_H */
diff --git a/include/linux/chio.h b/include/linux/chio.h
index a404c111c937..519248d8b2b6 100644
--- a/include/linux/chio.h
+++ b/include/linux/chio.h
@@ -108,7 +108,7 @@ struct changer_element_status {
108 108
109/* 109/*
110 * CHIOGELEM 110 * CHIOGELEM
111 * get more detailed status informtion for a single element 111 * get more detailed status information for a single element
112 */ 112 */
113struct changer_get_element { 113struct changer_get_element {
114 int cge_type; /* type/unit */ 114 int cge_type; /* type/unit */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index d38655f2be70..ae0a483bef9b 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -279,8 +279,11 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename,
279asmlinkage long compat_sys_signalfd(int ufd, 279asmlinkage long compat_sys_signalfd(int ufd,
280 const compat_sigset_t __user *sigmask, 280 const compat_sigset_t __user *sigmask,
281 compat_size_t sigsetsize); 281 compat_size_t sigsetsize);
282asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags, 282asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
283 const struct compat_itimerspec __user *utmr); 283 const struct compat_itimerspec __user *utmr,
284 struct compat_itimerspec __user *otmr);
285asmlinkage long compat_sys_timerfd_gettime(int ufd,
286 struct compat_itimerspec __user *otmr);
284 287
285#endif /* CONFIG_COMPAT */ 288#endif /* CONFIG_COMPAT */
286#endif /* _LINUX_COMPAT_H */ 289#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 33d6aaf94447..d2961b66d53d 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -44,6 +44,7 @@ static inline void init_completion(struct completion *x)
44 44
45extern void wait_for_completion(struct completion *); 45extern void wait_for_completion(struct completion *);
46extern int wait_for_completion_interruptible(struct completion *x); 46extern int wait_for_completion_interruptible(struct completion *x);
47extern int wait_for_completion_killable(struct completion *x);
47extern unsigned long wait_for_completion_timeout(struct completion *x, 48extern unsigned long wait_for_completion_timeout(struct completion *x,
48 unsigned long timeout); 49 unsigned long timeout);
49extern unsigned long wait_for_completion_interruptible_timeout( 50extern unsigned long wait_for_completion_interruptible_timeout(
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 8f3dcd30828f..504cb2c3fa9a 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -177,7 +177,7 @@ struct CUSTOM_REG {
177 __u32 fpga_version; /* FPGA Version Number Register */ 177 __u32 fpga_version; /* FPGA Version Number Register */
178 __u32 cpu_start; /* CPU start Register (write) */ 178 __u32 cpu_start; /* CPU start Register (write) */
179 __u32 cpu_stop; /* CPU stop Register (write) */ 179 __u32 cpu_stop; /* CPU stop Register (write) */
180 __u32 misc_reg; /* Miscelaneous Register */ 180 __u32 misc_reg; /* Miscellaneous Register */
181 __u32 idt_mode; /* IDT mode Register */ 181 __u32 idt_mode; /* IDT mode Register */
182 __u32 uart_irq_status; /* UART IRQ status Register */ 182 __u32 uart_irq_status; /* UART IRQ status Register */
183 __u32 clear_timer0_irq; /* Clear timer interrupt Register */ 183 __u32 clear_timer0_irq; /* Clear timer interrupt Register */
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
index f7a906583463..362bf19d6cf1 100644
--- a/include/linux/cycx_x25.h
+++ b/include/linux/cycx_x25.h
@@ -81,7 +81,7 @@ struct cycx_x25_cmd {
81 * @n2win - level 2 window (values: 1 thru 7) 81 * @n2win - level 2 window (values: 1 thru 7)
82 * @n3win - level 3 window (values: 1 thru 7) 82 * @n3win - level 3 window (values: 1 thru 7)
83 * @nvc - # of logical channels (values: 1 thru 64) 83 * @nvc - # of logical channels (values: 1 thru 64)
84 * @pktlen - level 3 packet lenght - log base 2 of size 84 * @pktlen - level 3 packet length - log base 2 of size
85 * @locaddr - my address 85 * @locaddr - my address
86 * @remaddr - remote address 86 * @remaddr - remote address
87 * @t1 - time, in seconds 87 * @t1 - time, in seconds
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 484e45c7c89a..aa0737019e37 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -525,6 +525,7 @@ struct dccp_sock {
525 __u64 dccps_gsr; 525 __u64 dccps_gsr;
526 __u64 dccps_gar; 526 __u64 dccps_gar;
527 __be32 dccps_service; 527 __be32 dccps_service;
528 __u32 dccps_mss_cache;
528 struct dccp_service_list *dccps_service_list; 529 struct dccp_service_list *dccps_service_list;
529 __u32 dccps_timestamp_echo; 530 __u32 dccps_timestamp_echo;
530 __u32 dccps_timestamp_time; 531 __u32 dccps_timestamp_time;
@@ -533,7 +534,6 @@ struct dccp_sock {
533 __u16 dccps_pcslen; 534 __u16 dccps_pcslen;
534 __u16 dccps_pcrlen; 535 __u16 dccps_pcrlen;
535 unsigned long dccps_ndp_count; 536 unsigned long dccps_ndp_count;
536 __u32 dccps_mss_cache;
537 unsigned long dccps_rate_last; 537 unsigned long dccps_rate_last;
538 struct dccp_minisock dccps_minisock; 538 struct dccp_minisock dccps_minisock;
539 struct dccp_ackvec *dccps_hc_rx_ackvec; 539 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/device.h b/include/linux/device.h
index db375be333c7..2258d89bf523 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -410,6 +410,15 @@ extern int devres_release_group(struct device *dev, void *id);
410extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 410extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
411extern void devm_kfree(struct device *dev, void *p); 411extern void devm_kfree(struct device *dev, void *p);
412 412
413struct device_dma_parameters {
414 /*
415 * a low level driver may set these to teach IOMMU code about
416 * sg limitations.
417 */
418 unsigned int max_segment_size;
419 unsigned long segment_boundary_mask;
420};
421
413struct device { 422struct device {
414 struct klist klist_children; 423 struct klist klist_children;
415 struct klist_node knode_parent; /* node in sibling list */ 424 struct klist_node knode_parent; /* node in sibling list */
@@ -445,6 +454,8 @@ struct device {
445 64 bit addresses for consistent 454 64 bit addresses for consistent
446 allocations such descriptors. */ 455 allocations such descriptors. */
447 456
457 struct device_dma_parameters *dma_parms;
458
448 struct list_head dma_pools; /* dma pools (if dma'ble) */ 459 struct list_head dma_pools; /* dma pools (if dma'ble) */
449 460
450 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 461 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
@@ -534,11 +545,17 @@ extern struct device *device_create(struct class *cls, struct device *parent,
534extern void device_destroy(struct class *cls, dev_t devt); 545extern void device_destroy(struct class *cls, dev_t devt);
535#ifdef CONFIG_PM_SLEEP 546#ifdef CONFIG_PM_SLEEP
536extern void destroy_suspended_device(struct class *cls, dev_t devt); 547extern void destroy_suspended_device(struct class *cls, dev_t devt);
548extern void device_pm_schedule_removal(struct device *);
537#else /* !CONFIG_PM_SLEEP */ 549#else /* !CONFIG_PM_SLEEP */
538static inline void destroy_suspended_device(struct class *cls, dev_t devt) 550static inline void destroy_suspended_device(struct class *cls, dev_t devt)
539{ 551{
540 device_destroy(cls, devt); 552 device_destroy(cls, devt);
541} 553}
554
555static inline void device_pm_schedule_removal(struct device *dev)
556{
557 device_unregister(dev);
558}
542#endif /* !CONFIG_PM_SLEEP */ 559#endif /* !CONFIG_PM_SLEEP */
543 560
544/* 561/*
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 101a2d4636be..332030709623 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_LINUX_DMA_MAPPING_H 1#ifndef _LINUX_DMA_MAPPING_H
2#define _ASM_LINUX_DMA_MAPPING_H 2#define _LINUX_DMA_MAPPING_H
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h> 5#include <linux/err.h>
@@ -60,6 +60,36 @@ static inline int is_device_dma_capable(struct device *dev)
60 60
61extern u64 dma_get_required_mask(struct device *dev); 61extern u64 dma_get_required_mask(struct device *dev);
62 62
63static inline unsigned int dma_get_max_seg_size(struct device *dev)
64{
65 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536;
66}
67
68static inline unsigned int dma_set_max_seg_size(struct device *dev,
69 unsigned int size)
70{
71 if (dev->dma_parms) {
72 dev->dma_parms->max_segment_size = size;
73 return 0;
74 } else
75 return -EIO;
76}
77
78static inline unsigned long dma_get_seg_boundary(struct device *dev)
79{
80 return dev->dma_parms ?
81 dev->dma_parms->segment_boundary_mask : 0xffffffff;
82}
83
84static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
85{
86 if (dev->dma_parms) {
87 dev->dma_parms->segment_boundary_mask = mask;
88 return 0;
89 } else
90 return -EIO;
91}
92
63/* flags for the coherent memory api */ 93/* flags for the coherent memory api */
64#define DMA_MEMORY_MAP 0x01 94#define DMA_MEMORY_MAP 0x01
65#define DMA_MEMORY_IO 0x02 95#define DMA_MEMORY_IO 0x02
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 55c9a6952f44..5c84bf897593 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -29,7 +29,7 @@
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30 30
31/** 31/**
32 * enum dma_state - resource PNP/power managment state 32 * enum dma_state - resource PNP/power management state
33 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state 33 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state
34 * @DMA_RESOURCE_RESUME: DMA device returning to full power 34 * @DMA_RESOURCE_RESUME: DMA device returning to full power
35 * @DMA_RESOURCE_AVAILABLE: DMA device available to the system 35 * @DMA_RESOURCE_AVAILABLE: DMA device available to the system
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 71d4ada6f315..fcbe8b640ffb 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -309,7 +309,7 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data);
309 * get_ringparam: Report ring sizes 309 * get_ringparam: Report ring sizes
310 * set_ringparam: Set ring sizes 310 * set_ringparam: Set ring sizes
311 * get_pauseparam: Report pause parameters 311 * get_pauseparam: Report pause parameters
312 * set_pauseparam: Set pause paramters 312 * set_pauseparam: Set pause parameters
313 * get_rx_csum: Report whether receive checksums are turned on or off 313 * get_rx_csum: Report whether receive checksums are turned on or off
314 * set_rx_csum: Turn receive checksum on or off 314 * set_rx_csum: Turn receive checksum on or off
315 * get_tx_csum: Report whether transmit checksums are turned on or off 315 * get_tx_csum: Report whether transmit checksums are turned on or off
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a516b6716870..56bd421c1208 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -872,6 +872,7 @@ struct file_lock {
872 struct list_head fl_block; /* circular list of blocked processes */ 872 struct list_head fl_block; /* circular list of blocked processes */
873 fl_owner_t fl_owner; 873 fl_owner_t fl_owner;
874 unsigned int fl_pid; 874 unsigned int fl_pid;
875 struct pid *fl_nspid;
875 wait_queue_head_t fl_wait; 876 wait_queue_head_t fl_wait;
876 struct file *fl_file; 877 struct file *fl_file;
877 unsigned char fl_flags; 878 unsigned char fl_flags;
@@ -1307,7 +1308,7 @@ struct super_operations {
1307 * being set. find_inode() uses this to prevent returning 1308 * being set. find_inode() uses this to prevent returning
1308 * nearly-dead inodes. 1309 * nearly-dead inodes.
1309 * I_SYNC Similar to I_LOCK, but limited in scope to writeback 1310 * I_SYNC Similar to I_LOCK, but limited in scope to writeback
1310 * of inode dirty data. Having a seperate lock for this 1311 * of inode dirty data. Having a separate lock for this
1311 * purpose reduces latency and prevents some filesystem- 1312 * purpose reduces latency and prevents some filesystem-
1312 * specific deadlocks. 1313 * specific deadlocks.
1313 * 1314 *
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 1a15f8e237a7..90048fb28a38 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -21,6 +21,8 @@ union ktime;
21#define FUTEX_LOCK_PI 6 21#define FUTEX_LOCK_PI 6
22#define FUTEX_UNLOCK_PI 7 22#define FUTEX_UNLOCK_PI 7
23#define FUTEX_TRYLOCK_PI 8 23#define FUTEX_TRYLOCK_PI 8
24#define FUTEX_WAIT_BITSET 9
25#define FUTEX_WAKE_BITSET 10
24 26
25#define FUTEX_PRIVATE_FLAG 128 27#define FUTEX_PRIVATE_FLAG 128
26#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG 28#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG
@@ -33,6 +35,8 @@ union ktime;
33#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) 35#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
34#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) 36#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
35#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) 37#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
38#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG)
39#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG)
36 40
37/* 41/*
38 * Support for robust futexes: the kernel cleans up held futexes at 42 * Support for robust futexes: the kernel cleans up held futexes at
@@ -111,6 +115,12 @@ struct robust_list_head {
111 */ 115 */
112#define ROBUST_LIST_LIMIT 2048 116#define ROBUST_LIST_LIMIT 2048
113 117
118/*
119 * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a
120 * match of any bit.
121 */
122#define FUTEX_BITSET_MATCH_ANY 0xffffffff
123
114#ifdef __KERNEL__ 124#ifdef __KERNEL__
115long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, 125long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
116 u32 __user *uaddr2, u32 val2, u32 val3); 126 u32 __user *uaddr2, u32 val2, u32 val3);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7e93a9ae7064..0c6ce515185d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -228,5 +228,7 @@ extern void FASTCALL(free_cold_page(struct page *page));
228 228
229void page_alloc_init(void); 229void page_alloc_init(void);
230void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); 230void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
231void drain_all_pages(void);
232void drain_local_pages(void *dummy);
231 233
232#endif /* __LINUX_GFP_H */ 234#endif /* __LINUX_GFP_H */
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index ff43f8d6b5b3..e38e75967e74 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -364,7 +364,7 @@ typedef struct hd_drive_hob_hdr {
364#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ 364#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
365#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ 365#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
366#define SETFEATURES_EN_REST 0xAC /* ATA-1 */ 366#define SETFEATURES_EN_REST 0xAC /* ATA-1 */
367#define SETFEATURES_4B_RW_LONG 0xBB /* Set Lenght of 4 bytes */ 367#define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */
368#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ 368#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */
369#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ 369#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
370#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ 370#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
@@ -706,8 +706,10 @@ struct hd_driveid {
706 */ 706 */
707#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ 707#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
708#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ 708#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
709#define IDE_NICE_0 (2) /* when sure that it won't affect us */
710#define IDE_NICE_1 (3) /* when probably won't affect us much */ 709#define IDE_NICE_1 (3) /* when probably won't affect us much */
710#ifndef __KERNEL__
711#define IDE_NICE_0 (2) /* when sure that it won't affect us */
711#define IDE_NICE_2 (4) /* when we know it's on our expense */ 712#define IDE_NICE_2 (4) /* when we know it's on our expense */
713#endif
712 714
713#endif /* _LINUX_HDREG_H */ 715#endif /* _LINUX_HDREG_H */
diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h
index 7974a47fe582..e69192159d40 100644
--- a/include/linux/hdsmart.h
+++ b/include/linux/hdsmart.h
@@ -17,6 +17,7 @@
17#ifndef _LINUX_HDSMART_H 17#ifndef _LINUX_HDSMART_H
18#define _LINUX_HDSMART_H 18#define _LINUX_HDSMART_H
19 19
20#ifndef __KERNEL
20#define OFFLINE_FULL_SCAN 0 21#define OFFLINE_FULL_SCAN 0
21#define SHORT_SELF_TEST 1 22#define SHORT_SELF_TEST 1
22#define EXTEND_SELF_TEST 2 23#define EXTEND_SELF_TEST 2
@@ -120,5 +121,6 @@ typedef struct ata_smart_selftestlog_s {
120 unsigned char resevered[2]; 121 unsigned char resevered[2];
121 unsigned char chksum; 122 unsigned char chksum;
122} __attribute__ ((packed)) ata_smart_selftestlog_t; 123} __attribute__ ((packed)) ata_smart_selftestlog_t;
124#endif /* __KERNEL__ *
123 125
124#endif /* _LINUX_HDSMART_H */ 126#endif /* _LINUX_HDSMART_H */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 1fcb0033179e..7dcbc82f3b7b 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -68,8 +68,6 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
68 void *addr = kmap_atomic(page, KM_USER0); 68 void *addr = kmap_atomic(page, KM_USER0);
69 clear_user_page(addr, vaddr, page); 69 clear_user_page(addr, vaddr, page);
70 kunmap_atomic(addr, KM_USER0); 70 kunmap_atomic(addr, KM_USER0);
71 /* Make sure this page is cleared on other CPU's too before using it */
72 smp_wmb();
73} 71}
74 72
75#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 73#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
@@ -124,28 +122,40 @@ static inline void clear_highpage(struct page *page)
124 kunmap_atomic(kaddr, KM_USER0); 122 kunmap_atomic(kaddr, KM_USER0);
125} 123}
126 124
127/* 125static inline void zero_user_segments(struct page *page,
128 * Same but also flushes aliased cache contents to RAM. 126 unsigned start1, unsigned end1,
129 * 127 unsigned start2, unsigned end2)
130 * This must be a macro because KM_USER0 and friends aren't defined if 128{
131 * !CONFIG_HIGHMEM 129 void *kaddr = kmap_atomic(page, KM_USER0);
132 */ 130
133#define zero_user_page(page, offset, size, km_type) \ 131 BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE);
134 do { \ 132
135 void *kaddr; \ 133 if (end1 > start1)
136 \ 134 memset(kaddr + start1, 0, end1 - start1);
137 BUG_ON((offset) + (size) > PAGE_SIZE); \ 135
138 \ 136 if (end2 > start2)
139 kaddr = kmap_atomic(page, km_type); \ 137 memset(kaddr + start2, 0, end2 - start2);
140 memset((char *)kaddr + (offset), 0, (size)); \ 138
141 flush_dcache_page(page); \ 139 kunmap_atomic(kaddr, KM_USER0);
142 kunmap_atomic(kaddr, (km_type)); \ 140 flush_dcache_page(page);
143 } while (0) 141}
142
143static inline void zero_user_segment(struct page *page,
144 unsigned start, unsigned end)
145{
146 zero_user_segments(page, start, end, 0, 0);
147}
148
149static inline void zero_user(struct page *page,
150 unsigned start, unsigned size)
151{
152 zero_user_segments(page, start, start + size, 0, 0);
153}
144 154
145static inline void __deprecated memclear_highpage_flush(struct page *page, 155static inline void __deprecated memclear_highpage_flush(struct page *page,
146 unsigned int offset, unsigned int size) 156 unsigned int offset, unsigned int size)
147{ 157{
148 zero_user_page(page, offset, size, KM_USER0); 158 zero_user(page, offset, size);
149} 159}
150 160
151#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE 161#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE
@@ -160,8 +170,6 @@ static inline void copy_user_highpage(struct page *to, struct page *from,
160 copy_user_page(vto, vfrom, vaddr, to); 170 copy_user_page(vto, vfrom, vaddr, to);
161 kunmap_atomic(vfrom, KM_USER0); 171 kunmap_atomic(vfrom, KM_USER0);
162 kunmap_atomic(vto, KM_USER1); 172 kunmap_atomic(vto, KM_USER1);
163 /* Make sure this page is cleared on other CPU's too before using it */
164 smp_wmb();
165} 173}
166 174
167#endif 175#endif
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 49067f14fac1..8371b664b41f 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -147,7 +147,6 @@ struct hrtimer_sleeper {
147 * @get_time: function to retrieve the current time of the clock 147 * @get_time: function to retrieve the current time of the clock
148 * @get_softirq_time: function to retrieve the current time from the softirq 148 * @get_softirq_time: function to retrieve the current time from the softirq
149 * @softirq_time: the time when running the hrtimer queue in the softirq 149 * @softirq_time: the time when running the hrtimer queue in the softirq
150 * @cb_pending: list of timers where the callback is pending
151 * @offset: offset of this clock to the monotonic base 150 * @offset: offset of this clock to the monotonic base
152 * @reprogram: function to reprogram the timer event 151 * @reprogram: function to reprogram the timer event
153 */ 152 */
@@ -302,9 +301,16 @@ static inline int hrtimer_is_queued(struct hrtimer *timer)
302} 301}
303 302
304/* Forward a hrtimer so it expires after now: */ 303/* Forward a hrtimer so it expires after now: */
305extern unsigned long 304extern u64
306hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); 305hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
307 306
307/* Forward a hrtimer so it expires after the hrtimer's current now */
308static inline u64 hrtimer_forward_now(struct hrtimer *timer,
309 ktime_t interval)
310{
311 return hrtimer_forward(timer, timer->base->get_time(), interval);
312}
313
308/* Precise sleep: */ 314/* Precise sleep: */
309extern long hrtimer_nanosleep(struct timespec *rqtp, 315extern long hrtimer_nanosleep(struct timespec *rqtp,
310 struct timespec *rmtp, 316 struct timespec *rmtp,
@@ -323,9 +329,9 @@ extern void hrtimer_run_pending(void);
323extern void __init hrtimers_init(void); 329extern void __init hrtimers_init(void);
324 330
325#if BITS_PER_LONG < 64 331#if BITS_PER_LONG < 64
326extern unsigned long ktime_divns(const ktime_t kt, s64 div); 332extern u64 ktime_divns(const ktime_t kt, s64 div);
327#else /* BITS_PER_LONG < 64 */ 333#else /* BITS_PER_LONG < 64 */
328# define ktime_divns(kt, div) (unsigned long)((kt).tv64 / (div)) 334# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
329#endif 335#endif
330 336
331/* Show pending timers: */ 337/* Show pending timers: */
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 85d11916e9ea..42131820bb89 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -44,7 +44,15 @@ struct hwrng {
44/** Register a new Hardware Random Number Generator driver. */ 44/** Register a new Hardware Random Number Generator driver. */
45extern int hwrng_register(struct hwrng *rng); 45extern int hwrng_register(struct hwrng *rng);
46/** Unregister a Hardware Random Number Generator driver. */ 46/** Unregister a Hardware Random Number Generator driver. */
47extern void hwrng_unregister(struct hwrng *rng); 47extern void __hwrng_unregister(struct hwrng *rng, bool suspended);
48static inline void hwrng_unregister(struct hwrng *rng)
49{
50 __hwrng_unregister(rng, false);
51}
52static inline void hwrng_unregister_suspended(struct hwrng *rng)
53{
54 __hwrng_unregister(rng, true);
55}
48 56
49#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
50#endif /* LINUX_HWRANDOM_H_ */ 58#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c/pca9539.h b/include/linux/i2c/pca9539.h
new file mode 100644
index 000000000000..611d84ab7a30
--- /dev/null
+++ b/include/linux/i2c/pca9539.h
@@ -0,0 +1,18 @@
1/* platform data for the PCA9539 16-bit I/O expander driver */
2
3struct pca9539_platform_data {
4 /* number of the first GPIO */
5 unsigned gpio_base;
6
7 /* initial polarity inversion setting */
8 uint16_t invert;
9
10 void *context; /* param to setup/teardown */
11
12 int (*setup)(struct i2c_client *client,
13 unsigned gpio, unsigned ngpio,
14 void *context);
15 int (*teardown)(struct i2c_client *client,
16 unsigned gpio, unsigned ngpio,
17 void *context);
18};
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h
new file mode 100644
index 000000000000..ba8ea6e16476
--- /dev/null
+++ b/include/linux/i2c/pcf857x.h
@@ -0,0 +1,45 @@
1#ifndef __LINUX_PCF857X_H
2#define __LINUX_PCF857X_H
3
4/**
5 * struct pcf857x_platform_data - data to set up pcf857x driver
6 * @gpio_base: number of the chip's first GPIO
7 * @n_latch: optional bit-inverse of initial register value; if
8 * you leave this initialized to zero the driver will act
9 * like the chip was just reset
10 * @setup: optional callback issued once the GPIOs are valid
11 * @teardown: optional callback issued before the GPIOs are invalidated
12 * @context: optional parameter passed to setup() and teardown()
13 *
14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
15 * the i2c_board_info used with the pcf875x driver must provide the
16 * chip "type" ("pcf8574", "pcf8574a", "pcf8575", "pcf8575c") and its
17 * platform_data (pointer to one of these structures) with at least
18 * the gpio_base value initialized.
19 *
20 * The @setup callback may be used with the kind of board-specific glue
21 * which hands the (now-valid) GPIOs to other drivers, or which puts
22 * devices in their initial states using these GPIOs.
23 *
24 * These GPIO chips are only "quasi-bidirectional"; read the chip specs
25 * to understand the behavior. They don't have separate registers to
26 * record which pins are used for input or output, record which output
27 * values are driven, or provide access to input values. That must be
28 * inferred by reading the chip's value and knowing the last value written
29 * to it. If you leave n_latch initialized to zero, that last written
30 * value is presumed to be all ones (as if the chip were just reset).
31 */
32struct pcf857x_platform_data {
33 unsigned gpio_base;
34 unsigned n_latch;
35
36 int (*setup)(struct i2c_client *client,
37 int gpio, unsigned ngpio,
38 void *context);
39 int (*teardown)(struct i2c_client *client,
40 int gpio, unsigned ngpio,
41 void *context);
42 void *context;
43};
44
45#endif /* __LINUX_PCF857X_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 27cb39de2ae2..acec99da832d 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -9,7 +9,6 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/hdreg.h> 11#include <linux/hdreg.h>
12#include <linux/hdsmart.h>
13#include <linux/blkdev.h> 12#include <linux/blkdev.h>
14#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
15#include <linux/interrupt.h> 14#include <linux/interrupt.h>
@@ -113,18 +112,8 @@ typedef unsigned char byte; /* used everywhere */
113#define SATA_NR_PORTS (3) /* 16 possible ?? */ 112#define SATA_NR_PORTS (3) /* 16 possible ?? */
114 113
115#define SATA_STATUS_OFFSET (0) 114#define SATA_STATUS_OFFSET (0)
116#define SATA_STATUS_REG (HWIF(drive)->sata_scr[SATA_STATUS_OFFSET])
117#define SATA_ERROR_OFFSET (1) 115#define SATA_ERROR_OFFSET (1)
118#define SATA_ERROR_REG (HWIF(drive)->sata_scr[SATA_ERROR_OFFSET])
119#define SATA_CONTROL_OFFSET (2) 116#define SATA_CONTROL_OFFSET (2)
120#define SATA_CONTROL_REG (HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET])
121
122#define SATA_MISC_OFFSET (0)
123#define SATA_MISC_REG (HWIF(drive)->sata_misc[SATA_MISC_OFFSET])
124#define SATA_PHY_OFFSET (1)
125#define SATA_PHY_REG (HWIF(drive)->sata_misc[SATA_PHY_OFFSET])
126#define SATA_IEN_OFFSET (2)
127#define SATA_IEN_REG (HWIF(drive)->sata_misc[SATA_IEN_OFFSET])
128 117
129/* 118/*
130 * Our Physical Region Descriptor (PRD) table should be large enough 119 * Our Physical Region Descriptor (PRD) table should be large enough
@@ -180,7 +169,7 @@ enum { ide_unknown, ide_generic, ide_pci,
180 ide_rz1000, ide_trm290, 169 ide_rz1000, ide_trm290,
181 ide_cmd646, ide_cy82c693, ide_4drives, 170 ide_cmd646, ide_cy82c693, ide_4drives,
182 ide_pmac, ide_etrax100, ide_acorn, 171 ide_pmac, ide_etrax100, ide_acorn,
183 ide_au1xxx, ide_forced 172 ide_au1xxx, ide_palm3710, ide_forced
184}; 173};
185 174
186typedef u8 hwif_chipset_t; 175typedef u8 hwif_chipset_t;
@@ -197,6 +186,7 @@ typedef struct hw_regs_s {
197} hw_regs_t; 186} hw_regs_t;
198 187
199struct hwif_s * ide_find_port(unsigned long); 188struct hwif_s * ide_find_port(unsigned long);
189struct hwif_s *ide_deprecated_find_port(unsigned long);
200void ide_init_port_data(struct hwif_s *, unsigned int); 190void ide_init_port_data(struct hwif_s *, unsigned int);
201void ide_init_port_hw(struct hwif_s *, hw_regs_t *); 191void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
202 192
@@ -204,17 +194,6 @@ struct ide_drive_s;
204int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), 194int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
205 struct hwif_s **); 195 struct hwif_s **);
206 196
207void ide_setup_ports( hw_regs_t *hw,
208 unsigned long base,
209 int *offsets,
210 unsigned long ctrl,
211 unsigned long intr,
212 ide_ack_intr_t *ack_intr,
213#if 0
214 ide_io_ops_t *iops,
215#endif
216 int irq);
217
218static inline void ide_std_init_ports(hw_regs_t *hw, 197static inline void ide_std_init_ports(hw_regs_t *hw,
219 unsigned long io_addr, 198 unsigned long io_addr,
220 unsigned long ctl_addr) 199 unsigned long ctl_addr)
@@ -407,8 +386,6 @@ typedef struct ide_drive_s {
407 unsigned no_unmask : 1; /* disallow setting unmask bit */ 386 unsigned no_unmask : 1; /* disallow setting unmask bit */
408 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ 387 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
409 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ 388 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
410 unsigned nice0 : 1; /* give obvious excess bandwidth */
411 unsigned nice2 : 1; /* give a share in our own bandwidth */
412 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 389 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
413 unsigned nodma : 1; /* disallow DMA */ 390 unsigned nodma : 1; /* disallow DMA */
414 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ 391 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
@@ -481,14 +458,12 @@ typedef struct hwif_s {
481 /* task file registers for pata and sata */ 458 /* task file registers for pata and sata */
482 unsigned long io_ports[IDE_NR_PORTS]; 459 unsigned long io_ports[IDE_NR_PORTS];
483 unsigned long sata_scr[SATA_NR_PORTS]; 460 unsigned long sata_scr[SATA_NR_PORTS];
484 unsigned long sata_misc[SATA_NR_PORTS];
485 461
486 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 462 ide_drive_t drives[MAX_DRIVES]; /* drive info */
487 463
488 u8 major; /* our major number */ 464 u8 major; /* our major number */
489 u8 index; /* 0 for ide0; 1 for ide1; ... */ 465 u8 index; /* 0 for ide0; 1 for ide1; ... */
490 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 466 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
491 u8 straight8; /* Alan's straight 8 check */
492 u8 bus_state; /* power state of the IDE bus */ 467 u8 bus_state; /* power state of the IDE bus */
493 468
494 u32 host_flags; 469 u32 host_flags;
@@ -503,7 +478,8 @@ typedef struct hwif_s {
503 478
504 hwif_chipset_t chipset; /* sub-module for tuning.. */ 479 hwif_chipset_t chipset; /* sub-module for tuning.. */
505 480
506 struct pci_dev *pci_dev; /* for pci chipsets */ 481 struct device *dev;
482
507 const struct ide_port_info *cds; /* chipset device struct */ 483 const struct ide_port_info *cds; /* chipset device struct */
508 484
509 ide_ack_intr_t *ack_intr; 485 ide_ack_intr_t *ack_intr;
@@ -513,6 +489,8 @@ typedef struct hwif_s {
513#if 0 489#if 0
514 ide_hwif_ops_t *hwifops; 490 ide_hwif_ops_t *hwifops;
515#else 491#else
492 /* host specific initialization of devices on a port */
493 void (*port_init_devs)(struct hwif_s *);
516 /* routine to program host for PIO mode */ 494 /* routine to program host for PIO mode */
517 void (*set_pio_mode)(ide_drive_t *, const u8); 495 void (*set_pio_mode)(ide_drive_t *, const u8);
518 /* routine to program host for DMA mode */ 496 /* routine to program host for DMA mode */
@@ -535,6 +513,8 @@ typedef struct hwif_s {
535 u8 (*mdma_filter)(ide_drive_t *); 513 u8 (*mdma_filter)(ide_drive_t *);
536 u8 (*udma_filter)(ide_drive_t *); 514 u8 (*udma_filter)(ide_drive_t *);
537 515
516 u8 (*cable_detect)(struct hwif_s *);
517
538 void (*ata_input_data)(ide_drive_t *, void *, u32); 518 void (*ata_input_data)(ide_drive_t *, void *, u32);
539 void (*ata_output_data)(ide_drive_t *, void *, u32); 519 void (*ata_output_data)(ide_drive_t *, void *, u32);
540 520
@@ -602,10 +582,9 @@ typedef struct hwif_s {
602 unsigned serialized : 1; /* serialized all channel operation */ 582 unsigned serialized : 1; /* serialized all channel operation */
603 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 583 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
604 unsigned reset : 1; /* reset after probe */ 584 unsigned reset : 1; /* reset after probe */
605 unsigned auto_poll : 1; /* supports nop auto-poll */
606 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 585 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
607 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
608 unsigned mmio : 1; /* host uses MMIO */ 586 unsigned mmio : 1; /* host uses MMIO */
587 unsigned straight8 : 1; /* Alan's straight 8 check */
609 588
610 struct device gendev; 589 struct device gendev;
611 struct completion gendev_rel_comp; /* To deal with device release() */ 590 struct completion gendev_rel_comp; /* To deal with device release() */
@@ -625,11 +604,13 @@ typedef struct hwif_s {
625typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); 604typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
626typedef int (ide_expiry_t)(ide_drive_t *); 605typedef int (ide_expiry_t)(ide_drive_t *);
627 606
607/* used by ide-cd, ide-floppy, etc. */
608typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
609
628typedef struct hwgroup_s { 610typedef struct hwgroup_s {
629 /* irq handler, if active */ 611 /* irq handler, if active */
630 ide_startstop_t (*handler)(ide_drive_t *); 612 ide_startstop_t (*handler)(ide_drive_t *);
631 /* irq handler, suspended if active */ 613
632 ide_startstop_t (*handler_save)(ide_drive_t *);
633 /* BOOL: protects all fields below */ 614 /* BOOL: protects all fields below */
634 volatile int busy; 615 volatile int busy;
635 /* BOOL: wake us up on timer expiry */ 616 /* BOOL: wake us up on timer expiry */
@@ -644,25 +625,18 @@ typedef struct hwgroup_s {
644 /* ptr to current hwif in linked-list */ 625 /* ptr to current hwif in linked-list */
645 ide_hwif_t *hwif; 626 ide_hwif_t *hwif;
646 627
647 /* for pci chipsets */
648 struct pci_dev *pci_dev;
649
650 /* current request */ 628 /* current request */
651 struct request *rq; 629 struct request *rq;
630
652 /* failsafe timer */ 631 /* failsafe timer */
653 struct timer_list timer; 632 struct timer_list timer;
654 /* local copy of current write rq */
655 struct request wrq;
656 /* timeout value during long polls */ 633 /* timeout value during long polls */
657 unsigned long poll_timeout; 634 unsigned long poll_timeout;
658 /* queried upon timeouts */ 635 /* queried upon timeouts */
659 int (*expiry)(ide_drive_t *); 636 int (*expiry)(ide_drive_t *);
660 /* ide_system_bus_speed */ 637
661 int pio_clock;
662 int req_gen; 638 int req_gen;
663 int req_gen_timer; 639 int req_gen_timer;
664
665 unsigned char cmd_buf[4];
666} ide_hwgroup_t; 640} ide_hwgroup_t;
667 641
668typedef struct ide_driver_s ide_driver_t; 642typedef struct ide_driver_s ide_driver_t;
@@ -716,6 +690,7 @@ typedef struct {
716void proc_ide_create(void); 690void proc_ide_create(void);
717void proc_ide_destroy(void); 691void proc_ide_destroy(void);
718void ide_proc_register_port(ide_hwif_t *); 692void ide_proc_register_port(ide_hwif_t *);
693void ide_proc_port_register_devices(ide_hwif_t *);
719void ide_proc_unregister_port(ide_hwif_t *); 694void ide_proc_unregister_port(ide_hwif_t *);
720void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 695void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
721void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 696void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -748,6 +723,7 @@ void ide_pci_create_host_proc(const char *, get_info_t *);
748static inline void proc_ide_create(void) { ; } 723static inline void proc_ide_create(void) { ; }
749static inline void proc_ide_destroy(void) { ; } 724static inline void proc_ide_destroy(void) { ; }
750static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 725static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
726static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
751static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 727static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
752static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 728static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
753static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 729static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
@@ -986,8 +962,6 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
986 962
987void task_end_request(ide_drive_t *, struct request *, u8); 963void task_end_request(ide_drive_t *, struct request *, u8);
988 964
989u8 wait_drive_not_busy(ide_drive_t *);
990
991int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); 965int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
992int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 966int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
993 967
@@ -998,10 +972,8 @@ int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
998extern int system_bus_clock(void); 972extern int system_bus_clock(void);
999 973
1000extern int ide_driveid_update(ide_drive_t *); 974extern int ide_driveid_update(ide_drive_t *);
1001extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
1002extern int ide_config_drive_speed(ide_drive_t *, u8); 975extern int ide_config_drive_speed(ide_drive_t *, u8);
1003extern u8 eighty_ninty_three (ide_drive_t *); 976extern u8 eighty_ninty_three (ide_drive_t *);
1004extern int set_transfer(ide_drive_t *, ide_task_t *);
1005extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); 977extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
1006 978
1007extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); 979extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
@@ -1017,7 +989,6 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
1017 989
1018#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 990#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1019extern int ide_scan_direction; 991extern int ide_scan_direction;
1020int __init ide_scan_pcibus(void);
1021extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 992extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1022#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 993#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1023#else 994#else
@@ -1027,6 +998,14 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1027void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); 998void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *);
1028void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 999void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1029 1000
1001/* FIXME: palm_bk3710 uses BLK_DEV_IDEDMA_PCI without BLK_DEV_IDEPCI! */
1002#if defined(CONFIG_BLK_DEV_IDEPCI) && defined(CONFIG_BLK_DEV_IDEDMA_PCI)
1003void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1004#else
1005static inline void ide_hwif_setup_dma(ide_hwif_t *hwif,
1006 const struct ide_port_info *d) { }
1007#endif
1008
1030extern void default_hwif_iops(ide_hwif_t *); 1009extern void default_hwif_iops(ide_hwif_t *);
1031extern void default_hwif_mmiops(ide_hwif_t *); 1010extern void default_hwif_mmiops(ide_hwif_t *);
1032extern void default_hwif_transport(ide_hwif_t *); 1011extern void default_hwif_transport(ide_hwif_t *);
@@ -1063,7 +1042,7 @@ enum {
1063 IDE_HFLAG_NO_SET_MODE = (1 << 9), 1042 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1064 /* trust BIOS for programming chipset/device for DMA */ 1043 /* trust BIOS for programming chipset/device for DMA */
1065 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1044 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1066 /* host uses VDMA */ 1045 /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */
1067 IDE_HFLAG_VDMA = (1 << 11), 1046 IDE_HFLAG_VDMA = (1 << 11),
1068 /* ATAPI DMA is unsupported */ 1047 /* ATAPI DMA is unsupported */
1069 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1048 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
@@ -1073,8 +1052,10 @@ enum {
1073 IDE_HFLAG_NO_DMA = (1 << 14), 1052 IDE_HFLAG_NO_DMA = (1 << 14),
1074 /* check if host is PCI IDE device before allowing DMA */ 1053 /* check if host is PCI IDE device before allowing DMA */
1075 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1054 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1055 /* don't autotune PIO */
1056 IDE_HFLAG_NO_AUTOTUNE = (1 << 16),
1076 /* host is CS5510/CS5520 */ 1057 /* host is CS5510/CS5520 */
1077 IDE_HFLAG_CS5520 = (1 << 16), 1058 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1078 /* no LBA48 */ 1059 /* no LBA48 */
1079 IDE_HFLAG_NO_LBA48 = (1 << 17), 1060 IDE_HFLAG_NO_LBA48 = (1 << 17),
1080 /* no LBA48 DMA */ 1061 /* no LBA48 DMA */
@@ -1096,6 +1077,14 @@ enum {
1096 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), 1077 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1097 /* host is CY82C693 */ 1078 /* host is CY82C693 */
1098 IDE_HFLAG_CY82C693 = (1 << 27), 1079 IDE_HFLAG_CY82C693 = (1 << 27),
1080 /* force host out of "simplex" mode */
1081 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1082 /* DSC overlap is unsupported */
1083 IDE_HFLAG_NO_DSC = (1 << 29),
1084 /* never use 32-bit I/O ops */
1085 IDE_HFLAG_NO_IO_32BIT = (1 << 30),
1086 /* never unmask IRQs */
1087 IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31),
1099}; 1088};
1100 1089
1101#ifdef CONFIG_BLK_DEV_OFFBOARD 1090#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1151,14 +1140,16 @@ void ide_dma_off_quietly(ide_drive_t *);
1151void ide_dma_off(ide_drive_t *); 1140void ide_dma_off(ide_drive_t *);
1152void ide_dma_on(ide_drive_t *); 1141void ide_dma_on(ide_drive_t *);
1153int ide_set_dma(ide_drive_t *); 1142int ide_set_dma(ide_drive_t *);
1143void ide_check_dma_crc(ide_drive_t *);
1154ide_startstop_t ide_dma_intr(ide_drive_t *); 1144ide_startstop_t ide_dma_intr(ide_drive_t *);
1155 1145
1146int ide_build_sglist(ide_drive_t *, struct request *);
1147void ide_destroy_dmatable(ide_drive_t *);
1148
1156#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1149#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1157extern int ide_build_sglist(ide_drive_t *, struct request *);
1158extern int ide_build_dmatable(ide_drive_t *, struct request *); 1150extern int ide_build_dmatable(ide_drive_t *, struct request *);
1159extern void ide_destroy_dmatable(ide_drive_t *);
1160extern int ide_release_dma(ide_hwif_t *); 1151extern int ide_release_dma(ide_hwif_t *);
1161extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); 1152extern void ide_setup_dma(ide_hwif_t *, unsigned long);
1162 1153
1163void ide_dma_host_set(ide_drive_t *, int); 1154void ide_dma_host_set(ide_drive_t *, int);
1164extern int ide_dma_setup(ide_drive_t *); 1155extern int ide_dma_setup(ide_drive_t *);
@@ -1177,6 +1168,7 @@ static inline void ide_dma_off(ide_drive_t *drive) { ; }
1177static inline void ide_dma_on(ide_drive_t *drive) { ; } 1168static inline void ide_dma_on(ide_drive_t *drive) { ; }
1178static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1169static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1179static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1170static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1171static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1180#endif /* CONFIG_BLK_DEV_IDEDMA */ 1172#endif /* CONFIG_BLK_DEV_IDEDMA */
1181 1173
1182#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 1174#ifndef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1188,26 +1180,29 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1188extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1180extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1189extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1181extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1190extern void ide_acpi_init(ide_hwif_t *hwif); 1182extern void ide_acpi_init(ide_hwif_t *hwif);
1183void ide_acpi_port_init_devices(ide_hwif_t *);
1191extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1184extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1192#else 1185#else
1193static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1186static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1194static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1187static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1195static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1188static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1196static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1189static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
1190static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1197static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1191static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1198#endif 1192#endif
1199 1193
1194void ide_remove_port_from_hwgroup(ide_hwif_t *);
1200extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1195extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1201extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1196extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1202extern void ide_unregister (unsigned int index); 1197void ide_unregister(unsigned int, int, int);
1203 1198
1204void ide_register_region(struct gendisk *); 1199void ide_register_region(struct gendisk *);
1205void ide_unregister_region(struct gendisk *); 1200void ide_unregister_region(struct gendisk *);
1206 1201
1207void ide_undecoded_slave(ide_drive_t *); 1202void ide_undecoded_slave(ide_drive_t *);
1208 1203
1209int ide_device_add_all(u8 *idx); 1204int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1210int ide_device_add(u8 idx[4]); 1205int ide_device_add(u8 idx[4], const struct ide_port_info *);
1211 1206
1212static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1207static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1213{ 1208{
@@ -1291,9 +1286,14 @@ extern struct bus_type ide_bus_type;
1291#define ide_id_has_flush_cache_ext(id) \ 1286#define ide_id_has_flush_cache_ext(id) \
1292 (((id)->cfs_enable_2 & 0x2400) == 0x2400) 1287 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1293 1288
1289static inline void ide_dump_identify(u8 *id)
1290{
1291 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);
1292}
1293
1294static inline int hwif_to_node(ide_hwif_t *hwif) 1294static inline int hwif_to_node(ide_hwif_t *hwif)
1295{ 1295{
1296 struct pci_dev *dev = hwif->pci_dev; 1296 struct pci_dev *dev = to_pci_dev(hwif->dev);
1297 return dev ? pcibus_to_node(dev->bus) : -1; 1297 return dev ? pcibus_to_node(dev->bus) : -1;
1298} 1298}
1299 1299
@@ -1309,4 +1309,25 @@ static inline void ide_set_irq(ide_drive_t *drive, int on)
1309 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); 1309 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG);
1310} 1310}
1311 1311
1312static inline u8 ide_read_status(ide_drive_t *drive)
1313{
1314 ide_hwif_t *hwif = drive->hwif;
1315
1316 return hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]);
1317}
1318
1319static inline u8 ide_read_altstatus(ide_drive_t *drive)
1320{
1321 ide_hwif_t *hwif = drive->hwif;
1322
1323 return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]);
1324}
1325
1326static inline u8 ide_read_error(ide_drive_t *drive)
1327{
1328 ide_hwif_t *hwif = drive->hwif;
1329
1330 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]);
1331}
1332
1312#endif /* _IDE_H */ 1333#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 5de6d911cdf7..f577c8f1c66d 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -287,6 +287,12 @@ struct ieee80211_ht_addt_info {
287#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 287#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
288#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 288#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
289 289
290/* MIMO Power Save Modes */
291#define WLAN_HT_CAP_MIMO_PS_STATIC 0
292#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1
293#define WLAN_HT_CAP_MIMO_PS_INVALID 2
294#define WLAN_HT_CAP_MIMO_PS_DISABLED 3
295
290/* Authentication algorithms */ 296/* Authentication algorithms */
291#define WLAN_AUTH_OPEN 0 297#define WLAN_AUTH_OPEN 0
292#define WLAN_AUTH_SHARED_KEY 1 298#define WLAN_AUTH_SHARED_KEY 1
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 8d9eaaebded7..fc4e3db649e8 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -17,8 +17,6 @@ struct ipv4_devconf
17 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); 17 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1);
18}; 18};
19 19
20extern struct ipv4_devconf ipv4_devconf;
21
22struct in_device 20struct in_device
23{ 21{
24 struct net_device *dev; 22 struct net_device *dev;
diff --git a/include/linux/init.h b/include/linux/init.h
index 2efbda016741..90cdbbbbe077 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -124,9 +124,6 @@
124#define __REF .section ".ref.text", "ax" 124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw" 125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw" 126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
130 127
131#ifndef __ASSEMBLY__ 128#ifndef __ASSEMBLY__
132/* 129/*
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index e6b3f7080679..1f74e1d7415f 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -114,6 +114,25 @@ extern struct group_info init_groups;
114 .pid = &init_struct_pid, \ 114 .pid = &init_struct_pid, \
115} 115}
116 116
117#ifdef CONFIG_AUDITSYSCALL
118#define INIT_IDS \
119 .loginuid = -1, \
120 .sessionid = -1,
121#else
122#define INIT_IDS
123#endif
124
125#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
126/*
127 * Because of the reduced scope of CAP_SETPCAP when filesystem
128 * capabilities are in effect, it is safe to allow CAP_SETPCAP to
129 * be available in the default configuration.
130 */
131# define CAP_INIT_BSET CAP_FULL_SET
132#else
133# define CAP_INIT_BSET CAP_INIT_EFF_SET
134#endif
135
117/* 136/*
118 * INIT_TASK is used to set up the first task table, touch at 137 * INIT_TASK is used to set up the first task table, touch at
119 * your own risk!. Base=0, limit=0x1fffff (=2MB) 138 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -149,6 +168,7 @@ extern struct group_info init_groups;
149 .cap_effective = CAP_INIT_EFF_SET, \ 168 .cap_effective = CAP_INIT_EFF_SET, \
150 .cap_inheritable = CAP_INIT_INH_SET, \ 169 .cap_inheritable = CAP_INIT_INH_SET, \
151 .cap_permitted = CAP_FULL_SET, \ 170 .cap_permitted = CAP_FULL_SET, \
171 .cap_bset = CAP_INIT_BSET, \
152 .keep_capabilities = 0, \ 172 .keep_capabilities = 0, \
153 .user = INIT_USER, \ 173 .user = INIT_USER, \
154 .comm = "swapper", \ 174 .comm = "swapper", \
@@ -173,6 +193,7 @@ extern struct group_info init_groups;
173 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 193 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
174 }, \ 194 }, \
175 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 195 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
196 INIT_IDS \
176 INIT_TRACE_IRQFLAGS \ 197 INIT_TRACE_IRQFLAGS \
177 INIT_LOCKDEP \ 198 INIT_LOCKDEP \
178} 199}
diff --git a/include/linux/input.h b/include/linux/input.h
index 2075d6da2a31..056a17a4f34f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -371,6 +371,8 @@ struct input_absinfo {
371#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ 371#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
372#define KEY_DISPLAY_OFF 245 /* display device to off state */ 372#define KEY_DISPLAY_OFF 245 /* display device to off state */
373 373
374#define KEY_WIMAX 246
375
374#define BTN_MISC 0x100 376#define BTN_MISC 0x100
375#define BTN_0 0x100 377#define BTN_0 0x100
376#define BTN_1 0x101 378#define BTN_1 0x101
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
new file mode 100644
index 000000000000..4dd4c04ff2f4
--- /dev/null
+++ b/include/linux/iommu-helper.h
@@ -0,0 +1,7 @@
1extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
2 unsigned long start, unsigned int nr,
3 unsigned long shift,
4 unsigned long boundary_size,
5 unsigned long align_mask);
6extern void iommu_area_free(unsigned long *map, unsigned long start,
7 unsigned int nr);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 5d35a4cc3bff..4aaefc349a4b 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -457,14 +457,22 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
457#define inet_v6_ipv6only(__sk) 0 457#define inet_v6_ipv6only(__sk) 0
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 459
460#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && \ 461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 463 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 467
468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
473 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \
474 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
475
468#endif /* __KERNEL__ */ 476#endif /* __KERNEL__ */
469 477
470#endif /* _IPV6_H */ 478#endif /* _IPV6_H */
diff --git a/include/linux/latency.h b/include/linux/latency.h
deleted file mode 100644
index c08b52bb55b0..000000000000
--- a/include/linux/latency.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * latency.h: Explicit system-wide latency-expectation infrastructure
3 *
4 * (C) Copyright 2006 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 */
8
9#ifndef _INCLUDE_GUARD_LATENCY_H_
10#define _INCLUDE_GUARD_LATENCY_H_
11
12#include <linux/notifier.h>
13
14void set_acceptable_latency(char *identifier, int usecs);
15void modify_acceptable_latency(char *identifier, int usecs);
16void remove_acceptable_latency(char *identifier);
17void synchronize_acceptable_latency(void);
18int system_latency_constraint(void);
19
20int register_latency_notifier(struct notifier_block * nb);
21int unregister_latency_notifier(struct notifier_block * nb);
22
23#define INFINITE_LATENCY 1000000
24
25#endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b4130ff58d0c..00f89fd6c52a 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -54,7 +54,15 @@ struct led_classdev {
54 54
55extern int led_classdev_register(struct device *parent, 55extern int led_classdev_register(struct device *parent,
56 struct led_classdev *led_cdev); 56 struct led_classdev *led_cdev);
57extern void led_classdev_unregister(struct led_classdev *led_cdev); 57extern void __led_classdev_unregister(struct led_classdev *led_cdev, bool sus);
58static inline void led_classdev_unregister(struct led_classdev *lcd)
59{
60 __led_classdev_unregister(lcd, false);
61}
62static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
63{
64 __led_classdev_unregister(lcd, true);
65}
58extern void led_classdev_suspend(struct led_classdev *led_cdev); 66extern void led_classdev_suspend(struct led_classdev *led_cdev);
59extern void led_classdev_resume(struct led_classdev *led_cdev); 67extern void led_classdev_resume(struct led_classdev *led_cdev);
60 68
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index 697104da91f1..589be3e1f3ac 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -23,7 +23,12 @@
23struct lguest_device_desc { 23struct lguest_device_desc {
24 /* The device type: console, network, disk etc. Type 0 terminates. */ 24 /* The device type: console, network, disk etc. Type 0 terminates. */
25 __u8 type; 25 __u8 type;
26 /* The number of bytes of the config array. */ 26 /* The number of virtqueues (first in config array) */
27 __u8 num_vq;
28 /* The number of bytes of feature bits. Multiply by 2: one for host
29 * features and one for guest acknowledgements. */
30 __u8 feature_len;
31 /* The number of bytes of the config array after virtqueues. */
27 __u8 config_len; 32 __u8 config_len;
28 /* A status byte, written by the Guest. */ 33 /* A status byte, written by the Guest. */
29 __u8 status; 34 __u8 status;
@@ -31,7 +36,7 @@ struct lguest_device_desc {
31}; 36};
32 37
33/*D:135 This is how we expect the device configuration field for a virtqueue 38/*D:135 This is how we expect the device configuration field for a virtqueue
34 * (type VIRTIO_CONFIG_F_VIRTQUEUE) to be laid out: */ 39 * to be laid out in config space. */
35struct lguest_vqconfig { 40struct lguest_vqconfig {
36 /* The number of entries in the virtio_ring */ 41 /* The number of entries in the virtio_ring */
37 __u16 num; 42 __u16 num;
diff --git a/include/linux/llc.h b/include/linux/llc.h
index 09f2e6d0e9eb..7733585603f1 100644
--- a/include/linux/llc.h
+++ b/include/linux/llc.h
@@ -49,9 +49,9 @@ enum llc_sockopts {
49 49
50/* LLC SAP types. */ 50/* LLC SAP types. */
51#define LLC_SAP_NULL 0x00 /* NULL SAP. */ 51#define LLC_SAP_NULL 0x00 /* NULL SAP. */
52#define LLC_SAP_LLC 0x02 /* LLC Sublayer Managment. */ 52#define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */
53#define LLC_SAP_SNA 0x04 /* SNA Path Control. */ 53#define LLC_SAP_SNA 0x04 /* SNA Path Control. */
54#define LLC_SAP_PNM 0x0E /* Proway Network Managment. */ 54#define LLC_SAP_PNM 0x0E /* Proway Network Management. */
55#define LLC_SAP_IP 0x06 /* TCP/IP. */ 55#define LLC_SAP_IP 0x06 /* TCP/IP. */
56#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ 56#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */
57#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ 57#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index e2d1ce36b367..4babb2a129ac 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -173,14 +173,17 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
173/* 173/*
174 * Host cache 174 * Host cache
175 */ 175 */
176struct nlm_host * nlmclnt_lookup_host(const struct sockaddr_in *, int, int, const char *, int); 176struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *, int, int,
177struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *, const char *, int); 177 const char *, unsigned int);
178struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
179 unsigned int);
178struct rpc_clnt * nlm_bind_host(struct nlm_host *); 180struct rpc_clnt * nlm_bind_host(struct nlm_host *);
179void nlm_rebind_host(struct nlm_host *); 181void nlm_rebind_host(struct nlm_host *);
180struct nlm_host * nlm_get_host(struct nlm_host *); 182struct nlm_host * nlm_get_host(struct nlm_host *);
181void nlm_release_host(struct nlm_host *); 183void nlm_release_host(struct nlm_host *);
182void nlm_shutdown_hosts(void); 184void nlm_shutdown_hosts(void);
183extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, int, u32); 185extern void nlm_host_rebooted(const struct sockaddr_in *, const char *,
186 unsigned int, u32);
184void nsm_release(struct nsm_handle *); 187void nsm_release(struct nsm_handle *);
185 188
186 189
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index 83a1f9f6237b..df18fa053bcd 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -29,7 +29,7 @@ struct svc_rqst;
29/* Lock info passed via NLM */ 29/* Lock info passed via NLM */
30struct nlm_lock { 30struct nlm_lock {
31 char * caller; 31 char * caller;
32 int len; /* length of "caller" */ 32 unsigned int len; /* length of "caller" */
33 struct nfs_fh fh; 33 struct nfs_fh fh;
34 struct xdr_netobj oh; 34 struct xdr_netobj oh;
35 u32 svid; 35 u32 svid;
@@ -78,7 +78,7 @@ struct nlm_res {
78 */ 78 */
79struct nlm_reboot { 79struct nlm_reboot {
80 char * mon; 80 char * mon;
81 int len; 81 unsigned int len;
82 u32 state; 82 u32 state;
83 __be32 addr; 83 __be32 addr;
84 __be32 vers; 84 __be32 vers;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index dff9ea32606a..24b30b9b4f8a 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -43,7 +43,15 @@ struct miscdevice {
43}; 43};
44 44
45extern int misc_register(struct miscdevice * misc); 45extern int misc_register(struct miscdevice * misc);
46extern int misc_deregister(struct miscdevice * misc); 46extern int __misc_deregister(struct miscdevice *misc, bool suspended);
47static inline int misc_deregister(struct miscdevice *misc)
48{
49 return __misc_deregister(misc, false);
50}
51static inline int misc_deregister_suspended(struct miscdevice *misc)
52{
53 return __misc_deregister(misc, true);
54}
47 55
48#define MODULE_ALIAS_MISCDEV(minor) \ 56#define MODULE_ALIAS_MISCDEV(minor) \
49 MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \ 57 MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1bba6789a50a..89d7c691b93a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -227,10 +227,22 @@ static inline int put_page_testzero(struct page *page)
227 */ 227 */
228static inline int get_page_unless_zero(struct page *page) 228static inline int get_page_unless_zero(struct page *page)
229{ 229{
230 VM_BUG_ON(PageCompound(page)); 230 VM_BUG_ON(PageTail(page));
231 return atomic_inc_not_zero(&page->_count); 231 return atomic_inc_not_zero(&page->_count);
232} 232}
233 233
234/* Support for virtually mapped pages */
235struct page *vmalloc_to_page(const void *addr);
236unsigned long vmalloc_to_pfn(const void *addr);
237
238/* Determine if an address is within the vmalloc range */
239static inline int is_vmalloc_addr(const void *x)
240{
241 unsigned long addr = (unsigned long)x;
242
243 return addr >= VMALLOC_START && addr < VMALLOC_END;
244}
245
234static inline struct page *compound_head(struct page *page) 246static inline struct page *compound_head(struct page *page)
235{ 247{
236 if (unlikely(PageTail(page))) 248 if (unlikely(PageTail(page)))
@@ -706,6 +718,28 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
706 struct vm_area_struct *start_vma, unsigned long start_addr, 718 struct vm_area_struct *start_vma, unsigned long start_addr,
707 unsigned long end_addr, unsigned long *nr_accounted, 719 unsigned long end_addr, unsigned long *nr_accounted,
708 struct zap_details *); 720 struct zap_details *);
721
722/**
723 * mm_walk - callbacks for walk_page_range
724 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry
725 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry
726 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
727 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
728 * @pte_hole: if set, called for each hole at all levels
729 *
730 * (see walk_page_range for more details)
731 */
732struct mm_walk {
733 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, void *);
734 int (*pud_entry)(pud_t *, unsigned long, unsigned long, void *);
735 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, void *);
736 int (*pte_entry)(pte_t *, unsigned long, unsigned long, void *);
737 int (*pte_hole)(unsigned long, unsigned long, void *);
738};
739
740int walk_page_range(const struct mm_struct *, unsigned long addr,
741 unsigned long end, const struct mm_walk *walk,
742 void *private);
709void free_pgd_range(struct mmu_gather **tlb, unsigned long addr, 743void free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
710 unsigned long end, unsigned long floor, unsigned long ceiling); 744 unsigned long end, unsigned long floor, unsigned long ceiling);
711void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma, 745void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma,
@@ -1089,8 +1123,6 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1089 1123
1090pgprot_t vm_get_page_prot(unsigned long vm_flags); 1124pgprot_t vm_get_page_prot(unsigned long vm_flags);
1091struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); 1125struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
1092struct page *vmalloc_to_page(void *addr);
1093unsigned long vmalloc_to_pfn(void *addr);
1094int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 1126int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1095 unsigned long pfn, unsigned long size, pgprot_t); 1127 unsigned long pfn, unsigned long size, pgprot_t);
1096int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 1128int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 4c4522a51a3b..8d8d1977736e 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -113,7 +113,7 @@ struct per_cpu_pages {
113}; 113};
114 114
115struct per_cpu_pageset { 115struct per_cpu_pageset {
116 struct per_cpu_pages pcp[2]; /* 0: hot. 1: cold */ 116 struct per_cpu_pages pcp;
117#ifdef CONFIG_NUMA 117#ifdef CONFIG_NUMA
118 s8 expire; 118 s8 expire;
119#endif 119#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e9fddb42f26c..139d49d2f078 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -343,7 +343,8 @@ struct sdio_device_id {
343 __u8 class; /* Standard interface or SDIO_ANY_ID */ 343 __u8 class; /* Standard interface or SDIO_ANY_ID */
344 __u16 vendor; /* Vendor or SDIO_ANY_ID */ 344 __u16 vendor; /* Vendor or SDIO_ANY_ID */
345 __u16 device; /* Device ID or SDIO_ANY_ID */ 345 __u16 device; /* Device ID or SDIO_ANY_ID */
346 kernel_ulong_t driver_data; /* Data private to the driver */ 346 kernel_ulong_t driver_data /* Data private to the driver */
347 __attribute__((aligned(sizeof(kernel_ulong_t))));
347}; 348};
348 349
349/* SSB core, see drivers/ssb/ */ 350/* SSB core, see drivers/ssb/ */
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 601479772b98..05c590352dd7 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -125,15 +125,20 @@ static inline int fastcall mutex_is_locked(struct mutex *lock)
125extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 125extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
126extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, 126extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
127 unsigned int subclass); 127 unsigned int subclass);
128extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
129 unsigned int subclass);
128 130
129#define mutex_lock(lock) mutex_lock_nested(lock, 0) 131#define mutex_lock(lock) mutex_lock_nested(lock, 0)
130#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) 132#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
133#define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0)
131#else 134#else
132extern void fastcall mutex_lock(struct mutex *lock); 135extern void fastcall mutex_lock(struct mutex *lock);
133extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); 136extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock);
137extern int __must_check fastcall mutex_lock_killable(struct mutex *lock);
134 138
135# define mutex_lock_nested(lock, subclass) mutex_lock(lock) 139# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
136# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) 140# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock)
141# define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock)
137#endif 142#endif
138 143
139/* 144/*
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b0813c3286b1..047d432bde55 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1414,12 +1414,16 @@ extern void dev_set_rx_mode(struct net_device *dev);
1414extern void __dev_set_rx_mode(struct net_device *dev); 1414extern void __dev_set_rx_mode(struct net_device *dev);
1415extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); 1415extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen);
1416extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); 1416extern int dev_unicast_add(struct net_device *dev, void *addr, int alen);
1417extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1418extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1417extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); 1419extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
1418extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); 1420extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1419extern int dev_mc_sync(struct net_device *to, struct net_device *from); 1421extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1420extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 1422extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1421extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all); 1423extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1422extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); 1424extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1425extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1426extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1423extern void dev_set_promiscuity(struct net_device *dev, int inc); 1427extern void dev_set_promiscuity(struct net_device *dev, int inc);
1424extern void dev_set_allmulti(struct net_device *dev, int inc); 1428extern void dev_set_allmulti(struct net_device *dev, int inc);
1425extern void netdev_state_change(struct net_device *dev); 1429extern void netdev_state_change(struct net_device *dev);
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
index 23435496d24a..3bbde0c3a8a6 100644
--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/netfilter/nf_conntrack_common.h> 5#include <linux/netfilter/nf_conntrack_common.h>
6 6
7extern const char *pptp_msg_name[]; 7extern const char *const pptp_msg_name[];
8 8
9/* state of the control session */ 9/* state of the control session */
10enum pptp_ctrlsess_state { 10enum pptp_ctrlsess_state {
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 9fff19779bd5..8e5ce1ca7bfc 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -30,9 +30,9 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb,
30 struct nf_conntrack_expect *exp, 30 struct nf_conntrack_expect *exp,
31 const char *dptr); 31 const char *dptr);
32 32
33extern int ct_sip_get_info(struct nf_conn *ct, const char *dptr, size_t dlen, 33extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr,
34 unsigned int *matchoff, unsigned int *matchlen, 34 size_t dlen, unsigned int *matchoff,
35 enum sip_header_pos pos); 35 unsigned int *matchlen, enum sip_header_pos pos);
36extern int ct_sip_lnlen(const char *line, const char *limit); 36extern int ct_sip_lnlen(const char *line, const char *limit);
37extern const char *ct_sip_search(const char *needle, const char *haystack, 37extern const char *ct_sip_search(const char *needle, const char *haystack,
38 size_t needle_len, size_t haystack_len, 38 size_t needle_len, size_t haystack_len,
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index b99ede51318a..b2c62cc618f5 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -214,7 +214,7 @@ struct xt_match
214 /* Free to use by each match */ 214 /* Free to use by each match */
215 unsigned long data; 215 unsigned long data;
216 216
217 char *table; 217 const char *table;
218 unsigned int matchsize; 218 unsigned int matchsize;
219 unsigned int compatsize; 219 unsigned int compatsize;
220 unsigned int hooks; 220 unsigned int hooks;
@@ -261,7 +261,7 @@ struct xt_target
261 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 261 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
262 struct module *me; 262 struct module *me;
263 263
264 char *table; 264 const char *table;
265 unsigned int targetsize; 265 unsigned int targetsize;
266 unsigned int compatsize; 266 unsigned int compatsize;
267 unsigned int hooks; 267 unsigned int hooks;
@@ -277,7 +277,7 @@ struct xt_table
277 struct list_head list; 277 struct list_head list;
278 278
279 /* A unique name... */ 279 /* A unique name... */
280 char name[XT_TABLE_MAXNAMELEN]; 280 const char name[XT_TABLE_MAXNAMELEN];
281 281
282 /* What hooks you will enter on */ 282 /* What hooks you will enter on */
283 unsigned int valid_hooks; 283 unsigned int valid_hooks;
@@ -335,9 +335,10 @@ extern int xt_check_target(const struct xt_target *target, unsigned short family
335 unsigned int size, const char *table, unsigned int hook, 335 unsigned int size, const char *table, unsigned int hook,
336 unsigned short proto, int inv_proto); 336 unsigned short proto, int inv_proto);
337 337
338extern int xt_register_table(struct xt_table *table, 338extern struct xt_table *xt_register_table(struct net *net,
339 struct xt_table_info *bootstrap, 339 struct xt_table *table,
340 struct xt_table_info *newinfo); 340 struct xt_table_info *bootstrap,
341 struct xt_table_info *newinfo);
341extern void *xt_unregister_table(struct xt_table *table); 342extern void *xt_unregister_table(struct xt_table *table);
342 343
343extern struct xt_table_info *xt_replace_table(struct xt_table *table, 344extern struct xt_table_info *xt_replace_table(struct xt_table *table,
@@ -352,11 +353,12 @@ extern struct xt_target *xt_request_find_target(int af, const char *name,
352extern int xt_find_revision(int af, const char *name, u8 revision, int target, 353extern int xt_find_revision(int af, const char *name, u8 revision, int target,
353 int *err); 354 int *err);
354 355
355extern struct xt_table *xt_find_table_lock(int af, const char *name); 356extern struct xt_table *xt_find_table_lock(struct net *net, int af,
357 const char *name);
356extern void xt_table_unlock(struct xt_table *t); 358extern void xt_table_unlock(struct xt_table *t);
357 359
358extern int xt_proto_init(int af); 360extern int xt_proto_init(struct net *net, int af);
359extern void xt_proto_fini(int af); 361extern void xt_proto_fini(struct net *net, int af);
360 362
361extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 363extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
362extern void xt_free_table_info(struct xt_table_info *info); 364extern void xt_free_table_info(struct xt_table_info *info);
@@ -430,15 +432,15 @@ extern short xt_compat_calc_jump(int af, unsigned int offset);
430 432
431extern int xt_compat_match_offset(struct xt_match *match); 433extern int xt_compat_match_offset(struct xt_match *match);
432extern int xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,
433 void **dstptr, int *size); 435 void **dstptr, unsigned int *size);
434extern int xt_compat_match_to_user(struct xt_entry_match *m, 436extern int xt_compat_match_to_user(struct xt_entry_match *m,
435 void __user **dstptr, int *size); 437 void __user **dstptr, unsigned int *size);
436 438
437extern int xt_compat_target_offset(struct xt_target *target); 439extern int xt_compat_target_offset(struct xt_target *target);
438extern void xt_compat_target_from_user(struct xt_entry_target *t, 440extern void xt_compat_target_from_user(struct xt_entry_target *t,
439 void **dstptr, int *size); 441 void **dstptr, unsigned int *size);
440extern int xt_compat_target_to_user(struct xt_entry_target *t, 442extern int xt_compat_target_to_user(struct xt_entry_target *t,
441 void __user **dstptr, int *size); 443 void __user **dstptr, unsigned int *size);
442 444
443#endif /* CONFIG_COMPAT */ 445#endif /* CONFIG_COMPAT */
444#endif /* __KERNEL__ */ 446#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index d2492a3329be..f3fd83e46bab 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -6,9 +6,6 @@
6#define _XT_CONNTRACK_H 6#define _XT_CONNTRACK_H
7 7
8#include <linux/netfilter/nf_conntrack_tuple_common.h> 8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#ifdef __KERNEL__
10# include <linux/in.h>
11#endif
12 9
13#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 10#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
14#define XT_CONNTRACK_STATE_INVALID (1 << 0) 11#define XT_CONNTRACK_STATE_INVALID (1 << 0)
@@ -18,14 +15,21 @@
18#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) 15#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
19 16
20/* flags, invflags: */ 17/* flags, invflags: */
21#define XT_CONNTRACK_STATE 0x01 18enum {
22#define XT_CONNTRACK_PROTO 0x02 19 XT_CONNTRACK_STATE = 1 << 0,
23#define XT_CONNTRACK_ORIGSRC 0x04 20 XT_CONNTRACK_PROTO = 1 << 1,
24#define XT_CONNTRACK_ORIGDST 0x08 21 XT_CONNTRACK_ORIGSRC = 1 << 2,
25#define XT_CONNTRACK_REPLSRC 0x10 22 XT_CONNTRACK_ORIGDST = 1 << 3,
26#define XT_CONNTRACK_REPLDST 0x20 23 XT_CONNTRACK_REPLSRC = 1 << 4,
27#define XT_CONNTRACK_STATUS 0x40 24 XT_CONNTRACK_REPLDST = 1 << 5,
28#define XT_CONNTRACK_EXPIRES 0x80 25 XT_CONNTRACK_STATUS = 1 << 6,
26 XT_CONNTRACK_EXPIRES = 1 << 7,
27 XT_CONNTRACK_ORIGSRC_PORT = 1 << 8,
28 XT_CONNTRACK_ORIGDST_PORT = 1 << 9,
29 XT_CONNTRACK_REPLSRC_PORT = 1 << 10,
30 XT_CONNTRACK_REPLDST_PORT = 1 << 11,
31 XT_CONNTRACK_DIRECTION = 1 << 12,
32};
29 33
30/* This is exposed to userspace, so remains frozen in time. */ 34/* This is exposed to userspace, so remains frozen in time. */
31struct ip_conntrack_old_tuple 35struct ip_conntrack_old_tuple
@@ -70,8 +74,10 @@ struct xt_conntrack_mtinfo1 {
70 union nf_inet_addr repldst_addr, repldst_mask; 74 union nf_inet_addr repldst_addr, repldst_mask;
71 u_int32_t expires_min, expires_max; 75 u_int32_t expires_min, expires_max;
72 u_int16_t l4proto; 76 u_int16_t l4proto;
77 __be16 origsrc_port, origdst_port;
78 __be16 replsrc_port, repldst_port;
79 u_int16_t match_flags, invert_flags;
73 u_int8_t state_mask, status_mask; 80 u_int8_t state_mask, status_mask;
74 u_int8_t match_flags, invert_flags;
75}; 81};
76 82
77#endif /*_XT_CONNTRACK_H*/ 83#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index c19972e4564d..58b818ee41ca 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -9,13 +9,16 @@
9/* details of this structure hidden by the implementation */ 9/* details of this structure hidden by the implementation */
10struct xt_hashlimit_htable; 10struct xt_hashlimit_htable;
11 11
12#define XT_HASHLIMIT_HASH_DIP 0x0001 12enum {
13#define XT_HASHLIMIT_HASH_DPT 0x0002 13 XT_HASHLIMIT_HASH_DIP = 1 << 0,
14#define XT_HASHLIMIT_HASH_SIP 0x0004 14 XT_HASHLIMIT_HASH_DPT = 1 << 1,
15#define XT_HASHLIMIT_HASH_SPT 0x0008 15 XT_HASHLIMIT_HASH_SIP = 1 << 2,
16 XT_HASHLIMIT_HASH_SPT = 1 << 3,
17 XT_HASHLIMIT_INVERT = 1 << 4,
18};
16 19
17struct hashlimit_cfg { 20struct hashlimit_cfg {
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */ 21 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */ 22 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */ 23 u_int32_t burst; /* Period multiplier for upper limit. */
21 24
@@ -37,4 +40,28 @@ struct xt_hashlimit_info {
37 struct xt_hashlimit_info *master; 40 struct xt_hashlimit_info *master;
38 } u; 41 } u;
39}; 42};
43
44struct hashlimit_cfg1 {
45 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
46 u_int32_t avg; /* Average secs between packets * scale */
47 u_int32_t burst; /* Period multiplier for upper limit. */
48
49 /* user specified */
50 u_int32_t size; /* how many buckets */
51 u_int32_t max; /* max number of entries */
52 u_int32_t gc_interval; /* gc interval */
53 u_int32_t expire; /* when do entries expire? */
54
55 u_int8_t srcmask, dstmask;
56};
57
58struct xt_hashlimit_mtinfo1 {
59 char name[IFNAMSIZ];
60 struct hashlimit_cfg1 cfg;
61
62 /* Used internally by the kernel */
63 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
64 struct xt_hashlimit_mtinfo1 *master __attribute__((aligned(8)));
65};
66
40#endif /*_XT_HASHLIMIT_H*/ 67#endif /*_XT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h
index eacd34efebd5..c84e52cfe415 100644
--- a/include/linux/netfilter/xt_owner.h
+++ b/include/linux/netfilter/xt_owner.h
@@ -8,8 +8,8 @@ enum {
8}; 8};
9 9
10struct xt_owner_match_info { 10struct xt_owner_match_info {
11 u_int32_t uid; 11 u_int32_t uid_min, uid_max;
12 u_int32_t gid; 12 u_int32_t gid_min, gid_max;
13 u_int8_t match, invert; 13 u_int8_t match, invert;
14}; 14};
15 15
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 53dd4df27aa1..db223ca92c8b 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -271,8 +271,9 @@ struct arpt_error
271 xt_register_target(tgt); }) 271 xt_register_target(tgt); })
272#define arpt_unregister_target(tgt) xt_unregister_target(tgt) 272#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
273 273
274extern int arpt_register_table(struct arpt_table *table, 274extern struct arpt_table *arpt_register_table(struct net *net,
275 const struct arpt_replace *repl); 275 struct arpt_table *table,
276 const struct arpt_replace *repl);
276extern void arpt_unregister_table(struct arpt_table *table); 277extern void arpt_unregister_table(struct arpt_table *table);
277extern unsigned int arpt_do_table(struct sk_buff *skb, 278extern unsigned int arpt_do_table(struct sk_buff *skb,
278 unsigned int hook, 279 unsigned int hook,
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 45fcad91e67b..bfc889f90276 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -244,8 +244,9 @@ ipt_get_target(struct ipt_entry *e)
244#include <linux/init.h> 244#include <linux/init.h>
245extern void ipt_init(void) __init; 245extern void ipt_init(void) __init;
246 246
247extern int ipt_register_table(struct xt_table *table, 247extern struct xt_table *ipt_register_table(struct net *net,
248 const struct ipt_replace *repl); 248 struct xt_table *table,
249 const struct ipt_replace *repl);
249extern void ipt_unregister_table(struct xt_table *table); 250extern void ipt_unregister_table(struct xt_table *table);
250 251
251/* Standard entry. */ 252/* Standard entry. */
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 110801d699ee..f2507dcc5750 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -305,8 +305,9 @@ ip6t_get_target(struct ip6t_entry *e)
305#include <linux/init.h> 305#include <linux/init.h>
306extern void ip6t_init(void) __init; 306extern void ip6t_init(void) __init;
307 307
308extern int ip6t_register_table(struct xt_table *table, 308extern struct xt_table *ip6t_register_table(struct net *net,
309 const struct ip6t_replace *repl); 309 struct xt_table *table,
310 const struct ip6t_replace *repl);
310extern void ip6t_unregister_table(struct xt_table *table); 311extern void ip6t_unregister_table(struct xt_table *table);
311extern unsigned int ip6t_do_table(struct sk_buff *skb, 312extern unsigned int ip6t_do_table(struct sk_buff *skb,
312 unsigned int hook, 313 unsigned int hook,
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index bd13b6f4a98e..fb0713b6ffaf 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -219,7 +219,7 @@ struct netlink_callback
219 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 219 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
220 int (*done)(struct netlink_callback *cb); 220 int (*done)(struct netlink_callback *cb);
221 int family; 221 int family;
222 long args[5]; 222 long args[6];
223}; 223};
224 224
225struct netlink_notify 225struct netlink_notify
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 099ddb4481c0..a69ba80f2dfe 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -556,14 +556,7 @@ extern void * nfs_root_data(void);
556 556
557#define nfs_wait_event(clnt, wq, condition) \ 557#define nfs_wait_event(clnt, wq, condition) \
558({ \ 558({ \
559 int __retval = 0; \ 559 int __retval = wait_event_killable(wq, condition); \
560 if (clnt->cl_intr) { \
561 sigset_t oldmask; \
562 rpc_clnt_sigmask(clnt, &oldmask); \
563 __retval = wait_event_interruptible(wq, condition); \
564 rpc_clnt_sigunmask(clnt, &oldmask); \
565 } else \
566 wait_event(wq, condition); \
567 __retval; \ 560 __retval; \
568}) 561})
569 562
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index a3ade89a64d2..df7c6b7a7ebb 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -48,7 +48,7 @@ struct nfs_mount_data {
48/* bits in the flags field */ 48/* bits in the flags field */
49 49
50#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 50#define NFS_MOUNT_SOFT 0x0001 /* 1 */
51#define NFS_MOUNT_INTR 0x0002 /* 1 */ 51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */
52#define NFS_MOUNT_SECURE 0x0004 /* 1 */ 52#define NFS_MOUNT_SECURE 0x0004 /* 1 */
53#define NFS_MOUNT_POSIX 0x0008 /* 1 */ 53#define NFS_MOUNT_POSIX 0x0008 /* 1 */
54#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ 54#define NFS_MOUNT_NOCTO 0x0010 /* 1 */
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index d9c5455808e5..e726fc3a4375 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -4,4 +4,3 @@ unifdef-y += stats.h
4unifdef-y += syscall.h 4unifdef-y += syscall.h
5unifdef-y += nfsfh.h 5unifdef-y += nfsfh.h
6unifdef-y += debug.h 6unifdef-y += debug.h
7unifdef-y += auth.h
diff --git a/include/linux/nfsd/auth.h b/include/linux/nfsd/auth.h
deleted file mode 100644
index 0fb9f7212195..000000000000
--- a/include/linux/nfsd/auth.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * include/linux/nfsd/auth.h
3 *
4 * nfsd-specific authentication stuff.
5 * uid/gid mapping not yet implemented.
6 *
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef LINUX_NFSD_AUTH_H
11#define LINUX_NFSD_AUTH_H
12
13#ifdef __KERNEL__
14
15#define nfsd_luid(rq, uid) ((u32)(uid))
16#define nfsd_lgid(rq, gid) ((u32)(gid))
17#define nfsd_ruid(rq, uid) ((u32)(uid))
18#define nfsd_rgid(rq, gid) ((u32)(gid))
19
20/*
21 * Set the current process's fsuid/fsgid etc to those of the NFS
22 * client user
23 */
24int nfsd_setuser(struct svc_rqst *, struct svc_export *);
25
26#endif /* __KERNEL__ */
27#endif /* LINUX_NFSD_AUTH_H */
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index 007480cd6a60..7b5d784cc858 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -72,8 +72,8 @@ enum {
72 */ 72 */
73#define RC_DELAY (HZ/5) 73#define RC_DELAY (HZ/5)
74 74
75void nfsd_cache_init(void); 75int nfsd_reply_cache_init(void);
76void nfsd_cache_shutdown(void); 76void nfsd_reply_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int); 77int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, __be32 *); 78void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
79 79
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index bcb7abafbca9..3a1687251367 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -122,7 +122,7 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
122/* 122/*
123 * Function declarations 123 * Function declarations
124 */ 124 */
125void nfsd_export_init(void); 125int nfsd_export_init(void);
126void nfsd_export_shutdown(void); 126void nfsd_export_shutdown(void);
127void nfsd_export_flush(void); 127void nfsd_export_flush(void);
128void exp_readlock(void); 128void exp_readlock(void);
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 604a0d786bc6..8caf4c4f64e6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -20,7 +20,6 @@
20#include <linux/nfsd/debug.h> 20#include <linux/nfsd/debug.h>
21#include <linux/nfsd/nfsfh.h> 21#include <linux/nfsd/nfsfh.h>
22#include <linux/nfsd/export.h> 22#include <linux/nfsd/export.h>
23#include <linux/nfsd/auth.h>
24#include <linux/nfsd/stats.h> 23#include <linux/nfsd/stats.h>
25/* 24/*
26 * nfsd version 25 * nfsd version
@@ -70,9 +69,9 @@ void nfsd_racache_shutdown(void);
70int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, 69int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
71 struct svc_export **expp); 70 struct svc_export **expp);
72__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, 71__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
73 const char *, int, struct svc_fh *); 72 const char *, unsigned int, struct svc_fh *);
74__be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, 73__be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
75 const char *, int, 74 const char *, unsigned int,
76 struct svc_export **, struct dentry **); 75 struct svc_export **, struct dentry **);
77__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, 76__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
78 struct iattr *, int, time_t); 77 struct iattr *, int, time_t);
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
index 8bcddccb6c42..4e439765b705 100644
--- a/include/linux/nfsd/syscall.h
+++ b/include/linux/nfsd/syscall.h
@@ -18,7 +18,6 @@
18#include <linux/nfsd/const.h> 18#include <linux/nfsd/const.h>
19#include <linux/nfsd/export.h> 19#include <linux/nfsd/export.h>
20#include <linux/nfsd/nfsfh.h> 20#include <linux/nfsd/nfsfh.h>
21#include <linux/nfsd/auth.h>
22 21
23/* 22/*
24 * Version of the syscall interface 23 * Version of the syscall interface
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 67885d5e6e50..a0132ef58f21 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -23,7 +23,7 @@ struct nfsd_sattrargs {
23struct nfsd_diropargs { 23struct nfsd_diropargs {
24 struct svc_fh fh; 24 struct svc_fh fh;
25 char * name; 25 char * name;
26 int len; 26 unsigned int len;
27}; 27};
28 28
29struct nfsd_readargs { 29struct nfsd_readargs {
@@ -43,17 +43,17 @@ struct nfsd_writeargs {
43struct nfsd_createargs { 43struct nfsd_createargs {
44 struct svc_fh fh; 44 struct svc_fh fh;
45 char * name; 45 char * name;
46 int len; 46 unsigned int len;
47 struct iattr attrs; 47 struct iattr attrs;
48}; 48};
49 49
50struct nfsd_renameargs { 50struct nfsd_renameargs {
51 struct svc_fh ffh; 51 struct svc_fh ffh;
52 char * fname; 52 char * fname;
53 int flen; 53 unsigned int flen;
54 struct svc_fh tfh; 54 struct svc_fh tfh;
55 char * tname; 55 char * tname;
56 int tlen; 56 unsigned int tlen;
57}; 57};
58 58
59struct nfsd_readlinkargs { 59struct nfsd_readlinkargs {
@@ -65,15 +65,15 @@ struct nfsd_linkargs {
65 struct svc_fh ffh; 65 struct svc_fh ffh;
66 struct svc_fh tfh; 66 struct svc_fh tfh;
67 char * tname; 67 char * tname;
68 int tlen; 68 unsigned int tlen;
69}; 69};
70 70
71struct nfsd_symlinkargs { 71struct nfsd_symlinkargs {
72 struct svc_fh ffh; 72 struct svc_fh ffh;
73 char * fname; 73 char * fname;
74 int flen; 74 unsigned int flen;
75 char * tname; 75 char * tname;
76 int tlen; 76 unsigned int tlen;
77 struct iattr attrs; 77 struct iattr attrs;
78}; 78};
79 79
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 89d9d6061a62..421eddd65a25 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -21,7 +21,7 @@ struct nfsd3_sattrargs {
21struct nfsd3_diropargs { 21struct nfsd3_diropargs {
22 struct svc_fh fh; 22 struct svc_fh fh;
23 char * name; 23 char * name;
24 int len; 24 unsigned int len;
25}; 25};
26 26
27struct nfsd3_accessargs { 27struct nfsd3_accessargs {
@@ -48,7 +48,7 @@ struct nfsd3_writeargs {
48struct nfsd3_createargs { 48struct nfsd3_createargs {
49 struct svc_fh fh; 49 struct svc_fh fh;
50 char * name; 50 char * name;
51 int len; 51 unsigned int len;
52 int createmode; 52 int createmode;
53 struct iattr attrs; 53 struct iattr attrs;
54 __be32 * verf; 54 __be32 * verf;
@@ -57,7 +57,7 @@ struct nfsd3_createargs {
57struct nfsd3_mknodargs { 57struct nfsd3_mknodargs {
58 struct svc_fh fh; 58 struct svc_fh fh;
59 char * name; 59 char * name;
60 int len; 60 unsigned int len;
61 __u32 ftype; 61 __u32 ftype;
62 __u32 major, minor; 62 __u32 major, minor;
63 struct iattr attrs; 63 struct iattr attrs;
@@ -66,10 +66,10 @@ struct nfsd3_mknodargs {
66struct nfsd3_renameargs { 66struct nfsd3_renameargs {
67 struct svc_fh ffh; 67 struct svc_fh ffh;
68 char * fname; 68 char * fname;
69 int flen; 69 unsigned int flen;
70 struct svc_fh tfh; 70 struct svc_fh tfh;
71 char * tname; 71 char * tname;
72 int tlen; 72 unsigned int tlen;
73}; 73};
74 74
75struct nfsd3_readlinkargs { 75struct nfsd3_readlinkargs {
@@ -81,15 +81,15 @@ struct nfsd3_linkargs {
81 struct svc_fh ffh; 81 struct svc_fh ffh;
82 struct svc_fh tfh; 82 struct svc_fh tfh;
83 char * tname; 83 char * tname;
84 int tlen; 84 unsigned int tlen;
85}; 85};
86 86
87struct nfsd3_symlinkargs { 87struct nfsd3_symlinkargs {
88 struct svc_fh ffh; 88 struct svc_fh ffh;
89 char * fname; 89 char * fname;
90 int flen; 90 unsigned int flen;
91 char * tname; 91 char * tname;
92 int tlen; 92 unsigned int tlen;
93 struct iattr attrs; 93 struct iattr attrs;
94}; 94};
95 95
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index b0ddfb41c790..27bd3e38ec5a 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -441,7 +441,7 @@ void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
441void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); 441void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
442__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 442__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
443 struct dentry *dentry, __be32 *buffer, int *countp, 443 struct dentry *dentry, __be32 *buffer, int *countp,
444 u32 *bmval, struct svc_rqst *); 444 u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
445extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, 445extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
446 struct nfsd4_compound_state *, 446 struct nfsd4_compound_state *,
447 struct nfsd4_setclientid *setclid); 447 struct nfsd4_setclientid *setclid);
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h
index e82746fcad14..d4a2ac18bd4c 100644
--- a/include/linux/nfsd_idmap.h
+++ b/include/linux/nfsd_idmap.h
@@ -44,11 +44,16 @@
44#define IDMAP_NAMESZ 128 44#define IDMAP_NAMESZ 128
45 45
46#ifdef CONFIG_NFSD_V4 46#ifdef CONFIG_NFSD_V4
47void nfsd_idmap_init(void); 47int nfsd_idmap_init(void);
48void nfsd_idmap_shutdown(void); 48void nfsd_idmap_shutdown(void);
49#else 49#else
50static inline void nfsd_idmap_init(void) {}; 50static inline int nfsd_idmap_init(void)
51static inline void nfsd_idmap_shutdown(void) {}; 51{
52 return 0;
53}
54static inline void nfsd_idmap_shutdown(void)
55{
56}
52#endif 57#endif
53 58
54int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); 59int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *);
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 5dfbc684ce7d..f4df40038f0c 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -228,6 +228,8 @@ static inline int notifier_to_errno(int ret)
228#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */ 228#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */
229#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ 229#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
230#define PM_POST_SUSPEND 0x0004 /* Suspend finished */ 230#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
231#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
232#define PM_POST_RESTORE 0x0006 /* Restore failed */
231 233
232/* Console keyboard events. 234/* Console keyboard events.
233 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and 235 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index cdb3e9b8db54..c4355076d1a5 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -132,10 +132,12 @@ enum nubus_drhw {
132 NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */ 132 NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */
133 NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */ 133 NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */
134 NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */ 134 NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */
135 NUBUS_DRHW_RASTER_24LXI = 0x02A0, /* RasterOps 8/24 XLi */ 135 NUBUS_DRHW_RASTER_24XLI = 0x02A0, /* RasterOps 8/24 XLi */
136 NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */ 136 NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */
137 NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */ 137 NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */
138 NUBUS_DRHW_RASTER_24XLTV = 0x02B7, /* RasterOps 24XLTV */
138 NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */ 139 NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */
140 NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9, /* SuperMac ThunderLight */
139 NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */ 141 NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */
140 NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */ 142 NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */
141 NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */ 143 NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */
diff --git a/include/linux/of.h b/include/linux/of.h
index b5f33efcb8e2..6981016dcc25 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -50,6 +50,7 @@ extern struct device_node *of_find_matching_node(struct device_node *from,
50extern struct device_node *of_find_node_by_path(const char *path); 50extern struct device_node *of_find_node_by_path(const char *path);
51extern struct device_node *of_find_node_by_phandle(phandle handle); 51extern struct device_node *of_find_node_by_phandle(phandle handle);
52extern struct device_node *of_get_parent(const struct device_node *node); 52extern struct device_node *of_get_parent(const struct device_node *node);
53extern struct device_node *of_get_next_parent(struct device_node *node);
53extern struct device_node *of_get_next_child(const struct device_node *node, 54extern struct device_node *of_get_next_child(const struct device_node *node,
54 struct device_node *prev); 55 struct device_node *prev);
55#define for_each_child_of_node(parent, child) \ 56#define for_each_child_of_node(parent, child) \
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 209d3a47f50f..bbad43fb8181 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -131,16 +131,52 @@
131#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags) 131#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags)
132#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) 132#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
133 133
134#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) 134static inline int PageUptodate(struct page *page)
135{
136 int ret = test_bit(PG_uptodate, &(page)->flags);
137
138 /*
139 * Must ensure that the data we read out of the page is loaded
140 * _after_ we've loaded page->flags to check for PageUptodate.
141 * We can skip the barrier if the page is not uptodate, because
142 * we wouldn't be reading anything from it.
143 *
144 * See SetPageUptodate() for the other side of the story.
145 */
146 if (ret)
147 smp_rmb();
148
149 return ret;
150}
151
152static inline void __SetPageUptodate(struct page *page)
153{
154 smp_wmb();
155 __set_bit(PG_uptodate, &(page)->flags);
135#ifdef CONFIG_S390 156#ifdef CONFIG_S390
157 page_clear_dirty(page);
158#endif
159}
160
136static inline void SetPageUptodate(struct page *page) 161static inline void SetPageUptodate(struct page *page)
137{ 162{
163#ifdef CONFIG_S390
138 if (!test_and_set_bit(PG_uptodate, &page->flags)) 164 if (!test_and_set_bit(PG_uptodate, &page->flags))
139 page_clear_dirty(page); 165 page_clear_dirty(page);
140}
141#else 166#else
142#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 167 /*
168 * Memory barrier must be issued before setting the PG_uptodate bit,
169 * so that all previous stores issued in order to bring the page
170 * uptodate are actually visible before PageUptodate becomes true.
171 *
172 * s390 doesn't need an explicit smp_wmb here because the test and
173 * set bit already provides full barriers.
174 */
175 smp_wmb();
176 set_bit(PG_uptodate, &(page)->flags);
143#endif 177#endif
178}
179
144#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) 180#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags)
145 181
146#define PageDirty(page) test_bit(PG_dirty, &(page)->flags) 182#define PageDirty(page) test_bit(PG_dirty, &(page)->flags)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index db8a410ae9e1..4b62a105622b 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -157,6 +157,7 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
157} 157}
158 158
159extern void FASTCALL(__lock_page(struct page *page)); 159extern void FASTCALL(__lock_page(struct page *page));
160extern int FASTCALL(__lock_page_killable(struct page *page));
160extern void FASTCALL(__lock_page_nosync(struct page *page)); 161extern void FASTCALL(__lock_page_nosync(struct page *page));
161extern void FASTCALL(unlock_page(struct page *page)); 162extern void FASTCALL(unlock_page(struct page *page));
162 163
@@ -171,6 +172,19 @@ static inline void lock_page(struct page *page)
171} 172}
172 173
173/* 174/*
175 * lock_page_killable is like lock_page but can be interrupted by fatal
176 * signals. It returns 0 if it locked the page and -EINTR if it was
177 * killed while waiting.
178 */
179static inline int lock_page_killable(struct page *page)
180{
181 might_sleep();
182 if (TestSetPageLocked(page))
183 return __lock_page_killable(page);
184 return 0;
185}
186
187/*
174 * lock_page_nosync should only be used if we can't pin the page's inode. 188 * lock_page_nosync should only be used if we can't pin the page's inode.
175 * Doesn't play quite so well with block device plugging. 189 * Doesn't play quite so well with block device plugging.
176 */ 190 */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 936ef82ed76a..3ba25065fa96 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -48,7 +48,15 @@
48 48
49#ifdef CONFIG_ACPI 49#ifdef CONFIG_ACPI
50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); 50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
51extern acpi_status pci_osc_support_set(u32 flags); 51extern acpi_status __pci_osc_support_set(u32 flags, const char *hid);
52static inline acpi_status pci_osc_support_set(u32 flags)
53{
54 return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING);
55}
56static inline acpi_status pcie_osc_support_set(u32 flags)
57{
58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
59}
52#else 60#else
53#if !defined(AE_ERROR) 61#if !defined(AE_ERROR)
54typedef u32 acpi_status; 62typedef u32 acpi_status;
@@ -57,6 +65,7 @@ typedef u32 acpi_status;
57static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) 65static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
58{return AE_ERROR;} 66{return AE_ERROR;}
59static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 67static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
68static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
60#endif 69#endif
61 70
62#endif /* _PCI_ACPI_H_ */ 71#endif /* _PCI_ACPI_H_ */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ae1006322f80..7215d3b1f4af 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -28,7 +28,7 @@
28 * 7:3 = slot 28 * 7:3 = slot
29 * 2:0 = function 29 * 2:0 = function
30 */ 30 */
31#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) 31#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
32#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) 32#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
33#define PCI_FUNC(devfn) ((devfn) & 0x07) 33#define PCI_FUNC(devfn) ((devfn) & 0x07)
34 34
@@ -66,7 +66,6 @@ enum pci_mmap_state {
66#define PCI_DMA_FROMDEVICE 2 66#define PCI_DMA_FROMDEVICE 2
67#define PCI_DMA_NONE 3 67#define PCI_DMA_NONE 3
68 68
69#define DEVICE_COUNT_COMPATIBLE 4
70#define DEVICE_COUNT_RESOURCE 12 69#define DEVICE_COUNT_RESOURCE 12
71 70
72typedef int __bitwise pci_power_t; 71typedef int __bitwise pci_power_t;
@@ -160,6 +159,8 @@ struct pci_dev {
160 this if your device has broken DMA 159 this if your device has broken DMA
161 or supports 64-bit transfers. */ 160 or supports 64-bit transfers. */
162 161
162 struct device_dma_parameters dma_parms;
163
163 pci_power_t current_state; /* Current operating state. In ACPI-speak, 164 pci_power_t current_state; /* Current operating state. In ACPI-speak,
164 this is D0-D3, D0 being fully functional, 165 this is D0-D3, D0 being fully functional,
165 and D3 being off. */ 166 and D3 being off. */
@@ -167,10 +168,6 @@ struct pci_dev {
167 pci_channel_state_t error_state; /* current connectivity state */ 168 pci_channel_state_t error_state; /* current connectivity state */
168 struct device dev; /* Generic device interface */ 169 struct device dev; /* Generic device interface */
169 170
170 /* device is compatible with these IDs */
171 unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
172 unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];
173
174 int cfg_size; /* Size of configuration space */ 171 int cfg_size; /* Size of configuration space */
175 172
176 /* 173 /*
@@ -219,7 +216,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
219} 216}
220 217
221static inline struct pci_cap_saved_state *pci_find_saved_cap( 218static inline struct pci_cap_saved_state *pci_find_saved_cap(
222 struct pci_dev *pci_dev,char cap) 219 struct pci_dev *pci_dev, char cap)
223{ 220{
224 struct pci_cap_saved_state *tmp; 221 struct pci_cap_saved_state *tmp;
225 struct hlist_node *pos; 222 struct hlist_node *pos;
@@ -278,13 +275,13 @@ struct pci_bus {
278 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 275 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
279 pci_bus_flags_t bus_flags; /* Inherited by child busses */ 276 pci_bus_flags_t bus_flags; /* Inherited by child busses */
280 struct device *bridge; 277 struct device *bridge;
281 struct class_device class_dev; 278 struct device dev;
282 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 279 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
283 struct bin_attribute *legacy_mem; /* legacy mem */ 280 struct bin_attribute *legacy_mem; /* legacy mem */
284}; 281};
285 282
286#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 283#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
287#define to_pci_bus(n) container_of(n, struct pci_bus, class_dev) 284#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
288 285
289/* 286/*
290 * Error values that may be returned by PCI functions. 287 * Error values that may be returned by PCI functions.
@@ -314,8 +311,8 @@ struct pci_raw_ops {
314extern struct pci_raw_ops *raw_pci_ops; 311extern struct pci_raw_ops *raw_pci_ops;
315 312
316struct pci_bus_region { 313struct pci_bus_region {
317 unsigned long start; 314 resource_size_t start;
318 unsigned long end; 315 resource_size_t end;
319}; 316};
320 317
321struct pci_dynids { 318struct pci_dynids {
@@ -351,11 +348,10 @@ enum pci_ers_result {
351}; 348};
352 349
353/* PCI bus error event callbacks */ 350/* PCI bus error event callbacks */
354struct pci_error_handlers 351struct pci_error_handlers {
355{
356 /* PCI bus error detected on this device */ 352 /* PCI bus error detected on this device */
357 pci_ers_result_t (*error_detected)(struct pci_dev *dev, 353 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
358 enum pci_channel_state error); 354 enum pci_channel_state error);
359 355
360 /* MMIO has been re-enabled, but not DMA */ 356 /* MMIO has been re-enabled, but not DMA */
361 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); 357 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
@@ -390,7 +386,7 @@ struct pci_driver {
390 struct pci_dynids dynids; 386 struct pci_dynids dynids;
391}; 387};
392 388
393#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 389#define to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
394 390
395/** 391/**
396 * PCI_DEVICE - macro used to describe a specific pci device 392 * PCI_DEVICE - macro used to describe a specific pci device
@@ -448,7 +444,7 @@ extern int no_pci_devices(void);
448 444
449void pcibios_fixup_bus(struct pci_bus *); 445void pcibios_fixup_bus(struct pci_bus *);
450int __must_check pcibios_enable_device(struct pci_dev *, int mask); 446int __must_check pcibios_enable_device(struct pci_dev *, int mask);
451char *pcibios_setup (char *str); 447char *pcibios_setup(char *str);
452 448
453/* Used only when drivers/pci/setup.c is used */ 449/* Used only when drivers/pci/setup.c is used */
454void pcibios_align_resource(void *, struct resource *, resource_size_t, 450void pcibios_align_resource(void *, struct resource *, resource_size_t,
@@ -459,8 +455,10 @@ void pcibios_update_irq(struct pci_dev *, int irq);
459 455
460extern struct pci_bus *pci_find_bus(int domain, int busnr); 456extern struct pci_bus *pci_find_bus(int domain, int busnr);
461void pci_bus_add_devices(struct pci_bus *bus); 457void pci_bus_add_devices(struct pci_bus *bus);
462struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 458struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
463static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) 459 struct pci_ops *ops, void *sysdata);
460static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
461 void *sysdata)
464{ 462{
465 struct pci_bus *root_bus; 463 struct pci_bus *root_bus;
466 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); 464 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
@@ -468,15 +466,18 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
468 pci_bus_add_devices(root_bus); 466 pci_bus_add_devices(root_bus);
469 return root_bus; 467 return root_bus;
470} 468}
471struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 469struct pci_bus *pci_create_bus(struct device *parent, int bus,
472struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); 470 struct pci_ops *ops, void *sysdata);
471struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
472 int busnr);
473int pci_scan_slot(struct pci_bus *bus, int devfn); 473int pci_scan_slot(struct pci_bus *bus, int devfn);
474struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 474struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
475void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 475void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
476unsigned int pci_scan_child_bus(struct pci_bus *bus); 476unsigned int pci_scan_child_bus(struct pci_bus *bus);
477int __must_check pci_bus_add_device(struct pci_dev *dev); 477int __must_check pci_bus_add_device(struct pci_dev *dev);
478void pci_read_bridge_bases(struct pci_bus *child); 478void pci_read_bridge_bases(struct pci_bus *child);
479struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 479struct resource *pci_find_parent_resource(const struct pci_dev *dev,
480 struct resource *res);
480int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 481int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
481extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 482extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
482extern void pci_dev_put(struct pci_dev *dev); 483extern void pci_dev_put(struct pci_dev *dev);
@@ -489,15 +490,19 @@ extern void pci_sort_breadthfirst(void);
489/* Generic PCI functions exported to card drivers */ 490/* Generic PCI functions exported to card drivers */
490 491
491#ifdef CONFIG_PCI_LEGACY 492#ifdef CONFIG_PCI_LEGACY
492struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); 493struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
493struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn); 494 unsigned int device,
495 const struct pci_dev *from);
496struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
497 unsigned int devfn);
494#endif /* CONFIG_PCI_LEGACY */ 498#endif /* CONFIG_PCI_LEGACY */
495 499
496int pci_find_capability (struct pci_dev *dev, int cap); 500int pci_find_capability(struct pci_dev *dev, int cap);
497int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 501int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
498int pci_find_ext_capability (struct pci_dev *dev, int cap); 502int pci_find_ext_capability(struct pci_dev *dev, int cap);
499int pci_find_ht_capability (struct pci_dev *dev, int ht_cap); 503int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
500int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap); 504int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
505void pcie_wait_pending_transaction(struct pci_dev *dev);
501struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 506struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
502 507
503struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, 508struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
@@ -505,49 +510,58 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
505struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device, 510struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
506 struct pci_dev *from); 511 struct pci_dev *from);
507 512
508struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 513struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
509 unsigned int ss_vendor, unsigned int ss_device, 514 unsigned int ss_vendor, unsigned int ss_device,
510 struct pci_dev *from); 515 struct pci_dev *from);
511struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); 516struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
512struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); 517struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
513struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); 518struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
514int pci_dev_present(const struct pci_device_id *ids); 519int pci_dev_present(const struct pci_device_id *ids);
515const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); 520const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
516 521
517int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); 522int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
518int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); 523 int where, u8 *val);
519int pci_bus_read_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 *val); 524int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn,
520int pci_bus_write_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 val); 525 int where, u16 *val);
521int pci_bus_write_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 val); 526int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn,
522int pci_bus_write_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 val); 527 int where, u32 *val);
528int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn,
529 int where, u8 val);
530int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn,
531 int where, u16 val);
532int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
533 int where, u32 val);
523 534
524static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) 535static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val)
525{ 536{
526 return pci_bus_read_config_byte (dev->bus, dev->devfn, where, val); 537 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
527} 538}
528static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) 539static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val)
529{ 540{
530 return pci_bus_read_config_word (dev->bus, dev->devfn, where, val); 541 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
531} 542}
532static inline int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val) 543static inline int pci_read_config_dword(struct pci_dev *dev, int where,
544 u32 *val)
533{ 545{
534 return pci_bus_read_config_dword (dev->bus, dev->devfn, where, val); 546 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
535} 547}
536static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) 548static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val)
537{ 549{
538 return pci_bus_write_config_byte (dev->bus, dev->devfn, where, val); 550 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
539} 551}
540static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) 552static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val)
541{ 553{
542 return pci_bus_write_config_word (dev->bus, dev->devfn, where, val); 554 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
543} 555}
544static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val) 556static inline int pci_write_config_dword(struct pci_dev *dev, int where,
557 u32 val)
545{ 558{
546 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 559 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
547} 560}
548 561
549int __must_check pci_enable_device(struct pci_dev *dev); 562int __must_check pci_enable_device(struct pci_dev *dev);
550int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); 563int __must_check pci_enable_device_io(struct pci_dev *dev);
564int __must_check pci_enable_device_mem(struct pci_dev *dev);
551int __must_check pci_reenable_device(struct pci_dev *); 565int __must_check pci_reenable_device(struct pci_dev *);
552int __must_check pcim_enable_device(struct pci_dev *pdev); 566int __must_check pcim_enable_device(struct pci_dev *pdev);
553void pcim_pin_device(struct pci_dev *pdev); 567void pcim_pin_device(struct pci_dev *pdev);
@@ -568,6 +582,8 @@ void pci_intx(struct pci_dev *dev, int enable);
568void pci_msi_off(struct pci_dev *dev); 582void pci_msi_off(struct pci_dev *dev);
569int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 583int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
570int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 584int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
585int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
586int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
571int pcix_get_max_mmrbc(struct pci_dev *dev); 587int pcix_get_max_mmrbc(struct pci_dev *dev);
572int pcix_get_mmrbc(struct pci_dev *dev); 588int pcix_get_mmrbc(struct pci_dev *dev);
573int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 589int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
@@ -576,14 +592,11 @@ int pcie_set_readrq(struct pci_dev *dev, int rq);
576void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 592void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
577int __must_check pci_assign_resource(struct pci_dev *dev, int i); 593int __must_check pci_assign_resource(struct pci_dev *dev, int i);
578int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); 594int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
579void pci_restore_bars(struct pci_dev *dev);
580int pci_select_bars(struct pci_dev *dev, unsigned long flags); 595int pci_select_bars(struct pci_dev *dev, unsigned long flags);
581 596
582/* ROM control related routines */ 597/* ROM control related routines */
583void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 598void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
584void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
585void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 599void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
586void pci_remove_rom(struct pci_dev *pdev);
587size_t pci_get_rom_size(void __iomem *rom, size_t size); 600size_t pci_get_rom_size(void __iomem *rom, size_t size);
588 601
589/* Power management related routines */ 602/* Power management related routines */
@@ -594,7 +607,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
594int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 607int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
595 608
596/* Functions for PCI Hotplug drivers to use */ 609/* Functions for PCI Hotplug drivers to use */
597int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); 610int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
598 611
599/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 612/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
600void pci_bus_assign_resources(struct pci_bus *bus); 613void pci_bus_assign_resources(struct pci_bus *bus);
@@ -631,16 +644,18 @@ static inline int __must_check pci_register_driver(struct pci_driver *driver)
631 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 644 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
632} 645}
633 646
634void pci_unregister_driver(struct pci_driver *); 647void pci_unregister_driver(struct pci_driver *dev);
635void pci_remove_behind_bridge(struct pci_dev *); 648void pci_remove_behind_bridge(struct pci_dev *dev);
636struct pci_driver *pci_dev_driver(const struct pci_dev *); 649struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
637const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); 650const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
638int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 651 struct pci_dev *dev);
652int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
653 int pass);
639 654
640void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 655void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
641 void *userdata); 656 void *userdata);
642int pci_cfg_space_size(struct pci_dev *dev); 657int pci_cfg_space_size(struct pci_dev *dev);
643unsigned char pci_bus_max_busnr(struct pci_bus* bus); 658unsigned char pci_bus_max_busnr(struct pci_bus *bus);
644 659
645/* kmem_cache style wrapper around pci_alloc_consistent() */ 660/* kmem_cache style wrapper around pci_alloc_consistent() */
646 661
@@ -669,19 +684,36 @@ struct msix_entry {
669 684
670 685
671#ifndef CONFIG_PCI_MSI 686#ifndef CONFIG_PCI_MSI
672static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} 687static inline int pci_enable_msi(struct pci_dev *dev)
673static inline void pci_disable_msi(struct pci_dev *dev) {} 688{
674static inline int pci_enable_msix(struct pci_dev* dev, 689 return -1;
675 struct msix_entry *entries, int nvec) {return -1;} 690}
676static inline void pci_disable_msix(struct pci_dev *dev) {} 691
677static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} 692static inline void pci_disable_msi(struct pci_dev *dev)
693{ }
694
695static inline int pci_enable_msix(struct pci_dev *dev,
696 struct msix_entry *entries, int nvec)
697{
698 return -1;
699}
700
701static inline void pci_disable_msix(struct pci_dev *dev)
702{ }
703
704static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
705{ }
706
707static inline void pci_restore_msi_state(struct pci_dev *dev)
708{ }
678#else 709#else
679extern int pci_enable_msi(struct pci_dev *dev); 710extern int pci_enable_msi(struct pci_dev *dev);
680extern void pci_disable_msi(struct pci_dev *dev); 711extern void pci_disable_msi(struct pci_dev *dev);
681extern int pci_enable_msix(struct pci_dev* dev, 712extern int pci_enable_msix(struct pci_dev *dev,
682 struct msix_entry *entries, int nvec); 713 struct msix_entry *entries, int nvec);
683extern void pci_disable_msix(struct pci_dev *dev); 714extern void pci_disable_msix(struct pci_dev *dev);
684extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 715extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
716extern void pci_restore_msi_state(struct pci_dev *dev);
685#endif 717#endif
686 718
687#ifdef CONFIG_HT_IRQ 719#ifdef CONFIG_HT_IRQ
@@ -702,7 +734,11 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
702extern int pci_domains_supported; 734extern int pci_domains_supported;
703#else 735#else
704enum { pci_domains_supported = 0 }; 736enum { pci_domains_supported = 0 };
705static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 737static inline int pci_domain_nr(struct pci_bus *bus)
738{
739 return 0;
740}
741
706static inline int pci_proc_domain(struct pci_bus *bus) 742static inline int pci_proc_domain(struct pci_bus *bus)
707{ 743{
708 return 0; 744 return 0;
@@ -716,67 +752,173 @@ static inline int pci_proc_domain(struct pci_bus *bus)
716 * these as simple inline functions to avoid hair in drivers. 752 * these as simple inline functions to avoid hair in drivers.
717 */ 753 */
718 754
719#define _PCI_NOP(o,s,t) \ 755#define _PCI_NOP(o, s, t) \
720 static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ 756 static inline int pci_##o##_config_##s(struct pci_dev *dev, \
757 int where, t val) \
721 { return PCIBIOS_FUNC_NOT_SUPPORTED; } 758 { return PCIBIOS_FUNC_NOT_SUPPORTED; }
722#define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \ 759
723 _PCI_NOP(o,word,u16 x) \ 760#define _PCI_NOP_ALL(o, x) _PCI_NOP(o, byte, u8 x) \
724 _PCI_NOP(o,dword,u32 x) 761 _PCI_NOP(o, word, u16 x) \
762 _PCI_NOP(o, dword, u32 x)
725_PCI_NOP_ALL(read, *) 763_PCI_NOP_ALL(read, *)
726_PCI_NOP_ALL(write,) 764_PCI_NOP_ALL(write,)
727 765
728static inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) 766static inline struct pci_dev *pci_find_device(unsigned int vendor,
729{ return NULL; } 767 unsigned int device,
768 const struct pci_dev *from)
769{
770 return NULL;
771}
730 772
731static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) 773static inline struct pci_dev *pci_find_slot(unsigned int bus,
732{ return NULL; } 774 unsigned int devfn)
775{
776 return NULL;
777}
733 778
734static inline struct pci_dev *pci_get_device(unsigned int vendor, 779static inline struct pci_dev *pci_get_device(unsigned int vendor,
735 unsigned int device, struct pci_dev *from) 780 unsigned int device,
736{ return NULL; } 781 struct pci_dev *from)
782{
783 return NULL;
784}
737 785
738static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor, 786static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
739 unsigned int device, struct pci_dev *from) 787 unsigned int device,
740{ return NULL; } 788 struct pci_dev *from)
789{
790 return NULL;
791}
741 792
742static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 793static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
743unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from) 794 unsigned int device,
744{ return NULL; } 795 unsigned int ss_vendor,
796 unsigned int ss_device,
797 struct pci_dev *from)
798{
799 return NULL;
800}
745 801
746static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) 802static inline struct pci_dev *pci_get_class(unsigned int class,
747{ return NULL; } 803 struct pci_dev *from)
804{
805 return NULL;
806}
748 807
749#define pci_dev_present(ids) (0) 808#define pci_dev_present(ids) (0)
750#define no_pci_devices() (1) 809#define no_pci_devices() (1)
751#define pci_find_present(ids) (NULL) 810#define pci_find_present(ids) (NULL)
752#define pci_dev_put(dev) do { } while (0) 811#define pci_dev_put(dev) do { } while (0)
753 812
754static inline void pci_set_master(struct pci_dev *dev) { } 813static inline void pci_set_master(struct pci_dev *dev)
755static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } 814{ }
756static inline void pci_disable_device(struct pci_dev *dev) { } 815
757static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } 816static inline int pci_enable_device(struct pci_dev *dev)
758static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} 817{
759static inline int __pci_register_driver(struct pci_driver *drv, struct module *owner) { return 0;} 818 return -EIO;
760static inline int pci_register_driver(struct pci_driver *drv) { return 0;} 819}
761static inline void pci_unregister_driver(struct pci_driver *drv) { } 820
762static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } 821static inline void pci_disable_device(struct pci_dev *dev)
763static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } 822{ }
764static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } 823
824static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
825{
826 return -EIO;
827}
828
829static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
830 unsigned int size)
831{
832 return -EIO;
833}
834
835static inline int pci_set_dma_seg_boundary(struct pci_dev *dev,
836 unsigned long mask)
837{
838 return -EIO;
839}
840
841static inline int pci_assign_resource(struct pci_dev *dev, int i)
842{
843 return -EBUSY;
844}
845
846static inline int __pci_register_driver(struct pci_driver *drv,
847 struct module *owner)
848{
849 return 0;
850}
851
852static inline int pci_register_driver(struct pci_driver *drv)
853{
854 return 0;
855}
856
857static inline void pci_unregister_driver(struct pci_driver *drv)
858{ }
859
860static inline int pci_find_capability(struct pci_dev *dev, int cap)
861{
862 return 0;
863}
864
865static inline int pci_find_next_capability(struct pci_dev *dev, u8 post,
866 int cap)
867{
868 return 0;
869}
870
871static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
872{
873 return 0;
874}
875
876static inline void pcie_wait_pending_transaction(struct pci_dev *dev)
877{ }
765 878
766/* Power management related routines */ 879/* Power management related routines */
767static inline int pci_save_state(struct pci_dev *dev) { return 0; } 880static inline int pci_save_state(struct pci_dev *dev)
768static inline int pci_restore_state(struct pci_dev *dev) { return 0; } 881{
769static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; } 882 return 0;
770static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } 883}
771static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; }
772 884
773static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) { return -EIO; } 885static inline int pci_restore_state(struct pci_dev *dev)
774static inline void pci_release_regions(struct pci_dev *dev) { } 886{
887 return 0;
888}
889
890static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
891{
892 return 0;
893}
894
895static inline pci_power_t pci_choose_state(struct pci_dev *dev,
896 pm_message_t state)
897{
898 return PCI_D0;
899}
900
901static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
902 int enable)
903{
904 return 0;
905}
906
907static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
908{
909 return -EIO;
910}
911
912static inline void pci_release_regions(struct pci_dev *dev)
913{ }
775 914
776#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 915#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
777 916
778static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } 917static inline void pci_block_user_cfg_access(struct pci_dev *dev)
779static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { } 918{ }
919
920static inline void pci_unblock_user_cfg_access(struct pci_dev *dev)
921{ }
780 922
781static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 923static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
782{ return NULL; } 924{ return NULL; }
@@ -797,27 +939,27 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
797 939
798/* these helpers provide future and backwards compatibility 940/* these helpers provide future and backwards compatibility
799 * for accessing popular PCI BAR info */ 941 * for accessing popular PCI BAR info */
800#define pci_resource_start(dev,bar) ((dev)->resource[(bar)].start) 942#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
801#define pci_resource_end(dev,bar) ((dev)->resource[(bar)].end) 943#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
802#define pci_resource_flags(dev,bar) ((dev)->resource[(bar)].flags) 944#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
803#define pci_resource_len(dev,bar) \ 945#define pci_resource_len(dev,bar) \
804 ((pci_resource_start((dev),(bar)) == 0 && \ 946 ((pci_resource_start((dev), (bar)) == 0 && \
805 pci_resource_end((dev),(bar)) == \ 947 pci_resource_end((dev), (bar)) == \
806 pci_resource_start((dev),(bar))) ? 0 : \ 948 pci_resource_start((dev), (bar))) ? 0 : \
807 \ 949 \
808 (pci_resource_end((dev),(bar)) - \ 950 (pci_resource_end((dev), (bar)) - \
809 pci_resource_start((dev),(bar)) + 1)) 951 pci_resource_start((dev), (bar)) + 1))
810 952
811/* Similar to the helpers above, these manipulate per-pci_dev 953/* Similar to the helpers above, these manipulate per-pci_dev
812 * driver-specific data. They are really just a wrapper around 954 * driver-specific data. They are really just a wrapper around
813 * the generic device structure functions of these calls. 955 * the generic device structure functions of these calls.
814 */ 956 */
815static inline void *pci_get_drvdata (struct pci_dev *pdev) 957static inline void *pci_get_drvdata(struct pci_dev *pdev)
816{ 958{
817 return dev_get_drvdata(&pdev->dev); 959 return dev_get_drvdata(&pdev->dev);
818} 960}
819 961
820static inline void pci_set_drvdata (struct pci_dev *pdev, void *data) 962static inline void pci_set_drvdata(struct pci_dev *pdev, void *data)
821{ 963{
822 dev_set_drvdata(&pdev->dev, data); 964 dev_set_drvdata(&pdev->dev, data);
823} 965}
@@ -836,7 +978,7 @@ static inline char *pci_name(struct pci_dev *pdev)
836 */ 978 */
837#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER 979#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
838static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, 980static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
839 const struct resource *rsrc, resource_size_t *start, 981 const struct resource *rsrc, resource_size_t *start,
840 resource_size_t *end) 982 resource_size_t *end)
841{ 983{
842 *start = rsrc->start; 984 *start = rsrc->start;
@@ -888,9 +1030,9 @@ enum pci_fixup_pass {
888 1030
889void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1031void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
890 1032
891void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1033void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
892void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1034void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
893void __iomem * const * pcim_iomap_table(struct pci_dev *pdev); 1035void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
894int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 1036int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
895void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); 1037void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
896 1038
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 41f6f28690f6..39d32837265b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2043,6 +2043,23 @@
2043#define PCI_VENDOR_ID_QUICKNET 0x15e2 2043#define PCI_VENDOR_ID_QUICKNET 0x15e2
2044#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500 2044#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
2045 2045
2046/*
2047 * ADDI-DATA GmbH communication cards <info@addi-data.com>
2048 */
2049#define PCI_VENDOR_ID_ADDIDATA_OLD 0x10E8
2050#define PCI_VENDOR_ID_ADDIDATA 0x15B8
2051#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000
2052#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001
2053#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002
2054#define PCI_DEVICE_ID_ADDIDATA_APCI7800 0x818E
2055#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009
2056#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A
2057#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B
2058#define PCI_DEVICE_ID_ADDIDATA_APCI7500_3 0x700C
2059#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D
2060#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E
2061#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F
2062
2046#define PCI_VENDOR_ID_PDC 0x15e9 2063#define PCI_VENDOR_ID_PDC 0x15e9
2047 2064
2048#define PCI_VENDOR_ID_FARSITE 0x1619 2065#define PCI_VENDOR_ID_FARSITE 0x1619
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index 1375f15797e7..225beb136807 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -26,6 +26,7 @@ struct pda_power_pdata {
26 26
27 unsigned int wait_for_status; /* msecs, default is 500 */ 27 unsigned int wait_for_status; /* msecs, default is 500 */
28 unsigned int wait_for_charger; /* msecs, default is 500 */ 28 unsigned int wait_for_charger; /* msecs, default is 500 */
29 unsigned int polling_interval; /* msecs, default is 2000 */
29}; 30};
30 31
31#endif /* __PDA_POWER_H__ */ 32#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 00412bb494c4..50faa0ea28e4 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -9,10 +9,6 @@
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
12#ifndef PER_CPU_ATTRIBUTES
13#define PER_CPU_ATTRIBUTES
14#endif
15
16#ifdef CONFIG_SMP 12#ifdef CONFIG_SMP
17#define DEFINE_PER_CPU(type, name) \ 13#define DEFINE_PER_CPU(type, name) \
18 __attribute__((__section__(".data.percpu"))) \ 14 __attribute__((__section__(".data.percpu"))) \
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index d9db5f62ee48..6db69ff5d83e 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -298,6 +298,12 @@ struct sadb_x_sec_ctx {
298#define SADB_X_EALG_BLOWFISHCBC 7 298#define SADB_X_EALG_BLOWFISHCBC 7
299#define SADB_EALG_NULL 11 299#define SADB_EALG_NULL 11
300#define SADB_X_EALG_AESCBC 12 300#define SADB_X_EALG_AESCBC 12
301#define SADB_X_EALG_AES_CCM_ICV8 14
302#define SADB_X_EALG_AES_CCM_ICV12 15
303#define SADB_X_EALG_AES_CCM_ICV16 16
304#define SADB_X_EALG_AES_GCM_ICV8 18
305#define SADB_X_EALG_AES_GCM_ICV12 19
306#define SADB_X_EALG_AES_GCM_ICV16 20
301#define SADB_X_EALG_CAMELLIACBC 22 307#define SADB_X_EALG_CAMELLIACBC 22
302#define SADB_EALG_MAX 253 /* last EALG */ 308#define SADB_EALG_MAX 253 /* last EALG */
303/* private allocations should use 249-255 (RFC2407) */ 309/* private allocations should use 249-255 (RFC2407) */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 554836edd915..5e43ae751412 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -88,7 +88,7 @@ struct mii_bus {
88 88
89 /* A lock to ensure that only one thing can read/write 89 /* A lock to ensure that only one thing can read/write
90 * the MDIO bus at a time */ 90 * the MDIO bus at a time */
91 spinlock_t mdio_lock; 91 struct mutex mdio_lock;
92 92
93 struct device *dev; 93 struct device *dev;
94 94
@@ -284,10 +284,11 @@ struct phy_device {
284 284
285 /* Interrupt and Polling infrastructure */ 285 /* Interrupt and Polling infrastructure */
286 struct work_struct phy_queue; 286 struct work_struct phy_queue;
287 struct work_struct state_queue;
287 struct timer_list phy_timer; 288 struct timer_list phy_timer;
288 atomic_t irq_disable; 289 atomic_t irq_disable;
289 290
290 spinlock_t lock; 291 struct mutex lock;
291 292
292 struct net_device *attached_dev; 293 struct net_device *attached_dev;
293 294
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 30b8571e6b34..40fac8c4559d 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -328,6 +328,56 @@ enum
328 328
329#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) 329#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1)
330 330
331/* Flow filter */
332
333enum
334{
335 FLOW_KEY_SRC,
336 FLOW_KEY_DST,
337 FLOW_KEY_PROTO,
338 FLOW_KEY_PROTO_SRC,
339 FLOW_KEY_PROTO_DST,
340 FLOW_KEY_IIF,
341 FLOW_KEY_PRIORITY,
342 FLOW_KEY_MARK,
343 FLOW_KEY_NFCT,
344 FLOW_KEY_NFCT_SRC,
345 FLOW_KEY_NFCT_DST,
346 FLOW_KEY_NFCT_PROTO_SRC,
347 FLOW_KEY_NFCT_PROTO_DST,
348 FLOW_KEY_RTCLASSID,
349 FLOW_KEY_SKUID,
350 FLOW_KEY_SKGID,
351 __FLOW_KEY_MAX,
352};
353
354#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1)
355
356enum
357{
358 FLOW_MODE_MAP,
359 FLOW_MODE_HASH,
360};
361
362enum
363{
364 TCA_FLOW_UNSPEC,
365 TCA_FLOW_KEYS,
366 TCA_FLOW_MODE,
367 TCA_FLOW_BASECLASS,
368 TCA_FLOW_RSHIFT,
369 TCA_FLOW_ADDEND,
370 TCA_FLOW_MASK,
371 TCA_FLOW_XOR,
372 TCA_FLOW_DIVISOR,
373 TCA_FLOW_ACT,
374 TCA_FLOW_POLICE,
375 TCA_FLOW_EMATCHES,
376 __TCA_FLOW_MAX
377};
378
379#define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1)
380
331/* Basic filter */ 381/* Basic filter */
332 382
333enum 383enum
@@ -409,7 +459,8 @@ enum
409#define TCF_EM_U32 3 459#define TCF_EM_U32 3
410#define TCF_EM_META 4 460#define TCF_EM_META 4
411#define TCF_EM_TEXT 5 461#define TCF_EM_TEXT 5
412#define TCF_EM_MAX 5 462#define TCF_EM_VLAN 6
463#define TCF_EM_MAX 6
413 464
414enum 465enum
415{ 466{
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 32761352e858..dbb7ac37960d 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -150,6 +150,11 @@ struct tc_sfq_qopt
150 unsigned flows; /* Maximal number of flows */ 150 unsigned flows; /* Maximal number of flows */
151}; 151};
152 152
153struct tc_sfq_xstats
154{
155 __s32 allot;
156};
157
153/* 158/*
154 * NOTE: limit, divisor and flows are hardwired to code at the moment. 159 * NOTE: limit, divisor and flows are hardwired to code at the moment.
155 * 160 *
diff --git a/include/linux/pm.h b/include/linux/pm.h
index b78e0295adf4..eccf59ea2a77 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -95,7 +95,7 @@ struct pm_dev
95}; 95};
96 96
97/* Functions above this comment are list-based old-style power 97/* Functions above this comment are list-based old-style power
98 * managment. Please avoid using them. */ 98 * management. Please avoid using them. */
99 99
100/* 100/*
101 * Callbacks for platform drivers to implement. 101 * Callbacks for platform drivers to implement.
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
new file mode 100644
index 000000000000..2e4e97bd19f7
--- /dev/null
+++ b/include/linux/pm_qos_params.h
@@ -0,0 +1,25 @@
1/* interface for the pm_qos_power infrastructure of the linux kernel.
2 *
3 * Mark Gross
4 */
5#include <linux/list.h>
6#include <linux/notifier.h>
7#include <linux/miscdevice.h>
8
9#define PM_QOS_RESERVED 0
10#define PM_QOS_CPU_DMA_LATENCY 1
11#define PM_QOS_NETWORK_LATENCY 2
12#define PM_QOS_NETWORK_THROUGHPUT 3
13
14#define PM_QOS_NUM_CLASSES 4
15#define PM_QOS_DEFAULT_VALUE -1
16
17int pm_qos_add_requirement(int qos, char *name, s32 value);
18int pm_qos_update_requirement(int qos, char *name, s32 new_value);
19void pm_qos_remove_requirement(int qos, char *name);
20
21int pm_qos_requirement(int qos);
22
23int pm_qos_add_notifier(int qos, struct notifier_block *notifier);
24int pm_qos_remove_notifier(int qos, struct notifier_block *notifier);
25
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 2a6d62c7d2d1..b9339d8b95bc 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -126,7 +126,7 @@ struct pnp_resource_table {
126}; 126};
127 127
128/* 128/*
129 * Device Managemnt 129 * Device Management
130 */ 130 */
131 131
132struct pnp_card { 132struct pnp_card {
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 606c0957997f..5cbf3e371012 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -54,15 +54,7 @@ enum {
54 POWER_SUPPLY_TECHNOLOGY_LIPO, 54 POWER_SUPPLY_TECHNOLOGY_LIPO,
55 POWER_SUPPLY_TECHNOLOGY_LiFe, 55 POWER_SUPPLY_TECHNOLOGY_LiFe,
56 POWER_SUPPLY_TECHNOLOGY_NiCd, 56 POWER_SUPPLY_TECHNOLOGY_NiCd,
57}; 57 POWER_SUPPLY_TECHNOLOGY_LiMn,
58
59enum {
60 POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
61 POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
62 POWER_SUPPLY_CAPACITY_LEVEL_LOW,
63 POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
64 POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
65 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
66}; 58};
67 59
68enum power_supply_property { 60enum power_supply_property {
@@ -72,6 +64,8 @@ enum power_supply_property {
72 POWER_SUPPLY_PROP_PRESENT, 64 POWER_SUPPLY_PROP_PRESENT,
73 POWER_SUPPLY_PROP_ONLINE, 65 POWER_SUPPLY_PROP_ONLINE,
74 POWER_SUPPLY_PROP_TECHNOLOGY, 66 POWER_SUPPLY_PROP_TECHNOLOGY,
67 POWER_SUPPLY_PROP_VOLTAGE_MAX,
68 POWER_SUPPLY_PROP_VOLTAGE_MIN,
75 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 69 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
76 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 70 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
77 POWER_SUPPLY_PROP_VOLTAGE_NOW, 71 POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -91,7 +85,6 @@ enum power_supply_property {
91 POWER_SUPPLY_PROP_ENERGY_NOW, 85 POWER_SUPPLY_PROP_ENERGY_NOW,
92 POWER_SUPPLY_PROP_ENERGY_AVG, 86 POWER_SUPPLY_PROP_ENERGY_AVG,
93 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ 87 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
94 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
95 POWER_SUPPLY_PROP_TEMP, 88 POWER_SUPPLY_PROP_TEMP,
96 POWER_SUPPLY_PROP_TEMP_AMBIENT, 89 POWER_SUPPLY_PROP_TEMP_AMBIENT,
97 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 90 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index e2eff9079fe9..3800639775ae 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -63,4 +63,8 @@
63#define PR_GET_SECCOMP 21 63#define PR_GET_SECCOMP 21
64#define PR_SET_SECCOMP 22 64#define PR_SET_SECCOMP 22
65 65
66/* Get/set the capability bounding set */
67#define PR_CAPBSET_READ 23
68#define PR_CAPBSET_DROP 24
69
66#endif /* _LINUX_PRCTL_H */ 70#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 8f92546b403d..e43551516831 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -19,6 +19,8 @@ struct completion;
19 */ 19 */
20#define FIRST_PROCESS_ENTRY 256 20#define FIRST_PROCESS_ENTRY 256
21 21
22/* Worst case buffer size needed for holding an integer. */
23#define PROC_NUMBUF 13
22 24
23/* 25/*
24 * We always define these enumerators 26 * We always define these enumerators
@@ -117,7 +119,6 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
117unsigned long task_vsize(struct mm_struct *); 119unsigned long task_vsize(struct mm_struct *);
118int task_statm(struct mm_struct *, int *, int *, int *, int *); 120int task_statm(struct mm_struct *, int *, int *, int *, int *);
119char *task_mem(struct mm_struct *, char *); 121char *task_mem(struct mm_struct *, char *);
120void clear_refs_smap(struct mm_struct *mm);
121 122
122struct proc_dir_entry *de_get(struct proc_dir_entry *de); 123struct proc_dir_entry *de_get(struct proc_dir_entry *de);
123void de_put(struct proc_dir_entry *de); 124void de_put(struct proc_dir_entry *de);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index b6116b4445c7..b8ce2b444bb5 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -91,7 +91,7 @@ do { \
91 * 91 *
92 * For API usage, in general, 92 * For API usage, in general,
93 * - any function _modifying_ the tree or tags (inserting or deleting 93 * - any function _modifying_ the tree or tags (inserting or deleting
94 * items, setting or clearing tags must exclude other modifications, and 94 * items, setting or clearing tags) must exclude other modifications, and
95 * exclude any functions reading the tree. 95 * exclude any functions reading the tree.
96 * - any function _reading_ the tree or tags (looking up items or tags, 96 * - any function _reading_ the tree or tags (looking up items or tags,
97 * gang lookups) must exclude modifications to the tree, but may occur 97 * gang lookups) must exclude modifications to the tree, but may occur
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 85ea63f462af..b93b541cf111 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -59,8 +59,6 @@ extern void machine_crash_shutdown(struct pt_regs *);
59 * Architecture independent implemenations of sys_reboot commands. 59 * Architecture independent implemenations of sys_reboot commands.
60 */ 60 */
61 61
62extern void kernel_shutdown_prepare(enum system_states state);
63
64extern void kernel_restart(char *cmd); 62extern void kernel_restart(char *cmd);
65extern void kernel_halt(void); 63extern void kernel_halt(void);
66extern void kernel_power_off(void); 64extern void kernel_power_off(void);
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 10fa0c832018..db5ef9b83c3f 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -185,7 +185,7 @@ struct reiserfs_journal {
185 unsigned long j_trans_id; 185 unsigned long j_trans_id;
186 unsigned long j_mount_id; 186 unsigned long j_mount_id;
187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ 187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
188 unsigned long j_len; /* lenght of current waiting commit */ 188 unsigned long j_len; /* length of current waiting commit */
189 unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ 189 unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */
190 atomic_t j_wcount; /* count of writers for current commit */ 190 atomic_t j_wcount; /* count of writers for current commit */
191 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ 191 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 0ce5e0b52dbd..e3ab21d7fc7f 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -33,11 +33,13 @@
33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device. 35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device.
36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
36 */ 37 */
37enum rfkill_type { 38enum rfkill_type {
38 RFKILL_TYPE_WLAN , 39 RFKILL_TYPE_WLAN ,
39 RFKILL_TYPE_BLUETOOTH, 40 RFKILL_TYPE_BLUETOOTH,
40 RFKILL_TYPE_UWB, 41 RFKILL_TYPE_UWB,
42 RFKILL_TYPE_WIMAX,
41 RFKILL_TYPE_MAX, 43 RFKILL_TYPE_MAX,
42}; 44};
43 45
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index b014f6b7fe29..b9e174079002 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,24 +602,12 @@ struct tcamsg
602 602
603#include <linux/mutex.h> 603#include <linux/mutex.h>
604 604
605extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size);
606static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) 605static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
607{ 606{
608 int len = strlen(str) + 1; 607 int len = strlen(str) + 1;
609 return len > rta->rta_len || memcmp(RTA_DATA(rta), str, len); 608 return len > rta->rta_len || memcmp(RTA_DATA(rta), str, len);
610} 609}
611 610
612extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len);
613extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
614 struct rtattr *rta, int len);
615
616#define rtattr_parse_nested(tb, max, rta) \
617 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
618
619#define rtattr_parse_nested_compat(tb, max, rta, data, len) \
620({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
621 __rtattr_parse_nested_compat(tb, max, rta, len); })
622
623extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); 611extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
624extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid); 612extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
625extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, 613extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d4797609aa5..9c13be3a21e8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -172,13 +172,35 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
172#define TASK_RUNNING 0 172#define TASK_RUNNING 0
173#define TASK_INTERRUPTIBLE 1 173#define TASK_INTERRUPTIBLE 1
174#define TASK_UNINTERRUPTIBLE 2 174#define TASK_UNINTERRUPTIBLE 2
175#define TASK_STOPPED 4 175#define __TASK_STOPPED 4
176#define TASK_TRACED 8 176#define __TASK_TRACED 8
177/* in tsk->exit_state */ 177/* in tsk->exit_state */
178#define EXIT_ZOMBIE 16 178#define EXIT_ZOMBIE 16
179#define EXIT_DEAD 32 179#define EXIT_DEAD 32
180/* in tsk->state again */ 180/* in tsk->state again */
181#define TASK_DEAD 64 181#define TASK_DEAD 64
182#define TASK_WAKEKILL 128
183
184/* Convenience macros for the sake of set_task_state */
185#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
186#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED)
187#define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED)
188
189/* Convenience macros for the sake of wake_up */
190#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
191#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED)
192
193/* get_task_state() */
194#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
195 TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
196 __TASK_TRACED)
197
198#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
199#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
200#define task_is_stopped_or_traced(task) \
201 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
202#define task_contributes_to_load(task) \
203 ((task->state & TASK_UNINTERRUPTIBLE) != 0)
182 204
183#define __set_task_state(tsk, state_value) \ 205#define __set_task_state(tsk, state_value) \
184 do { (tsk)->state = (state_value); } while (0) 206 do { (tsk)->state = (state_value); } while (0)
@@ -302,6 +324,7 @@ extern int in_sched_functions(unsigned long addr);
302#define MAX_SCHEDULE_TIMEOUT LONG_MAX 324#define MAX_SCHEDULE_TIMEOUT LONG_MAX
303extern signed long FASTCALL(schedule_timeout(signed long timeout)); 325extern signed long FASTCALL(schedule_timeout(signed long timeout));
304extern signed long schedule_timeout_interruptible(signed long timeout); 326extern signed long schedule_timeout_interruptible(signed long timeout);
327extern signed long schedule_timeout_killable(signed long timeout);
305extern signed long schedule_timeout_uninterruptible(signed long timeout); 328extern signed long schedule_timeout_uninterruptible(signed long timeout);
306asmlinkage void schedule(void); 329asmlinkage void schedule(void);
307 330
@@ -532,6 +555,13 @@ struct signal_struct {
532#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ 555#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */
533#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ 556#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */
534 557
558/* If true, all threads except ->group_exit_task have pending SIGKILL */
559static inline int signal_group_exit(const struct signal_struct *sig)
560{
561 return (sig->flags & SIGNAL_GROUP_EXIT) ||
562 (sig->group_exit_task != NULL);
563}
564
535/* 565/*
536 * Some day this will be a full-fledged user tracking system.. 566 * Some day this will be a full-fledged user tracking system..
537 */ 567 */
@@ -1068,7 +1098,7 @@ struct task_struct {
1068 uid_t uid,euid,suid,fsuid; 1098 uid_t uid,euid,suid,fsuid;
1069 gid_t gid,egid,sgid,fsgid; 1099 gid_t gid,egid,sgid,fsgid;
1070 struct group_info *group_info; 1100 struct group_info *group_info;
1071 kernel_cap_t cap_effective, cap_inheritable, cap_permitted; 1101 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1072 unsigned keep_capabilities:1; 1102 unsigned keep_capabilities:1;
1073 struct user_struct *user; 1103 struct user_struct *user;
1074#ifdef CONFIG_KEYS 1104#ifdef CONFIG_KEYS
@@ -1116,6 +1146,10 @@ struct task_struct {
1116 void *security; 1146 void *security;
1117#endif 1147#endif
1118 struct audit_context *audit_context; 1148 struct audit_context *audit_context;
1149#ifdef CONFIG_AUDITSYSCALL
1150 uid_t loginuid;
1151 unsigned int sessionid;
1152#endif
1119 seccomp_t seccomp; 1153 seccomp_t seccomp;
1120 1154
1121/* Thread group tracking */ 1155/* Thread group tracking */
@@ -1743,7 +1777,7 @@ extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned lon
1743struct task_struct *fork_idle(int); 1777struct task_struct *fork_idle(int);
1744 1778
1745extern void set_task_comm(struct task_struct *tsk, char *from); 1779extern void set_task_comm(struct task_struct *tsk, char *from);
1746extern void get_task_comm(char *to, struct task_struct *tsk); 1780extern char *get_task_comm(char *to, struct task_struct *tsk);
1747 1781
1748#ifdef CONFIG_SMP 1782#ifdef CONFIG_SMP
1749extern void wait_task_inactive(struct task_struct * p); 1783extern void wait_task_inactive(struct task_struct * p);
@@ -1892,7 +1926,14 @@ static inline int signal_pending(struct task_struct *p)
1892{ 1926{
1893 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 1927 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
1894} 1928}
1895 1929
1930extern int FASTCALL(__fatal_signal_pending(struct task_struct *p));
1931
1932static inline int fatal_signal_pending(struct task_struct *p)
1933{
1934 return signal_pending(p) && __fatal_signal_pending(p);
1935}
1936
1896static inline int need_resched(void) 1937static inline int need_resched(void)
1897{ 1938{
1898 return unlikely(test_thread_flag(TIF_NEED_RESCHED)); 1939 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
@@ -2046,6 +2087,10 @@ static inline void migration_init(void)
2046} 2087}
2047#endif 2088#endif
2048 2089
2090#ifndef TASK_SIZE_OF
2091#define TASK_SIZE_OF(tsk) TASK_SIZE
2092#endif
2093
2049#endif /* __KERNEL__ */ 2094#endif /* __KERNEL__ */
2050 2095
2051#endif 2096#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index d24974262dc6..fe52cdeab0a6 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -40,11 +40,6 @@
40#define ROOTCONTEXT_MNT 0x04 40#define ROOTCONTEXT_MNT 0x04
41#define DEFCONTEXT_MNT 0x08 41#define DEFCONTEXT_MNT 0x08
42 42
43/*
44 * Bounding set
45 */
46extern kernel_cap_t cap_bset;
47
48extern unsigned securebits; 43extern unsigned securebits;
49 44
50struct ctl_table; 45struct ctl_table;
@@ -423,15 +418,12 @@ struct request_sock;
423 * identified by @name for @dentry. 418 * identified by @name for @dentry.
424 * Return 0 if permission is granted. 419 * Return 0 if permission is granted.
425 * @inode_getsecurity: 420 * @inode_getsecurity:
426 * Copy the extended attribute representation of the security label 421 * Retrieve a copy of the extended attribute representation of the
427 * associated with @name for @inode into @buffer. @buffer may be 422 * security label associated with @name for @inode via @buffer. Note that
428 * NULL to request the size of the buffer required. @size indicates 423 * @name is the remainder of the attribute name after the security prefix
429 * the size of @buffer in bytes. Note that @name is the remainder 424 * has been removed. @alloc is used to specify of the call should return a
430 * of the attribute name after the security. prefix has been removed. 425 * value via the buffer or just the value length Return size of buffer on
431 * @err is the return value from the preceding fs getxattr call, 426 * success.
432 * and can be used by the security module to determine whether it
433 * should try and canonicalize the attribute value.
434 * Return number of bytes used/required on success.
435 * @inode_setsecurity: 427 * @inode_setsecurity:
436 * Set the security label associated with @name for @inode from the 428 * Set the security label associated with @name for @inode from the
437 * extended attribute value @value. @size indicates the size of the 429 * extended attribute value @value. @size indicates the size of the
@@ -1304,7 +1296,7 @@ struct security_operations {
1304 int (*inode_removexattr) (struct dentry *dentry, char *name); 1296 int (*inode_removexattr) (struct dentry *dentry, char *name);
1305 int (*inode_need_killpriv) (struct dentry *dentry); 1297 int (*inode_need_killpriv) (struct dentry *dentry);
1306 int (*inode_killpriv) (struct dentry *dentry); 1298 int (*inode_killpriv) (struct dentry *dentry);
1307 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err); 1299 int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc);
1308 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1300 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1309 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1301 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
1310 1302
@@ -1565,7 +1557,7 @@ int security_inode_listxattr(struct dentry *dentry);
1565int security_inode_removexattr(struct dentry *dentry, char *name); 1557int security_inode_removexattr(struct dentry *dentry, char *name);
1566int security_inode_need_killpriv(struct dentry *dentry); 1558int security_inode_need_killpriv(struct dentry *dentry);
1567int security_inode_killpriv(struct dentry *dentry); 1559int security_inode_killpriv(struct dentry *dentry);
1568int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err); 1560int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
1569int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1561int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1570int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); 1562int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
1571int security_file_permission(struct file *file, int mask); 1563int security_file_permission(struct file *file, int mask);
@@ -1967,7 +1959,7 @@ static inline int security_inode_killpriv(struct dentry *dentry)
1967 return cap_inode_killpriv(dentry); 1959 return cap_inode_killpriv(dentry);
1968} 1960}
1969 1961
1970static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err) 1962static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc)
1971{ 1963{
1972 return -EOPNOTSUPP; 1964 return -EOPNOTSUPP;
1973} 1965}
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index afe0f6d9b9bc..00b65c0a82ca 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -23,6 +23,7 @@ struct plat_serial8250_port {
23 resource_size_t mapbase; /* resource base */ 23 resource_size_t mapbase; /* resource base */
24 unsigned int irq; /* interrupt number */ 24 unsigned int irq; /* interrupt number */
25 unsigned int uartclk; /* UART clock rate */ 25 unsigned int uartclk; /* UART clock rate */
26 void *private_data;
26 unsigned char regshift; /* register shift */ 27 unsigned char regshift; /* register shift */
27 unsigned char iotype; /* UPIO_* */ 28 unsigned char iotype; /* UPIO_* */
28 unsigned char hub6; 29 unsigned char hub6;
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 86f9b1ef0e09..ea037f28df91 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -29,7 +29,7 @@ struct signalfd_siginfo {
29 29
30 /* 30 /*
31 * Pad strcture to 128 bytes. Remember to update the 31 * Pad strcture to 128 bytes. Remember to update the
32 * pad size when you add new memebers. We use a fixed 32 * pad size when you add new members. We use a fixed
33 * size structure to avoid compatibility problems with 33 * size structure to avoid compatibility problems with
34 * future versions, and we leave extra space for additional 34 * future versions, and we leave extra space for additional
35 * members. We use fixed size members because this strcture 35 * members. We use fixed size members because this strcture
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c618fbf7d173..412672a79e8a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -108,9 +108,6 @@ struct nf_bridge_info {
108 atomic_t use; 108 atomic_t use;
109 struct net_device *physindev; 109 struct net_device *physindev;
110 struct net_device *physoutdev; 110 struct net_device *physoutdev;
111#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
112 struct net_device *netoutdev;
113#endif
114 unsigned int mask; 111 unsigned int mask;
115 unsigned long data[32 / sizeof(unsigned long)]; 112 unsigned long data[32 / sizeof(unsigned long)];
116}; 113};
@@ -1813,5 +1810,6 @@ static inline void skb_forward_csum(struct sk_buff *skb)
1813 skb->ip_summed = CHECKSUM_NONE; 1810 skb->ip_summed = CHECKSUM_NONE;
1814} 1811}
1815 1812
1813bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
1816#endif /* __KERNEL__ */ 1814#endif /* __KERNEL__ */
1817#endif /* _LINUX_SKBUFF_H */ 1815#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 40801e754afb..ddb1a706b144 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -12,11 +12,11 @@
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13 13
14struct kmem_cache_cpu { 14struct kmem_cache_cpu {
15 void **freelist; 15 void **freelist; /* Pointer to first free per cpu object */
16 struct page *page; 16 struct page *page; /* The slab from which we are allocating */
17 int node; 17 int node; /* The node of the page (or -1 for debug) */
18 unsigned int offset; 18 unsigned int offset; /* Freepointer offset (in word units) */
19 unsigned int objsize; 19 unsigned int objsize; /* Size of an object (from kmem_cache) */
20}; 20};
21 21
22struct kmem_cache_node { 22struct kmem_cache_node {
@@ -59,7 +59,10 @@ struct kmem_cache {
59#endif 59#endif
60 60
61#ifdef CONFIG_NUMA 61#ifdef CONFIG_NUMA
62 int defrag_ratio; 62 /*
63 * Defragmentation by allocating from a remote node.
64 */
65 int remote_node_defrag_ratio;
63 struct kmem_cache_node *node[MAX_NUMNODES]; 66 struct kmem_cache_node *node[MAX_NUMNODES];
64#endif 67#endif
65#ifdef CONFIG_SMP 68#ifdef CONFIG_SMP
diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h
index df7620dd8f31..64236b73c724 100644
--- a/include/linux/sm501-regs.h
+++ b/include/linux/sm501-regs.h
@@ -171,7 +171,7 @@
171/* USB slave/gadget data port base */ 171/* USB slave/gadget data port base */
172#define SM501_USB_GADGET_DATA (0x070000) 172#define SM501_USB_GADGET_DATA (0x070000)
173 173
174/* Display contoller/video engine base */ 174/* Display controller/video engine base */
175#define SM501_DC (0x080000) 175#define SM501_DC (0x080000)
176 176
177/* common defines for the SM501 address registers */ 177/* common defines for the SM501 address registers */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 86d3effb2836..5df62ef1280c 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -227,7 +227,7 @@ enum
227 LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ 227 LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */
228 LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ 228 LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */
229 LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ 229 LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */
230 LINUX_MIB_XFRMINSEQOUTOFWINDOW, /* XfrmInSeqOutOfWindow */ 230 LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */
231 LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ 231 LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */
232 LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ 232 LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */
233 LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ 233 LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */
@@ -241,6 +241,7 @@ enum
241 LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ 241 LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */
242 LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ 242 LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */
243 LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ 243 LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */
244 LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */
244 LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ 245 LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */
245 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ 246 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */
246 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ 247 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
new file mode 100644
index 000000000000..835ddf47d45c
--- /dev/null
+++ b/include/linux/spi/mcp23s08.h
@@ -0,0 +1,24 @@
1
2/* FIXME driver should be able to handle all four slaves that
3 * can be hooked up to each chipselect, as well as IRQs...
4 */
5
6struct mcp23s08_platform_data {
7 /* four slaves can share one SPI chipselect */
8 u8 slave;
9
10 /* number assigned to the first GPIO */
11 unsigned base;
12
13 /* pins with pullups */
14 u8 pullups;
15
16 void *context; /* param to setup/teardown */
17
18 int (*setup)(struct spi_device *spi,
19 int gpio, unsigned ngpio,
20 void *context);
21 int (*teardown)(struct spi_device *spi,
22 int gpio, unsigned ngpio,
23 void *context);
24};
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index 67faa044c5f5..04e1d3164576 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -21,7 +21,7 @@
21/* 21/*
22 * In the UP-nondebug case there's no real locking going on, so the 22 * In the UP-nondebug case there's no real locking going on, so the
23 * only thing we have to do is to keep the preempt counts and irq 23 * only thing we have to do is to keep the preempt counts and irq
24 * flags straight, to supress compiler warnings of unused lock 24 * flags straight, to suppress compiler warnings of unused lock
25 * variables, and to add the proper checker annotations: 25 * variables, and to add the proper checker annotations:
26 */ 26 */
27#define __LOCK(lock) \ 27#define __LOCK(lock) \
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index bd7a6b0a87af..03547d6abee5 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -169,8 +169,8 @@ extern int cache_check(struct cache_detail *detail,
169extern void cache_flush(void); 169extern void cache_flush(void);
170extern void cache_purge(struct cache_detail *detail); 170extern void cache_purge(struct cache_detail *detail);
171#define NEVER (0x7FFFFFFF) 171#define NEVER (0x7FFFFFFF)
172extern void cache_register(struct cache_detail *cd); 172extern int cache_register(struct cache_detail *cd);
173extern int cache_unregister(struct cache_detail *cd); 173extern void cache_unregister(struct cache_detail *cd);
174 174
175extern void qword_add(char **bpp, int *lp, char *str); 175extern void qword_add(char **bpp, int *lp, char *str);
176extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); 176extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 3e9addc741c1..129a86e25d29 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -41,7 +41,6 @@ struct rpc_clnt {
41 struct rpc_iostats * cl_metrics; /* per-client statistics */ 41 struct rpc_iostats * cl_metrics; /* per-client statistics */
42 42
43 unsigned int cl_softrtry : 1,/* soft timeouts */ 43 unsigned int cl_softrtry : 1,/* soft timeouts */
44 cl_intr : 1,/* interruptible */
45 cl_discrtry : 1,/* disconnect before retry */ 44 cl_discrtry : 1,/* disconnect before retry */
46 cl_autobind : 1;/* use getport() */ 45 cl_autobind : 1;/* use getport() */
47 46
@@ -111,7 +110,6 @@ struct rpc_create_args {
111 110
112/* Values for "flags" field */ 111/* Values for "flags" field */
113#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0) 112#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
114#define RPC_CLNT_CREATE_INTR (1UL << 1)
115#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2) 113#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
116#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3) 114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3)
117#define RPC_CLNT_CREATE_NOPING (1UL << 4) 115#define RPC_CLNT_CREATE_NOPING (1UL << 4)
@@ -137,8 +135,6 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
137struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 135struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
138 int flags); 136 int flags);
139void rpc_restart_call(struct rpc_task *); 137void rpc_restart_call(struct rpc_task *);
140void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
141void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
142void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 138void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
143size_t rpc_max_payload(struct rpc_clnt *); 139size_t rpc_max_payload(struct rpc_clnt *);
144void rpc_force_rebind(struct rpc_clnt *); 140void rpc_force_rebind(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 3912cf16361e..10709cbe96fd 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -20,7 +20,7 @@
20#define RPCDBG_BIND 0x0020 20#define RPCDBG_BIND 0x0020
21#define RPCDBG_SCHED 0x0040 21#define RPCDBG_SCHED 0x0040
22#define RPCDBG_TRANS 0x0080 22#define RPCDBG_TRANS 0x0080
23#define RPCDBG_SVCSOCK 0x0100 23#define RPCDBG_SVCXPRT 0x0100
24#define RPCDBG_SVCDSP 0x0200 24#define RPCDBG_SVCDSP 0x0200
25#define RPCDBG_MISC 0x0400 25#define RPCDBG_MISC 0x0400
26#define RPCDBG_CACHE 0x0800 26#define RPCDBG_CACHE 0x0800
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index ce3d1b132729..f689f02e6793 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -137,7 +137,6 @@ struct rpc_task_setup {
137#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ 137#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
138#define RPC_TASK_KILLED 0x0100 /* task was killed */ 138#define RPC_TASK_KILLED 0x0100 /* task was killed */
139#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ 139#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */
140#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */
141 140
142#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 141#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
143#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 142#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
@@ -145,7 +144,6 @@ struct rpc_task_setup {
145#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 144#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
146#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) 145#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
147#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 146#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
148#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)
149 147
150#define RPC_TASK_RUNNING 0 148#define RPC_TASK_RUNNING 0
151#define RPC_TASK_QUEUED 1 149#define RPC_TASK_QUEUED 1
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 8531a70da73d..64c771056187 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -204,7 +204,7 @@ union svc_addr_u {
204struct svc_rqst { 204struct svc_rqst {
205 struct list_head rq_list; /* idle list */ 205 struct list_head rq_list; /* idle list */
206 struct list_head rq_all; /* all threads list */ 206 struct list_head rq_all; /* all threads list */
207 struct svc_sock * rq_sock; /* socket */ 207 struct svc_xprt * rq_xprt; /* transport ptr */
208 struct sockaddr_storage rq_addr; /* peer address */ 208 struct sockaddr_storage rq_addr; /* peer address */
209 size_t rq_addrlen; 209 size_t rq_addrlen;
210 210
@@ -214,9 +214,10 @@ struct svc_rqst {
214 struct auth_ops * rq_authop; /* authentication flavour */ 214 struct auth_ops * rq_authop; /* authentication flavour */
215 u32 rq_flavor; /* pseudoflavor */ 215 u32 rq_flavor; /* pseudoflavor */
216 struct svc_cred rq_cred; /* auth info */ 216 struct svc_cred rq_cred; /* auth info */
217 struct sk_buff * rq_skbuff; /* fast recv inet buffer */ 217 void * rq_xprt_ctxt; /* transport specific context ptr */
218 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 218 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
219 219
220 size_t rq_xprt_hlen; /* xprt header len */
220 struct xdr_buf rq_arg; 221 struct xdr_buf rq_arg;
221 struct xdr_buf rq_res; 222 struct xdr_buf rq_res;
222 struct page * rq_pages[RPCSVC_MAXPAGES]; 223 struct page * rq_pages[RPCSVC_MAXPAGES];
@@ -317,11 +318,12 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp)
317 318
318struct svc_deferred_req { 319struct svc_deferred_req {
319 u32 prot; /* protocol (UDP or TCP) */ 320 u32 prot; /* protocol (UDP or TCP) */
320 struct svc_sock *svsk; 321 struct svc_xprt *xprt;
321 struct sockaddr_storage addr; /* where reply must go */ 322 struct sockaddr_storage addr; /* where reply must go */
322 size_t addrlen; 323 size_t addrlen;
323 union svc_addr_u daddr; /* where reply must come from */ 324 union svc_addr_u daddr; /* where reply must come from */
324 struct cache_deferred_req handle; 325 struct cache_deferred_req handle;
326 size_t xprt_hlen;
325 int argslen; 327 int argslen;
326 __be32 args[0]; 328 __be32 args[0];
327}; 329};
@@ -382,6 +384,8 @@ struct svc_procedure {
382 */ 384 */
383struct svc_serv * svc_create(struct svc_program *, unsigned int, 385struct svc_serv * svc_create(struct svc_program *, unsigned int,
384 void (*shutdown)(struct svc_serv*)); 386 void (*shutdown)(struct svc_serv*));
387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
388 struct svc_pool *pool);
385int svc_create_thread(svc_thread_fn, struct svc_serv *); 389int svc_create_thread(svc_thread_fn, struct svc_serv *);
386void svc_exit_thread(struct svc_rqst *); 390void svc_exit_thread(struct svc_rqst *);
387struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 391struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
new file mode 100644
index 000000000000..c11bbcc081f9
--- /dev/null
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -0,0 +1,262 @@
1/*
2 * Copyright (c) 2005-2006 Network Appliance, Inc. 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 BSD-type
8 * license below:
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * Neither the name of the Network Appliance, Inc. nor the names of
23 * its contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 * Author: Tom Tucker <tom@opengridcomputing.com>
40 */
41
42#ifndef SVC_RDMA_H
43#define SVC_RDMA_H
44#include <linux/sunrpc/xdr.h>
45#include <linux/sunrpc/svcsock.h>
46#include <linux/sunrpc/rpc_rdma.h>
47#include <rdma/ib_verbs.h>
48#include <rdma/rdma_cm.h>
49#define SVCRDMA_DEBUG
50
51/* RPC/RDMA parameters and stats */
52extern unsigned int svcrdma_ord;
53extern unsigned int svcrdma_max_requests;
54extern unsigned int svcrdma_max_req_size;
55
56extern atomic_t rdma_stat_recv;
57extern atomic_t rdma_stat_read;
58extern atomic_t rdma_stat_write;
59extern atomic_t rdma_stat_sq_starve;
60extern atomic_t rdma_stat_rq_starve;
61extern atomic_t rdma_stat_rq_poll;
62extern atomic_t rdma_stat_rq_prod;
63extern atomic_t rdma_stat_sq_poll;
64extern atomic_t rdma_stat_sq_prod;
65
66#define RPCRDMA_VERSION 1
67
68/*
69 * Contexts are built when an RDMA request is created and are a
70 * record of the resources that can be recovered when the request
71 * completes.
72 */
73struct svc_rdma_op_ctxt {
74 struct svc_rdma_op_ctxt *next;
75 struct xdr_buf arg;
76 struct list_head dto_q;
77 enum ib_wr_opcode wr_op;
78 enum ib_wc_status wc_status;
79 u32 byte_len;
80 struct svcxprt_rdma *xprt;
81 unsigned long flags;
82 enum dma_data_direction direction;
83 int count;
84 struct ib_sge sge[RPCSVC_MAXPAGES];
85 struct page *pages[RPCSVC_MAXPAGES];
86};
87
88#define RDMACTXT_F_READ_DONE 1
89#define RDMACTXT_F_LAST_CTXT 2
90
91struct svcxprt_rdma {
92 struct svc_xprt sc_xprt; /* SVC transport structure */
93 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */
94 struct list_head sc_accept_q; /* Conn. waiting accept */
95 int sc_ord; /* RDMA read limit */
96 wait_queue_head_t sc_read_wait;
97 int sc_max_sge;
98
99 int sc_sq_depth; /* Depth of SQ */
100 atomic_t sc_sq_count; /* Number of SQ WR on queue */
101
102 int sc_max_requests; /* Depth of RQ */
103 int sc_max_req_size; /* Size of each RQ WR buf */
104
105 struct ib_pd *sc_pd;
106
107 struct svc_rdma_op_ctxt *sc_ctxt_head;
108 int sc_ctxt_cnt;
109 int sc_ctxt_bump;
110 int sc_ctxt_max;
111 spinlock_t sc_ctxt_lock;
112 struct list_head sc_rq_dto_q;
113 spinlock_t sc_rq_dto_lock;
114 struct ib_qp *sc_qp;
115 struct ib_cq *sc_rq_cq;
116 struct ib_cq *sc_sq_cq;
117 struct ib_mr *sc_phys_mr; /* MR for server memory */
118
119 spinlock_t sc_lock; /* transport lock */
120
121 wait_queue_head_t sc_send_wait; /* SQ exhaustion waitlist */
122 unsigned long sc_flags;
123 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */
124 struct list_head sc_read_complete_q;
125 spinlock_t sc_read_complete_lock;
126};
127/* sc_flags */
128#define RDMAXPRT_RQ_PENDING 1
129#define RDMAXPRT_SQ_PENDING 2
130#define RDMAXPRT_CONN_PENDING 3
131
132#define RPCRDMA_LISTEN_BACKLOG 10
133/* The default ORD value is based on two outstanding full-size writes with a
134 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
135#define RPCRDMA_ORD (64/4)
136#define RPCRDMA_SQ_DEPTH_MULT 8
137#define RPCRDMA_MAX_THREADS 16
138#define RPCRDMA_MAX_REQUESTS 16
139#define RPCRDMA_MAX_REQ_SIZE 4096
140
141/* svc_rdma_marshal.c */
142extern void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *,
143 int *, int *);
144extern int svc_rdma_xdr_decode_req(struct rpcrdma_msg **, struct svc_rqst *);
145extern int svc_rdma_xdr_decode_deferred_req(struct svc_rqst *);
146extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *,
147 struct rpcrdma_msg *,
148 enum rpcrdma_errcode, u32 *);
149extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int);
150extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int);
151extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int,
152 u32, u64, u32);
153extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *,
154 struct rpcrdma_msg *,
155 struct rpcrdma_msg *,
156 enum rpcrdma_proc);
157extern int svc_rdma_xdr_get_reply_hdr_len(struct rpcrdma_msg *);
158
159/* svc_rdma_recvfrom.c */
160extern int svc_rdma_recvfrom(struct svc_rqst *);
161
162/* svc_rdma_sendto.c */
163extern int svc_rdma_sendto(struct svc_rqst *);
164
165/* svc_rdma_transport.c */
166extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *);
167extern int svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
168 enum rpcrdma_errcode);
169struct page *svc_rdma_get_page(void);
170extern int svc_rdma_post_recv(struct svcxprt_rdma *);
171extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
172extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
173extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
174extern void svc_sq_reap(struct svcxprt_rdma *);
175extern void svc_rq_reap(struct svcxprt_rdma *);
176extern struct svc_xprt_class svc_rdma_class;
177extern void svc_rdma_prep_reply_hdr(struct svc_rqst *);
178
179/* svc_rdma.c */
180extern int svc_rdma_init(void);
181extern void svc_rdma_cleanup(void);
182
183/*
184 * Returns the address of the first read chunk or <nul> if no read chunk is
185 * present
186 */
187static inline struct rpcrdma_read_chunk *
188svc_rdma_get_read_chunk(struct rpcrdma_msg *rmsgp)
189{
190 struct rpcrdma_read_chunk *ch =
191 (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
192
193 if (ch->rc_discrim == 0)
194 return NULL;
195
196 return ch;
197}
198
199/*
200 * Returns the address of the first read write array element or <nul> if no
201 * write array list is present
202 */
203static inline struct rpcrdma_write_array *
204svc_rdma_get_write_array(struct rpcrdma_msg *rmsgp)
205{
206 if (rmsgp->rm_body.rm_chunks[0] != 0
207 || rmsgp->rm_body.rm_chunks[1] == 0)
208 return NULL;
209
210 return (struct rpcrdma_write_array *)&rmsgp->rm_body.rm_chunks[1];
211}
212
213/*
214 * Returns the address of the first reply array element or <nul> if no
215 * reply array is present
216 */
217static inline struct rpcrdma_write_array *
218svc_rdma_get_reply_array(struct rpcrdma_msg *rmsgp)
219{
220 struct rpcrdma_read_chunk *rch;
221 struct rpcrdma_write_array *wr_ary;
222 struct rpcrdma_write_array *rp_ary;
223
224 /* XXX: Need to fix when reply list may occur with read-list and/or
225 * write list */
226 if (rmsgp->rm_body.rm_chunks[0] != 0 ||
227 rmsgp->rm_body.rm_chunks[1] != 0)
228 return NULL;
229
230 rch = svc_rdma_get_read_chunk(rmsgp);
231 if (rch) {
232 while (rch->rc_discrim)
233 rch++;
234
235 /* The reply list follows an empty write array located
236 * at 'rc_position' here. The reply array is at rc_target.
237 */
238 rp_ary = (struct rpcrdma_write_array *)&rch->rc_target;
239
240 goto found_it;
241 }
242
243 wr_ary = svc_rdma_get_write_array(rmsgp);
244 if (wr_ary) {
245 rp_ary = (struct rpcrdma_write_array *)
246 &wr_ary->
247 wc_array[wr_ary->wc_nchunks].wc_target.rs_length;
248
249 goto found_it;
250 }
251
252 /* No read list, no write list */
253 rp_ary = (struct rpcrdma_write_array *)
254 &rmsgp->rm_body.rm_chunks[2];
255
256 found_it:
257 if (rp_ary->wc_discrim == 0)
258 return NULL;
259
260 return rp_ary;
261}
262#endif
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
new file mode 100644
index 000000000000..6fd7b016517f
--- /dev/null
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -0,0 +1,159 @@
1/*
2 * linux/include/linux/sunrpc/svc_xprt.h
3 *
4 * RPC server transport I/O
5 */
6
7#ifndef SUNRPC_SVC_XPRT_H
8#define SUNRPC_SVC_XPRT_H
9
10#include <linux/sunrpc/svc.h>
11#include <linux/module.h>
12
13struct svc_xprt_ops {
14 struct svc_xprt *(*xpo_create)(struct svc_serv *,
15 struct sockaddr *, int,
16 int);
17 struct svc_xprt *(*xpo_accept)(struct svc_xprt *);
18 int (*xpo_has_wspace)(struct svc_xprt *);
19 int (*xpo_recvfrom)(struct svc_rqst *);
20 void (*xpo_prep_reply_hdr)(struct svc_rqst *);
21 int (*xpo_sendto)(struct svc_rqst *);
22 void (*xpo_release_rqst)(struct svc_rqst *);
23 void (*xpo_detach)(struct svc_xprt *);
24 void (*xpo_free)(struct svc_xprt *);
25};
26
27struct svc_xprt_class {
28 const char *xcl_name;
29 struct module *xcl_owner;
30 struct svc_xprt_ops *xcl_ops;
31 struct list_head xcl_list;
32 u32 xcl_max_payload;
33};
34
35struct svc_xprt {
36 struct svc_xprt_class *xpt_class;
37 struct svc_xprt_ops *xpt_ops;
38 struct kref xpt_ref;
39 struct list_head xpt_list;
40 struct list_head xpt_ready;
41 unsigned long xpt_flags;
42#define XPT_BUSY 0 /* enqueued/receiving */
43#define XPT_CONN 1 /* conn pending */
44#define XPT_CLOSE 2 /* dead or dying */
45#define XPT_DATA 3 /* data pending */
46#define XPT_TEMP 4 /* connected transport */
47#define XPT_DEAD 6 /* transport closed */
48#define XPT_CHNGBUF 7 /* need to change snd/rcv buf sizes */
49#define XPT_DEFERRED 8 /* deferred request pending */
50#define XPT_OLD 9 /* used for xprt aging mark+sweep */
51#define XPT_DETACHED 10 /* detached from tempsocks list */
52#define XPT_LISTENER 11 /* listening endpoint */
53#define XPT_CACHE_AUTH 12 /* cache auth info */
54
55 struct svc_pool *xpt_pool; /* current pool iff queued */
56 struct svc_serv *xpt_server; /* service for transport */
57 atomic_t xpt_reserved; /* space on outq that is rsvd */
58 struct mutex xpt_mutex; /* to serialize sending data */
59 spinlock_t xpt_lock; /* protects sk_deferred
60 * and xpt_auth_cache */
61 void *xpt_auth_cache;/* auth cache */
62 struct list_head xpt_deferred; /* deferred requests that need
63 * to be revisted */
64 struct sockaddr_storage xpt_local; /* local address */
65 size_t xpt_locallen; /* length of address */
66 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */
68};
69
70int svc_reg_xprt_class(struct svc_xprt_class *);
71void svc_unreg_xprt_class(struct svc_xprt_class *);
72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
73 struct svc_serv *);
74int svc_create_xprt(struct svc_serv *, char *, unsigned short, int);
75void svc_xprt_enqueue(struct svc_xprt *xprt);
76void svc_xprt_received(struct svc_xprt *);
77void svc_xprt_put(struct svc_xprt *xprt);
78void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
79void svc_close_xprt(struct svc_xprt *xprt);
80void svc_delete_xprt(struct svc_xprt *xprt);
81int svc_port_is_privileged(struct sockaddr *sin);
82int svc_print_xprts(char *buf, int maxlen);
83struct svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int);
84int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen);
85
86static inline void svc_xprt_get(struct svc_xprt *xprt)
87{
88 kref_get(&xprt->xpt_ref);
89}
90static inline void svc_xprt_set_local(struct svc_xprt *xprt,
91 struct sockaddr *sa, int salen)
92{
93 memcpy(&xprt->xpt_local, sa, salen);
94 xprt->xpt_locallen = salen;
95}
96static inline void svc_xprt_set_remote(struct svc_xprt *xprt,
97 struct sockaddr *sa, int salen)
98{
99 memcpy(&xprt->xpt_remote, sa, salen);
100 xprt->xpt_remotelen = salen;
101}
102static inline unsigned short svc_addr_port(struct sockaddr *sa)
103{
104 unsigned short ret = 0;
105 switch (sa->sa_family) {
106 case AF_INET:
107 ret = ntohs(((struct sockaddr_in *)sa)->sin_port);
108 break;
109 case AF_INET6:
110 ret = ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
111 break;
112 }
113 return ret;
114}
115
116static inline size_t svc_addr_len(struct sockaddr *sa)
117{
118 switch (sa->sa_family) {
119 case AF_INET:
120 return sizeof(struct sockaddr_in);
121 case AF_INET6:
122 return sizeof(struct sockaddr_in6);
123 }
124 return -EAFNOSUPPORT;
125}
126
127static inline unsigned short svc_xprt_local_port(struct svc_xprt *xprt)
128{
129 return svc_addr_port((struct sockaddr *)&xprt->xpt_local);
130}
131
132static inline unsigned short svc_xprt_remote_port(struct svc_xprt *xprt)
133{
134 return svc_addr_port((struct sockaddr *)&xprt->xpt_remote);
135}
136
137static inline char *__svc_print_addr(struct sockaddr *addr,
138 char *buf, size_t len)
139{
140 switch (addr->sa_family) {
141 case AF_INET:
142 snprintf(buf, len, "%u.%u.%u.%u, port=%u",
143 NIPQUAD(((struct sockaddr_in *) addr)->sin_addr),
144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break;
146
147 case AF_INET6:
148 snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u",
149 NIP6(((struct sockaddr_in6 *) addr)->sin6_addr),
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
151 break;
152
153 default:
154 snprintf(buf, len, "unknown address type: %d", addr->sa_family);
155 break;
156 }
157 return buf;
158}
159#endif /* SUNRPC_SVC_XPRT_H */
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index a53e0fa855d2..206f092ad4c7 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -10,42 +10,16 @@
10#define SUNRPC_SVCSOCK_H 10#define SUNRPC_SVCSOCK_H
11 11
12#include <linux/sunrpc/svc.h> 12#include <linux/sunrpc/svc.h>
13#include <linux/sunrpc/svc_xprt.h>
13 14
14/* 15/*
15 * RPC server socket. 16 * RPC server socket.
16 */ 17 */
17struct svc_sock { 18struct svc_sock {
18 struct list_head sk_ready; /* list of ready sockets */ 19 struct svc_xprt sk_xprt;
19 struct list_head sk_list; /* list of all sockets */
20 struct socket * sk_sock; /* berkeley socket layer */ 20 struct socket * sk_sock; /* berkeley socket layer */
21 struct sock * sk_sk; /* INET layer */ 21 struct sock * sk_sk; /* INET layer */
22 22
23 struct svc_pool * sk_pool; /* current pool iff queued */
24 struct svc_serv * sk_server; /* service for this socket */
25 atomic_t sk_inuse; /* use count */
26 unsigned long sk_flags;
27#define SK_BUSY 0 /* enqueued/receiving */
28#define SK_CONN 1 /* conn pending */
29#define SK_CLOSE 2 /* dead or dying */
30#define SK_DATA 3 /* data pending */
31#define SK_TEMP 4 /* temp (TCP) socket */
32#define SK_DEAD 6 /* socket closed */
33#define SK_CHNGBUF 7 /* need to change snd/rcv buffer sizes */
34#define SK_DEFERRED 8 /* request on sk_deferred */
35#define SK_OLD 9 /* used for temp socket aging mark+sweep */
36#define SK_DETACHED 10 /* detached from tempsocks list */
37
38 atomic_t sk_reserved; /* space on outq that is reserved */
39
40 spinlock_t sk_lock; /* protects sk_deferred and
41 * sk_info_authunix */
42 struct list_head sk_deferred; /* deferred requests that need to
43 * be revisted */
44 struct mutex sk_mutex; /* to serialize sending data */
45
46 int (*sk_recvfrom)(struct svc_rqst *rqstp);
47 int (*sk_sendto)(struct svc_rqst *rqstp);
48
49 /* We keep the old state_change and data_ready CB's here */ 23 /* We keep the old state_change and data_ready CB's here */
50 void (*sk_ostate)(struct sock *); 24 void (*sk_ostate)(struct sock *);
51 void (*sk_odata)(struct sock *, int bytes); 25 void (*sk_odata)(struct sock *, int bytes);
@@ -54,21 +28,12 @@ struct svc_sock {
54 /* private TCP part */ 28 /* private TCP part */
55 int sk_reclen; /* length of record */ 29 int sk_reclen; /* length of record */
56 int sk_tcplen; /* current read length */ 30 int sk_tcplen; /* current read length */
57 time_t sk_lastrecv; /* time of last received request */
58
59 /* cache of various info for TCP sockets */
60 void *sk_info_authunix;
61
62 struct sockaddr_storage sk_local; /* local address */
63 struct sockaddr_storage sk_remote; /* remote peer's address */
64 int sk_remotelen; /* length of address */
65}; 31};
66 32
67/* 33/*
68 * Function prototypes. 34 * Function prototypes.
69 */ 35 */
70int svc_makesock(struct svc_serv *, int, unsigned short, int flags); 36void svc_close_all(struct list_head *);
71void svc_force_close_socket(struct svc_sock *);
72int svc_recv(struct svc_rqst *, long); 37int svc_recv(struct svc_rqst *, long);
73int svc_send(struct svc_rqst *); 38int svc_send(struct svc_rqst *);
74void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
@@ -78,6 +43,8 @@ int svc_addsock(struct svc_serv *serv,
78 int fd, 43 int fd,
79 char *name_return, 44 char *name_return,
80 int *proto); 45 int *proto);
46void svc_init_xprt_sock(void);
47void svc_cleanup_xprt_sock(void);
81 48
82/* 49/*
83 * svc_makesock socket characteristics 50 * svc_makesock socket characteristics
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 0751c9464d0f..e4057d729f03 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -112,7 +112,8 @@ struct xdr_buf {
112__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len); 112__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
113__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len); 113__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
114__be32 *xdr_encode_string(__be32 *p, const char *s); 114__be32 *xdr_encode_string(__be32 *p, const char *s);
115__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen); 115__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, unsigned int *lenp,
116 unsigned int maxlen);
116__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *); 117__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
117__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *); 118__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
118 119
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 40280df2a3db..1d7d4c5797ee 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -38,18 +38,16 @@ typedef int __bitwise suspend_state_t;
38 * There is the %suspend_valid_only_mem function available that can be 38 * There is the %suspend_valid_only_mem function available that can be
39 * assigned to this if the platform only supports mem sleep. 39 * assigned to this if the platform only supports mem sleep.
40 * 40 *
41 * @set_target: Tell the platform which system sleep state is going to be 41 * @begin: Initialise a transition to given system sleep state.
42 * entered. 42 * @begin() is executed right prior to suspending devices. The information
43 * @set_target() is executed right prior to suspending devices. The 43 * conveyed to the platform code by @begin() should be disregarded by it as
44 * information conveyed to the platform code by @set_target() should be 44 * soon as @end() is executed. If @begin() fails (ie. returns nonzero),
45 * disregarded by the platform as soon as @finish() is executed and if
46 * @prepare() fails. If @set_target() fails (ie. returns nonzero),
47 * @prepare(), @enter() and @finish() will not be called by the PM core. 45 * @prepare(), @enter() and @finish() will not be called by the PM core.
48 * This callback is optional. However, if it is implemented, the argument 46 * This callback is optional. However, if it is implemented, the argument
49 * passed to @enter() is meaningless and should be ignored. 47 * passed to @enter() is redundant and should be ignored.
50 * 48 *
51 * @prepare: Prepare the platform for entering the system sleep state indicated 49 * @prepare: Prepare the platform for entering the system sleep state indicated
52 * by @set_target(). 50 * by @begin().
53 * @prepare() is called right after devices have been suspended (ie. the 51 * @prepare() is called right after devices have been suspended (ie. the
54 * appropriate .suspend() method has been executed for each device) and 52 * appropriate .suspend() method has been executed for each device) and
55 * before the nonboot CPUs are disabled (it is executed with IRQs enabled). 53 * before the nonboot CPUs are disabled (it is executed with IRQs enabled).
@@ -57,8 +55,8 @@ typedef int __bitwise suspend_state_t;
57 * error code otherwise, in which case the system cannot enter the desired 55 * error code otherwise, in which case the system cannot enter the desired
58 * sleep state (@enter() and @finish() will not be called in that case). 56 * sleep state (@enter() and @finish() will not be called in that case).
59 * 57 *
60 * @enter: Enter the system sleep state indicated by @set_target() or 58 * @enter: Enter the system sleep state indicated by @begin() or represented by
61 * represented by the argument if @set_target() is not implemented. 59 * the argument if @begin() is not implemented.
62 * This callback is mandatory. It returns 0 on success or a negative 60 * This callback is mandatory. It returns 0 on success or a negative
63 * error code otherwise, in which case the system cannot enter the desired 61 * error code otherwise, in which case the system cannot enter the desired
64 * sleep state. 62 * sleep state.
@@ -69,13 +67,22 @@ typedef int __bitwise suspend_state_t;
69 * This callback is optional, but should be implemented by the platforms 67 * This callback is optional, but should be implemented by the platforms
70 * that implement @prepare(). If implemented, it is always called after 68 * that implement @prepare(). If implemented, it is always called after
71 * @enter() (even if @enter() fails). 69 * @enter() (even if @enter() fails).
70 *
71 * @end: Called by the PM core right after resuming devices, to indicate to
72 * the platform that the system has returned to the working state or
73 * the transition to the sleep state has been aborted.
74 * This callback is optional, but should be implemented by the platforms
75 * that implement @begin(), but platforms implementing @begin() should
76 * also provide a @end() which cleans up transitions aborted before
77 * @enter().
72 */ 78 */
73struct platform_suspend_ops { 79struct platform_suspend_ops {
74 int (*valid)(suspend_state_t state); 80 int (*valid)(suspend_state_t state);
75 int (*set_target)(suspend_state_t state); 81 int (*begin)(suspend_state_t state);
76 int (*prepare)(void); 82 int (*prepare)(void);
77 int (*enter)(suspend_state_t state); 83 int (*enter)(suspend_state_t state);
78 void (*finish)(void); 84 void (*finish)(void);
85 void (*end)(void);
79}; 86};
80 87
81#ifdef CONFIG_SUSPEND 88#ifdef CONFIG_SUSPEND
@@ -123,20 +130,22 @@ struct pbe {
123}; 130};
124 131
125/* mm/page_alloc.c */ 132/* mm/page_alloc.c */
126extern void drain_local_pages(void);
127extern void mark_free_pages(struct zone *zone); 133extern void mark_free_pages(struct zone *zone);
128 134
129/** 135/**
130 * struct platform_hibernation_ops - hibernation platform support 136 * struct platform_hibernation_ops - hibernation platform support
131 * 137 *
132 * The methods in this structure allow a platform to override the default 138 * The methods in this structure allow a platform to carry out special
133 * mechanism of shutting down the machine during a hibernation transition. 139 * operations required by it during a hibernation transition.
134 * 140 *
135 * All three methods must be assigned. 141 * All the methods below must be implemented.
136 * 142 *
137 * @start: Tell the platform driver that we're starting hibernation. 143 * @begin: Tell the platform driver that we're starting hibernation.
138 * Called right after shrinking memory and before freezing devices. 144 * Called right after shrinking memory and before freezing devices.
139 * 145 *
146 * @end: Called by the PM core right after resuming devices, to indicate to
147 * the platform that the system has returned to the working state.
148 *
140 * @pre_snapshot: Prepare the platform for creating the hibernation image. 149 * @pre_snapshot: Prepare the platform for creating the hibernation image.
141 * Called right after devices have been frozen and before the nonboot 150 * Called right after devices have been frozen and before the nonboot
142 * CPUs are disabled (runs with IRQs on). 151 * CPUs are disabled (runs with IRQs on).
@@ -171,7 +180,8 @@ extern void mark_free_pages(struct zone *zone);
171 * thawing devices (runs with IRQs on). 180 * thawing devices (runs with IRQs on).
172 */ 181 */
173struct platform_hibernation_ops { 182struct platform_hibernation_ops {
174 int (*start)(void); 183 int (*begin)(void);
184 void (*end)(void);
175 int (*pre_snapshot)(void); 185 int (*pre_snapshot)(void);
176 void (*finish)(void); 186 void (*finish)(void);
177 int (*prepare)(void); 187 int (*prepare)(void);
@@ -213,17 +223,8 @@ void save_processor_state(void);
213void restore_processor_state(void); 223void restore_processor_state(void);
214 224
215/* kernel/power/main.c */ 225/* kernel/power/main.c */
216extern struct blocking_notifier_head pm_chain_head; 226extern int register_pm_notifier(struct notifier_block *nb);
217 227extern int unregister_pm_notifier(struct notifier_block *nb);
218static inline int register_pm_notifier(struct notifier_block *nb)
219{
220 return blocking_notifier_chain_register(&pm_chain_head, nb);
221}
222
223static inline int unregister_pm_notifier(struct notifier_block *nb)
224{
225 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
226}
227 228
228#define pm_notifier(fn, pri) { \ 229#define pm_notifier(fn, pri) { \
229 static struct notifier_block fn##_nb = \ 230 static struct notifier_block fn##_nb = \
diff --git a/include/linux/suspend_ioctls.h b/include/linux/suspend_ioctls.h
new file mode 100644
index 000000000000..2c6faec96bde
--- /dev/null
+++ b/include/linux/suspend_ioctls.h
@@ -0,0 +1,32 @@
1#ifndef _LINUX_SUSPEND_IOCTLS_H
2#define _LINUX_SUSPEND_IOCTLS_H
3
4/*
5 * This structure is used to pass the values needed for the identification
6 * of the resume swap area from a user space to the kernel via the
7 * SNAPSHOT_SET_SWAP_AREA ioctl
8 */
9struct resume_swap_area {
10 loff_t offset;
11 u_int32_t dev;
12} __attribute__((packed));
13
14#define SNAPSHOT_IOC_MAGIC '3'
15#define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1)
16#define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2)
17#define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4)
18#define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5)
19#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)
20#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
21#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \
22 struct resume_swap_area)
23#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, loff_t)
24#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15)
25#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16)
26#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int)
27#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18)
28#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, loff_t)
29#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, loff_t)
30#define SNAPSHOT_IOC_MAXNR 20
31
32#endif /* _LINUX_SUSPEND_IOCTLS_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 2c3ce4c69b25..353153ea0bd5 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -6,7 +6,6 @@
6#include <linux/mmzone.h> 6#include <linux/mmzone.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/pagemap.h>
10 9
11#include <asm/atomic.h> 10#include <asm/atomic.h>
12#include <asm/page.h> 11#include <asm/page.h>
@@ -159,9 +158,6 @@ struct swap_list_t {
159/* Swap 50% full? Release swapcache more aggressively.. */ 158/* Swap 50% full? Release swapcache more aggressively.. */
160#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 159#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
161 160
162/* linux/mm/memory.c */
163extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
164
165/* linux/mm/page_alloc.c */ 161/* linux/mm/page_alloc.c */
166extern unsigned long totalram_pages; 162extern unsigned long totalram_pages;
167extern unsigned long totalreserve_pages; 163extern unsigned long totalreserve_pages;
@@ -224,16 +220,17 @@ extern struct address_space swapper_space;
224#define total_swapcache_pages swapper_space.nrpages 220#define total_swapcache_pages swapper_space.nrpages
225extern void show_swap_cache_info(void); 221extern void show_swap_cache_info(void);
226extern int add_to_swap(struct page *, gfp_t); 222extern int add_to_swap(struct page *, gfp_t);
223extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
227extern void __delete_from_swap_cache(struct page *); 224extern void __delete_from_swap_cache(struct page *);
228extern void delete_from_swap_cache(struct page *); 225extern void delete_from_swap_cache(struct page *);
229extern int move_to_swap_cache(struct page *, swp_entry_t);
230extern int move_from_swap_cache(struct page *, unsigned long,
231 struct address_space *);
232extern void free_page_and_swap_cache(struct page *); 226extern void free_page_and_swap_cache(struct page *);
233extern void free_pages_and_swap_cache(struct page **, int); 227extern void free_pages_and_swap_cache(struct page **, int);
234extern struct page * lookup_swap_cache(swp_entry_t); 228extern struct page *lookup_swap_cache(swp_entry_t);
235extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *vma, 229extern struct page *read_swap_cache_async(swp_entry_t, gfp_t,
236 unsigned long addr); 230 struct vm_area_struct *vma, unsigned long addr);
231extern struct page *swapin_readahead(swp_entry_t, gfp_t,
232 struct vm_area_struct *vma, unsigned long addr);
233
237/* linux/mm/swapfile.c */ 234/* linux/mm/swapfile.c */
238extern long total_swap_pages; 235extern long total_swap_pages;
239extern unsigned int nr_swapfiles; 236extern unsigned int nr_swapfiles;
@@ -307,7 +304,7 @@ static inline void swap_free(swp_entry_t swp)
307{ 304{
308} 305}
309 306
310static inline struct page *read_swap_cache_async(swp_entry_t swp, 307static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
311 struct vm_area_struct *vma, unsigned long addr) 308 struct vm_area_struct *vma, unsigned long addr)
312{ 309{
313 return NULL; 310 return NULL;
@@ -318,22 +315,12 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)
318 return NULL; 315 return NULL;
319} 316}
320 317
321static inline int valid_swaphandles(swp_entry_t entry, unsigned long *offset)
322{
323 return 0;
324}
325
326#define can_share_swap_page(p) (page_mapcount(p) == 1) 318#define can_share_swap_page(p) (page_mapcount(p) == 1)
327 319
328static inline int move_to_swap_cache(struct page *page, swp_entry_t entry) 320static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,
329{ 321 gfp_t gfp_mask)
330 return 1;
331}
332
333static inline int move_from_swap_cache(struct page *page, unsigned long index,
334 struct address_space *mapping)
335{ 322{
336 return 1; 323 return -1;
337} 324}
338 325
339static inline void __delete_from_swap_cache(struct page *page) 326static inline void __delete_from_swap_cache(struct page *page)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index ceb6cc5ceebb..7bf2d149d209 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -42,6 +42,12 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
42 return entry.val & SWP_OFFSET_MASK(entry); 42 return entry.val & SWP_OFFSET_MASK(entry);
43} 43}
44 44
45/* check whether a pte points to a swap entry */
46static inline int is_swap_pte(pte_t pte)
47{
48 return !pte_none(pte) && !pte_present(pte) && !pte_file(pte);
49}
50
45/* 51/*
46 * Convert the arch-dependent pte representation of a swp_entry_t into an 52 * Convert the arch-dependent pte representation of a swp_entry_t into an
47 * arch-independent swp_entry_t. 53 * arch-independent swp_entry_t.
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 61def7c8fbb3..4c2577bd1c85 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -607,8 +607,11 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
607 size_t len); 607 size_t len);
608asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); 608asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
609asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask); 609asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask);
610asmlinkage long sys_timerfd(int ufd, int clockid, int flags, 610asmlinkage long sys_timerfd_create(int clockid, int flags);
611 const struct itimerspec __user *utmr); 611asmlinkage long sys_timerfd_settime(int ufd, int flags,
612 const struct itimerspec __user *utmr,
613 struct itimerspec __user *otmr);
614asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
612asmlinkage long sys_eventfd(unsigned int count); 615asmlinkage long sys_eventfd(unsigned int count);
613asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 616asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
614 617
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 89faebfe48b8..571f01d20a86 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -102,7 +102,6 @@ enum
102 KERN_NODENAME=7, 102 KERN_NODENAME=7,
103 KERN_DOMAINNAME=8, 103 KERN_DOMAINNAME=8,
104 104
105 KERN_CAP_BSET=14, /* int: capability bounding set */
106 KERN_PANIC=15, /* int: panic timeout */ 105 KERN_PANIC=15, /* int: panic timeout */
107 KERN_REALROOTDEV=16, /* real root device to mount after initrd */ 106 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
108 107
@@ -440,8 +439,8 @@ enum
440 439
441enum { 440enum {
442 NET_IPV4_ROUTE_FLUSH=1, 441 NET_IPV4_ROUTE_FLUSH=1,
443 NET_IPV4_ROUTE_MIN_DELAY=2, 442 NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
444 NET_IPV4_ROUTE_MAX_DELAY=3, 443 NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
445 NET_IPV4_ROUTE_GC_THRESH=4, 444 NET_IPV4_ROUTE_GC_THRESH=4,
446 NET_IPV4_ROUTE_MAX_SIZE=5, 445 NET_IPV4_ROUTE_MAX_SIZE=5,
447 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, 446 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
@@ -965,8 +964,6 @@ extern int proc_dostring(struct ctl_table *, int, struct file *,
965 void __user *, size_t *, loff_t *); 964 void __user *, size_t *, loff_t *);
966extern int proc_dointvec(struct ctl_table *, int, struct file *, 965extern int proc_dointvec(struct ctl_table *, int, struct file *,
967 void __user *, size_t *, loff_t *); 966 void __user *, size_t *, loff_t *);
968extern int proc_dointvec_bset(struct ctl_table *, int, struct file *,
969 void __user *, size_t *, loff_t *);
970extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *, 967extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *,
971 void __user *, size_t *, loff_t *); 968 void __user *, size_t *, loff_t *);
972extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *, 969extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *,
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index e21937cf91d0..c50d2ba5caf0 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -81,6 +81,7 @@ enum
81 TCF_META_ID_SK_SNDTIMEO, 81 TCF_META_ID_SK_SNDTIMEO,
82 TCF_META_ID_SK_SENDMSG_OFF, 82 TCF_META_ID_SK_SENDMSG_OFF,
83 TCF_META_ID_SK_WRITE_PENDING, 83 TCF_META_ID_SK_WRITE_PENDING,
84 TCF_META_ID_VLAN_TAG,
84 __TCF_META_ID_MAX 85 __TCF_META_ID_MAX
85}; 86};
86#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) 87#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index dfbdfb9836f4..421323e5a2d6 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -23,6 +23,7 @@ struct restart_block {
23 u32 *uaddr; 23 u32 *uaddr;
24 u32 val; 24 u32 val;
25 u32 flags; 25 u32 flags;
26 u32 bitset;
26 u64 time; 27 u64 time;
27 } futex; 28 } futex;
28 }; 29 };
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 0fadf95debe1..a881c652f7e9 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -39,6 +39,8 @@ enum tick_nohz_mode {
39 * @idle_calls: Total number of idle calls 39 * @idle_calls: Total number of idle calls
40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped 40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
41 * @idle_entrytime: Time when the idle call was entered 41 * @idle_entrytime: Time when the idle call was entered
42 * @idle_waketime: Time when the idle was interrupted
43 * @idle_exittime: Time when the idle state was left
42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
43 * @sleep_length: Duration of the current idle sleep 45 * @sleep_length: Duration of the current idle sleep
44 */ 46 */
@@ -53,6 +55,8 @@ struct tick_sched {
53 unsigned long idle_sleeps; 55 unsigned long idle_sleeps;
54 int idle_active; 56 int idle_active;
55 ktime_t idle_entrytime; 57 ktime_t idle_entrytime;
58 ktime_t idle_waketime;
59 ktime_t idle_exittime;
56 ktime_t idle_sleeptime; 60 ktime_t idle_sleeptime;
57 ktime_t idle_lastupdate; 61 ktime_t idle_lastupdate;
58 ktime_t sleep_length; 62 ktime_t sleep_length;
diff --git a/include/linux/time.h b/include/linux/time.h
index b04136d60a2f..ceaab9fff155 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -122,6 +122,7 @@ extern void monotonic_to_bootbased(struct timespec *ts);
122extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 122extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
123extern int timekeeping_is_continuous(void); 123extern int timekeeping_is_continuous(void);
124extern void update_wall_time(void); 124extern void update_wall_time(void);
125extern void update_xtime_cache(u64 nsec);
125 126
126/** 127/**
127 * timespec_to_ns - Convert timespec to nanoseconds 128 * timespec_to_ns - Convert timespec to nanoseconds
diff --git a/include/linux/types.h b/include/linux/types.h
index f4f8d19158e4..b94c0e4efe24 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -126,7 +126,7 @@ typedef __s64 int64_t;
126#endif 126#endif
127 127
128/* this is a special 64bit data type that is 8-byte aligned */ 128/* this is a special 64bit data type that is 8-byte aligned */
129#define aligned_u64 unsigned long long __attribute__((aligned(8))) 129#define aligned_u64 __u64 __attribute__((aligned(8)))
130#define aligned_be64 __be64 __attribute__((aligned(8))) 130#define aligned_be64 __be64 __attribute__((aligned(8)))
131#define aligned_le64 __le64 __attribute__((aligned(8))) 131#define aligned_le64 __le64 __attribute__((aligned(8)))
132 132
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 5fc8ff73b7bb..2372e2e6b527 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -162,19 +162,19 @@ struct usb_interface {
162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
163 163
164 struct device dev; /* interface specific device info */ 164 struct device dev; /* interface specific device info */
165 struct device *usb_dev; /* pointer to the usb class's device, if any */ 165 struct device *usb_dev;
166 int pm_usage_cnt; /* usage counter for autosuspend */ 166 int pm_usage_cnt; /* usage counter for autosuspend */
167}; 167};
168#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 168#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
169#define interface_to_usbdev(intf) \ 169#define interface_to_usbdev(intf) \
170 container_of(intf->dev.parent, struct usb_device, dev) 170 container_of(intf->dev.parent, struct usb_device, dev)
171 171
172static inline void *usb_get_intfdata (struct usb_interface *intf) 172static inline void *usb_get_intfdata(struct usb_interface *intf)
173{ 173{
174 return dev_get_drvdata (&intf->dev); 174 return dev_get_drvdata(&intf->dev);
175} 175}
176 176
177static inline void usb_set_intfdata (struct usb_interface *intf, void *data) 177static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
178{ 178{
179 dev_set_drvdata(&intf->dev, data); 179 dev_set_drvdata(&intf->dev, data);
180} 180}
@@ -275,9 +275,10 @@ struct usb_host_config {
275 275
276int __usb_get_extra_descriptor(char *buffer, unsigned size, 276int __usb_get_extra_descriptor(char *buffer, unsigned size,
277 unsigned char type, void **ptr); 277 unsigned char type, void **ptr);
278#define usb_get_extra_descriptor(ifpoint,type,ptr)\ 278#define usb_get_extra_descriptor(ifpoint, type, ptr) \
279 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ 279 __usb_get_extra_descriptor((ifpoint)->extra, \
280 type,(void**)ptr) 280 (ifpoint)->extralen, \
281 type, (void **)ptr)
281 282
282/* ----------------------------------------------------------------------- */ 283/* ----------------------------------------------------------------------- */
283 284
@@ -318,7 +319,7 @@ struct usb_bus {
318#ifdef CONFIG_USB_DEVICEFS 319#ifdef CONFIG_USB_DEVICEFS
319 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 320 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
320#endif 321#endif
321 struct class_device *class_dev; /* class device for this bus */ 322 struct device *dev; /* device for this bus */
322 323
323#if defined(CONFIG_USB_MON) 324#if defined(CONFIG_USB_MON)
324 struct mon_bus *mon_bus; /* non-null when associated */ 325 struct mon_bus *mon_bus; /* non-null when associated */
@@ -388,7 +389,7 @@ struct usb_device {
388 unsigned can_submit:1; /* URBs may be submitted */ 389 unsigned can_submit:1; /* URBs may be submitted */
389 unsigned discon_suspended:1; /* Disconnected while suspended */ 390 unsigned discon_suspended:1; /* Disconnected while suspended */
390 unsigned have_langid:1; /* whether string_langid is valid */ 391 unsigned have_langid:1; /* whether string_langid is valid */
391 unsigned authorized:1; /* Policy has determined we can use it */ 392 unsigned authorized:1; /* Policy has said we can use it */
392 unsigned wusb:1; /* Device is Wireless USB */ 393 unsigned wusb:1; /* Device is Wireless USB */
393 int string_langid; /* language ID for strings */ 394 int string_langid; /* language ID for strings */
394 395
@@ -417,7 +418,10 @@ struct usb_device {
417 418
418 int pm_usage_cnt; /* usage counter for autosuspend */ 419 int pm_usage_cnt; /* usage counter for autosuspend */
419 u32 quirks; /* quirks of the whole device */ 420 u32 quirks; /* quirks of the whole device */
420 atomic_t urbnum; /* number of URBs submitted for the whole device */ 421 atomic_t urbnum; /* number of URBs submitted for
422 the whole device */
423
424 unsigned long active_duration; /* total time device is not suspended */
421 425
422#ifdef CONFIG_PM 426#ifdef CONFIG_PM
423 struct delayed_work autosuspend; /* for delayed autosuspends */ 427 struct delayed_work autosuspend; /* for delayed autosuspends */
@@ -425,6 +429,7 @@ struct usb_device {
425 429
426 unsigned long last_busy; /* time of last use */ 430 unsigned long last_busy; /* time of last use */
427 int autosuspend_delay; /* in jiffies */ 431 int autosuspend_delay; /* in jiffies */
432 unsigned long connect_time; /* time device was first connected */
428 433
429 unsigned auto_pm:1; /* autosuspend/resume in progress */ 434 unsigned auto_pm:1; /* autosuspend/resume in progress */
430 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 435 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
@@ -498,11 +503,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
498/*-------------------------------------------------------------------------*/ 503/*-------------------------------------------------------------------------*/
499 504
500/* for drivers using iso endpoints */ 505/* for drivers using iso endpoints */
501extern int usb_get_current_frame_number (struct usb_device *usb_dev); 506extern int usb_get_current_frame_number(struct usb_device *usb_dev);
502 507
503/* used these for multi-interface device registration */ 508/* used these for multi-interface device registration */
504extern int usb_driver_claim_interface(struct usb_driver *driver, 509extern int usb_driver_claim_interface(struct usb_driver *driver,
505 struct usb_interface *iface, void* priv); 510 struct usb_interface *iface, void *priv);
506 511
507/** 512/**
508 * usb_interface_claimed - returns true iff an interface is claimed 513 * usb_interface_claimed - returns true iff an interface is claimed
@@ -514,7 +519,8 @@ extern int usb_driver_claim_interface(struct usb_driver *driver,
514 * may need to explicitly claim that lock. 519 * may need to explicitly claim that lock.
515 * 520 *
516 */ 521 */
517static inline int usb_interface_claimed(struct usb_interface *iface) { 522static inline int usb_interface_claimed(struct usb_interface *iface)
523{
518 return (iface->dev.driver != NULL); 524 return (iface->dev.driver != NULL);
519} 525}
520 526
@@ -557,12 +563,11 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
557 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 563 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
558 * high speed, and a different one if they are full or low speed. 564 * high speed, and a different one if they are full or low speed.
559 */ 565 */
560static inline int usb_make_path (struct usb_device *dev, char *buf, 566static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
561 size_t size)
562{ 567{
563 int actual; 568 int actual;
564 actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, 569 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name,
565 dev->devpath); 570 dev->devpath);
566 return (actual >= (int)size) ? -1 : actual; 571 return (actual >= (int)size) ? -1 : actual;
567} 572}
568 573
@@ -608,7 +613,8 @@ static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
608 * 613 *
609 * Returns true if the endpoint is of type OUT, otherwise it returns false. 614 * Returns true if the endpoint is of type OUT, otherwise it returns false.
610 */ 615 */
611static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) 616static inline int usb_endpoint_dir_out(
617 const struct usb_endpoint_descriptor *epd)
612{ 618{
613 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); 619 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
614} 620}
@@ -619,7 +625,8 @@ static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd
619 * 625 *
620 * Returns true if the endpoint is of type bulk, otherwise it returns false. 626 * Returns true if the endpoint is of type bulk, otherwise it returns false.
621 */ 627 */
622static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) 628static inline int usb_endpoint_xfer_bulk(
629 const struct usb_endpoint_descriptor *epd)
623{ 630{
624 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 631 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
625 USB_ENDPOINT_XFER_BULK); 632 USB_ENDPOINT_XFER_BULK);
@@ -631,7 +638,8 @@ static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *e
631 * 638 *
632 * Returns true if the endpoint is of type control, otherwise it returns false. 639 * Returns true if the endpoint is of type control, otherwise it returns false.
633 */ 640 */
634static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd) 641static inline int usb_endpoint_xfer_control(
642 const struct usb_endpoint_descriptor *epd)
635{ 643{
636 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 644 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
637 USB_ENDPOINT_XFER_CONTROL); 645 USB_ENDPOINT_XFER_CONTROL);
@@ -644,7 +652,8 @@ static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor
644 * Returns true if the endpoint is of type interrupt, otherwise it returns 652 * Returns true if the endpoint is of type interrupt, otherwise it returns
645 * false. 653 * false.
646 */ 654 */
647static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) 655static inline int usb_endpoint_xfer_int(
656 const struct usb_endpoint_descriptor *epd)
648{ 657{
649 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 658 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
650 USB_ENDPOINT_XFER_INT); 659 USB_ENDPOINT_XFER_INT);
@@ -657,7 +666,8 @@ static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *ep
657 * Returns true if the endpoint is of type isochronous, otherwise it returns 666 * Returns true if the endpoint is of type isochronous, otherwise it returns
658 * false. 667 * false.
659 */ 668 */
660static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) 669static inline int usb_endpoint_xfer_isoc(
670 const struct usb_endpoint_descriptor *epd)
661{ 671{
662 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 672 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
663 USB_ENDPOINT_XFER_ISOC); 673 USB_ENDPOINT_XFER_ISOC);
@@ -670,7 +680,8 @@ static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *e
670 * Returns true if the endpoint has bulk transfer type and IN direction, 680 * Returns true if the endpoint has bulk transfer type and IN direction,
671 * otherwise it returns false. 681 * otherwise it returns false.
672 */ 682 */
673static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) 683static inline int usb_endpoint_is_bulk_in(
684 const struct usb_endpoint_descriptor *epd)
674{ 685{
675 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 686 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
676} 687}
@@ -682,7 +693,8 @@ static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *
682 * Returns true if the endpoint has bulk transfer type and OUT direction, 693 * Returns true if the endpoint has bulk transfer type and OUT direction,
683 * otherwise it returns false. 694 * otherwise it returns false.
684 */ 695 */
685static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) 696static inline int usb_endpoint_is_bulk_out(
697 const struct usb_endpoint_descriptor *epd)
686{ 698{
687 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 699 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
688} 700}
@@ -694,7 +706,8 @@ static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor
694 * Returns true if the endpoint has interrupt transfer type and IN direction, 706 * Returns true if the endpoint has interrupt transfer type and IN direction,
695 * otherwise it returns false. 707 * otherwise it returns false.
696 */ 708 */
697static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) 709static inline int usb_endpoint_is_int_in(
710 const struct usb_endpoint_descriptor *epd)
698{ 711{
699 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 712 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
700} 713}
@@ -706,7 +719,8 @@ static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *e
706 * Returns true if the endpoint has interrupt transfer type and OUT direction, 719 * Returns true if the endpoint has interrupt transfer type and OUT direction,
707 * otherwise it returns false. 720 * otherwise it returns false.
708 */ 721 */
709static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) 722static inline int usb_endpoint_is_int_out(
723 const struct usb_endpoint_descriptor *epd)
710{ 724{
711 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 725 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
712} 726}
@@ -718,7 +732,8 @@ static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *
718 * Returns true if the endpoint has isochronous transfer type and IN direction, 732 * Returns true if the endpoint has isochronous transfer type and IN direction,
719 * otherwise it returns false. 733 * otherwise it returns false.
720 */ 734 */
721static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) 735static inline int usb_endpoint_is_isoc_in(
736 const struct usb_endpoint_descriptor *epd)
722{ 737{
723 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 738 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
724} 739}
@@ -730,7 +745,8 @@ static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *
730 * Returns true if the endpoint has isochronous transfer type and OUT direction, 745 * Returns true if the endpoint has isochronous transfer type and OUT direction,
731 * otherwise it returns false. 746 * otherwise it returns false.
732 */ 747 */
733static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) 748static inline int usb_endpoint_is_isoc_out(
749 const struct usb_endpoint_descriptor *epd)
734{ 750{
735 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 751 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
736} 752}
@@ -761,8 +777,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
761 * specific device. 777 * specific device.
762 */ 778 */
763#define USB_DEVICE(vend,prod) \ 779#define USB_DEVICE(vend,prod) \
764 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \ 780 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
765 .idProduct = (prod) 781 .idVendor = (vend), \
782 .idProduct = (prod)
766/** 783/**
767 * USB_DEVICE_VER - macro used to describe a specific usb device with a 784 * USB_DEVICE_VER - macro used to describe a specific usb device with a
768 * version range 785 * version range
@@ -774,10 +791,12 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
774 * This macro is used to create a struct usb_device_id that matches a 791 * This macro is used to create a struct usb_device_id that matches a
775 * specific device, with a version range. 792 * specific device, with a version range.
776 */ 793 */
777#define USB_DEVICE_VER(vend,prod,lo,hi) \ 794#define USB_DEVICE_VER(vend, prod, lo, hi) \
778 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ 795 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
779 .idVendor = (vend), .idProduct = (prod), \ 796 .idVendor = (vend), \
780 .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) 797 .idProduct = (prod), \
798 .bcdDevice_lo = (lo), \
799 .bcdDevice_hi = (hi)
781 800
782/** 801/**
783 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb 802 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb
@@ -789,8 +808,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
789 * This macro is used to create a struct usb_device_id that matches a 808 * This macro is used to create a struct usb_device_id that matches a
790 * specific interface protocol of devices. 809 * specific interface protocol of devices.
791 */ 810 */
792#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \ 811#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \
793 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 812 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
813 USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
794 .idVendor = (vend), \ 814 .idVendor = (vend), \
795 .idProduct = (prod), \ 815 .idProduct = (prod), \
796 .bInterfaceProtocol = (pr) 816 .bInterfaceProtocol = (pr)
@@ -804,12 +824,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
804 * This macro is used to create a struct usb_device_id that matches a 824 * This macro is used to create a struct usb_device_id that matches a
805 * specific class of devices. 825 * specific class of devices.
806 */ 826 */
807#define USB_DEVICE_INFO(cl,sc,pr) \ 827#define USB_DEVICE_INFO(cl, sc, pr) \
808 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \ 828 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \
809 .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) 829 .bDeviceClass = (cl), \
830 .bDeviceSubClass = (sc), \
831 .bDeviceProtocol = (pr)
810 832
811/** 833/**
812 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 834 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
813 * @cl: bInterfaceClass value 835 * @cl: bInterfaceClass value
814 * @sc: bInterfaceSubClass value 836 * @sc: bInterfaceSubClass value
815 * @pr: bInterfaceProtocol value 837 * @pr: bInterfaceProtocol value
@@ -817,9 +839,11 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
817 * This macro is used to create a struct usb_device_id that matches a 839 * This macro is used to create a struct usb_device_id that matches a
818 * specific class of interfaces. 840 * specific class of interfaces.
819 */ 841 */
820#define USB_INTERFACE_INFO(cl,sc,pr) \ 842#define USB_INTERFACE_INFO(cl, sc, pr) \
821 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ 843 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \
822 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 844 .bInterfaceClass = (cl), \
845 .bInterfaceSubClass = (sc), \
846 .bInterfaceProtocol = (pr)
823 847
824/** 848/**
825 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device 849 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device
@@ -836,12 +860,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
836 * This is especially useful when explicitly matching devices that have 860 * This is especially useful when explicitly matching devices that have
837 * vendor specific bDeviceClass values, but standards-compliant interfaces. 861 * vendor specific bDeviceClass values, but standards-compliant interfaces.
838 */ 862 */
839#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ 863#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
840 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 864 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
841 | USB_DEVICE_ID_MATCH_DEVICE, \ 865 | USB_DEVICE_ID_MATCH_DEVICE, \
842 .idVendor = (vend), .idProduct = (prod), \ 866 .idVendor = (vend), \
867 .idProduct = (prod), \
843 .bInterfaceClass = (cl), \ 868 .bInterfaceClass = (cl), \
844 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 869 .bInterfaceSubClass = (sc), \
870 .bInterfaceProtocol = (pr)
845 871
846/* ----------------------------------------------------------------------- */ 872/* ----------------------------------------------------------------------- */
847 873
@@ -1119,7 +1145,7 @@ typedef void (*usb_complete_t)(struct urb *);
1119 * transferred. It will normally be the same as requested, unless 1145 * transferred. It will normally be the same as requested, unless
1120 * either an error was reported or a short read was performed. 1146 * either an error was reported or a short read was performed.
1121 * The URB_SHORT_NOT_OK transfer flag may be used to make such 1147 * The URB_SHORT_NOT_OK transfer flag may be used to make such
1122 * short reads be reported as errors. 1148 * short reads be reported as errors.
1123 * @setup_packet: Only used for control transfers, this points to eight bytes 1149 * @setup_packet: Only used for control transfers, this points to eight bytes
1124 * of setup data. Control transfers always start by sending this data 1150 * of setup data. Control transfers always start by sending this data
1125 * to the device. Then transfer_buffer is read or written, if needed. 1151 * to the device. Then transfer_buffer is read or written, if needed.
@@ -1138,7 +1164,7 @@ typedef void (*usb_complete_t)(struct urb *);
1138 * @complete: Completion handler. This URB is passed as the parameter to the 1164 * @complete: Completion handler. This URB is passed as the parameter to the
1139 * completion function. The completion function may then do what 1165 * completion function. The completion function may then do what
1140 * it likes with the URB, including resubmitting or freeing it. 1166 * it likes with the URB, including resubmitting or freeing it.
1141 * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 1167 * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to
1142 * collect the transfer status for each buffer. 1168 * collect the transfer status for each buffer.
1143 * 1169 *
1144 * This structure identifies USB transfer requests. URBs must be allocated by 1170 * This structure identifies USB transfer requests. URBs must be allocated by
@@ -1242,8 +1268,7 @@ typedef void (*usb_complete_t)(struct urb *);
1242 * when the urb is owned by the hcd, that is, since the call to 1268 * when the urb is owned by the hcd, that is, since the call to
1243 * usb_submit_urb() till the entry into the completion routine. 1269 * usb_submit_urb() till the entry into the completion routine.
1244 */ 1270 */
1245struct urb 1271struct urb {
1246{
1247 /* private: usb core and host controller only fields in the urb */ 1272 /* private: usb core and host controller only fields in the urb */
1248 struct kref kref; /* reference count of the URB */ 1273 struct kref kref; /* reference count of the URB */
1249 void *hcpriv; /* private data for host controller */ 1274 void *hcpriv; /* private data for host controller */
@@ -1254,10 +1279,10 @@ struct urb
1254 /* public: documented fields in the urb that can be used by drivers */ 1279 /* public: documented fields in the urb that can be used by drivers */
1255 struct list_head urb_list; /* list head for use by the urb's 1280 struct list_head urb_list; /* list head for use by the urb's
1256 * current owner */ 1281 * current owner */
1257 struct list_head anchor_list; /* the URB may be anchored by the driver */ 1282 struct list_head anchor_list; /* the URB may be anchored */
1258 struct usb_anchor *anchor; 1283 struct usb_anchor *anchor;
1259 struct usb_device *dev; /* (in) pointer to associated device */ 1284 struct usb_device *dev; /* (in) pointer to associated device */
1260 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ 1285 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
1261 unsigned int pipe; /* (in) pipe information */ 1286 unsigned int pipe; /* (in) pipe information */
1262 int status; /* (return) non-ISO status */ 1287 int status; /* (return) non-ISO status */
1263 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1288 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
@@ -1294,14 +1319,14 @@ struct urb
1294 * Initializes a control urb with the proper information needed to submit 1319 * Initializes a control urb with the proper information needed to submit
1295 * it to a device. 1320 * it to a device.
1296 */ 1321 */
1297static inline void usb_fill_control_urb (struct urb *urb, 1322static inline void usb_fill_control_urb(struct urb *urb,
1298 struct usb_device *dev, 1323 struct usb_device *dev,
1299 unsigned int pipe, 1324 unsigned int pipe,
1300 unsigned char *setup_packet, 1325 unsigned char *setup_packet,
1301 void *transfer_buffer, 1326 void *transfer_buffer,
1302 int buffer_length, 1327 int buffer_length,
1303 usb_complete_t complete_fn, 1328 usb_complete_t complete_fn,
1304 void *context) 1329 void *context)
1305{ 1330{
1306 urb->dev = dev; 1331 urb->dev = dev;
1307 urb->pipe = pipe; 1332 urb->pipe = pipe;
@@ -1325,13 +1350,13 @@ static inline void usb_fill_control_urb (struct urb *urb,
1325 * Initializes a bulk urb with the proper information needed to submit it 1350 * Initializes a bulk urb with the proper information needed to submit it
1326 * to a device. 1351 * to a device.
1327 */ 1352 */
1328static inline void usb_fill_bulk_urb (struct urb *urb, 1353static inline void usb_fill_bulk_urb(struct urb *urb,
1329 struct usb_device *dev, 1354 struct usb_device *dev,
1330 unsigned int pipe, 1355 unsigned int pipe,
1331 void *transfer_buffer, 1356 void *transfer_buffer,
1332 int buffer_length, 1357 int buffer_length,
1333 usb_complete_t complete_fn, 1358 usb_complete_t complete_fn,
1334 void *context) 1359 void *context)
1335{ 1360{
1336 urb->dev = dev; 1361 urb->dev = dev;
1337 urb->pipe = pipe; 1362 urb->pipe = pipe;
@@ -1359,14 +1384,14 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
1359 * the endpoint interval, and express polling intervals in microframes 1384 * the endpoint interval, and express polling intervals in microframes
1360 * (eight per millisecond) rather than in frames (one per millisecond). 1385 * (eight per millisecond) rather than in frames (one per millisecond).
1361 */ 1386 */
1362static inline void usb_fill_int_urb (struct urb *urb, 1387static inline void usb_fill_int_urb(struct urb *urb,
1363 struct usb_device *dev, 1388 struct usb_device *dev,
1364 unsigned int pipe, 1389 unsigned int pipe,
1365 void *transfer_buffer, 1390 void *transfer_buffer,
1366 int buffer_length, 1391 int buffer_length,
1367 usb_complete_t complete_fn, 1392 usb_complete_t complete_fn,
1368 void *context, 1393 void *context,
1369 int interval) 1394 int interval)
1370{ 1395{
1371 urb->dev = dev; 1396 urb->dev = dev;
1372 urb->pipe = pipe; 1397 urb->pipe = pipe;
@@ -1419,15 +1444,15 @@ static inline int usb_urb_dir_out(struct urb *urb)
1419 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1444 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
1420} 1445}
1421 1446
1422void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1447void *usb_buffer_alloc(struct usb_device *dev, size_t size,
1423 gfp_t mem_flags, dma_addr_t *dma); 1448 gfp_t mem_flags, dma_addr_t *dma);
1424void usb_buffer_free (struct usb_device *dev, size_t size, 1449void usb_buffer_free(struct usb_device *dev, size_t size,
1425 void *addr, dma_addr_t dma); 1450 void *addr, dma_addr_t dma);
1426 1451
1427#if 0 1452#if 0
1428struct urb *usb_buffer_map (struct urb *urb); 1453struct urb *usb_buffer_map(struct urb *urb);
1429void usb_buffer_dmasync (struct urb *urb); 1454void usb_buffer_dmasync(struct urb *urb);
1430void usb_buffer_unmap (struct urb *urb); 1455void usb_buffer_unmap(struct urb *urb);
1431#endif 1456#endif
1432 1457
1433struct scatterlist; 1458struct scatterlist;
@@ -1499,7 +1524,7 @@ struct usb_sg_request {
1499 int status; 1524 int status;
1500 size_t bytes; 1525 size_t bytes;
1501 1526
1502 /* 1527 /*
1503 * members below are private: to usbcore, 1528 * members below are private: to usbcore,
1504 * and are not provided for driver access! 1529 * and are not provided for driver access!
1505 */ 1530 */
@@ -1517,18 +1542,18 @@ struct usb_sg_request {
1517 struct completion complete; 1542 struct completion complete;
1518}; 1543};
1519 1544
1520int usb_sg_init ( 1545int usb_sg_init(
1521 struct usb_sg_request *io, 1546 struct usb_sg_request *io,
1522 struct usb_device *dev, 1547 struct usb_device *dev,
1523 unsigned pipe, 1548 unsigned pipe,
1524 unsigned period, 1549 unsigned period,
1525 struct scatterlist *sg, 1550 struct scatterlist *sg,
1526 int nents, 1551 int nents,
1527 size_t length, 1552 size_t length,
1528 gfp_t mem_flags 1553 gfp_t mem_flags
1529); 1554);
1530void usb_sg_cancel (struct usb_sg_request *io); 1555void usb_sg_cancel(struct usb_sg_request *io);
1531void usb_sg_wait (struct usb_sg_request *io); 1556void usb_sg_wait(struct usb_sg_request *io);
1532 1557
1533 1558
1534/* ----------------------------------------------------------------------- */ 1559/* ----------------------------------------------------------------------- */
@@ -1585,21 +1610,21 @@ static inline unsigned int __create_pipe(struct usb_device *dev,
1585 1610
1586/* Create various pipes... */ 1611/* Create various pipes... */
1587#define usb_sndctrlpipe(dev,endpoint) \ 1612#define usb_sndctrlpipe(dev,endpoint) \
1588 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) 1613 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
1589#define usb_rcvctrlpipe(dev,endpoint) \ 1614#define usb_rcvctrlpipe(dev,endpoint) \
1590 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1615 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1591#define usb_sndisocpipe(dev,endpoint) \ 1616#define usb_sndisocpipe(dev,endpoint) \
1592 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) 1617 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
1593#define usb_rcvisocpipe(dev,endpoint) \ 1618#define usb_rcvisocpipe(dev,endpoint) \
1594 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1619 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1595#define usb_sndbulkpipe(dev,endpoint) \ 1620#define usb_sndbulkpipe(dev,endpoint) \
1596 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) 1621 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
1597#define usb_rcvbulkpipe(dev,endpoint) \ 1622#define usb_rcvbulkpipe(dev,endpoint) \
1598 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1623 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1599#define usb_sndintpipe(dev,endpoint) \ 1624#define usb_sndintpipe(dev,endpoint) \
1600 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) 1625 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
1601#define usb_rcvintpipe(dev,endpoint) \ 1626#define usb_rcvintpipe(dev,endpoint) \
1602 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1627 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1603 1628
1604/*-------------------------------------------------------------------------*/ 1629/*-------------------------------------------------------------------------*/
1605 1630
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 6ce42bf9f743..b8cba1dcb2c6 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,6 +1,7 @@
1unifdef-y += audio.h 1header-y += audio.h
2unifdef-y += cdc.h 2header-y += cdc.h
3unifdef-y += ch9.h 3header-y += ch9.h
4unifdef-y += gadgetfs.h 4header-y += gadgetfs.h
5unifdef-y += midi.h 5header-y += midi.h
6unifdef-y += g_printer.h
6 7
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 6bd235994dc2..2dfeef16b221 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -27,13 +27,13 @@
27 27
28/* 4.3.2 Class-Specific AC Interface Descriptor */ 28/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor { 29struct usb_ac_header_descriptor {
30 __u8 bLength; // 8+n 30 __u8 bLength; /* 8+n */
31 __u8 bDescriptorType; // USB_DT_CS_INTERFACE 31 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
32 __u8 bDescriptorSubtype; // USB_MS_HEADER 32 __u8 bDescriptorSubtype; /* USB_MS_HEADER */
33 __le16 bcdADC; // 0x0100 33 __le16 bcdADC; /* 0x0100 */
34 __le16 wTotalLength; // includes Unit and Terminal desc. 34 __le16 wTotalLength; /* includes Unit and Terminal desc. */
35 __u8 bInCollection; // n 35 __u8 bInCollection; /* n */
36 __u8 baInterfaceNr[]; // [n] 36 __u8 baInterfaceNr[]; /* [n] */
37} __attribute__ ((packed)); 37} __attribute__ ((packed));
38 38
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n)) 39#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 2204ae22c381..94ee4ecf0564 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -29,16 +29,16 @@
29 * Class-Specific descriptors ... there are a couple dozen of them 29 * Class-Specific descriptors ... there are a couple dozen of them
30 */ 30 */
31 31
32#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ 32#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
33#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ 33#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ 34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ 35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
36#define USB_CDC_COUNTRY_TYPE 0x07 36#define USB_CDC_COUNTRY_TYPE 0x07
37#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ 37#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
38#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ 38#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
39#define USB_CDC_WHCM_TYPE 0x11 39#define USB_CDC_WHCM_TYPE 0x11
40#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ 40#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
41#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ 41#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
42#define USB_CDC_DMM_TYPE 0x14 42#define USB_CDC_DMM_TYPE 0x14
43#define USB_CDC_OBEX_TYPE 0x15 43#define USB_CDC_OBEX_TYPE 0x15
44 44
diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h
new file mode 100644
index 000000000000..0c5ea1e3eb98
--- /dev/null
+++ b/include/linux/usb/g_printer.h
@@ -0,0 +1,31 @@
1/*
2 * g_printer.h -- Header file for USB Printer gadget driver
3 *
4 * Copyright (C) 2007 Craig W. Nadler
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22#define PRINTER_NOT_ERROR 0x08
23#define PRINTER_SELECTED 0x10
24#define PRINTER_PAPER_EMPTY 0x20
25
26/* The 'g' code is also used by gadgetfs ioctl requests.
27 * Don't add any colliding codes to either driver, and keep
28 * them in unique ranges (size 0x20 for now).
29 */
30#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char)
31#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char)
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c1527c2ef3cb..aa3047ff00d1 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -70,9 +70,10 @@ struct usb_ep;
70 * 70 *
71 * Bulk endpoints can use any size buffers, and can also be used for interrupt 71 * Bulk endpoints can use any size buffers, and can also be used for interrupt
72 * transfers. interrupt-only endpoints can be much less functional. 72 * transfers. interrupt-only endpoints can be much less functional.
73 *
74 * NOTE: this is analagous to 'struct urb' on the host side, except that
75 * it's thinner and promotes more pre-allocation.
73 */ 76 */
74 // NOTE this is analagous to 'struct urb' on the host side,
75 // except that it's thinner and promotes more pre-allocation.
76 77
77struct usb_request { 78struct usb_request {
78 void *buf; 79 void *buf;
@@ -168,10 +169,10 @@ struct usb_ep {
168 * 169 *
169 * returns zero, or a negative error code. 170 * returns zero, or a negative error code.
170 */ 171 */
171static inline int 172static inline int usb_ep_enable(struct usb_ep *ep,
172usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) 173 const struct usb_endpoint_descriptor *desc)
173{ 174{
174 return ep->ops->enable (ep, desc); 175 return ep->ops->enable(ep, desc);
175} 176}
176 177
177/** 178/**
@@ -186,10 +187,9 @@ usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
186 * 187 *
187 * returns zero, or a negative error code. 188 * returns zero, or a negative error code.
188 */ 189 */
189static inline int 190static inline int usb_ep_disable(struct usb_ep *ep)
190usb_ep_disable (struct usb_ep *ep)
191{ 191{
192 return ep->ops->disable (ep); 192 return ep->ops->disable(ep);
193} 193}
194 194
195/** 195/**
@@ -206,10 +206,10 @@ usb_ep_disable (struct usb_ep *ep)
206 * 206 *
207 * Returns the request, or null if one could not be allocated. 207 * Returns the request, or null if one could not be allocated.
208 */ 208 */
209static inline struct usb_request * 209static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
210usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) 210 gfp_t gfp_flags)
211{ 211{
212 return ep->ops->alloc_request (ep, gfp_flags); 212 return ep->ops->alloc_request(ep, gfp_flags);
213} 213}
214 214
215/** 215/**
@@ -221,10 +221,10 @@ usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
221 * Caller guarantees the request is not queued, and that it will 221 * Caller guarantees the request is not queued, and that it will
222 * no longer be requeued (or otherwise used). 222 * no longer be requeued (or otherwise used).
223 */ 223 */
224static inline void 224static inline void usb_ep_free_request(struct usb_ep *ep,
225usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) 225 struct usb_request *req)
226{ 226{
227 ep->ops->free_request (ep, req); 227 ep->ops->free_request(ep, req);
228} 228}
229 229
230/** 230/**
@@ -281,10 +281,10 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
281 * report errors; errors will also be 281 * report errors; errors will also be
282 * reported when the usb peripheral is disconnected. 282 * reported when the usb peripheral is disconnected.
283 */ 283 */
284static inline int 284static inline int usb_ep_queue(struct usb_ep *ep,
285usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) 285 struct usb_request *req, gfp_t gfp_flags)
286{ 286{
287 return ep->ops->queue (ep, req, gfp_flags); 287 return ep->ops->queue(ep, req, gfp_flags);
288} 288}
289 289
290/** 290/**
@@ -301,9 +301,9 @@ usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags)
301 * restrictions prevent drivers from supporting configuration changes, 301 * restrictions prevent drivers from supporting configuration changes,
302 * even to configuration zero (a "chapter 9" requirement). 302 * even to configuration zero (a "chapter 9" requirement).
303 */ 303 */
304static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) 304static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
305{ 305{
306 return ep->ops->dequeue (ep, req); 306 return ep->ops->dequeue(ep, req);
307} 307}
308 308
309/** 309/**
@@ -327,10 +327,9 @@ static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req)
327 * transfer requests are still queued, or if the controller hardware 327 * transfer requests are still queued, or if the controller hardware
328 * (usually a FIFO) still holds bytes that the host hasn't collected. 328 * (usually a FIFO) still holds bytes that the host hasn't collected.
329 */ 329 */
330static inline int 330static inline int usb_ep_set_halt(struct usb_ep *ep)
331usb_ep_set_halt (struct usb_ep *ep)
332{ 331{
333 return ep->ops->set_halt (ep, 1); 332 return ep->ops->set_halt(ep, 1);
334} 333}
335 334
336/** 335/**
@@ -346,10 +345,9 @@ usb_ep_set_halt (struct usb_ep *ep)
346 * Note that some hardware can't support this request (like pxa2xx_udc), 345 * Note that some hardware can't support this request (like pxa2xx_udc),
347 * and accordingly can't correctly implement interface altsettings. 346 * and accordingly can't correctly implement interface altsettings.
348 */ 347 */
349static inline int 348static inline int usb_ep_clear_halt(struct usb_ep *ep)
350usb_ep_clear_halt (struct usb_ep *ep)
351{ 349{
352 return ep->ops->set_halt (ep, 0); 350 return ep->ops->set_halt(ep, 0);
353} 351}
354 352
355/** 353/**
@@ -367,11 +365,10 @@ usb_ep_clear_halt (struct usb_ep *ep)
367 * errno if the endpoint doesn't use a FIFO or doesn't support such 365 * errno if the endpoint doesn't use a FIFO or doesn't support such
368 * precise handling. 366 * precise handling.
369 */ 367 */
370static inline int 368static inline int usb_ep_fifo_status(struct usb_ep *ep)
371usb_ep_fifo_status (struct usb_ep *ep)
372{ 369{
373 if (ep->ops->fifo_status) 370 if (ep->ops->fifo_status)
374 return ep->ops->fifo_status (ep); 371 return ep->ops->fifo_status(ep);
375 else 372 else
376 return -EOPNOTSUPP; 373 return -EOPNOTSUPP;
377} 374}
@@ -385,11 +382,10 @@ usb_ep_fifo_status (struct usb_ep *ep)
385 * must never be used except when endpoint is not being used for any 382 * must never be used except when endpoint is not being used for any
386 * protocol translation. 383 * protocol translation.
387 */ 384 */
388static inline void 385static inline void usb_ep_fifo_flush(struct usb_ep *ep)
389usb_ep_fifo_flush (struct usb_ep *ep)
390{ 386{
391 if (ep->ops->fifo_flush) 387 if (ep->ops->fifo_flush)
392 ep->ops->fifo_flush (ep); 388 ep->ops->fifo_flush(ep);
393} 389}
394 390
395 391
@@ -469,10 +465,10 @@ struct usb_gadget {
469 struct device dev; 465 struct device dev;
470}; 466};
471 467
472static inline void set_gadget_data (struct usb_gadget *gadget, void *data) 468static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
473 { dev_set_drvdata (&gadget->dev, data); } 469 { dev_set_drvdata(&gadget->dev, data); }
474static inline void *get_gadget_data (struct usb_gadget *gadget) 470static inline void *get_gadget_data(struct usb_gadget *gadget)
475 { return dev_get_drvdata (&gadget->dev); } 471 { return dev_get_drvdata(&gadget->dev); }
476 472
477/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ 473/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
478#define gadget_for_each_ep(tmp,gadget) \ 474#define gadget_for_each_ep(tmp,gadget) \
@@ -511,7 +507,6 @@ static inline int gadget_is_otg(struct usb_gadget *g)
511#endif 507#endif
512} 508}
513 509
514
515/** 510/**
516 * usb_gadget_frame_number - returns the current frame number 511 * usb_gadget_frame_number - returns the current frame number
517 * @gadget: controller that reports the frame number 512 * @gadget: controller that reports the frame number
@@ -519,9 +514,9 @@ static inline int gadget_is_otg(struct usb_gadget *g)
519 * Returns the usb frame number, normally eleven bits from a SOF packet, 514 * Returns the usb frame number, normally eleven bits from a SOF packet,
520 * or negative errno if this device doesn't support this capability. 515 * or negative errno if this device doesn't support this capability.
521 */ 516 */
522static inline int usb_gadget_frame_number (struct usb_gadget *gadget) 517static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
523{ 518{
524 return gadget->ops->get_frame (gadget); 519 return gadget->ops->get_frame(gadget);
525} 520}
526 521
527/** 522/**
@@ -537,11 +532,11 @@ static inline int usb_gadget_frame_number (struct usb_gadget *gadget)
537 * even if OTG isn't otherwise in use. OTG devices may also start 532 * even if OTG isn't otherwise in use. OTG devices may also start
538 * remote wakeup even when hosts don't explicitly enable it. 533 * remote wakeup even when hosts don't explicitly enable it.
539 */ 534 */
540static inline int usb_gadget_wakeup (struct usb_gadget *gadget) 535static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
541{ 536{
542 if (!gadget->ops->wakeup) 537 if (!gadget->ops->wakeup)
543 return -EOPNOTSUPP; 538 return -EOPNOTSUPP;
544 return gadget->ops->wakeup (gadget); 539 return gadget->ops->wakeup(gadget);
545} 540}
546 541
547/** 542/**
@@ -553,12 +548,11 @@ static inline int usb_gadget_wakeup (struct usb_gadget *gadget)
553 * 548 *
554 * returns zero on success, else negative errno. 549 * returns zero on success, else negative errno.
555 */ 550 */
556static inline int 551static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
557usb_gadget_set_selfpowered (struct usb_gadget *gadget)
558{ 552{
559 if (!gadget->ops->set_selfpowered) 553 if (!gadget->ops->set_selfpowered)
560 return -EOPNOTSUPP; 554 return -EOPNOTSUPP;
561 return gadget->ops->set_selfpowered (gadget, 1); 555 return gadget->ops->set_selfpowered(gadget, 1);
562} 556}
563 557
564/** 558/**
@@ -571,12 +565,11 @@ usb_gadget_set_selfpowered (struct usb_gadget *gadget)
571 * 565 *
572 * returns zero on success, else negative errno. 566 * returns zero on success, else negative errno.
573 */ 567 */
574static inline int 568static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
575usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
576{ 569{
577 if (!gadget->ops->set_selfpowered) 570 if (!gadget->ops->set_selfpowered)
578 return -EOPNOTSUPP; 571 return -EOPNOTSUPP;
579 return gadget->ops->set_selfpowered (gadget, 0); 572 return gadget->ops->set_selfpowered(gadget, 0);
580} 573}
581 574
582/** 575/**
@@ -591,12 +584,11 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
591 * 584 *
592 * Returns zero on success, else negative errno. 585 * Returns zero on success, else negative errno.
593 */ 586 */
594static inline int 587static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
595usb_gadget_vbus_connect(struct usb_gadget *gadget)
596{ 588{
597 if (!gadget->ops->vbus_session) 589 if (!gadget->ops->vbus_session)
598 return -EOPNOTSUPP; 590 return -EOPNOTSUPP;
599 return gadget->ops->vbus_session (gadget, 1); 591 return gadget->ops->vbus_session(gadget, 1);
600} 592}
601 593
602/** 594/**
@@ -611,12 +603,11 @@ usb_gadget_vbus_connect(struct usb_gadget *gadget)
611 * 603 *
612 * Returns zero on success, else negative errno. 604 * Returns zero on success, else negative errno.
613 */ 605 */
614static inline int 606static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
615usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
616{ 607{
617 if (!gadget->ops->vbus_draw) 608 if (!gadget->ops->vbus_draw)
618 return -EOPNOTSUPP; 609 return -EOPNOTSUPP;
619 return gadget->ops->vbus_draw (gadget, mA); 610 return gadget->ops->vbus_draw(gadget, mA);
620} 611}
621 612
622/** 613/**
@@ -629,12 +620,11 @@ usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
629 * 620 *
630 * Returns zero on success, else negative errno. 621 * Returns zero on success, else negative errno.
631 */ 622 */
632static inline int 623static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
633usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
634{ 624{
635 if (!gadget->ops->vbus_session) 625 if (!gadget->ops->vbus_session)
636 return -EOPNOTSUPP; 626 return -EOPNOTSUPP;
637 return gadget->ops->vbus_session (gadget, 0); 627 return gadget->ops->vbus_session(gadget, 0);
638} 628}
639 629
640/** 630/**
@@ -648,12 +638,11 @@ usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
648 * 638 *
649 * Returns zero on success, else negative errno. 639 * Returns zero on success, else negative errno.
650 */ 640 */
651static inline int 641static inline int usb_gadget_connect(struct usb_gadget *gadget)
652usb_gadget_connect (struct usb_gadget *gadget)
653{ 642{
654 if (!gadget->ops->pullup) 643 if (!gadget->ops->pullup)
655 return -EOPNOTSUPP; 644 return -EOPNOTSUPP;
656 return gadget->ops->pullup (gadget, 1); 645 return gadget->ops->pullup(gadget, 1);
657} 646}
658 647
659/** 648/**
@@ -671,16 +660,14 @@ usb_gadget_connect (struct usb_gadget *gadget)
671 * 660 *
672 * Returns zero on success, else negative errno. 661 * Returns zero on success, else negative errno.
673 */ 662 */
674static inline int 663static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
675usb_gadget_disconnect (struct usb_gadget *gadget)
676{ 664{
677 if (!gadget->ops->pullup) 665 if (!gadget->ops->pullup)
678 return -EOPNOTSUPP; 666 return -EOPNOTSUPP;
679 return gadget->ops->pullup (gadget, 0); 667 return gadget->ops->pullup(gadget, 0);
680} 668}
681 669
682 670
683
684/*-------------------------------------------------------------------------*/ 671/*-------------------------------------------------------------------------*/
685 672
686/** 673/**
@@ -764,7 +751,7 @@ struct usb_gadget_driver {
764 void (*suspend)(struct usb_gadget *); 751 void (*suspend)(struct usb_gadget *);
765 void (*resume)(struct usb_gadget *); 752 void (*resume)(struct usb_gadget *);
766 753
767 // FIXME support safe rmmod 754 /* FIXME support safe rmmod */
768 struct device_driver driver; 755 struct device_driver driver;
769}; 756};
770 757
@@ -790,7 +777,7 @@ struct usb_gadget_driver {
790 * the bind() functions will be in init sections. 777 * the bind() functions will be in init sections.
791 * This function must be called in a context that can sleep. 778 * This function must be called in a context that can sleep.
792 */ 779 */
793int usb_gadget_register_driver (struct usb_gadget_driver *driver); 780int usb_gadget_register_driver(struct usb_gadget_driver *driver);
794 781
795/** 782/**
796 * usb_gadget_unregister_driver - unregister a gadget driver 783 * usb_gadget_unregister_driver - unregister a gadget driver
@@ -805,7 +792,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver);
805 * will in in exit sections, so may not be linked in some kernels. 792 * will in in exit sections, so may not be linked in some kernels.
806 * This function must be called in a context that can sleep. 793 * This function must be called in a context that can sleep.
807 */ 794 */
808int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); 795int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
809 796
810/*-------------------------------------------------------------------------*/ 797/*-------------------------------------------------------------------------*/
811 798
@@ -838,7 +825,7 @@ struct usb_gadget_strings {
838}; 825};
839 826
840/* put descriptor for string with that id into buf (buflen >= 256) */ 827/* put descriptor for string with that id into buf (buflen >= 256) */
841int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf); 828int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
842 829
843/*-------------------------------------------------------------------------*/ 830/*-------------------------------------------------------------------------*/
844 831
@@ -856,10 +843,10 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
856 843
857/* utility wrapping a simple endpoint selection policy */ 844/* utility wrapping a simple endpoint selection policy */
858 845
859extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, 846extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
860 struct usb_endpoint_descriptor *) __devinit; 847 struct usb_endpoint_descriptor *) __devinit;
861 848
862extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit; 849extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit;
863 850
864#endif /* __KERNEL__ */ 851#endif /* __KERNEL__ */
865 852
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index e8654c338729..c291ab1af747 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -36,7 +36,7 @@ enum usb_gadgetfs_event_type {
36 GADGETFS_DISCONNECT, 36 GADGETFS_DISCONNECT,
37 GADGETFS_SETUP, 37 GADGETFS_SETUP,
38 GADGETFS_SUSPEND, 38 GADGETFS_SUSPEND,
39 // and likely more ! 39 /* and likely more ! */
40}; 40};
41 41
42/* NOTE: this structure must stay the same size and layout on 42/* NOTE: this structure must stay the same size and layout on
@@ -44,21 +44,28 @@ enum usb_gadgetfs_event_type {
44 */ 44 */
45struct usb_gadgetfs_event { 45struct usb_gadgetfs_event {
46 union { 46 union {
47 // NOP, DISCONNECT, SUSPEND: nothing 47 /* NOP, DISCONNECT, SUSPEND: nothing
48 // ... some hardware can't report disconnection 48 * ... some hardware can't report disconnection
49 */
49 50
50 // CONNECT: just the speed 51 /* CONNECT: just the speed */
51 enum usb_device_speed speed; 52 enum usb_device_speed speed;
52 53
53 // SETUP: packet; DATA phase i/o precedes next event 54 /* SETUP: packet; DATA phase i/o precedes next event
54 // (setup.bmRequestType & USB_DIR_IN) flags direction 55 *(setup.bmRequestType & USB_DIR_IN) flags direction
55 // ... includes SET_CONFIGURATION, SET_INTERFACE 56 * ... includes SET_CONFIGURATION, SET_INTERFACE
57 */
56 struct usb_ctrlrequest setup; 58 struct usb_ctrlrequest setup;
57 } u; 59 } u;
58 enum usb_gadgetfs_event_type type; 60 enum usb_gadgetfs_event_type type;
59}; 61};
60 62
61 63
64/* The 'g' code is also used by printer gadget ioctl requests.
65 * Don't add any colliding codes to either driver, and keep
66 * them in unique ranges (size 0x20 for now).
67 */
68
62/* endpoint ioctls */ 69/* endpoint ioctls */
63 70
64/* IN transfers may be reported to the gadget driver as complete 71/* IN transfers may be reported to the gadget driver as complete
@@ -68,14 +75,14 @@ struct usb_gadgetfs_event {
68 * THIS returns how many bytes are "unclaimed" in the endpoint fifo 75 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
69 * (needed for precise fault handling, when the hardware allows it) 76 * (needed for precise fault handling, when the hardware allows it)
70 */ 77 */
71#define GADGETFS_FIFO_STATUS _IO('g',1) 78#define GADGETFS_FIFO_STATUS _IO('g', 1)
72 79
73/* discards any unclaimed data in the fifo. */ 80/* discards any unclaimed data in the fifo. */
74#define GADGETFS_FIFO_FLUSH _IO('g',2) 81#define GADGETFS_FIFO_FLUSH _IO('g', 2)
75 82
76/* resets endpoint halt+toggle; used to implement set_interface. 83/* resets endpoint halt+toggle; used to implement set_interface.
77 * some hardware (like pxa2xx) can't support this. 84 * some hardware (like pxa2xx) can't support this.
78 */ 85 */
79#define GADGETFS_CLEAR_HALT _IO('g',3) 86#define GADGETFS_CLEAR_HALT _IO('g', 3)
80 87
81#endif /* __LINUX_USB_GADGETFS_H */ 88#endif /* __LINUX_USB_GADGETFS_H */
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
index cbbe020a4f5c..de6f380e17a2 100644
--- a/include/linux/usb/iowarrior.h
+++ b/include/linux/usb/iowarrior.h
@@ -14,14 +14,23 @@
14 this information. 14 this information.
15*/ 15*/
16struct iowarrior_info { 16struct iowarrior_info {
17 __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ 17 /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
18 __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */ 18 __u32 vendor;
19 __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */ 19 /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */
20 __u32 revision; /* revision number of the chip */ 20 __u32 product;
21 __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ 21 /* the serial number of our chip (if a serial-number is not available
22 __u32 power; /* power consumption of the device in mA */ 22 * this is empty string) */
23 __u32 if_num; /* the number of the endpoint */ 23 __u8 serial[9];
24 __u32 report_size; /* size of the data-packets on this interface */ 24 /* revision number of the chip */
25 __u32 revision;
26 /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
27 __u32 speed;
28 /* power consumption of the device in mA */
29 __u32 power;
30 /* the number of the endpoint */
31 __u32 if_num;
32 /* size of the data-packets on this interface */
33 __u32 report_size;
25}; 34};
26 35
27/* 36/*
diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h
index 436dd8a2b64a..67d2826f34fe 100644
--- a/include/linux/usb/isp116x.h
+++ b/include/linux/usb/isp116x.h
@@ -25,5 +25,5 @@ struct isp116x_platform_data {
25 300ns delay between access to ADDR_REG and DATA_REG 25 300ns delay between access to ADDR_REG and DATA_REG
26 OE, WE MUST NOT be changed during these intervals 26 OE, WE MUST NOT be changed during these intervals
27 */ 27 */
28 void (*delay) (struct device * dev, int delay); 28 void (*delay) (struct device *dev, int delay);
29}; 29};
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
index 11a97d5ffd34..80624c562921 100644
--- a/include/linux/usb/midi.h
+++ b/include/linux/usb/midi.h
@@ -47,9 +47,9 @@ struct usb_ms_header_descriptor {
47/* 6.1.2.2 MIDI IN Jack Descriptor */ 47/* 6.1.2.2 MIDI IN Jack Descriptor */
48struct usb_midi_in_jack_descriptor { 48struct usb_midi_in_jack_descriptor {
49 __u8 bLength; 49 __u8 bLength;
50 __u8 bDescriptorType; // USB_DT_CS_INTERFACE 50 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
51 __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK 51 __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */
52 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL 52 __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
53 __u8 bJackID; 53 __u8 bJackID;
54 __u8 iJack; 54 __u8 iJack;
55} __attribute__ ((packed)); 55} __attribute__ ((packed));
@@ -64,12 +64,12 @@ struct usb_midi_source_pin {
64/* 6.1.2.3 MIDI OUT Jack Descriptor */ 64/* 6.1.2.3 MIDI OUT Jack Descriptor */
65struct usb_midi_out_jack_descriptor { 65struct usb_midi_out_jack_descriptor {
66 __u8 bLength; 66 __u8 bLength;
67 __u8 bDescriptorType; // USB_DT_CS_INTERFACE 67 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
68 __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK 68 __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */
69 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL 69 __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
70 __u8 bJackID; 70 __u8 bJackID;
71 __u8 bNrInputPins; // p 71 __u8 bNrInputPins; /* p */
72 struct usb_midi_source_pin pins[]; // [p] 72 struct usb_midi_source_pin pins[]; /* [p] */
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */ 73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */
74} __attribute__ ((packed)); 74} __attribute__ ((packed));
75 75
@@ -90,11 +90,11 @@ struct usb_midi_out_jack_descriptor_##p { \
90 90
91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ 91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
92struct usb_ms_endpoint_descriptor { 92struct usb_ms_endpoint_descriptor {
93 __u8 bLength; // 4+n 93 __u8 bLength; /* 4+n */
94 __u8 bDescriptorType; // USB_DT_CS_ENDPOINT 94 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
95 __u8 bDescriptorSubtype; // USB_MS_GENERAL 95 __u8 bDescriptorSubtype; /* USB_MS_GENERAL */
96 __u8 bNumEmbMIDIJack; // n 96 __u8 bNumEmbMIDIJack; /* n */
97 __u8 baAssocJackID[]; // [n] 97 __u8 baAssocJackID[]; /* [n] */
98} __attribute__ ((packed)); 98} __attribute__ ((packed));
99 99
100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) 100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index c602f884f182..ec897cb844ab 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -37,7 +37,7 @@
37 37
38/* main registers, BAR0 + 0x0000 */ 38/* main registers, BAR0 + 0x0000 */
39struct net2280_regs { 39struct net2280_regs {
40 // offset 0x0000 40 /* offset 0x0000 */
41 u32 devinit; 41 u32 devinit;
42#define LOCAL_CLOCK_FREQUENCY 8 42#define LOCAL_CLOCK_FREQUENCY 8
43#define FORCE_PCI_RESET 7 43#define FORCE_PCI_RESET 7
@@ -61,7 +61,7 @@ struct net2280_regs {
61#define EEPROM_WRITE_DATA 0 61#define EEPROM_WRITE_DATA 0
62 u32 eeclkfreq; 62 u32 eeclkfreq;
63 u32 _unused0; 63 u32 _unused0;
64 // offset 0x0010 64 /* offset 0x0010 */
65 65
66 u32 pciirqenb0; /* interrupt PCI master ... */ 66 u32 pciirqenb0; /* interrupt PCI master ... */
67#define SETUP_PACKET_INTERRUPT_ENABLE 7 67#define SETUP_PACKET_INTERRUPT_ENABLE 7
@@ -131,7 +131,7 @@ struct net2280_regs {
131#define RESUME_INTERRUPT_ENABLE 1 131#define RESUME_INTERRUPT_ENABLE 1
132#define SOF_INTERRUPT_ENABLE 0 132#define SOF_INTERRUPT_ENABLE 0
133 133
134 // offset 0x0020 134 /* offset 0x0020 */
135 u32 _unused1; 135 u32 _unused1;
136 u32 usbirqenb1; 136 u32 usbirqenb1;
137#define USB_INTERRUPT_ENABLE 31 137#define USB_INTERRUPT_ENABLE 31
@@ -195,7 +195,7 @@ struct net2280_regs {
195#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 195#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
196#define RESUME_INTERRUPT 1 196#define RESUME_INTERRUPT 1
197#define SOF_INTERRUPT 0 197#define SOF_INTERRUPT 0
198 // offset 0x0030 198 /* offset 0x0030 */
199 u32 idxaddr; 199 u32 idxaddr;
200 u32 idxdata; 200 u32 idxdata;
201 u32 fifoctl; 201 u32 fifoctl;
@@ -204,7 +204,7 @@ struct net2280_regs {
204#define PCI_BASE2_SELECT 2 204#define PCI_BASE2_SELECT 2
205#define FIFO_CONFIGURATION_SELECT 0 205#define FIFO_CONFIGURATION_SELECT 0
206 u32 _unused2; 206 u32 _unused2;
207 // offset 0x0040 207 /* offset 0x0040 */
208 u32 memaddr; 208 u32 memaddr;
209#define START 28 209#define START 28
210#define DIRECTION 27 210#define DIRECTION 27
@@ -213,7 +213,7 @@ struct net2280_regs {
213 u32 memdata0; 213 u32 memdata0;
214 u32 memdata1; 214 u32 memdata1;
215 u32 _unused3; 215 u32 _unused3;
216 // offset 0x0050 216 /* offset 0x0050 */
217 u32 gpioctl; 217 u32 gpioctl;
218#define GPIO3_LED_SELECT 12 218#define GPIO3_LED_SELECT 12
219#define GPIO3_INTERRUPT_ENABLE 11 219#define GPIO3_INTERRUPT_ENABLE 11
@@ -237,7 +237,7 @@ struct net2280_regs {
237 237
238/* usb control, BAR0 + 0x0080 */ 238/* usb control, BAR0 + 0x0080 */
239struct net2280_usb_regs { 239struct net2280_usb_regs {
240 // offset 0x0080 240 /* offset 0x0080 */
241 u32 stdrsp; 241 u32 stdrsp;
242#define STALL_UNSUPPORTED_REQUESTS 31 242#define STALL_UNSUPPORTED_REQUESTS 31
243#define SET_TEST_MODE 16 243#define SET_TEST_MODE 16
@@ -275,7 +275,7 @@ struct net2280_usb_regs {
275#define PME_WAKEUP_ENABLE 2 275#define PME_WAKEUP_ENABLE 2
276#define DEVICE_REMOTE_WAKEUP_ENABLE 1 276#define DEVICE_REMOTE_WAKEUP_ENABLE 1
277#define SELF_POWERED_STATUS 0 277#define SELF_POWERED_STATUS 0
278 // offset 0x0090 278 /* offset 0x0090 */
279 u32 usbstat; 279 u32 usbstat;
280#define HIGH_SPEED 7 280#define HIGH_SPEED 7
281#define FULL_SPEED 6 281#define FULL_SPEED 6
@@ -291,7 +291,7 @@ struct net2280_usb_regs {
291#define TERMINATION_SELECT 0 291#define TERMINATION_SELECT 0
292 u32 setup0123; 292 u32 setup0123;
293 u32 setup4567; 293 u32 setup4567;
294 // offset 0x0090 294 /* offset 0x0090 */
295 u32 _unused0; 295 u32 _unused0;
296 u32 ouraddr; 296 u32 ouraddr;
297#define FORCE_IMMEDIATE 7 297#define FORCE_IMMEDIATE 7
@@ -301,7 +301,7 @@ struct net2280_usb_regs {
301 301
302/* pci control, BAR0 + 0x0100 */ 302/* pci control, BAR0 + 0x0100 */
303struct net2280_pci_regs { 303struct net2280_pci_regs {
304 // offset 0x0100 304 /* offset 0x0100 */
305 u32 pcimstctl; 305 u32 pcimstctl;
306#define PCI_ARBITER_PARK_SELECT 13 306#define PCI_ARBITER_PARK_SELECT 13
307#define PCI_MULTI LEVEL_ARBITER 12 307#define PCI_MULTI LEVEL_ARBITER 12
@@ -331,7 +331,7 @@ struct net2280_pci_regs {
331 * that can be loaded into some of these registers. 331 * that can be loaded into some of these registers.
332 */ 332 */
333struct net2280_dma_regs { /* [11.7] */ 333struct net2280_dma_regs { /* [11.7] */
334 // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, 334 /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
335 u32 dmactl; 335 u32 dmactl;
336#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 336#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
337#define DMA_CLEAR_COUNT_ENABLE 21 337#define DMA_CLEAR_COUNT_ENABLE 21
@@ -355,7 +355,7 @@ struct net2280_dma_regs { /* [11.7] */
355#define DMA_ABORT 1 355#define DMA_ABORT 1
356#define DMA_START 0 356#define DMA_START 0
357 u32 _unused0 [2]; 357 u32 _unused0 [2];
358 // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, 358 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
359 u32 dmacount; 359 u32 dmacount;
360#define VALID_BIT 31 360#define VALID_BIT 31
361#define DMA_DIRECTION 30 361#define DMA_DIRECTION 30
@@ -371,9 +371,9 @@ struct net2280_dma_regs { /* [11.7] */
371/* dedicated endpoint registers, BAR0 + 0x0200 */ 371/* dedicated endpoint registers, BAR0 + 0x0200 */
372 372
373struct net2280_dep_regs { /* [11.8] */ 373struct net2280_dep_regs { /* [11.8] */
374 // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 374 /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
375 u32 dep_cfg; 375 u32 dep_cfg;
376 // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 376 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
377 u32 dep_rsp; 377 u32 dep_rsp;
378 u32 _unused [2]; 378 u32 _unused [2];
379} __attribute__ ((packed)); 379} __attribute__ ((packed));
@@ -383,7 +383,7 @@ struct net2280_dep_regs { /* [11.8] */
383 * ep0 reserved for control; E and F have only 64 bytes of fifo 383 * ep0 reserved for control; E and F have only 64 bytes of fifo
384 */ 384 */
385struct net2280_ep_regs { /* [11.9] */ 385struct net2280_ep_regs { /* [11.9] */
386 // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 386 /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
387 u32 ep_cfg; 387 u32 ep_cfg;
388#define ENDPOINT_BYTE_COUNT 16 388#define ENDPOINT_BYTE_COUNT 16
389#define ENDPOINT_ENABLE 10 389#define ENDPOINT_ENABLE 10
@@ -435,7 +435,7 @@ struct net2280_ep_regs { /* [11.9] */
435#define DATA_PACKET_TRANSMITTED_INTERRUPT 2 435#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
436#define DATA_OUT_PING_TOKEN_INTERRUPT 1 436#define DATA_OUT_PING_TOKEN_INTERRUPT 1
437#define DATA_IN_TOKEN_INTERRUPT 0 437#define DATA_IN_TOKEN_INTERRUPT 0
438 // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 438 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
439 u32 ep_avail; 439 u32 ep_avail;
440 u32 ep_data; 440 u32 ep_data;
441 u32 _unused0 [2]; 441 u32 _unused0 [2];
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 9897f7a818c5..e007074ebe41 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -1,4 +1,4 @@
1// include/linux/usb/otg.h 1/* USB OTG (On The Go) defines */
2 2
3/* 3/*
4 * These APIs may be used between USB controllers. USB device drivers 4 * These APIs may be used between USB controllers. USB device drivers
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
new file mode 100644
index 000000000000..edc1d4a0e272
--- /dev/null
+++ b/include/linux/usb/rndis_host.h
@@ -0,0 +1,274 @@
1/*
2 * Host Side support for RNDIS Networking Links
3 * Copyright (C) 2005 by David Brownell
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20
21#ifndef __RNDIS_HOST_H
22#define __RNDIS_HOST_H
23
24
25/*
26 * CONTROL uses CDC "encapsulated commands" with funky notifications.
27 * - control-out: SEND_ENCAPSULATED
28 * - interrupt-in: RESPONSE_AVAILABLE
29 * - control-in: GET_ENCAPSULATED
30 *
31 * We'll try to ignore the RESPONSE_AVAILABLE notifications.
32 *
33 * REVISIT some RNDIS implementations seem to have curious issues still
34 * to be resolved.
35 */
36struct rndis_msg_hdr {
37 __le32 msg_type; /* RNDIS_MSG_* */
38 __le32 msg_len;
39 // followed by data that varies between messages
40 __le32 request_id;
41 __le32 status;
42 // ... and more
43} __attribute__ ((packed));
44
45/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
46#define CONTROL_BUFFER_SIZE 1025
47
48/* RNDIS defines an (absurdly huge) 10 second control timeout,
49 * but ActiveSync seems to use a more usual 5 second timeout
50 * (which matches the USB 2.0 spec).
51 */
52#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
53
54
55#define ccpu2 __constant_cpu_to_le32
56
57#define RNDIS_MSG_COMPLETION ccpu2(0x80000000)
58
59/* codes for "msg_type" field of rndis messages;
60 * only the data channel uses packet messages (maybe batched);
61 * everything else goes on the control channel.
62 */
63#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */
64#define RNDIS_MSG_INIT ccpu2(0x00000002)
65#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
66#define RNDIS_MSG_HALT ccpu2(0x00000003)
67#define RNDIS_MSG_QUERY ccpu2(0x00000004)
68#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
69#define RNDIS_MSG_SET ccpu2(0x00000005)
70#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
71#define RNDIS_MSG_RESET ccpu2(0x00000006)
72#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
73#define RNDIS_MSG_INDICATE ccpu2(0x00000007)
74#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008)
75#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
76
77/* codes for "status" field of completion messages */
78#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000)
79#define RNDIS_STATUS_FAILURE ccpu2(0xc0000001)
80#define RNDIS_STATUS_INVALID_DATA ccpu2(0xc0010015)
81#define RNDIS_STATUS_NOT_SUPPORTED ccpu2(0xc00000bb)
82#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b)
83#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c)
84
85/* codes for OID_GEN_PHYSICAL_MEDIUM */
86#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x00000000)
87#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x00000001)
88#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x00000002)
89#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE ccpu2(0x00000003)
90#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE ccpu2(0x00000004)
91#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x00000005)
92#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x00000006)
93#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x00000007)
94#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x00000008)
95#define RNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x00000009)
96
97struct rndis_data_hdr {
98 __le32 msg_type; /* RNDIS_MSG_PACKET */
99 __le32 msg_len; // rndis_data_hdr + data_len + pad
100 __le32 data_offset; // 36 -- right after header
101 __le32 data_len; // ... real packet size
102
103 __le32 oob_data_offset; // zero
104 __le32 oob_data_len; // zero
105 __le32 num_oob; // zero
106 __le32 packet_data_offset; // zero
107
108 __le32 packet_data_len; // zero
109 __le32 vc_handle; // zero
110 __le32 reserved; // zero
111} __attribute__ ((packed));
112
113struct rndis_init { /* OUT */
114 // header and:
115 __le32 msg_type; /* RNDIS_MSG_INIT */
116 __le32 msg_len; // 24
117 __le32 request_id;
118 __le32 major_version; // of rndis (1.0)
119 __le32 minor_version;
120 __le32 max_transfer_size;
121} __attribute__ ((packed));
122
123struct rndis_init_c { /* IN */
124 // header and:
125 __le32 msg_type; /* RNDIS_MSG_INIT_C */
126 __le32 msg_len;
127 __le32 request_id;
128 __le32 status;
129 __le32 major_version; // of rndis (1.0)
130 __le32 minor_version;
131 __le32 device_flags;
132 __le32 medium; // zero == 802.3
133 __le32 max_packets_per_message;
134 __le32 max_transfer_size;
135 __le32 packet_alignment; // max 7; (1<<n) bytes
136 __le32 af_list_offset; // zero
137 __le32 af_list_size; // zero
138} __attribute__ ((packed));
139
140struct rndis_halt { /* OUT (no reply) */
141 // header and:
142 __le32 msg_type; /* RNDIS_MSG_HALT */
143 __le32 msg_len;
144 __le32 request_id;
145} __attribute__ ((packed));
146
147struct rndis_query { /* OUT */
148 // header and:
149 __le32 msg_type; /* RNDIS_MSG_QUERY */
150 __le32 msg_len;
151 __le32 request_id;
152 __le32 oid;
153 __le32 len;
154 __le32 offset;
155/*?*/ __le32 handle; // zero
156} __attribute__ ((packed));
157
158struct rndis_query_c { /* IN */
159 // header and:
160 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
161 __le32 msg_len;
162 __le32 request_id;
163 __le32 status;
164 __le32 len;
165 __le32 offset;
166} __attribute__ ((packed));
167
168struct rndis_set { /* OUT */
169 // header and:
170 __le32 msg_type; /* RNDIS_MSG_SET */
171 __le32 msg_len;
172 __le32 request_id;
173 __le32 oid;
174 __le32 len;
175 __le32 offset;
176/*?*/ __le32 handle; // zero
177} __attribute__ ((packed));
178
179struct rndis_set_c { /* IN */
180 // header and:
181 __le32 msg_type; /* RNDIS_MSG_SET_C */
182 __le32 msg_len;
183 __le32 request_id;
184 __le32 status;
185} __attribute__ ((packed));
186
187struct rndis_reset { /* IN */
188 // header and:
189 __le32 msg_type; /* RNDIS_MSG_RESET */
190 __le32 msg_len;
191 __le32 reserved;
192} __attribute__ ((packed));
193
194struct rndis_reset_c { /* OUT */
195 // header and:
196 __le32 msg_type; /* RNDIS_MSG_RESET_C */
197 __le32 msg_len;
198 __le32 status;
199 __le32 addressing_lost;
200} __attribute__ ((packed));
201
202struct rndis_indicate { /* IN (unrequested) */
203 // header and:
204 __le32 msg_type; /* RNDIS_MSG_INDICATE */
205 __le32 msg_len;
206 __le32 status;
207 __le32 length;
208 __le32 offset;
209/**/ __le32 diag_status;
210 __le32 error_offset;
211/**/ __le32 message;
212} __attribute__ ((packed));
213
214struct rndis_keepalive { /* OUT (optionally IN) */
215 // header and:
216 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
217 __le32 msg_len;
218 __le32 request_id;
219} __attribute__ ((packed));
220
221struct rndis_keepalive_c { /* IN (optionally OUT) */
222 // header and:
223 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
224 __le32 msg_len;
225 __le32 request_id;
226 __le32 status;
227} __attribute__ ((packed));
228
229/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
230 * there are gobs more that may optionally be supported. We'll avoid as much
231 * of that mess as possible.
232 */
233#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)
234#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)
235#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e)
236#define OID_GEN_PHYSICAL_MEDIUM ccpu2(0x00010202)
237
238/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
239#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001)
240#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002)
241#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004)
242#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008)
243#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010)
244#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020)
245#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040)
246#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080)
247#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000)
248#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000)
249#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000)
250#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000)
251
252/* default filter used with RNDIS devices */
253#define RNDIS_DEFAULT_FILTER ( \
254 RNDIS_PACKET_TYPE_DIRECTED | \
255 RNDIS_PACKET_TYPE_BROADCAST | \
256 RNDIS_PACKET_TYPE_ALL_MULTICAST | \
257 RNDIS_PACKET_TYPE_PROMISCUOUS)
258
259/* Flags to require specific physical medium type for generic_rndis_bind() */
260#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001
261#define FLAG_RNDIS_PHYM_WIRELESS 0x0002
262
263
264extern void rndis_status(struct usbnet *dev, struct urb *urb);
265extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf);
266extern int
267generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags);
268extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf);
269extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
270extern struct sk_buff *
271rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
272
273#endif /* __RNDIS_HOST_H */
274
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 488ce128885c..21b4a1c6f585 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,8 @@
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */ 21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
22 22
23#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ 23/* The maximum number of ports one device can grab at once */
24#define MAX_NUM_PORTS 8
24 25
25/* parity check flag */ 26/* parity check flag */
26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 27#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@@ -61,29 +62,29 @@
61 * ports of a device. 62 * ports of a device.
62 */ 63 */
63struct usb_serial_port { 64struct usb_serial_port {
64 struct usb_serial * serial; 65 struct usb_serial *serial;
65 struct tty_struct * tty; 66 struct tty_struct *tty;
66 spinlock_t lock; 67 spinlock_t lock;
67 struct mutex mutex; 68 struct mutex mutex;
68 unsigned char number; 69 unsigned char number;
69 70
70 unsigned char * interrupt_in_buffer; 71 unsigned char *interrupt_in_buffer;
71 struct urb * interrupt_in_urb; 72 struct urb *interrupt_in_urb;
72 __u8 interrupt_in_endpointAddress; 73 __u8 interrupt_in_endpointAddress;
73 74
74 unsigned char * interrupt_out_buffer; 75 unsigned char *interrupt_out_buffer;
75 int interrupt_out_size; 76 int interrupt_out_size;
76 struct urb * interrupt_out_urb; 77 struct urb *interrupt_out_urb;
77 __u8 interrupt_out_endpointAddress; 78 __u8 interrupt_out_endpointAddress;
78 79
79 unsigned char * bulk_in_buffer; 80 unsigned char *bulk_in_buffer;
80 int bulk_in_size; 81 int bulk_in_size;
81 struct urb * read_urb; 82 struct urb *read_urb;
82 __u8 bulk_in_endpointAddress; 83 __u8 bulk_in_endpointAddress;
83 84
84 unsigned char * bulk_out_buffer; 85 unsigned char *bulk_out_buffer;
85 int bulk_out_size; 86 int bulk_out_size;
86 struct urb * write_urb; 87 struct urb *write_urb;
87 int write_urb_busy; 88 int write_urb_busy;
88 __u8 bulk_out_endpointAddress; 89 __u8 bulk_out_endpointAddress;
89 90
@@ -92,17 +93,19 @@ struct usb_serial_port {
92 int open_count; 93 int open_count;
93 char throttled; 94 char throttled;
94 char throttle_req; 95 char throttle_req;
96 char console;
95 struct device dev; 97 struct device dev;
96}; 98};
97#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 99#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
98 100
99/* get and set the port private data pointer helper functions */ 101/* get and set the port private data pointer helper functions */
100static inline void *usb_get_serial_port_data (struct usb_serial_port *port) 102static inline void *usb_get_serial_port_data(struct usb_serial_port *port)
101{ 103{
102 return dev_get_drvdata(&port->dev); 104 return dev_get_drvdata(&port->dev);
103} 105}
104 106
105static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) 107static inline void usb_set_serial_port_data(struct usb_serial_port *port,
108 void *data)
106{ 109{
107 dev_set_drvdata(&port->dev, data); 110 dev_set_drvdata(&port->dev, data);
108} 111}
@@ -125,9 +128,10 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void
125 * usb_set_serial_data() to access this. 128 * usb_set_serial_data() to access this.
126 */ 129 */
127struct usb_serial { 130struct usb_serial {
128 struct usb_device * dev; 131 struct usb_device *dev;
129 struct usb_serial_driver * type; 132 struct usb_serial_driver *type;
130 struct usb_interface * interface; 133 struct usb_interface *interface;
134 unsigned char disconnected;
131 unsigned char minor; 135 unsigned char minor;
132 unsigned char num_ports; 136 unsigned char num_ports;
133 unsigned char num_port_pointers; 137 unsigned char num_port_pointers;
@@ -135,29 +139,30 @@ struct usb_serial {
135 char num_interrupt_out; 139 char num_interrupt_out;
136 char num_bulk_in; 140 char num_bulk_in;
137 char num_bulk_out; 141 char num_bulk_out;
138 struct usb_serial_port * port[MAX_NUM_PORTS]; 142 struct usb_serial_port *port[MAX_NUM_PORTS];
139 struct kref kref; 143 struct kref kref;
140 void * private; 144 struct mutex disc_mutex;
145 void *private;
141}; 146};
142#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 147#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
143 148
144#define NUM_DONT_CARE 99 149#define NUM_DONT_CARE 99
145 150
146/* get and set the serial private data pointer helper functions */ 151/* get and set the serial private data pointer helper functions */
147static inline void *usb_get_serial_data (struct usb_serial *serial) 152static inline void *usb_get_serial_data(struct usb_serial *serial)
148{ 153{
149 return serial->private; 154 return serial->private;
150} 155}
151 156
152static inline void usb_set_serial_data (struct usb_serial *serial, void *data) 157static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
153{ 158{
154 serial->private = data; 159 serial->private = data;
155} 160}
156 161
157/** 162/**
158 * usb_serial_driver - describes a usb serial driver 163 * usb_serial_driver - describes a usb serial driver
159 * @description: pointer to a string that describes this driver. This string used 164 * @description: pointer to a string that describes this driver. This string
160 * in the syslog messages when a device is inserted or removed. 165 * used in the syslog messages when a device is inserted or removed.
161 * @id_table: pointer to a list of usb_device_id structures that define all 166 * @id_table: pointer to a list of usb_device_id structures that define all
162 * of the devices this structure can support. 167 * of the devices this structure can support.
163 * @num_interrupt_in: If a device doesn't have this many interrupt-in 168 * @num_interrupt_in: If a device doesn't have this many interrupt-in
@@ -218,82 +223,91 @@ struct usb_serial_driver {
218 struct usb_driver *usb_driver; 223 struct usb_driver *usb_driver;
219 struct usb_dynids dynids; 224 struct usb_dynids dynids;
220 225
221 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); 226 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
222 int (*attach) (struct usb_serial *serial); 227 int (*attach)(struct usb_serial *serial);
223 int (*calc_num_ports) (struct usb_serial *serial); 228 int (*calc_num_ports) (struct usb_serial *serial);
224 229
225 void (*shutdown) (struct usb_serial *serial); 230 void (*shutdown)(struct usb_serial *serial);
226 231
227 int (*port_probe) (struct usb_serial_port *port); 232 int (*port_probe)(struct usb_serial_port *port);
228 int (*port_remove) (struct usb_serial_port *port); 233 int (*port_remove)(struct usb_serial_port *port);
229 234
230 int (*suspend) (struct usb_serial *serial, pm_message_t message); 235 int (*suspend)(struct usb_serial *serial, pm_message_t message);
231 int (*resume) (struct usb_serial *serial); 236 int (*resume)(struct usb_serial *serial);
232 237
233 /* serial function calls */ 238 /* serial function calls */
234 int (*open) (struct usb_serial_port *port, struct file * filp); 239 int (*open)(struct usb_serial_port *port, struct file *filp);
235 void (*close) (struct usb_serial_port *port, struct file * filp); 240 void (*close)(struct usb_serial_port *port, struct file *filp);
236 int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); 241 int (*write)(struct usb_serial_port *port, const unsigned char *buf,
237 int (*write_room) (struct usb_serial_port *port); 242 int count);
238 int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 243 int (*write_room)(struct usb_serial_port *port);
239 void (*set_termios) (struct usb_serial_port *port, struct ktermios * old); 244 int (*ioctl)(struct usb_serial_port *port, struct file *file,
240 void (*break_ctl) (struct usb_serial_port *port, int break_state); 245 unsigned int cmd, unsigned long arg);
241 int (*chars_in_buffer) (struct usb_serial_port *port); 246 void (*set_termios)(struct usb_serial_port *port, struct ktermios *old);
242 void (*throttle) (struct usb_serial_port *port); 247 void (*break_ctl)(struct usb_serial_port *port, int break_state);
243 void (*unthrottle) (struct usb_serial_port *port); 248 int (*chars_in_buffer)(struct usb_serial_port *port);
244 int (*tiocmget) (struct usb_serial_port *port, struct file *file); 249 void (*throttle)(struct usb_serial_port *port);
245 int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); 250 void (*unthrottle)(struct usb_serial_port *port);
251 int (*tiocmget)(struct usb_serial_port *port, struct file *file);
252 int (*tiocmset)(struct usb_serial_port *port, struct file *file,
253 unsigned int set, unsigned int clear);
246 254
247 void (*read_int_callback)(struct urb *urb); 255 void (*read_int_callback)(struct urb *urb);
248 void (*write_int_callback)(struct urb *urb); 256 void (*write_int_callback)(struct urb *urb);
249 void (*read_bulk_callback)(struct urb *urb); 257 void (*read_bulk_callback)(struct urb *urb);
250 void (*write_bulk_callback)(struct urb *urb); 258 void (*write_bulk_callback)(struct urb *urb);
251}; 259};
252#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) 260#define to_usb_serial_driver(d) \
261 container_of(d, struct usb_serial_driver, driver)
253 262
254extern int usb_serial_register(struct usb_serial_driver *driver); 263extern int usb_serial_register(struct usb_serial_driver *driver);
255extern void usb_serial_deregister(struct usb_serial_driver *driver); 264extern void usb_serial_deregister(struct usb_serial_driver *driver);
256extern void usb_serial_port_softint(struct usb_serial_port *port); 265extern void usb_serial_port_softint(struct usb_serial_port *port);
257 266
258extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); 267extern int usb_serial_probe(struct usb_interface *iface,
268 const struct usb_device_id *id);
259extern void usb_serial_disconnect(struct usb_interface *iface); 269extern void usb_serial_disconnect(struct usb_interface *iface);
260 270
261extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 271extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
262extern int usb_serial_resume(struct usb_interface *intf); 272extern int usb_serial_resume(struct usb_interface *intf);
263 273
264extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); 274extern int ezusb_writememory(struct usb_serial *serial, int address,
265extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); 275 unsigned char *data, int length, __u8 bRequest);
276extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit);
266 277
267/* USB Serial console functions */ 278/* USB Serial console functions */
268#ifdef CONFIG_USB_SERIAL_CONSOLE 279#ifdef CONFIG_USB_SERIAL_CONSOLE
269extern void usb_serial_console_init (int debug, int minor); 280extern void usb_serial_console_init(int debug, int minor);
270extern void usb_serial_console_exit (void); 281extern void usb_serial_console_exit(void);
271extern void usb_serial_console_disconnect(struct usb_serial *serial); 282extern void usb_serial_console_disconnect(struct usb_serial *serial);
272#else 283#else
273static inline void usb_serial_console_init (int debug, int minor) { } 284static inline void usb_serial_console_init(int debug, int minor) { }
274static inline void usb_serial_console_exit (void) { } 285static inline void usb_serial_console_exit(void) { }
275static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} 286static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
276#endif 287#endif
277 288
278/* Functions needed by other parts of the usbserial core */ 289/* Functions needed by other parts of the usbserial core */
279extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); 290extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
280extern void usb_serial_put(struct usb_serial *serial); 291extern void usb_serial_put(struct usb_serial *serial);
281extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); 292extern int usb_serial_generic_open(struct usb_serial_port *port,
282extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); 293 struct file *filp);
283extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); 294extern int usb_serial_generic_write(struct usb_serial_port *port,
284extern int usb_serial_generic_resume (struct usb_serial *serial); 295 const unsigned char *buf, int count);
285extern int usb_serial_generic_write_room (struct usb_serial_port *port); 296extern void usb_serial_generic_close(struct usb_serial_port *port,
286extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); 297 struct file *filp);
287extern void usb_serial_generic_read_bulk_callback (struct urb *urb); 298extern int usb_serial_generic_resume(struct usb_serial *serial);
288extern void usb_serial_generic_write_bulk_callback (struct urb *urb); 299extern int usb_serial_generic_write_room(struct usb_serial_port *port);
289extern void usb_serial_generic_throttle (struct usb_serial_port *port); 300extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port);
290extern void usb_serial_generic_unthrottle (struct usb_serial_port *port); 301extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
291extern void usb_serial_generic_shutdown (struct usb_serial *serial); 302extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
292extern int usb_serial_generic_register (int debug); 303extern void usb_serial_generic_throttle(struct usb_serial_port *port);
293extern void usb_serial_generic_deregister (void); 304extern void usb_serial_generic_unthrottle(struct usb_serial_port *port);
294 305extern void usb_serial_generic_shutdown(struct usb_serial *serial);
295extern int usb_serial_bus_register (struct usb_serial_driver *device); 306extern int usb_serial_generic_register(int debug);
296extern void usb_serial_bus_deregister (struct usb_serial_driver *device); 307extern void usb_serial_generic_deregister(void);
308
309extern int usb_serial_bus_register(struct usb_serial_driver *device);
310extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
297 311
298extern struct usb_serial_driver usb_serial_generic_device; 312extern struct usb_serial_driver usb_serial_generic_device;
299extern struct bus_type usb_serial_bus_type; 313extern struct bus_type usb_serial_bus_type;
@@ -307,16 +321,22 @@ static inline void usb_serial_debug_data(int debug,
307 int i; 321 int i;
308 322
309 if (debug) { 323 if (debug) {
310 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); 324 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ",
325 function, size);
311 for (i = 0; i < size; ++i) 326 for (i = 0; i < size; ++i)
312 printk ("%.2x ", data[i]); 327 printk("%.2x ", data[i]);
313 printk ("\n"); 328 printk("\n");
314 } 329 }
315} 330}
316 331
317/* Use our own dbg macro */ 332/* Use our own dbg macro */
318#undef dbg 333#undef dbg
319#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) 334#define dbg(format, arg...) \
335 do { \
336 if (debug) \
337 printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \
338 ## arg); \
339 } while (0)
320 340
321 341
322 342
diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h
index 397ee3b3d7f3..877373da410d 100644
--- a/include/linux/usb/sl811.h
+++ b/include/linux/usb/sl811.h
@@ -19,8 +19,8 @@ struct sl811_platform_data {
19 /* pulse sl811 nRST (probably with a GPIO) */ 19 /* pulse sl811 nRST (probably with a GPIO) */
20 void (*reset)(struct device *dev); 20 void (*reset)(struct device *dev);
21 21
22 // some boards need something like these: 22 /* some boards need something like these: */
23 // int (*check_overcurrent)(struct device *dev); 23 /* int (*check_overcurrent)(struct device *dev); */
24 // void (*clock_enable)(struct device *dev, int is_on); 24 /* void (*clock_enable)(struct device *dev, int is_on); */
25}; 25};
26 26
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
new file mode 100644
index 000000000000..e0501da3dd11
--- /dev/null
+++ b/include/linux/usb/usbnet.h
@@ -0,0 +1,214 @@
1/*
2 * USB Networking Link Interface
3 *
4 * Copyright (C) 2000-2005 by David Brownell <dbrownell@users.sourceforge.net>
5 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
23#ifndef __USBNET_H
24#define __USBNET_H
25
26
27/* interface from usbnet core to each USB networking link we handle */
28struct usbnet {
29 /* housekeeping */
30 struct usb_device *udev;
31 struct usb_interface *intf;
32 struct driver_info *driver_info;
33 const char *driver_name;
34 void *driver_priv;
35 wait_queue_head_t *wait;
36 struct mutex phy_mutex;
37 unsigned char suspend_count;
38
39 /* i/o info: pipes etc */
40 unsigned in, out;
41 struct usb_host_endpoint *status;
42 unsigned maxpacket;
43 struct timer_list delay;
44
45 /* protocol/interface state */
46 struct net_device *net;
47 struct net_device_stats stats;
48 int msg_enable;
49 unsigned long data [5];
50 u32 xid;
51 u32 hard_mtu; /* count any extra framing */
52 size_t rx_urb_size; /* size for rx urbs */
53 struct mii_if_info mii;
54
55 /* various kinds of pending driver work */
56 struct sk_buff_head rxq;
57 struct sk_buff_head txq;
58 struct sk_buff_head done;
59 struct urb *interrupt;
60 struct tasklet_struct bh;
61
62 struct work_struct kevent;
63 unsigned long flags;
64# define EVENT_TX_HALT 0
65# define EVENT_RX_HALT 1
66# define EVENT_RX_MEMORY 2
67# define EVENT_STS_SPLIT 3
68# define EVENT_LINK_RESET 4
69};
70
71static inline struct usb_driver *driver_of(struct usb_interface *intf)
72{
73 return to_usb_driver(intf->dev.driver);
74}
75
76/* interface from the device/framing level "minidriver" to core */
77struct driver_info {
78 char *description;
79
80 int flags;
81/* framing is CDC Ethernet, not writing ZLPs (hw issues), or optionally: */
82#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */
83#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */
84#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */
85#define FLAG_FRAMING_RN 0x0008 /* RNDIS batches, plus huge header */
86
87#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
88#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
89
90#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
91#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
92
93
94 /* init device ... can sleep, or cause probe() failure */
95 int (*bind)(struct usbnet *, struct usb_interface *);
96
97 /* cleanup device ... can sleep, but can't fail */
98 void (*unbind)(struct usbnet *, struct usb_interface *);
99
100 /* reset device ... can sleep */
101 int (*reset)(struct usbnet *);
102
103 /* see if peer is connected ... can sleep */
104 int (*check_connect)(struct usbnet *);
105
106 /* for status polling */
107 void (*status)(struct usbnet *, struct urb *);
108
109 /* link reset handling, called from defer_kevent */
110 int (*link_reset)(struct usbnet *);
111
112 /* fixup rx packet (strip framing) */
113 int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb);
114
115 /* fixup tx packet (add framing) */
116 struct sk_buff *(*tx_fixup)(struct usbnet *dev,
117 struct sk_buff *skb, gfp_t flags);
118
119 /* early initialization code, can sleep. This is for minidrivers
120 * having 'subminidrivers' that need to do extra initialization
121 * right after minidriver have initialized hardware. */
122 int (*early_init)(struct usbnet *dev);
123
124 /* called by minidriver when link state changes, state: 0=disconnect,
125 * 1=connect */
126 void (*link_change)(struct usbnet *dev, int state);
127
128 /* for new devices, use the descriptor-reading code instead */
129 int in; /* rx endpoint */
130 int out; /* tx endpoint */
131
132 unsigned long data; /* Misc driver specific data */
133};
134
135/* Minidrivers are just drivers using the "usbnet" core as a powerful
136 * network-specific subroutine library ... that happens to do pretty
137 * much everything except custom framing and chip-specific stuff.
138 */
139extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
140extern int usbnet_suspend (struct usb_interface *, pm_message_t );
141extern int usbnet_resume (struct usb_interface *);
142extern void usbnet_disconnect(struct usb_interface *);
143
144
145/* Drivers that reuse some of the standard USB CDC infrastructure
146 * (notably, using multiple interfaces according to the CDC
147 * union descriptor) get some helper code.
148 */
149struct cdc_state {
150 struct usb_cdc_header_desc *header;
151 struct usb_cdc_union_desc *u;
152 struct usb_cdc_ether_desc *ether;
153 struct usb_interface *control;
154 struct usb_interface *data;
155};
156
157extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *);
158extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *);
159
160/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
161#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
162 |USB_CDC_PACKET_TYPE_ALL_MULTICAST \
163 |USB_CDC_PACKET_TYPE_PROMISCUOUS \
164 |USB_CDC_PACKET_TYPE_DIRECTED)
165
166
167/* we record the state for each of our queued skbs */
168enum skb_state {
169 illegal = 0,
170 tx_start, tx_done,
171 rx_start, rx_done, rx_cleanup
172};
173
174struct skb_data { /* skb->cb is one of these */
175 struct urb *urb;
176 struct usbnet *dev;
177 enum skb_state state;
178 size_t length;
179};
180
181
182extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
183extern void usbnet_defer_kevent (struct usbnet *, int);
184extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
185extern void usbnet_unlink_rx_urbs(struct usbnet *);
186
187extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
188extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
189extern u32 usbnet_get_link (struct net_device *net);
190extern u32 usbnet_get_msglevel (struct net_device *);
191extern void usbnet_set_msglevel (struct net_device *, u32);
192extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
193extern int usbnet_nway_reset(struct net_device *net);
194
195/* messaging support includes the interface name, so it must not be
196 * used before it has one ... notably, in minidriver bind() calls.
197 */
198#ifdef DEBUG
199#define devdbg(usbnet, fmt, arg...) \
200 printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
201#else
202#define devdbg(usbnet, fmt, arg...) do {} while(0)
203#endif
204
205#define deverr(usbnet, fmt, arg...) \
206 printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
207#define devwarn(usbnet, fmt, arg...) \
208 printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
209
210#define devinfo(usbnet, fmt, arg...) \
211 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \
212
213
214#endif /* __USBNET_H */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index a417b09b8b3d..cee0623b3c7b 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -80,10 +80,9 @@ enum { US_DO_ALL_FLAGS };
80#define US_SC_UFI 0x04 /* Floppy */ 80#define US_SC_UFI 0x04 /* Floppy */
81#define US_SC_8070 0x05 /* Removable media */ 81#define US_SC_8070 0x05 /* Removable media */
82#define US_SC_SCSI 0x06 /* Transparent */ 82#define US_SC_SCSI 0x06 /* Transparent */
83#define US_SC_ISD200 0x07 /* ISD200 ATA */ 83#define US_SC_LOCKABLE 0x07 /* Password-protected */
84#define US_SC_MIN US_SC_RBC
85#define US_SC_MAX US_SC_ISD200
86 84
85#define US_SC_ISD200 0xf0 /* ISD200 ATA */
87#define US_SC_DEVICE 0xff /* Use device's value */ 86#define US_SC_DEVICE 0xff /* Use device's value */
88 87
89/* Protocols */ 88/* Protocols */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 8ca5a7fbc9ec..17cb108b7db0 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -104,7 +104,7 @@ struct usbdevfs_urb {
104 int error_count; 104 int error_count;
105 unsigned int signr; /* signal to be sent on completion, 105 unsigned int signr; /* signal to be sent on completion,
106 or 0 if none should be sent. */ 106 or 0 if none should be sent. */
107 void *usercontext; 107 void __user *usercontext;
108 struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 108 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
109}; 109};
110 110
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 14e1379876d3..260d1fcf29a4 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -11,15 +11,13 @@
11/** 11/**
12 * virtqueue - a queue to register buffers for sending or receiving. 12 * virtqueue - a queue to register buffers for sending or receiving.
13 * @callback: the function to call when buffers are consumed (can be NULL). 13 * @callback: the function to call when buffers are consumed (can be NULL).
14 * If this returns false, callbacks are suppressed until vq_ops->restart
15 * is called.
16 * @vdev: the virtio device this queue was created for. 14 * @vdev: the virtio device this queue was created for.
17 * @vq_ops: the operations for this virtqueue (see below). 15 * @vq_ops: the operations for this virtqueue (see below).
18 * @priv: a pointer for the virtqueue implementation to use. 16 * @priv: a pointer for the virtqueue implementation to use.
19 */ 17 */
20struct virtqueue 18struct virtqueue
21{ 19{
22 bool (*callback)(struct virtqueue *vq); 20 void (*callback)(struct virtqueue *vq);
23 struct virtio_device *vdev; 21 struct virtio_device *vdev;
24 struct virtqueue_ops *vq_ops; 22 struct virtqueue_ops *vq_ops;
25 void *priv; 23 void *priv;
@@ -41,13 +39,12 @@ struct virtqueue
41 * vq: the struct virtqueue we're talking about. 39 * vq: the struct virtqueue we're talking about.
42 * len: the length written into the buffer 40 * len: the length written into the buffer
43 * Returns NULL or the "data" token handed to add_buf. 41 * Returns NULL or the "data" token handed to add_buf.
44 * @restart: restart callbacks after callback returned false. 42 * @disable_cb: disable callbacks
43 * vq: the struct virtqueue we're talking about.
44 * @enable_cb: restart callbacks after disable_cb.
45 * vq: the struct virtqueue we're talking about. 45 * vq: the struct virtqueue we're talking about.
46 * This returns "false" (and doesn't re-enable) if there are pending 46 * This returns "false" (and doesn't re-enable) if there are pending
47 * buffers in the queue, to avoid a race. 47 * buffers in the queue, to avoid a race.
48 * @shutdown: "unadd" all buffers.
49 * vq: the struct virtqueue we're talking about.
50 * Remove everything from the queue.
51 * 48 *
52 * Locking rules are straightforward: the driver is responsible for 49 * Locking rules are straightforward: the driver is responsible for
53 * locking. No two operations may be invoked simultaneously. 50 * locking. No two operations may be invoked simultaneously.
@@ -65,9 +62,8 @@ struct virtqueue_ops {
65 62
66 void *(*get_buf)(struct virtqueue *vq, unsigned int *len); 63 void *(*get_buf)(struct virtqueue *vq, unsigned int *len);
67 64
68 bool (*restart)(struct virtqueue *vq); 65 void (*disable_cb)(struct virtqueue *vq);
69 66 bool (*enable_cb)(struct virtqueue *vq);
70 void (*shutdown)(struct virtqueue *vq);
71}; 67};
72 68
73/** 69/**
@@ -97,12 +93,15 @@ void unregister_virtio_device(struct virtio_device *dev);
97 * @probe: the function to call when a device is found. Returns a token for 93 * @probe: the function to call when a device is found. Returns a token for
98 * remove, or PTR_ERR(). 94 * remove, or PTR_ERR().
99 * @remove: the function when a device is removed. 95 * @remove: the function when a device is removed.
96 * @config_changed: optional function to call when the device configuration
97 * changes; may be called in interrupt context.
100 */ 98 */
101struct virtio_driver { 99struct virtio_driver {
102 struct device_driver driver; 100 struct device_driver driver;
103 const struct virtio_device_id *id_table; 101 const struct virtio_device_id *id_table;
104 int (*probe)(struct virtio_device *dev); 102 int (*probe)(struct virtio_device *dev);
105 void (*remove)(struct virtio_device *dev); 103 void (*remove)(struct virtio_device *dev);
104 void (*config_changed)(struct virtio_device *dev);
106}; 105};
107 106
108int register_virtio_driver(struct virtio_driver *drv); 107int register_virtio_driver(struct virtio_driver *drv);
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
new file mode 100644
index 000000000000..979524ee75b7
--- /dev/null
+++ b/include/linux/virtio_balloon.h
@@ -0,0 +1,18 @@
1#ifndef _LINUX_VIRTIO_BALLOON_H
2#define _LINUX_VIRTIO_BALLOON_H
3#include <linux/virtio_config.h>
4
5/* The ID for virtio_balloon */
6#define VIRTIO_ID_BALLOON 5
7
8/* The feature bitmap for virtio balloon */
9#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
10
11struct virtio_balloon_config
12{
13 /* Number of pages host wants Guest to give up. */
14 __le32 num_pages;
15 /* Number of pages we've actually got in balloon. */
16 __le32 actual;
17};
18#endif /* _LINUX_VIRTIO_BALLOON_H */
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 7bd2bce0cfd9..bca0b10d7947 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -6,15 +6,19 @@
6#define VIRTIO_ID_BLOCK 2 6#define VIRTIO_ID_BLOCK 2
7 7
8/* Feature bits */ 8/* Feature bits */
9#define VIRTIO_CONFIG_BLK_F 0x40 9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
10#define VIRTIO_BLK_F_BARRIER 1 /* Does host support barriers? */ 10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
11 12
12/* The capacity (in 512-byte sectors). */ 13struct virtio_blk_config
13#define VIRTIO_CONFIG_BLK_F_CAPACITY 0x41 14{
14/* The maximum segment size. */ 15 /* The capacity (in 512-byte sectors). */
15#define VIRTIO_CONFIG_BLK_F_SIZE_MAX 0x42 16 __le64 capacity;
16/* The maximum number of segments. */ 17 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
17#define VIRTIO_CONFIG_BLK_F_SEG_MAX 0x43 18 __le32 size_max;
19 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
20 __le32 seg_max;
21} __attribute__((packed));
18 22
19/* These two define direction. */ 23/* These two define direction. */
20#define VIRTIO_BLK_T_IN 0 24#define VIRTIO_BLK_T_IN 0
@@ -35,8 +39,6 @@ struct virtio_blk_outhdr
35 __u32 ioprio; 39 __u32 ioprio;
36 /* Sector (ie. 512 byte offset) */ 40 /* Sector (ie. 512 byte offset) */
37 __u64 sector; 41 __u64 sector;
38 /* Where to put reply. */
39 __u64 id;
40}; 42};
41 43
42#define VIRTIO_BLK_S_OK 0 44#define VIRTIO_BLK_S_OK 0
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index bcc01888df78..d581b2914b34 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -5,7 +5,7 @@
5 * store and access that space differently. */ 5 * store and access that space differently. */
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8/* Status byte for guest to report progress, and synchronize config. */ 8/* Status byte for guest to report progress, and synchronize features. */
9/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ 9/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
10#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 10#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
11/* We have found a driver for the device. */ 11/* We have found a driver for the device. */
@@ -15,34 +15,27 @@
15/* We've given up on this device. */ 15/* We've given up on this device. */
16#define VIRTIO_CONFIG_S_FAILED 0x80 16#define VIRTIO_CONFIG_S_FAILED 0x80
17 17
18/* Feature byte (actually 7 bits availabe): */
19/* Requirements/features of the virtio implementation. */
20#define VIRTIO_CONFIG_F_VIRTIO 1
21/* Requirements/features of the virtqueue (may have more than one). */
22#define VIRTIO_CONFIG_F_VIRTQUEUE 2
23
24#ifdef __KERNEL__ 18#ifdef __KERNEL__
25struct virtio_device; 19struct virtio_device;
26 20
27/** 21/**
28 * virtio_config_ops - operations for configuring a virtio device 22 * virtio_config_ops - operations for configuring a virtio device
29 * @find: search for the next configuration field of the given type. 23 * @feature: search for a feature in this config
30 * vdev: the virtio_device 24 * vdev: the virtio_device
31 * type: the feature type 25 * bit: the feature bit
32 * len: the (returned) length of the field if found. 26 * Returns true if the feature is supported. Acknowledges the feature
33 * Returns a token if found, or NULL. Never returnes the same field twice 27 * so the host can see it.
34 * (ie. it's used up). 28 * @get: read the value of a configuration field
35 * @get: read the value of a configuration field after find().
36 * vdev: the virtio_device 29 * vdev: the virtio_device
37 * token: the token returned from find(). 30 * offset: the offset of the configuration field
38 * buf: the buffer to write the field value into. 31 * buf: the buffer to write the field value into.
39 * len: the length of the buffer (given by find()). 32 * len: the length of the buffer
40 * Note that contents are conventionally little-endian. 33 * Note that contents are conventionally little-endian.
41 * @set: write the value of a configuration field after find(). 34 * @set: write the value of a configuration field
42 * vdev: the virtio_device 35 * vdev: the virtio_device
43 * token: the token returned from find(). 36 * offset: the offset of the configuration field
44 * buf: the buffer to read the field value from. 37 * buf: the buffer to read the field value from.
45 * len: the length of the buffer (given by find()). 38 * len: the length of the buffer
46 * Note that contents are conventionally little-endian. 39 * Note that contents are conventionally little-endian.
47 * @get_status: read the status byte 40 * @get_status: read the status byte
48 * vdev: the virtio_device 41 * vdev: the virtio_device
@@ -50,62 +43,67 @@ struct virtio_device;
50 * @set_status: write the status byte 43 * @set_status: write the status byte
51 * vdev: the virtio_device 44 * vdev: the virtio_device
52 * status: the new status byte 45 * status: the new status byte
53 * @find_vq: find the first VIRTIO_CONFIG_F_VIRTQUEUE and create a virtqueue. 46 * @reset: reset the device
47 * vdev: the virtio device
48 * After this, status and feature negotiation must be done again
49 * @find_vq: find a virtqueue and instantiate it.
54 * vdev: the virtio_device 50 * vdev: the virtio_device
51 * index: the 0-based virtqueue number in case there's more than one.
55 * callback: the virqtueue callback 52 * callback: the virqtueue callback
56 * Returns the new virtqueue or ERR_PTR(). 53 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT).
57 * @del_vq: free a virtqueue found by find_vq(). 54 * @del_vq: free a virtqueue found by find_vq().
58 */ 55 */
59struct virtio_config_ops 56struct virtio_config_ops
60{ 57{
61 void *(*find)(struct virtio_device *vdev, u8 type, unsigned *len); 58 bool (*feature)(struct virtio_device *vdev, unsigned bit);
62 void (*get)(struct virtio_device *vdev, void *token, 59 void (*get)(struct virtio_device *vdev, unsigned offset,
63 void *buf, unsigned len); 60 void *buf, unsigned len);
64 void (*set)(struct virtio_device *vdev, void *token, 61 void (*set)(struct virtio_device *vdev, unsigned offset,
65 const void *buf, unsigned len); 62 const void *buf, unsigned len);
66 u8 (*get_status)(struct virtio_device *vdev); 63 u8 (*get_status)(struct virtio_device *vdev);
67 void (*set_status)(struct virtio_device *vdev, u8 status); 64 void (*set_status)(struct virtio_device *vdev, u8 status);
65 void (*reset)(struct virtio_device *vdev);
68 struct virtqueue *(*find_vq)(struct virtio_device *vdev, 66 struct virtqueue *(*find_vq)(struct virtio_device *vdev,
69 bool (*callback)(struct virtqueue *)); 67 unsigned index,
68 void (*callback)(struct virtqueue *));
70 void (*del_vq)(struct virtqueue *vq); 69 void (*del_vq)(struct virtqueue *vq);
71}; 70};
72 71
73/** 72/**
74 * virtio_config_val - get a single virtio config and mark it used. 73 * virtio_config_val - look for a feature and get a single virtio config.
75 * @config: the virtio config space 74 * @vdev: the virtio device
76 * @type: the type to search for. 75 * @fbit: the feature bit
76 * @offset: the type to search for.
77 * @val: a pointer to the value to fill in. 77 * @val: a pointer to the value to fill in.
78 * 78 *
79 * Once used, the config type is marked with VIRTIO_CONFIG_F_USED so it can't 79 * The return value is -ENOENT if the feature doesn't exist. Otherwise
80 * be found again. This version does endian conversion. */ 80 * the value is endian-corrected and returned in v. */
81#define virtio_config_val(vdev, type, v) ({ \ 81#define virtio_config_val(vdev, fbit, offset, v) ({ \
82 int _err = __virtio_config_val((vdev),(type),(v),sizeof(*(v))); \ 82 int _err; \
83 \ 83 if ((vdev)->config->feature((vdev), (fbit))) { \
84 BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \ 84 __virtio_config_val((vdev), (offset), (v)); \
85 && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \ 85 _err = 0; \
86 if (!_err) { \ 86 } else \
87 switch (sizeof(*(v))) { \ 87 _err = -ENOENT; \
88 case 2: le16_to_cpus((__u16 *) v); break; \
89 case 4: le32_to_cpus((__u32 *) v); break; \
90 case 8: le64_to_cpus((__u64 *) v); break; \
91 } \
92 } \
93 _err; \ 88 _err; \
94}) 89})
95 90
96int __virtio_config_val(struct virtio_device *dev,
97 u8 type, void *val, size_t size);
98
99/** 91/**
100 * virtio_use_bit - helper to use a feature bit in a bitfield value. 92 * __virtio_config_val - get a single virtio config without feature check.
101 * @dev: the virtio device 93 * @vdev: the virtio device
102 * @token: the token as returned from vdev->config->find(). 94 * @offset: the type to search for.
103 * @len: the length of the field. 95 * @val: a pointer to the value to fill in.
104 * @bitnum: the bit to test.
105 * 96 *
106 * If handed a NULL token, it returns false, otherwise returns bit status. 97 * The value is endian-corrected and returned in v. */
107 * If it's one, it sets the mirroring acknowledgement bit. */ 98#define __virtio_config_val(vdev, offset, v) do { \
108int virtio_use_bit(struct virtio_device *vdev, 99 BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \
109 void *token, unsigned int len, unsigned int bitnum); 100 && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \
101 (vdev)->config->get((vdev), (offset), (v), sizeof(*(v))); \
102 switch (sizeof(*(v))) { \
103 case 2: le16_to_cpus((__u16 *) v); break; \
104 case 4: le32_to_cpus((__u32 *) v); break; \
105 case 8: le64_to_cpus((__u64 *) v); break; \
106 } \
107} while(0)
110#endif /* __KERNEL__ */ 108#endif /* __KERNEL__ */
111#endif /* _LINUX_VIRTIO_CONFIG_H */ 109#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index ae469ae55d36..1ea3351df609 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -5,32 +5,32 @@
5/* The ID for virtio_net */ 5/* The ID for virtio_net */
6#define VIRTIO_ID_NET 1 6#define VIRTIO_ID_NET 1
7 7
8/* The bitmap of config for virtio net */ 8/* The feature bitmap for virtio net */
9#define VIRTIO_CONFIG_NET_F 0x40 9#define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */
10#define VIRTIO_NET_F_NO_CSUM 0 10#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
11#define VIRTIO_NET_F_TSO4 1 11#define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */
12#define VIRTIO_NET_F_UFO 2
13#define VIRTIO_NET_F_TSO4_ECN 3
14#define VIRTIO_NET_F_TSO6 4
15 12
16/* The config defining mac address. */ 13struct virtio_net_config
17#define VIRTIO_CONFIG_NET_MAC_F 0x41 14{
15 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
16 __u8 mac[6];
17} __attribute__((packed));
18 18
19/* This is the first element of the scatter-gather list. If you don't 19/* This is the first element of the scatter-gather list. If you don't
20 * specify GSO or CSUM features, you can simply ignore the header. */ 20 * specify GSO or CSUM features, you can simply ignore the header. */
21struct virtio_net_hdr 21struct virtio_net_hdr
22{ 22{
23#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset 23#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
24 __u8 flags; 24 __u8 flags;
25#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame 25#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
26#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) 26#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
27/* FIXME: Do we need this? If they said they can handle ECN, do they care? */
28#define VIRTIO_NET_HDR_GSO_TCPV4_ECN 2 // GSO frame, IPv4 TCP w/ ECN
29#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) 27#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
30#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP 28#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
31 __u8 gso_type; 29#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
32 __u16 gso_size; 30 __u8 gso_type;
33 __u16 csum_start; 31 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
34 __u16 csum_offset; 32 __u16 gso_size; /* Bytes to append to gso_hdr_len per frame */
33 __u16 csum_start; /* Position to start checksumming from */
34 __u16 csum_offset; /* Offset after that to place checksum */
35}; 35};
36#endif /* _LINUX_VIRTIO_NET_H */ 36#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h
new file mode 100644
index 000000000000..b3151659cf49
--- /dev/null
+++ b/include/linux/virtio_pci.h
@@ -0,0 +1,57 @@
1/*
2 * Virtio PCI driver
3 *
4 * This module allows virtio devices to be used over a virtual PCI device.
5 * This can be used with QEMU based VMMs like KVM or Xen.
6 *
7 * Copyright IBM Corp. 2007
8 *
9 * Authors:
10 * Anthony Liguori <aliguori@us.ibm.com>
11 *
12 * This work is licensed under the terms of the GNU GPL, version 2 or later.
13 * See the COPYING file in the top-level directory.
14 *
15 */
16
17#ifndef _LINUX_VIRTIO_PCI_H
18#define _LINUX_VIRTIO_PCI_H
19
20#include <linux/virtio_config.h>
21
22/* A 32-bit r/o bitmask of the features supported by the host */
23#define VIRTIO_PCI_HOST_FEATURES 0
24
25/* A 32-bit r/w bitmask of features activated by the guest */
26#define VIRTIO_PCI_GUEST_FEATURES 4
27
28/* A 32-bit r/w PFN for the currently selected queue */
29#define VIRTIO_PCI_QUEUE_PFN 8
30
31/* A 16-bit r/o queue size for the currently selected queue */
32#define VIRTIO_PCI_QUEUE_NUM 12
33
34/* A 16-bit r/w queue selector */
35#define VIRTIO_PCI_QUEUE_SEL 14
36
37/* A 16-bit r/w queue notifier */
38#define VIRTIO_PCI_QUEUE_NOTIFY 16
39
40/* An 8-bit device status register. */
41#define VIRTIO_PCI_STATUS 18
42
43/* An 8-bit r/o interrupt status register. Reading the value will return the
44 * current contents of the ISR and will also clear it. This is effectively
45 * a read-and-acknowledge. */
46#define VIRTIO_PCI_ISR 19
47
48/* The bit of the ISR which indicates a device configuration change. */
49#define VIRTIO_PCI_ISR_CONFIG 0x2
50
51/* The remaining space is defined by each driver as the per-driver
52 * configuration space */
53#define VIRTIO_PCI_CONFIG 20
54
55/* Virtio ABI version, this must match exactly */
56#define VIRTIO_PCI_ABI_VERSION 0
57#endif
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 1a4ed49f6478..abe481ed990e 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -15,9 +15,13 @@
15/* This marks a buffer as write-only (otherwise read-only). */ 15/* This marks a buffer as write-only (otherwise read-only). */
16#define VRING_DESC_F_WRITE 2 16#define VRING_DESC_F_WRITE 2
17 17
18/* This means don't notify other side when buffer added. */ 18/* The Host uses this in used->flags to advise the Guest: don't kick me when
19 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
20 * will still kick if it's out of buffers. */
19#define VRING_USED_F_NO_NOTIFY 1 21#define VRING_USED_F_NO_NOTIFY 1
20/* This means don't interrupt guest when buffer consumed. */ 22/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
23 * when you consume a buffer. It's unreliable, so it's simply an
24 * optimization. */
21#define VRING_AVAIL_F_NO_INTERRUPT 1 25#define VRING_AVAIL_F_NO_INTERRUPT 1
22 26
23/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ 27/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
@@ -89,7 +93,7 @@ struct vring {
89 * }; 93 * };
90 */ 94 */
91static inline void vring_init(struct vring *vr, unsigned int num, void *p, 95static inline void vring_init(struct vring *vr, unsigned int num, void *p,
92 unsigned int pagesize) 96 unsigned long pagesize)
93{ 97{
94 vr->num = num; 98 vr->num = num;
95 vr->desc = p; 99 vr->desc = p;
@@ -98,7 +102,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
98 & ~(pagesize - 1)); 102 & ~(pagesize - 1));
99} 103}
100 104
101static inline unsigned vring_size(unsigned int num, unsigned int pagesize) 105static inline unsigned vring_size(unsigned int num, unsigned long pagesize)
102{ 106{
103 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) 107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
104 + pagesize - 1) & ~(pagesize - 1)) 108 + pagesize - 1) & ~(pagesize - 1))
@@ -114,7 +118,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
114 struct virtio_device *vdev, 118 struct virtio_device *vdev,
115 void *pages, 119 void *pages,
116 void (*notify)(struct virtqueue *vq), 120 void (*notify)(struct virtqueue *vq),
117 bool (*callback)(struct virtqueue *vq)); 121 void (*callback)(struct virtqueue *vq));
118void vring_del_virtqueue(struct virtqueue *vq); 122void vring_del_virtqueue(struct virtqueue *vq);
119 123
120irqreturn_t vring_interrupt(int irq, void *_vq); 124irqreturn_t vring_interrupt(int irq, void *_vq);
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 89338b468d0d..ce8e7da05807 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -45,11 +45,11 @@ extern void *vmalloc_32_user(unsigned long size);
45extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 45extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
46extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, 46extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
47 pgprot_t prot); 47 pgprot_t prot);
48extern void vfree(void *addr); 48extern void vfree(const void *addr);
49 49
50extern void *vmap(struct page **pages, unsigned int count, 50extern void *vmap(struct page **pages, unsigned int count,
51 unsigned long flags, pgprot_t prot); 51 unsigned long flags, pgprot_t prot);
52extern void vunmap(void *addr); 52extern void vunmap(const void *addr);
53 53
54extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, 54extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
55 unsigned long pgoff); 55 unsigned long pgoff);
@@ -71,7 +71,7 @@ extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
71extern struct vm_struct *get_vm_area_node(unsigned long size, 71extern struct vm_struct *get_vm_area_node(unsigned long size,
72 unsigned long flags, int node, 72 unsigned long flags, int node,
73 gfp_t gfp_mask); 73 gfp_t gfp_mask);
74extern struct vm_struct *remove_vm_area(void *addr); 74extern struct vm_struct *remove_vm_area(const void *addr);
75 75
76extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 76extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
77 struct page ***pages); 77 struct page ***pages);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 0e686280450b..33a2aa9e02f2 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -152,14 +152,31 @@ int FASTCALL(out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned));
152int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned)); 152int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned));
153wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int)); 153wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int));
154 154
155#define wake_up(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL) 155#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
156#define wake_up_nr(x, nr) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL) 156#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)
157#define wake_up_all(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL) 157#define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL)
158#define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL)
159
158#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) 160#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
159#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) 161#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
160#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) 162#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
161#define wake_up_locked(x) __wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) 163#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1)
162#define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE, 1) 164
165#ifdef CONFIG_DEBUG_LOCK_ALLOC
166/*
167 * macro to avoid include hell
168 */
169#define wake_up_nested(x, s) \
170do { \
171 unsigned long flags; \
172 \
173 spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \
174 wake_up_locked(x); \
175 spin_unlock_irqrestore(&(x)->lock, flags); \
176} while (0)
177#else
178#define wake_up_nested(x, s) wake_up(x)
179#endif
163 180
164#define __wait_event(wq, condition) \ 181#define __wait_event(wq, condition) \
165do { \ 182do { \
@@ -345,6 +362,47 @@ do { \
345 __ret; \ 362 __ret; \
346}) 363})
347 364
365#define __wait_event_killable(wq, condition, ret) \
366do { \
367 DEFINE_WAIT(__wait); \
368 \
369 for (;;) { \
370 prepare_to_wait(&wq, &__wait, TASK_KILLABLE); \
371 if (condition) \
372 break; \
373 if (!fatal_signal_pending(current)) { \
374 schedule(); \
375 continue; \
376 } \
377 ret = -ERESTARTSYS; \
378 break; \
379 } \
380 finish_wait(&wq, &__wait); \
381} while (0)
382
383/**
384 * wait_event_killable - sleep until a condition gets true
385 * @wq: the waitqueue to wait on
386 * @condition: a C expression for the event to wait for
387 *
388 * The process is put to sleep (TASK_KILLABLE) until the
389 * @condition evaluates to true or a signal is received.
390 * The @condition is checked each time the waitqueue @wq is woken up.
391 *
392 * wake_up() has to be called after changing any variable that could
393 * change the result of the wait condition.
394 *
395 * The function will return -ERESTARTSYS if it was interrupted by a
396 * signal and 0 if @condition evaluated to true.
397 */
398#define wait_event_killable(wq, condition) \
399({ \
400 int __ret = 0; \
401 if (!(condition)) \
402 __wait_event_killable(wq, condition, __ret); \
403 __ret; \
404})
405
348/* 406/*
349 * Must be called with the spinlock in the wait_queue_head_t held. 407 * Must be called with the spinlock in the wait_queue_head_t held.
350 */ 408 */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 74e84caa1e20..3160dfed73ca 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1079,7 +1079,7 @@ struct iw_priv_args
1079 */ 1079 */
1080struct iw_event 1080struct iw_event
1081{ 1081{
1082 __u16 len; /* Real lenght of this stuff */ 1082 __u16 len; /* Real length of this stuff */
1083 __u16 cmd; /* Wireless IOCTL */ 1083 __u16 cmd; /* Wireless IOCTL */
1084 union iwreq_data u; /* IOCTL fixed payload */ 1084 union iwreq_data u; /* IOCTL fixed payload */
1085}; 1085};
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index c6148bbf1250..b7b3362f7717 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,6 +62,7 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */
65}; 66};
66 67
67/* 68/*
@@ -100,6 +101,7 @@ extern int dirty_background_ratio;
100extern int vm_dirty_ratio; 101extern int vm_dirty_ratio;
101extern int dirty_writeback_interval; 102extern int dirty_writeback_interval;
102extern int dirty_expire_interval; 103extern int dirty_expire_interval;
104extern int vm_highmem_is_dirtyable;
103extern int block_dump; 105extern int block_dump;
104extern int laptop_mode; 106extern int laptop_mode;
105 107
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index def131a5ac70..df6b95d2218e 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -46,6 +46,7 @@ struct xattr_handler {
46 size_t size, int flags); 46 size_t size, int flags);
47}; 47};
48 48
49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
49ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); 50ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
50ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); 51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
51int vfs_setxattr(struct dentry *, char *, void *, size_t, int); 52int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 9b5b00c4ef9d..e31b8c84f2c9 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -96,6 +96,13 @@ struct xfrm_algo {
96 char alg_key[0]; 96 char alg_key[0];
97}; 97};
98 98
99struct xfrm_algo_aead {
100 char alg_name[64];
101 int alg_key_len; /* in bits */
102 int alg_icv_len; /* in bits */
103 char alg_key[0];
104};
105
99struct xfrm_stats { 106struct xfrm_stats {
100 __u32 replay_window; 107 __u32 replay_window;
101 __u32 replay; 108 __u32 replay;
@@ -270,6 +277,7 @@ enum xfrm_attr_type_t {
270 XFRMA_LASTUSED, 277 XFRMA_LASTUSED,
271 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 278 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
272 XFRMA_MIGRATE, 279 XFRMA_MIGRATE,
280 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
273 __XFRMA_MAX 281 __XFRMA_MAX
274 282
275#define XFRMA_MAX (__XFRMA_MAX - 1) 283#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/media/rds.h b/include/media/rds.h
index 951c1ae0be74..a89426667618 100644
--- a/include/media/rds.h
+++ b/include/media/rds.h
@@ -4,7 +4,7 @@
4 saa6588.c and every driver (e.g. bttv-driver.c) that wants 4 saa6588.c and every driver (e.g. bttv-driver.c) that wants
5 to use the saa6588 module. 5 to use the saa6588 module.
6 6
7 Instead of having a seperate rds.h, I'd prefer to include 7 Instead of having a separate rds.h, I'd prefer to include
8 this stuff in one of the already existing files like tuner.h 8 this stuff in one of the already existing files like tuner.h
9 9
10 (c) 2005 by Hans J. Koch 10 (c) 2005 by Hans J. Koch
diff --git a/include/net/arp.h b/include/net/arp.h
index 752eb47b2678..c236270ec95e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -13,15 +13,17 @@ extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
13extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); 13extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
14extern void arp_send(int type, int ptype, __be32 dest_ip, 14extern void arp_send(int type, int ptype, __be32 dest_ip,
15 struct net_device *dev, __be32 src_ip, 15 struct net_device *dev, __be32 src_ip,
16 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); 16 const unsigned char *dest_hw,
17 const unsigned char *src_hw, const unsigned char *th);
17extern int arp_bind_neighbour(struct dst_entry *dst); 18extern int arp_bind_neighbour(struct dst_entry *dst);
18extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir); 19extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
19extern void arp_ifdown(struct net_device *dev); 20extern void arp_ifdown(struct net_device *dev);
20 21
21extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, 22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
22 struct net_device *dev, __be32 src_ip, 23 struct net_device *dev, __be32 src_ip,
23 unsigned char *dest_hw, unsigned char *src_hw, 24 const unsigned char *dest_hw,
24 unsigned char *target_hw); 25 const unsigned char *src_hw,
26 const unsigned char *target_hw);
25extern void arp_xmit(struct sk_buff *skb); 27extern void arp_xmit(struct sk_buff *skb);
26 28
27extern struct neigh_ops arp_broken_ops; 29extern struct neigh_ops arp_broken_ops;
diff --git a/include/net/esp.h b/include/net/esp.h
index c05f529bff28..d58451331dbd 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -1,58 +1,20 @@
1#ifndef _NET_ESP_H 1#ifndef _NET_ESP_H
2#define _NET_ESP_H 2#define _NET_ESP_H
3 3
4#include <linux/crypto.h> 4#include <linux/skbuff.h>
5#include <net/xfrm.h>
6#include <linux/scatterlist.h>
7 5
8#define ESP_NUM_FAST_SG 4 6struct crypto_aead;
9 7
10struct esp_data 8struct esp_data {
11{ 9 /* 0..255 */
12 struct scatterlist sgbuf[ESP_NUM_FAST_SG]; 10 int padlen;
13 11
14 /* Confidentiality */ 12 /* Confidentiality & Integrity */
15 struct { 13 struct crypto_aead *aead;
16 int padlen; /* 0..255 */
17 /* ivlen is offset from enc_data, where encrypted data start.
18 * It is logically different of crypto_tfm_alg_ivsize(tfm).
19 * We assume that it is either zero (no ivec), or
20 * >= crypto_tfm_alg_ivsize(tfm). */
21 int ivlen;
22 int ivinitted;
23 u8 *ivec; /* ivec buffer */
24 struct crypto_blkcipher *tfm; /* crypto handle */
25 } conf;
26
27 /* Integrity. It is active when icv_full_len != 0 */
28 struct {
29 u8 *work_icv;
30 int icv_full_len;
31 int icv_trunc_len;
32 struct crypto_hash *tfm;
33 } auth;
34}; 14};
35 15
36extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 16extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
37 17
38static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
39 int offset, int len)
40{
41 struct hash_desc desc;
42 int err;
43
44 desc.tfm = esp->auth.tfm;
45 desc.flags = 0;
46
47 err = crypto_hash_init(&desc);
48 if (unlikely(err))
49 return err;
50 err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update);
51 if (unlikely(err))
52 return err;
53 return crypto_hash_final(&desc, esp->auth.work_icv);
54}
55
56struct ip_esp_hdr; 18struct ip_esp_hdr;
57 19
58static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) 20static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index b24508abb850..b2cfc4927257 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -112,13 +112,13 @@ struct ifmcaddr6
112 struct ip6_sf_list *mca_sources; 112 struct ip6_sf_list *mca_sources;
113 struct ip6_sf_list *mca_tomb; 113 struct ip6_sf_list *mca_tomb;
114 unsigned int mca_sfmode; 114 unsigned int mca_sfmode;
115 unsigned char mca_crcount;
115 unsigned long mca_sfcount[2]; 116 unsigned long mca_sfcount[2];
116 struct timer_list mca_timer; 117 struct timer_list mca_timer;
117 unsigned mca_flags; 118 unsigned mca_flags;
118 int mca_users; 119 int mca_users;
119 atomic_t mca_refcnt; 120 atomic_t mca_refcnt;
120 spinlock_t mca_lock; 121 spinlock_t mca_lock;
121 unsigned char mca_crcount;
122 unsigned long mca_cstamp; 122 unsigned long mca_cstamp;
123 unsigned long mca_tstamp; 123 unsigned long mca_tstamp;
124}; 124};
@@ -166,11 +166,11 @@ struct inet6_dev
166 struct ifmcaddr6 *mc_list; 166 struct ifmcaddr6 *mc_list;
167 struct ifmcaddr6 *mc_tomb; 167 struct ifmcaddr6 *mc_tomb;
168 rwlock_t mc_lock; 168 rwlock_t mc_lock;
169 unsigned long mc_v1_seen;
170 unsigned long mc_maxdelay;
171 unsigned char mc_qrv; 169 unsigned char mc_qrv;
172 unsigned char mc_gq_running; 170 unsigned char mc_gq_running;
173 unsigned char mc_ifc_count; 171 unsigned char mc_ifc_count;
172 unsigned long mc_v1_seen;
173 unsigned long mc_maxdelay;
174 struct timer_list mc_gq_timer; /* general query timer */ 174 struct timer_list mc_gq_timer; /* general query timer */
175 struct timer_list mc_ifc_timer; /* interface change timer */ 175 struct timer_list mc_ifc_timer; /* interface change timer */
176 176
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 668056b4bb0b..62a5b691858e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -49,7 +49,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
49 return inet6_ehashfn(laddr, lport, faddr, fport); 49 return inet6_ehashfn(laddr, lport, faddr, fport);
50} 50}
51 51
52extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk); 52extern void __inet6_hash(struct sock *sk);
53 53
54/* 54/*
55 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 55 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -57,34 +57,37 @@ extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
57 * 57 *
58 * The sockhash lock must be held as a reader here. 58 * The sockhash lock must be held as a reader here.
59 */ 59 */
60extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, 60extern struct sock *__inet6_lookup_established(struct net *net,
61 struct inet_hashinfo *hashinfo,
61 const struct in6_addr *saddr, 62 const struct in6_addr *saddr,
62 const __be16 sport, 63 const __be16 sport,
63 const struct in6_addr *daddr, 64 const struct in6_addr *daddr,
64 const u16 hnum, 65 const u16 hnum,
65 const int dif); 66 const int dif);
66 67
67extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 68extern struct sock *inet6_lookup_listener(struct net *net,
69 struct inet_hashinfo *hashinfo,
68 const struct in6_addr *daddr, 70 const struct in6_addr *daddr,
69 const unsigned short hnum, 71 const unsigned short hnum,
70 const int dif); 72 const int dif);
71 73
72static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo, 74static inline struct sock *__inet6_lookup(struct net *net,
75 struct inet_hashinfo *hashinfo,
73 const struct in6_addr *saddr, 76 const struct in6_addr *saddr,
74 const __be16 sport, 77 const __be16 sport,
75 const struct in6_addr *daddr, 78 const struct in6_addr *daddr,
76 const u16 hnum, 79 const u16 hnum,
77 const int dif) 80 const int dif)
78{ 81{
79 struct sock *sk = __inet6_lookup_established(hashinfo, saddr, sport, 82 struct sock *sk = __inet6_lookup_established(net, hashinfo, saddr,
80 daddr, hnum, dif); 83 sport, daddr, hnum, dif);
81 if (sk) 84 if (sk)
82 return sk; 85 return sk;
83 86
84 return inet6_lookup_listener(hashinfo, daddr, hnum, dif); 87 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
85} 88}
86 89
87extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo, 90extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
88 const struct in6_addr *saddr, const __be16 sport, 91 const struct in6_addr *saddr, const __be16 sport,
89 const struct in6_addr *daddr, const __be16 dport, 92 const struct in6_addr *daddr, const __be16 dport,
90 const int dif); 93 const int dif);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 133cf30d2d79..f00f0573627b 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -29,7 +29,6 @@
29#undef INET_CSK_CLEAR_TIMERS 29#undef INET_CSK_CLEAR_TIMERS
30 30
31struct inet_bind_bucket; 31struct inet_bind_bucket;
32struct inet_hashinfo;
33struct tcp_congestion_ops; 32struct tcp_congestion_ops;
34 33
35/* 34/*
@@ -59,6 +58,8 @@ struct inet_connection_sock_af_ops {
59 int level, int optname, 58 int level, int optname,
60 char __user *optval, int __user *optlen); 59 char __user *optval, int __user *optlen);
61 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 60 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
61 int (*bind_conflict)(const struct sock *sk,
62 const struct inet_bind_bucket *tb);
62}; 63};
63 64
64/** inet_connection_sock - INET connection oriented sock 65/** inet_connection_sock - INET connection oriented sock
@@ -244,10 +245,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
244 const __be32 laddr); 245 const __be32 laddr);
245extern int inet_csk_bind_conflict(const struct sock *sk, 246extern int inet_csk_bind_conflict(const struct sock *sk,
246 const struct inet_bind_bucket *tb); 247 const struct inet_bind_bucket *tb);
247extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, 248extern int inet_csk_get_port(struct sock *sk, unsigned short snum);
248 struct sock *sk, unsigned short snum,
249 int (*bind_conflict)(const struct sock *sk,
250 const struct inet_bind_bucket *tb));
251 249
252extern struct dst_entry* inet_csk_route_req(struct sock *sk, 250extern struct dst_entry* inet_csk_route_req(struct sock *sk,
253 const struct request_sock *req); 251 const struct request_sock *req);
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 761bdc01425d..97dc35ad09be 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -74,6 +74,7 @@ struct inet_ehash_bucket {
74 * ports are created in O(1) time? I thought so. ;-) -DaveM 74 * ports are created in O(1) time? I thought so. ;-) -DaveM
75 */ 75 */
76struct inet_bind_bucket { 76struct inet_bind_bucket {
77 struct net *ib_net;
77 unsigned short port; 78 unsigned short port;
78 signed short fastreuse; 79 signed short fastreuse;
79 struct hlist_node node; 80 struct hlist_node node;
@@ -194,6 +195,7 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
194 195
195extern struct inet_bind_bucket * 196extern struct inet_bind_bucket *
196 inet_bind_bucket_create(struct kmem_cache *cachep, 197 inet_bind_bucket_create(struct kmem_cache *cachep,
198 struct net *net,
197 struct inet_bind_hashbucket *head, 199 struct inet_bind_hashbucket *head,
198 const unsigned short snum); 200 const unsigned short snum);
199extern void inet_bind_bucket_destroy(struct kmem_cache *cachep, 201extern void inet_bind_bucket_destroy(struct kmem_cache *cachep,
@@ -219,9 +221,9 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
219} 221}
220 222
221/* Caller must disable local BH processing. */ 223/* Caller must disable local BH processing. */
222static inline void __inet_inherit_port(struct inet_hashinfo *table, 224static inline void __inet_inherit_port(struct sock *sk, struct sock *child)
223 struct sock *sk, struct sock *child)
224{ 225{
226 struct inet_hashinfo *table = sk->sk_prot->hashinfo;
225 const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); 227 const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size);
226 struct inet_bind_hashbucket *head = &table->bhash[bhash]; 228 struct inet_bind_hashbucket *head = &table->bhash[bhash];
227 struct inet_bind_bucket *tb; 229 struct inet_bind_bucket *tb;
@@ -233,15 +235,14 @@ static inline void __inet_inherit_port(struct inet_hashinfo *table,
233 spin_unlock(&head->lock); 235 spin_unlock(&head->lock);
234} 236}
235 237
236static inline void inet_inherit_port(struct inet_hashinfo *table, 238static inline void inet_inherit_port(struct sock *sk, struct sock *child)
237 struct sock *sk, struct sock *child)
238{ 239{
239 local_bh_disable(); 240 local_bh_disable();
240 __inet_inherit_port(table, sk, child); 241 __inet_inherit_port(sk, child);
241 local_bh_enable(); 242 local_bh_enable();
242} 243}
243 244
244extern void inet_put_port(struct inet_hashinfo *table, struct sock *sk); 245extern void inet_put_port(struct sock *sk);
245 246
246extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); 247extern void inet_listen_wlock(struct inet_hashinfo *hashinfo);
247 248
@@ -264,51 +265,21 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
264 wake_up(&hashinfo->lhash_wait); 265 wake_up(&hashinfo->lhash_wait);
265} 266}
266 267
267extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk); 268extern void __inet_hash_nolisten(struct sock *sk);
268extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk); 269extern void inet_hash(struct sock *sk);
270extern void inet_unhash(struct sock *sk);
269 271
270static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) 272extern struct sock *__inet_lookup_listener(struct net *net,
271{ 273 struct inet_hashinfo *hashinfo,
272 if (sk->sk_state != TCP_CLOSE) {
273 local_bh_disable();
274 __inet_hash(hashinfo, sk);
275 local_bh_enable();
276 }
277}
278
279static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
280{
281 rwlock_t *lock;
282
283 if (sk_unhashed(sk))
284 goto out;
285
286 if (sk->sk_state == TCP_LISTEN) {
287 local_bh_disable();
288 inet_listen_wlock(hashinfo);
289 lock = &hashinfo->lhash_lock;
290 } else {
291 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
292 write_lock_bh(lock);
293 }
294
295 if (__sk_del_node_init(sk))
296 sock_prot_inuse_add(sk->sk_prot, -1);
297 write_unlock_bh(lock);
298out:
299 if (sk->sk_state == TCP_LISTEN)
300 wake_up(&hashinfo->lhash_wait);
301}
302
303extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
304 const __be32 daddr, 274 const __be32 daddr,
305 const unsigned short hnum, 275 const unsigned short hnum,
306 const int dif); 276 const int dif);
307 277
308static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, 278static inline struct sock *inet_lookup_listener(struct net *net,
309 __be32 daddr, __be16 dport, int dif) 279 struct inet_hashinfo *hashinfo,
280 __be32 daddr, __be16 dport, int dif)
310{ 281{
311 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); 282 return __inet_lookup_listener(net, hashinfo, daddr, ntohs(dport), dif);
312} 283}
313 284
314/* Socket demux engine toys. */ 285/* Socket demux engine toys. */
@@ -342,26 +313,26 @@ typedef __u64 __bitwise __addrpair;
342 (((__force __u64)(__be32)(__daddr)) << 32) | \ 313 (((__force __u64)(__be32)(__daddr)) << 32) | \
343 ((__force __u64)(__be32)(__saddr))); 314 ((__force __u64)(__be32)(__saddr)));
344#endif /* __BIG_ENDIAN */ 315#endif /* __BIG_ENDIAN */
345#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 316#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
346 (((__sk)->sk_hash == (__hash)) && \ 317 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
347 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 318 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
348 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 319 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
349 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 320 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
350#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 321#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
351 (((__sk)->sk_hash == (__hash)) && \ 322 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
352 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 323 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
353 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 324 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
354 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
355#else /* 32-bit arch */ 326#else /* 32-bit arch */
356#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 327#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
357#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 328#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
358 (((__sk)->sk_hash == (__hash)) && \ 329 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
359 (inet_sk(__sk)->daddr == (__saddr)) && \ 330 (inet_sk(__sk)->daddr == (__saddr)) && \
360 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 331 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
361 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 332 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
362 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 333 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
363#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 334#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
364 (((__sk)->sk_hash == (__hash)) && \ 335 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
365 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 336 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
366 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 337 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
367 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 338 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
@@ -374,32 +345,36 @@ typedef __u64 __bitwise __addrpair;
374 * 345 *
375 * Local BH must be disabled here. 346 * Local BH must be disabled here.
376 */ 347 */
377extern struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo, 348extern struct sock * __inet_lookup_established(struct net *net,
349 struct inet_hashinfo *hashinfo,
378 const __be32 saddr, const __be16 sport, 350 const __be32 saddr, const __be16 sport,
379 const __be32 daddr, const u16 hnum, const int dif); 351 const __be32 daddr, const u16 hnum, const int dif);
380 352
381static inline struct sock * 353static inline struct sock *
382 inet_lookup_established(struct inet_hashinfo *hashinfo, 354 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
383 const __be32 saddr, const __be16 sport, 355 const __be32 saddr, const __be16 sport,
384 const __be32 daddr, const __be16 dport, 356 const __be32 daddr, const __be16 dport,
385 const int dif) 357 const int dif)
386{ 358{
387 return __inet_lookup_established(hashinfo, saddr, sport, daddr, 359 return __inet_lookup_established(net, hashinfo, saddr, sport, daddr,
388 ntohs(dport), dif); 360 ntohs(dport), dif);
389} 361}
390 362
391static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, 363static inline struct sock *__inet_lookup(struct net *net,
364 struct inet_hashinfo *hashinfo,
392 const __be32 saddr, const __be16 sport, 365 const __be32 saddr, const __be16 sport,
393 const __be32 daddr, const __be16 dport, 366 const __be32 daddr, const __be16 dport,
394 const int dif) 367 const int dif)
395{ 368{
396 u16 hnum = ntohs(dport); 369 u16 hnum = ntohs(dport);
397 struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, 370 struct sock *sk = __inet_lookup_established(net, hashinfo,
398 hnum, dif); 371 saddr, sport, daddr, hnum, dif);
399 return sk ? : __inet_lookup_listener(hashinfo, daddr, hnum, dif); 372
373 return sk ? : __inet_lookup_listener(net, hashinfo, daddr, hnum, dif);
400} 374}
401 375
402static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, 376static inline struct sock *inet_lookup(struct net *net,
377 struct inet_hashinfo *hashinfo,
403 const __be32 saddr, const __be16 sport, 378 const __be32 saddr, const __be16 sport,
404 const __be32 daddr, const __be16 dport, 379 const __be32 daddr, const __be16 dport,
405 const int dif) 380 const int dif)
@@ -407,12 +382,17 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
407 struct sock *sk; 382 struct sock *sk;
408 383
409 local_bh_disable(); 384 local_bh_disable();
410 sk = __inet_lookup(hashinfo, saddr, sport, daddr, dport, dif); 385 sk = __inet_lookup(net, hashinfo, saddr, sport, daddr, dport, dif);
411 local_bh_enable(); 386 local_bh_enable();
412 387
413 return sk; 388 return sk;
414} 389}
415 390
391extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
392 struct sock *sk, u32 port_offset,
393 int (*check_established)(struct inet_timewait_death_row *,
394 struct sock *, __u16, struct inet_timewait_sock **),
395 void (*hash)(struct sock *sk));
416extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 396extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
417 struct sock *sk); 397 struct sock *sk);
418#endif /* _INET_HASHTABLES_H */ 398#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 67e925065aae..296547bfb0b7 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -116,6 +116,7 @@ struct inet_timewait_sock {
116#define tw_hash __tw_common.skc_hash 116#define tw_hash __tw_common.skc_hash
117#define tw_prot __tw_common.skc_prot 117#define tw_prot __tw_common.skc_prot
118#define tw_net __tw_common.skc_net 118#define tw_net __tw_common.skc_net
119 int tw_timeout;
119 volatile unsigned char tw_substate; 120 volatile unsigned char tw_substate;
120 /* 3 bits hole, try to pack */ 121 /* 3 bits hole, try to pack */
121 unsigned char tw_rcv_wscale; 122 unsigned char tw_rcv_wscale;
@@ -130,7 +131,6 @@ struct inet_timewait_sock {
130 __u8 tw_ipv6only:1; 131 __u8 tw_ipv6only:1;
131 /* 15 bits hole, try to pack */ 132 /* 15 bits hole, try to pack */
132 __u16 tw_ipv6_offset; 133 __u16 tw_ipv6_offset;
133 int tw_timeout;
134 unsigned long tw_ttd; 134 unsigned long tw_ttd;
135 struct inet_bind_bucket *tw_tb; 135 struct inet_bind_bucket *tw_tb;
136 struct hlist_node tw_death_node; 136 struct hlist_node tw_death_node;
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9daa60b544ba..8b12667f7a2b 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -69,6 +69,7 @@ struct fib_nh {
69struct fib_info { 69struct fib_info {
70 struct hlist_node fib_hash; 70 struct hlist_node fib_hash;
71 struct hlist_node fib_lhash; 71 struct hlist_node fib_lhash;
72 struct net *fib_net;
72 int fib_treeref; 73 int fib_treeref;
73 atomic_t fib_clntref; 74 atomic_t fib_clntref;
74 int fib_dead; 75 int fib_dead;
@@ -218,7 +219,8 @@ extern void fib_select_default(struct net *net, const struct flowi *flp,
218 219
219/* Exported by fib_semantics.c */ 220/* Exported by fib_semantics.c */
220extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 221extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
221extern int fib_sync_down(__be32 local, struct net_device *dev, int force); 222extern int fib_sync_down_dev(struct net_device *dev, int force);
223extern int fib_sync_down_addr(struct net *net, __be32 local);
222extern int fib_sync_up(struct net_device *dev); 224extern int fib_sync_up(struct net_device *dev);
223extern __be32 __fib_res_prefsrc(struct fib_result *res); 225extern __be32 __fib_res_prefsrc(struct fib_result *res);
224extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 226extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
@@ -264,6 +266,14 @@ static inline void fib_res_put(struct fib_result *res)
264#ifdef CONFIG_PROC_FS 266#ifdef CONFIG_PROC_FS
265extern int __net_init fib_proc_init(struct net *net); 267extern int __net_init fib_proc_init(struct net *net);
266extern void __net_exit fib_proc_exit(struct net *net); 268extern void __net_exit fib_proc_exit(struct net *net);
269#else
270static inline int fib_proc_init(struct net *net)
271{
272 return 0;
273}
274static inline void fib_proc_exit(struct net *net)
275{
276}
267#endif 277#endif
268 278
269#endif /* _NET_FIB_H */ 279#endif /* _NET_FIB_H */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index fa80ea48639d..c0c019f72ba9 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -110,7 +110,6 @@ struct frag_hdr {
110 110
111/* sysctls */ 111/* sysctls */
112extern int sysctl_mld_max_msf; 112extern int sysctl_mld_max_msf;
113
114extern struct ctl_path net_ipv6_ctl_path[]; 113extern struct ctl_path net_ipv6_ctl_path[];
115 114
116#define _DEVINC(statname, modifier, idev, field) \ 115#define _DEVINC(statname, modifier, idev, field) \
@@ -586,9 +585,6 @@ extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
586 int __user *optlen); 585 int __user *optlen);
587 586
588#ifdef CONFIG_PROC_FS 587#ifdef CONFIG_PROC_FS
589extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
590extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
591
592extern int ac6_proc_init(void); 588extern int ac6_proc_init(void);
593extern void ac6_proc_exit(void); 589extern void ac6_proc_exit(void);
594extern int raw6_proc_init(void); 590extern int raw6_proc_init(void);
@@ -621,6 +617,8 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev)
621extern ctl_table ipv6_route_table_template[]; 617extern ctl_table ipv6_route_table_template[];
622extern ctl_table ipv6_icmp_table_template[]; 618extern ctl_table ipv6_icmp_table_template[];
623 619
620extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
621extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
624extern int ipv6_sysctl_register(void); 622extern int ipv6_sysctl_register(void);
625extern void ipv6_sysctl_unregister(void); 623extern void ipv6_sysctl_unregister(void);
626#endif 624#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index b8c1d60ba9e4..28738b7d53eb 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -12,6 +12,7 @@
12#include <net/netns/packet.h> 12#include <net/netns/packet.h>
13#include <net/netns/ipv4.h> 13#include <net/netns/ipv4.h>
14#include <net/netns/ipv6.h> 14#include <net/netns/ipv6.h>
15#include <net/netns/x_tables.h>
15 16
16struct proc_dir_entry; 17struct proc_dir_entry;
17struct net_device; 18struct net_device;
@@ -56,6 +57,9 @@ struct net {
56#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 57#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
57 struct netns_ipv6 ipv6; 58 struct netns_ipv6 ipv6;
58#endif 59#endif
60#ifdef CONFIG_NETFILTER
61 struct netns_xt xt;
62#endif
59}; 63};
60 64
61#ifdef CONFIG_NET 65#ifdef CONFIG_NET
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 857d89951790..90b3e7f5df5f 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -129,6 +129,8 @@ struct nf_conn
129 129
130 /* Extensions */ 130 /* Extensions */
131 struct nf_ct_ext *ext; 131 struct nf_ct_ext *ext;
132
133 struct rcu_head rcu;
132}; 134};
133 135
134static inline struct nf_conn * 136static inline struct nf_conn *
@@ -143,7 +145,7 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
143 145
144/* Alter reply tuple (maybe alter helper). */ 146/* Alter reply tuple (maybe alter helper). */
145extern void 147extern void
146nf_conntrack_alter_reply(struct nf_conn *conntrack, 148nf_conntrack_alter_reply(struct nf_conn *ct,
147 const struct nf_conntrack_tuple *newreply); 149 const struct nf_conntrack_tuple *newreply);
148 150
149/* Is this tuple taken? (ignoring any belonging to the given 151/* Is this tuple taken? (ignoring any belonging to the given
@@ -171,13 +173,12 @@ static inline void nf_ct_put(struct nf_conn *ct)
171extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 173extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
172extern void nf_ct_l3proto_module_put(unsigned short l3proto); 174extern void nf_ct_l3proto_module_put(unsigned short l3proto);
173 175
174extern struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced); 176extern struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced);
175extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, 177extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced,
176 int size); 178 unsigned int size);
177 179
178extern struct nf_conntrack_tuple_hash * 180extern struct nf_conntrack_tuple_hash *
179__nf_conntrack_find(const struct nf_conntrack_tuple *tuple, 181__nf_conntrack_find(const struct nf_conntrack_tuple *tuple);
180 const struct nf_conn *ignored_conntrack);
181 182
182extern void nf_conntrack_hash_insert(struct nf_conn *ct); 183extern void nf_conntrack_hash_insert(struct nf_conn *ct);
183 184
@@ -215,9 +216,9 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
215 216
216/* These are for NAT. Icky. */ 217/* These are for NAT. Icky. */
217/* Update TCP window tracking data when NAT mangles the packet */ 218/* Update TCP window tracking data when NAT mangles the packet */
218extern void nf_conntrack_tcp_update(struct sk_buff *skb, 219extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
219 unsigned int dataoff, 220 unsigned int dataoff,
220 struct nf_conn *conntrack, 221 struct nf_conn *ct,
221 int dir); 222 int dir);
222 223
223/* Fake conntrack entry for untracked connections */ 224/* Fake conntrack entry for untracked connections */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 7ad0828f05cf..9ee26469c759 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -68,11 +68,11 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
68 68
69int 69int
70print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, 70print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
71 struct nf_conntrack_l3proto *l3proto, 71 const struct nf_conntrack_l3proto *l3proto,
72 struct nf_conntrack_l4proto *proto); 72 const struct nf_conntrack_l4proto *proto);
73 73
74extern struct hlist_head *nf_conntrack_hash; 74extern struct hlist_head *nf_conntrack_hash;
75extern rwlock_t nf_conntrack_lock ; 75extern spinlock_t nf_conntrack_lock ;
76extern struct hlist_head unconfirmed; 76extern struct hlist_head unconfirmed;
77 77
78#endif /* _NF_CONNTRACK_CORE_H */ 78#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 6c3fd254c28e..cb608a1b44e5 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -49,6 +49,8 @@ struct nf_conntrack_expect
49 /* Direction relative to the master connection. */ 49 /* Direction relative to the master connection. */
50 enum ip_conntrack_dir dir; 50 enum ip_conntrack_dir dir;
51#endif 51#endif
52
53 struct rcu_head rcu;
52}; 54};
53 55
54#define NF_CT_EXPECT_PERMANENT 0x1 56#define NF_CT_EXPECT_PERMANENT 0x1
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 2f3af00643cf..4ca125e9b3ce 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -43,12 +43,8 @@ extern struct nf_conntrack_helper *
43__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple); 43__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
44 44
45extern struct nf_conntrack_helper * 45extern struct nf_conntrack_helper *
46nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
47
48extern struct nf_conntrack_helper *
49__nf_conntrack_helper_find_byname(const char *name); 46__nf_conntrack_helper_find_byname(const char *name);
50 47
51extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
52extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 48extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
53extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 49extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
54 50
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index d5526bcce147..b886e3ae6cad 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -43,7 +43,7 @@ struct nf_conntrack_l3proto
43 const struct nf_conntrack_tuple *); 43 const struct nf_conntrack_tuple *);
44 44
45 /* Returns verdict for packet, or -1 for invalid. */ 45 /* Returns verdict for packet, or -1 for invalid. */
46 int (*packet)(struct nf_conn *conntrack, 46 int (*packet)(struct nf_conn *ct,
47 const struct sk_buff *skb, 47 const struct sk_buff *skb,
48 enum ip_conntrack_info ctinfo); 48 enum ip_conntrack_info ctinfo);
49 49
@@ -51,7 +51,7 @@ struct nf_conntrack_l3proto
51 * Called when a new connection for this protocol found; 51 * Called when a new connection for this protocol found;
52 * returns TRUE if it's OK. If so, packet() called next. 52 * returns TRUE if it's OK. If so, packet() called next.
53 */ 53 */
54 int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb); 54 int (*new)(struct nf_conn *ct, const struct sk_buff *skb);
55 55
56 /* 56 /*
57 * Called before tracking. 57 * Called before tracking.
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index fb50c217ba0a..efc16eccddb1 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -23,9 +23,6 @@ struct nf_conntrack_l4proto
23 /* L4 Protocol number. */ 23 /* L4 Protocol number. */
24 u_int8_t l4proto; 24 u_int8_t l4proto;
25 25
26 /* Protocol name */
27 const char *name;
28
29 /* Try to fill in the third arg: dataoff is offset past network protocol 26 /* Try to fill in the third arg: dataoff is offset past network protocol
30 hdr. Return true if possible. */ 27 hdr. Return true if possible. */
31 int (*pkt_to_tuple)(const struct sk_buff *skb, 28 int (*pkt_to_tuple)(const struct sk_buff *skb,
@@ -38,15 +35,8 @@ struct nf_conntrack_l4proto
38 int (*invert_tuple)(struct nf_conntrack_tuple *inverse, 35 int (*invert_tuple)(struct nf_conntrack_tuple *inverse,
39 const struct nf_conntrack_tuple *orig); 36 const struct nf_conntrack_tuple *orig);
40 37
41 /* Print out the per-protocol part of the tuple. Return like seq_* */
42 int (*print_tuple)(struct seq_file *s,
43 const struct nf_conntrack_tuple *);
44
45 /* Print out the private part of the conntrack. */
46 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *);
47
48 /* Returns verdict for packet, or -1 for invalid. */ 38 /* Returns verdict for packet, or -1 for invalid. */
49 int (*packet)(struct nf_conn *conntrack, 39 int (*packet)(struct nf_conn *ct,
50 const struct sk_buff *skb, 40 const struct sk_buff *skb,
51 unsigned int dataoff, 41 unsigned int dataoff,
52 enum ip_conntrack_info ctinfo, 42 enum ip_conntrack_info ctinfo,
@@ -55,16 +45,23 @@ struct nf_conntrack_l4proto
55 45
56 /* Called when a new connection for this protocol found; 46 /* Called when a new connection for this protocol found;
57 * returns TRUE if it's OK. If so, packet() called next. */ 47 * returns TRUE if it's OK. If so, packet() called next. */
58 int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb, 48 int (*new)(struct nf_conn *ct, const struct sk_buff *skb,
59 unsigned int dataoff); 49 unsigned int dataoff);
60 50
61 /* Called when a conntrack entry is destroyed */ 51 /* Called when a conntrack entry is destroyed */
62 void (*destroy)(struct nf_conn *conntrack); 52 void (*destroy)(struct nf_conn *ct);
63 53
64 int (*error)(struct sk_buff *skb, unsigned int dataoff, 54 int (*error)(struct sk_buff *skb, unsigned int dataoff,
65 enum ip_conntrack_info *ctinfo, 55 enum ip_conntrack_info *ctinfo,
66 int pf, unsigned int hooknum); 56 int pf, unsigned int hooknum);
67 57
58 /* Print out the per-protocol part of the tuple. Return like seq_* */
59 int (*print_tuple)(struct seq_file *s,
60 const struct nf_conntrack_tuple *);
61
62 /* Print out the private part of the conntrack. */
63 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *);
64
68 /* convert protoinfo to nfnetink attributes */ 65 /* convert protoinfo to nfnetink attributes */
69 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 66 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
70 const struct nf_conn *ct); 67 const struct nf_conn *ct);
@@ -87,6 +84,8 @@ struct nf_conntrack_l4proto
87 struct ctl_table *ctl_compat_table; 84 struct ctl_table *ctl_compat_table;
88#endif 85#endif
89#endif 86#endif
87 /* Protocol name */
88 const char *name;
90 89
91 /* Module (if any) which this is connected to. */ 90 /* Module (if any) which this is connected to. */
92 struct module *me; 91 struct module *me;
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 45cb17cdcfd0..e69ab2e87597 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -132,34 +132,33 @@ struct nf_conntrack_tuple_hash
132 132
133#endif /* __KERNEL__ */ 133#endif /* __KERNEL__ */
134 134
135static inline int nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, 135static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
136 const struct nf_conntrack_tuple *t2) 136 const struct nf_conntrack_tuple *t2)
137{ 137{
138 return (t1->src.u3.all[0] == t2->src.u3.all[0] && 138 return (t1->src.u3.all[0] == t2->src.u3.all[0] &&
139 t1->src.u3.all[1] == t2->src.u3.all[1] && 139 t1->src.u3.all[1] == t2->src.u3.all[1] &&
140 t1->src.u3.all[2] == t2->src.u3.all[2] && 140 t1->src.u3.all[2] == t2->src.u3.all[2] &&
141 t1->src.u3.all[3] == t2->src.u3.all[3] && 141 t1->src.u3.all[3] == t2->src.u3.all[3] &&
142 t1->src.u.all == t2->src.u.all && 142 t1->src.u.all == t2->src.u.all &&
143 t1->src.l3num == t2->src.l3num && 143 t1->src.l3num == t2->src.l3num);
144 t1->dst.protonum == t2->dst.protonum);
145} 144}
146 145
147static inline int nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, 146static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1,
148 const struct nf_conntrack_tuple *t2) 147 const struct nf_conntrack_tuple *t2)
149{ 148{
150 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && 149 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] &&
151 t1->dst.u3.all[1] == t2->dst.u3.all[1] && 150 t1->dst.u3.all[1] == t2->dst.u3.all[1] &&
152 t1->dst.u3.all[2] == t2->dst.u3.all[2] && 151 t1->dst.u3.all[2] == t2->dst.u3.all[2] &&
153 t1->dst.u3.all[3] == t2->dst.u3.all[3] && 152 t1->dst.u3.all[3] == t2->dst.u3.all[3] &&
154 t1->dst.u.all == t2->dst.u.all && 153 t1->dst.u.all == t2->dst.u.all &&
155 t1->src.l3num == t2->src.l3num &&
156 t1->dst.protonum == t2->dst.protonum); 154 t1->dst.protonum == t2->dst.protonum);
157} 155}
158 156
159static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, 157static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1,
160 const struct nf_conntrack_tuple *t2) 158 const struct nf_conntrack_tuple *t2)
161{ 159{
162 return nf_ct_tuple_src_equal(t1, t2) && nf_ct_tuple_dst_equal(t1, t2); 160 return __nf_ct_tuple_src_equal(t1, t2) &&
161 __nf_ct_tuple_dst_equal(t1, t2);
163} 162}
164 163
165static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, 164static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1,
@@ -199,7 +198,7 @@ static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t,
199 const struct nf_conntrack_tuple_mask *mask) 198 const struct nf_conntrack_tuple_mask *mask)
200{ 199{
201 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && 200 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) &&
202 nf_ct_tuple_dst_equal(t, tuple); 201 __nf_ct_tuple_dst_equal(t, tuple);
203} 202}
204 203
205#endif /* _NF_CONNTRACK_TUPLE_H */ 204#endif /* _NF_CONNTRACK_TUPLE_H */
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 037e82403f91..8c6b5ae45534 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -54,6 +54,6 @@ void nf_log_packet(int pf,
54 const struct net_device *in, 54 const struct net_device *in,
55 const struct net_device *out, 55 const struct net_device *out,
56 const struct nf_loginfo *li, 56 const struct nf_loginfo *li,
57 const char *fmt, ...); 57 const char *fmt, ...) __attribute__ ((format(printf,7,8)));
58 58
59#endif /* _NF_LOG_H */ 59#endif /* _NF_LOG_H */
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index b3213c7c5309..0ca67d73c7ad 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -36,6 +36,8 @@
36#include <net/netlink.h> 36#include <net/netlink.h>
37#include <asm/atomic.h> 37#include <asm/atomic.h>
38 38
39struct cipso_v4_doi;
40
39/* 41/*
40 * NetLabel - A management interface for maintaining network packet label 42 * NetLabel - A management interface for maintaining network packet label
41 * mapping tables for explicit packet labling protocols. 43 * mapping tables for explicit packet labling protocols.
@@ -103,12 +105,6 @@ struct netlbl_audit {
103 uid_t loginuid; 105 uid_t loginuid;
104}; 106};
105 107
106/* Domain mapping definition struct */
107struct netlbl_dom_map;
108
109/* Domain mapping operations */
110int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);
111
112/* 108/*
113 * LSM security attributes 109 * LSM security attributes
114 */ 110 */
@@ -344,6 +340,19 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
344 340
345#ifdef CONFIG_NETLABEL 341#ifdef CONFIG_NETLABEL
346/* 342/*
343 * LSM configuration operations
344 */
345int netlbl_cfg_map_del(const char *domain, struct netlbl_audit *audit_info);
346int netlbl_cfg_unlbl_add_map(const char *domain,
347 struct netlbl_audit *audit_info);
348int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
349 struct netlbl_audit *audit_info);
350int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def,
351 const char *domain,
352 struct netlbl_audit *audit_info);
353int netlbl_cfg_cipsov4_del(u32 doi, struct netlbl_audit *audit_info);
354
355/*
347 * LSM security attribute operations 356 * LSM security attribute operations
348 */ 357 */
349int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap, 358int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap,
@@ -378,6 +387,32 @@ void netlbl_cache_invalidate(void);
378int netlbl_cache_add(const struct sk_buff *skb, 387int netlbl_cache_add(const struct sk_buff *skb,
379 const struct netlbl_lsm_secattr *secattr); 388 const struct netlbl_lsm_secattr *secattr);
380#else 389#else
390static inline int netlbl_cfg_map_del(const char *domain,
391 struct netlbl_audit *audit_info)
392{
393 return -ENOSYS;
394}
395static inline int netlbl_cfg_unlbl_add_map(const char *domain,
396 struct netlbl_audit *audit_info)
397{
398 return -ENOSYS;
399}
400static inline int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
401 struct netlbl_audit *audit_info)
402{
403 return -ENOSYS;
404}
405static inline int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def,
406 const char *domain,
407 struct netlbl_audit *audit_info)
408{
409 return -ENOSYS;
410}
411static inline int netlbl_cfg_cipsov4_del(u32 doi,
412 struct netlbl_audit *audit_info)
413{
414 return -ENOSYS;
415}
381static inline int netlbl_secattr_catmap_walk( 416static inline int netlbl_secattr_catmap_walk(
382 struct netlbl_lsm_secattr_catmap *catmap, 417 struct netlbl_lsm_secattr_catmap *catmap,
383 u32 offset) 418 u32 offset)
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 15a0b052df22..a9b4f6086294 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -27,5 +27,11 @@ struct netns_ipv4 {
27 struct sock *fibnl; 27 struct sock *fibnl;
28 28
29 struct netns_frags frags; 29 struct netns_frags frags;
30#ifdef CONFIG_NETFILTER
31 struct xt_table *iptable_filter;
32 struct xt_table *iptable_mangle;
33 struct xt_table *iptable_raw;
34 struct xt_table *arptable_filter;
35#endif
30}; 36};
31#endif 37#endif
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 187c4248df22..1dd7de4e4195 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -31,5 +31,10 @@ struct netns_ipv6 {
31 struct ipv6_devconf *devconf_all; 31 struct ipv6_devconf *devconf_all;
32 struct ipv6_devconf *devconf_dflt; 32 struct ipv6_devconf *devconf_dflt;
33 struct netns_frags frags; 33 struct netns_frags frags;
34#ifdef CONFIG_NETFILTER
35 struct xt_table *ip6table_filter;
36 struct xt_table *ip6table_mangle;
37 struct xt_table *ip6table_raw;
38#endif
34}; 39};
35#endif 40#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
new file mode 100644
index 000000000000..0cb63ed2c1fc
--- /dev/null
+++ b/include/net/netns/x_tables.h
@@ -0,0 +1,10 @@
1#ifndef __NETNS_X_TABLES_H
2#define __NETNS_X_TABLES_H
3
4#include <linux/list.h>
5#include <linux/net.h>
6
7struct netns_xt {
8 struct list_head tables[NPROTO];
9};
10#endif
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 8716eb757d51..d349c66ef828 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -131,14 +131,14 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
131 131
132extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, 132extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
133 struct nlattr *rate_tlv, struct tcf_exts *exts, 133 struct nlattr *rate_tlv, struct tcf_exts *exts,
134 struct tcf_ext_map *map); 134 const struct tcf_ext_map *map);
135extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); 135extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts);
136extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, 136extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
137 struct tcf_exts *src); 137 struct tcf_exts *src);
138extern int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, 138extern int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
139 struct tcf_ext_map *map); 139 const struct tcf_ext_map *map);
140extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, 140extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
141 struct tcf_ext_map *map); 141 const struct tcf_ext_map *map);
142 142
143/** 143/**
144 * struct tcf_pkt_info - packet information 144 * struct tcf_pkt_info - packet information
diff --git a/include/net/raw.h b/include/net/raw.h
index cca81d8b2d8b..1828f81fe374 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -41,7 +41,6 @@ extern void raw_proc_exit(void);
41struct raw_iter_state { 41struct raw_iter_state {
42 struct seq_net_private p; 42 struct seq_net_private p;
43 int bucket; 43 int bucket;
44 unsigned short family;
45 struct raw_hashinfo *h; 44 struct raw_hashinfo *h;
46}; 45};
47 46
@@ -49,8 +48,8 @@ struct raw_iter_state {
49void *raw_seq_start(struct seq_file *seq, loff_t *pos); 48void *raw_seq_start(struct seq_file *seq, loff_t *pos);
50void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); 49void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos);
51void raw_seq_stop(struct seq_file *seq, void *v); 50void raw_seq_stop(struct seq_file *seq, void *v);
52int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, 51int raw_seq_open(struct inode *ino, struct file *file,
53 unsigned short family); 52 struct raw_hashinfo *h, const struct seq_operations *ops);
54 53
55#endif 54#endif
56 55
diff --git a/include/net/route.h b/include/net/route.h
index 4eabf008413b..eadad5901429 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -27,6 +27,7 @@
27#include <net/dst.h> 27#include <net/dst.h>
28#include <net/inetpeer.h> 28#include <net/inetpeer.h>
29#include <net/flow.h> 29#include <net/flow.h>
30#include <net/sock.h>
30#include <linux/in_route.h> 31#include <linux/in_route.h>
31#include <linux/rtnetlink.h> 32#include <linux/rtnetlink.h>
32#include <linux/route.h> 33#include <linux/route.h>
@@ -61,6 +62,7 @@ struct rtable
61 62
62 struct in_device *idev; 63 struct in_device *idev;
63 64
65 int rt_genid;
64 unsigned rt_flags; 66 unsigned rt_flags;
65 __u16 rt_type; 67 __u16 rt_type;
66 68
@@ -149,6 +151,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
149 int flags) 151 int flags)
150{ 152{
151 struct flowi fl = { .oif = oif, 153 struct flowi fl = { .oif = oif,
154 .mark = sk->sk_mark,
152 .nl_u = { .ip4_u = { .daddr = dst, 155 .nl_u = { .ip4_u = { .daddr = dst,
153 .saddr = src, 156 .saddr = src,
154 .tos = tos } }, 157 .tos = tos } },
diff --git a/include/net/sock.h b/include/net/sock.h
index 902324488d0f..8a7889b35810 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -262,6 +262,8 @@ struct sock {
262 __u32 sk_sndmsg_off; 262 __u32 sk_sndmsg_off;
263 int sk_write_pending; 263 int sk_write_pending;
264 void *sk_security; 264 void *sk_security;
265 __u32 sk_mark;
266 /* XXX 4 bytes hole on 64 bit */
265 void (*sk_state_change)(struct sock *sk); 267 void (*sk_state_change)(struct sock *sk);
266 void (*sk_data_ready)(struct sock *sk, int bytes); 268 void (*sk_data_ready)(struct sock *sk, int bytes);
267 void (*sk_write_space)(struct sock *sk); 269 void (*sk_write_space)(struct sock *sk);
@@ -494,6 +496,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);
494 496
495struct request_sock_ops; 497struct request_sock_ops;
496struct timewait_sock_ops; 498struct timewait_sock_ops;
499struct inet_hashinfo;
497 500
498/* Networking protocol blocks we attach to sockets. 501/* Networking protocol blocks we attach to sockets.
499 * socket layer -> transport layer interface 502 * socket layer -> transport layer interface
@@ -576,6 +579,8 @@ struct proto {
576 struct request_sock_ops *rsk_prot; 579 struct request_sock_ops *rsk_prot;
577 struct timewait_sock_ops *twsk_prot; 580 struct timewait_sock_ops *twsk_prot;
578 581
582 struct inet_hashinfo *hashinfo;
583
579 struct module *owner; 584 struct module *owner;
580 585
581 char name[32]; 586 char name[32];
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5ebb9ba479b1..ac72116636ca 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -159,6 +159,7 @@ struct xfrm_state
159 struct xfrm_algo *aalg; 159 struct xfrm_algo *aalg;
160 struct xfrm_algo *ealg; 160 struct xfrm_algo *ealg;
161 struct xfrm_algo *calg; 161 struct xfrm_algo *calg;
162 struct xfrm_algo_aead *aead;
162 163
163 /* Data for encapsulator */ 164 /* Data for encapsulator */
164 struct xfrm_encap_tmpl *encap; 165 struct xfrm_encap_tmpl *encap;
@@ -201,7 +202,7 @@ struct xfrm_state
201 202
202 /* Reference to data common to all the instances of this 203 /* Reference to data common to all the instances of this
203 * transformer. */ 204 * transformer. */
204 struct xfrm_type *type; 205 const struct xfrm_type *type;
205 struct xfrm_mode *inner_mode; 206 struct xfrm_mode *inner_mode;
206 struct xfrm_mode *outer_mode; 207 struct xfrm_mode *outer_mode;
207 208
@@ -278,7 +279,7 @@ struct xfrm_state_afinfo {
278 unsigned int proto; 279 unsigned int proto;
279 unsigned int eth_proto; 280 unsigned int eth_proto;
280 struct module *owner; 281 struct module *owner;
281 struct xfrm_type *type_map[IPPROTO_MAX]; 282 const struct xfrm_type *type_map[IPPROTO_MAX];
282 struct xfrm_mode *mode_map[XFRM_MODE_MAX]; 283 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
283 int (*init_flags)(struct xfrm_state *x); 284 int (*init_flags)(struct xfrm_state *x);
284 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 285 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
@@ -321,8 +322,8 @@ struct xfrm_type
321 u32 (*get_mtu)(struct xfrm_state *, int size); 322 u32 (*get_mtu)(struct xfrm_state *, int size);
322}; 323};
323 324
324extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 325extern int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
325extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 326extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
326 327
327struct xfrm_mode { 328struct xfrm_mode {
328 /* 329 /*
@@ -1108,6 +1109,10 @@ static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
1108/* 1109/*
1109 * xfrm algorithm information 1110 * xfrm algorithm information
1110 */ 1111 */
1112struct xfrm_algo_aead_info {
1113 u16 icv_truncbits;
1114};
1115
1111struct xfrm_algo_auth_info { 1116struct xfrm_algo_auth_info {
1112 u16 icv_truncbits; 1117 u16 icv_truncbits;
1113 u16 icv_fullbits; 1118 u16 icv_fullbits;
@@ -1127,6 +1132,7 @@ struct xfrm_algo_desc {
1127 char *compat; 1132 char *compat;
1128 u8 available:1; 1133 u8 available:1;
1129 union { 1134 union {
1135 struct xfrm_algo_aead_info aead;
1130 struct xfrm_algo_auth_info auth; 1136 struct xfrm_algo_auth_info auth;
1131 struct xfrm_algo_encr_info encr; 1137 struct xfrm_algo_encr_info encr;
1132 struct xfrm_algo_comp_info comp; 1138 struct xfrm_algo_comp_info comp;
@@ -1343,6 +1349,8 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id);
1343extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); 1349extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe);
1344extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); 1350extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe);
1345extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); 1351extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe);
1352extern struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len,
1353 int probe);
1346 1354
1347struct hash_desc; 1355struct hash_desc;
1348struct scatterlist; 1356struct scatterlist;
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index d5838c30d20f..87a260e3699e 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -147,11 +147,11 @@ typedef struct config_req_t {
147 147
148/* For RequestIO and ReleaseIO */ 148/* For RequestIO and ReleaseIO */
149typedef struct io_req_t { 149typedef struct io_req_t {
150 ioaddr_t BasePort1; 150 u_int BasePort1;
151 ioaddr_t NumPorts1; 151 u_int NumPorts1;
152 u_int Attributes1; 152 u_int Attributes1;
153 ioaddr_t BasePort2; 153 u_int BasePort2;
154 ioaddr_t NumPorts2; 154 u_int NumPorts2;
155 u_int Attributes2; 155 u_int Attributes2;
156 u_int IOAddrLines; 156 u_int IOAddrLines;
157} io_req_t; 157} io_req_t;
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
index 5f388035687d..9a6bcc4952f0 100644
--- a/include/pcmcia/cs_types.h
+++ b/include/pcmcia/cs_types.h
@@ -27,7 +27,6 @@ typedef u_int ioaddr_t;
27#else 27#else
28typedef u_short ioaddr_t; 28typedef u_short ioaddr_t;
29#endif 29#endif
30typedef unsigned long kio_addr_t;
31 30
32typedef u_short socket_t; 31typedef u_short socket_t;
33typedef u_int event_t; 32typedef u_int event_t;
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 6e84258b94de..f95dca077c1c 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -92,7 +92,7 @@ typedef struct pccard_io_map {
92 u_char map; 92 u_char map;
93 u_char flags; 93 u_char flags;
94 u_short speed; 94 u_short speed;
95 kio_addr_t start, stop; 95 u_int start, stop;
96} pccard_io_map; 96} pccard_io_map;
97 97
98typedef struct pccard_mem_map { 98typedef struct pccard_mem_map {
@@ -155,7 +155,7 @@ extern struct pccard_resource_ops pccard_iodyn_ops;
155struct pcmcia_socket; 155struct pcmcia_socket;
156 156
157typedef struct io_window_t { 157typedef struct io_window_t {
158 kio_addr_t InUse, Config; 158 u_int InUse, Config;
159 struct resource *res; 159 struct resource *res;
160} io_window_t; 160} io_window_t;
161 161
@@ -208,7 +208,7 @@ struct pcmcia_socket {
208 u_int features; 208 u_int features;
209 u_int irq_mask; 209 u_int irq_mask;
210 u_int map_size; 210 u_int map_size;
211 kio_addr_t io_offset; 211 u_int io_offset;
212 u_char pci_irq; 212 u_char pci_irq;
213 struct pci_dev * cb_dev; 213 struct pci_dev * cb_dev;
214 214
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index e466d886e192..4769efd4db24 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -176,7 +176,7 @@ struct class_device_attribute class_device_attr_vport_##_name = \
176 * ports has a unique presense on the SAN, and may be instantiated via 176 * ports has a unique presense on the SAN, and may be instantiated via
177 * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a 177 * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a
178 * unique presense, each vport has it's own view of the fabric, 178 * unique presense, each vport has it's own view of the fabric,
179 * authentication priviledge, and priorities. 179 * authentication privilege, and priorities.
180 * 180 *
181 * A virtual port may support 1 or more FC4 roles. Typically it is a 181 * A virtual port may support 1 or more FC4 roles. Typically it is a
182 * FCP Initiator. It could be a FCP Target, or exist sole for an IP over FC 182 * FCP Initiator. It could be a FCP Target, or exist sole for an IP over FC
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index d04f9e78c7c1..d9aebdf6db63 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -48,7 +48,7 @@
48#define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */ 48#define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
49#define AD1848_PIN_CTRL 0x0a /* pin control */ 49#define AD1848_PIN_CTRL 0x0a /* pin control */
50#define AD1848_TEST_INIT 0x0b /* test and initialization */ 50#define AD1848_TEST_INIT 0x0b /* test and initialization */
51#define AD1848_MISC_INFO 0x0c /* miscellaneaous information */ 51#define AD1848_MISC_INFO 0x0c /* miscellaneous information */
52#define AD1848_LOOPBACK 0x0d /* loopback control */ 52#define AD1848_LOOPBACK 0x0d /* loopback control */
53#define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */ 53#define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */
54#define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */ 54#define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */
diff --git a/include/sound/ainstr_fm.h b/include/sound/ainstr_fm.h
deleted file mode 100644
index c4afb1f121fe..000000000000
--- a/include/sound/ainstr_fm.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * Advanced Linux Sound Architecture
3 *
4 * FM (OPL2/3) Instrument Format
5 * Copyright (c) 2000 Uros Bizjak <uros@kss-loka.si>
6 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __SOUND_AINSTR_FM_H
25#define __SOUND_AINSTR_FM_H
26
27#ifndef __KERNEL__
28#include <asm/types.h>
29#include <asm/byteorder.h>
30#endif
31
32/*
33 * share types (share ID 1)
34 */
35
36#define FM_SHARE_FILE 0
37
38/*
39 * FM operator
40 */
41
42struct fm_operator {
43 unsigned char am_vib;
44 unsigned char ksl_level;
45 unsigned char attack_decay;
46 unsigned char sustain_release;
47 unsigned char wave_select;
48};
49
50/*
51 * Instrument
52 */
53
54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
56
57struct fm_instrument {
58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned char type; /* instrument type */
60
61 struct fm_operator op[4];
62 unsigned char feedback_connection[2];
63
64 unsigned char echo_delay;
65 unsigned char echo_atten;
66 unsigned char chorus_spread;
67 unsigned char trnsps;
68 unsigned char fix_dur;
69 unsigned char modes;
70 unsigned char fix_key;
71};
72
73/*
74 *
75 * Kernel <-> user space
76 * Hardware (CPU) independent section
77 *
78 * * = zero or more
79 * + = one or more
80 *
81 * fm_xinstrument FM_STRU_INSTR
82 *
83 */
84
85#define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
86
87/*
88 * FM operator
89 */
90
91struct fm_xoperator {
92 __u8 am_vib;
93 __u8 ksl_level;
94 __u8 attack_decay;
95 __u8 sustain_release;
96 __u8 wave_select;
97};
98
99/*
100 * Instrument
101 */
102
103struct fm_xinstrument {
104 __u32 stype; /* structure type */
105
106 __u32 share_id[4]; /* share id - zero = no sharing */
107 __u8 type; /* instrument type */
108
109 struct fm_xoperator op[4]; /* fm operators */
110 __u8 feedback_connection[2];
111
112 __u8 echo_delay;
113 __u8 echo_atten;
114 __u8 chorus_spread;
115 __u8 trnsps;
116 __u8 fix_dur;
117 __u8 modes;
118 __u8 fix_key;
119};
120
121#ifdef __KERNEL__
122
123#include "seq_instr.h"
124
125int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops,
126 struct snd_seq_kinstr_ops * next);
127
128#endif
129
130/* typedefs for compatibility to user-space */
131typedef struct fm_xoperator fm_xoperator_t;
132typedef struct fm_xinstrument fm_xinstrument_t;
133
134#endif /* __SOUND_AINSTR_FM_H */
diff --git a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h
deleted file mode 100644
index b62b665c69c6..000000000000
--- a/include/sound/ainstr_gf1.h
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * Advanced Linux Sound Architecture
3 *
4 * GF1 (GUS) Patch Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.cz>
6 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __SOUND_AINSTR_GF1_H
25#define __SOUND_AINSTR_GF1_H
26
27#ifndef __KERNEL__
28#include <asm/types.h>
29#include <asm/byteorder.h>
30#endif
31
32/*
33 * share types (share ID 1)
34 */
35
36#define GF1_SHARE_FILE 0
37
38/*
39 * wave formats
40 */
41
42#define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */
43#define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */
44#define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */
45#define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
46#define GF1_WAVE_LOOP 0x0008 /* loop mode */
47#define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */
48#define GF1_WAVE_STEREO 0x0100 /* stereo mode */
49#define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */
50
51/*
52 * Wavetable definitions
53 */
54
55struct gf1_wave {
56 unsigned int share_id[4]; /* share id - zero = no sharing */
57 unsigned int format; /* wave format */
58
59 struct {
60 unsigned int number; /* some other ID for this instrument */
61 unsigned int memory; /* begin of waveform in onboard memory */
62 unsigned char *ptr; /* pointer to waveform in system memory */
63 } address;
64
65 unsigned int size; /* size of waveform in samples */
66 unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
67 unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
68 unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
69 unsigned short loop_repeat; /* loop repeat - 0 = forever */
70
71 unsigned char flags; /* GF1 patch flags */
72 unsigned char pad;
73 unsigned int sample_rate; /* sample rate in Hz */
74 unsigned int low_frequency; /* low frequency range */
75 unsigned int high_frequency; /* high frequency range */
76 unsigned int root_frequency; /* root frequency range */
77 signed short tune;
78 unsigned char balance;
79 unsigned char envelope_rate[6];
80 unsigned char envelope_offset[6];
81 unsigned char tremolo_sweep;
82 unsigned char tremolo_rate;
83 unsigned char tremolo_depth;
84 unsigned char vibrato_sweep;
85 unsigned char vibrato_rate;
86 unsigned char vibrato_depth;
87 unsigned short scale_frequency;
88 unsigned short scale_factor; /* 0-2048 or 0-2 */
89
90 struct gf1_wave *next;
91};
92
93/*
94 * Instrument
95 */
96
97#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
98#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
99#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
100
101#define IWFFFF_EFFECT_NONE 0
102#define IWFFFF_EFFECT_REVERB 1
103#define IWFFFF_EFFECT_CHORUS 2
104#define IWFFFF_EFFECT_ECHO 3
105
106struct gf1_instrument {
107 unsigned short exclusion;
108 unsigned short exclusion_group; /* 0 - none, 1-65535 */
109
110 unsigned char effect1; /* effect 1 */
111 unsigned char effect1_depth; /* 0-127 */
112 unsigned char effect2; /* effect 2 */
113 unsigned char effect2_depth; /* 0-127 */
114
115 struct gf1_wave *wave; /* first waveform */
116};
117
118/*
119 *
120 * Kernel <-> user space
121 * Hardware (CPU) independent section
122 *
123 * * = zero or more
124 * + = one or more
125 *
126 * gf1_xinstrument IWFFFF_STRU_INSTR
127 * +gf1_xwave IWFFFF_STRU_WAVE
128 *
129 */
130
131#define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
132#define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
133
134/*
135 * Wavetable definitions
136 */
137
138struct gf1_xwave {
139 __u32 stype; /* structure type */
140
141 __u32 share_id[4]; /* share id - zero = no sharing */
142 __u32 format; /* wave format */
143
144 __u32 size; /* size of waveform in samples */
145 __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
146 __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
147 __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
148 __u16 loop_repeat; /* loop repeat - 0 = forever */
149
150 __u8 flags; /* GF1 patch flags */
151 __u8 pad;
152 __u32 sample_rate; /* sample rate in Hz */
153 __u32 low_frequency; /* low frequency range */
154 __u32 high_frequency; /* high frequency range */
155 __u32 root_frequency; /* root frequency range */
156 __s16 tune;
157 __u8 balance;
158 __u8 envelope_rate[6];
159 __u8 envelope_offset[6];
160 __u8 tremolo_sweep;
161 __u8 tremolo_rate;
162 __u8 tremolo_depth;
163 __u8 vibrato_sweep;
164 __u8 vibrato_rate;
165 __u8 vibrato_depth;
166 __u16 scale_frequency;
167 __u16 scale_factor; /* 0-2048 or 0-2 */
168};
169
170/*
171 * Instrument
172 */
173
174struct gf1_xinstrument {
175 __u32 stype;
176
177 __u16 exclusion;
178 __u16 exclusion_group; /* 0 - none, 1-65535 */
179
180 __u8 effect1; /* effect 1 */
181 __u8 effect1_depth; /* 0-127 */
182 __u8 effect2; /* effect 2 */
183 __u8 effect2_depth; /* 0-127 */
184};
185
186/*
187 * Instrument info
188 */
189
190#define GF1_INFO_ENVELOPE (1<<0)
191#define GF1_INFO_TREMOLO (1<<1)
192#define GF1_INFO_VIBRATO (1<<2)
193
194struct gf1_info {
195 unsigned char flags; /* supported wave flags */
196 unsigned char pad[3];
197 unsigned int features; /* supported features */
198 unsigned int max8_len; /* maximum 8-bit wave length */
199 unsigned int max16_len; /* maximum 16-bit wave length */
200};
201
202#ifdef __KERNEL__
203
204#include "seq_instr.h"
205
206struct snd_gf1_ops {
207 void *private_data;
208 int (*info)(void *private_data, struct gf1_info *info);
209 int (*put_sample)(void *private_data, struct gf1_wave *wave,
210 char __user *data, long len, int atomic);
211 int (*get_sample)(void *private_data, struct gf1_wave *wave,
212 char __user *data, long len, int atomic);
213 int (*remove_sample)(void *private_data, struct gf1_wave *wave,
214 int atomic);
215 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
216 struct snd_seq_kinstr_ops kops;
217};
218
219int snd_seq_gf1_init(struct snd_gf1_ops *ops,
220 void *private_data,
221 struct snd_seq_kinstr_ops *next);
222
223#endif
224
225/* typedefs for compatibility to user-space */
226typedef struct gf1_xwave gf1_xwave_t;
227typedef struct gf1_xinstrument gf1_xinstrument_t;
228
229#endif /* __SOUND_AINSTR_GF1_H */
diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h
deleted file mode 100644
index 11bd25082600..000000000000
--- a/include/sound/ainstr_iw.h
+++ /dev/null
@@ -1,384 +0,0 @@
1/*
2 * Advanced Linux Sound Architecture
3 *
4 * InterWave FFFF Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.cz>
6 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __SOUND_AINSTR_IW_H
25#define __SOUND_AINSTR_IW_H
26
27#ifndef __KERNEL__
28#include <asm/types.h>
29#include <asm/byteorder.h>
30#endif
31
32/*
33 * share types (share ID 1)
34 */
35
36#define IWFFFF_SHARE_FILE 0
37
38/*
39 * wave formats
40 */
41
42#define IWFFFF_WAVE_16BIT 0x0001 /* 16-bit wave */
43#define IWFFFF_WAVE_UNSIGNED 0x0002 /* unsigned wave */
44#define IWFFFF_WAVE_INVERT 0x0002 /* same as unsigned wave */
45#define IWFFFF_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
46#define IWFFFF_WAVE_LOOP 0x0008 /* loop mode */
47#define IWFFFF_WAVE_BIDIR 0x0010 /* bidirectional mode */
48#define IWFFFF_WAVE_ULAW 0x0020 /* uLaw compressed wave */
49#define IWFFFF_WAVE_RAM 0x0040 /* wave is _preloaded_ in RAM (it is used for ROM simulation) */
50#define IWFFFF_WAVE_ROM 0x0080 /* wave is in ROM */
51#define IWFFFF_WAVE_STEREO 0x0100 /* wave is stereo */
52
53/*
54 * Wavetable definitions
55 */
56
57struct iwffff_wave {
58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned int format; /* wave format */
60
61 struct {
62 unsigned int number; /* some other ID for this wave */
63 unsigned int memory; /* begin of waveform in onboard memory */
64 unsigned char *ptr; /* pointer to waveform in system memory */
65 } address;
66
67 unsigned int size; /* size of waveform in samples */
68 unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
69 unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
70 unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
71 unsigned short loop_repeat; /* loop repeat - 0 = forever */
72 unsigned int sample_ratio; /* sample ratio (44100 * 1024 / rate) */
73 unsigned char attenuation; /* 0 - 127 (no corresponding midi controller) */
74 unsigned char low_note; /* lower frequency range for this waveform */
75 unsigned char high_note; /* higher frequency range for this waveform */
76 unsigned char pad;
77
78 struct iwffff_wave *next;
79};
80
81/*
82 * Layer
83 */
84
85#define IWFFFF_LFO_SHAPE_TRIANGLE 0
86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
87
88struct iwffff_lfo {
89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
90 signed short depth; /* volume +- (0-255) 0.48675dB/step */
91 signed short sweep; /* 0 - 950 deciseconds */
92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
93 unsigned char delay; /* 0 - 255 deciseconds */
94};
95
96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
97
98#define IWFFFF_ENV_MODE_ONE_SHOT 0x0001 /* mode - one shot */
99#define IWFFFF_ENV_MODE_SUSTAIN 0x0002 /* mode - sustain */
100#define IWFFFF_ENV_MODE_NO_SUSTAIN 0x0003 /* mode - no sustain */
101
102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
104
105struct iwffff_env_point {
106 unsigned short offset;
107 unsigned short rate;
108};
109
110struct iwffff_env_record {
111 unsigned short nattack;
112 unsigned short nrelease;
113 unsigned short sustain_offset;
114 unsigned short sustain_rate;
115 unsigned short release_rate;
116 unsigned char hirange;
117 unsigned char pad;
118 struct iwffff_env_record *next;
119 /* points are stored here */
120 /* count of points = nattack + nrelease */
121};
122
123struct iwffff_env {
124 unsigned char flags;
125 unsigned char mode;
126 unsigned char index;
127 unsigned char pad;
128 struct iwffff_env_record *record;
129};
130
131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
132
133#define IWFFFF_LAYER_VELOCITY_TIME 0x0000 /* velocity mode = time */
134#define IWFFFF_LAYER_VELOCITY_RATE 0x0001 /* velocity mode = rate */
135
136#define IWFFFF_LAYER_EVENT_KUP 0x0000 /* layer event - key up */
137#define IWFFFF_LAYER_EVENT_KDOWN 0x0001 /* layer event - key down */
138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
140
141struct iwffff_layer {
142 unsigned char flags;
143 unsigned char velocity_mode;
144 unsigned char layer_event;
145 unsigned char low_range; /* range for layer based */
146 unsigned char high_range; /* on either velocity or frequency */
147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */
149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
150 struct iwffff_lfo tremolo; /* tremolo effect */
151 struct iwffff_lfo vibrato; /* vibrato effect */
152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
153 unsigned char freq_center; /* center for keyboard frequency scaling */
154 unsigned char pad;
155 struct iwffff_env penv; /* pitch envelope */
156 struct iwffff_env venv; /* volume envelope */
157
158 struct iwffff_wave *wave;
159 struct iwffff_layer *next;
160};
161
162/*
163 * Instrument
164 */
165
166#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
167#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
168#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
169
170#define IWFFFF_LAYER_NONE 0x0000 /* not layered */
171#define IWFFFF_LAYER_ON 0x0001 /* layered */
172#define IWFFFF_LAYER_VELOCITY 0x0002 /* layered by velocity */
173#define IWFFFF_LAYER_FREQUENCY 0x0003 /* layered by frequency */
174
175#define IWFFFF_EFFECT_NONE 0
176#define IWFFFF_EFFECT_REVERB 1
177#define IWFFFF_EFFECT_CHORUS 2
178#define IWFFFF_EFFECT_ECHO 3
179
180struct iwffff_instrument {
181 unsigned short exclusion;
182 unsigned short layer_type;
183 unsigned short exclusion_group; /* 0 - none, 1-65535 */
184
185 unsigned char effect1; /* effect 1 */
186 unsigned char effect1_depth; /* 0-127 */
187 unsigned char effect2; /* effect 2 */
188 unsigned char effect2_depth; /* 0-127 */
189
190 struct iwffff_layer *layer; /* first layer */
191};
192
193/*
194 *
195 * Kernel <-> user space
196 * Hardware (CPU) independent section
197 *
198 * * = zero or more
199 * + = one or more
200 *
201 * iwffff_xinstrument IWFFFF_STRU_INSTR
202 * +iwffff_xlayer IWFFFF_STRU_LAYER
203 * *iwffff_xenv_record IWFFFF_STRU_ENV_RECT (tremolo)
204 * *iwffff_xenv_record IWFFFF_STRU_EVN_RECT (vibrato)
205 * +iwffff_xwave IWFFFF_STRU_WAVE
206 *
207 */
208
209#define IWFFFF_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
210#define IWFFFF_STRU_ENV_RECP __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'P')
211#define IWFFFF_STRU_ENV_RECV __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'V')
212#define IWFFFF_STRU_LAYER __cpu_to_be32(('L'<<24)|('A'<<16)|('Y'<<8)|'R')
213#define IWFFFF_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
214
215/*
216 * Wavetable definitions
217 */
218
219struct iwffff_xwave {
220 __u32 stype; /* structure type */
221
222 __u32 share_id[4]; /* share id - zero = no sharing */
223
224 __u32 format; /* wave format */
225 __u32 offset; /* offset to ROM (address) */
226
227 __u32 size; /* size of waveform in samples */
228 __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
229 __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
230 __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
231 __u16 loop_repeat; /* loop repeat - 0 = forever */
232 __u32 sample_ratio; /* sample ratio (44100 * 1024 / rate) */
233 __u8 attenuation; /* 0 - 127 (no corresponding midi controller) */
234 __u8 low_note; /* lower frequency range for this waveform */
235 __u8 high_note; /* higher frequency range for this waveform */
236 __u8 pad;
237};
238
239/*
240 * Layer
241 */
242
243struct iwffff_xlfo {
244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */
246 __s16 sweep; /* 0 - 950 deciseconds */
247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
248 __u8 delay; /* 0 - 255 deciseconds */
249};
250
251struct iwffff_xenv_point {
252 __u16 offset;
253 __u16 rate;
254};
255
256struct iwffff_xenv_record {
257 __u32 stype;
258 __u16 nattack;
259 __u16 nrelease;
260 __u16 sustain_offset;
261 __u16 sustain_rate;
262 __u16 release_rate;
263 __u8 hirange;
264 __u8 pad;
265 /* points are stored here.. */
266 /* count of points = nattack + nrelease */
267};
268
269struct iwffff_xenv {
270 __u8 flags;
271 __u8 mode;
272 __u8 index;
273 __u8 pad;
274};
275
276struct iwffff_xlayer {
277 __u32 stype;
278 __u8 flags;
279 __u8 velocity_mode;
280 __u8 layer_event;
281 __u8 low_range; /* range for layer based */
282 __u8 high_range; /* on either velocity or frequency */
283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
284 __u8 pan_freq_scale; /* position based on frequency (0-127) */
285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */
286 struct iwffff_xlfo tremolo; /* tremolo effect */
287 struct iwffff_xlfo vibrato; /* vibrato effect */
288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
289 __u8 freq_center; /* center for keyboard frequency scaling */
290 __u8 pad;
291 struct iwffff_xenv penv; /* pitch envelope */
292 struct iwffff_xenv venv; /* volume envelope */
293};
294
295/*
296 * Instrument
297 */
298
299struct iwffff_xinstrument {
300 __u32 stype;
301
302 __u16 exclusion;
303 __u16 layer_type;
304 __u16 exclusion_group; /* 0 - none, 1-65535 */
305
306 __u8 effect1; /* effect 1 */
307 __u8 effect1_depth; /* 0-127 */
308 __u8 effect2; /* effect 2 */
309 __u8 effect2_depth; /* 0-127 */
310};
311
312/*
313 * ROM support
314 * InterWave ROMs are Little-Endian (x86)
315 */
316
317#define IWFFFF_ROM_HDR_SIZE 512
318
319struct iwffff_rom_header {
320 __u8 iwave[8];
321 __u8 revision;
322 __u8 series_number;
323 __u8 series_name[16];
324 __u8 date[10];
325 __u16 vendor_revision_major;
326 __u16 vendor_revision_minor;
327 __u32 rom_size;
328 __u8 copyright[128];
329 __u8 vendor_name[64];
330 __u8 description[128];
331};
332
333/*
334 * Instrument info
335 */
336
337#define IWFFFF_INFO_LFO_VIBRATO (1<<0)
338#define IWFFFF_INFO_LFO_VIBRATO_SHAPE (1<<1)
339#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
341
342struct iwffff_info {
343 unsigned int format; /* supported format bits */
344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
345 unsigned int lfos; /* LFO effects */
346 unsigned int max8_len; /* maximum 8-bit wave length */
347 unsigned int max16_len; /* maximum 16-bit wave length */
348};
349
350#ifdef __KERNEL__
351
352#include "seq_instr.h"
353
354struct snd_iwffff_ops {
355 void *private_data;
356 int (*info)(void *private_data, struct iwffff_info *info);
357 int (*put_sample)(void *private_data, struct iwffff_wave *wave,
358 char __user *data, long len, int atomic);
359 int (*get_sample)(void *private_data, struct iwffff_wave *wave,
360 char __user *data, long len, int atomic);
361 int (*remove_sample)(void *private_data, struct iwffff_wave *wave,
362 int atomic);
363 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
364 struct snd_seq_kinstr_ops kops;
365};
366
367int snd_seq_iwffff_init(struct snd_iwffff_ops *ops,
368 void *private_data,
369 struct snd_seq_kinstr_ops *next);
370
371#endif
372
373/* typedefs for compatibility to user-space */
374typedef struct iwffff_xwave iwffff_xwave_t;
375typedef struct iwffff_xlfo iwffff_xlfo_t;
376typedef struct iwffff_xenv_point iwffff_xenv_point_t;
377typedef struct iwffff_xenv_record iwffff_xenv_record_t;
378typedef struct iwffff_xenv iwffff_xenv_t;
379typedef struct iwffff_xlayer iwffff_xlayer_t;
380typedef struct iwffff_xinstrument iwffff_xinstrument_t;
381typedef struct iwffff_rom_header iwffff_rom_header_t;
382typedef struct iwffff_info iwffff_info_t;
383
384#endif /* __SOUND_AINSTR_IW_H */
diff --git a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h
deleted file mode 100644
index da08e7287557..000000000000
--- a/include/sound/ainstr_simple.h
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * Advanced Linux Sound Architecture
3 *
4 * Simple (MOD player) Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.cz>
6 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __SOUND_AINSTR_SIMPLE_H
25#define __SOUND_AINSTR_SIMPLE_H
26
27#ifndef __KERNEL__
28#include <asm/types.h>
29#include <asm/byteorder.h>
30#endif
31
32/*
33 * share types (share ID 1)
34 */
35
36#define SIMPLE_SHARE_FILE 0
37
38/*
39 * wave formats
40 */
41
42#define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */
43#define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */
44#define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */
45#define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
46#define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */
47#define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */
48#define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */
49#define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */
50
51/*
52 * instrument effects
53 */
54
55#define SIMPLE_EFFECT_NONE 0
56#define SIMPLE_EFFECT_REVERB 1
57#define SIMPLE_EFFECT_CHORUS 2
58#define SIMPLE_EFFECT_ECHO 3
59
60/*
61 * instrument info
62 */
63
64struct simple_instrument_info {
65 unsigned int format; /* supported format bits */
66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
67 unsigned int max8_len; /* maximum 8-bit wave length */
68 unsigned int max16_len; /* maximum 16-bit wave length */
69};
70
71/*
72 * Instrument
73 */
74
75struct simple_instrument {
76 unsigned int share_id[4]; /* share id - zero = no sharing */
77 unsigned int format; /* wave format */
78
79 struct {
80 unsigned int number; /* some other ID for this instrument */
81 unsigned int memory; /* begin of waveform in onboard memory */
82 unsigned char *ptr; /* pointer to waveform in system memory */
83 } address;
84
85 unsigned int size; /* size of waveform in samples */
86 unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
87 unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
88 unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */
89 unsigned short loop_repeat; /* loop repeat - 0 = forever */
90
91 unsigned char effect1; /* effect 1 */
92 unsigned char effect1_depth; /* 0-127 */
93 unsigned char effect2; /* effect 2 */
94 unsigned char effect2_depth; /* 0-127 */
95};
96
97/*
98 *
99 * Kernel <-> user space
100 * Hardware (CPU) independent section
101 *
102 * * = zero or more
103 * + = one or more
104 *
105 * simple_xinstrument SIMPLE_STRU_INSTR
106 *
107 */
108
109#define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
110
111/*
112 * Instrument
113 */
114
115struct simple_xinstrument {
116 __u32 stype;
117
118 __u32 share_id[4]; /* share id - zero = no sharing */
119 __u32 format; /* wave format */
120
121 __u32 size; /* size of waveform in samples */
122 __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
123 __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
124 __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
125 __u16 loop_repeat; /* loop repeat - 0 = forever */
126
127 __u8 effect1; /* effect 1 */
128 __u8 effect1_depth; /* 0-127 */
129 __u8 effect2; /* effect 2 */
130 __u8 effect2_depth; /* 0-127 */
131};
132
133#ifdef __KERNEL__
134
135#include "seq_instr.h"
136
137struct snd_simple_ops {
138 void *private_data;
139 int (*info)(void *private_data, struct simple_instrument_info *info);
140 int (*put_sample)(void *private_data, struct simple_instrument *instr,
141 char __user *data, long len, int atomic);
142 int (*get_sample)(void *private_data, struct simple_instrument *instr,
143 char __user *data, long len, int atomic);
144 int (*remove_sample)(void *private_data, struct simple_instrument *instr,
145 int atomic);
146 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
147 struct snd_seq_kinstr_ops kops;
148};
149
150int snd_seq_simple_init(struct snd_simple_ops *ops,
151 void *private_data,
152 struct snd_seq_kinstr_ops *next);
153
154#endif
155
156/* typedefs for compatibility to user-space */
157typedef struct simple_xinstrument simple_xinstrument_t;
158
159#endif /* __SOUND_AINSTR_SIMPLE_H */
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index 891cf1aea8b1..6153b91cdc3e 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -68,7 +68,7 @@ struct snd_akm4xxx {
68 enum { 68 enum {
69 SND_AK4524, SND_AK4528, SND_AK4529, 69 SND_AK4524, SND_AK4528, SND_AK4529,
70 SND_AK4355, SND_AK4358, SND_AK4381, 70 SND_AK4355, SND_AK4358, SND_AK4381,
71 SND_AK5365 71 SND_AK5365, NON_AKM
72 } type; 72 } type;
73 73
74 /* (array) information of combined codecs */ 74 /* (array) information of combined codecs */
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 64daccbe8b29..1505e6d5ef82 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -110,18 +110,7 @@
110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
112 112
113/** synthesizer events 113/* 70-89: synthesizer events - obsoleted */
114 * event data type = snd_seq_eve_sample_control
115 */
116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
118#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */
119#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */
120#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */
121#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */
122#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */
123#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */
124#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */
125 114
126/** user-defined events with fixed length 115/** user-defined events with fixed length
127 * event data type = any 116 * event data type = any
@@ -137,28 +126,7 @@
137#define SNDRV_SEQ_EVENT_USR8 98 126#define SNDRV_SEQ_EVENT_USR8 98
138#define SNDRV_SEQ_EVENT_USR9 99 127#define SNDRV_SEQ_EVENT_USR9 99
139 128
140/** instrument layer 129/* 100-118: instrument layer - obsoleted */
141 * variable length data can be passed directly to the driver
142 */
143#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */
144#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */
145#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */
146#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */
147#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */
148#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */
149#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */
150#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */
151#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */
152#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */
153#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */
154#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */
155#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */
156#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */
157#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */
158#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */
159#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */
160#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */
161#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */
162/* 119-129: reserved */ 130/* 119-129: reserved */
163 131
164/* 130-139: variable length events 132/* 130-139: variable length events
@@ -258,78 +226,6 @@ struct snd_seq_ev_ext {
258 void *ptr; /* pointer to data (note: maybe 64-bit) */ 226 void *ptr; /* pointer to data (note: maybe 64-bit) */
259} __attribute__((packed)); 227} __attribute__((packed));
260 228
261/* Instrument cluster type */
262typedef unsigned int snd_seq_instr_cluster_t;
263
264/* Instrument type */
265struct snd_seq_instr {
266 snd_seq_instr_cluster_t cluster;
267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
268 unsigned short bank;
269 unsigned short prg;
270};
271
272 /* sample number */
273struct snd_seq_ev_sample {
274 unsigned int std;
275 unsigned short bank;
276 unsigned short prg;
277};
278
279 /* sample cluster */
280struct snd_seq_ev_cluster {
281 snd_seq_instr_cluster_t cluster;
282};
283
284 /* sample position */
285typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
286
287 /* sample stop mode */
288enum {
289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
292};
293
294 /* sample frequency */
295typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
296
297 /* sample volume control; if any value is set to -1 == do not change */
298struct snd_seq_ev_volume {
299 signed short volume; /* range: 0-16383 */
300 signed short lr; /* left-right balance; range: 0-16383 */
301 signed short fr; /* front-rear balance; range: 0-16383 */
302 signed short du; /* down-up balance; range: 0-16383 */
303};
304
305 /* simple loop redefinition */
306struct snd_seq_ev_loop {
307 unsigned int start; /* loop start (in samples) * 16 */
308 unsigned int end; /* loop end (in samples) * 16 */
309};
310
311struct snd_seq_ev_sample_control {
312 unsigned char channel;
313 unsigned char unused1, unused2, unused3; /* pad */
314 union {
315 struct snd_seq_ev_sample sample;
316 struct snd_seq_ev_cluster cluster;
317 snd_seq_position_t position;
318 int stop_mode;
319 snd_seq_frequency_t frequency;
320 struct snd_seq_ev_volume volume;
321 struct snd_seq_ev_loop loop;
322 unsigned char raw8[8];
323 } param;
324};
325
326
327
328/* INSTR_BEGIN event */
329struct snd_seq_ev_instr_begin {
330 int timeout; /* zero = forever, otherwise timeout in ms */
331};
332
333struct snd_seq_result { 229struct snd_seq_result {
334 int event; /* processed event type */ 230 int event; /* processed event type */
335 int result; 231 int result;
@@ -399,8 +295,6 @@ struct snd_seq_event {
399 struct snd_seq_addr addr; 295 struct snd_seq_addr addr;
400 struct snd_seq_connect connect; 296 struct snd_seq_connect connect;
401 struct snd_seq_result result; 297 struct snd_seq_result result;
402 struct snd_seq_ev_instr_begin instr_begin;
403 struct snd_seq_ev_sample_control sample;
404 struct snd_seq_ev_quote quote; 298 struct snd_seq_ev_quote quote;
405 } data; 299 } data;
406}; 300};
@@ -441,8 +335,6 @@ struct snd_seq_event_bounce {
441#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) 335#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
442/* fixed length events: 0-99 */ 336/* fixed length events: 0-99 */
443#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100) 337#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
444/* instrument layer events: 100-129 */
445#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
446/* variable length events: 130-139 */ 338/* variable length events: 130-139 */
447#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) 339#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
448/* reserved for kernel */ 340/* reserved for kernel */
@@ -738,136 +630,6 @@ struct snd_seq_query_subs {
738 630
739 631
740/* 632/*
741 * Instrument abstraction layer
742 * - based on events
743 */
744
745/* instrument types */
746#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
747#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
748
749/* instrument ASCII identifiers */
750#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
751#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
752#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
753#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
754#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
755#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
756#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
757#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
758
759/* instrument types */
760#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
761#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
762#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
763#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
764#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
765#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
766#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
767#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
768
769/* put commands */
770#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
771#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
772#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
773#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
774#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
775
776/* get commands */
777#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
778#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
779
780/* query flags */
781#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
782
783/* free commands */
784#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
785#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
786#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
787#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
788
789/* size of ROM/RAM */
790typedef unsigned int snd_seq_instr_size_t;
791
792/* INSTR_INFO */
793
794struct snd_seq_instr_info {
795 int result; /* operation result */
796 unsigned int formats[8]; /* bitmap of supported formats */
797 int ram_count; /* count of RAM banks */
798 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
799 int rom_count; /* count of ROM banks */
800 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
801 char reserved[128];
802};
803
804/* INSTR_STATUS */
805
806struct snd_seq_instr_status {
807 int result; /* operation result */
808 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
809 int instrument_count; /* count of downloaded instruments */
810 char reserved[128];
811};
812
813/* INSTR_FORMAT_INFO */
814
815struct snd_seq_instr_format_info {
816 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
817 unsigned int len; /* max data length (without this structure) */
818};
819
820struct snd_seq_instr_format_info_result {
821 int result; /* operation result */
822 char format[16]; /* format identifier */
823 unsigned int len; /* filled data length (without this structure) */
824};
825
826/* instrument data */
827struct snd_seq_instr_data {
828 char name[32]; /* instrument name */
829 char reserved[16]; /* for the future use */
830 int type; /* instrument type */
831 union {
832 char format[16]; /* format identifier */
833 struct snd_seq_instr alias;
834 } data;
835};
836
837/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
838
839struct snd_seq_instr_header {
840 union {
841 struct snd_seq_instr instr;
842 snd_seq_instr_cluster_t cluster;
843 } id; /* instrument identifier */
844 unsigned int cmd; /* get/put/free command */
845 unsigned int flags; /* query flags (only for get) */
846 unsigned int len; /* real instrument data length (without header) */
847 int result; /* operation result */
848 char reserved[16]; /* for the future */
849 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
850};
851
852/* INSTR_CLUSTER_SET */
853
854struct snd_seq_instr_cluster_set {
855 snd_seq_instr_cluster_t cluster; /* cluster identifier */
856 char name[32]; /* cluster name */
857 int priority; /* cluster priority */
858 char reserved[64]; /* for the future use */
859};
860
861/* INSTR_CLUSTER_GET */
862
863struct snd_seq_instr_cluster_get {
864 snd_seq_instr_cluster_t cluster; /* cluster identifier */
865 char name[32]; /* cluster name */
866 int priority; /* cluster priority */
867 char reserved[64]; /* for the future use */
868};
869
870/*
871 * IOCTL commands 633 * IOCTL commands
872 */ 634 */
873 635
diff --git a/include/sound/asound.h b/include/sound/asound.h
index af9d11d315e9..3eaf155b850d 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -95,7 +95,7 @@ enum {
95 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 95 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
96 96
97 /* Don't forget to change the following: */ 97 /* Don't forget to change the following: */
98 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC 98 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_HDA
99}; 99};
100 100
101struct snd_hwdep_info { 101struct snd_hwdep_info {
@@ -138,7 +138,7 @@ enum {
138 * * 138 * *
139 *****************************************************************************/ 139 *****************************************************************************/
140 140
141#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8) 141#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
142 142
143typedef unsigned long snd_pcm_uframes_t; 143typedef unsigned long snd_pcm_uframes_t;
144typedef signed long snd_pcm_sframes_t; 144typedef signed long snd_pcm_sframes_t;
@@ -354,8 +354,8 @@ struct snd_pcm_hw_params {
354 354
355enum { 355enum {
356 SNDRV_PCM_TSTAMP_NONE = 0, 356 SNDRV_PCM_TSTAMP_NONE = 0,
357 SNDRV_PCM_TSTAMP_MMAP, 357 SNDRV_PCM_TSTAMP_ENABLE,
358 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, 358 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
359}; 359};
360 360
361struct snd_pcm_sw_params { 361struct snd_pcm_sw_params {
@@ -363,7 +363,7 @@ struct snd_pcm_sw_params {
363 unsigned int period_step; 363 unsigned int period_step;
364 unsigned int sleep_min; /* min ticks to sleep */ 364 unsigned int sleep_min; /* min ticks to sleep */
365 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ 365 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
366 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 366 snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
367 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ 367 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
368 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ 368 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
369 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 369 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
@@ -435,9 +435,16 @@ struct snd_xfern {
435}; 435};
436 436
437enum { 437enum {
438 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
439 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
440 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
441};
442
443enum {
438 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 444 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
439 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info), 445 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info),
440 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 446 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
447 SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int),
441 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params), 448 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params),
442 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params), 449 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params),
443 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 450 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
@@ -689,7 +696,7 @@ struct snd_timer_tread {
689 * * 696 * *
690 ****************************************************************************/ 697 ****************************************************************************/
691 698
692#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4) 699#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
693 700
694struct snd_ctl_card_info { 701struct snd_ctl_card_info {
695 int card; /* card number */ 702 int card; /* card number */
@@ -738,8 +745,7 @@ typedef int __bitwise snd_ctl_elem_iface_t;
738#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ 745#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
739#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ 746#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
740#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ 747#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
741#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ 748/* bits 30 and 31 are obsoleted (for indirect access) */
742#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */
743 749
744/* for further details see the ACPI and PCI power management specification */ 750/* for further details see the ACPI and PCI power management specification */
745#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ 751#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
@@ -793,30 +799,30 @@ struct snd_ctl_elem_info {
793 } value; 799 } value;
794 union { 800 union {
795 unsigned short d[4]; /* dimensions */ 801 unsigned short d[4]; /* dimensions */
796 unsigned short *d_ptr; /* indirect */ 802 unsigned short *d_ptr; /* indirect - obsoleted */
797 } dimen; 803 } dimen;
798 unsigned char reserved[64-4*sizeof(unsigned short)]; 804 unsigned char reserved[64-4*sizeof(unsigned short)];
799}; 805};
800 806
801struct snd_ctl_elem_value { 807struct snd_ctl_elem_value {
802 struct snd_ctl_elem_id id; /* W: element ID */ 808 struct snd_ctl_elem_id id; /* W: element ID */
803 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */ 809 unsigned int indirect: 1; /* W: indirect access - obsoleted */
804 union { 810 union {
805 union { 811 union {
806 long value[128]; 812 long value[128];
807 long *value_ptr; 813 long *value_ptr; /* obsoleted */
808 } integer; 814 } integer;
809 union { 815 union {
810 long long value[64]; 816 long long value[64];
811 long long *value_ptr; 817 long long *value_ptr; /* obsoleted */
812 } integer64; 818 } integer64;
813 union { 819 union {
814 unsigned int item[128]; 820 unsigned int item[128];
815 unsigned int *item_ptr; 821 unsigned int *item_ptr; /* obsoleted */
816 } enumerated; 822 } enumerated;
817 union { 823 union {
818 unsigned char data[512]; 824 unsigned char data[512];
819 unsigned char *data_ptr; 825 unsigned char *data_ptr; /* obsoleted */
820 } bytes; 826 } bytes;
821 struct snd_aes_iec958 iec958; 827 struct snd_aes_iec958 iec958;
822 } value; /* RO */ 828 } value; /* RO */
diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h
index 8fbcab7cc73b..c2a4b967d5be 100644
--- a/include/sound/asound_fm.h
+++ b/include/sound/asound_fm.h
@@ -104,6 +104,8 @@ struct snd_dm_fm_params {
104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
105/* for OPL3 only */ 105/* for OPL3 only */
106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
107/* SBI patch management */
108#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
107 109
108#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 110#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
109#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 111#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
@@ -112,4 +114,21 @@ struct snd_dm_fm_params {
112#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 114#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
113#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 115#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
114 116
117/*
118 * Patch Record - fixed size for write
119 */
120
121#define FM_KEY_SBI "SBI\032"
122#define FM_KEY_2OP "2OP\032"
123#define FM_KEY_4OP "4OP\032"
124
125struct sbi_patch {
126 unsigned char prog;
127 unsigned char bank;
128 char key[4];
129 char name[25];
130 char extension[7];
131 unsigned char data[32];
132};
133
115#endif /* __SOUND_ASOUND_FM_H */ 134#endif /* __SOUND_ASOUND_FM_H */
diff --git a/include/sound/core.h b/include/sound/core.h
index 6954836487ed..4fc0235ad784 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -22,12 +22,22 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/module.h>
25#include <linux/sched.h> /* wake_up() */ 26#include <linux/sched.h> /* wake_up() */
26#include <linux/mutex.h> /* struct mutex */ 27#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 28#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
29#include <linux/device.h> 30#include <linux/device.h>
30 31
32/* number of supported soundcards */
33#ifdef CONFIG_SND_DYNAMIC_MINORS
34#define SNDRV_CARDS 32
35#else
36#define SNDRV_CARDS 8 /* don't change - minor numbers */
37#endif
38
39#define CONFIG_SND_MAJOR 116 /* standard configuration */
40
31/* forward declarations */ 41/* forward declarations */
32#ifdef CONFIG_PCI 42#ifdef CONFIG_PCI
33struct pci_dev; 43struct pci_dev;
diff --git a/include/sound/cs4231-regs.h b/include/sound/cs4231-regs.h
index f1490265c9b8..e8d1f3e31f9e 100644
--- a/include/sound/cs4231-regs.h
+++ b/include/sound/cs4231-regs.h
@@ -45,7 +45,7 @@
45#define CS4231_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */ 45#define CS4231_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
46#define CS4231_PIN_CTRL 0x0a /* pin control */ 46#define CS4231_PIN_CTRL 0x0a /* pin control */
47#define CS4231_TEST_INIT 0x0b /* test and initialization */ 47#define CS4231_TEST_INIT 0x0b /* test and initialization */
48#define CS4231_MISC_INFO 0x0c /* miscellaneaous information */ 48#define CS4231_MISC_INFO 0x0c /* miscellaneous information */
49#define CS4231_LOOPBACK 0x0d /* loopback control */ 49#define CS4231_LOOPBACK 0x0d /* loopback control */
50#define CS4231_PLY_UPR_CNT 0x0e /* playback upper base count */ 50#define CS4231_PLY_UPR_CNT 0x0e /* playback upper base count */
51#define CS4231_PLY_LWR_CNT 0x0f /* playback lower base count */ 51#define CS4231_PLY_LWR_CNT 0x0f /* playback lower base count */
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 6b40ee60f4c5..e3005a674a24 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1708,9 +1708,6 @@ struct snd_cs46xx {
1708 1708
1709 struct gameport *gameport; 1709 struct gameport *gameport;
1710 1710
1711#ifdef CONFIG_SND_CS46XX_DEBUG_GPIO
1712 int current_gpio;
1713#endif
1714#ifdef CONFIG_SND_CS46XX_NEW_DSP 1711#ifdef CONFIG_SND_CS46XX_NEW_DSP
1715 struct mutex spos_mutex; 1712 struct mutex spos_mutex;
1716 1713
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 5ccb6c5feecb..f0359437d01a 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -1,51 +1 @@
1#ifndef __SOUND_DRIVER_H #warning "This file is deprecated"
2#define __SOUND_DRIVER_H
3
4/*
5 * Main header file for the ALSA driver
6 * Copyright (c) 1994-2000 by Jaroslav Kysela <perex@perex.cz>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifdef ALSA_BUILD
26#include "config.h"
27#endif
28
29
30/* number of supported soundcards */
31#ifdef CONFIG_SND_DYNAMIC_MINORS
32#define SNDRV_CARDS 32
33#else
34#define SNDRV_CARDS 8 /* don't change - minor numbers */
35#endif
36
37#ifndef CONFIG_SND_MAJOR /* standard configuration */
38#define CONFIG_SND_MAJOR 116
39#endif
40
41#ifndef CONFIG_SND_DEBUG
42#undef CONFIG_SND_DEBUG_MEMORY
43#endif
44
45#ifdef ALSA_BUILD
46#include "adriver.h"
47#endif
48
49#include <linux/module.h>
50
51#endif /* __SOUND_DRIVER_H */
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 441aa06dcd6f..7b7b9b13b4dd 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1120,6 +1120,99 @@
1120/************************************************************************************************/ 1120/************************************************************************************************/
1121/* EMU1010m HANA Destinations */ 1121/* EMU1010m HANA Destinations */
1122/************************************************************************************************/ 1122/************************************************************************************************/
1123/* Hana, original 1010,1212,1820 using Alice2
1124 * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
1125 * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2
1126 * 0x01, 0x10-0x1f: 32 Elink channels to Audio Dock
1127 * 0x01, 0x00: Dock DAC 1 Left
1128 * 0x01, 0x04: Dock DAC 1 Right
1129 * 0x01, 0x08: Dock DAC 2 Left
1130 * 0x01, 0x0c: Dock DAC 2 Right
1131 * 0x01, 0x10: Dock DAC 3 Left
1132 * 0x01, 0x12: PHONES Left
1133 * 0x01, 0x14: Dock DAC 3 Right
1134 * 0x01, 0x16: PHONES Right
1135 * 0x01, 0x18: Dock DAC 4 Left
1136 * 0x01, 0x1a: S/PDIF Left
1137 * 0x01, 0x1c: Dock DAC 4 Right
1138 * 0x01, 0x1e: S/PDIF Right
1139 * 0x02, 0x00: Hana S/PDIF Left
1140 * 0x02, 0x01: Hana S/PDIF Right
1141 * 0x03, 0x00: Hanoa DAC Left
1142 * 0x03, 0x01: Hanoa DAC Right
1143 * 0x04, 0x00-0x07: Hana ADAT
1144 * 0x05, 0x00: I2S0 Left to Alice2
1145 * 0x05, 0x01: I2S0 Right to Alice2
1146 * 0x06, 0x00: I2S0 Left to Alice2
1147 * 0x06, 0x01: I2S0 Right to Alice2
1148 * 0x07, 0x00: I2S0 Left to Alice2
1149 * 0x07, 0x01: I2S0 Right to Alice2
1150 *
1151 * Hana2 never released, but used Tina
1152 * Not needed.
1153 *
1154 * Hana3, rev2 1010,1212,1616 using Tina
1155 * Destinations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
1156 * 0x00, 0x00-0x0f: 16 EMU32A channels to Tina
1157 * 0x01, 0x10-0x1f: 32 EDI channels to Micro Dock
1158 * 0x01, 0x00: Dock DAC 1 Left
1159 * 0x01, 0x04: Dock DAC 1 Right
1160 * 0x01, 0x08: Dock DAC 2 Left
1161 * 0x01, 0x0c: Dock DAC 2 Right
1162 * 0x01, 0x10: Dock DAC 3 Left
1163 * 0x01, 0x12: Dock S/PDIF Left
1164 * 0x01, 0x14: Dock DAC 3 Right
1165 * 0x01, 0x16: Dock S/PDIF Right
1166 * 0x01, 0x18-0x1f: Dock ADAT 0-7
1167 * 0x02, 0x00: Hana3 S/PDIF Left
1168 * 0x02, 0x01: Hana3 S/PDIF Right
1169 * 0x03, 0x00: Hanoa DAC Left
1170 * 0x03, 0x01: Hanoa DAC Right
1171 * 0x04, 0x00-0x07: Hana3 ADAT 0-7
1172 * 0x05, 0x00-0x0f: 16 EMU32B channels to Tina
1173 * 0x06-0x07: Not used
1174 *
1175 * HanaLite, rev1 0404 using Alice2
1176 * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
1177 * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2
1178 * 0x01: Not used
1179 * 0x02, 0x00: S/PDIF Left
1180 * 0x02, 0x01: S/PDIF Right
1181 * 0x03, 0x00: DAC Left
1182 * 0x03, 0x01: DAC Right
1183 * 0x04-0x07: Not used
1184 *
1185 * HanaLiteLite, rev2 0404 using Alice2
1186 * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
1187 * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2
1188 * 0x01: Not used
1189 * 0x02, 0x00: S/PDIF Left
1190 * 0x02, 0x01: S/PDIF Right
1191 * 0x03, 0x00: DAC Left
1192 * 0x03, 0x01: DAC Right
1193 * 0x04-0x07: Not used
1194 *
1195 * Mana, Cardbus 1616 using Tina2
1196 * Destinations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
1197 * 0x00, 0x00-0x0f: 16 EMU32A channels to Tina2
1198 * 0x01, 0x10-0x1f: 32 EDI channels to Micro Dock
1199 * 0x01, 0x00: Dock DAC 1 Left
1200 * 0x01, 0x04: Dock DAC 1 Right
1201 * 0x01, 0x08: Dock DAC 2 Left
1202 * 0x01, 0x0c: Dock DAC 2 Right
1203 * 0x01, 0x10: Dock DAC 3 Left
1204 * 0x01, 0x12: Dock S/PDIF Left
1205 * 0x01, 0x14: Dock DAC 3 Right
1206 * 0x01, 0x16: Dock S/PDIF Right
1207 * 0x01, 0x18-0x1f: Dock ADAT 0-7
1208 * 0x02: Not used
1209 * 0x03, 0x00: Mana DAC Left
1210 * 0x03, 0x01: Mana DAC Right
1211 * 0x04, 0x00-0x0f: 16 EMU32B channels to Tina2
1212 * 0x05-0x07: Not used
1213 *
1214 *
1215 */
1123/* 32-bit destinations of signal in the Hana FPGA. Destinations are either 1216/* 32-bit destinations of signal in the Hana FPGA. Destinations are either
1124 * physical outputs of Hana, or outputs going to Alice2 (audigy) for capture 1217 * physical outputs of Hana, or outputs going to Alice2 (audigy) for capture
1125 * - 16 x EMU_DST_ALICE2_EMU32_X. 1218 * - 16 x EMU_DST_ALICE2_EMU32_X.
@@ -1206,9 +1299,122 @@
1206#define EMU_DST_ALICE_I2S2_LEFT 0x0700 /* Alice2 I2S2 Left */ 1299#define EMU_DST_ALICE_I2S2_LEFT 0x0700 /* Alice2 I2S2 Left */
1207#define EMU_DST_ALICE_I2S2_RIGHT 0x0701 /* Alice2 I2S2 Right */ 1300#define EMU_DST_ALICE_I2S2_RIGHT 0x0701 /* Alice2 I2S2 Right */
1208 1301
1302/* Additional destinations for 1616(M)/Microdock */
1303/* Microdock S/PDIF OUT Left, 1st or 48kHz only */
1304#define EMU_DST_MDOCK_SPDIF_LEFT1 0x0112
1305/* Microdock S/PDIF OUT Left, 2nd or 96kHz */
1306#define EMU_DST_MDOCK_SPDIF_LEFT2 0x0113
1307/* Microdock S/PDIF OUT Right, 1st or 48kHz only */
1308#define EMU_DST_MDOCK_SPDIF_RIGHT1 0x0116
1309/* Microdock S/PDIF OUT Right, 2nd or 96kHz */
1310#define EMU_DST_MDOCK_SPDIF_RIGHT2 0x0117
1311/* Microdock S/PDIF ADAT 8 channel out +8 to +f */
1312#define EMU_DST_MDOCK_ADAT 0x0118
1313
1314/* Headphone jack on 1010 cardbus? 44.1/48kHz only? */
1315#define EMU_DST_MANA_DAC_LEFT 0x0300
1316/* Headphone jack on 1010 cardbus? 44.1/48kHz only? */
1317#define EMU_DST_MANA_DAC_RIGHT 0x0301
1318
1209/************************************************************************************************/ 1319/************************************************************************************************/
1210/* EMU1010m HANA Sources */ 1320/* EMU1010m HANA Sources */
1211/************************************************************************************************/ 1321/************************************************************************************************/
1322/* Hana, original 1010,1212,1820 using Alice2
1323 * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
1324 * 0x00,0x00-0x1f: Silence
1325 * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock
1326 * 0x01, 0x00: Dock Mic A
1327 * 0x01, 0x04: Dock Mic B
1328 * 0x01, 0x08: Dock ADC 1 Left
1329 * 0x01, 0x0c: Dock ADC 1 Right
1330 * 0x01, 0x10: Dock ADC 2 Left
1331 * 0x01, 0x14: Dock ADC 2 Right
1332 * 0x01, 0x18: Dock ADC 3 Left
1333 * 0x01, 0x1c: Dock ADC 3 Right
1334 * 0x02, 0x00: Hana ADC Left
1335 * 0x02, 0x01: Hana ADC Right
1336 * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output
1337 * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output
1338 * 0x04, 0x00-0x07: Hana ADAT
1339 * 0x05, 0x00: Hana S/PDIF Left
1340 * 0x05, 0x01: Hana S/PDIF Right
1341 * 0x06-0x07: Not used
1342 *
1343 * Hana2 never released, but used Tina
1344 * Not needed.
1345 *
1346 * Hana3, rev2 1010,1212,1616 using Tina
1347 * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
1348 * 0x00,0x00-0x1f: Silence
1349 * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock
1350 * 0x01, 0x00: Dock Mic A
1351 * 0x01, 0x04: Dock Mic B
1352 * 0x01, 0x08: Dock ADC 1 Left
1353 * 0x01, 0x0c: Dock ADC 1 Right
1354 * 0x01, 0x10: Dock ADC 2 Left
1355 * 0x01, 0x12: Dock S/PDIF Left
1356 * 0x01, 0x14: Dock ADC 2 Right
1357 * 0x01, 0x16: Dock S/PDIF Right
1358 * 0x01, 0x18-0x1f: Dock ADAT 0-7
1359 * 0x01, 0x18: Dock ADC 3 Left
1360 * 0x01, 0x1c: Dock ADC 3 Right
1361 * 0x02, 0x00: Hanoa ADC Left
1362 * 0x02, 0x01: Hanoa ADC Right
1363 * 0x03, 0x00-0x0f: 16 inputs from Tina Emu32A output
1364 * 0x03, 0x10-0x1f: 16 inputs from Tina Emu32B output
1365 * 0x04, 0x00-0x07: Hana3 ADAT
1366 * 0x05, 0x00: Hana3 S/PDIF Left
1367 * 0x05, 0x01: Hana3 S/PDIF Right
1368 * 0x06-0x07: Not used
1369 *
1370 * HanaLite, rev1 0404 using Alice2
1371 * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
1372 * 0x00,0x00-0x1f: Silence
1373 * 0x01: Not used
1374 * 0x02, 0x00: ADC Left
1375 * 0x02, 0x01: ADC Right
1376 * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output
1377 * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output
1378 * 0x04: Not used
1379 * 0x05, 0x00: S/PDIF Left
1380 * 0x05, 0x01: S/PDIF Right
1381 * 0x06-0x07: Not used
1382 *
1383 * HanaLiteLite, rev2 0404 using Alice2
1384 * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
1385 * 0x00,0x00-0x1f: Silence
1386 * 0x01: Not used
1387 * 0x02, 0x00: ADC Left
1388 * 0x02, 0x01: ADC Right
1389 * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output
1390 * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output
1391 * 0x04: Not used
1392 * 0x05, 0x00: S/PDIF Left
1393 * 0x05, 0x01: S/PDIF Right
1394 * 0x06-0x07: Not used
1395 *
1396 * Mana, Cardbus 1616 using Tina2
1397 * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
1398 * 0x00,0x00-0x1f: Silence
1399 * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock
1400 * 0x01, 0x00: Dock Mic A
1401 * 0x01, 0x04: Dock Mic B
1402 * 0x01, 0x08: Dock ADC 1 Left
1403 * 0x01, 0x0c: Dock ADC 1 Right
1404 * 0x01, 0x10: Dock ADC 2 Left
1405 * 0x01, 0x12: Dock S/PDIF Left
1406 * 0x01, 0x14: Dock ADC 2 Right
1407 * 0x01, 0x16: Dock S/PDIF Right
1408 * 0x01, 0x18-0x1f: Dock ADAT 0-7
1409 * 0x01, 0x18: Dock ADC 3 Left
1410 * 0x01, 0x1c: Dock ADC 3 Right
1411 * 0x02: Not used
1412 * 0x03, 0x00-0x0f: 16 inputs from Tina Emu32A output
1413 * 0x03, 0x10-0x1f: 16 inputs from Tina Emu32B output
1414 * 0x04-0x07: Not used
1415 *
1416 */
1417
1212/* 32-bit sources of signal in the Hana FPGA. The sources are routed to 1418/* 32-bit sources of signal in the Hana FPGA. The sources are routed to
1213 * destinations using mixer control for each destination - see emumixer.c 1419 * destinations using mixer control for each destination - see emumixer.c
1214 * Sources are either physical inputs of FPGA, 1420 * Sources are either physical inputs of FPGA,
@@ -1263,6 +1469,19 @@
1263#define EMU_SRC_HANA_SPDIF_LEFT2 0x0502 /* Hana SPDIF Left, 2nd or 96kHz */ 1469#define EMU_SRC_HANA_SPDIF_LEFT2 0x0502 /* Hana SPDIF Left, 2nd or 96kHz */
1264#define EMU_SRC_HANA_SPDIF_RIGHT1 0x0501 /* Hana SPDIF Right, 1st or 48kHz only */ 1470#define EMU_SRC_HANA_SPDIF_RIGHT1 0x0501 /* Hana SPDIF Right, 1st or 48kHz only */
1265#define EMU_SRC_HANA_SPDIF_RIGHT2 0x0503 /* Hana SPDIF Right, 2nd or 96kHz */ 1471#define EMU_SRC_HANA_SPDIF_RIGHT2 0x0503 /* Hana SPDIF Right, 2nd or 96kHz */
1472
1473/* Additional inputs for 1616(M)/Microdock */
1474/* Microdock S/PDIF Left, 1st or 48kHz only */
1475#define EMU_SRC_MDOCK_SPDIF_LEFT1 0x0112
1476/* Microdock S/PDIF Left, 2nd or 96kHz */
1477#define EMU_SRC_MDOCK_SPDIF_LEFT2 0x0113
1478/* Microdock S/PDIF Right, 1st or 48kHz only */
1479#define EMU_SRC_MDOCK_SPDIF_RIGHT1 0x0116
1480/* Microdock S/PDIF Right, 2nd or 96kHz */
1481#define EMU_SRC_MDOCK_SPDIF_RIGHT2 0x0117
1482/* Microdock ADAT 8 channel in +8 to +f */
1483#define EMU_SRC_MDOCK_ADAT 0x0118
1484
1266/* 0x600 and 0x700 no used */ 1485/* 0x600 and 0x700 no used */
1267 1486
1268/* ------------------- STRUCTURES -------------------- */ 1487/* ------------------- STRUCTURES -------------------- */
@@ -1423,6 +1642,14 @@ struct snd_emu10k1_midi {
1423 void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status); 1642 void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1424}; 1643};
1425 1644
1645enum {
1646 EMU_MODEL_SB,
1647 EMU_MODEL_EMU1010,
1648 EMU_MODEL_EMU1010B,
1649 EMU_MODEL_EMU1616,
1650 EMU_MODEL_EMU0404,
1651};
1652
1426struct snd_emu_chip_details { 1653struct snd_emu_chip_details {
1427 u32 vendor; 1654 u32 vendor;
1428 u32 device; 1655 u32 device;
@@ -1439,7 +1666,7 @@ struct snd_emu_chip_details {
1439 unsigned char spdif_bug; /* Has Spdif phasing bug */ 1666 unsigned char spdif_bug; /* Has Spdif phasing bug */
1440 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ 1667 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */
1441 unsigned char ecard; /* APS EEPROM */ 1668 unsigned char ecard; /* APS EEPROM */
1442 unsigned char emu1010; /* EMU 1010m card */ 1669 unsigned char emu_model; /* EMU model type */
1443 unsigned char spi_dac; /* SPI interface for DAC */ 1670 unsigned char spi_dac; /* SPI interface for DAC */
1444 unsigned char i2c_adc; /* I2C interface for ADC */ 1671 unsigned char i2c_adc; /* I2C interface for ADC */
1445 unsigned char adc_1361t; /* Use Philips 1361T ADC */ 1672 unsigned char adc_1361t; /* Use Philips 1361T ADC */
@@ -1515,6 +1742,8 @@ struct snd_emu10k1 {
1515 spinlock_t reg_lock; 1742 spinlock_t reg_lock;
1516 spinlock_t emu_lock; 1743 spinlock_t emu_lock;
1517 spinlock_t voice_lock; 1744 spinlock_t voice_lock;
1745 spinlock_t spi_lock; /* serialises access to spi port */
1746 spinlock_t i2c_lock; /* serialises access to i2c port */
1518 1747
1519 struct snd_emu10k1_voice voices[NUM_G]; 1748 struct snd_emu10k1_voice voices[NUM_G];
1520 struct snd_emu10k1_voice p16v_voices[4]; 1749 struct snd_emu10k1_voice p16v_voices[4];
diff --git a/include/sound/gus.h b/include/sound/gus.h
index e5433d8b78bc..841bb8df38c1 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -27,13 +27,8 @@
27#include "timer.h" 27#include "timer.h"
28#include "seq_midi_emul.h" 28#include "seq_midi_emul.h"
29#include "seq_device.h" 29#include "seq_device.h"
30#include "ainstr_iw.h"
31#include "ainstr_gf1.h"
32#include "ainstr_simple.h"
33#include <asm/io.h> 30#include <asm/io.h>
34 31
35#define SNDRV_SEQ_DEV_ID_GUS "gus-synth"
36
37/* IO ports */ 32/* IO ports */
38 33
39#define GUSP(gus, x) ((gus)->gf1.port + SNDRV_g_u_s_##x) 34#define GUSP(gus, x) ((gus)->gf1.port + SNDRV_g_u_s_##x)
@@ -234,16 +229,6 @@ struct snd_gus_port {
234 229
235struct snd_gus_voice; 230struct snd_gus_voice;
236 231
237struct snd_gus_sample_ops {
238 void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);
239 void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);
240 void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);
241 void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);
242 void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);
243 void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);
244 void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);
245};
246
247#define SNDRV_GF1_VOICE_TYPE_PCM 0 232#define SNDRV_GF1_VOICE_TYPE_PCM 0
248#define SNDRV_GF1_VOICE_TYPE_SYNTH 1 233#define SNDRV_GF1_VOICE_TYPE_SYNTH 1
249#define SNDRV_GF1_VOICE_TYPE_MIDI 2 234#define SNDRV_GF1_VOICE_TYPE_MIDI 2
@@ -284,12 +269,8 @@ struct snd_gus_voice {
284 269
285 struct snd_gus_sample_ops *sample_ops; 270 struct snd_gus_sample_ops *sample_ops;
286 271
287 struct snd_seq_instr instr;
288
289 /* running status / registers */ 272 /* running status / registers */
290 273
291 struct snd_seq_ev_volume sample_volume;
292
293 unsigned short fc_register; 274 unsigned short fc_register;
294 unsigned short fc_lfo; 275 unsigned short fc_lfo;
295 unsigned short gf1_volume; 276 unsigned short gf1_volume;
@@ -382,10 +363,6 @@ struct snd_gf1 {
382 363
383 int seq_client; 364 int seq_client;
384 struct snd_gus_port seq_ports[4]; 365 struct snd_gus_port seq_ports[4];
385 struct snd_seq_kinstr_list *ilist;
386 struct snd_iwffff_ops iwffff_ops;
387 struct snd_gf1_ops gf1_ops;
388 struct snd_simple_ops simple_ops;
389 366
390 /* timer */ 367 /* timer */
391 368
@@ -458,8 +435,6 @@ struct snd_gus_card {
458 struct snd_rawmidi_substream *midi_substream_output; 435 struct snd_rawmidi_substream *midi_substream_output;
459 struct snd_rawmidi_substream *midi_substream_input; 436 struct snd_rawmidi_substream *midi_substream_input;
460 437
461 struct snd_seq_device *seq_dev;
462
463 spinlock_t reg_lock; 438 spinlock_t reg_lock;
464 spinlock_t voice_alloc; 439 spinlock_t voice_alloc;
465 spinlock_t active_voice_lock; 440 spinlock_t active_voice_lock;
@@ -647,48 +622,10 @@ void snd_gus_irq_profile_init(struct snd_gus_card *gus);
647 622
648int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi); 623int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);
649 624
650#if 0
651extern void snd_engine_instrument_register(unsigned short mode,
652 struct _SND_INSTRUMENT_VOICE_COMMANDS *voice_cmds,
653 struct _SND_INSTRUMENT_NOTE_COMMANDS *note_cmds,
654 struct _SND_INSTRUMENT_CHANNEL_COMMANDS *channel_cmds);
655extern int snd_engine_instrument_register_ask(unsigned short mode);
656#endif
657
658/* gus_dram.c */ 625/* gus_dram.c */
659int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr, 626int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
660 unsigned int addr, unsigned int size); 627 unsigned int addr, unsigned int size);
661int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr, 628int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
662 unsigned int addr, unsigned int size, int rom); 629 unsigned int addr, unsigned int size, int rom);
663 630
664#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
665
666/* gus_sample.c */
667void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p);
668
669/* gus_simple.c */
670void snd_gf1_simple_init(struct snd_gus_voice *voice);
671
672/* gus_instr.c */
673int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave,
674 char __user *data, long len, int atomic);
675int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave,
676 char __user *data, long len, int atomic);
677int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave,
678 int atomic);
679int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave,
680 char __user *data, long len, int atomic);
681int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave,
682 char __user *data, long len, int atomic);
683int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave,
684 int atomic);
685int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr,
686 char __user *data, long len, int atomic);
687int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr,
688 char __user *data, long len, int atomic);
689int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr,
690 int atomic);
691
692#endif /* CONFIG_SND_SEQUENCER */
693
694#endif /* __SOUND_GUS_H */ 631#endif /* __SOUND_GUS_H */
diff --git a/include/sound/info.h b/include/sound/info.h
index fecbb1ffd540..8ae72e74f898 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -100,8 +100,10 @@ int snd_info_minor_unregister(void);
100extern struct snd_info_entry *snd_seq_root; 100extern struct snd_info_entry *snd_seq_root;
101#ifdef CONFIG_SND_OSSEMUL 101#ifdef CONFIG_SND_OSSEMUL
102extern struct snd_info_entry *snd_oss_root; 102extern struct snd_info_entry *snd_oss_root;
103void snd_card_info_read_oss(struct snd_info_buffer *buffer);
103#else 104#else
104#define snd_oss_root NULL 105#define snd_oss_root NULL
106static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
105#endif 107#endif
106 108
107int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); 109int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index 1d14b3f82393..a0c5febdc4ea 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -51,19 +51,16 @@
51 * 51 *
52 */ 52 */
53 53
54#include "driver.h" 54#include <sound/core.h>
55#include <linux/time.h> 55#include <sound/hwdep.h>
56#include <linux/mutex.h> 56#include <sound/timer.h>
57#include "core.h" 57#include <sound/seq_midi_emul.h>
58#include "hwdep.h"
59#include "timer.h"
60#include "seq_midi_emul.h"
61#ifdef CONFIG_SND_SEQUENCER_OSS 58#ifdef CONFIG_SND_SEQUENCER_OSS
62#include "seq_oss.h" 59#include <sound/seq_oss.h>
63#include "seq_oss_legacy.h" 60#include <sound/seq_oss_legacy.h>
64#endif 61#endif
65#include "seq_device.h" 62#include <sound/seq_device.h>
66#include "ainstr_fm.h" 63#include <sound/asound_fm.h>
67 64
68/* 65/*
69 * Register numbers for the global registers 66 * Register numbers for the global registers
@@ -240,6 +237,47 @@
240struct snd_opl3; 237struct snd_opl3;
241 238
242/* 239/*
240 * Instrument record, aka "Patch"
241 */
242
243/* FM operator */
244struct fm_operator {
245 unsigned char am_vib;
246 unsigned char ksl_level;
247 unsigned char attack_decay;
248 unsigned char sustain_release;
249 unsigned char wave_select;
250} __attribute__((packed));
251
252/* Instrument data */
253struct fm_instrument {
254 struct fm_operator op[4];
255 unsigned char feedback_connection[2];
256 unsigned char echo_delay;
257 unsigned char echo_atten;
258 unsigned char chorus_spread;
259 unsigned char trnsps;
260 unsigned char fix_dur;
261 unsigned char modes;
262 unsigned char fix_key;
263};
264
265/* type */
266#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
267#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
268
269/* Instrument record */
270struct fm_patch {
271 unsigned char prog;
272 unsigned char bank;
273 unsigned char type;
274 struct fm_instrument inst;
275 char name[24];
276 struct fm_patch *next;
277};
278
279
280/*
243 * A structure to keep track of each hardware voice 281 * A structure to keep track of each hardware voice
244 */ 282 */
245struct snd_opl3_voice { 283struct snd_opl3_voice {
@@ -277,9 +315,9 @@ struct snd_opl3 {
277 void *private_data; 315 void *private_data;
278 void (*private_free)(struct snd_opl3 *); 316 void (*private_free)(struct snd_opl3 *);
279 317
318 struct snd_hwdep *hwdep;
280 spinlock_t reg_lock; 319 spinlock_t reg_lock;
281 struct snd_card *card; /* The card that this belongs to */ 320 struct snd_card *card; /* The card that this belongs to */
282 int used; /* usage flag - exclusive */
283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 321 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
284 unsigned char rhythm; /* percussion mode flag */ 322 unsigned char rhythm; /* percussion mode flag */
285 unsigned char max_voices; /* max number of voices */ 323 unsigned char max_voices; /* max number of voices */
@@ -297,8 +335,8 @@ struct snd_opl3 {
297 struct snd_midi_channel_set * oss_chset; 335 struct snd_midi_channel_set * oss_chset;
298#endif 336#endif
299 337
300 struct snd_seq_kinstr_ops fm_ops; 338#define OPL3_PATCH_HASH_SIZE 32
301 struct snd_seq_kinstr_list *ilist; 339 struct fm_patch *patch_table[OPL3_PATCH_HASH_SIZE];
302 340
303 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ 341 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
304 int use_time; /* allocation counter */ 342 int use_time; /* allocation counter */
@@ -312,7 +350,6 @@ struct snd_opl3 {
312 int sys_timer_status; /* system timer run status */ 350 int sys_timer_status; /* system timer run status */
313 spinlock_t sys_timer_lock; /* Lock for system timer access */ 351 spinlock_t sys_timer_lock; /* Lock for system timer access */
314#endif 352#endif
315 struct mutex access_mutex; /* locking */
316}; 353};
317 354
318/* opl3.c */ 355/* opl3.c */
@@ -333,8 +370,19 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device,
333int snd_opl3_open(struct snd_hwdep * hw, struct file *file); 370int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
334int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, 371int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
335 unsigned int cmd, unsigned long arg); 372 unsigned int cmd, unsigned long arg);
373long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count,
374 loff_t *offset);
336int snd_opl3_release(struct snd_hwdep * hw, struct file *file); 375int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
337 376
338void snd_opl3_reset(struct snd_opl3 * opl3); 377void snd_opl3_reset(struct snd_opl3 * opl3);
339 378
379int snd_opl3_load_patch(struct snd_opl3 *opl3,
380 int prog, int bank, int type,
381 const char *name,
382 const unsigned char *ext,
383 const unsigned char *data);
384struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank,
385 int create_patch);
386void snd_opl3_clear_patches(struct snd_opl3 *opl3);
387
340#endif /* __SOUND_OPL3_H */ 388#endif /* __SOUND_OPL3_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 5e9cc460075e..51d58ccda2d8 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -274,7 +274,6 @@ struct snd_pcm_runtime {
274 snd_pcm_uframes_t period_size; /* period size */ 274 snd_pcm_uframes_t period_size; /* period size */
275 unsigned int periods; /* periods */ 275 unsigned int periods; /* periods */
276 snd_pcm_uframes_t buffer_size; /* buffer size */ 276 snd_pcm_uframes_t buffer_size; /* buffer size */
277 unsigned int tick_time; /* tick time */
278 snd_pcm_uframes_t min_align; /* Min alignment for the format */ 277 snd_pcm_uframes_t min_align; /* Min alignment for the format */
279 size_t byte_align; 278 size_t byte_align;
280 unsigned int frame_bits; 279 unsigned int frame_bits;
@@ -286,8 +285,6 @@ struct snd_pcm_runtime {
286 /* -- SW params -- */ 285 /* -- SW params -- */
287 int tstamp_mode; /* mmap timestamp is updated */ 286 int tstamp_mode; /* mmap timestamp is updated */
288 unsigned int period_step; 287 unsigned int period_step;
289 unsigned int sleep_min; /* min ticks to sleep */
290 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
291 snd_pcm_uframes_t start_threshold; 288 snd_pcm_uframes_t start_threshold;
292 snd_pcm_uframes_t stop_threshold; 289 snd_pcm_uframes_t stop_threshold;
293 snd_pcm_uframes_t silence_threshold; /* Silence filling happens when 290 snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
@@ -306,7 +303,6 @@ struct snd_pcm_runtime {
306 303
307 /* -- locking / scheduling -- */ 304 /* -- locking / scheduling -- */
308 wait_queue_head_t sleep; 305 wait_queue_head_t sleep;
309 struct timer_list tick_timer;
310 struct fasync_struct *fasync; 306 struct fasync_struct *fasync;
311 307
312 /* -- private section -- */ 308 /* -- private section -- */
@@ -323,6 +319,7 @@ struct snd_pcm_runtime {
323 319
324 /* -- timer -- */ 320 /* -- timer -- */
325 unsigned int timer_resolution; /* timer resolution */ 321 unsigned int timer_resolution; /* timer resolution */
322 int tstamp_type; /* timestamp type */
326 323
327 /* -- DMA -- */ 324 /* -- DMA -- */
328 unsigned char *dma_area; /* DMA area */ 325 unsigned char *dma_area; /* DMA area */
@@ -810,7 +807,6 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc
810#define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min 807#define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min
811#define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min 808#define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min
812#define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min 809#define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min
813#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
814 810
815 811
816int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); 812int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
@@ -908,9 +904,6 @@ int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
908int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream); 904int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
909int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream); 905int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
910void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr); 906void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
911void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
912void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
913void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
914void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); 907void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
915snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, 908snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
916 const void __user *buf, 909 const void __user *buf,
@@ -952,6 +945,15 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
952void snd_pcm_timer_init(struct snd_pcm_substream *substream); 945void snd_pcm_timer_init(struct snd_pcm_substream *substream);
953void snd_pcm_timer_done(struct snd_pcm_substream *substream); 946void snd_pcm_timer_done(struct snd_pcm_substream *substream);
954 947
948static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
949 struct timespec *tv)
950{
951 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC)
952 do_posix_clock_monotonic_gettime(tv);
953 else
954 getnstimeofday(tv);
955}
956
955/* 957/*
956 * Memory 958 * Memory
957 */ 959 */
diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h
deleted file mode 100644
index 93b0c51df5b0..000000000000
--- a/include/sound/seq_instr.h
+++ /dev/null
@@ -1,110 +0,0 @@
1#ifndef __SOUND_SEQ_INSTR_H
2#define __SOUND_SEQ_INSTR_H
3
4/*
5 * Main kernel header file for the ALSA sequencer
6 * Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24#include "seq_kernel.h"
25
26/* Instrument cluster */
27struct snd_seq_kcluster {
28 snd_seq_instr_cluster_t cluster;
29 char name[32];
30 int priority;
31 struct snd_seq_kcluster *next;
32};
33
34/* return pointer to private data */
35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
36
37/* Instrument structure */
38struct snd_seq_kinstr {
39 struct snd_seq_instr instr;
40 char name[32];
41 int type; /* instrument type */
42 int use; /* use count */
43 int busy; /* not useable */
44 int add_len; /* additional length */
45 struct snd_seq_kinstr_ops *ops; /* operations */
46 struct snd_seq_kinstr *next;
47};
48
49#define SNDRV_SEQ_INSTR_HASH_SIZE 32
50
51/* Instrument flags */
52#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
53
54/* List of all instruments */
55struct snd_seq_kinstr_list {
56 struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
57 int count; /* count of all instruments */
58
59 struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
60 int ccount; /* count of all clusters */
61
62 int owner; /* current owner of the instrument list */
63 unsigned int flags;
64
65 spinlock_t lock;
66 spinlock_t ops_lock;
67 struct mutex ops_mutex;
68 unsigned long ops_flags;
69};
70
71#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
72#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
73
74struct snd_seq_kinstr_ops {
75 void *private_data;
76 long add_len; /* additional length */
77 char *instr_type;
78 int (*info)(void *private_data, char *info_data, long len);
79 int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
80 char __user *instr_data, long len, int atomic, int cmd);
81 int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
82 char __user *instr_data, long len, int atomic, int cmd);
83 int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
84 int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
85 void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
86 struct snd_seq_kinstr_ops *next;
87};
88
89
90/* instrument operations */
91struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
92void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
93int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
94 struct snd_seq_instr_header *ifree,
95 int client,
96 int atomic);
97struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
98 struct snd_seq_instr *instr,
99 int exact,
100 int follow_alias);
101void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
102 struct snd_seq_kinstr *instr);
103int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
104 struct snd_seq_kinstr_list *list,
105 struct snd_seq_event *ev,
106 int client,
107 int atomic,
108 int hop);
109
110#endif /* __SOUND_SEQ_INSTR_H */
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 2b1ae8edc43c..a105b01e06d5 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -22,7 +22,7 @@
22#define SND_SOC_NOPM -1 22#define SND_SOC_NOPM -1
23 23
24/* 24/*
25 * SoC dynamic audio power managment 25 * SoC dynamic audio power management
26 * 26 *
27 * We can have upto 4 power domains 27 * We can have upto 4 power domains
28 * 1. Codec domain - VREF, VMID 28 * 1. Codec domain - VREF, VMID
@@ -131,18 +131,34 @@
131 .shift = wshift, .invert = winvert} 131 .shift = wshift, .invert = winvert}
132 132
133/* dapm kcontrol types */ 133/* dapm kcontrol types */
134#define SOC_DAPM_SINGLE(xname, reg, shift, mask, invert) \ 134#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
135{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 135{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
136 .info = snd_soc_info_volsw, \ 136 .info = snd_soc_info_volsw, \
137 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 137 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
138 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } 138 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
139#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, mask, invert, \ 139#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \
140 power) \ 140 power) \
141{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 141{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
142 .info = snd_soc_info_volsw, \ 142 .info = snd_soc_info_volsw, \
143 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 143 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
144 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\ 144 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
145 ((mask) << 16) | ((invert) << 24) } 145 ((max) << 16) | ((invert) << 24) }
146#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
147{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
148 .info = snd_soc_info_volsw, \
149 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
150 .tlv.p = (tlv_array), \
151 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
152 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
153#define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \
154 power, tlv_array) \
155{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
156 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
157 .tlv.p = (tlv_array), \
158 .info = snd_soc_info_volsw, \
159 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
160 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
161 ((max) << 16) | ((invert) << 24) }
146#define SOC_DAPM_ENUM(xname, xenum) \ 162#define SOC_DAPM_ENUM(xname, xenum) \
147{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 163{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
148 .info = snd_soc_info_enum_double, \ 164 .info = snd_soc_info_enum_double, \
@@ -199,6 +215,7 @@ void snd_soc_dapm_free(struct snd_soc_device *socdev);
199/* dapm events */ 215/* dapm events */
200int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, 216int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
201 int event); 217 int event);
218int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event);
202 219
203/* dapm sys fs - used by the core */ 220/* dapm sys fs - used by the core */
204int snd_soc_dapm_sys_add(struct device *dev); 221int snd_soc_dapm_sys_add(struct device *dev);
@@ -272,7 +289,7 @@ struct snd_soc_dapm_widget {
272 289
273 /* external events */ 290 /* external events */
274 unsigned short event_flags; /* flags to specify event types */ 291 unsigned short event_flags; /* flags to specify event types */
275 int (*event)(struct snd_soc_dapm_widget*, int); 292 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int);
276 293
277 /* kcontrols that relate to this widget */ 294 /* kcontrols that relate to this widget */
278 int num_kcontrols; 295 int num_kcontrols;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f47ef1f75f18..e6ea6f750941 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -16,38 +16,63 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <sound/driver.h>
20#include <sound/core.h> 19#include <sound/core.h>
21#include <sound/pcm.h> 20#include <sound/pcm.h>
22#include <sound/control.h> 21#include <sound/control.h>
23#include <sound/ac97_codec.h> 22#include <sound/ac97_codec.h>
24 23
25#define SND_SOC_VERSION "0.13.1" 24#define SND_SOC_VERSION "0.13.2"
26 25
27/* 26/*
28 * Convenience kcontrol builders 27 * Convenience kcontrol builders
29 */ 28 */
30#define SOC_SINGLE_VALUE(reg,shift,mask,invert) ((reg) | ((shift) << 8) |\ 29#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\
31 ((shift) << 12) | ((mask) << 16) | ((invert) << 24)) 30 ((shift) << 12) | ((max) << 16) | ((invert) << 24))
32#define SOC_SINGLE_VALUE_EXT(reg,mask,invert) ((reg) | ((mask) << 16) |\ 31#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\
33 ((invert) << 31)) 32 ((invert) << 31))
34#define SOC_SINGLE(xname, reg, shift, mask, invert) \ 33#define SOC_SINGLE(xname, reg, shift, max, invert) \
35{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 34{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
36 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 35 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
37 .put = snd_soc_put_volsw, \ 36 .put = snd_soc_put_volsw, \
38 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } 37 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
39#define SOC_DOUBLE(xname, reg, shift_left, shift_right, mask, invert) \ 38#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
39{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
40 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
41 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
42 .tlv.p = (tlv_array), \
43 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
44 .put = snd_soc_put_volsw, \
45 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
46#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
40{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 47{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
41 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 48 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
42 .put = snd_soc_put_volsw, \ 49 .put = snd_soc_put_volsw, \
43 .private_value = (reg) | ((shift_left) << 8) | \ 50 .private_value = (reg) | ((shift_left) << 8) | \
44 ((shift_right) << 12) | ((mask) << 16) | ((invert) << 24) } 51 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
45#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, mask, invert) \ 52#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \
46{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 53{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
47 .info = snd_soc_info_volsw_2r, \ 54 .info = snd_soc_info_volsw_2r, \
48 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 55 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
49 .private_value = (reg_left) | ((shift) << 8) | \ 56 .private_value = (reg_left) | ((shift) << 8) | \
50 ((mask) << 12) | ((invert) << 20) | ((reg_right) << 24) } 57 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) }
58#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
61 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
62 .tlv.p = (tlv_array), \
63 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
64 .put = snd_soc_put_volsw, \
65 .private_value = (reg) | ((shift_left) << 8) | \
66 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
67#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \
68{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
69 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
70 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
71 .tlv.p = (tlv_array), \
72 .info = snd_soc_info_volsw_2r, \
73 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
74 .private_value = (reg_left) | ((shift) << 8) | \
75 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) }
51#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 76#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
52{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 77{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
53 .mask = xmask, .texts = xtexts } 78 .mask = xmask, .texts = xtexts }
@@ -105,9 +130,21 @@
105#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */ 130#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */
106 131
107/* 132/*
133 * DAI Sync
134 * Synchronous LR (Left Right) clocks and Frame signals.
135 */
136#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
137#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
138
139/*
140 * TDM
141 */
142#define SND_SOC_DAIFMT_TDM (1 << 6)
143
144/*
108 * DAI hardware signal inversions 145 * DAI hardware signal inversions
109 */ 146 */
110#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ 147#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */
111#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */ 148#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
112#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */ 149#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
113#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ 150#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
@@ -410,6 +447,9 @@ struct snd_soc_dai_link {
410 447
411 /* codec/machine specific init - e.g. add machine controls */ 448 /* codec/machine specific init - e.g. add machine controls */
412 int (*init)(struct snd_soc_codec *codec); 449 int (*init)(struct snd_soc_codec *codec);
450
451 /* DAI pcm */
452 struct snd_pcm *pcm;
413}; 453};
414 454
415/* SoC machine */ 455/* SoC machine */
@@ -426,6 +466,9 @@ struct snd_soc_machine {
426 int (*resume_pre)(struct platform_device *pdev); 466 int (*resume_pre)(struct platform_device *pdev);
427 int (*resume_post)(struct platform_device *pdev); 467 int (*resume_post)(struct platform_device *pdev);
428 468
469 /* callbacks */
470 int (*dapm_event)(struct snd_soc_machine *, int event);
471
429 /* CPU <--> Codec DAI links */ 472 /* CPU <--> Codec DAI links */
430 struct snd_soc_dai_link *dai_link; 473 struct snd_soc_dai_link *dai_link;
431 int num_links; 474 int num_links;
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index e8eeb3a1ed29..b62ce3e077f9 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -30,6 +30,7 @@ struct snd_tea575x;
30struct snd_tea575x_ops { 30struct snd_tea575x_ops {
31 void (*write)(struct snd_tea575x *tea, unsigned int val); 31 void (*write)(struct snd_tea575x *tea, unsigned int val);
32 unsigned int (*read)(struct snd_tea575x *tea); 32 unsigned int (*read)(struct snd_tea575x *tea);
33 void (*mute)(struct snd_tea575x *tea, unsigned int mute);
33}; 34};
34 35
35struct snd_tea575x { 36struct snd_tea575x {
diff --git a/include/sound/trident.h b/include/sound/trident.h
index 9752243241e5..9f191a0a1e19 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -26,19 +26,12 @@
26#include "pcm.h" 26#include "pcm.h"
27#include "mpu401.h" 27#include "mpu401.h"
28#include "ac97_codec.h" 28#include "ac97_codec.h"
29#include "seq_midi_emul.h"
30#include "seq_device.h"
31#include "util_mem.h" 29#include "util_mem.h"
32//#include "ainstr_iw.h"
33//#include "ainstr_gf1.h"
34#include "ainstr_simple.h"
35 30
36#define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX) 31#define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX)
37#define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX) 32#define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX)
38#define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018) 33#define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018)
39 34
40#define SNDRV_SEQ_DEV_ID_TRIDENT "trident-synth"
41
42#define SNDRV_TRIDENT_VOICE_TYPE_PCM 0 35#define SNDRV_TRIDENT_VOICE_TYPE_PCM 0
43#define SNDRV_TRIDENT_VOICE_TYPE_SYNTH 1 36#define SNDRV_TRIDENT_VOICE_TYPE_SYNTH 1
44#define SNDRV_TRIDENT_VOICE_TYPE_MIDI 2 37#define SNDRV_TRIDENT_VOICE_TYPE_MIDI 2
@@ -257,16 +250,6 @@ struct snd_trident;
257struct snd_trident_voice; 250struct snd_trident_voice;
258struct snd_trident_pcm_mixer; 251struct snd_trident_pcm_mixer;
259 252
260struct snd_trident_sample_ops {
261 void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position);
262 void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode);
263 void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq);
264 void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume);
265 void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop);
266 void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position);
267 void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data);
268};
269
270struct snd_trident_port { 253struct snd_trident_port {
271 struct snd_midi_channel_set * chset; 254 struct snd_midi_channel_set * chset;
272 struct snd_trident * trident; 255 struct snd_trident * trident;
@@ -300,7 +283,6 @@ struct snd_trident_voice {
300 unsigned char port; 283 unsigned char port;
301 unsigned char index; 284 unsigned char index;
302 285
303 struct snd_seq_instr instr;
304 struct snd_trident_sample_ops *sample_ops; 286 struct snd_trident_sample_ops *sample_ops;
305 287
306 /* channel parameters */ 288 /* channel parameters */
@@ -354,9 +336,6 @@ struct snd_4dwave {
354 int seq_client; 336 int seq_client;
355 337
356 struct snd_trident_port seq_ports[4]; 338 struct snd_trident_port seq_ports[4];
357 struct snd_simple_ops simple_ops;
358 struct snd_seq_kinstr_list *ilist;
359
360 struct snd_trident_voice voices[64]; 339 struct snd_trident_voice voices[64];
361 340
362 int ChanSynthCount; /* number of allocated synth channels */ 341 int ChanSynthCount; /* number of allocated synth channels */
@@ -416,7 +395,6 @@ struct snd_trident {
416 struct snd_pcm *foldback; /* Foldback PCM */ 395 struct snd_pcm *foldback; /* Foldback PCM */
417 struct snd_pcm *spdif; /* SPDIF PCM */ 396 struct snd_pcm *spdif; /* SPDIF PCM */
418 struct snd_rawmidi *rmidi; 397 struct snd_rawmidi *rmidi;
419 struct snd_seq_device *seq_dev;
420 398
421 struct snd_ac97_bus *ac97_bus; 399 struct snd_ac97_bus *ac97_bus;
422 struct snd_ac97 *ac97; 400 struct snd_ac97 *ac97;
diff --git a/include/sound/version.h b/include/sound/version.h
index a9781eb0da09..fac66c49445a 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.15" 2#define CONFIG_SND_VERSION "1.0.16rc2"
3#define CONFIG_SND_DATE " (Tue Nov 20 19:16:42 2007 UTC)" 3#define CONFIG_SND_DATE " (Thu Jan 31 16:40:16 2008 UTC)"