aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acglobal.h4
-rw-r--r--include/acpi/acpi_drivers.h1
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/processor.h5
-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/tlb.h4
-rw-r--r--include/asm-alpha/tlbflush.h6
-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-iop13xx/adma.h18
-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-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-s3c2410/regs-lcd.h11
-rw-r--r--include/asm-arm/arch-s3c2410/spi-gpio.h6
-rw-r--r--include/asm-arm/arch-s3c2410/spi.h6
-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/iop3xx-adma.h30
-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/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/delay.h2
-rw-r--r--include/asm-avr32/pgalloc.h6
-rw-r--r--include/asm-avr32/timex.h3
-rw-r--r--include/asm-avr32/unistd.h2
-rw-r--r--include/asm-blackfin/io.h2
-rw-r--r--include/asm-cris/bitops.h7
-rw-r--r--include/asm-cris/pgalloc.h6
-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/unistd.h2
-rw-r--r--include/asm-generic/4level-fixup.h2
-rw-r--r--include/asm-generic/cputime.h1
-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/sections.h2
-rw-r--r--include/asm-generic/tlb.h1
-rw-r--r--include/asm-h8300/io.h2
-rw-r--r--include/asm-h8300/virtconvert.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/pgalloc.h16
-rw-r--r--include/asm-ia64/processor.h5
-rw-r--r--include/asm-ia64/sal.h14
-rw-r--r--include/asm-m32r/delay.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/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/pgtable.h2
-rw-r--r--include/asm-m68k/sun3_pgalloc.h8
-rw-r--r--include/asm-m68knommu/bitops.h2
-rw-r--r--include/asm-m68knommu/commproc.h2
-rw-r--r--include/asm-m68knommu/delay.h2
-rw-r--r--include/asm-m68knommu/io.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/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.h4
-rw-r--r--include/asm-m68knommu/system.h17
-rw-r--r--include/asm-mips/compat.h2
-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-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/tlb.h4
-rw-r--r--include/asm-parisc/vga.h2
-rw-r--r--include/asm-powerpc/compat.h2
-rw-r--r--include/asm-powerpc/cputime.h14
-rw-r--r--include/asm-powerpc/dma.h39
-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/paca.h2
-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/ps3av.h43
-rw-r--r--include/asm-powerpc/systbl.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/cputime.h1
-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/tlb.h8
-rw-r--r--include/asm-sh/delay.h2
-rw-r--r--include/asm-sh/pgalloc.h8
-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/unistd.h6
-rw-r--r--include/asm-sparc64/compat.h2
-rw-r--r--include/asm-sparc64/io.h2
-rw-r--r--include/asm-sparc64/pgalloc.h8
-rw-r--r--include/asm-sparc64/timex.h6
-rw-r--r--include/asm-sparc64/tlb.h4
-rw-r--r--include/asm-sparc64/unistd.h6
-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/io.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/cpufeature.h14
-rw-r--r--include/asm-x86/delay.h2
-rw-r--r--include/asm-x86/efi.h4
-rw-r--r--include/asm-x86/futex.h23
-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.h14
-rw-r--r--include/asm-x86/pgalloc_64.h20
-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/string_32.h8
-rw-r--r--include/asm-x86/system.h23
-rw-r--r--include/asm-x86/timex.h3
-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/tlb.h2
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/ac97_codec.h7
-rw-r--r--include/linux/acct.h4
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/agp_backend.h1
-rw-r--r--include/linux/agpgart.h1
-rw-r--r--include/linux/async_tx.h13
-rw-r--r--include/linux/ata_platform.h (renamed from include/linux/pata_platform.h)13
-rw-r--r--include/linux/atmel_serial.h127
-rw-r--r--include/linux/capability.h251
-rw-r--r--include/linux/chio.h2
-rw-r--r--include/linux/compat.h15
-rw-r--r--include/linux/cpuidle.h28
-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.h31
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fs.h15
-rw-r--r--include/linux/fsnotify.h22
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/hash.h42
-rw-r--r--include/linux/hdlc.h25
-rw-r--r--include/linux/hdreg.h6
-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/pca953x.h18
-rw-r--r--include/linux/i2c/pcf857x.h45
-rw-r--r--include/linux/ide.h91
-rw-r--r--include/linux/ieee80211.h6
-rw-r--r--include/linux/if_vlan.h7
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/init_task.h13
-rw-r--r--include/linux/interrupt.h2
-rw-r--r--include/linux/iommu-helper.h7
-rw-r--r--include/linux/isdn.h1
-rw-r--r--include/linux/jbd.h3
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kprobes.h3
-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/libata.h2
-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/log2.h16
-rw-r--r--include/linux/loop.h1
-rw-r--r--include/linux/lp.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/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/page-flags.h42
-rw-r--r--include/linux/pci-acpi.h11
-rw-r--r--include/linux/pci.h378
-rw-r--r--include/linux/pci_ids.h18
-rw-r--r--include/linux/pda_power.h1
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/phy.h5
-rw-r--r--include/linux/pkt_cls.h4
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_qos_params.h25
-rw-r--r--include/linux/pnp.h3
-rw-r--r--include/linux/power_supply.h14
-rw-r--r--include/linux/prctl.h4
-rw-r--r--include/linux/proc_fs.h3
-rw-r--r--include/linux/ptrace.h35
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/raid/bitmap.h3
-rw-r--r--include/linux/raid/md_k.h23
-rw-r--r--include/linux/rcupdate.h11
-rw-r--r--include/linux/reboot.h2
-rw-r--r--include/linux/reiserfs_fs_sb.h2
-rw-r--r--include/linux/rtnetlink.h12
-rw-r--r--include/linux/sched.h17
-rw-r--r--include/linux/security.h26
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/signalfd.h2
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/linux/slub_def.h15
-rw-r--r--include/linux/sm501-regs.h2
-rw-r--r--include/linux/sm501.h2
-rw-r--r--include/linux/sonypi.h2
-rw-r--r--include/linux/spi/mcp23s08.h24
-rw-r--r--include/linux/spinlock_api_up.h2
-rw-r--r--include/linux/ssb/ssb.h9
-rw-r--r--include/linux/sunrpc/cache.h4
-rw-r--r--include/linux/sunrpc/debug.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.h34
-rw-r--r--include/linux/swapops.h6
-rw-r--r--include/linux/syscalls.h7
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h1
-rw-r--r--include/linux/timex.h2
-rw-r--r--include/linux/tty.h1
-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/serial.h160
-rw-r--r--include/linux/usb/sl811.h6
-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/vt_kern.h1
-rw-r--r--include/linux/w1-gpio.h23
-rw-r--r--include/linux/wait.h16
-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/media/rds.h2
-rw-r--r--include/net/9p/9p.h1
-rw-r--r--include/net/9p/client.h5
-rw-r--r--include/net/9p/conn.h57
-rw-r--r--include/net/9p/transport.h11
-rw-r--r--include/net/if_inet6.h6
-rw-r--r--include/net/inet6_hashtables.h2
-rw-r--r--include/net/inet_connection_sock.h8
-rw-r--r--include/net/inet_hashtables.h53
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip_fib.h8
-rw-r--r--include/net/ipv6.h6
-rw-r--r--include/net/netlabel.h47
-rw-r--r--include/net/sock.h3
-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/video/atmel_lcdc.h25
384 files changed, 4281 insertions, 2655 deletions
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 347a911d8237..47a1fd8f2d8a 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -117,10 +117,6 @@ extern u32 acpi_dbg_layer;
117 117
118extern u32 acpi_gbl_nesting_level; 118extern u32 acpi_gbl_nesting_level;
119 119
120/* Event counters */
121
122ACPI_EXTERN u32 acpi_gpe_count;
123
124/* Support for dynamic control method tracing mechanism */ 120/* Support for dynamic control method tracing mechanism */
125 121
126ACPI_EXTERN u32 acpi_gbl_original_dbg_level; 122ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index f85f77a538aa..581daa451ffc 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -48,6 +48,7 @@
48#define ACPI_BUTTON_HID_SLEEPF "LNXSLPBN" 48#define ACPI_BUTTON_HID_SLEEPF "LNXSLPBN"
49#define ACPI_VIDEO_HID "LNXVIDEO" 49#define ACPI_VIDEO_HID "LNXVIDEO"
50#define ACPI_BAY_HID "LNXIOBAY" 50#define ACPI_BAY_HID "LNXIOBAY"
51#define ACPI_DOCK_HID "LNXDOCK"
51 52
52/* -------------------------------------------------------------------------- 53/* --------------------------------------------------------------------------
53 PCI 54 PCI
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index ca882b8e7d10..1a16cfbe9e0d 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -181,6 +181,9 @@ acpi_os_install_interrupt_handler(u32 gsi,
181acpi_status 181acpi_status
182acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); 182acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
183 183
184void acpi_os_gpe_count(u32 gpe_number);
185void acpi_os_fixed_event_count(u32 fixed_event_number);
186
184/* 187/*
185 * Threads and Scheduling 188 * Threads and Scheduling
186 */ 189 */
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 0787635a11aa..0c75a0b9c565 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -34,6 +34,7 @@
34 34
35#define ACPI_CSTATE_SYSTEMIO (0) 35#define ACPI_CSTATE_SYSTEMIO (0)
36#define ACPI_CSTATE_FFH (1) 36#define ACPI_CSTATE_FFH (1)
37#define ACPI_CSTATE_HALT (2)
37 38
38/* Power Management */ 39/* Power Management */
39 40
@@ -64,7 +65,7 @@ struct acpi_processor_cx {
64 u8 valid; 65 u8 valid;
65 u8 type; 66 u8 type;
66 u32 address; 67 u32 address;
67 u8 space_id; 68 u8 entry_method;
68 u8 index; 69 u8 index;
69 u32 latency; 70 u32 latency;
70 u32 latency_ticks; 71 u32 latency_ticks;
@@ -182,7 +183,7 @@ struct acpi_processor_throttling {
182/* Limit Interface */ 183/* Limit Interface */
183 184
184struct acpi_processor_lx { 185struct acpi_processor_lx {
185 int px; /* performace state */ 186 int px; /* performance state */
186 int tx; /* throttle level */ 187 int tx; /* throttle level */
187}; 188};
188 189
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/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 b9e9147226f7..9d87aaa08c0d 100644
--- a/include/asm-alpha/tlbflush.h
+++ b/include/asm-alpha/tlbflush.h
@@ -142,6 +142,10 @@ extern void flush_tlb_range(struct vm_area_struct *, unsigned long,
142 142
143#endif /* CONFIG_SMP */ 143#endif /* CONFIG_SMP */
144 144
145#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}
146 150
147#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-iop13xx/adma.h b/include/asm-arm/arch-iop13xx/adma.h
index 04006c1c5fd7..efd9a5eb1008 100644
--- a/include/asm-arm/arch-iop13xx/adma.h
+++ b/include/asm-arm/arch-iop13xx/adma.h
@@ -247,7 +247,7 @@ static inline u32 iop_desc_get_src_count(struct iop_adma_desc_slot *desc,
247} 247}
248 248
249static inline void 249static inline void
250iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, int int_en) 250iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, unsigned long flags)
251{ 251{
252 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; 252 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
253 union { 253 union {
@@ -257,13 +257,13 @@ iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, int int_en)
257 257
258 u_desc_ctrl.value = 0; 258 u_desc_ctrl.value = 0;
259 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */ 259 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
260 u_desc_ctrl.field.int_en = int_en; 260 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
261 hw_desc->desc_ctrl = u_desc_ctrl.value; 261 hw_desc->desc_ctrl = u_desc_ctrl.value;
262 hw_desc->crc_addr = 0; 262 hw_desc->crc_addr = 0;
263} 263}
264 264
265static inline void 265static inline void
266iop_desc_init_memset(struct iop_adma_desc_slot *desc, int int_en) 266iop_desc_init_memset(struct iop_adma_desc_slot *desc, unsigned long flags)
267{ 267{
268 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; 268 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
269 union { 269 union {
@@ -274,14 +274,15 @@ iop_desc_init_memset(struct iop_adma_desc_slot *desc, int int_en)
274 u_desc_ctrl.value = 0; 274 u_desc_ctrl.value = 0;
275 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */ 275 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
276 u_desc_ctrl.field.block_fill_en = 1; 276 u_desc_ctrl.field.block_fill_en = 1;
277 u_desc_ctrl.field.int_en = int_en; 277 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
278 hw_desc->desc_ctrl = u_desc_ctrl.value; 278 hw_desc->desc_ctrl = u_desc_ctrl.value;
279 hw_desc->crc_addr = 0; 279 hw_desc->crc_addr = 0;
280} 280}
281 281
282/* to do: support buffers larger than ADMA_MAX_BYTE_COUNT */ 282/* to do: support buffers larger than ADMA_MAX_BYTE_COUNT */
283static inline void 283static inline void
284iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt, int int_en) 284iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt,
285 unsigned long flags)
285{ 286{
286 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; 287 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
287 union { 288 union {
@@ -292,7 +293,7 @@ iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt, int int_en)
292 u_desc_ctrl.value = 0; 293 u_desc_ctrl.value = 0;
293 u_desc_ctrl.field.src_select = src_cnt - 1; 294 u_desc_ctrl.field.src_select = src_cnt - 1;
294 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */ 295 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
295 u_desc_ctrl.field.int_en = int_en; 296 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
296 hw_desc->desc_ctrl = u_desc_ctrl.value; 297 hw_desc->desc_ctrl = u_desc_ctrl.value;
297 hw_desc->crc_addr = 0; 298 hw_desc->crc_addr = 0;
298 299
@@ -301,7 +302,8 @@ iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt, int int_en)
301 302
302/* to do: support buffers larger than ADMA_MAX_BYTE_COUNT */ 303/* to do: support buffers larger than ADMA_MAX_BYTE_COUNT */
303static inline int 304static inline int
304iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt, int int_en) 305iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt,
306 unsigned long flags)
305{ 307{
306 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; 308 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
307 union { 309 union {
@@ -314,7 +316,7 @@ iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt, int int_en)
314 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */ 316 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
315 u_desc_ctrl.field.zero_result = 1; 317 u_desc_ctrl.field.zero_result = 1;
316 u_desc_ctrl.field.status_write_back_en = 1; 318 u_desc_ctrl.field.status_write_back_en = 1;
317 u_desc_ctrl.field.int_en = int_en; 319 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
318 hw_desc->desc_ctrl = u_desc_ctrl.value; 320 hw_desc->desc_ctrl = u_desc_ctrl.value;
319 hw_desc->crc_addr = 0; 321 hw_desc->crc_addr = 0;
320 322
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-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-s3c2410/regs-lcd.h b/include/asm-arm/arch-s3c2410/regs-lcd.h
index 76fe5f693426..bd854845697f 100644
--- a/include/asm-arm/arch-s3c2410/regs-lcd.h
+++ b/include/asm-arm/arch-s3c2410/regs-lcd.h
@@ -147,7 +147,16 @@
147 147
148#define S3C2412_FRCPAT(x) S3C2410_LCDREG(0xB4 + ((x)*4)) 148#define S3C2412_FRCPAT(x) S3C2410_LCDREG(0xB4 + ((x)*4))
149 149
150#endif /* ___ASM_ARCH_REGS_LCD_H */ 150/* general registers */
151
152/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
153 * are available. */
151 154
155#define S3C2410_LCDINTBASE S3C2410_LCDREG(0x54)
156#define S3C2412_LCDINTBASE S3C2410_LCDREG(0x24)
152 157
158#define S3C24XX_LCDINTPND (0x00)
159#define S3C24XX_LCDSRCPND (0x04)
160#define S3C24XX_LCDINTMSK (0x08)
153 161
162#endif /* ___ASM_ARCH_REGS_LCD_H */
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h
index ba1dca88d480..73803731142a 100644
--- a/include/asm-arm/arch-s3c2410/spi-gpio.h
+++ b/include/asm-arm/arch-s3c2410/spi-gpio.h
@@ -13,9 +13,6 @@
13#ifndef __ASM_ARCH_SPIGPIO_H 13#ifndef __ASM_ARCH_SPIGPIO_H
14#define __ASM_ARCH_SPIGPIO_H __FILE__ 14#define __ASM_ARCH_SPIGPIO_H __FILE__
15 15
16struct s3c2410_spigpio_info;
17struct spi_board_info;
18
19struct s3c2410_spigpio_info { 16struct s3c2410_spigpio_info {
20 unsigned long pin_clk; 17 unsigned long pin_clk;
21 unsigned long pin_mosi; 18 unsigned long pin_mosi;
@@ -23,9 +20,6 @@ struct s3c2410_spigpio_info {
23 20
24 int bus_num; 21 int bus_num;
25 22
26 unsigned long board_size;
27 struct spi_board_info *board_info;
28
29 void (*chip_select)(struct s3c2410_spigpio_info *spi, int cs); 23 void (*chip_select)(struct s3c2410_spigpio_info *spi, int cs);
30}; 24};
31 25
diff --git a/include/asm-arm/arch-s3c2410/spi.h b/include/asm-arm/arch-s3c2410/spi.h
index 4029a1a1ab40..7ca0ed97a6d0 100644
--- a/include/asm-arm/arch-s3c2410/spi.h
+++ b/include/asm-arm/arch-s3c2410/spi.h
@@ -13,15 +13,9 @@
13#ifndef __ASM_ARCH_SPI_H 13#ifndef __ASM_ARCH_SPI_H
14#define __ASM_ARCH_SPI_H __FILE__ 14#define __ASM_ARCH_SPI_H __FILE__
15 15
16struct s3c2410_spi_info;
17struct spi_board_info;
18
19struct s3c2410_spi_info { 16struct s3c2410_spi_info {
20 unsigned long pin_cs; /* simple gpio cs */ 17 unsigned long pin_cs; /* simple gpio cs */
21 18
22 unsigned long board_size;
23 struct spi_board_info *board_info;
24
25 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); 19 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
26}; 20};
27 21
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/iop3xx-adma.h b/include/asm-arm/hardware/iop3xx-adma.h
index 10834b54f681..5c529e6a5e3b 100644
--- a/include/asm-arm/hardware/iop3xx-adma.h
+++ b/include/asm-arm/hardware/iop3xx-adma.h
@@ -414,7 +414,7 @@ static inline void iop3xx_aau_desc_set_src_addr(struct iop3xx_desc_aau *hw_desc,
414} 414}
415 415
416static inline void 416static inline void
417iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, int int_en) 417iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, unsigned long flags)
418{ 418{
419 struct iop3xx_desc_dma *hw_desc = desc->hw_desc; 419 struct iop3xx_desc_dma *hw_desc = desc->hw_desc;
420 union { 420 union {
@@ -425,14 +425,14 @@ iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, int int_en)
425 u_desc_ctrl.value = 0; 425 u_desc_ctrl.value = 0;
426 u_desc_ctrl.field.mem_to_mem_en = 1; 426 u_desc_ctrl.field.mem_to_mem_en = 1;
427 u_desc_ctrl.field.pci_transaction = 0xe; /* memory read block */ 427 u_desc_ctrl.field.pci_transaction = 0xe; /* memory read block */
428 u_desc_ctrl.field.int_en = int_en; 428 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
429 hw_desc->desc_ctrl = u_desc_ctrl.value; 429 hw_desc->desc_ctrl = u_desc_ctrl.value;
430 hw_desc->upper_pci_src_addr = 0; 430 hw_desc->upper_pci_src_addr = 0;
431 hw_desc->crc_addr = 0; 431 hw_desc->crc_addr = 0;
432} 432}
433 433
434static inline void 434static inline void
435iop_desc_init_memset(struct iop_adma_desc_slot *desc, int int_en) 435iop_desc_init_memset(struct iop_adma_desc_slot *desc, unsigned long flags)
436{ 436{
437 struct iop3xx_desc_aau *hw_desc = desc->hw_desc; 437 struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
438 union { 438 union {
@@ -443,12 +443,13 @@ iop_desc_init_memset(struct iop_adma_desc_slot *desc, int int_en)
443 u_desc_ctrl.value = 0; 443 u_desc_ctrl.value = 0;
444 u_desc_ctrl.field.blk1_cmd_ctrl = 0x2; /* memory block fill */ 444 u_desc_ctrl.field.blk1_cmd_ctrl = 0x2; /* memory block fill */
445 u_desc_ctrl.field.dest_write_en = 1; 445 u_desc_ctrl.field.dest_write_en = 1;
446 u_desc_ctrl.field.int_en = int_en; 446 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
447 hw_desc->desc_ctrl = u_desc_ctrl.value; 447 hw_desc->desc_ctrl = u_desc_ctrl.value;
448} 448}
449 449
450static inline u32 450static inline u32
451iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt, int int_en) 451iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
452 unsigned long flags)
452{ 453{
453 int i, shift; 454 int i, shift;
454 u32 edcr; 455 u32 edcr;
@@ -509,21 +510,23 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt, int int_en)
509 510
510 u_desc_ctrl.field.dest_write_en = 1; 511 u_desc_ctrl.field.dest_write_en = 1;
511 u_desc_ctrl.field.blk1_cmd_ctrl = 0x7; /* direct fill */ 512 u_desc_ctrl.field.blk1_cmd_ctrl = 0x7; /* direct fill */
512 u_desc_ctrl.field.int_en = int_en; 513 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
513 hw_desc->desc_ctrl = u_desc_ctrl.value; 514 hw_desc->desc_ctrl = u_desc_ctrl.value;
514 515
515 return u_desc_ctrl.value; 516 return u_desc_ctrl.value;
516} 517}
517 518
518static inline void 519static inline void
519iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt, int int_en) 520iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt,
521 unsigned long flags)
520{ 522{
521 iop3xx_desc_init_xor(desc->hw_desc, src_cnt, int_en); 523 iop3xx_desc_init_xor(desc->hw_desc, src_cnt, flags);
522} 524}
523 525
524/* return the number of operations */ 526/* return the number of operations */
525static inline int 527static inline int
526iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt, int int_en) 528iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt,
529 unsigned long flags)
527{ 530{
528 int slot_cnt = desc->slot_cnt, slots_per_op = desc->slots_per_op; 531 int slot_cnt = desc->slot_cnt, slots_per_op = desc->slots_per_op;
529 struct iop3xx_desc_aau *hw_desc, *prev_hw_desc, *iter; 532 struct iop3xx_desc_aau *hw_desc, *prev_hw_desc, *iter;
@@ -538,10 +541,10 @@ iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt, int int_en)
538 for (i = 0, j = 0; (slot_cnt -= slots_per_op) >= 0; 541 for (i = 0, j = 0; (slot_cnt -= slots_per_op) >= 0;
539 i += slots_per_op, j++) { 542 i += slots_per_op, j++) {
540 iter = iop_hw_desc_slot_idx(hw_desc, i); 543 iter = iop_hw_desc_slot_idx(hw_desc, i);
541 u_desc_ctrl.value = iop3xx_desc_init_xor(iter, src_cnt, int_en); 544 u_desc_ctrl.value = iop3xx_desc_init_xor(iter, src_cnt, flags);
542 u_desc_ctrl.field.dest_write_en = 0; 545 u_desc_ctrl.field.dest_write_en = 0;
543 u_desc_ctrl.field.zero_result_en = 1; 546 u_desc_ctrl.field.zero_result_en = 1;
544 u_desc_ctrl.field.int_en = int_en; 547 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
545 iter->desc_ctrl = u_desc_ctrl.value; 548 iter->desc_ctrl = u_desc_ctrl.value;
546 549
547 /* for the subsequent descriptors preserve the store queue 550 /* for the subsequent descriptors preserve the store queue
@@ -559,7 +562,8 @@ iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt, int int_en)
559} 562}
560 563
561static inline void 564static inline void
562iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt, int int_en) 565iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt,
566 unsigned long flags)
563{ 567{
564 struct iop3xx_desc_aau *hw_desc = desc->hw_desc; 568 struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
565 union { 569 union {
@@ -591,7 +595,7 @@ iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt, int int_en)
591 } 595 }
592 596
593 u_desc_ctrl.field.dest_write_en = 0; 597 u_desc_ctrl.field.dest_write_en = 0;
594 u_desc_ctrl.field.int_en = int_en; 598 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
595 hw_desc->desc_ctrl = u_desc_ctrl.value; 599 hw_desc->desc_ctrl = u_desc_ctrl.value;
596} 600}
597 601
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/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/delay.h b/include/asm-avr32/delay.h
index cc3b2e3343b3..a0ed9a9839a5 100644
--- a/include/asm-avr32/delay.h
+++ b/include/asm-avr32/delay.h
@@ -12,7 +12,7 @@ extern void __bad_ndelay(void);
12 12
13extern void __udelay(unsigned long usecs); 13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs); 14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long usecs); 15extern void __const_udelay(unsigned long xloops);
16extern void __delay(unsigned long loops); 16extern void __delay(unsigned long loops);
17 17
18#define udelay(n) (__builtin_constant_p(n) ? \ 18#define udelay(n) (__builtin_constant_p(n) ? \
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/timex.h b/include/asm-avr32/timex.h
index 5e44ecb3ce0c..187dcf38b210 100644
--- a/include/asm-avr32/timex.h
+++ b/include/asm-avr32/timex.h
@@ -34,7 +34,6 @@ static inline cycles_t get_cycles (void)
34 return 0; 34 return 0;
35} 35}
36 36
37extern int read_current_timer(unsigned long *timer_value); 37#define ARCH_HAS_READ_CURRENT_TIMER
38#define ARCH_HAS_READ_CURRENT_TIMER 1
39 38
40#endif /* __ASM_AVR32_TIMEX_H */ 39#endif /* __ASM_AVR32_TIMEX_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/io.h b/include/asm-blackfin/io.h
index 1601d62f39a5..574fe56989d1 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -188,8 +188,6 @@ extern void blkfin_inv_cache_all(void);
188#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) 188#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
189#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT) 189#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
190 190
191#define mm_ptov(vaddr) ((void *) (vaddr))
192#define mm_vtop(vaddr) ((unsigned long) (vaddr))
193#define phys_to_virt(vaddr) ((void *) (vaddr)) 191#define phys_to_virt(vaddr) ((void *) (vaddr))
194#define virt_to_phys(vaddr) ((unsigned long) (vaddr)) 192#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
195 193
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-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/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/cputime.h b/include/asm-generic/cputime.h
index 09204e40d663..1c1fa422d18a 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -18,6 +18,7 @@ typedef unsigned long cputime_t;
18#define cputime_lt(__a, __b) ((__a) < (__b)) 18#define cputime_lt(__a, __b) ((__a) < (__b))
19#define cputime_le(__a, __b) ((__a) <= (__b)) 19#define cputime_le(__a, __b) ((__a) <= (__b))
20#define cputime_to_jiffies(__ct) (__ct) 20#define cputime_to_jiffies(__ct) (__ct)
21#define cputime_to_scaled(__ct) (__ct)
21#define jiffies_to_cputime(__hz) (__hz) 22#define jiffies_to_cputime(__hz) (__hz)
22 23
23typedef u64 cputime64_t; 24typedef u64 cputime64_t;
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/sections.h b/include/asm-generic/sections.h
index 962cad7cfbbd..8feeae1f2369 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -8,8 +8,6 @@ extern char _data[], _sdata[], _edata[];
8extern char __bss_start[], __bss_stop[]; 8extern char __bss_start[], __bss_stop[];
9extern char __init_begin[], __init_end[]; 9extern char __init_begin[], __init_end[];
10extern char _sinittext[], _einittext[]; 10extern char _sinittext[], _einittext[];
11extern char _sextratext[] __attribute__((weak));
12extern char _eextratext[] __attribute__((weak));
13extern char _end[]; 11extern char _end[];
14extern char __per_cpu_start[], __per_cpu_end[]; 12extern char __per_cpu_start[], __per_cpu_end[];
15extern char __kprobes_text_start[], __kprobes_text_end[]; 13extern char __kprobes_text_start[], __kprobes_text_end[];
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 75f2bfab614f..f490e43a90b9 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -14,7 +14,6 @@
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>
18#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
19#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
20 19
diff --git a/include/asm-h8300/io.h b/include/asm-h8300/io.h
index 7543a57b4ea1..26dc6ccd9441 100644
--- a/include/asm-h8300/io.h
+++ b/include/asm-h8300/io.h
@@ -302,8 +302,6 @@ static __inline__ void ctrl_outl(unsigned long b, unsigned long addr)
302/* 302/*
303 * Macros used for converting between virtual and physical mappings. 303 * Macros used for converting between virtual and physical mappings.
304 */ 304 */
305#define mm_ptov(vaddr) ((void *) (vaddr))
306#define mm_vtop(vaddr) ((unsigned long) (vaddr))
307#define phys_to_virt(vaddr) ((void *) (vaddr)) 305#define phys_to_virt(vaddr) ((void *) (vaddr))
308#define virt_to_phys(vaddr) ((unsigned long) (vaddr)) 306#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
309 307
diff --git a/include/asm-h8300/virtconvert.h b/include/asm-h8300/virtconvert.h
index ee7d5ea10065..19cfd62b11c3 100644
--- a/include/asm-h8300/virtconvert.h
+++ b/include/asm-h8300/virtconvert.h
@@ -10,8 +10,6 @@
10#include <asm/setup.h> 10#include <asm/setup.h>
11#include <asm/page.h> 11#include <asm/page.h>
12 12
13#define mm_ptov(vaddr) ((void *) (vaddr))
14#define mm_vtop(vaddr) ((unsigned long) (vaddr))
15#define phys_to_virt(vaddr) ((void *) (vaddr)) 13#define phys_to_virt(vaddr) ((void *) (vaddr))
16#define virt_to_phys(vaddr) ((unsigned long) (vaddr)) 14#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
17 15
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/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-m32r/delay.h b/include/asm-m32r/delay.h
index 164448d23850..9dd9e999ea69 100644
--- a/include/asm-m32r/delay.h
+++ b/include/asm-m32r/delay.h
@@ -12,7 +12,7 @@ extern void __bad_ndelay(void);
12 12
13extern void __udelay(unsigned long usecs); 13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs); 14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long usecs); 15extern void __const_udelay(unsigned long xloops);
16extern void __delay(unsigned long loops); 16extern void __delay(unsigned long loops);
17 17
18#define udelay(n) (__builtin_constant_p(n) ? \ 18#define udelay(n) (__builtin_constant_p(n) ? \
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/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/pgtable.h b/include/asm-m68k/pgtable.h
index 778a4c538eb2..0b604f0f192d 100644
--- a/include/asm-m68k/pgtable.h
+++ b/include/asm-m68k/pgtable.h
@@ -107,8 +107,6 @@ extern void *empty_zero_page;
107/* 64-bit machines, beware! SRB. */ 107/* 64-bit machines, beware! SRB. */
108#define SIZEOF_PTR_LOG2 2 108#define SIZEOF_PTR_LOG2 2
109 109
110#define mm_end_of_chunk(addr, len) 0
111
112extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); 110extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
113 111
114/* 112/*
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/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/io.h b/include/asm-m68knommu/io.h
index 653d9b2d7ddf..6adef1ee2082 100644
--- a/include/asm-m68knommu/io.h
+++ b/include/asm-m68knommu/io.h
@@ -172,8 +172,6 @@ extern void iounmap(void *addr);
172/* 172/*
173 * Macros used for converting between virtual and physical mappings. 173 * Macros used for converting between virtual and physical mappings.
174 */ 174 */
175#define mm_ptov(vaddr) ((void *) (vaddr))
176#define mm_vtop(vaddr) ((unsigned long) (vaddr))
177#define phys_to_virt(vaddr) ((void *) (vaddr)) 175#define phys_to_virt(vaddr) ((void *) (vaddr))
178#define virt_to_phys(vaddr) ((unsigned long) (vaddr)) 176#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
179 177
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/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 1319a81814b1..ef2293873612 100644
--- a/include/asm-m68knommu/mcfuart.h
+++ b/include/asm-m68knommu/mcfuart.h
@@ -19,7 +19,7 @@
19#if defined(CONFIG_M5272) 19#if defined(CONFIG_M5272)
20#define MCFUART_BASE1 0x100 /* Base address of UART1 */ 20#define MCFUART_BASE1 0x100 /* Base address of UART1 */
21#define MCFUART_BASE2 0x140 /* Base address of UART2 */ 21#define MCFUART_BASE2 0x140 /* Base address of UART2 */
22#elif defined(CONFIG_M5204) || defined(CONFIG_M5206) || defined(CONFIG_M5206e) 22#elif defined(CONFIG_M5206) || defined(CONFIG_M5206e)
23#if defined(CONFIG_NETtel) 23#if defined(CONFIG_NETtel)
24#define MCFUART_BASE1 0x180 /* Base address of UART1 */ 24#define MCFUART_BASE1 0x180 /* Base address of UART1 */
25#define MCFUART_BASE2 0x140 /* Base address of UART2 */ 25#define MCFUART_BASE2 0x140 /* Base address of UART2 */
@@ -71,7 +71,7 @@ struct mcf_platform_uart {
71#define MCFUART_UTB 0x0c /* Transmit Buffer (w) */ 71#define MCFUART_UTB 0x0c /* Transmit Buffer (w) */
72#define MCFUART_UIPCR 0x10 /* Input Port Change (r) */ 72#define MCFUART_UIPCR 0x10 /* Input Port Change (r) */
73#define MCFUART_UACR 0x10 /* Auxiliary Control (w) */ 73#define MCFUART_UACR 0x10 /* Auxiliary Control (w) */
74#define MCFUART_UISR 0x14 /* Interrup Status (r) */ 74#define MCFUART_UISR 0x14 /* Interrupt Status (r) */
75#define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */ 75#define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */
76#define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */ 76#define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */
77#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-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-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/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/cputime.h b/include/asm-powerpc/cputime.h
index 310804485208..f42e623030ee 100644
--- a/include/asm-powerpc/cputime.h
+++ b/include/asm-powerpc/cputime.h
@@ -52,12 +52,26 @@ typedef u64 cputime64_t;
52 * Convert cputime <-> jiffies 52 * Convert cputime <-> jiffies
53 */ 53 */
54extern u64 __cputime_jiffies_factor; 54extern u64 __cputime_jiffies_factor;
55DECLARE_PER_CPU(unsigned long, cputime_last_delta);
56DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta);
55 57
56static inline unsigned long cputime_to_jiffies(const cputime_t ct) 58static inline unsigned long cputime_to_jiffies(const cputime_t ct)
57{ 59{
58 return mulhdu(ct, __cputime_jiffies_factor); 60 return mulhdu(ct, __cputime_jiffies_factor);
59} 61}
60 62
63/* Estimate the scaled cputime by scaling the real cputime based on
64 * the last scaled to real ratio */
65static inline cputime_t cputime_to_scaled(const cputime_t ct)
66{
67 if (cpu_has_feature(CPU_FTR_SPURR) &&
68 per_cpu(cputime_last_delta, smp_processor_id()))
69 return ct *
70 per_cpu(cputime_scaled_last_delta, smp_processor_id())/
71 per_cpu(cputime_last_delta, smp_processor_id());
72 return ct;
73}
74
61static inline cputime_t jiffies_to_cputime(const unsigned long jif) 75static inline cputime_t jiffies_to_cputime(const unsigned long jif)
62{ 76{
63 cputime_t ct; 77 cputime_t ct;
diff --git a/include/asm-powerpc/dma.h b/include/asm-powerpc/dma.h
index 7a4374bdbef4..a7e06e25c708 100644
--- a/include/asm-powerpc/dma.h
+++ b/include/asm-powerpc/dma.h
@@ -93,16 +93,6 @@
93 * 93 *
94 */ 94 */
95 95
96/* see prep_setup_arch() for detailed informations */
97#if defined(CONFIG_SOUND_CS4232) && defined(CONFIG_PPC_PREP)
98extern long ppc_cs4232_dma, ppc_cs4232_dma2;
99#define SND_DMA1 ppc_cs4232_dma
100#define SND_DMA2 ppc_cs4232_dma2
101#else
102#define SND_DMA1 -1
103#define SND_DMA2 -1
104#endif
105
106/* 8237 DMA controllers */ 96/* 8237 DMA controllers */
107#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ 97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
108#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ 98#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
@@ -269,24 +259,15 @@ static __inline__ void set_dma_page(unsigned int dmanr, int pagenr)
269 dma_outb(pagenr >> 8, DMA_HI_PAGE_3); 259 dma_outb(pagenr >> 8, DMA_HI_PAGE_3);
270 break; 260 break;
271 case 5: 261 case 5:
272 if (SND_DMA1 == 5 || SND_DMA2 == 5) 262 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5);
273 dma_outb(pagenr, DMA_LO_PAGE_5);
274 else
275 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5);
276 dma_outb(pagenr >> 8, DMA_HI_PAGE_5); 263 dma_outb(pagenr >> 8, DMA_HI_PAGE_5);
277 break; 264 break;
278 case 6: 265 case 6:
279 if (SND_DMA1 == 6 || SND_DMA2 == 6) 266 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6);
280 dma_outb(pagenr, DMA_LO_PAGE_6);
281 else
282 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6);
283 dma_outb(pagenr >> 8, DMA_HI_PAGE_6); 267 dma_outb(pagenr >> 8, DMA_HI_PAGE_6);
284 break; 268 break;
285 case 7: 269 case 7:
286 if (SND_DMA1 == 7 || SND_DMA2 == 7) 270 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7);
287 dma_outb(pagenr, DMA_LO_PAGE_7);
288 else
289 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7);
290 dma_outb(pagenr >> 8, DMA_HI_PAGE_7); 271 dma_outb(pagenr >> 8, DMA_HI_PAGE_7);
291 break; 272 break;
292 } 273 }
@@ -302,12 +283,6 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int phys)
302 ((dmanr & 3) << 1) + IO_DMA1_BASE); 283 ((dmanr & 3) << 1) + IO_DMA1_BASE);
303 dma_outb((phys >> 8) & 0xff, 284 dma_outb((phys >> 8) & 0xff,
304 ((dmanr & 3) << 1) + IO_DMA1_BASE); 285 ((dmanr & 3) << 1) + IO_DMA1_BASE);
305 } else if (dmanr == SND_DMA1 || dmanr == SND_DMA2) {
306 dma_outb(phys & 0xff,
307 ((dmanr & 3) << 2) + IO_DMA2_BASE);
308 dma_outb((phys >> 8) & 0xff,
309 ((dmanr & 3) << 2) + IO_DMA2_BASE);
310 dma_outb((dmanr & 3), DMA2_EXT_REG);
311 } else { 286 } else {
312 dma_outb((phys >> 1) & 0xff, 287 dma_outb((phys >> 1) & 0xff,
313 ((dmanr & 3) << 2) + IO_DMA2_BASE); 288 ((dmanr & 3) << 2) + IO_DMA2_BASE);
@@ -334,11 +309,6 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
334 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE); 309 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
335 dma_outb((count >> 8) & 0xff, 310 dma_outb((count >> 8) & 0xff,
336 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE); 311 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
337 } else if (dmanr == SND_DMA1 || dmanr == SND_DMA2) {
338 dma_outb(count & 0xff,
339 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
340 dma_outb((count >> 8) & 0xff,
341 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
342 } else { 312 } else {
343 dma_outb((count >> 1) & 0xff, 313 dma_outb((count >> 1) & 0xff,
344 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE); 314 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
@@ -368,8 +338,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
368 count = 1 + dma_inb(io_port); 338 count = 1 + dma_inb(io_port);
369 count += dma_inb(io_port) << 8; 339 count += dma_inb(io_port) << 8;
370 340
371 return (dmanr <= 3 || dmanr == SND_DMA1 || dmanr == SND_DMA2) 341 return (dmanr <= 3) ? count : (count << 1);
372 ? count : (count << 1);
373} 342}
374 343
375/* These are in kernel/dma.c: */ 344/* These are in kernel/dma.c: */
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/paca.h b/include/asm-powerpc/paca.h
index f6dfce025adf..748b35ab37b5 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -115,8 +115,6 @@ struct paca_struct {
115 u64 system_time; /* accumulated system TB ticks */ 115 u64 system_time; /* accumulated system TB ticks */
116 u64 startpurr; /* PURR/TB value snapshot */ 116 u64 startpurr; /* PURR/TB value snapshot */
117 u64 startspurr; /* SPURR value snapshot */ 117 u64 startspurr; /* SPURR value snapshot */
118 u64 purrdelta; /* FIXME: document */
119 u64 spurrdelta; /* FIXME: document */
120}; 118};
121 119
122extern struct paca_struct paca[]; 120extern struct paca_struct paca[];
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/ps3av.h b/include/asm-powerpc/ps3av.h
index 967930b82ed3..fda98715cd35 100644
--- a/include/asm-powerpc/ps3av.h
+++ b/include/asm-powerpc/ps3av.h
@@ -310,19 +310,25 @@
310#define PS3AV_MONITOR_TYPE_HDMI 1 /* HDMI */ 310#define PS3AV_MONITOR_TYPE_HDMI 1 /* HDMI */
311#define PS3AV_MONITOR_TYPE_DVI 2 /* DVI */ 311#define PS3AV_MONITOR_TYPE_DVI 2 /* DVI */
312 312
313#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_60 2 /* 480p */
314#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_60 1 /* 480i */
315#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_50 7 /* 576p */
316#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_50 6 /* 576i */
317
318#define PS3AV_REGION_60 0x01
319#define PS3AV_REGION_50 0x02
320#define PS3AV_REGION_RGB 0x10
321
322#define get_status(buf) (((__u32 *)buf)[2])
323#define PS3AV_HDR_SIZE 4 /* version + size */
324 313
325/* for video mode */ 314/* for video mode */
315enum ps3av_mode_num {
316 PS3AV_MODE_AUTO = 0,
317 PS3AV_MODE_480I = 1,
318 PS3AV_MODE_480P = 2,
319 PS3AV_MODE_720P60 = 3,
320 PS3AV_MODE_1080I60 = 4,
321 PS3AV_MODE_1080P60 = 5,
322 PS3AV_MODE_576I = 6,
323 PS3AV_MODE_576P = 7,
324 PS3AV_MODE_720P50 = 8,
325 PS3AV_MODE_1080I50 = 9,
326 PS3AV_MODE_1080P50 = 10,
327 PS3AV_MODE_WXGA = 11,
328 PS3AV_MODE_SXGA = 12,
329 PS3AV_MODE_WUXGA = 13,
330};
331
326#define PS3AV_MODE_MASK 0x000F 332#define PS3AV_MODE_MASK 0x000F
327#define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */ 333#define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */
328#define PS3AV_MODE_DITHER 0x0800 334#define PS3AV_MODE_DITHER 0x0800
@@ -333,6 +339,19 @@
333#define PS3AV_MODE_RGB 0x0020 339#define PS3AV_MODE_RGB 0x0020
334 340
335 341
342#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_60 PS3AV_MODE_480P
343#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_60 PS3AV_MODE_480I
344#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_50 PS3AV_MODE_576P
345#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_50 PS3AV_MODE_576I
346
347#define PS3AV_REGION_60 0x01
348#define PS3AV_REGION_50 0x02
349#define PS3AV_REGION_RGB 0x10
350
351#define get_status(buf) (((__u32 *)buf)[2])
352#define PS3AV_HDR_SIZE 4 /* version + size */
353
354
336/** command packet structure **/ 355/** command packet structure **/
337struct ps3av_send_hdr { 356struct ps3av_send_hdr {
338 u16 version; 357 u16 version;
@@ -713,8 +732,6 @@ extern int ps3av_set_video_mode(u32);
713extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32); 732extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
714extern int ps3av_get_auto_mode(void); 733extern int ps3av_get_auto_mode(void);
715extern int ps3av_get_mode(void); 734extern int ps3av_get_mode(void);
716extern int ps3av_get_scanmode(int);
717extern int ps3av_get_refresh_rate(int);
718extern int ps3av_video_mode2res(u32, u32 *, u32 *); 735extern int ps3av_video_mode2res(u32, u32 *, u32 *);
719extern int ps3av_video_mute(int); 736extern int ps3av_video_mute(int);
720extern int ps3av_audio_mute(int); 737extern int ps3av_audio_mute(int);
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-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/cputime.h b/include/asm-s390/cputime.h
index 4b3ef7cad115..133ce054fc89 100644
--- a/include/asm-s390/cputime.h
+++ b/include/asm-s390/cputime.h
@@ -54,6 +54,7 @@ __div(unsigned long long n, unsigned int base)
54#define cputime_lt(__a, __b) ((__a) < (__b)) 54#define cputime_lt(__a, __b) ((__a) < (__b))
55#define cputime_le(__a, __b) ((__a) <= (__b)) 55#define cputime_le(__a, __b) ((__a) <= (__b))
56#define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ)) 56#define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ))
57#define cputime_to_scaled(__ct) (__ct)
57#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ)) 58#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ))
58 59
59#define cputime64_zero (0ULL) 60#define cputime64_zero (0ULL)
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/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/delay.h b/include/asm-sh/delay.h
index 031db84f2aa1..d5d464041003 100644
--- a/include/asm-sh/delay.h
+++ b/include/asm-sh/delay.h
@@ -12,7 +12,7 @@ extern void __bad_ndelay(void);
12 12
13extern void __udelay(unsigned long usecs); 13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs); 14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long usecs); 15extern void __const_udelay(unsigned long xloops);
16extern void __delay(unsigned long loops); 16extern void __delay(unsigned long loops);
17 17
18#ifdef CONFIG_SUPERH32 18#ifdef CONFIG_SUPERH32
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/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/unistd.h b/include/asm-sparc/unistd.h
index 0decdf763716..2338a0276377 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -327,11 +327,13 @@
327#define __NR_epoll_pwait 309 327#define __NR_epoll_pwait 309
328#define __NR_utimensat 310 328#define __NR_utimensat 310
329#define __NR_signalfd 311 329#define __NR_signalfd 311
330#define __NR_timerfd 312 330#define __NR_timerfd_create 312
331#define __NR_eventfd 313 331#define __NR_eventfd 313
332#define __NR_fallocate 314 332#define __NR_fallocate 314
333#define __NR_timerfd_settime 315
334#define __NR_timerfd_gettime 316
333 335
334#define NR_SYSCALLS 315 336#define NR_SYSCALLS 317
335 337
336/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 338/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
337 * it never had the plain ones and there is no value to adding those 339 * it never had the plain ones and there is no value to adding those
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/io.h b/include/asm-sparc64/io.h
index c299b853b5ba..b6ece223562d 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -16,7 +16,7 @@
16/* BIO layer definitions. */ 16/* BIO layer definitions. */
17extern unsigned long kern_base, kern_size; 17extern unsigned long kern_base, kern_size;
18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
19#define BIO_VMERGE_BOUNDARY 8192 19#define BIO_VMERGE_BOUNDARY 0
20 20
21static inline u8 _inb(unsigned long addr) 21static inline u8 _inb(unsigned long addr)
22{ 22{
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/timex.h b/include/asm-sparc64/timex.h
index 2a5e4ebaad80..c622535c4560 100644
--- a/include/asm-sparc64/timex.h
+++ b/include/asm-sparc64/timex.h
@@ -14,10 +14,6 @@
14typedef unsigned long cycles_t; 14typedef unsigned long cycles_t;
15#define get_cycles() tick_ops->get_tick() 15#define get_cycles() tick_ops->get_tick()
16 16
17#define ARCH_HAS_READ_CURRENT_TIMER 1 17#define ARCH_HAS_READ_CURRENT_TIMER
18#define read_current_timer(timer_val_p) \
19({ *timer_val_p = tick_ops->get_tick(); \
20 0; \
21})
22 18
23#endif 19#endif
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-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index cb751b4d0f56..77559da0ea3f 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -329,11 +329,13 @@
329#define __NR_epoll_pwait 309 329#define __NR_epoll_pwait 309
330#define __NR_utimensat 310 330#define __NR_utimensat 310
331#define __NR_signalfd 311 331#define __NR_signalfd 311
332#define __NR_timerfd 312 332#define __NR_timerfd_create 312
333#define __NR_eventfd 313 333#define __NR_eventfd 313
334#define __NR_fallocate 314 334#define __NR_fallocate 314
335#define __NR_timerfd_settime 315
336#define __NR_timerfd_gettime 316
335 337
336#define NR_SYSCALLS 315 338#define NR_SYSCALLS 317
337 339
338#ifdef __KERNEL__ 340#ifdef __KERNEL__
339/* sysconf options, for SunOS compatibility */ 341/* sysconf options, for SunOS compatibility */
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/io.h b/include/asm-v850/io.h
index cc364fcbec10..cdad251fba9f 100644
--- a/include/asm-v850/io.h
+++ b/include/asm-v850/io.h
@@ -122,8 +122,6 @@ outsl (unsigned long port, const void *src, unsigned long count)
122#endif 122#endif
123 123
124/* Conversion between virtual and physical mappings. */ 124/* Conversion between virtual and physical mappings. */
125#define mm_ptov(addr) ((void *)__phys_to_virt (addr))
126#define mm_vtop(addr) ((unsigned long)__virt_to_phys (addr))
127#define phys_to_virt(addr) ((void *)__phys_to_virt (addr)) 125#define phys_to_virt(addr) ((void *)__phys_to_virt (addr))
128#define virt_to_phys(addr) ((unsigned long)__virt_to_phys (addr)) 126#define virt_to_phys(addr) ((unsigned long)__virt_to_phys (addr))
129 127
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/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/delay.h b/include/asm-x86/delay.h
index d11d47fc1a0e..409a649204aa 100644
--- a/include/asm-x86/delay.h
+++ b/include/asm-x86/delay.h
@@ -13,7 +13,7 @@ extern void __bad_ndelay(void);
13 13
14extern void __udelay(unsigned long usecs); 14extern void __udelay(unsigned long usecs);
15extern void __ndelay(unsigned long nsecs); 15extern void __ndelay(unsigned long nsecs);
16extern void __const_udelay(unsigned long usecs); 16extern void __const_udelay(unsigned long xloops);
17extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
18 18
19/* 0x10c7 is 2**32 / 1000000 (rounded up) */ 19/* 0x10c7 is 2**32 / 1000000 (rounded up) */
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 9d919264923a..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
@@ -35,11 +32,9 @@
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))
@@ -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
115 "1: lock; cmpxchgl %3, %1 \n" 109 "1: lock; cmpxchgl %3, %1 \n"
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 7641e7b5d931..bab12718a913 100644
--- a/include/asm-x86/pgalloc_32.h
+++ b/include/asm-x86/pgalloc_32.h
@@ -36,17 +36,17 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
36 * Allocate and free page tables. 36 * Allocate and free page tables.
37 */ 37 */
38extern pgd_t *pgd_alloc(struct mm_struct *); 38extern pgd_t *pgd_alloc(struct mm_struct *);
39extern void pgd_free(pgd_t *pgd); 39extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
40 40
41extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); 41extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
42extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); 42extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
43 43
44static inline void pte_free_kernel(pte_t *pte) 44static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
45{ 45{
46 free_page((unsigned long)pte); 46 free_page((unsigned long)pte);
47} 47}
48 48
49static inline void pte_free(struct page *pte) 49static inline void pte_free(struct mm_struct *mm, struct page *pte)
50{ 50{
51 __free_page(pte); 51 __free_page(pte);
52} 52}
@@ -63,7 +63,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
63 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 63 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
64} 64}
65 65
66static inline void pmd_free(pmd_t *pmd) 66static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
67{ 67{
68 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 68 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
69 free_page((unsigned long)pmd); 69 free_page((unsigned long)pmd);
@@ -80,8 +80,10 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
80 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT)); 80 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
81 81
82 /* 82 /*
83 * Pentium-II erratum A13: in PAE mode we explicitly have to flush 83 * According to Intel App note "TLBs, Paging-Structure Caches,
84 * 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...
85 */ 87 */
86 if (mm == current->active_mm) 88 if (mm == current->active_mm)
87 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..4f6220db22b1 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);
@@ -42,19 +42,21 @@ static inline void pud_free (pud_t *pud)
42static inline void pgd_list_add(pgd_t *pgd) 42static inline void pgd_list_add(pgd_t *pgd)
43{ 43{
44 struct page *page = virt_to_page(pgd); 44 struct page *page = virt_to_page(pgd);
45 unsigned long flags;
45 46
46 spin_lock(&pgd_lock); 47 spin_lock_irqsave(&pgd_lock, flags);
47 list_add(&page->lru, &pgd_list); 48 list_add(&page->lru, &pgd_list);
48 spin_unlock(&pgd_lock); 49 spin_unlock_irqrestore(&pgd_lock, flags);
49} 50}
50 51
51static inline void pgd_list_del(pgd_t *pgd) 52static inline void pgd_list_del(pgd_t *pgd)
52{ 53{
53 struct page *page = virt_to_page(pgd); 54 struct page *page = virt_to_page(pgd);
55 unsigned long flags;
54 56
55 spin_lock(&pgd_lock); 57 spin_lock_irqsave(&pgd_lock, flags);
56 list_del(&page->lru); 58 list_del(&page->lru);
57 spin_unlock(&pgd_lock); 59 spin_unlock_irqrestore(&pgd_lock, flags);
58} 60}
59 61
60static inline pgd_t *pgd_alloc(struct mm_struct *mm) 62static inline pgd_t *pgd_alloc(struct mm_struct *mm)
@@ -77,7 +79,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
77 return pgd; 79 return pgd;
78} 80}
79 81
80static inline void pgd_free(pgd_t *pgd) 82static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
81{ 83{
82 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1)); 84 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
83 pgd_list_del(pgd); 85 pgd_list_del(pgd);
@@ -100,13 +102,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 102/* Should really implement gc for free page table pages. This could be
101 done with a reference count in struct page. */ 103 done with a reference count in struct page. */
102 104
103static inline void pte_free_kernel(pte_t *pte) 105static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
104{ 106{
105 BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); 107 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
106 free_page((unsigned long)pte); 108 free_page((unsigned long)pte);
107} 109}
108 110
109static inline void pte_free(struct page *pte) 111static inline void pte_free(struct mm_struct *mm, struct page *pte)
110{ 112{
111 __free_page(pte); 113 __free_page(pte);
112} 114}
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/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/timex.h b/include/asm-x86/timex.h
index 27cfd6c599ba..43e5a78500c5 100644
--- a/include/asm-x86/timex.h
+++ b/include/asm-x86/timex.h
@@ -14,7 +14,6 @@
14#endif 14#endif
15#define CLOCK_TICK_RATE PIT_TICK_RATE 15#define CLOCK_TICK_RATE PIT_TICK_RATE
16 16
17extern int read_current_timer(unsigned long *timer_value); 17#define ARCH_HAS_READ_CURRENT_TIMER
18#define ARCH_HAS_READ_CURRENT_TIMER 1
19 18
20#endif 19#endif
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/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/ac97_codec.h b/include/linux/ac97_codec.h
index 22eb9367235a..0260c3e79fdd 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -326,11 +326,7 @@ struct ac97_ops
326#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */ 326#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */
327}; 327};
328 328
329extern int ac97_read_proc (char *page_out, char **start, off_t off,
330 int count, int *eof, void *data);
331extern int ac97_probe_codec(struct ac97_codec *); 329extern int ac97_probe_codec(struct ac97_codec *);
332extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);
333extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
334 330
335extern struct ac97_codec *ac97_alloc_codec(void); 331extern struct ac97_codec *ac97_alloc_codec(void);
336extern void ac97_release_codec(struct ac97_codec *codec); 332extern void ac97_release_codec(struct ac97_codec *codec);
@@ -363,7 +359,4 @@ struct ac97_quirk {
363 int type; /* quirk type above */ 359 int type; /* quirk type above */
364}; 360};
365 361
366struct pci_dev;
367extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);
368
369#endif /* _AC97_CODEC_H_ */ 362#endif /* _AC97_CODEC_H_ */
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 302eb727ecb8..e8cae54e8d88 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -173,7 +173,11 @@ typedef struct acct acct_t;
173static inline u32 jiffies_to_AHZ(unsigned long x) 173static inline u32 jiffies_to_AHZ(unsigned long x)
174{ 174{
175#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0 175#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0
176# if HZ < AHZ
177 return x * (AHZ / HZ);
178# else
176 return x / (HZ / AHZ); 179 return x / (HZ / AHZ);
180# endif
177#else 181#else
178 u64 tmp = (u64)x * TICK_NSEC; 182 u64 tmp = (u64)x * TICK_NSEC;
179 do_div(tmp, (NSEC_PER_SEC / AHZ)); 183 do_div(tmp, (NSEC_PER_SEC / AHZ));
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 63f2e6ed698f..cf13bec517b7 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -80,7 +80,6 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
80typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 80typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
81 81
82char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 82char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
83unsigned long acpi_find_rsdp (void);
84int acpi_boot_init (void); 83int acpi_boot_init (void);
85int acpi_boot_table_init (void); 84int acpi_boot_table_init (void);
86int acpi_numa_init (void); 85int acpi_numa_init (void);
@@ -115,7 +114,9 @@ int acpi_unmap_lsapic(int cpu);
115 114
116int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); 115int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
117int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); 116int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
117void acpi_irq_stats_init(void);
118 118
119extern u32 acpi_irq_handled;
119extern int acpi_mp_config; 120extern int acpi_mp_config;
120 121
121extern struct acpi_mcfg_allocation *pci_mmcfg_config; 122extern struct acpi_mcfg_allocation *pci_mmcfg_config;
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/async_tx.h b/include/linux/async_tx.h
index bdca3f1b3213..eb640f0acfac 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -47,7 +47,6 @@ struct dma_chan_ref {
47 * address is an implied source, whereas the asynchronous case it must be listed 47 * address is an implied source, whereas the asynchronous case it must be listed
48 * as a source. The destination address must be the first address in the source 48 * as a source. The destination address must be the first address in the source
49 * array. 49 * array.
50 * @ASYNC_TX_ASSUME_COHERENT: skip cache maintenance operations
51 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 50 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
52 * dependency chain 51 * dependency chain
53 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. 52 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining.
@@ -55,7 +54,6 @@ struct dma_chan_ref {
55enum async_tx_flags { 54enum async_tx_flags {
56 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 55 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
57 ASYNC_TX_XOR_DROP_DST = (1 << 1), 56 ASYNC_TX_XOR_DROP_DST = (1 << 1),
58 ASYNC_TX_ASSUME_COHERENT = (1 << 2),
59 ASYNC_TX_ACK = (1 << 3), 57 ASYNC_TX_ACK = (1 << 3),
60 ASYNC_TX_DEP_ACK = (1 << 4), 58 ASYNC_TX_DEP_ACK = (1 << 4),
61}; 59};
@@ -64,9 +62,15 @@ enum async_tx_flags {
64void async_tx_issue_pending_all(void); 62void async_tx_issue_pending_all(void);
65enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 63enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
66void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx); 64void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx);
65#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
66#include <asm/async_tx.h>
67#else
68#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
69 __async_tx_find_channel(dep, type)
67struct dma_chan * 70struct dma_chan *
68async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 71__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
69 enum dma_transaction_type tx_type); 72 enum dma_transaction_type tx_type);
73#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */
70#else 74#else
71static inline void async_tx_issue_pending_all(void) 75static inline void async_tx_issue_pending_all(void)
72{ 76{
@@ -88,7 +92,8 @@ async_tx_run_dependencies(struct dma_async_tx_descriptor *tx,
88 92
89static inline struct dma_chan * 93static inline struct dma_chan *
90async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 94async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
91 enum dma_transaction_type tx_type) 95 enum dma_transaction_type tx_type, struct page **dst, int dst_count,
96 struct page **src, int src_count, size_t len)
92{ 97{
93 return NULL; 98 return NULL;
94} 99}
diff --git a/include/linux/pata_platform.h b/include/linux/ata_platform.h
index 6a7a92db294c..b856a2a590d9 100644
--- a/include/linux/pata_platform.h
+++ b/include/linux/ata_platform.h
@@ -1,5 +1,5 @@
1#ifndef __LINUX_PATA_PLATFORM_H 1#ifndef __LINUX_ATA_PLATFORM_H
2#define __LINUX_PATA_PLATFORM_H 2#define __LINUX_ATA_PLATFORM_H
3 3
4struct pata_platform_info { 4struct pata_platform_info {
5 /* 5 /*
@@ -24,4 +24,11 @@ extern int __devinit __pata_platform_probe(struct device *dev,
24 24
25extern int __devexit __pata_platform_remove(struct device *dev); 25extern int __devexit __pata_platform_remove(struct device *dev);
26 26
27#endif /* __LINUX_PATA_PLATFORM_H */ 27/*
28 * Marvell SATA private data
29 */
30struct mv_sata_platform_data {
31 int n_ports; /* number of sata ports */
32};
33
34#endif /* __LINUX_ATA_PLATFORM_H */
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/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/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..a671dbff7a1f 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -257,16 +257,8 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
257/* 257/*
258 * epoll (fs/eventpoll.c) compat bits follow ... 258 * epoll (fs/eventpoll.c) compat bits follow ...
259 */ 259 */
260#ifndef CONFIG_HAS_COMPAT_EPOLL_EVENT
261struct epoll_event; 260struct epoll_event;
262#define compat_epoll_event epoll_event 261#define compat_epoll_event epoll_event
263#else
264asmlinkage long compat_sys_epoll_ctl(int epfd, int op, int fd,
265 struct compat_epoll_event __user *event);
266asmlinkage long compat_sys_epoll_wait(int epfd,
267 struct compat_epoll_event __user *events,
268 int maxevents, int timeout);
269#endif
270asmlinkage long compat_sys_epoll_pwait(int epfd, 262asmlinkage long compat_sys_epoll_pwait(int epfd,
271 struct compat_epoll_event __user *events, 263 struct compat_epoll_event __user *events,
272 int maxevents, int timeout, 264 int maxevents, int timeout,
@@ -279,8 +271,11 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename,
279asmlinkage long compat_sys_signalfd(int ufd, 271asmlinkage long compat_sys_signalfd(int ufd,
280 const compat_sigset_t __user *sigmask, 272 const compat_sigset_t __user *sigmask,
281 compat_size_t sigsetsize); 273 compat_size_t sigsetsize);
282asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags, 274asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
283 const struct compat_itimerspec __user *utmr); 275 const struct compat_itimerspec __user *utmr,
276 struct compat_itimerspec __user *otmr);
277asmlinkage long compat_sys_timerfd_gettime(int ufd,
278 struct compat_itimerspec __user *otmr);
284 279
285#endif /* CONFIG_COMPAT */ 280#endif /* CONFIG_COMPAT */
286#endif /* _LINUX_COMPAT_H */ 281#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index c4e00161a247..c8eb8c71809e 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -46,9 +46,10 @@ struct cpuidle_state {
46/* Idle State Flags */ 46/* Idle State Flags */
47#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ 47#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
48#define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */ 48#define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */
49#define CPUIDLE_FLAG_SHALLOW (0x10) /* low latency, minimal savings */ 49#define CPUIDLE_FLAG_POLL (0x10) /* no latency, no savings */
50#define CPUIDLE_FLAG_BALANCED (0x20) /* medium latency, moderate savings */ 50#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */
51#define CPUIDLE_FLAG_DEEP (0x40) /* high latency, large savings */ 51#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
52#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
52 53
53#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 54#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
54 55
@@ -72,6 +73,19 @@ cpuidle_set_statedata(struct cpuidle_state *state, void *data)
72 state->driver_data = data; 73 state->driver_data = data;
73} 74}
74 75
76#ifdef CONFIG_SMP
77#ifdef CONFIG_ARCH_HAS_CPU_IDLE_WAIT
78static inline void cpuidle_kick_cpus(void)
79{
80 cpu_idle_wait();
81}
82#else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT */
83#error "Arch needs cpu_idle_wait() equivalent here"
84#endif /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT */
85#else /* !CONFIG_SMP */
86static inline void cpuidle_kick_cpus(void) {}
87#endif /* !CONFIG_SMP */
88
75struct cpuidle_state_kobj { 89struct cpuidle_state_kobj {
76 struct cpuidle_state *state; 90 struct cpuidle_state *state;
77 struct completion kobj_unregister; 91 struct completion kobj_unregister;
@@ -79,7 +93,7 @@ struct cpuidle_state_kobj {
79}; 93};
80 94
81struct cpuidle_device { 95struct cpuidle_device {
82 int enabled:1; 96 unsigned int enabled:1;
83 unsigned int cpu; 97 unsigned int cpu;
84 98
85 int last_residency; 99 int last_residency;
@@ -178,4 +192,10 @@ static inline void cpuidle_unregister_governor(struct cpuidle_governor *gov) { }
178 192
179#endif 193#endif
180 194
195#ifdef CONFIG_ARCH_HAS_CPU_RELAX
196#define CPUIDLE_DRIVER_STATE_START 1
197#else
198#define CPUIDLE_DRIVER_STATE_START 0
199#endif
200
181#endif /* _LINUX_CPUIDLE_H */ 201#endif /* _LINUX_CPUIDLE_H */
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..acbb364674ff 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
@@ -95,6 +95,15 @@ enum dma_transaction_type {
95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) 95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1)
96 96
97/** 97/**
98 * enum dma_prep_flags - DMA flags to augment operation preparation
99 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
100 * this transaction
101 */
102enum dma_prep_flags {
103 DMA_PREP_INTERRUPT = (1 << 0),
104};
105
106/**
98 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. 107 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t.
99 * See linux/cpumask.h 108 * See linux/cpumask.h
100 */ 109 */
@@ -209,8 +218,6 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
209 * descriptors 218 * descriptors
210 * @chan: target channel for this operation 219 * @chan: target channel for this operation
211 * @tx_submit: set the prepared descriptor(s) to be executed by the engine 220 * @tx_submit: set the prepared descriptor(s) to be executed by the engine
212 * @tx_set_dest: set a destination address in a hardware descriptor
213 * @tx_set_src: set a source address in a hardware descriptor
214 * @callback: routine to call after this operation is complete 221 * @callback: routine to call after this operation is complete
215 * @callback_param: general parameter to pass to the callback routine 222 * @callback_param: general parameter to pass to the callback routine
216 * ---async_tx api specific fields--- 223 * ---async_tx api specific fields---
@@ -227,10 +234,6 @@ struct dma_async_tx_descriptor {
227 struct list_head tx_list; 234 struct list_head tx_list;
228 struct dma_chan *chan; 235 struct dma_chan *chan;
229 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 236 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
230 void (*tx_set_dest)(dma_addr_t addr,
231 struct dma_async_tx_descriptor *tx, int index);
232 void (*tx_set_src)(dma_addr_t addr,
233 struct dma_async_tx_descriptor *tx, int index);
234 dma_async_tx_callback callback; 237 dma_async_tx_callback callback;
235 void *callback_param; 238 void *callback_param;
236 struct list_head depend_list; 239 struct list_head depend_list;
@@ -279,15 +282,17 @@ struct dma_device {
279 void (*device_free_chan_resources)(struct dma_chan *chan); 282 void (*device_free_chan_resources)(struct dma_chan *chan);
280 283
281 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( 284 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
282 struct dma_chan *chan, size_t len, int int_en); 285 struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
286 size_t len, unsigned long flags);
283 struct dma_async_tx_descriptor *(*device_prep_dma_xor)( 287 struct dma_async_tx_descriptor *(*device_prep_dma_xor)(
284 struct dma_chan *chan, unsigned int src_cnt, size_t len, 288 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
285 int int_en); 289 unsigned int src_cnt, size_t len, unsigned long flags);
286 struct dma_async_tx_descriptor *(*device_prep_dma_zero_sum)( 290 struct dma_async_tx_descriptor *(*device_prep_dma_zero_sum)(
287 struct dma_chan *chan, unsigned int src_cnt, size_t len, 291 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt,
288 u32 *result, int int_en); 292 size_t len, u32 *result, unsigned long flags);
289 struct dma_async_tx_descriptor *(*device_prep_dma_memset)( 293 struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
290 struct dma_chan *chan, int value, size_t len, int int_en); 294 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
295 unsigned long flags);
291 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 296 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
292 struct dma_chan *chan); 297 struct dma_chan *chan);
293 298
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 5b42a659a308..b1251b2af568 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -79,7 +79,6 @@ extern void dmi_scan_machine(void);
79extern int dmi_get_year(int field); 79extern int dmi_get_year(int field);
80extern int dmi_name_in_vendors(const char *str); 80extern int dmi_name_in_vendors(const char *str);
81extern int dmi_available; 81extern int dmi_available;
82extern char *dmi_get_slot(int slot);
83 82
84#else 83#else
85 84
@@ -90,7 +89,6 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
90static inline int dmi_get_year(int year) { return 0; } 89static inline int dmi_get_year(int year) { return 0; }
91static inline int dmi_name_in_vendors(const char *s) { return 0; } 90static inline int dmi_name_in_vendors(const char *s) { return 0; }
92#define dmi_available 0 91#define dmi_available 0
93static inline char *dmi_get_slot(int slot) { return NULL; }
94 92
95#endif 93#endif
96 94
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..109734bf6377 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -21,7 +21,7 @@
21 21
22/* Fixed constants first: */ 22/* Fixed constants first: */
23#undef NR_OPEN 23#undef NR_OPEN
24#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */ 24extern int sysctl_nr_open;
25#define INR_OPEN 1024 /* Initial setting for nfile rlimits */ 25#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
26 26
27#define BLOCK_SIZE_BITS 10 27#define BLOCK_SIZE_BITS 10
@@ -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;
@@ -976,7 +977,6 @@ extern int send_sigurg(struct fown_struct *fown);
976extern struct list_head super_blocks; 977extern struct list_head super_blocks;
977extern spinlock_t sb_lock; 978extern spinlock_t sb_lock;
978 979
979#define sb_entry(list) list_entry((list), struct super_block, s_list)
980#define S_BIAS (1<<30) 980#define S_BIAS (1<<30)
981struct super_block { 981struct super_block {
982 struct list_head s_list; /* Keep this first */ 982 struct list_head s_list; /* Keep this first */
@@ -1278,8 +1278,10 @@ struct super_operations {
1278 * 1278 *
1279 * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. 1279 * Two bits are used for locking and completion notification, I_LOCK and I_SYNC.
1280 * 1280 *
1281 * I_DIRTY_SYNC Inode itself is dirty. 1281 * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on
1282 * I_DIRTY_DATASYNC Data-related inode changes pending 1282 * fdatasync(). i_atime is the usual cause.
1283 * I_DIRTY_DATASYNC Inode is dirty and must be written on fdatasync(), f.e.
1284 * because i_size changed.
1283 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. 1285 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean.
1284 * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both 1286 * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both
1285 * are cleared by unlock_new_inode(), called from iget(). 1287 * are cleared by unlock_new_inode(), called from iget().
@@ -1307,12 +1309,10 @@ struct super_operations {
1307 * being set. find_inode() uses this to prevent returning 1309 * being set. find_inode() uses this to prevent returning
1308 * nearly-dead inodes. 1310 * nearly-dead inodes.
1309 * I_SYNC Similar to I_LOCK, but limited in scope to writeback 1311 * I_SYNC Similar to I_LOCK, but limited in scope to writeback
1310 * of inode dirty data. Having a seperate lock for this 1312 * of inode dirty data. Having a separate lock for this
1311 * purpose reduces latency and prevents some filesystem- 1313 * purpose reduces latency and prevents some filesystem-
1312 * specific deadlocks. 1314 * specific deadlocks.
1313 * 1315 *
1314 * Q: Why does I_DIRTY_DATASYNC exist? It appears as if it could be replaced
1315 * by (I_DIRTY_SYNC|I_DIRTY_PAGES).
1316 * Q: What is the difference between I_WILL_FREE and I_FREEING? 1316 * Q: What is the difference between I_WILL_FREE and I_FREEING?
1317 * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on 1317 * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on
1318 * I_CLEAR? If not, why? 1318 * I_CLEAR? If not, why?
@@ -2112,6 +2112,7 @@ struct ctl_table;
2112int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2112int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
2113 void __user *buffer, size_t *lenp, loff_t *ppos); 2113 void __user *buffer, size_t *lenp, loff_t *ppos);
2114 2114
2115int get_filesystem_list(char * buf);
2115 2116
2116#endif /* __KERNEL__ */ 2117#endif /* __KERNEL__ */
2117#endif /* _LINUX_FS_H */ 2118#endif /* _LINUX_FS_H */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 2bd31fa623b6..d4b7c4ac72e6 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -92,6 +92,14 @@ static inline void fsnotify_inoderemove(struct inode *inode)
92} 92}
93 93
94/* 94/*
95 * fsnotify_link_count - inode's link count changed
96 */
97static inline void fsnotify_link_count(struct inode *inode)
98{
99 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
100}
101
102/*
95 * fsnotify_create - 'name' was linked in 103 * fsnotify_create - 'name' was linked in
96 */ 104 */
97static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 105static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
@@ -103,6 +111,20 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
103} 111}
104 112
105/* 113/*
114 * fsnotify_link - new hardlink in 'inode' directory
115 * Note: We have to pass also the linked inode ptr as some filesystems leave
116 * new_dentry->d_inode NULL and instantiate inode pointer later
117 */
118static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
119{
120 inode_dir_notify(dir, DN_CREATE);
121 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
122 inode);
123 fsnotify_link_count(inode);
124 audit_inode_child(new_dentry->d_name.name, new_dentry, dir);
125}
126
127/*
106 * fsnotify_mkdir - directory 'name' was created 128 * fsnotify_mkdir - directory 'name' was created
107 */ 129 */
108static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) 130static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
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/hash.h b/include/linux/hash.h
index acf17bb8e7f9..06d25c189cc5 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -1,6 +1,6 @@
1#ifndef _LINUX_HASH_H 1#ifndef _LINUX_HASH_H
2#define _LINUX_HASH_H 2#define _LINUX_HASH_H
3/* Fast hashing routine for a long. 3/* Fast hashing routine for ints, longs and pointers.
4 (C) 2002 William Lee Irwin III, IBM */ 4 (C) 2002 William Lee Irwin III, IBM */
5 5
6/* 6/*
@@ -13,23 +13,30 @@
13 * them can use shifts and additions instead of multiplications for 13 * them can use shifts and additions instead of multiplications for
14 * machines where multiplications are slow. 14 * machines where multiplications are slow.
15 */ 15 */
16#if BITS_PER_LONG == 32 16
17#include <asm/types.h>
18
17/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ 19/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
18#define GOLDEN_RATIO_PRIME 0x9e370001UL 20#define GOLDEN_RATIO_PRIME_32 0x9e370001UL
19#elif BITS_PER_LONG == 64
20/* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ 21/* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */
21#define GOLDEN_RATIO_PRIME 0x9e37fffffffc0001UL 22#define GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001UL
23
24#if BITS_PER_LONG == 32
25#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_PRIME_32
26#define hash_long(val, bits) hash_32(val, bits)
27#elif BITS_PER_LONG == 64
28#define hash_long(val, bits) hash_64(val, bits)
29#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_PRIME_64
22#else 30#else
23#error Define GOLDEN_RATIO_PRIME for your wordsize. 31#error Wordsize not 32 or 64
24#endif 32#endif
25 33
26static inline unsigned long hash_long(unsigned long val, unsigned int bits) 34static inline u64 hash_64(u64 val, unsigned int bits)
27{ 35{
28 unsigned long hash = val; 36 u64 hash = val;
29 37
30#if BITS_PER_LONG == 64
31 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ 38 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
32 unsigned long n = hash; 39 u64 n = hash;
33 n <<= 18; 40 n <<= 18;
34 hash -= n; 41 hash -= n;
35 n <<= 33; 42 n <<= 33;
@@ -42,15 +49,20 @@ static inline unsigned long hash_long(unsigned long val, unsigned int bits)
42 hash += n; 49 hash += n;
43 n <<= 2; 50 n <<= 2;
44 hash += n; 51 hash += n;
45#else 52
53 /* High bits are more random, so use them. */
54 return hash >> (64 - bits);
55}
56
57static inline u32 hash_32(u32 val, unsigned int bits)
58{
46 /* On some cpus multiply is faster, on others gcc will do shifts */ 59 /* On some cpus multiply is faster, on others gcc will do shifts */
47 hash *= GOLDEN_RATIO_PRIME; 60 u32 hash = val * GOLDEN_RATIO_PRIME_32;
48#endif
49 61
50 /* High bits are more random, so use them. */ 62 /* High bits are more random, so use them. */
51 return hash >> (BITS_PER_LONG - bits); 63 return hash >> (32 - bits);
52} 64}
53 65
54static inline unsigned long hash_ptr(void *ptr, unsigned int bits) 66static inline unsigned long hash_ptr(void *ptr, unsigned int bits)
55{ 67{
56 return hash_long((unsigned long)ptr, bits); 68 return hash_long((unsigned long)ptr, bits);
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index db390c511ada..6115545a5b9c 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -26,13 +26,6 @@
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/hdlc/ioctl.h> 27#include <linux/hdlc/ioctl.h>
28 28
29
30/* Used by all network devices here, pointed to by netdev_priv(dev) */
31struct hdlc_device_desc {
32 int (*netif_rx)(struct sk_buff *skb);
33 struct net_device_stats stats;
34};
35
36/* This structure is a private property of HDLC protocols. 29/* This structure is a private property of HDLC protocols.
37 Hardware drivers have no interest here */ 30 Hardware drivers have no interest here */
38 31
@@ -44,12 +37,15 @@ struct hdlc_proto {
44 void (*detach)(struct net_device *dev); 37 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); 39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
40 int (*netif_rx)(struct sk_buff *skb);
47 struct module *module; 41 struct module *module;
48 struct hdlc_proto *next; /* next protocol in the list */ 42 struct hdlc_proto *next; /* next protocol in the list */
49}; 43};
50 44
51 45
46/* Pointed to by dev->priv */
52typedef struct hdlc_device { 47typedef struct hdlc_device {
48 struct net_device_stats stats;
53 /* used by HDLC layer to take control over HDLC device from hw driver*/ 49 /* used by HDLC layer to take control over HDLC device from hw driver*/
54 int (*attach)(struct net_device *dev, 50 int (*attach)(struct net_device *dev,
55 unsigned short encoding, unsigned short parity); 51 unsigned short encoding, unsigned short parity);
@@ -83,18 +79,11 @@ void unregister_hdlc_protocol(struct hdlc_proto *proto);
83 79
84struct net_device *alloc_hdlcdev(void *priv); 80struct net_device *alloc_hdlcdev(void *priv);
85 81
86 82static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
87static __inline__ struct hdlc_device_desc* dev_to_desc(struct net_device *dev)
88{
89 return netdev_priv(dev);
90}
91
92static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev)
93{ 83{
94 return netdev_priv(dev) + sizeof(struct hdlc_device_desc); 84 return dev->priv;
95} 85}
96 86
97
98static __inline__ void debug_frame(const struct sk_buff *skb) 87static __inline__ void debug_frame(const struct sk_buff *skb)
99{ 88{
100 int i; 89 int i;
@@ -116,13 +105,13 @@ int hdlc_open(struct net_device *dev);
116void hdlc_close(struct net_device *dev); 105void hdlc_close(struct net_device *dev);
117 106
118int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 107int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
119 int (*rx)(struct sk_buff *skb), size_t size); 108 size_t size);
120/* May be used by hardware driver to gain control over HDLC device */ 109/* May be used by hardware driver to gain control over HDLC device */
121void detach_hdlc_protocol(struct net_device *dev); 110void detach_hdlc_protocol(struct net_device *dev);
122 111
123static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) 112static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
124{ 113{
125 return &dev_to_desc(dev)->stats; 114 return &dev_to_hdlc(dev)->stats;
126} 115}
127 116
128 117
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/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/pca953x.h b/include/linux/i2c/pca953x.h
new file mode 100644
index 000000000000..3c7361217df8
--- /dev/null
+++ b/include/linux/i2c/pca953x.h
@@ -0,0 +1,18 @@
1/* platform data for the PCA9539 16-bit I/O expander driver */
2
3struct pca953x_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 ec10b2a3bb6e..acec99da832d 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -112,18 +112,8 @@ typedef unsigned char byte; /* used everywhere */
112#define SATA_NR_PORTS (3) /* 16 possible ?? */ 112#define SATA_NR_PORTS (3) /* 16 possible ?? */
113 113
114#define SATA_STATUS_OFFSET (0) 114#define SATA_STATUS_OFFSET (0)
115#define SATA_STATUS_REG (HWIF(drive)->sata_scr[SATA_STATUS_OFFSET])
116#define SATA_ERROR_OFFSET (1) 115#define SATA_ERROR_OFFSET (1)
117#define SATA_ERROR_REG (HWIF(drive)->sata_scr[SATA_ERROR_OFFSET])
118#define SATA_CONTROL_OFFSET (2) 116#define SATA_CONTROL_OFFSET (2)
119#define SATA_CONTROL_REG (HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET])
120
121#define SATA_MISC_OFFSET (0)
122#define SATA_MISC_REG (HWIF(drive)->sata_misc[SATA_MISC_OFFSET])
123#define SATA_PHY_OFFSET (1)
124#define SATA_PHY_REG (HWIF(drive)->sata_misc[SATA_PHY_OFFSET])
125#define SATA_IEN_OFFSET (2)
126#define SATA_IEN_REG (HWIF(drive)->sata_misc[SATA_IEN_OFFSET])
127 117
128/* 118/*
129 * Our Physical Region Descriptor (PRD) table should be large enough 119 * Our Physical Region Descriptor (PRD) table should be large enough
@@ -179,7 +169,7 @@ enum { ide_unknown, ide_generic, ide_pci,
179 ide_rz1000, ide_trm290, 169 ide_rz1000, ide_trm290,
180 ide_cmd646, ide_cy82c693, ide_4drives, 170 ide_cmd646, ide_cy82c693, ide_4drives,
181 ide_pmac, ide_etrax100, ide_acorn, 171 ide_pmac, ide_etrax100, ide_acorn,
182 ide_au1xxx, ide_forced 172 ide_au1xxx, ide_palm3710, ide_forced
183}; 173};
184 174
185typedef u8 hwif_chipset_t; 175typedef u8 hwif_chipset_t;
@@ -196,6 +186,7 @@ typedef struct hw_regs_s {
196} hw_regs_t; 186} hw_regs_t;
197 187
198struct hwif_s * ide_find_port(unsigned long); 188struct hwif_s * ide_find_port(unsigned long);
189struct hwif_s *ide_deprecated_find_port(unsigned long);
199void ide_init_port_data(struct hwif_s *, unsigned int); 190void ide_init_port_data(struct hwif_s *, unsigned int);
200void ide_init_port_hw(struct hwif_s *, hw_regs_t *); 191void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
201 192
@@ -203,17 +194,6 @@ struct ide_drive_s;
203int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), 194int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
204 struct hwif_s **); 195 struct hwif_s **);
205 196
206void ide_setup_ports( hw_regs_t *hw,
207 unsigned long base,
208 int *offsets,
209 unsigned long ctrl,
210 unsigned long intr,
211 ide_ack_intr_t *ack_intr,
212#if 0
213 ide_io_ops_t *iops,
214#endif
215 int irq);
216
217static inline void ide_std_init_ports(hw_regs_t *hw, 197static inline void ide_std_init_ports(hw_regs_t *hw,
218 unsigned long io_addr, 198 unsigned long io_addr,
219 unsigned long ctl_addr) 199 unsigned long ctl_addr)
@@ -406,8 +386,6 @@ typedef struct ide_drive_s {
406 unsigned no_unmask : 1; /* disallow setting unmask bit */ 386 unsigned no_unmask : 1; /* disallow setting unmask bit */
407 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ 387 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
408 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ 388 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
409 unsigned nice0 : 1; /* give obvious excess bandwidth */
410 unsigned nice2 : 1; /* give a share in our own bandwidth */
411 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 389 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
412 unsigned nodma : 1; /* disallow DMA */ 390 unsigned nodma : 1; /* disallow DMA */
413 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ 391 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
@@ -480,14 +458,12 @@ typedef struct hwif_s {
480 /* task file registers for pata and sata */ 458 /* task file registers for pata and sata */
481 unsigned long io_ports[IDE_NR_PORTS]; 459 unsigned long io_ports[IDE_NR_PORTS];
482 unsigned long sata_scr[SATA_NR_PORTS]; 460 unsigned long sata_scr[SATA_NR_PORTS];
483 unsigned long sata_misc[SATA_NR_PORTS];
484 461
485 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 462 ide_drive_t drives[MAX_DRIVES]; /* drive info */
486 463
487 u8 major; /* our major number */ 464 u8 major; /* our major number */
488 u8 index; /* 0 for ide0; 1 for ide1; ... */ 465 u8 index; /* 0 for ide0; 1 for ide1; ... */
489 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 466 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
490 u8 straight8; /* Alan's straight 8 check */
491 u8 bus_state; /* power state of the IDE bus */ 467 u8 bus_state; /* power state of the IDE bus */
492 468
493 u32 host_flags; 469 u32 host_flags;
@@ -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,6 +604,9 @@ 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 *);
@@ -708,6 +690,7 @@ typedef struct {
708void proc_ide_create(void); 690void proc_ide_create(void);
709void proc_ide_destroy(void); 691void proc_ide_destroy(void);
710void ide_proc_register_port(ide_hwif_t *); 692void ide_proc_register_port(ide_hwif_t *);
693void ide_proc_port_register_devices(ide_hwif_t *);
711void ide_proc_unregister_port(ide_hwif_t *); 694void ide_proc_unregister_port(ide_hwif_t *);
712void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 695void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
713void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 696void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -740,6 +723,7 @@ void ide_pci_create_host_proc(const char *, get_info_t *);
740static inline void proc_ide_create(void) { ; } 723static inline void proc_ide_create(void) { ; }
741static inline void proc_ide_destroy(void) { ; } 724static inline void proc_ide_destroy(void) { ; }
742static 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) { ; }
743static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 727static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
744static 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) { ; }
745static 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) { ; }
@@ -988,10 +972,8 @@ int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
988extern int system_bus_clock(void); 972extern int system_bus_clock(void);
989 973
990extern int ide_driveid_update(ide_drive_t *); 974extern int ide_driveid_update(ide_drive_t *);
991extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
992extern int ide_config_drive_speed(ide_drive_t *, u8); 975extern int ide_config_drive_speed(ide_drive_t *, u8);
993extern u8 eighty_ninty_three (ide_drive_t *); 976extern u8 eighty_ninty_three (ide_drive_t *);
994extern int set_transfer(ide_drive_t *, ide_task_t *);
995extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); 977extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
996 978
997extern 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);
@@ -1016,6 +998,14 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1016void 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 *);
1017void 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 *);
1018 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
1019extern void default_hwif_iops(ide_hwif_t *); 1009extern void default_hwif_iops(ide_hwif_t *);
1020extern void default_hwif_mmiops(ide_hwif_t *); 1010extern void default_hwif_mmiops(ide_hwif_t *);
1021extern void default_hwif_transport(ide_hwif_t *); 1011extern void default_hwif_transport(ide_hwif_t *);
@@ -1052,7 +1042,7 @@ enum {
1052 IDE_HFLAG_NO_SET_MODE = (1 << 9), 1042 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1053 /* trust BIOS for programming chipset/device for DMA */ 1043 /* trust BIOS for programming chipset/device for DMA */
1054 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1044 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1055 /* host uses VDMA */ 1045 /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */
1056 IDE_HFLAG_VDMA = (1 << 11), 1046 IDE_HFLAG_VDMA = (1 << 11),
1057 /* ATAPI DMA is unsupported */ 1047 /* ATAPI DMA is unsupported */
1058 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1048 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
@@ -1062,8 +1052,10 @@ enum {
1062 IDE_HFLAG_NO_DMA = (1 << 14), 1052 IDE_HFLAG_NO_DMA = (1 << 14),
1063 /* check if host is PCI IDE device before allowing DMA */ 1053 /* check if host is PCI IDE device before allowing DMA */
1064 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),
1065 /* host is CS5510/CS5520 */ 1057 /* host is CS5510/CS5520 */
1066 IDE_HFLAG_CS5520 = (1 << 16), 1058 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1067 /* no LBA48 */ 1059 /* no LBA48 */
1068 IDE_HFLAG_NO_LBA48 = (1 << 17), 1060 IDE_HFLAG_NO_LBA48 = (1 << 17),
1069 /* no LBA48 DMA */ 1061 /* no LBA48 DMA */
@@ -1089,6 +1081,10 @@ enum {
1089 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), 1081 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1090 /* DSC overlap is unsupported */ 1082 /* DSC overlap is unsupported */
1091 IDE_HFLAG_NO_DSC = (1 << 29), 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),
1092}; 1088};
1093 1089
1094#ifdef CONFIG_BLK_DEV_OFFBOARD 1090#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1144,6 +1140,7 @@ void ide_dma_off_quietly(ide_drive_t *);
1144void ide_dma_off(ide_drive_t *); 1140void ide_dma_off(ide_drive_t *);
1145void ide_dma_on(ide_drive_t *); 1141void ide_dma_on(ide_drive_t *);
1146int ide_set_dma(ide_drive_t *); 1142int ide_set_dma(ide_drive_t *);
1143void ide_check_dma_crc(ide_drive_t *);
1147ide_startstop_t ide_dma_intr(ide_drive_t *); 1144ide_startstop_t ide_dma_intr(ide_drive_t *);
1148 1145
1149int ide_build_sglist(ide_drive_t *, struct request *); 1146int ide_build_sglist(ide_drive_t *, struct request *);
@@ -1171,6 +1168,7 @@ static inline void ide_dma_off(ide_drive_t *drive) { ; }
1171static inline void ide_dma_on(ide_drive_t *drive) { ; } 1168static inline void ide_dma_on(ide_drive_t *drive) { ; }
1172static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1169static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1173static 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) { ; }
1174#endif /* CONFIG_BLK_DEV_IDEDMA */ 1172#endif /* CONFIG_BLK_DEV_IDEDMA */
1175 1173
1176#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 1174#ifndef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1182,27 +1180,29 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1182extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1180extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1183extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1181extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1184extern 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 *);
1185extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1184extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1186#else 1185#else
1187static 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; }
1188static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1187static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1189static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1188static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1190static 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) { ; }
1191static 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) {}
1192#endif 1192#endif
1193 1193
1194void ide_remove_port_from_hwgroup(ide_hwif_t *); 1194void ide_remove_port_from_hwgroup(ide_hwif_t *);
1195extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1195extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1196extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1196extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1197extern void ide_unregister (unsigned int index); 1197void ide_unregister(unsigned int, int, int);
1198 1198
1199void ide_register_region(struct gendisk *); 1199void ide_register_region(struct gendisk *);
1200void ide_unregister_region(struct gendisk *); 1200void ide_unregister_region(struct gendisk *);
1201 1201
1202void ide_undecoded_slave(ide_drive_t *); 1202void ide_undecoded_slave(ide_drive_t *);
1203 1203
1204int ide_device_add_all(u8 *idx); 1204int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1205int ide_device_add(u8 idx[4]); 1205int ide_device_add(u8 idx[4], const struct ide_port_info *);
1206 1206
1207static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1207static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1208{ 1208{
@@ -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/if_vlan.h b/include/linux/if_vlan.h
index 34f40efc7607..79504b22a932 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -327,7 +327,7 @@ static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, unsigned short t
327 * 327 *
328 * Returns error if the skb is not of VLAN type 328 * Returns error if the skb is not of VLAN type
329 */ 329 */
330static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag) 330static inline int __vlan_get_tag(const struct sk_buff *skb, unsigned short *tag)
331{ 331{
332 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 332 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
333 333
@@ -347,7 +347,8 @@ static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
347 * 347 *
348 * Returns error if @skb->cb[] is not set correctly 348 * Returns error if @skb->cb[] is not set correctly
349 */ 349 */
350static inline int __vlan_hwaccel_get_tag(struct sk_buff *skb, unsigned short *tag) 350static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
351 unsigned short *tag)
351{ 352{
352 struct vlan_skb_tx_cookie *cookie; 353 struct vlan_skb_tx_cookie *cookie;
353 354
@@ -370,7 +371,7 @@ static inline int __vlan_hwaccel_get_tag(struct sk_buff *skb, unsigned short *ta
370 * 371 *
371 * Returns error if the skb is not VLAN tagged 372 * Returns error if the skb is not VLAN tagged
372 */ 373 */
373static inline int vlan_get_tag(struct sk_buff *skb, unsigned short *tag) 374static inline int vlan_get_tag(const struct sk_buff *skb, unsigned short *tag)
374{ 375{
375 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 376 if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
376 return __vlan_hwaccel_get_tag(skb, tag); 377 return __vlan_hwaccel_get_tag(skb, tag);
diff --git a/include/linux/init.h b/include/linux/init.h
index 2efbda016741..a404a0055dd7 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -110,6 +110,7 @@
110#define __FINIT .previous 110#define __FINIT .previous
111 111
112#define __INITDATA .section ".init.data","aw" 112#define __INITDATA .section ".init.data","aw"
113#define __FINITDATA .previous
113 114
114#define __DEVINIT .section ".devinit.text", "ax" 115#define __DEVINIT .section ".devinit.text", "ax"
115#define __DEVINITDATA .section ".devinit.data", "aw" 116#define __DEVINITDATA .section ".devinit.data", "aw"
@@ -124,9 +125,6 @@
124#define __REF .section ".ref.text", "ax" 125#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw" 126#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw" 127#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
130 128
131#ifndef __ASSEMBLY__ 129#ifndef __ASSEMBLY__
132/* 130/*
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index f42663eaf655..1f74e1d7415f 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -121,6 +121,18 @@ extern struct group_info init_groups;
121#else 121#else
122#define INIT_IDS 122#define INIT_IDS
123#endif 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
124/* 136/*
125 * 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
126 * your own risk!. Base=0, limit=0x1fffff (=2MB) 138 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -156,6 +168,7 @@ extern struct group_info init_groups;
156 .cap_effective = CAP_INIT_EFF_SET, \ 168 .cap_effective = CAP_INIT_EFF_SET, \
157 .cap_inheritable = CAP_INIT_INH_SET, \ 169 .cap_inheritable = CAP_INIT_INH_SET, \
158 .cap_permitted = CAP_FULL_SET, \ 170 .cap_permitted = CAP_FULL_SET, \
171 .cap_bset = CAP_INIT_BSET, \
159 .keep_capabilities = 0, \ 172 .keep_capabilities = 0, \
160 .user = INIT_USER, \ 173 .user = INIT_USER, \
161 .comm = "swapper", \ 174 .comm = "swapper", \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c3db4a00f1fa..dea7598aeff4 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -444,4 +444,6 @@ static inline void init_irq_proc(void)
444} 444}
445#endif 445#endif
446 446
447int show_interrupts(struct seq_file *p, void *v);
448
447#endif 449#endif
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/isdn.h b/include/linux/isdn.h
index d0ecc8eebfbf..9cb2855bb170 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -507,7 +507,6 @@ typedef struct modem_info {
507 struct ktermios normal_termios; /* For saving termios structs */ 507 struct ktermios normal_termios; /* For saving termios structs */
508 struct ktermios callout_termios; 508 struct ktermios callout_termios;
509 wait_queue_head_t open_wait, close_wait; 509 wait_queue_head_t open_wait, close_wait;
510 struct semaphore write_sem;
511 spinlock_t readlock; 510 spinlock_t readlock;
512} modem_info; 511} modem_info;
513 512
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index d9ecd13393b0..b18fd3b9b835 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -33,7 +33,6 @@
33#include <linux/lockdep.h> 33#include <linux/lockdep.h>
34 34
35#include <asm/semaphore.h> 35#include <asm/semaphore.h>
36#endif
37 36
38#define journal_oom_retry 1 37#define journal_oom_retry 1
39 38
@@ -84,7 +83,6 @@ static inline void jbd_free(void *ptr, size_t size)
84 83
85#define JFS_MIN_JOURNAL_BLOCKS 1024 84#define JFS_MIN_JOURNAL_BLOCKS 1024
86 85
87#ifdef __KERNEL__
88 86
89/** 87/**
90 * typedef handle_t - The handle_t type represents a single atomic update being performed by some process. 88 * typedef handle_t - The handle_t type represents a single atomic update being performed by some process.
@@ -924,7 +922,6 @@ extern int journal_recover (journal_t *journal);
924extern int journal_wipe (journal_t *, int); 922extern int journal_wipe (journal_t *, int);
925extern int journal_skip_recovery (journal_t *); 923extern int journal_skip_recovery (journal_t *);
926extern void journal_update_superblock (journal_t *, int); 924extern void journal_update_superblock (journal_t *, int);
927extern void __journal_abort_hard (journal_t *);
928extern void journal_abort (journal_t *, int); 925extern void journal_abort (journal_t *, int);
929extern int journal_errno (journal_t *); 926extern int journal_errno (journal_t *);
930extern void journal_ack_err (journal_t *); 927extern void journal_ack_err (journal_t *);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ff356b2ee478..18222f267bc4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -35,7 +35,7 @@ extern const char linux_proc_banner[];
35#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) 35#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
36#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 36#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
37#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 37#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
38#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0) 38#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
39 39
40#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) 40#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
41 41
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 6168c0a44172..4a6ce82ba039 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -152,8 +152,10 @@ static inline int arch_trampoline_kprobe(struct kprobe *p)
152struct kretprobe { 152struct kretprobe {
153 struct kprobe kp; 153 struct kprobe kp;
154 kretprobe_handler_t handler; 154 kretprobe_handler_t handler;
155 kretprobe_handler_t entry_handler;
155 int maxactive; 156 int maxactive;
156 int nmissed; 157 int nmissed;
158 size_t data_size;
157 struct hlist_head free_instances; 159 struct hlist_head free_instances;
158 struct hlist_head used_instances; 160 struct hlist_head used_instances;
159}; 161};
@@ -164,6 +166,7 @@ struct kretprobe_instance {
164 struct kretprobe *rp; 166 struct kretprobe *rp;
165 kprobe_opcode_t *ret_addr; 167 kprobe_opcode_t *ret_addr;
166 struct task_struct *task; 168 struct task_struct *task;
169 char data[0];
167}; 170};
168 171
169struct kretprobe_blackpoint { 172struct kretprobe_blackpoint {
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/libata.h b/include/linux/libata.h
index 4374c4277780..bc5a8d0c7090 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -457,7 +457,6 @@ struct ata_queued_cmd {
457 unsigned long flags; /* ATA_QCFLAG_xxx */ 457 unsigned long flags; /* ATA_QCFLAG_xxx */
458 unsigned int tag; 458 unsigned int tag;
459 unsigned int n_elem; 459 unsigned int n_elem;
460 unsigned int n_iter;
461 unsigned int mapped_n_elem; 460 unsigned int mapped_n_elem;
462 461
463 int dma_dir; 462 int dma_dir;
@@ -1367,7 +1366,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1367 qc->nbytes = qc->raw_nbytes = qc->curbytes = 0; 1366 qc->nbytes = qc->raw_nbytes = qc->curbytes = 0;
1368 qc->n_elem = 0; 1367 qc->n_elem = 0;
1369 qc->mapped_n_elem = 0; 1368 qc->mapped_n_elem = 0;
1370 qc->n_iter = 0;
1371 qc->err_mask = 0; 1369 qc->err_mask = 0;
1372 qc->pad_len = 0; 1370 qc->pad_len = 0;
1373 qc->last_sg = NULL; 1371 qc->last_sg = NULL;
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/log2.h b/include/linux/log2.h
index c8cf5e8ef171..25b808631cd9 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -190,4 +190,20 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
190 __rounddown_pow_of_two(n) \ 190 __rounddown_pow_of_two(n) \
191 ) 191 )
192 192
193/**
194 * order_base_2 - calculate the (rounded up) base 2 order of the argument
195 * @n: parameter
196 *
197 * The first few values calculated by this routine:
198 * ob2(0) = 0
199 * ob2(1) = 0
200 * ob2(2) = 1
201 * ob2(3) = 2
202 * ob2(4) = 2
203 * ob2(5) = 3
204 * ... and so on.
205 */
206
207#define order_base_2(n) ilog2(roundup_pow_of_two(n))
208
193#endif /* _LINUX_LOG2_H */ 209#endif /* _LINUX_LOG2_H */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 26a0a103898f..46169a7b559b 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -76,6 +76,7 @@ struct loop_device {
76enum { 76enum {
77 LO_FLAGS_READ_ONLY = 1, 77 LO_FLAGS_READ_ONLY = 1,
78 LO_FLAGS_USE_AOPS = 2, 78 LO_FLAGS_USE_AOPS = 2,
79 LO_FLAGS_AUTOCLEAR = 4,
79}; 80};
80 81
81#include <asm/posix_types.h> /* for __kernel_old_dev_t */ 82#include <asm/posix_types.h> /* for __kernel_old_dev_t */
diff --git a/include/linux/lp.h b/include/linux/lp.h
index 7059b6b9878a..0df024bfd6f0 100644
--- a/include/linux/lp.h
+++ b/include/linux/lp.h
@@ -99,7 +99,7 @@
99#ifdef __KERNEL__ 99#ifdef __KERNEL__
100 100
101#include <linux/wait.h> 101#include <linux/wait.h>
102#include <asm/semaphore.h> 102#include <linux/mutex.h>
103 103
104/* Magic numbers for defining port-device mappings */ 104/* Magic numbers for defining port-device mappings */
105#define LP_PARPORT_UNSPEC -4 105#define LP_PARPORT_UNSPEC -4
@@ -145,7 +145,7 @@ struct lp_struct {
145#endif 145#endif
146 wait_queue_head_t waitq; 146 wait_queue_head_t waitq;
147 unsigned int last_error; 147 unsigned int last_error;
148 struct semaphore port_mutex; 148 struct mutex port_mutex;
149 wait_queue_head_t dataq; 149 wait_queue_head_t dataq;
150 long timeout; 150 long timeout;
151 unsigned int best_mode; 151 unsigned int best_mode;
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/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/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/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..df6dd79a0d3b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1765,6 +1765,7 @@
1765#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 1765#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
1766#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 1766#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050
1767#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 1767#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060
1768#define PCI_DEVICE_ID_QUATECH_SPPXP_100 0x0278
1768 1769
1769#define PCI_VENDOR_ID_SEALEVEL 0x135e 1770#define PCI_VENDOR_ID_SEALEVEL 0x135e
1770#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 1771#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101
@@ -2043,6 +2044,23 @@
2043#define PCI_VENDOR_ID_QUICKNET 0x15e2 2044#define PCI_VENDOR_ID_QUICKNET 0x15e2
2044#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500 2045#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
2045 2046
2047/*
2048 * ADDI-DATA GmbH communication cards <info@addi-data.com>
2049 */
2050#define PCI_VENDOR_ID_ADDIDATA_OLD 0x10E8
2051#define PCI_VENDOR_ID_ADDIDATA 0x15B8
2052#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000
2053#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001
2054#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002
2055#define PCI_DEVICE_ID_ADDIDATA_APCI7800 0x818E
2056#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009
2057#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A
2058#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B
2059#define PCI_DEVICE_ID_ADDIDATA_APCI7500_3 0x700C
2060#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D
2061#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E
2062#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F
2063
2046#define PCI_VENDOR_ID_PDC 0x15e9 2064#define PCI_VENDOR_ID_PDC 0x15e9
2047 2065
2048#define PCI_VENDOR_ID_FARSITE 0x1619 2066#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 50faa0ea28e4..1ac969724bb2 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -54,7 +54,7 @@
54#ifdef CONFIG_SMP 54#ifdef CONFIG_SMP
55 55
56struct percpu_data { 56struct percpu_data {
57 void *ptrs[NR_CPUS]; 57 void *ptrs[1];
58}; 58};
59 59
60#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) 60#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
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 1c1dba9ea5fb..28dfc61cf79e 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -348,6 +348,7 @@ enum
348 FLOW_KEY_RTCLASSID, 348 FLOW_KEY_RTCLASSID,
349 FLOW_KEY_SKUID, 349 FLOW_KEY_SKUID,
350 FLOW_KEY_SKGID, 350 FLOW_KEY_SKGID,
351 FLOW_KEY_VLAN_TAG,
351 __FLOW_KEY_MAX, 352 __FLOW_KEY_MAX,
352}; 353};
353 354
@@ -459,7 +460,8 @@ enum
459#define TCF_EM_U32 3 460#define TCF_EM_U32 3
460#define TCF_EM_META 4 461#define TCF_EM_META 4
461#define TCF_EM_TEXT 5 462#define TCF_EM_TEXT 5
462#define TCF_EM_MAX 5 463#define TCF_EM_VLAN 6
464#define TCF_EM_MAX 6
463 465
464enum 466enum
465{ 467{
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..cd6332b88829 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 {
@@ -258,6 +258,7 @@ extern struct pnp_protocol isapnp_protocol;
258#else 258#else
259#define pnp_device_is_isapnp(dev) 0 259#define pnp_device_is_isapnp(dev) 0
260#endif 260#endif
261extern struct mutex pnp_res_mutex;
261 262
262#ifdef CONFIG_PNPBIOS 263#ifdef CONFIG_PNPBIOS
263extern struct pnp_protocol pnpbios_protocol; 264extern struct pnp_protocol pnpbios_protocol;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 606c0957997f..68ed19ccf1f7 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,
@@ -101,6 +94,7 @@ enum power_supply_property {
101 /* Properties of type `const char *' */ 94 /* Properties of type `const char *' */
102 POWER_SUPPLY_PROP_MODEL_NAME, 95 POWER_SUPPLY_PROP_MODEL_NAME,
103 POWER_SUPPLY_PROP_MANUFACTURER, 96 POWER_SUPPLY_PROP_MANUFACTURER,
97 POWER_SUPPLY_PROP_SERIAL_NUMBER,
104}; 98};
105 99
106enum power_supply_type { 100enum power_supply_type {
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/ptrace.h b/include/linux/ptrace.h
index 515bff053de8..6ab80714a916 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -204,6 +204,41 @@ static inline void user_enable_block_step(struct task_struct *task)
204} 204}
205#endif /* arch_has_block_step */ 205#endif /* arch_has_block_step */
206 206
207#ifndef arch_ptrace_stop_needed
208/**
209 * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called
210 * @code: current->exit_code value ptrace will stop with
211 * @info: siginfo_t pointer (or %NULL) for signal ptrace will stop with
212 *
213 * This is called with the siglock held, to decide whether or not it's
214 * necessary to release the siglock and call arch_ptrace_stop() with the
215 * same @code and @info arguments. It can be defined to a constant if
216 * arch_ptrace_stop() is never required, or always is. On machines where
217 * this makes sense, it should be defined to a quick test to optimize out
218 * calling arch_ptrace_stop() when it would be superfluous. For example,
219 * if the thread has not been back to user mode since the last stop, the
220 * thread state might indicate that nothing needs to be done.
221 */
222#define arch_ptrace_stop_needed(code, info) (0)
223#endif
224
225#ifndef arch_ptrace_stop
226/**
227 * arch_ptrace_stop - Do machine-specific work before stopping for ptrace
228 * @code: current->exit_code value ptrace will stop with
229 * @info: siginfo_t pointer (or %NULL) for signal ptrace will stop with
230 *
231 * This is called with no locks held when arch_ptrace_stop_needed() has
232 * just returned nonzero. It is allowed to block, e.g. for user memory
233 * access. The arch can have machine-specific work to be done before
234 * ptrace stops. On ia64, register backing store gets written back to user
235 * memory here. Since this can be costly (requires dropping the siglock),
236 * we only do it when the arch requires it for this particular stop, as
237 * indicated by arch_ptrace_stop_needed().
238 */
239#define arch_ptrace_stop(code, info) do { } while (0)
240#endif
241
207#endif 242#endif
208 243
209#endif 244#endif
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/raid/bitmap.h b/include/linux/raid/bitmap.h
index 306a1d1a5af0..e51b531cd0b2 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -244,6 +244,8 @@ struct bitmap {
244 */ 244 */
245 unsigned long daemon_lastrun; /* jiffies of last run */ 245 unsigned long daemon_lastrun; /* jiffies of last run */
246 unsigned long daemon_sleep; /* how many seconds between updates? */ 246 unsigned long daemon_sleep; /* how many seconds between updates? */
247 unsigned long last_end_sync; /* when we lasted called end_sync to
248 * update bitmap with resync progress */
247 249
248 atomic_t pending_writes; /* pending writes to the bitmap file */ 250 atomic_t pending_writes; /* pending writes to the bitmap file */
249 wait_queue_head_t write_wait; 251 wait_queue_head_t write_wait;
@@ -275,6 +277,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset,
275int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); 277int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded);
276void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); 278void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
277void bitmap_close_sync(struct bitmap *bitmap); 279void bitmap_close_sync(struct bitmap *bitmap);
280void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector);
278 281
279void bitmap_unplug(struct bitmap *bitmap); 282void bitmap_unplug(struct bitmap *bitmap);
280void bitmap_daemon_work(struct bitmap *bitmap); 283void bitmap_daemon_work(struct bitmap *bitmap);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index dcb729244f47..85a068bab625 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -81,6 +81,8 @@ struct mdk_rdev_s
81#define In_sync 2 /* device is in_sync with rest of array */ 81#define In_sync 2 /* device is in_sync with rest of array */
82#define WriteMostly 4 /* Avoid reading if at all possible */ 82#define WriteMostly 4 /* Avoid reading if at all possible */
83#define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */ 83#define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */
84#define AllReserved 6 /* If whole device is reserved for
85 * one array */
84 86
85 int desc_nr; /* descriptor index in the superblock */ 87 int desc_nr; /* descriptor index in the superblock */
86 int raid_disk; /* role of device in array */ 88 int raid_disk; /* role of device in array */
@@ -130,6 +132,9 @@ struct mddev_s
130 minor_version, 132 minor_version,
131 patch_version; 133 patch_version;
132 int persistent; 134 int persistent;
135 int external; /* metadata is
136 * managed externally */
137 char metadata_type[17]; /* externally set*/
133 int chunk_size; 138 int chunk_size;
134 time_t ctime, utime; 139 time_t ctime, utime;
135 int level, layout; 140 int level, layout;
@@ -216,6 +221,8 @@ struct mddev_s
216 atomic_t recovery_active; /* blocks scheduled, but not written */ 221 atomic_t recovery_active; /* blocks scheduled, but not written */
217 wait_queue_head_t recovery_wait; 222 wait_queue_head_t recovery_wait;
218 sector_t recovery_cp; 223 sector_t recovery_cp;
224 sector_t resync_max; /* resync should pause
225 * when it gets here */
219 226
220 spinlock_t write_lock; 227 spinlock_t write_lock;
221 wait_queue_head_t sb_wait; /* for waiting on superblock updates */ 228 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
@@ -306,23 +313,17 @@ static inline char * mdname (mddev_t * mddev)
306 * iterates through some rdev ringlist. It's safe to remove the 313 * iterates through some rdev ringlist. It's safe to remove the
307 * current 'rdev'. Dont touch 'tmp' though. 314 * current 'rdev'. Dont touch 'tmp' though.
308 */ 315 */
309#define ITERATE_RDEV_GENERIC(head,rdev,tmp) \ 316#define rdev_for_each_list(rdev, tmp, list) \
310 \ 317 \
311 for ((tmp) = (head).next; \ 318 for ((tmp) = (list).next; \
312 (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), \ 319 (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), \
313 (tmp) = (tmp)->next, (tmp)->prev != &(head) \ 320 (tmp) = (tmp)->next, (tmp)->prev != &(list) \
314 ; ) 321 ; )
315/* 322/*
316 * iterates through the 'same array disks' ringlist 323 * iterates through the 'same array disks' ringlist
317 */ 324 */
318#define ITERATE_RDEV(mddev,rdev,tmp) \ 325#define rdev_for_each(rdev, tmp, mddev) \
319 ITERATE_RDEV_GENERIC((mddev)->disks,rdev,tmp) 326 rdev_for_each_list(rdev, tmp, (mddev)->disks)
320
321/*
322 * Iterates through 'pending RAID disks'
323 */
324#define ITERATE_RDEV_PENDING(rdev,tmp) \
325 ITERATE_RDEV_GENERIC(pending_raid_disks,rdev,tmp)
326 327
327typedef struct mdk_thread_s { 328typedef struct mdk_thread_s {
328 void (*run) (mddev_t *mddev); 329 void (*run) (mddev_t *mddev);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d32c14de270e..37a642c54871 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -174,10 +174,13 @@ struct rcu_head {
174 * code. 174 * code.
175 */ 175 */
176 176
177#define rcu_assign_pointer(p, v) ({ \ 177#define rcu_assign_pointer(p, v) \
178 smp_wmb(); \ 178 ({ \
179 (p) = (v); \ 179 if (!__builtin_constant_p(v) || \
180 }) 180 ((v) != NULL)) \
181 smp_wmb(); \
182 (p) = (v); \
183 })
181 184
182/** 185/**
183 * synchronize_sched - block until all CPUs have exited any non-preemptive 186 * synchronize_sched - block until all CPUs have exited any non-preemptive
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/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 af6947e69b40..7c8ca05c3cae 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -555,6 +555,13 @@ struct signal_struct {
555#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ 555#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */
556#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ 556#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */
557 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
558/* 565/*
559 * Some day this will be a full-fledged user tracking system.. 566 * Some day this will be a full-fledged user tracking system..
560 */ 567 */
@@ -803,7 +810,7 @@ static inline int above_background_load(void)
803 810
804struct io_context; /* See blkdev.h */ 811struct io_context; /* See blkdev.h */
805#define NGROUPS_SMALL 32 812#define NGROUPS_SMALL 32
806#define NGROUPS_PER_BLOCK ((int)(PAGE_SIZE / sizeof(gid_t))) 813#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
807struct group_info { 814struct group_info {
808 int ngroups; 815 int ngroups;
809 atomic_t usage; 816 atomic_t usage;
@@ -1091,7 +1098,7 @@ struct task_struct {
1091 uid_t uid,euid,suid,fsuid; 1098 uid_t uid,euid,suid,fsuid;
1092 gid_t gid,egid,sgid,fsgid; 1099 gid_t gid,egid,sgid,fsgid;
1093 struct group_info *group_info; 1100 struct group_info *group_info;
1094 kernel_cap_t cap_effective, cap_inheritable, cap_permitted; 1101 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1095 unsigned keep_capabilities:1; 1102 unsigned keep_capabilities:1;
1096 struct user_struct *user; 1103 struct user_struct *user;
1097#ifdef CONFIG_KEYS 1104#ifdef CONFIG_KEYS
@@ -1770,7 +1777,7 @@ extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned lon
1770struct task_struct *fork_idle(int); 1777struct task_struct *fork_idle(int);
1771 1778
1772extern void set_task_comm(struct task_struct *tsk, char *from); 1779extern void set_task_comm(struct task_struct *tsk, char *from);
1773extern void get_task_comm(char *to, struct task_struct *tsk); 1780extern char *get_task_comm(char *to, struct task_struct *tsk);
1774 1781
1775#ifdef CONFIG_SMP 1782#ifdef CONFIG_SMP
1776extern void wait_task_inactive(struct task_struct * p); 1783extern void wait_task_inactive(struct task_struct * p);
@@ -2080,6 +2087,10 @@ static inline void migration_init(void)
2080} 2087}
2081#endif 2088#endif
2082 2089
2090#ifndef TASK_SIZE_OF
2091#define TASK_SIZE_OF(tsk) TASK_SIZE
2092#endif
2093
2083#endif /* __KERNEL__ */ 2094#endif /* __KERNEL__ */
2084 2095
2085#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/signal.h b/include/linux/signal.h
index 0ae338866240..7e095147656c 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -371,6 +371,8 @@ int unhandled_signal(struct task_struct *tsk, int sig);
371 (!siginmask(signr, SIG_KERNEL_IGNORE_MASK|SIG_KERNEL_STOP_MASK) && \ 371 (!siginmask(signr, SIG_KERNEL_IGNORE_MASK|SIG_KERNEL_STOP_MASK) && \
372 (t)->sighand->action[(signr)-1].sa.sa_handler == SIG_DFL) 372 (t)->sighand->action[(signr)-1].sa.sa_handler == SIG_DFL)
373 373
374void signals_init(void);
375
374#endif /* __KERNEL__ */ 376#endif /* __KERNEL__ */
375 377
376#endif /* _LINUX_SIGNAL_H */ 378#endif /* _LINUX_SIGNAL_H */
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 dfe975a9967e..412672a79e8a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1810,5 +1810,6 @@ static inline void skb_forward_csum(struct sk_buff *skb)
1810 skb->ip_summed = CHECKSUM_NONE; 1810 skb->ip_summed = CHECKSUM_NONE;
1811} 1811}
1812 1812
1813bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
1813#endif /* __KERNEL__ */ 1814#endif /* __KERNEL__ */
1814#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/sm501.h b/include/linux/sm501.h
index 9e3aaad6fe4d..932a9efee8a5 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -70,6 +70,8 @@ extern unsigned long sm501_gpio_get(struct device *dev,
70#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1) 70#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
71#define SM501FB_FLAG_USE_HWCURSOR (1<<2) 71#define SM501FB_FLAG_USE_HWCURSOR (1<<2)
72#define SM501FB_FLAG_USE_HWACCEL (1<<3) 72#define SM501FB_FLAG_USE_HWACCEL (1<<3)
73#define SM501FB_FLAG_PANEL_USE_FPEN (1<<4)
74#define SM501FB_FLAG_PANEL_USE_VBIASEN (1<<5)
73 75
74struct sm501_platdata_fbsub { 76struct sm501_platdata_fbsub {
75 struct fb_videomode *def_mode; 77 struct fb_videomode *def_mode;
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 40c7b5d993b9..f41ffd7c2dd9 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -101,6 +101,8 @@
101#define SONYPI_EVENT_FNKEY_RELEASED 59 101#define SONYPI_EVENT_FNKEY_RELEASED 59
102#define SONYPI_EVENT_WIRELESS_ON 60 102#define SONYPI_EVENT_WIRELESS_ON 60
103#define SONYPI_EVENT_WIRELESS_OFF 61 103#define SONYPI_EVENT_WIRELESS_OFF 61
104#define SONYPI_EVENT_ZOOM_IN_PRESSED 62
105#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63
104 106
105/* get/set brightness */ 107/* get/set brightness */
106#define SONYPI_IOCGBRT _IOR('v', 0, __u8) 108#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
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/ssb/ssb.h b/include/linux/ssb/ssb.h
index e18f5c23b930..9d5da8b2ccf9 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -373,6 +373,15 @@ void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state)
373 if (sdev->bus->bustype == SSB_BUSTYPE_PCI) 373 if (sdev->bus->bustype == SSB_BUSTYPE_PCI)
374 pci_set_power_state(sdev->bus->host_pci, state); 374 pci_set_power_state(sdev->bus->host_pci, state);
375} 375}
376#else
377static inline void ssb_pcihost_unregister(struct pci_driver *driver)
378{
379}
380
381static inline
382void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state)
383{
384}
376#endif /* CONFIG_SSB_PCIHOST */ 385#endif /* CONFIG_SSB_PCIHOST */
377 386
378 387
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/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/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 4f3838adbb30..353153ea0bd5 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -158,9 +158,6 @@ struct swap_list_t {
158/* Swap 50% full? Release swapcache more aggressively.. */ 158/* Swap 50% full? Release swapcache more aggressively.. */
159#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 159#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
160 160
161/* linux/mm/memory.c */
162extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
163
164/* linux/mm/page_alloc.c */ 161/* linux/mm/page_alloc.c */
165extern unsigned long totalram_pages; 162extern unsigned long totalram_pages;
166extern unsigned long totalreserve_pages; 163extern unsigned long totalreserve_pages;
@@ -223,16 +220,17 @@ extern struct address_space swapper_space;
223#define total_swapcache_pages swapper_space.nrpages 220#define total_swapcache_pages swapper_space.nrpages
224extern void show_swap_cache_info(void); 221extern void show_swap_cache_info(void);
225extern 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);
226extern void __delete_from_swap_cache(struct page *); 224extern void __delete_from_swap_cache(struct page *);
227extern void delete_from_swap_cache(struct page *); 225extern void delete_from_swap_cache(struct page *);
228extern int move_to_swap_cache(struct page *, swp_entry_t);
229extern int move_from_swap_cache(struct page *, unsigned long,
230 struct address_space *);
231extern void free_page_and_swap_cache(struct page *); 226extern void free_page_and_swap_cache(struct page *);
232extern void free_pages_and_swap_cache(struct page **, int); 227extern void free_pages_and_swap_cache(struct page **, int);
233extern struct page * lookup_swap_cache(swp_entry_t); 228extern struct page *lookup_swap_cache(swp_entry_t);
234extern 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,
235 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
236/* linux/mm/swapfile.c */ 234/* linux/mm/swapfile.c */
237extern long total_swap_pages; 235extern long total_swap_pages;
238extern unsigned int nr_swapfiles; 236extern unsigned int nr_swapfiles;
@@ -306,7 +304,7 @@ static inline void swap_free(swp_entry_t swp)
306{ 304{
307} 305}
308 306
309static 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,
310 struct vm_area_struct *vma, unsigned long addr) 308 struct vm_area_struct *vma, unsigned long addr)
311{ 309{
312 return NULL; 310 return NULL;
@@ -317,22 +315,12 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)
317 return NULL; 315 return NULL;
318} 316}
319 317
320static inline int valid_swaphandles(swp_entry_t entry, unsigned long *offset)
321{
322 return 0;
323}
324
325#define can_share_swap_page(p) (page_mapcount(p) == 1) 318#define can_share_swap_page(p) (page_mapcount(p) == 1)
326 319
327static 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,
328{ 321 gfp_t gfp_mask)
329 return 1;
330}
331
332static inline int move_from_swap_cache(struct page *page, unsigned long index,
333 struct address_space *mapping)
334{ 322{
335 return 1; 323 return -1;
336} 324}
337 325
338static 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 bf4ae4e138f7..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
@@ -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/timex.h b/include/linux/timex.h
index 24c6a2b59511..8ea3e71ba7fa 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -244,6 +244,8 @@ extern int do_adjtimex(struct timex *);
244/* Don't use! Compatibility define for existing users. */ 244/* Don't use! Compatibility define for existing users. */
245#define tickadj (500/HZ ? : 1) 245#define tickadj (500/HZ ? : 1)
246 246
247int read_current_timer(unsigned long *timer_val);
248
247#endif /* KERNEL */ 249#endif /* KERNEL */
248 250
249#endif /* LINUX_TIMEX_H */ 251#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 402de892b3ed..5824a9777ad7 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -74,7 +74,6 @@ struct tty_buffer {
74 74
75struct tty_bufhead { 75struct tty_bufhead {
76 struct delayed_work work; 76 struct delayed_work work;
77 struct semaphore pty_sem;
78 spinlock_t lock; 77 spinlock_t lock;
79 struct tty_buffer *head; /* Queue head */ 78 struct tty_buffer *head; /* Queue head */
80 struct tty_buffer *tail; /* Active buffer */ 79 struct tty_buffer *tail; /* Active buffer */
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/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_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/vt_kern.h b/include/linux/vt_kern.h
index feb5e99a1079..9448ffbdcbf6 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -77,6 +77,7 @@ void change_console(struct vc_data *new_vc);
77void reset_vc(struct vc_data *vc); 77void reset_vc(struct vc_data *vc);
78extern int unbind_con_driver(const struct consw *csw, int first, int last, 78extern int unbind_con_driver(const struct consw *csw, int first, int last,
79 int deflt); 79 int deflt);
80int vty_init(void);
80 81
81/* 82/*
82 * vc_screen.c shares this temporary buffer with the console write code so that 83 * vc_screen.c shares this temporary buffer with the console write code so that
diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h
new file mode 100644
index 000000000000..9797fec7748a
--- /dev/null
+++ b/include/linux/w1-gpio.h
@@ -0,0 +1,23 @@
1/*
2 * w1-gpio interface to platform code
3 *
4 * Copyright (C) 2007 Ville Syrjala <syrjala@sci.fi>
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
8 * as published by the Free Software Foundation.
9 */
10#ifndef _LINUX_W1_GPIO_H
11#define _LINUX_W1_GPIO_H
12
13/**
14 * struct w1_gpio_platform_data - Platform-dependent data for w1-gpio
15 * @pin: GPIO pin to use
16 * @is_open_drain: GPIO pin is configured as open drain
17 */
18struct w1_gpio_platform_data {
19 unsigned int pin;
20 unsigned int is_open_drain:1;
21};
22
23#endif /* _LINUX_W1_GPIO_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1f4fb0a81ecd..33a2aa9e02f2 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -162,6 +162,22 @@ wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int));
162#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)
163#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) 163#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1)
164 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
180
165#define __wait_event(wq, condition) \ 181#define __wait_event(wq, condition) \
166do { \ 182do { \
167 DEFINE_WAIT(__wait); \ 183 DEFINE_WAIT(__wait); \
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/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/9p/9p.h b/include/net/9p/9p.h
index 625346c47ee2..585eb4496990 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -124,6 +124,7 @@ enum {
124 P9_DMSOCKET = 0x00100000, 124 P9_DMSOCKET = 0x00100000,
125 P9_DMSETUID = 0x00080000, 125 P9_DMSETUID = 0x00080000,
126 P9_DMSETGID = 0x00040000, 126 P9_DMSETGID = 0x00040000,
127 P9_DMSETVTX = 0x00010000,
127}; 128};
128 129
129/* qid.types */ 130/* qid.types */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 9b9221a21392..e52f93d9ac5f 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * 9P Client Definitions 4 * 9P Client Definitions
5 * 5 *
6 * Copyright (C) 2008 by Eric Van Hensbergen <ericvh@gmail.com>
6 * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net> 7 * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -29,6 +30,7 @@ struct p9_client {
29 spinlock_t lock; /* protect client structure */ 30 spinlock_t lock; /* protect client structure */
30 int msize; 31 int msize;
31 unsigned char dotu; 32 unsigned char dotu;
33 struct p9_trans_module *trans_mod;
32 struct p9_trans *trans; 34 struct p9_trans *trans;
33 struct p9_conn *conn; 35 struct p9_conn *conn;
34 36
@@ -52,8 +54,7 @@ struct p9_fid {
52 struct list_head dlist; /* list of all fids attached to a dentry */ 54 struct list_head dlist; /* list of all fids attached to a dentry */
53}; 55};
54 56
55struct p9_client *p9_client_create(struct p9_trans *trans, int msize, 57struct p9_client *p9_client_create(const char *dev_name, char *options);
56 int dotu);
57void p9_client_destroy(struct p9_client *clnt); 58void p9_client_destroy(struct p9_client *clnt);
58void p9_client_disconnect(struct p9_client *clnt); 59void p9_client_disconnect(struct p9_client *clnt);
59struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, 60struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
diff --git a/include/net/9p/conn.h b/include/net/9p/conn.h
deleted file mode 100644
index 756d8784f953..000000000000
--- a/include/net/9p/conn.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * include/net/9p/conn.h
3 *
4 * Connection Definitions
5 *
6 * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
7 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
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:
20 * Free Software Foundation
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02111-1301 USA
23 *
24 */
25
26#ifndef NET_9P_CONN_H
27#define NET_9P_CONN_H
28
29#undef P9_NONBLOCK
30
31struct p9_conn;
32struct p9_req;
33
34/**
35 * p9_mux_req_callback - callback function that is called when the
36 * response of a request is received. The callback is called from
37 * a workqueue and shouldn't block.
38 *
39 * @req - request
40 * @a - the pointer that was specified when the request was send to be
41 * passed to the callback
42 */
43typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a);
44
45struct p9_conn *p9_conn_create(struct p9_trans *trans, int msize,
46 unsigned char *dotu);
47void p9_conn_destroy(struct p9_conn *);
48int p9_conn_rpc(struct p9_conn *m, struct p9_fcall *tc, struct p9_fcall **rc);
49
50#ifdef P9_NONBLOCK
51int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
52 p9_conn_req_callback cb, void *a);
53#endif /* P9_NONBLOCK */
54
55void p9_conn_cancel(struct p9_conn *m, int err);
56
57#endif /* NET_9P_CONN_H */
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 9dd4a05619a8..d2209ae9d18b 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -4,7 +4,7 @@
4 * Transport Definition 4 * Transport Definition
5 * 5 *
6 * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> 6 * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
7 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> 7 * Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 10 * it under the terms of the GNU General Public License version 2
@@ -34,11 +34,12 @@ enum p9_trans_status {
34 34
35struct p9_trans { 35struct p9_trans {
36 enum p9_trans_status status; 36 enum p9_trans_status status;
37 int msize;
38 unsigned char extended;
37 void *priv; 39 void *priv;
38 int (*write) (struct p9_trans *, void *, int);
39 int (*read) (struct p9_trans *, void *, int);
40 void (*close) (struct p9_trans *); 40 void (*close) (struct p9_trans *);
41 unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *); 41 int (*rpc) (struct p9_trans *t, struct p9_fcall *tc,
42 struct p9_fcall **rc);
42}; 43};
43 44
44struct p9_trans_module { 45struct p9_trans_module {
@@ -46,7 +47,7 @@ struct p9_trans_module {
46 char *name; /* name of transport */ 47 char *name; /* name of transport */
47 int maxsize; /* max message size of transport */ 48 int maxsize; /* max message size of transport */
48 int def; /* this transport should be default */ 49 int def; /* this transport should be default */
49 struct p9_trans * (*create)(const char *devname, char *options); 50 struct p9_trans * (*create)(const char *, char *, int, unsigned char);
50}; 51};
51 52
52void v9fs_register_trans(struct p9_trans_module *m); 53void v9fs_register_trans(struct p9_trans_module *m);
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 fdff630708ce..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
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 c23c4ed30724..97dc35ad09be 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -221,9 +221,9 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
221} 221}
222 222
223/* Caller must disable local BH processing. */ 223/* Caller must disable local BH processing. */
224static inline void __inet_inherit_port(struct inet_hashinfo *table, 224static inline void __inet_inherit_port(struct sock *sk, struct sock *child)
225 struct sock *sk, struct sock *child)
226{ 225{
226 struct inet_hashinfo *table = sk->sk_prot->hashinfo;
227 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);
228 struct inet_bind_hashbucket *head = &table->bhash[bhash]; 228 struct inet_bind_hashbucket *head = &table->bhash[bhash];
229 struct inet_bind_bucket *tb; 229 struct inet_bind_bucket *tb;
@@ -235,15 +235,14 @@ static inline void __inet_inherit_port(struct inet_hashinfo *table,
235 spin_unlock(&head->lock); 235 spin_unlock(&head->lock);
236} 236}
237 237
238static inline void inet_inherit_port(struct inet_hashinfo *table, 238static inline void inet_inherit_port(struct sock *sk, struct sock *child)
239 struct sock *sk, struct sock *child)
240{ 239{
241 local_bh_disable(); 240 local_bh_disable();
242 __inet_inherit_port(table, sk, child); 241 __inet_inherit_port(sk, child);
243 local_bh_enable(); 242 local_bh_enable();
244} 243}
245 244
246extern void inet_put_port(struct inet_hashinfo *table, struct sock *sk); 245extern void inet_put_port(struct sock *sk);
247 246
248extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); 247extern void inet_listen_wlock(struct inet_hashinfo *hashinfo);
249 248
@@ -266,41 +265,9 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
266 wake_up(&hashinfo->lhash_wait); 265 wake_up(&hashinfo->lhash_wait);
267} 266}
268 267
269extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk); 268extern void __inet_hash_nolisten(struct sock *sk);
270extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk); 269extern void inet_hash(struct sock *sk);
271 270extern void inet_unhash(struct sock *sk);
272static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk)
273{
274 if (sk->sk_state != TCP_CLOSE) {
275 local_bh_disable();
276 __inet_hash(hashinfo, sk);
277 local_bh_enable();
278 }
279}
280
281static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
282{
283 rwlock_t *lock;
284
285 if (sk_unhashed(sk))
286 goto out;
287
288 if (sk->sk_state == TCP_LISTEN) {
289 local_bh_disable();
290 inet_listen_wlock(hashinfo);
291 lock = &hashinfo->lhash_lock;
292 } else {
293 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
294 write_lock_bh(lock);
295 }
296
297 if (__sk_del_node_init(sk))
298 sock_prot_inuse_add(sk->sk_prot, -1);
299 write_unlock_bh(lock);
300out:
301 if (sk->sk_state == TCP_LISTEN)
302 wake_up(&hashinfo->lhash_wait);
303}
304 271
305extern struct sock *__inet_lookup_listener(struct net *net, 272extern struct sock *__inet_lookup_listener(struct net *net,
306 struct inet_hashinfo *hashinfo, 273 struct inet_hashinfo *hashinfo,
@@ -422,10 +389,10 @@ static inline struct sock *inet_lookup(struct net *net,
422} 389}
423 390
424extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 391extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
425 struct sock *sk, 392 struct sock *sk, u32 port_offset,
426 int (*check_established)(struct inet_timewait_death_row *, 393 int (*check_established)(struct inet_timewait_death_row *,
427 struct sock *, __u16, struct inet_timewait_sock **), 394 struct sock *, __u16, struct inet_timewait_sock **),
428 void (*hash)(struct inet_hashinfo *, struct sock *)); 395 void (*hash)(struct sock *sk));
429extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 396extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
430 struct sock *sk); 397 struct sock *sk);
431#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 90d1175f63de..8b12667f7a2b 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -266,6 +266,14 @@ static inline void fib_res_put(struct fib_result *res)
266#ifdef CONFIG_PROC_FS 266#ifdef CONFIG_PROC_FS
267extern int __net_init fib_proc_init(struct net *net); 267extern int __net_init fib_proc_init(struct net *net);
268extern 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}
269#endif 277#endif
270 278
271#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/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/sock.h b/include/net/sock.h
index e3fb4c047f4c..8a7889b35810 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -496,6 +496,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);
496 496
497struct request_sock_ops; 497struct request_sock_ops;
498struct timewait_sock_ops; 498struct timewait_sock_ops;
499struct inet_hashinfo;
499 500
500/* Networking protocol blocks we attach to sockets. 501/* Networking protocol blocks we attach to sockets.
501 * socket layer -> transport layer interface 502 * socket layer -> transport layer interface
@@ -578,6 +579,8 @@ struct proto {
578 struct request_sock_ops *rsk_prot; 579 struct request_sock_ops *rsk_prot;
579 struct timewait_sock_ops *twsk_prot; 580 struct timewait_sock_ops *twsk_prot;
580 581
582 struct inet_hashinfo *hashinfo;
583
581 struct module *owner; 584 struct module *owner;
582 585
583 char name[32]; 586 char name[32];
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/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 4eea63761a3f..336c20db87f8 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -22,7 +22,7 @@
22#ifndef __ATMEL_LCDC_H__ 22#ifndef __ATMEL_LCDC_H__
23#define __ATMEL_LCDC_H__ 23#define __ATMEL_LCDC_H__
24 24
25 /* LCD Controller info data structure */ 25 /* LCD Controller info data structure, stored in device platform_data */
26struct atmel_lcdfb_info { 26struct atmel_lcdfb_info {
27 spinlock_t lock; 27 spinlock_t lock;
28 struct fb_info *info; 28 struct fb_info *info;
@@ -33,7 +33,14 @@ struct atmel_lcdfb_info {
33 struct platform_device *pdev; 33 struct platform_device *pdev;
34 struct clk *bus_clk; 34 struct clk *bus_clk;
35 struct clk *lcdc_clk; 35 struct clk *lcdc_clk;
36 unsigned int default_bpp; 36
37#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
38 struct backlight_device *backlight;
39 u8 bl_power;
40#endif
41 bool lcdcon_is_backlight;
42
43 u8 default_bpp;
37 unsigned int default_lcdcon2; 44 unsigned int default_lcdcon2;
38 unsigned int default_dmacon; 45 unsigned int default_dmacon;
39 void (*atmel_lcdfb_power_control)(int on); 46 void (*atmel_lcdfb_power_control)(int on);
@@ -115,20 +122,20 @@ struct atmel_lcdfb_info {
115#define ATMEL_LCDC_MEMOR_LITTLE (1 << 31) 122#define ATMEL_LCDC_MEMOR_LITTLE (1 << 31)
116 123
117#define ATMEL_LCDC_TIM1 0x0808 124#define ATMEL_LCDC_TIM1 0x0808
118#define ATMEL_LCDC_VFP (0xff << 0) 125#define ATMEL_LCDC_VFP (0xffU << 0)
119#define ATMEL_LCDC_VBP_OFFSET 8 126#define ATMEL_LCDC_VBP_OFFSET 8
120#define ATMEL_LCDC_VBP (0xff << ATMEL_LCDC_VBP_OFFSET) 127#define ATMEL_LCDC_VBP (0xffU << ATMEL_LCDC_VBP_OFFSET)
121#define ATMEL_LCDC_VPW_OFFSET 16 128#define ATMEL_LCDC_VPW_OFFSET 16
122#define ATMEL_LCDC_VPW (0x3f << ATMEL_LCDC_VPW_OFFSET) 129#define ATMEL_LCDC_VPW (0x3fU << ATMEL_LCDC_VPW_OFFSET)
123#define ATMEL_LCDC_VHDLY_OFFSET 24 130#define ATMEL_LCDC_VHDLY_OFFSET 24
124#define ATMEL_LCDC_VHDLY (0xf << ATMEL_LCDC_VHDLY_OFFSET) 131#define ATMEL_LCDC_VHDLY (0xfU << ATMEL_LCDC_VHDLY_OFFSET)
125 132
126#define ATMEL_LCDC_TIM2 0x080c 133#define ATMEL_LCDC_TIM2 0x080c
127#define ATMEL_LCDC_HBP (0xff << 0) 134#define ATMEL_LCDC_HBP (0xffU << 0)
128#define ATMEL_LCDC_HPW_OFFSET 8 135#define ATMEL_LCDC_HPW_OFFSET 8
129#define ATMEL_LCDC_HPW (0x3f << ATMEL_LCDC_HPW_OFFSET) 136#define ATMEL_LCDC_HPW (0x3fU << ATMEL_LCDC_HPW_OFFSET)
130#define ATMEL_LCDC_HFP_OFFSET 21 137#define ATMEL_LCDC_HFP_OFFSET 21
131#define ATMEL_LCDC_HFP (0x7ff << ATMEL_LCDC_HFP_OFFSET) 138#define ATMEL_LCDC_HFP (0x7ffU << ATMEL_LCDC_HFP_OFFSET)
132 139
133#define ATMEL_LCDC_LCDFRMCFG 0x0810 140#define ATMEL_LCDC_LCDFRMCFG 0x0810
134#define ATMEL_LCDC_LINEVAL (0x7ff << 0) 141#define ATMEL_LCDC_LINEVAL (0x7ff << 0)