aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-21 10:37:27 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-21 10:37:27 -0500
commit77835492ed489c0b870f82f4c50687bd267acc0a (patch)
treed80903ce1b8dd30aa44ccfc756616ad4d6c74d63
parentaf37501c792107c2bde1524bdae38d9a247b841a (diff)
parent1de9e8e70f5acc441550ca75433563d91b269bbe (diff)
Merge commit 'v2.6.29-rc2' into perfcounters/core
Conflicts: include/linux/syscalls.h
-rw-r--r--CREDITS11
-rw-r--r--Documentation/DMA-API.txt9
-rw-r--r--Documentation/accounting/getdelays.c4
-rw-r--r--Documentation/cgroups/cgroups.txt5
-rw-r--r--Documentation/cgroups/cpuacct.txt (renamed from Documentation/controllers/cpuacct.txt)0
-rw-r--r--Documentation/cgroups/cpusets.txt (renamed from Documentation/cpusets.txt)0
-rw-r--r--Documentation/cgroups/devices.txt (renamed from Documentation/controllers/devices.txt)0
-rw-r--r--Documentation/cgroups/memcg_test.txt (renamed from Documentation/controllers/memcg_test.txt)2
-rw-r--r--Documentation/cgroups/memory.txt (renamed from Documentation/controllers/memory.txt)0
-rw-r--r--Documentation/cgroups/resource_counter.txt (renamed from Documentation/controllers/resource_counter.txt)0
-rw-r--r--Documentation/filesystems/proc.txt288
-rw-r--r--Documentation/hwmon/adt747587
-rw-r--r--Documentation/hwmon/lis3lv02d30
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt25
-rw-r--r--Documentation/mips/AU1xxx_IDE.README6
-rw-r--r--Documentation/scheduler/sched-design-CFS.txt2
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt12
-rw-r--r--Documentation/sysctl/vm.txt619
-rw-r--r--Documentation/sysrq.txt19
-rw-r--r--MAINTAINERS19
-rw-r--r--Makefile2
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/byteorder.h1
-rw-r--r--arch/alpha/include/asm/machvec.h4
-rw-r--r--arch/alpha/include/asm/pgalloc.h7
-rw-r--r--arch/alpha/include/asm/rtc.h12
-rw-r--r--arch/alpha/kernel/.gitignore1
-rw-r--r--arch/alpha/kernel/core_marvel.c10
-rw-r--r--arch/alpha/kernel/entry.S8
-rw-r--r--arch/alpha/kernel/irq_srm.c2
-rw-r--r--arch/alpha/kernel/machvec_impl.h5
-rw-r--r--arch/alpha/kernel/proto.h2
-rw-r--r--arch/alpha/kernel/sys_jensen.c2
-rw-r--r--arch/alpha/kernel/sys_marvel.c56
-rw-r--r--arch/alpha/kernel/sys_nautilus.c4
-rw-r--r--arch/alpha/kernel/systbls.S2
-rw-r--r--arch/alpha/kernel/time.c10
-rw-r--r--arch/alpha/mm/init.c7
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/byteorder.h2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/avr32/include/asm/Kbuild1
-rw-r--r--arch/avr32/include/asm/byteorder.h1
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/byteorder.h1
-rw-r--r--arch/cris/arch-v10/kernel/entry.S2
-rw-r--r--arch/cris/arch-v32/kernel/entry.S2
-rw-r--r--arch/cris/include/arch-v10/arch/swab.h (renamed from arch/cris/include/arch-v10/arch/byteorder.h)16
-rw-r--r--arch/cris/include/arch-v32/arch/byteorder.h20
-rw-r--r--arch/cris/include/arch-v32/arch/swab.h24
-rw-r--r--arch/cris/include/asm/byteorder.h19
-rw-r--r--arch/cris/include/asm/swab.h8
-rw-r--r--arch/h8300/include/asm/Kbuild1
-rw-r--r--arch/h8300/include/asm/byteorder.h1
-rw-r--r--arch/h8300/kernel/syscalls.S2
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/configs/generic_defconfig2
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/byteorder.h1
-rw-r--r--arch/ia64/include/asm/dma-mapping.h2
-rw-r--r--arch/ia64/include/asm/machvec.h7
-rw-r--r--arch/ia64/include/asm/machvec_init.h1
-rw-r--r--arch/ia64/include/asm/machvec_sn2.h2
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/kprobes.c2
-rw-r--r--arch/ia64/kernel/sys_ia64.c2
-rw-r--r--arch/ia64/kernel/unaligned.c6
-rw-r--r--arch/ia64/pci/pci.c27
-rw-r--r--arch/ia64/sn/pci/pci_dma.c6
-rw-r--r--arch/ia64/xen/time.c4
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68knommu/include/asm/Kbuild2
-rw-r--r--arch/m68knommu/include/asm/byteorder.h1
-rw-r--r--arch/m68knommu/kernel/syscalltable.S2
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/byteorder.h2
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mn10300/kernel/entry.S2
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/byteorder.h1
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts2
-rw-r--r--arch/powerpc/configs/ppc64_defconfig26
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/byteorder.h2
-rw-r--r--arch/powerpc/include/asm/ps3.h8
-rw-r--r--arch/powerpc/include/asm/qe.h19
-rw-r--r--arch/powerpc/include/asm/rtas.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/include/asm/types.h7
-rw-r--r--arch/powerpc/kernel/asm-offsets.c7
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/dma-iommu.c4
-rw-r--r--arch/powerpc/kernel/head_64.S9
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S8
-rw-r--r--arch/powerpc/kernel/iommu.c12
-rw-r--r--arch/powerpc/kernel/lparcfg.c10
-rw-r--r--arch/powerpc/kernel/machine_kexec.c25
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/powerpc/kernel/prom.c5
-rw-r--r--arch/powerpc/kernel/setup_64.c6
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S4
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c9
-rw-r--r--arch/powerpc/mm/mmu_decl.h11
-rw-r--r--arch/powerpc/mm/slice.c11
-rw-r--r--arch/powerpc/mm/stab.c4
-rw-r--r--arch/powerpc/oprofile/op_model_pa6t.c6
-rw-r--r--arch/powerpc/platforms/512x/clock.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c3
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c8
-rw-r--r--arch/powerpc/platforms/83xx/Makefile1
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c (renamed from drivers/i2c/chips/mcu_mpc8349emitx.c)0
-rw-r--r--arch/powerpc/platforms/Kconfig11
-rw-r--r--arch/powerpc/platforms/cell/beat_interrupt.c2
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_epci.c4
-rw-r--r--arch/powerpc/platforms/cell/iommu.c4
-rw-r--r--arch/powerpc/platforms/cell/ras.c8
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c4
-rw-r--r--arch/powerpc/platforms/cell/spu_callbacks.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c6
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c1
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c26
-rw-r--r--arch/powerpc/platforms/ps3/htab.c2
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c28
-rw-r--r--arch/powerpc/platforms/ps3/mm.c97
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c2
-rw-r--r--arch/powerpc/platforms/ps3/repository.c22
-rw-r--r--arch/powerpc/platforms/ps3/setup.c2
-rw-r--r--arch/powerpc/platforms/ps3/spu.c12
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c14
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c35
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c107
-rw-r--r--arch/powerpc/sysdev/mpic.c2
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/byteorder.h1
-rw-r--r--arch/s390/kernel/compat_wrapper.S4
-rw-r--r--arch/s390/kernel/entry.h16
-rw-r--r--arch/s390/kernel/process.c9
-rw-r--r--arch/s390/kernel/signal.c19
-rw-r--r--arch/s390/kernel/sys_s390.c35
-rw-r--r--arch/s390/kernel/syscalls.S12
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/byteorder.h2
-rw-r--r--arch/sh/include/asm/syscalls_32.h6
-rw-r--r--arch/sh/kernel/sys_sh32.c2
-rw-r--r--arch/sh/kernel/syscalls_32.S4
-rw-r--r--arch/sh/kernel/syscalls_64.S2
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/byteorder.h1
-rw-r--r--arch/sparc/kernel/entry.S4
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c11
-rw-r--r--arch/sparc/kernel/syscalls.S2
-rw-r--r--arch/sparc/kernel/systbls_32.S4
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/x86/include/asm/Kbuild1
-rw-r--r--arch/x86/include/asm/byteorder.h1
-rw-r--r--arch/x86/kernel/kprobes.c2
-rw-r--r--arch/x86/kernel/syscall_table_32.S2
-rw-r--r--arch/x86/mm/pageattr.c10
-rw-r--r--arch/x86/mm/pat.c45
-rw-r--r--arch/xtensa/include/asm/Kbuild2
-rw-r--r--arch/xtensa/include/asm/byteorder.h2
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/ec.c73
-rw-r--r--drivers/acpi/sleep.c (renamed from drivers/acpi/main.c)0
-rw-r--r--drivers/acpi/thermal.c16
-rw-r--r--drivers/ata/Kconfig9
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/libata-core.c73
-rw-r--r--drivers/ata/libata-scsi.c17
-rw-r--r--drivers/ata/pata_ali.c28
-rw-r--r--drivers/ata/pata_atiixp.c32
-rw-r--r--drivers/ata/pata_octeon_cf.c965
-rw-r--r--drivers/ata/sata_fsl.c2
-rw-r--r--drivers/ata/sata_via.c2
-rw-r--r--drivers/block/nbd.c4
-rw-r--r--drivers/block/ps3disk.c18
-rw-r--r--drivers/block/xsysace.c1
-rw-r--r--drivers/char/bsr.c2
-rw-r--r--drivers/char/hvc_console.c12
-rw-r--r--drivers/char/hvc_irq.c2
-rw-r--r--drivers/char/ps3flash.c18
-rw-r--r--drivers/char/synclink_gt.c16
-rw-r--r--drivers/char/sysrq.c6
-rw-r--r--drivers/char/tty_ioctl.c2
-rw-r--r--drivers/gpio/max7301.c6
-rw-r--r--drivers/gpio/max732x.c6
-rw-r--r--drivers/gpio/mcp23s08.c6
-rw-r--r--drivers/gpio/pca953x.c6
-rw-r--r--drivers/gpio/pcf857x.c12
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c175
-rw-r--r--drivers/gpu/drm/drm_irq.c18
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c10
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h23
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c189
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c6
-rw-r--r--drivers/gpu/drm/i915/intel_display.c43
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c7
-rw-r--r--drivers/hwmon/Kconfig24
-rw-r--r--drivers/hwmon/Makefile2
-rw-r--r--drivers/hwmon/abituguru3.c24
-rw-r--r--drivers/hwmon/adt7475.c1221
-rw-r--r--drivers/hwmon/applesmc.c5
-rw-r--r--drivers/hwmon/hp_accel.c75
-rw-r--r--drivers/hwmon/k8temp.c55
-rw-r--r--drivers/i2c/chips/Kconfig11
-rw-r--r--drivers/i2c/chips/Makefile1
-rw-r--r--drivers/ide/Kconfig5
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/ide/ide-pm.c12
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/it821x.c15
-rw-r--r--drivers/ide/sl82c105.c4
-rw-r--r--drivers/ide/tx4938ide.c1
-rw-r--r--drivers/ide/via82cxxx.c2
-rw-r--r--drivers/isdn/i4l/isdn_net.c9
-rw-r--r--drivers/leds/Kconfig7
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-hp-disk.c137
-rw-r--r--drivers/message/fusion/lsi/mpi.h7
-rw-r--r--drivers/message/fusion/lsi/mpi_cnfg.h47
-rw-r--r--drivers/message/fusion/lsi/mpi_fc.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_history.txt86
-rw-r--r--drivers/message/fusion/lsi/mpi_init.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_ioc.h22
-rw-r--r--drivers/message/fusion/lsi/mpi_lan.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_log_fc.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_log_sas.h37
-rw-r--r--drivers/message/fusion/lsi/mpi_raid.h11
-rw-r--r--drivers/message/fusion/lsi/mpi_sas.h18
-rw-r--r--drivers/message/fusion/lsi/mpi_targ.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_tool.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_type.h4
-rw-r--r--drivers/message/fusion/mptbase.c87
-rw-r--r--drivers/message/fusion/mptbase.h3
-rw-r--r--drivers/message/fusion/mptscsih.c3
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c2
-rw-r--r--drivers/net/arm/etherh.c2
-rw-r--r--drivers/net/ax88796.c27
-rw-r--r--drivers/net/b44.c4
-rw-r--r--drivers/net/b44.h2
-rw-r--r--drivers/net/bnx2x.h19
-rw-r--r--drivers/net/bnx2x_main.c178
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/ehea/ehea_qmr.c18
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c1
-rw-r--r--drivers/net/gianfar.c8
-rw-r--r--drivers/net/ibm_newemac/mal.c4
-rw-r--r--drivers/net/ibm_newemac/mal.h2
-rw-r--r--drivers/net/ibmveth.c16
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/iseries_veth.c2
-rw-r--r--drivers/net/korina.c158
-rw-r--r--drivers/net/netxen/netxen_nic.h146
-rw-r--r--drivers/net/netxen/netxen_nic_ctx.c50
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c31
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c97
-rw-r--r--drivers/net/netxen/netxen_nic_init.c105
-rw-r--r--drivers/net/netxen/netxen_nic_main.c210
-rw-r--r--drivers/net/pasemi_mac.c6
-rw-r--r--drivers/net/phy/phy_device.c9
-rw-r--r--drivers/net/ppp_generic.c43
-rw-r--r--drivers/net/sis900.c8
-rw-r--r--drivers/net/usb/hso.c12
-rw-r--r--drivers/net/wan/ixp4xx_hss.c6
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/ath5k/base.c8
-rw-r--r--drivers/net/wireless/ath5k/pcu.c4
-rw-r--r--drivers/net/wireless/ath5k/reg.h2
-rw-r--r--drivers/net/wireless/ath9k/Kconfig1
-rw-r--r--drivers/net/wireless/ath9k/main.c4
-rw-r--r--drivers/net/wireless/ath9k/xmit.c48
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c1
-rw-r--r--drivers/net/wireless/libertas_tf/main.c2
-rw-r--r--drivers/net/wireless/orinoco/orinoco.c28
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c1
-rw-r--r--drivers/net/wireless/p54/p54common.c34
-rw-r--r--drivers/net/wireless/p54/p54usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00leds.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180_dev.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c5
-rw-r--r--drivers/of/of_i2c.c19
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c2
-rw-r--r--drivers/pci/pci.c8
-rw-r--r--drivers/pci/syscall.c12
-rw-r--r--drivers/pcmcia/electra_cf.c2
-rw-r--r--drivers/platform/x86/Kconfig23
-rw-r--r--drivers/platform/x86/Makefile1
-rw-r--r--drivers/platform/x86/dell-laptop.c (renamed from drivers/misc/dell-laptop.c)2
-rw-r--r--drivers/platform/x86/eeepc-laptop.c4
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c910
-rw-r--r--drivers/ps3/ps3-lpm.c16
-rw-r--r--drivers/ps3/ps3-vuart.c32
-rw-r--r--drivers/ps3/ps3stor_lib.c14
-rw-r--r--drivers/rtc/rtc-pxa.c2
-rw-r--r--drivers/rtc/rtc-twl4030.c49
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c14
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c12
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/scsi/libiscsi_tcp.c3
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c2
-rw-r--r--drivers/scsi/ps3rom.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c58
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c7
-rw-r--r--drivers/scsi/scsi.c5
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/serial/8250_pci.c8
-rw-r--r--drivers/serial/8250_pnp.c2
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/of_serial.c1
-rw-r--r--drivers/serial/pnx8xxx_uart.c23
-rw-r--r--drivers/spi/atmel_spi.c3
-rw-r--r--drivers/spi/xilinx_spi.c137
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/video/bf54x-lq043fb.c15
-rw-r--r--drivers/video/bfin-t350mcqb-fb.c15
-rw-r--r--drivers/video/ps3fb.c4
-rw-r--r--fs/aio.c22
-rw-r--r--fs/btrfs/ioctl.h14
-rw-r--r--fs/btrfs/super.c5
-rw-r--r--fs/btrfs/volumes.c1
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/compat.c6
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/dcookies.c10
-rw-r--r--fs/eventfd.c5
-rw-r--r--fs/eventpoll.c18
-rw-r--r--fs/exec.c2
-rw-r--r--fs/ext2/dir.c7
-rw-r--r--fs/fcntl.c11
-rw-r--r--fs/filesystems.c2
-rw-r--r--fs/ioctl.c2
-rw-r--r--fs/ioprio.c5
-rw-r--r--fs/locks.c2
-rw-r--r--fs/namei.c35
-rw-r--r--fs/namespace.c13
-rw-r--r--fs/nfsctl.c4
-rw-r--r--fs/notify/inotify/inotify_user.c9
-rw-r--r--fs/open.c82
-rw-r--r--fs/pipe.c4
-rw-r--r--fs/quota.c3
-rw-r--r--fs/read_write.c49
-rw-r--r--fs/readdir.c9
-rw-r--r--fs/select.c27
-rw-r--r--fs/signalfd.c8
-rw-r--r--fs/splice.c12
-rw-r--r--fs/squashfs/squashfs_fs.h1
-rw-r--r--fs/squashfs/super.c1
-rw-r--r--fs/stat.c38
-rw-r--r--fs/super.c2
-rw-r--r--fs/sync.c32
-rw-r--r--fs/timerfd.c10
-rw-r--r--fs/utimes.c11
-rw-r--r--fs/xattr.c53
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c79
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c23
-rw-r--r--fs/xfs/xfs_acl.h1
-rw-r--r--fs/xfs/xfs_ag.h2
-rw-r--r--fs/xfs/xfs_attr_leaf.c72
-rw-r--r--fs/xfs/xfs_attr_leaf.h12
-rw-r--r--fs/xfs/xfs_bit.h10
-rw-r--r--fs/xfs/xfs_bmap_btree.c84
-rw-r--r--fs/xfs/xfs_btree.c4
-rw-r--r--fs/xfs/xfs_dir2_block.c7
-rw-r--r--fs/xfs/xfs_dir2_leaf.c6
-rw-r--r--fs/xfs/xfs_dir2_sf.c15
-rw-r--r--fs/xfs/xfs_types.h4
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/asm-frv/Kbuild1
-rw-r--r--include/asm-frv/byteorder.h1
-rw-r--r--include/asm-generic/Kbuild.asm1
-rw-r--r--include/asm-generic/rtc.h14
-rw-r--r--include/asm-m32r/Kbuild1
-rw-r--r--include/asm-m32r/byteorder.h2
-rw-r--r--include/asm-m68k/Kbuild1
-rw-r--r--include/asm-m68k/byteorder.h1
-rw-r--r--include/asm-mn10300/Kbuild1
-rw-r--r--include/asm-mn10300/byteorder.h1
-rw-r--r--include/drm/drm_crtc.h2
-rw-r--r--include/drm/drm_crtc_helper.h2
-rw-r--r--include/linux/agpgart.h1
-rw-r--r--include/linux/atm_idt77105.h2
-rw-r--r--include/linux/capi.h2
-rw-r--r--include/linux/compat.h13
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cyclades.h2
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/if_pppol2tp.h2
-rw-r--r--include/linux/if_pppox.h2
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ioport.h3
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/joystick.h2
-rw-r--r--include/linux/kvm.h2
-rw-r--r--include/linux/libata.h11
-rw-r--r--include/linux/loop.h2
-rw-r--r--include/linux/magic.h2
-rw-r--r--include/linux/matroxfb.h2
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--include/linux/netfilter/x_tables.h2
-rw-r--r--include/linux/of_i2c.h3
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/phantom.h2
-rw-r--r--include/linux/radeonfb.h2
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/swab.h2
-rw-r--r--include/linux/syscalls.h169
-rw-r--r--include/scsi/libiscsi_tcp.h1
-rw-r--r--init/Kconfig65
-rw-r--r--ipc/mqueue.c28
-rw-r--r--ipc/msg.c12
-rw-r--r--ipc/sem.c18
-rw-r--r--ipc/shm.c8
-rw-r--r--kernel/Makefile5
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/capability.c4
-rw-r--r--kernel/cpuset.c2
-rw-r--r--kernel/exec_domain.c3
-rw-r--r--kernel/exit.c17
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/futex.c17
-rw-r--r--kernel/hrtimer.c4
-rw-r--r--kernel/itimer.c7
-rw-r--r--kernel/kexec.c5
-rw-r--r--kernel/kprobes.c2
-rw-r--r--kernel/module.c10
-rw-r--r--kernel/posix-timers.c43
-rw-r--r--kernel/power/Makefile3
-rw-r--r--kernel/printk.c7
-rw-r--r--kernel/ptrace.c2
-rw-r--r--kernel/resource.c1
-rw-r--r--kernel/sched.c43
-rw-r--r--kernel/sched_fair.c37
-rw-r--r--kernel/signal.c59
-rw-r--r--kernel/sys.c70
-rw-r--r--kernel/sys_ni.c1
-rw-r--r--kernel/sysctl.c13
-rw-r--r--kernel/time.c14
-rw-r--r--kernel/timer.c18
-rw-r--r--kernel/uid16.c39
-rw-r--r--lib/idr.c14
-rw-r--r--mm/fadvise.c18
-rw-r--r--mm/filemap.c9
-rw-r--r--mm/fremap.c4
-rw-r--r--mm/madvise.c2
-rw-r--r--mm/memcontrol.c130
-rw-r--r--mm/mempolicy.c24
-rw-r--r--mm/migrate.c8
-rw-r--r--mm/mincore.c4
-rw-r--r--mm/mlock.c8
-rw-r--r--mm/mmap.c4
-rw-r--r--mm/mprotect.c4
-rw-r--r--mm/mremap.c6
-rw-r--r--mm/msync.c2
-rw-r--r--mm/nommu.c11
-rw-r--r--mm/swapfile.c4
-rw-r--r--mm/vmalloc.c20
-rw-r--r--net/9p/Kconfig2
-rw-r--r--net/bridge/br_netfilter.c18
-rw-r--r--net/bridge/netfilter/ebtables.c2
-rw-r--r--net/can/bcm.c57
-rw-r--r--net/core/dev.c48
-rw-r--r--net/core/skbuff.c6
-rw-r--r--net/ipv4/netfilter/iptable_filter.c7
-rw-r--r--net/ipv4/netfilter/iptable_mangle.c6
-rw-r--r--net/ipv4/netfilter/iptable_raw.c6
-rw-r--r--net/ipv4/netfilter/iptable_security.c6
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c5
-rw-r--r--net/ipv4/netfilter/nf_conntrack_proto_icmp.c2
-rw-r--r--net/ipv4/tcp.c24
-rw-r--r--net/ipv6/ip6_fib.c15
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c2
-rw-r--r--net/mac80211/ht.c2
-rw-r--r--net/mac80211/iface.c3
-rw-r--r--net/mac80211/mesh_plink.c1
-rw-r--r--net/mac80211/rc80211_minstrel.c10
-rw-r--r--net/netfilter/nf_conntrack_core.c4
-rw-r--r--net/netfilter/nf_conntrack_netlink.c2
-rw-r--r--net/netfilter/x_tables.c8
-rw-r--r--net/netfilter/xt_time.c11
-rw-r--r--net/sched/sch_htb.c15
-rw-r--r--net/socket.c63
-rw-r--r--net/xfrm/xfrm_user.c11
-rwxr-xr-xscripts/checkpatch.pl28
-rw-r--r--security/keys/keyctl.c22
-rw-r--r--sound/pci/hda/hda_codec.c63
-rw-r--r--sound/pci/hda/hda_local.h3
-rw-r--r--sound/pci/hda/patch_nvhdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c159
-rw-r--r--sound/pci/oxygen/virtuoso.c17
-rw-r--r--sound/ppc/snd_ps3.c4
-rw-r--r--sound/soc/soc-dapm.c3
-rw-r--r--sound/usb/usbquirks.h8
524 files changed, 7963 insertions, 3528 deletions
diff --git a/CREDITS b/CREDITS
index 939da46a87fb..2b39168c06aa 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3786,14 +3786,11 @@ S: The Netherlands
3786 3786
3787N: David Woodhouse 3787N: David Woodhouse
3788E: dwmw2@infradead.org 3788E: dwmw2@infradead.org
3789D: ARCnet stuff, Applicom board driver, SO_BINDTODEVICE, 3789D: JFFS2 file system, Memory Technology Device subsystem,
3790D: some Alpha platform porting from 2.0, Memory Technology Devices,
3791D: Acquire watchdog timer, PC speaker driver maintenance,
3792D: various other stuff that annoyed me by not working. 3790D: various other stuff that annoyed me by not working.
3793S: c/o Red Hat Engineering 3791S: c/o Intel Corporation
3794S: Rustat House 3792S: Pipers Way
3795S: 60 Clifton Road 3793S: Swindon. SN3 1RJ
3796S: Cambridge. CB1 7EG
3797S: England 3794S: England
3798 3795
3799N: Chris Wright 3796N: Chris Wright
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index b462bb149543..52441694fe03 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -170,16 +170,15 @@ Returns: 0 if successful and a negative error if not.
170u64 170u64
171dma_get_required_mask(struct device *dev) 171dma_get_required_mask(struct device *dev)
172 172
173After setting the mask with dma_set_mask(), this API returns the 173This API returns the mask that the platform requires to
174actual mask (within that already set) that the platform actually 174operate efficiently. Usually this means the returned mask
175requires to operate efficiently. Usually this means the returned mask
176is the minimum required to cover all of memory. Examining the 175is the minimum required to cover all of memory. Examining the
177required mask gives drivers with variable descriptor sizes the 176required mask gives drivers with variable descriptor sizes the
178opportunity to use smaller descriptors as necessary. 177opportunity to use smaller descriptors as necessary.
179 178
180Requesting the required mask does not alter the current mask. If you 179Requesting the required mask does not alter the current mask. If you
181wish to take advantage of it, you should issue another dma_set_mask() 180wish to take advantage of it, you should issue a dma_set_mask()
182call to lower the mask again. 181call to set the mask to the value returned.
183 182
184 183
185Part Id - Streaming DMA mappings 184Part Id - Streaming DMA mappings
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cc49400b4af8..7ea231172c85 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -392,6 +392,10 @@ int main(int argc, char *argv[])
392 goto err; 392 goto err;
393 } 393 }
394 } 394 }
395 if (!maskset && !tid && !containerset) {
396 usage();
397 goto err;
398 }
395 399
396 do { 400 do {
397 int i; 401 int i;
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index e33ee74eee77..d9e5d6f41b92 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -1,7 +1,8 @@
1 CGROUPS 1 CGROUPS
2 ------- 2 -------
3 3
4Written by Paul Menage <menage@google.com> based on Documentation/cpusets.txt 4Written by Paul Menage <menage@google.com> based on
5Documentation/cgroups/cpusets.txt
5 6
6Original copyright statements from cpusets.txt: 7Original copyright statements from cpusets.txt:
7Portions Copyright (C) 2004 BULL SA. 8Portions Copyright (C) 2004 BULL SA.
@@ -68,7 +69,7 @@ On their own, the only use for cgroups is for simple job
68tracking. The intention is that other subsystems hook into the generic 69tracking. The intention is that other subsystems hook into the generic
69cgroup support to provide new attributes for cgroups, such as 70cgroup support to provide new attributes for cgroups, such as
70accounting/limiting the resources which processes in a cgroup can 71accounting/limiting the resources which processes in a cgroup can
71access. For example, cpusets (see Documentation/cpusets.txt) allows 72access. For example, cpusets (see Documentation/cgroups/cpusets.txt) allows
72you to associate a set of CPUs and a set of memory nodes with the 73you to associate a set of CPUs and a set of memory nodes with the
73tasks in each cgroup. 74tasks in each cgroup.
74 75
diff --git a/Documentation/controllers/cpuacct.txt b/Documentation/cgroups/cpuacct.txt
index bb775fbe43d7..bb775fbe43d7 100644
--- a/Documentation/controllers/cpuacct.txt
+++ b/Documentation/cgroups/cpuacct.txt
diff --git a/Documentation/cpusets.txt b/Documentation/cgroups/cpusets.txt
index 5c86c258c791..5c86c258c791 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cgroups/cpusets.txt
diff --git a/Documentation/controllers/devices.txt b/Documentation/cgroups/devices.txt
index 7cc6e6a60672..7cc6e6a60672 100644
--- a/Documentation/controllers/devices.txt
+++ b/Documentation/cgroups/devices.txt
diff --git a/Documentation/controllers/memcg_test.txt b/Documentation/cgroups/memcg_test.txt
index 08d4d3ea0d79..19533f93b7a2 100644
--- a/Documentation/controllers/memcg_test.txt
+++ b/Documentation/cgroups/memcg_test.txt
@@ -6,7 +6,7 @@ Because VM is getting complex (one of reasons is memcg...), memcg's behavior
6is complex. This is a document for memcg's internal behavior. 6is complex. This is a document for memcg's internal behavior.
7Please note that implementation details can be changed. 7Please note that implementation details can be changed.
8 8
9(*) Topics on API should be in Documentation/controllers/memory.txt) 9(*) Topics on API should be in Documentation/cgroups/memory.txt)
10 10
110. How to record usage ? 110. How to record usage ?
12 2 objects are used. 12 2 objects are used.
diff --git a/Documentation/controllers/memory.txt b/Documentation/cgroups/memory.txt
index e1501964df1e..e1501964df1e 100644
--- a/Documentation/controllers/memory.txt
+++ b/Documentation/cgroups/memory.txt
diff --git a/Documentation/controllers/resource_counter.txt b/Documentation/cgroups/resource_counter.txt
index f196ac1d7d25..f196ac1d7d25 100644
--- a/Documentation/controllers/resource_counter.txt
+++ b/Documentation/cgroups/resource_counter.txt
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index d105eb45282a..bbebc3a43ac0 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1371,292 +1371,8 @@ auto_msgmni default value is 1.
13712.4 /proc/sys/vm - The virtual memory subsystem 13712.4 /proc/sys/vm - The virtual memory subsystem
1372----------------------------------------------- 1372-----------------------------------------------
1373 1373
1374The files in this directory can be used to tune the operation of the virtual 1374Please see: Documentation/sysctls/vm.txt for a description of these
1375memory (VM) subsystem of the Linux kernel. 1375entries.
1376
1377vfs_cache_pressure
1378------------------
1379
1380Controls the tendency of the kernel to reclaim the memory which is used for
1381caching of directory and inode objects.
1382
1383At the default value of vfs_cache_pressure=100 the kernel will attempt to
1384reclaim dentries and inodes at a "fair" rate with respect to pagecache and
1385swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer
1386to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100
1387causes the kernel to prefer to reclaim dentries and inodes.
1388
1389dirty_background_bytes
1390----------------------
1391
1392Contains the amount of dirty memory at which the pdflush background writeback
1393daemon will start writeback.
1394
1395If dirty_background_bytes is written, dirty_background_ratio becomes a function
1396of its value (dirty_background_bytes / the amount of dirtyable system memory).
1397
1398dirty_background_ratio
1399----------------------
1400
1401Contains, as a percentage of the dirtyable system memory (free pages + mapped
1402pages + file cache, not including locked pages and HugePages), the number of
1403pages at which the pdflush background writeback daemon will start writing out
1404dirty data.
1405
1406If dirty_background_ratio is written, dirty_background_bytes becomes a function
1407of its value (dirty_background_ratio * the amount of dirtyable system memory).
1408
1409dirty_bytes
1410-----------
1411
1412Contains the amount of dirty memory at which a process generating disk writes
1413will itself start writeback.
1414
1415If dirty_bytes is written, dirty_ratio becomes a function of its value
1416(dirty_bytes / the amount of dirtyable system memory).
1417
1418dirty_ratio
1419-----------
1420
1421Contains, as a percentage of the dirtyable system memory (free pages + mapped
1422pages + file cache, not including locked pages and HugePages), the number of
1423pages at which a process which is generating disk writes will itself start
1424writing out dirty data.
1425
1426If dirty_ratio is written, dirty_bytes becomes a function of its value
1427(dirty_ratio * the amount of dirtyable system memory).
1428
1429dirty_writeback_centisecs
1430-------------------------
1431
1432The pdflush writeback daemons will periodically wake up and write `old' data
1433out to disk. This tunable expresses the interval between those wakeups, in
1434100'ths of a second.
1435
1436Setting this to zero disables periodic writeback altogether.
1437
1438dirty_expire_centisecs
1439----------------------
1440
1441This tunable is used to define when dirty data is old enough to be eligible
1442for writeout by the pdflush daemons. It is expressed in 100'ths of a second.
1443Data which has been dirty in-memory for longer than this interval will be
1444written out next time a pdflush daemon wakes up.
1445
1446highmem_is_dirtyable
1447--------------------
1448
1449Only present if CONFIG_HIGHMEM is set.
1450
1451This defaults to 0 (false), meaning that the ratios set above are calculated
1452as a percentage of lowmem only. This protects against excessive scanning
1453in page reclaim, swapping and general VM distress.
1454
1455Setting this to 1 can be useful on 32 bit machines where you want to make
1456random changes within an MMAPed file that is larger than your available
1457lowmem without causing large quantities of random IO. Is is safe if the
1458behavior of all programs running on the machine is known and memory will
1459not be otherwise stressed.
1460
1461legacy_va_layout
1462----------------
1463
1464If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
1465will use the legacy (2.4) layout for all processes.
1466
1467lowmem_reserve_ratio
1468---------------------
1469
1470For some specialised workloads on highmem machines it is dangerous for
1471the kernel to allow process memory to be allocated from the "lowmem"
1472zone. This is because that memory could then be pinned via the mlock()
1473system call, or by unavailability of swapspace.
1474
1475And on large highmem machines this lack of reclaimable lowmem memory
1476can be fatal.
1477
1478So the Linux page allocator has a mechanism which prevents allocations
1479which _could_ use highmem from using too much lowmem. This means that
1480a certain amount of lowmem is defended from the possibility of being
1481captured into pinned user memory.
1482
1483(The same argument applies to the old 16 megabyte ISA DMA region. This
1484mechanism will also defend that region from allocations which could use
1485highmem or lowmem).
1486
1487The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
1488in defending these lower zones.
1489
1490If you have a machine which uses highmem or ISA DMA and your
1491applications are using mlock(), or if you are running with no swap then
1492you probably should change the lowmem_reserve_ratio setting.
1493
1494The lowmem_reserve_ratio is an array. You can see them by reading this file.
1495-
1496% cat /proc/sys/vm/lowmem_reserve_ratio
1497256 256 32
1498-
1499Note: # of this elements is one fewer than number of zones. Because the highest
1500 zone's value is not necessary for following calculation.
1501
1502But, these values are not used directly. The kernel calculates # of protection
1503pages for each zones from them. These are shown as array of protection pages
1504in /proc/zoneinfo like followings. (This is an example of x86-64 box).
1505Each zone has an array of protection pages like this.
1506
1507-
1508Node 0, zone DMA
1509 pages free 1355
1510 min 3
1511 low 3
1512 high 4
1513 :
1514 :
1515 numa_other 0
1516 protection: (0, 2004, 2004, 2004)
1517 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1518 pagesets
1519 cpu: 0 pcp: 0
1520 :
1521-
1522These protections are added to score to judge whether this zone should be used
1523for page allocation or should be reclaimed.
1524
1525In this example, if normal pages (index=2) are required to this DMA zone and
1526pages_high is used for watermark, the kernel judges this zone should not be
1527used because pages_free(1355) is smaller than watermark + protection[2]
1528(4 + 2004 = 2008). If this protection value is 0, this zone would be used for
1529normal page requirement. If requirement is DMA zone(index=0), protection[0]
1530(=0) is used.
1531
1532zone[i]'s protection[j] is calculated by following expression.
1533
1534(i < j):
1535 zone[i]->protection[j]
1536 = (total sums of present_pages from zone[i+1] to zone[j] on the node)
1537 / lowmem_reserve_ratio[i];
1538(i = j):
1539 (should not be protected. = 0;
1540(i > j):
1541 (not necessary, but looks 0)
1542
1543The default values of lowmem_reserve_ratio[i] are
1544 256 (if zone[i] means DMA or DMA32 zone)
1545 32 (others).
1546As above expression, they are reciprocal number of ratio.
1547256 means 1/256. # of protection pages becomes about "0.39%" of total present
1548pages of higher zones on the node.
1549
1550If you would like to protect more pages, smaller values are effective.
1551The minimum value is 1 (1/1 -> 100%).
1552
1553page-cluster
1554------------
1555
1556page-cluster controls the number of pages which are written to swap in
1557a single attempt. The swap I/O size.
1558
1559It is a logarithmic value - setting it to zero means "1 page", setting
1560it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
1561
1562The default value is three (eight pages at a time). There may be some
1563small benefits in tuning this to a different value if your workload is
1564swap-intensive.
1565
1566overcommit_memory
1567-----------------
1568
1569Controls overcommit of system memory, possibly allowing processes
1570to allocate (but not use) more memory than is actually available.
1571
1572
15730 - Heuristic overcommit handling. Obvious overcommits of
1574 address space are refused. Used for a typical system. It
1575 ensures a seriously wild allocation fails while allowing
1576 overcommit to reduce swap usage. root is allowed to
1577 allocate slightly more memory in this mode. This is the
1578 default.
1579
15801 - Always overcommit. Appropriate for some scientific
1581 applications.
1582
15832 - Don't overcommit. The total address space commit
1584 for the system is not permitted to exceed swap plus a
1585 configurable percentage (default is 50) of physical RAM.
1586 Depending on the percentage you use, in most situations
1587 this means a process will not be killed while attempting
1588 to use already-allocated memory but will receive errors
1589 on memory allocation as appropriate.
1590
1591overcommit_ratio
1592----------------
1593
1594Percentage of physical memory size to include in overcommit calculations
1595(see above.)
1596
1597Memory allocation limit = swapspace + physmem * (overcommit_ratio / 100)
1598
1599 swapspace = total size of all swap areas
1600 physmem = size of physical memory in system
1601
1602nr_hugepages and hugetlb_shm_group
1603----------------------------------
1604
1605nr_hugepages configures number of hugetlb page reserved for the system.
1606
1607hugetlb_shm_group contains group id that is allowed to create SysV shared
1608memory segment using hugetlb page.
1609
1610hugepages_treat_as_movable
1611--------------------------
1612
1613This parameter is only useful when kernelcore= is specified at boot time to
1614create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
1615are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
1616value written to hugepages_treat_as_movable allows huge pages to be allocated
1617from ZONE_MOVABLE.
1618
1619Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
1620pages pool can easily grow or shrink within. Assuming that applications are
1621not running that mlock() a lot of memory, it is likely the huge pages pool
1622can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
1623into nr_hugepages and triggering page reclaim.
1624
1625laptop_mode
1626-----------
1627
1628laptop_mode is a knob that controls "laptop mode". All the things that are
1629controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt.
1630
1631block_dump
1632----------
1633
1634block_dump enables block I/O debugging when set to a nonzero value. More
1635information on block I/O debugging is in Documentation/laptops/laptop-mode.txt.
1636
1637swap_token_timeout
1638------------------
1639
1640This file contains valid hold time of swap out protection token. The Linux
1641VM has token based thrashing control mechanism and uses the token to prevent
1642unnecessary page faults in thrashing situation. The unit of the value is
1643second. The value would be useful to tune thrashing behavior.
1644
1645drop_caches
1646-----------
1647
1648Writing to this will cause the kernel to drop clean caches, dentries and
1649inodes from memory, causing that memory to become free.
1650
1651To free pagecache:
1652 echo 1 > /proc/sys/vm/drop_caches
1653To free dentries and inodes:
1654 echo 2 > /proc/sys/vm/drop_caches
1655To free pagecache, dentries and inodes:
1656 echo 3 > /proc/sys/vm/drop_caches
1657
1658As this is a non-destructive operation and dirty objects are not freeable, the
1659user should run `sync' first.
1660 1376
1661 1377
16622.5 /proc/sys/dev - Device specific parameters 13782.5 /proc/sys/dev - Device specific parameters
diff --git a/Documentation/hwmon/adt7475 b/Documentation/hwmon/adt7475
new file mode 100644
index 000000000000..a2b1abec850e
--- /dev/null
+++ b/Documentation/hwmon/adt7475
@@ -0,0 +1,87 @@
1This describes the interface for the ADT7475 driver:
2
3(there are 4 fans, numbered fan1 to fan4):
4
5fanX_input Read the current speed of the fan (in RPMs)
6fanX_min Read/write the minimum speed of the fan. Dropping
7 below this sets an alarm.
8
9(there are three PWMs, numbered pwm1 to pwm3):
10
11pwmX Read/write the current duty cycle of the PWM. Writes
12 only have effect when auto mode is turned off (see
13 below). Range is 0 - 255.
14
15pwmX_enable Fan speed control method:
16
17 0 - No control (fan at full speed)
18 1 - Manual fan speed control (using pwm[1-*])
19 2 - Automatic fan speed control
20
21pwmX_auto_channels_temp Select which channels affect this PWM
22
23 1 - TEMP1 controls PWM
24 2 - TEMP2 controls PWM
25 4 - TEMP3 controls PWM
26 6 - TEMP2 and TEMP3 control PWM
27 7 - All three inputs control PWM
28
29pwmX_freq Read/write the PWM frequency in Hz. The number
30 should be one of the following:
31
32 11 Hz
33 14 Hz
34 22 Hz
35 29 Hz
36 35 Hz
37 44 Hz
38 58 Hz
39 88 Hz
40
41pwmX_auto_point1_pwm Read/write the minimum PWM duty cycle in automatic mode
42
43pwmX_auto_point2_pwm Read/write the maximum PWM duty cycle in automatic mode
44
45(there are three temperature settings numbered temp1 to temp3):
46
47tempX_input Read the current temperature. The value is in milli
48 degrees of Celsius.
49
50tempX_max Read/write the upper temperature limit - exceeding this
51 will cause an alarm.
52
53tempX_min Read/write the lower temperature limit - exceeding this
54 will cause an alarm.
55
56tempX_offset Read/write the temperature adjustment offset
57
58tempX_crit Read/write the THERM limit for remote1.
59
60tempX_crit_hyst Set the temperature value below crit where the
61 fans will stay on - this helps drive the temperature
62 low enough so it doesn't stay near the edge and
63 cause THERM to keep tripping.
64
65tempX_auto_point1_temp Read/write the minimum temperature where the fans will
66 turn on in automatic mode.
67
68tempX_auto_point2_temp Read/write the maximum temperature over which the fans
69 will run in automatic mode. tempX_auto_point1_temp
70 and tempX_auto_point2_temp together define the
71 range of automatic control.
72
73tempX_alarm Read a 1 if the max/min alarm is set
74tempX_fault Read a 1 if either temp1 or temp3 diode has a fault
75
76(There are two voltage settings, in1 and in2):
77
78inX_input Read the current voltage on VCC. Value is in
79 millivolts.
80
81inX_min read/write the minimum voltage limit.
82 Dropping below this causes an alarm.
83
84inX_max read/write the maximum voltage limit.
85 Exceeding this causes an alarm.
86
87inX_alarm Read a 1 if the max/min alarm is set.
diff --git a/Documentation/hwmon/lis3lv02d b/Documentation/hwmon/lis3lv02d
index 65dfb0c0fd67..0fcfc4a7ccdc 100644
--- a/Documentation/hwmon/lis3lv02d
+++ b/Documentation/hwmon/lis3lv02d
@@ -13,18 +13,21 @@ Author:
13Description 13Description
14----------- 14-----------
15 15
16This driver provides support for the accelerometer found in various HP laptops 16This driver provides support for the accelerometer found in various HP
17sporting the feature officially called "HP Mobile Data Protection System 3D" or 17laptops sporting the feature officially called "HP Mobile Data
18"HP 3D DriveGuard". It detect automatically laptops with this sensor. Known models 18Protection System 3D" or "HP 3D DriveGuard". It detect automatically
19(for now the HP 2133, nc6420, nc2510, nc8510, nc84x0, nw9440 and nx9420) will 19laptops with this sensor. Known models (for now the HP 2133, nc6420,
20have their axis automatically oriented on standard way (eg: you can directly 20nc2510, nc8510, nc84x0, nw9440 and nx9420) will have their axis
21play neverball). The accelerometer data is readable via 21automatically oriented on standard way (eg: you can directly play
22neverball). The accelerometer data is readable via
22/sys/devices/platform/lis3lv02d. 23/sys/devices/platform/lis3lv02d.
23 24
24Sysfs attributes under /sys/devices/platform/lis3lv02d/: 25Sysfs attributes under /sys/devices/platform/lis3lv02d/:
25position - 3D position that the accelerometer reports. Format: "(x,y,z)" 26position - 3D position that the accelerometer reports. Format: "(x,y,z)"
26calibrate - read: values (x, y, z) that are used as the base for input class device operation. 27calibrate - read: values (x, y, z) that are used as the base for input
27 write: forces the base to be recalibrated with the current position. 28 class device operation.
29 write: forces the base to be recalibrated with the current
30 position.
28rate - reports the sampling rate of the accelerometer device in HZ 31rate - reports the sampling rate of the accelerometer device in HZ
29 32
30This driver also provides an absolute input class device, allowing 33This driver also provides an absolute input class device, allowing
@@ -39,11 +42,12 @@ the accelerometer are converted into a "standard" organisation of the axes
39 * When the laptop is horizontal the position reported is about 0 for X and Y 42 * When the laptop is horizontal the position reported is about 0 for X and Y
40and a positive value for Z 43and a positive value for Z
41 * If the left side is elevated, X increases (becomes positive) 44 * If the left side is elevated, X increases (becomes positive)
42 * If the front side (where the touchpad is) is elevated, Y decreases (becomes negative) 45 * If the front side (where the touchpad is) is elevated, Y decreases
46 (becomes negative)
43 * If the laptop is put upside-down, Z becomes negative 47 * If the laptop is put upside-down, Z becomes negative
44 48
45If your laptop model is not recognized (cf "dmesg"), you can send an email to the 49If your laptop model is not recognized (cf "dmesg"), you can send an
46authors to add it to the database. When reporting a new laptop, please include 50email to the authors to add it to the database. When reporting a new
47the output of "dmidecode" plus the value of /sys/devices/platform/lis3lv02d/position 51laptop, please include the output of "dmidecode" plus the value of
48in these four cases. 52/sys/devices/platform/lis3lv02d/position in these four cases.
49 53
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 898b4987bb80..41bc99fa1884 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -1,7 +1,7 @@
1 ThinkPad ACPI Extras Driver 1 ThinkPad ACPI Extras Driver
2 2
3 Version 0.21 3 Version 0.22
4 May 29th, 2008 4 November 23rd, 2008
5 5
6 Borislav Deianov <borislav@users.sf.net> 6 Borislav Deianov <borislav@users.sf.net>
7 Henrique de Moraes Holschuh <hmh@hmh.eng.br> 7 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
@@ -16,7 +16,8 @@ supported by the generic Linux ACPI drivers.
16This driver used to be named ibm-acpi until kernel 2.6.21 and release 16This driver used to be named ibm-acpi until kernel 2.6.21 and release
170.13-20070314. It used to be in the drivers/acpi tree, but it was 170.13-20070314. It used to be in the drivers/acpi tree, but it was
18moved to the drivers/misc tree and renamed to thinkpad-acpi for kernel 18moved to the drivers/misc tree and renamed to thinkpad-acpi for kernel
192.6.22, and release 0.14. 192.6.22, and release 0.14. It was moved to drivers/platform/x86 for
20kernel 2.6.29 and release 0.22.
20 21
21The driver is named "thinkpad-acpi". In some places, like module 22The driver is named "thinkpad-acpi". In some places, like module
22names, "thinkpad_acpi" is used because of userspace issues. 23names, "thinkpad_acpi" is used because of userspace issues.
@@ -1412,6 +1413,24 @@ Sysfs notes:
1412 rfkill controller switch "tpacpi_wwan_sw": refer to 1413 rfkill controller switch "tpacpi_wwan_sw": refer to
1413 Documentation/rfkill.txt for details. 1414 Documentation/rfkill.txt for details.
1414 1415
1416EXPERIMENTAL: UWB
1417-----------------
1418
1419This feature is marked EXPERIMENTAL because it has not been extensively
1420tested and validated in various ThinkPad models yet. The feature may not
1421work as expected. USE WITH CAUTION! To use this feature, you need to supply
1422the experimental=1 parameter when loading the module.
1423
1424sysfs rfkill class: switch "tpacpi_uwb_sw"
1425
1426This feature exports an rfkill controller for the UWB device, if one is
1427present and enabled in the BIOS.
1428
1429Sysfs notes:
1430
1431 rfkill controller switch "tpacpi_uwb_sw": refer to
1432 Documentation/rfkill.txt for details.
1433
1415Multiple Commands, Module Parameters 1434Multiple Commands, Module Parameters
1416------------------------------------ 1435------------------------------------
1417 1436
diff --git a/Documentation/mips/AU1xxx_IDE.README b/Documentation/mips/AU1xxx_IDE.README
index f54962aea84d..8ace35ebdcd5 100644
--- a/Documentation/mips/AU1xxx_IDE.README
+++ b/Documentation/mips/AU1xxx_IDE.README
@@ -52,14 +52,12 @@ Two files are introduced:
52 b) 'drivers/ide/mips/au1xxx-ide.c' 52 b) 'drivers/ide/mips/au1xxx-ide.c'
53 contains the functionality of the AU1XXX IDE driver 53 contains the functionality of the AU1XXX IDE driver
54 54
55Four configs variables are introduced: 55Following extra configs variables are introduced:
56 56
57 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - enable the PIO+DBDMA mode 57 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - enable the PIO+DBDMA mode
58 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - enable the MWDMA mode 58 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - enable the MWDMA mode
59 CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - set Burstable FIFO in DBDMA 59 CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - set Burstable FIFO in DBDMA
60 controller 60 controller
61 CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ - maximum transfer size
62 per descriptor
63 61
64 62
65SUPPORTED IDE MODES 63SUPPORTED IDE MODES
@@ -87,7 +85,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
87CONFIG_IDEDMA_PCI_AUTO=y 85CONFIG_IDEDMA_PCI_AUTO=y
88CONFIG_BLK_DEV_IDE_AU1XXX=y 86CONFIG_BLK_DEV_IDE_AU1XXX=y
89CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y 87CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
90CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
91CONFIG_BLK_DEV_IDEDMA=y 88CONFIG_BLK_DEV_IDEDMA=y
92CONFIG_IDEDMA_AUTO=y 89CONFIG_IDEDMA_AUTO=y
93 90
@@ -105,7 +102,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
105CONFIG_IDEDMA_PCI_AUTO=y 102CONFIG_IDEDMA_PCI_AUTO=y
106CONFIG_BLK_DEV_IDE_AU1XXX=y 103CONFIG_BLK_DEV_IDE_AU1XXX=y
107CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y 104CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
108CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
109CONFIG_BLK_DEV_IDEDMA=y 105CONFIG_BLK_DEV_IDEDMA=y
110CONFIG_IDEDMA_AUTO=y 106CONFIG_IDEDMA_AUTO=y
111 107
diff --git a/Documentation/scheduler/sched-design-CFS.txt b/Documentation/scheduler/sched-design-CFS.txt
index 8398ca4ff4ed..6f33593e59e2 100644
--- a/Documentation/scheduler/sched-design-CFS.txt
+++ b/Documentation/scheduler/sched-design-CFS.txt
@@ -231,7 +231,7 @@ CPU bandwidth control purposes:
231 231
232 This options needs CONFIG_CGROUPS to be defined, and lets the administrator 232 This options needs CONFIG_CGROUPS to be defined, and lets the administrator
233 create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See 233 create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See
234 Documentation/cgroups.txt for more information about this filesystem. 234 Documentation/cgroups/cgroups.txt for more information about this filesystem.
235 235
236Only one of these options to group tasks can be chosen and not both. 236Only one of these options to group tasks can be chosen and not both.
237 237
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index 4b7ac21ea9eb..64eb1100eec1 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -275,7 +275,8 @@ STAC9200
275 dell-m25 Dell Inspiron E1505n 275 dell-m25 Dell Inspiron E1505n
276 dell-m26 Dell Inspiron 1501 276 dell-m26 Dell Inspiron 1501
277 dell-m27 Dell Inspiron E1705/9400 277 dell-m27 Dell Inspiron E1705/9400
278 gateway Gateway laptops with EAPD control 278 gateway-m4 Gateway laptops with EAPD control
279 gateway-m4-2 Gateway laptops with EAPD control
279 panasonic Panasonic CF-74 280 panasonic Panasonic CF-74
280 281
281STAC9205/9254 282STAC9205/9254
@@ -302,6 +303,7 @@ STAC9220/9221
302 macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3) 303 macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3)
303 imac-intel Intel iMac (eq. type 2) 304 imac-intel Intel iMac (eq. type 2)
304 imac-intel-20 Intel iMac (newer version) (eq. type 3) 305 imac-intel-20 Intel iMac (newer version) (eq. type 3)
306 ecs202 ECS/PC chips
305 dell-d81 Dell (unknown) 307 dell-d81 Dell (unknown)
306 dell-d82 Dell (unknown) 308 dell-d82 Dell (unknown)
307 dell-m81 Dell (unknown) 309 dell-m81 Dell (unknown)
@@ -310,9 +312,13 @@ STAC9220/9221
310STAC9202/9250/9251 312STAC9202/9250/9251
311================== 313==================
312 ref Reference board, base config 314 ref Reference board, base config
315 m1 Some Gateway MX series laptops (NX560XL)
316 m1-2 Some Gateway MX series laptops (MX6453)
317 m2 Some Gateway MX series laptops (M255)
313 m2-2 Some Gateway MX series laptops 318 m2-2 Some Gateway MX series laptops
319 m3 Some Gateway MX series laptops
320 m5 Some Gateway MX series laptops (MP6954)
314 m6 Some Gateway NX series laptops 321 m6 Some Gateway NX series laptops
315 pa6 Gateway NX860 series
316 322
317STAC9227/9228/9229/927x 323STAC9227/9228/9229/927x
318======================= 324=======================
@@ -329,6 +335,7 @@ STAC92HD71B*
329 dell-m4-1 Dell desktops 335 dell-m4-1 Dell desktops
330 dell-m4-2 Dell desktops 336 dell-m4-2 Dell desktops
331 dell-m4-3 Dell desktops 337 dell-m4-3 Dell desktops
338 hp-m4 HP dv laptops
332 339
333STAC92HD73* 340STAC92HD73*
334=========== 341===========
@@ -337,6 +344,7 @@ STAC92HD73*
337 dell-m6-amic Dell desktops/laptops with analog mics 344 dell-m6-amic Dell desktops/laptops with analog mics
338 dell-m6-dmic Dell desktops/laptops with digital mics 345 dell-m6-dmic Dell desktops/laptops with digital mics
339 dell-m6 Dell desktops/laptops with both type of mics 346 dell-m6 Dell desktops/laptops with both type of mics
347 dell-eq Dell desktops/laptops
340 348
341STAC92HD83* 349STAC92HD83*
342=========== 350===========
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index a3415070bcac..3197fc83bc51 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -1,12 +1,13 @@
1Documentation for /proc/sys/vm/* kernel version 2.2.10 1Documentation for /proc/sys/vm/* kernel version 2.6.29
2 (c) 1998, 1999, Rik van Riel <riel@nl.linux.org> 2 (c) 1998, 1999, Rik van Riel <riel@nl.linux.org>
3 (c) 2008 Peter W. Morreale <pmorreale@novell.com>
3 4
4For general info and legal blurb, please look in README. 5For general info and legal blurb, please look in README.
5 6
6============================================================== 7==============================================================
7 8
8This file contains the documentation for the sysctl files in 9This file contains the documentation for the sysctl files in
9/proc/sys/vm and is valid for Linux kernel version 2.2. 10/proc/sys/vm and is valid for Linux kernel version 2.6.29.
10 11
11The files in this directory can be used to tune the operation 12The files in this directory can be used to tune the operation
12of the virtual memory (VM) subsystem of the Linux kernel and 13of the virtual memory (VM) subsystem of the Linux kernel and
@@ -16,180 +17,274 @@ Default values and initialization routines for most of these
16files can be found in mm/swap.c. 17files can be found in mm/swap.c.
17 18
18Currently, these files are in /proc/sys/vm: 19Currently, these files are in /proc/sys/vm:
19- overcommit_memory 20
20- page-cluster 21- block_dump
21- dirty_ratio 22- dirty_background_bytes
22- dirty_background_ratio 23- dirty_background_ratio
24- dirty_bytes
23- dirty_expire_centisecs 25- dirty_expire_centisecs
26- dirty_ratio
24- dirty_writeback_centisecs 27- dirty_writeback_centisecs
25- highmem_is_dirtyable (only if CONFIG_HIGHMEM set) 28- drop_caches
29- hugepages_treat_as_movable
30- hugetlb_shm_group
31- laptop_mode
32- legacy_va_layout
33- lowmem_reserve_ratio
26- max_map_count 34- max_map_count
27- min_free_kbytes 35- min_free_kbytes
28- laptop_mode
29- block_dump
30- drop-caches
31- zone_reclaim_mode
32- min_unmapped_ratio
33- min_slab_ratio 36- min_slab_ratio
34- panic_on_oom 37- min_unmapped_ratio
35- oom_dump_tasks 38- mmap_min_addr
36- oom_kill_allocating_task
37- mmap_min_address
38- numa_zonelist_order
39- nr_hugepages 39- nr_hugepages
40- nr_overcommit_hugepages 40- nr_overcommit_hugepages
41- nr_trim_pages (only if CONFIG_MMU=n) 41- nr_pdflush_threads
42- nr_trim_pages (only if CONFIG_MMU=n)
43- numa_zonelist_order
44- oom_dump_tasks
45- oom_kill_allocating_task
46- overcommit_memory
47- overcommit_ratio
48- page-cluster
49- panic_on_oom
50- percpu_pagelist_fraction
51- stat_interval
52- swappiness
53- vfs_cache_pressure
54- zone_reclaim_mode
55
42 56
43============================================================== 57==============================================================
44 58
45dirty_bytes, dirty_ratio, dirty_background_bytes, 59block_dump
46dirty_background_ratio, dirty_expire_centisecs,
47dirty_writeback_centisecs, highmem_is_dirtyable,
48vfs_cache_pressure, laptop_mode, block_dump, swap_token_timeout,
49drop-caches, hugepages_treat_as_movable:
50 60
51See Documentation/filesystems/proc.txt 61block_dump enables block I/O debugging when set to a nonzero value. More
62information on block I/O debugging is in Documentation/laptops/laptop-mode.txt.
52 63
53============================================================== 64==============================================================
54 65
55overcommit_memory: 66dirty_background_bytes
56 67
57This value contains a flag that enables memory overcommitment. 68Contains the amount of dirty memory at which the pdflush background writeback
69daemon will start writeback.
58 70
59When this flag is 0, the kernel attempts to estimate the amount 71If dirty_background_bytes is written, dirty_background_ratio becomes a function
60of free memory left when userspace requests more memory. 72of its value (dirty_background_bytes / the amount of dirtyable system memory).
61 73
62When this flag is 1, the kernel pretends there is always enough 74==============================================================
63memory until it actually runs out.
64 75
65When this flag is 2, the kernel uses a "never overcommit" 76dirty_background_ratio
66policy that attempts to prevent any overcommit of memory.
67 77
68This feature can be very useful because there are a lot of 78Contains, as a percentage of total system memory, the number of pages at which
69programs that malloc() huge amounts of memory "just-in-case" 79the pdflush background writeback daemon will start writing out dirty data.
70and don't use much of it.
71 80
72The default value is 0. 81==============================================================
73 82
74See Documentation/vm/overcommit-accounting and 83dirty_bytes
75security/commoncap.c::cap_vm_enough_memory() for more information. 84
85Contains the amount of dirty memory at which a process generating disk writes
86will itself start writeback.
87
88If dirty_bytes is written, dirty_ratio becomes a function of its value
89(dirty_bytes / the amount of dirtyable system memory).
76 90
77============================================================== 91==============================================================
78 92
79overcommit_ratio: 93dirty_expire_centisecs
80 94
81When overcommit_memory is set to 2, the committed address 95This tunable is used to define when dirty data is old enough to be eligible
82space is not permitted to exceed swap plus this percentage 96for writeout by the pdflush daemons. It is expressed in 100'ths of a second.
83of physical RAM. See above. 97Data which has been dirty in-memory for longer than this interval will be
98written out next time a pdflush daemon wakes up.
99
100==============================================================
101
102dirty_ratio
103
104Contains, as a percentage of total system memory, the number of pages at which
105a process which is generating disk writes will itself start writing out dirty
106data.
84 107
85============================================================== 108==============================================================
86 109
87page-cluster: 110dirty_writeback_centisecs
88 111
89The Linux VM subsystem avoids excessive disk seeks by reading 112The pdflush writeback daemons will periodically wake up and write `old' data
90multiple pages on a page fault. The number of pages it reads 113out to disk. This tunable expresses the interval between those wakeups, in
91is dependent on the amount of memory in your machine. 114100'ths of a second.
92 115
93The number of pages the kernel reads in at once is equal to 116Setting this to zero disables periodic writeback altogether.
942 ^ page-cluster. Values above 2 ^ 5 don't make much sense
95for swap because we only cluster swap data in 32-page groups.
96 117
97============================================================== 118==============================================================
98 119
99max_map_count: 120drop_caches
100 121
101This file contains the maximum number of memory map areas a process 122Writing to this will cause the kernel to drop clean caches, dentries and
102may have. Memory map areas are used as a side-effect of calling 123inodes from memory, causing that memory to become free.
103malloc, directly by mmap and mprotect, and also when loading shared
104libraries.
105 124
106While most applications need less than a thousand maps, certain 125To free pagecache:
107programs, particularly malloc debuggers, may consume lots of them, 126 echo 1 > /proc/sys/vm/drop_caches
108e.g., up to one or two maps per allocation. 127To free dentries and inodes:
128 echo 2 > /proc/sys/vm/drop_caches
129To free pagecache, dentries and inodes:
130 echo 3 > /proc/sys/vm/drop_caches
109 131
110The default value is 65536. 132As this is a non-destructive operation and dirty objects are not freeable, the
133user should run `sync' first.
111 134
112============================================================== 135==============================================================
113 136
114min_free_kbytes: 137hugepages_treat_as_movable
115 138
116This is used to force the Linux VM to keep a minimum number 139This parameter is only useful when kernelcore= is specified at boot time to
117of kilobytes free. The VM uses this number to compute a pages_min 140create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
118value for each lowmem zone in the system. Each lowmem zone gets 141are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
119a number of reserved free pages based proportionally on its size. 142value written to hugepages_treat_as_movable allows huge pages to be allocated
143from ZONE_MOVABLE.
120 144
121Some minimal amount of memory is needed to satisfy PF_MEMALLOC 145Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
122allocations; if you set this to lower than 1024KB, your system will 146pages pool can easily grow or shrink within. Assuming that applications are
123become subtly broken, and prone to deadlock under high loads. 147not running that mlock() a lot of memory, it is likely the huge pages pool
124 148can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
125Setting this too high will OOM your machine instantly. 149into nr_hugepages and triggering page reclaim.
126 150
127============================================================== 151==============================================================
128 152
129percpu_pagelist_fraction 153hugetlb_shm_group
130 154
131This is the fraction of pages at most (high mark pcp->high) in each zone that 155hugetlb_shm_group contains group id that is allowed to create SysV
132are allocated for each per cpu page list. The min value for this is 8. It 156shared memory segment using hugetlb page.
133means that we don't allow more than 1/8th of pages in each zone to be
134allocated in any single per_cpu_pagelist. This entry only changes the value
135of hot per cpu pagelists. User can specify a number like 100 to allocate
1361/100th of each zone to each per cpu page list.
137 157
138The batch value of each per cpu pagelist is also updated as a result. It is 158==============================================================
139set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
140 159
141The initial value is zero. Kernel does not use this value at boot time to set 160laptop_mode
142the high water marks for each per cpu page list.
143 161
144=============================================================== 162laptop_mode is a knob that controls "laptop mode". All the things that are
163controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt.
145 164
146zone_reclaim_mode: 165==============================================================
147 166
148Zone_reclaim_mode allows someone to set more or less aggressive approaches to 167legacy_va_layout
149reclaim memory when a zone runs out of memory. If it is set to zero then no
150zone reclaim occurs. Allocations will be satisfied from other zones / nodes
151in the system.
152 168
153This is value ORed together of 169If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
170will use the legacy (2.4) layout for all processes.
154 171
1551 = Zone reclaim on 172==============================================================
1562 = Zone reclaim writes dirty pages out
1574 = Zone reclaim swaps pages
158 173
159zone_reclaim_mode is set during bootup to 1 if it is determined that pages 174lowmem_reserve_ratio
160from remote zones will cause a measurable performance reduction. The 175
161page allocator will then reclaim easily reusable pages (those page 176For some specialised workloads on highmem machines it is dangerous for
162cache pages that are currently not used) before allocating off node pages. 177the kernel to allow process memory to be allocated from the "lowmem"
178zone. This is because that memory could then be pinned via the mlock()
179system call, or by unavailability of swapspace.
180
181And on large highmem machines this lack of reclaimable lowmem memory
182can be fatal.
183
184So the Linux page allocator has a mechanism which prevents allocations
185which _could_ use highmem from using too much lowmem. This means that
186a certain amount of lowmem is defended from the possibility of being
187captured into pinned user memory.
188
189(The same argument applies to the old 16 megabyte ISA DMA region. This
190mechanism will also defend that region from allocations which could use
191highmem or lowmem).
192
193The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
194in defending these lower zones.
195
196If you have a machine which uses highmem or ISA DMA and your
197applications are using mlock(), or if you are running with no swap then
198you probably should change the lowmem_reserve_ratio setting.
199
200The lowmem_reserve_ratio is an array. You can see them by reading this file.
201-
202% cat /proc/sys/vm/lowmem_reserve_ratio
203256 256 32
204-
205Note: # of this elements is one fewer than number of zones. Because the highest
206 zone's value is not necessary for following calculation.
207
208But, these values are not used directly. The kernel calculates # of protection
209pages for each zones from them. These are shown as array of protection pages
210in /proc/zoneinfo like followings. (This is an example of x86-64 box).
211Each zone has an array of protection pages like this.
212
213-
214Node 0, zone DMA
215 pages free 1355
216 min 3
217 low 3
218 high 4
219 :
220 :
221 numa_other 0
222 protection: (0, 2004, 2004, 2004)
223 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
224 pagesets
225 cpu: 0 pcp: 0
226 :
227-
228These protections are added to score to judge whether this zone should be used
229for page allocation or should be reclaimed.
230
231In this example, if normal pages (index=2) are required to this DMA zone and
232pages_high is used for watermark, the kernel judges this zone should not be
233used because pages_free(1355) is smaller than watermark + protection[2]
234(4 + 2004 = 2008). If this protection value is 0, this zone would be used for
235normal page requirement. If requirement is DMA zone(index=0), protection[0]
236(=0) is used.
237
238zone[i]'s protection[j] is calculated by following expression.
239
240(i < j):
241 zone[i]->protection[j]
242 = (total sums of present_pages from zone[i+1] to zone[j] on the node)
243 / lowmem_reserve_ratio[i];
244(i = j):
245 (should not be protected. = 0;
246(i > j):
247 (not necessary, but looks 0)
248
249The default values of lowmem_reserve_ratio[i] are
250 256 (if zone[i] means DMA or DMA32 zone)
251 32 (others).
252As above expression, they are reciprocal number of ratio.
253256 means 1/256. # of protection pages becomes about "0.39%" of total present
254pages of higher zones on the node.
255
256If you would like to protect more pages, smaller values are effective.
257The minimum value is 1 (1/1 -> 100%).
163 258
164It may be beneficial to switch off zone reclaim if the system is 259==============================================================
165used for a file server and all of memory should be used for caching files
166from disk. In that case the caching effect is more important than
167data locality.
168 260
169Allowing zone reclaim to write out pages stops processes that are 261max_map_count:
170writing large amounts of data from dirtying pages on other nodes. Zone
171reclaim will write out dirty pages if a zone fills up and so effectively
172throttle the process. This may decrease the performance of a single process
173since it cannot use all of system memory to buffer the outgoing writes
174anymore but it preserve the memory on other nodes so that the performance
175of other processes running on other nodes will not be affected.
176 262
177Allowing regular swap effectively restricts allocations to the local 263This file contains the maximum number of memory map areas a process
178node unless explicitly overridden by memory policies or cpuset 264may have. Memory map areas are used as a side-effect of calling
179configurations. 265malloc, directly by mmap and mprotect, and also when loading shared
266libraries.
180 267
181============================================================= 268While most applications need less than a thousand maps, certain
269programs, particularly malloc debuggers, may consume lots of them,
270e.g., up to one or two maps per allocation.
182 271
183min_unmapped_ratio: 272The default value is 65536.
184 273
185This is available only on NUMA kernels. 274==============================================================
186 275
187A percentage of the total pages in each zone. Zone reclaim will only 276min_free_kbytes:
188occur if more than this percentage of pages are file backed and unmapped.
189This is to insure that a minimal amount of local pages is still available for
190file I/O even if the node is overallocated.
191 277
192The default is 1 percent. 278This is used to force the Linux VM to keep a minimum number
279of kilobytes free. The VM uses this number to compute a pages_min
280value for each lowmem zone in the system. Each lowmem zone gets
281a number of reserved free pages based proportionally on its size.
282
283Some minimal amount of memory is needed to satisfy PF_MEMALLOC
284allocations; if you set this to lower than 1024KB, your system will
285become subtly broken, and prone to deadlock under high loads.
286
287Setting this too high will OOM your machine instantly.
193 288
194============================================================= 289=============================================================
195 290
@@ -211,82 +306,73 @@ and may not be fast.
211 306
212============================================================= 307=============================================================
213 308
214panic_on_oom 309min_unmapped_ratio:
215 310
216This enables or disables panic on out-of-memory feature. 311This is available only on NUMA kernels.
217 312
218If this is set to 0, the kernel will kill some rogue process, 313A percentage of the total pages in each zone. Zone reclaim will only
219called oom_killer. Usually, oom_killer can kill rogue processes and 314occur if more than this percentage of pages are file backed and unmapped.
220system will survive. 315This is to insure that a minimal amount of local pages is still available for
316file I/O even if the node is overallocated.
221 317
222If this is set to 1, the kernel panics when out-of-memory happens. 318The default is 1 percent.
223However, if a process limits using nodes by mempolicy/cpusets,
224and those nodes become memory exhaustion status, one process
225may be killed by oom-killer. No panic occurs in this case.
226Because other nodes' memory may be free. This means system total status
227may be not fatal yet.
228 319
229If this is set to 2, the kernel panics compulsorily even on the 320==============================================================
230above-mentioned.
231 321
232The default value is 0. 322mmap_min_addr
2331 and 2 are for failover of clustering. Please select either
234according to your policy of failover.
235 323
236============================================================= 324This file indicates the amount of address space which a user process will
325be restricted from mmaping. Since kernel null dereference bugs could
326accidentally operate based on the information in the first couple of pages
327of memory userspace processes should not be allowed to write to them. By
328default this value is set to 0 and no protections will be enforced by the
329security module. Setting this value to something like 64k will allow the
330vast majority of applications to work correctly and provide defense in depth
331against future potential kernel bugs.
237 332
238oom_dump_tasks 333==============================================================
239 334
240Enables a system-wide task dump (excluding kernel threads) to be 335nr_hugepages
241produced when the kernel performs an OOM-killing and includes such
242information as pid, uid, tgid, vm size, rss, cpu, oom_adj score, and
243name. This is helpful to determine why the OOM killer was invoked
244and to identify the rogue task that caused it.
245 336
246If this is set to zero, this information is suppressed. On very 337Change the minimum size of the hugepage pool.
247large systems with thousands of tasks it may not be feasible to dump
248the memory state information for each one. Such systems should not
249be forced to incur a performance penalty in OOM conditions when the
250information may not be desired.
251 338
252If this is set to non-zero, this information is shown whenever the 339See Documentation/vm/hugetlbpage.txt
253OOM killer actually kills a memory-hogging task.
254 340
255The default value is 0. 341==============================================================
256 342
257============================================================= 343nr_overcommit_hugepages
258 344
259oom_kill_allocating_task 345Change the maximum size of the hugepage pool. The maximum is
346nr_hugepages + nr_overcommit_hugepages.
260 347
261This enables or disables killing the OOM-triggering task in 348See Documentation/vm/hugetlbpage.txt
262out-of-memory situations.
263 349
264If this is set to zero, the OOM killer will scan through the entire 350==============================================================
265tasklist and select a task based on heuristics to kill. This normally
266selects a rogue memory-hogging task that frees up a large amount of
267memory when killed.
268 351
269If this is set to non-zero, the OOM killer simply kills the task that 352nr_pdflush_threads
270triggered the out-of-memory condition. This avoids the expensive
271tasklist scan.
272 353
273If panic_on_oom is selected, it takes precedence over whatever value 354The current number of pdflush threads. This value is read-only.
274is used in oom_kill_allocating_task. 355The value changes according to the number of dirty pages in the system.
275 356
276The default value is 0. 357When neccessary, additional pdflush threads are created, one per second, up to
358nr_pdflush_threads_max.
277 359
278============================================================== 360==============================================================
279 361
280mmap_min_addr 362nr_trim_pages
281 363
282This file indicates the amount of address space which a user process will 364This is available only on NOMMU kernels.
283be restricted from mmaping. Since kernel null dereference bugs could 365
284accidentally operate based on the information in the first couple of pages 366This value adjusts the excess page trimming behaviour of power-of-2 aligned
285of memory userspace processes should not be allowed to write to them. By 367NOMMU mmap allocations.
286default this value is set to 0 and no protections will be enforced by the 368
287security module. Setting this value to something like 64k will allow the 369A value of 0 disables trimming of allocations entirely, while a value of 1
288vast majority of applications to work correctly and provide defense in depth 370trims excess pages aggressively. Any value >= 1 acts as the watermark where
289against future potential kernel bugs. 371trimming of allocations is initiated.
372
373The default value is 1.
374
375See Documentation/nommu-mmap.txt for more information.
290 376
291============================================================== 377==============================================================
292 378
@@ -335,34 +421,199 @@ this is causing problems for your system/application.
335 421
336============================================================== 422==============================================================
337 423
338nr_hugepages 424oom_dump_tasks
339 425
340Change the minimum size of the hugepage pool. 426Enables a system-wide task dump (excluding kernel threads) to be
427produced when the kernel performs an OOM-killing and includes such
428information as pid, uid, tgid, vm size, rss, cpu, oom_adj score, and
429name. This is helpful to determine why the OOM killer was invoked
430and to identify the rogue task that caused it.
341 431
342See Documentation/vm/hugetlbpage.txt 432If this is set to zero, this information is suppressed. On very
433large systems with thousands of tasks it may not be feasible to dump
434the memory state information for each one. Such systems should not
435be forced to incur a performance penalty in OOM conditions when the
436information may not be desired.
437
438If this is set to non-zero, this information is shown whenever the
439OOM killer actually kills a memory-hogging task.
440
441The default value is 0.
343 442
344============================================================== 443==============================================================
345 444
346nr_overcommit_hugepages 445oom_kill_allocating_task
347 446
348Change the maximum size of the hugepage pool. The maximum is 447This enables or disables killing the OOM-triggering task in
349nr_hugepages + nr_overcommit_hugepages. 448out-of-memory situations.
350 449
351See Documentation/vm/hugetlbpage.txt 450If this is set to zero, the OOM killer will scan through the entire
451tasklist and select a task based on heuristics to kill. This normally
452selects a rogue memory-hogging task that frees up a large amount of
453memory when killed.
454
455If this is set to non-zero, the OOM killer simply kills the task that
456triggered the out-of-memory condition. This avoids the expensive
457tasklist scan.
458
459If panic_on_oom is selected, it takes precedence over whatever value
460is used in oom_kill_allocating_task.
461
462The default value is 0.
352 463
353============================================================== 464==============================================================
354 465
355nr_trim_pages 466overcommit_memory:
356 467
357This is available only on NOMMU kernels. 468This value contains a flag that enables memory overcommitment.
358 469
359This value adjusts the excess page trimming behaviour of power-of-2 aligned 470When this flag is 0, the kernel attempts to estimate the amount
360NOMMU mmap allocations. 471of free memory left when userspace requests more memory.
361 472
362A value of 0 disables trimming of allocations entirely, while a value of 1 473When this flag is 1, the kernel pretends there is always enough
363trims excess pages aggressively. Any value >= 1 acts as the watermark where 474memory until it actually runs out.
364trimming of allocations is initiated.
365 475
366The default value is 1. 476When this flag is 2, the kernel uses a "never overcommit"
477policy that attempts to prevent any overcommit of memory.
367 478
368See Documentation/nommu-mmap.txt for more information. 479This feature can be very useful because there are a lot of
480programs that malloc() huge amounts of memory "just-in-case"
481and don't use much of it.
482
483The default value is 0.
484
485See Documentation/vm/overcommit-accounting and
486security/commoncap.c::cap_vm_enough_memory() for more information.
487
488==============================================================
489
490overcommit_ratio:
491
492When overcommit_memory is set to 2, the committed address
493space is not permitted to exceed swap plus this percentage
494of physical RAM. See above.
495
496==============================================================
497
498page-cluster
499
500page-cluster controls the number of pages which are written to swap in
501a single attempt. The swap I/O size.
502
503It is a logarithmic value - setting it to zero means "1 page", setting
504it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
505
506The default value is three (eight pages at a time). There may be some
507small benefits in tuning this to a different value if your workload is
508swap-intensive.
509
510=============================================================
511
512panic_on_oom
513
514This enables or disables panic on out-of-memory feature.
515
516If this is set to 0, the kernel will kill some rogue process,
517called oom_killer. Usually, oom_killer can kill rogue processes and
518system will survive.
519
520If this is set to 1, the kernel panics when out-of-memory happens.
521However, if a process limits using nodes by mempolicy/cpusets,
522and those nodes become memory exhaustion status, one process
523may be killed by oom-killer. No panic occurs in this case.
524Because other nodes' memory may be free. This means system total status
525may be not fatal yet.
526
527If this is set to 2, the kernel panics compulsorily even on the
528above-mentioned.
529
530The default value is 0.
5311 and 2 are for failover of clustering. Please select either
532according to your policy of failover.
533
534=============================================================
535
536percpu_pagelist_fraction
537
538This is the fraction of pages at most (high mark pcp->high) in each zone that
539are allocated for each per cpu page list. The min value for this is 8. It
540means that we don't allow more than 1/8th of pages in each zone to be
541allocated in any single per_cpu_pagelist. This entry only changes the value
542of hot per cpu pagelists. User can specify a number like 100 to allocate
5431/100th of each zone to each per cpu page list.
544
545The batch value of each per cpu pagelist is also updated as a result. It is
546set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
547
548The initial value is zero. Kernel does not use this value at boot time to set
549the high water marks for each per cpu page list.
550
551==============================================================
552
553stat_interval
554
555The time interval between which vm statistics are updated. The default
556is 1 second.
557
558==============================================================
559
560swappiness
561
562This control is used to define how aggressive the kernel will swap
563memory pages. Higher values will increase agressiveness, lower values
564descrease the amount of swap.
565
566The default value is 60.
567
568==============================================================
569
570vfs_cache_pressure
571------------------
572
573Controls the tendency of the kernel to reclaim the memory which is used for
574caching of directory and inode objects.
575
576At the default value of vfs_cache_pressure=100 the kernel will attempt to
577reclaim dentries and inodes at a "fair" rate with respect to pagecache and
578swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer
579to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100
580causes the kernel to prefer to reclaim dentries and inodes.
581
582==============================================================
583
584zone_reclaim_mode:
585
586Zone_reclaim_mode allows someone to set more or less aggressive approaches to
587reclaim memory when a zone runs out of memory. If it is set to zero then no
588zone reclaim occurs. Allocations will be satisfied from other zones / nodes
589in the system.
590
591This is value ORed together of
592
5931 = Zone reclaim on
5942 = Zone reclaim writes dirty pages out
5954 = Zone reclaim swaps pages
596
597zone_reclaim_mode is set during bootup to 1 if it is determined that pages
598from remote zones will cause a measurable performance reduction. The
599page allocator will then reclaim easily reusable pages (those page
600cache pages that are currently not used) before allocating off node pages.
601
602It may be beneficial to switch off zone reclaim if the system is
603used for a file server and all of memory should be used for caching files
604from disk. In that case the caching effect is more important than
605data locality.
606
607Allowing zone reclaim to write out pages stops processes that are
608writing large amounts of data from dirtying pages on other nodes. Zone
609reclaim will write out dirty pages if a zone fills up and so effectively
610throttle the process. This may decrease the performance of a single process
611since it cannot use all of system memory to buffer the outgoing writes
612anymore but it preserve the memory on other nodes so that the performance
613of other processes running on other nodes will not be affected.
614
615Allowing regular swap effectively restricts allocations to the local
616node unless explicitly overridden by memory policies or cpuset
617configurations.
618
619============ End of Document =================================
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 10a0263ebb3f..9e592c718afb 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -1,6 +1,5 @@
1Linux Magic System Request Key Hacks 1Linux Magic System Request Key Hacks
2Documentation for sysrq.c 2Documentation for sysrq.c
3Last update: 2007-AUG-04
4 3
5* What is the magic SysRq key? 4* What is the magic SysRq key?
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -211,6 +210,24 @@ within a function called by handle_sysrq, you must be aware that you are in
211a lock (you are also in an interrupt handler, which means don't sleep!), so 210a lock (you are also in an interrupt handler, which means don't sleep!), so
212you must call __handle_sysrq_nolock instead. 211you must call __handle_sysrq_nolock instead.
213 212
213* When I hit a SysRq key combination only the header appears on the console?
214~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215Sysrq output is subject to the same console loglevel control as all
216other console output. This means that if the kernel was booted 'quiet'
217as is common on distro kernels the output may not appear on the actual
218console, even though it will appear in the dmesg buffer, and be accessible
219via the dmesg command and to the consumers of /proc/kmsg. As a specific
220exception the header line from the sysrq command is passed to all console
221consumers as if the current loglevel was maximum. If only the header
222is emitted it is almost certain that the kernel loglevel is too low.
223Should you require the output on the console channel then you will need
224to temporarily up the console loglevel using alt-sysrq-8 or:
225
226 echo 8 > /proc/sysrq-trigger
227
228Remember to return the loglevel to normal after triggering the sysrq
229command you are interested in.
230
214* I have more questions, who can I ask? 231* I have more questions, who can I ask?
215~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 232~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216And I'll answer any questions about the registration system you got, also 233And I'll answer any questions about the registration system you got, also
diff --git a/MAINTAINERS b/MAINTAINERS
index 6f65a269cb17..3fe4dc2c2564 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1581,6 +1581,13 @@ L: bluesmoke-devel@lists.sourceforge.net
1581W: bluesmoke.sourceforge.net 1581W: bluesmoke.sourceforge.net
1582S: Maintained 1582S: Maintained
1583 1583
1584EDAC-I5400
1585P: Mauro Carvalho Chehab
1586M: mchehab@redhat.com
1587L: bluesmoke-devel@lists.sourceforge.net
1588W: bluesmoke.sourceforge.net
1589S: Maintained
1590
1584EDAC-I82975X 1591EDAC-I82975X
1585P: Ranganathan Desikan 1592P: Ranganathan Desikan
1586P: Arvind R. 1593P: Arvind R.
@@ -1814,6 +1821,14 @@ M: hch@infradead.org
1814W: ftp://ftp.openlinux.org/pub/people/hch/vxfs 1821W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
1815S: Maintained 1822S: Maintained
1816 1823
1824FREEZER
1825P: Pavel Machek
1826M: pavel@suse.cz
1827P: Rafael J. Wysocki
1828M: rjw@sisk.pl
1829L: linux-pm@lists.linux-foundation.org
1830S: Supported
1831
1817FTRACE 1832FTRACE
1818P: Steven Rostedt 1833P: Steven Rostedt
1819M: rostedt@goodmis.org 1834M: rostedt@goodmis.org
@@ -4842,11 +4857,11 @@ S: Supported
4842 4857
4843XFS FILESYSTEM 4858XFS FILESYSTEM
4844P: Silicon Graphics Inc 4859P: Silicon Graphics Inc
4845P: Tim Shimmin 4860P: Bill O'Donnell
4846M: xfs-masters@oss.sgi.com 4861M: xfs-masters@oss.sgi.com
4847L: xfs@oss.sgi.com 4862L: xfs@oss.sgi.com
4848W: http://oss.sgi.com/projects/xfs 4863W: http://oss.sgi.com/projects/xfs
4849T: git git://oss.sgi.com:8090/xfs/xfs-2.6.git 4864T: git://oss.sgi.com/xfs/xfs.git
4850S: Supported 4865S: Supported
4851 4866
4852XILINX SYSTEMACE DRIVER 4867XILINX SYSTEMACE DRIVER
diff --git a/Makefile b/Makefile
index c06e250eca18..207303da3971 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 29 3SUBLEVEL = 29
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Erotic Pickled Herring 5NAME = Erotic Pickled Herring
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/Kconfig b/arch/Kconfig
index 2e13aa261929..550dab22daa1 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -62,6 +62,9 @@ config HAVE_EFFICIENT_UNALIGNED_ACCESS
62 See Documentation/unaligned-memory-access.txt for more 62 See Documentation/unaligned-memory-access.txt for more
63 information on the topic of unaligned memory accesses. 63 information on the topic of unaligned memory accesses.
64 64
65config HAVE_SYSCALL_WRAPPERS
66 bool
67
65config KRETPROBES 68config KRETPROBES
66 def_bool y 69 def_bool y
67 depends on KPROBES && HAVE_KRETPROBES 70 depends on KPROBES && HAVE_KRETPROBES
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index 4dad27360576..b7c8f188b313 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -9,4 +9,3 @@ unifdef-y += console.h
9unifdef-y += fpu.h 9unifdef-y += fpu.h
10unifdef-y += sysinfo.h 10unifdef-y += sysinfo.h
11unifdef-y += compiler.h 11unifdef-y += compiler.h
12unifdef-y += swab.h
diff --git a/arch/alpha/include/asm/byteorder.h b/arch/alpha/include/asm/byteorder.h
index 6772f3168701..73683093202d 100644
--- a/arch/alpha/include/asm/byteorder.h
+++ b/arch/alpha/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ALPHA_BYTEORDER_H 1#ifndef _ALPHA_BYTEORDER_H
2#define _ALPHA_BYTEORDER_H 2#define _ALPHA_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ALPHA_BYTEORDER_H */ 6#endif /* _ALPHA_BYTEORDER_H */
diff --git a/arch/alpha/include/asm/machvec.h b/arch/alpha/include/asm/machvec.h
index a86c083cdf7f..fea4ea75b79d 100644
--- a/arch/alpha/include/asm/machvec.h
+++ b/arch/alpha/include/asm/machvec.h
@@ -21,6 +21,7 @@ struct pci_dev;
21struct pci_ops; 21struct pci_ops;
22struct pci_controller; 22struct pci_controller;
23struct _alpha_agp_info; 23struct _alpha_agp_info;
24struct rtc_time;
24 25
25struct alpha_machine_vector 26struct alpha_machine_vector
26{ 27{
@@ -94,6 +95,9 @@ struct alpha_machine_vector
94 95
95 struct _alpha_agp_info *(*agp_info)(void); 96 struct _alpha_agp_info *(*agp_info)(void);
96 97
98 unsigned int (*rtc_get_time)(struct rtc_time *);
99 int (*rtc_set_time)(struct rtc_time *);
100
97 const char *vector_name; 101 const char *vector_name;
98 102
99 /* NUMA information */ 103 /* NUMA information */
diff --git a/arch/alpha/include/asm/pgalloc.h b/arch/alpha/include/asm/pgalloc.h
index fd090155dccd..bc2a0daf2d92 100644
--- a/arch/alpha/include/asm/pgalloc.h
+++ b/arch/alpha/include/asm/pgalloc.h
@@ -50,7 +50,12 @@ pmd_free(struct mm_struct *mm, pmd_t *pmd)
50 free_page((unsigned long)pmd); 50 free_page((unsigned long)pmd);
51} 51}
52 52
53extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 53static inline pte_t *
54pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
55{
56 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
57 return pte;
58}
54 59
55static inline void 60static inline void
56pte_free_kernel(struct mm_struct *mm, pte_t *pte) 61pte_free_kernel(struct mm_struct *mm, pte_t *pte)
diff --git a/arch/alpha/include/asm/rtc.h b/arch/alpha/include/asm/rtc.h
index 4e854b1333eb..1f7fba671ae6 100644
--- a/arch/alpha/include/asm/rtc.h
+++ b/arch/alpha/include/asm/rtc.h
@@ -1,9 +1,15 @@
1#ifndef _ALPHA_RTC_H 1#ifndef _ALPHA_RTC_H
2#define _ALPHA_RTC_H 2#define _ALPHA_RTC_H
3 3
4/* 4#if defined(CONFIG_ALPHA_GENERIC)
5 * Alpha uses the default access methods for the RTC. 5# define get_rtc_time alpha_mv.rtc_get_time
6 */ 6# define set_rtc_time alpha_mv.rtc_set_time
7#else
8# if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP)
9# define get_rtc_time marvel_get_rtc_time
10# define set_rtc_time marvel_set_rtc_time
11# endif
12#endif
7 13
8#include <asm-generic/rtc.h> 14#include <asm-generic/rtc.h>
9 15
diff --git a/arch/alpha/kernel/.gitignore b/arch/alpha/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/alpha/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
index 9cd8dca742a7..e302daecbe56 100644
--- a/arch/alpha/kernel/core_marvel.c
+++ b/arch/alpha/kernel/core_marvel.c
@@ -658,16 +658,8 @@ __marvel_rtc_io(u8 b, unsigned long addr, int write)
658 rtc_access.data = bcd2bin(b); 658 rtc_access.data = bcd2bin(b);
659 rtc_access.function = 0x48 + !write; /* GET/PUT_TOY */ 659 rtc_access.function = 0x48 + !write; /* GET/PUT_TOY */
660 660
661#ifdef CONFIG_SMP
662 if (smp_processor_id() != boot_cpuid)
663 smp_call_function_single(boot_cpuid,
664 __marvel_access_rtc,
665 &rtc_access, 1);
666 else
667 __marvel_access_rtc(&rtc_access);
668#else
669 __marvel_access_rtc(&rtc_access); 661 __marvel_access_rtc(&rtc_access);
670#endif 662
671 ret = bin2bcd(rtc_access.data); 663 ret = bin2bcd(rtc_access.data);
672 break; 664 break;
673 665
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index f77345bc66a9..aa2e50cf9857 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -896,9 +896,9 @@ sys_getxpid:
896.end sys_getxpid 896.end sys_getxpid
897 897
898 .align 4 898 .align 4
899 .globl sys_pipe 899 .globl sys_alpha_pipe
900 .ent sys_pipe 900 .ent sys_alpha_pipe
901sys_pipe: 901sys_alpha_pipe:
902 lda $sp, -16($sp) 902 lda $sp, -16($sp)
903 stq $26, 0($sp) 903 stq $26, 0($sp)
904 .prologue 0 904 .prologue 0
@@ -916,7 +916,7 @@ sys_pipe:
916 stq $1, 80+16($sp) 916 stq $1, 80+16($sp)
9171: lda $sp, 16($sp) 9171: lda $sp, 16($sp)
918 ret 918 ret
919.end sys_pipe 919.end sys_alpha_pipe
920 920
921 .align 4 921 .align 4
922 .globl sys_execve 922 .globl sys_execve
diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c
index 32212014fbe9..a03fbca4940e 100644
--- a/arch/alpha/kernel/irq_srm.c
+++ b/arch/alpha/kernel/irq_srm.c
@@ -63,6 +63,8 @@ init_srm_irqs(long max, unsigned long ignore_mask)
63{ 63{
64 long i; 64 long i;
65 65
66 if (NR_IRQS <= 16)
67 return;
66 for (i = 16; i < max; ++i) { 68 for (i = 16; i < max; ++i) {
67 if (i < 64 && ((ignore_mask >> i) & 1)) 69 if (i < 64 && ((ignore_mask >> i) & 1))
68 continue; 70 continue;
diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
index 466c9dff8181..512685f78097 100644
--- a/arch/alpha/kernel/machvec_impl.h
+++ b/arch/alpha/kernel/machvec_impl.h
@@ -40,7 +40,10 @@
40#define CAT1(x,y) x##y 40#define CAT1(x,y) x##y
41#define CAT(x,y) CAT1(x,y) 41#define CAT(x,y) CAT1(x,y)
42 42
43#define DO_DEFAULT_RTC .rtc_port = 0x70 43#define DO_DEFAULT_RTC \
44 .rtc_port = 0x70, \
45 .rtc_get_time = common_get_rtc_time, \
46 .rtc_set_time = common_set_rtc_time
44 47
45#define DO_EV4_MMU \ 48#define DO_EV4_MMU \
46 .max_asn = EV4_MAX_ASN, \ 49 .max_asn = EV4_MAX_ASN, \
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
index 708d5ca87782..fe14c6747cd6 100644
--- a/arch/alpha/kernel/proto.h
+++ b/arch/alpha/kernel/proto.h
@@ -145,6 +145,8 @@ extern void smp_percpu_timer_interrupt(struct pt_regs *);
145extern irqreturn_t timer_interrupt(int irq, void *dev); 145extern irqreturn_t timer_interrupt(int irq, void *dev);
146extern void common_init_rtc(void); 146extern void common_init_rtc(void);
147extern unsigned long est_cycle_freq; 147extern unsigned long est_cycle_freq;
148extern unsigned int common_get_rtc_time(struct rtc_time *time);
149extern int common_set_rtc_time(struct rtc_time *time);
148 150
149/* smc37c93x.c */ 151/* smc37c93x.c */
150extern void SMC93x_Init(void); 152extern void SMC93x_Init(void);
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c
index 2c3de97de46c..e2516f9a8967 100644
--- a/arch/alpha/kernel/sys_jensen.c
+++ b/arch/alpha/kernel/sys_jensen.c
@@ -261,6 +261,8 @@ struct alpha_machine_vector jensen_mv __initmv = {
261 .machine_check = jensen_machine_check, 261 .machine_check = jensen_machine_check,
262 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, 262 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
263 .rtc_port = 0x170, 263 .rtc_port = 0x170,
264 .rtc_get_time = common_get_rtc_time,
265 .rtc_set_time = common_set_rtc_time,
264 266
265 .nr_irqs = 16, 267 .nr_irqs = 16,
266 .device_interrupt = jensen_device_interrupt, 268 .device_interrupt = jensen_device_interrupt,
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 828449cd2636..c5a1a2438c67 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -23,6 +23,7 @@
23#include <asm/hwrpb.h> 23#include <asm/hwrpb.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/vga.h> 25#include <asm/vga.h>
26#include <asm/rtc.h>
26 27
27#include "proto.h" 28#include "proto.h"
28#include "err_impl.h" 29#include "err_impl.h"
@@ -426,6 +427,57 @@ marvel_init_rtc(void)
426 init_rtc_irq(); 427 init_rtc_irq();
427} 428}
428 429
430struct marvel_rtc_time {
431 struct rtc_time *time;
432 int retval;
433};
434
435#ifdef CONFIG_SMP
436static void
437smp_get_rtc_time(void *data)
438{
439 struct marvel_rtc_time *mrt = data;
440 mrt->retval = __get_rtc_time(mrt->time);
441}
442
443static void
444smp_set_rtc_time(void *data)
445{
446 struct marvel_rtc_time *mrt = data;
447 mrt->retval = __set_rtc_time(mrt->time);
448}
449#endif
450
451static unsigned int
452marvel_get_rtc_time(struct rtc_time *time)
453{
454#ifdef CONFIG_SMP
455 struct marvel_rtc_time mrt;
456
457 if (smp_processor_id() != boot_cpuid) {
458 mrt.time = time;
459 smp_call_function_single(boot_cpuid, smp_get_rtc_time, &mrt, 1);
460 return mrt.retval;
461 }
462#endif
463 return __get_rtc_time(time);
464}
465
466static int
467marvel_set_rtc_time(struct rtc_time *time)
468{
469#ifdef CONFIG_SMP
470 struct marvel_rtc_time mrt;
471
472 if (smp_processor_id() != boot_cpuid) {
473 mrt.time = time;
474 smp_call_function_single(boot_cpuid, smp_set_rtc_time, &mrt, 1);
475 return mrt.retval;
476 }
477#endif
478 return __set_rtc_time(time);
479}
480
429static void 481static void
430marvel_smp_callin(void) 482marvel_smp_callin(void)
431{ 483{
@@ -466,7 +518,9 @@ marvel_smp_callin(void)
466struct alpha_machine_vector marvel_ev7_mv __initmv = { 518struct alpha_machine_vector marvel_ev7_mv __initmv = {
467 .vector_name = "MARVEL/EV7", 519 .vector_name = "MARVEL/EV7",
468 DO_EV7_MMU, 520 DO_EV7_MMU,
469 DO_DEFAULT_RTC, 521 .rtc_port = 0x70,
522 .rtc_get_time = marvel_get_rtc_time,
523 .rtc_set_time = marvel_set_rtc_time,
470 DO_MARVEL_IO, 524 DO_MARVEL_IO,
471 .machine_check = marvel_machine_check, 525 .machine_check = marvel_machine_check,
472 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, 526 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index a7f23b5ab814..99c0f46f6b9c 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -245,6 +245,10 @@ nautilus_init_pci(void)
245 IRONGATE0->pci_mem = pci_mem; 245 IRONGATE0->pci_mem = pci_mem;
246 246
247 pci_bus_assign_resources(bus); 247 pci_bus_assign_resources(bus);
248
249 /* pci_common_swizzle() relies on bus->self being NULL
250 for the root bus, so just clear it. */
251 bus->self = NULL;
248 pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); 252 pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
249} 253}
250 254
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index ba914af18c4f..9d9e3a98bb95 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -52,7 +52,7 @@ sys_call_table:
52 .quad sys_setpgid 52 .quad sys_setpgid
53 .quad alpha_ni_syscall /* 40 */ 53 .quad alpha_ni_syscall /* 40 */
54 .quad sys_dup 54 .quad sys_dup
55 .quad sys_pipe 55 .quad sys_alpha_pipe
56 .quad osf_set_program_attributes 56 .quad osf_set_program_attributes
57 .quad alpha_ni_syscall 57 .quad alpha_ni_syscall
58 .quad sys_open /* 45 */ 58 .quad sys_open /* 45 */
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index e6a231435cba..b04e2cbf23a4 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -46,6 +46,7 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/hwrpb.h> 47#include <asm/hwrpb.h>
48#include <asm/8253pit.h> 48#include <asm/8253pit.h>
49#include <asm/rtc.h>
49 50
50#include <linux/mc146818rtc.h> 51#include <linux/mc146818rtc.h>
51#include <linux/time.h> 52#include <linux/time.h>
@@ -180,6 +181,15 @@ common_init_rtc(void)
180 init_rtc_irq(); 181 init_rtc_irq();
181} 182}
182 183
184unsigned int common_get_rtc_time(struct rtc_time *time)
185{
186 return __get_rtc_time(time);
187}
188
189int common_set_rtc_time(struct rtc_time *time)
190{
191 return __set_rtc_time(time);
192}
183 193
184/* Validate a computed cycle counter result against the known bounds for 194/* Validate a computed cycle counter result against the known bounds for
185 the given processor core. There's too much brokenness in the way of 195 the given processor core. There's too much brokenness in the way of
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 234e42b8ee74..5d7a16eab312 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -59,13 +59,6 @@ pgd_alloc(struct mm_struct *mm)
59 return ret; 59 return ret;
60} 60}
61 61
62pte_t *
63pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
64{
65 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
66 return pte;
67}
68
69 62
70/* 63/*
71 * BAD_PAGE is the page that is used for page faults when linux 64 * BAD_PAGE is the page that is used for page faults when linux
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 43b0b2ba392f..73237bd130a2 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += hwcap.h 3unifdef-y += hwcap.h
4unifdef-y += swab.h
diff --git a/arch/arm/include/asm/byteorder.h b/arch/arm/include/asm/byteorder.h
index c02b6fc28e1a..77379748b171 100644
--- a/arch/arm/include/asm/byteorder.h
+++ b/arch/arm/include/asm/byteorder.h
@@ -15,8 +15,6 @@
15#ifndef __ASM_ARM_BYTEORDER_H 15#ifndef __ASM_ARM_BYTEORDER_H
16#define __ASM_ARM_BYTEORDER_H 16#define __ASM_ARM_BYTEORDER_H
17 17
18#include <asm/swab.h>
19
20#ifdef __ARMEB__ 18#ifdef __ARMEB__
21#include <linux/byteorder/big_endian.h> 19#include <linux/byteorder/big_endian.h>
22#else 20#else
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 09a061cb7838..9ca8d13f05f7 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -98,7 +98,7 @@
98 CALL(sys_uselib) 98 CALL(sys_uselib)
99 CALL(sys_swapon) 99 CALL(sys_swapon)
100 CALL(sys_reboot) 100 CALL(sys_reboot)
101 CALL(OBSOLETE(old_readdir)) /* used by libc4 */ 101 CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */
102/* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */ 102/* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */
103 CALL(sys_munmap) 103 CALL(sys_munmap)
104 CALL(sys_truncate) 104 CALL(sys_truncate)
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 219822c8ad18..3136628ba8d2 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += swab.h
4header-y += cachectl.h 3header-y += cachectl.h
diff --git a/arch/avr32/include/asm/byteorder.h b/arch/avr32/include/asm/byteorder.h
index 2aba64b4e122..50abc21619a8 100644
--- a/arch/avr32/include/asm/byteorder.h
+++ b/arch/avr32/include/asm/byteorder.h
@@ -4,7 +4,6 @@
4#ifndef __ASM_AVR32_BYTEORDER_H 4#ifndef __ASM_AVR32_BYTEORDER_H
5#define __ASM_AVR32_BYTEORDER_H 5#define __ASM_AVR32_BYTEORDER_H
6 6
7#include <asm/swab.h>
8#include <linux/byteorder/big_endian.h> 7#include <linux/byteorder/big_endian.h>
9 8
10#endif /* __ASM_AVR32_BYTEORDER_H */ 9#endif /* __ASM_AVR32_BYTEORDER_H */
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index d0d1ac435544..606ecfdcc962 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += fixed_code.h 3unifdef-y += fixed_code.h
4unifdef-y += swab.h
diff --git a/arch/blackfin/include/asm/byteorder.h b/arch/blackfin/include/asm/byteorder.h
index b9e797a497b4..3e69106a4d37 100644
--- a/arch/blackfin/include/asm/byteorder.h
+++ b/arch/blackfin/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _BLACKFIN_BYTEORDER_H 1#ifndef _BLACKFIN_BYTEORDER_H
2#define _BLACKFIN_BYTEORDER_H 2#define _BLACKFIN_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _BLACKFIN_BYTEORDER_H */ 6#endif /* _BLACKFIN_BYTEORDER_H */
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index ed171d389e65..72f5cd319b97 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -691,7 +691,7 @@ sys_call_table:
691 .long sys_uselib 691 .long sys_uselib
692 .long sys_swapon 692 .long sys_swapon
693 .long sys_reboot 693 .long sys_reboot
694 .long old_readdir 694 .long sys_old_readdir
695 .long old_mmap /* 90 */ 695 .long old_mmap /* 90 */
696 .long sys_munmap 696 .long sys_munmap
697 .long sys_truncate 697 .long sys_truncate
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index 7f6f93e6b70e..5e674c8f7c51 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -614,7 +614,7 @@ sys_call_table:
614 .long sys_uselib 614 .long sys_uselib
615 .long sys_swapon 615 .long sys_swapon
616 .long sys_reboot 616 .long sys_reboot
617 .long old_readdir 617 .long sys_old_readdir
618 .long old_mmap /* 90 */ 618 .long old_mmap /* 90 */
619 .long sys_munmap 619 .long sys_munmap
620 .long sys_truncate 620 .long sys_truncate
diff --git a/arch/cris/include/arch-v10/arch/byteorder.h b/arch/cris/include/arch-v10/arch/swab.h
index 255b646b7fa8..e4e847d8a05e 100644
--- a/arch/cris/include/arch-v10/arch/byteorder.h
+++ b/arch/cris/include/arch-v10/arch/swab.h
@@ -1,26 +1,30 @@
1#ifndef _CRIS_ARCH_BYTEORDER_H 1#ifndef _CRIS_ARCH_SWAB_H
2#define _CRIS_ARCH_BYTEORDER_H 2#define _CRIS_ARCH_SWAB_H
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#define __SWAB_64_THRU_32__
8
7/* we just define these two (as we can do the swap in a single 9/* we just define these two (as we can do the swap in a single
8 * asm instruction in CRIS) and the arch-independent files will put 10 * asm instruction in CRIS) and the arch-independent files will put
9 * them together into ntohl etc. 11 * them together into ntohl etc.
10 */ 12 */
11 13
12static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) 14static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
13{ 15{
14 __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); 16 __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
15 17
16 return(x); 18 return(x);
17} 19}
20#define __arch_swab32 __arch_swab32
18 21
19static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) 22static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
20{ 23{
21 __asm__ ("swapb %0" : "=r" (x) : "0" (x)); 24 __asm__ ("swapb %0" : "=r" (x) : "0" (x));
22 25
23 return(x); 26 return(x);
24} 27}
28#define __arch_swab16 __arch_swab16
25 29
26#endif 30#endif
diff --git a/arch/cris/include/arch-v32/arch/byteorder.h b/arch/cris/include/arch-v32/arch/byteorder.h
deleted file mode 100644
index 6ef8fb4a35f2..000000000000
--- a/arch/cris/include/arch-v32/arch/byteorder.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_CRIS_ARCH_BYTEORDER_H
2#define _ASM_CRIS_ARCH_BYTEORDER_H
3
4#include <asm/types.h>
5
6static inline __const__ __u32
7___arch__swab32(__u32 x)
8{
9 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
10 return (x);
11}
12
13static inline __const__ __u16
14___arch__swab16(__u16 x)
15{
16 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
17 return (x);
18}
19
20#endif /* _ASM_CRIS_ARCH_BYTEORDER_H */
diff --git a/arch/cris/include/arch-v32/arch/swab.h b/arch/cris/include/arch-v32/arch/swab.h
new file mode 100644
index 000000000000..9a4ea5e209c2
--- /dev/null
+++ b/arch/cris/include/arch-v32/arch/swab.h
@@ -0,0 +1,24 @@
1#ifndef _ASM_CRIS_ARCH_SWAB_H
2#define _ASM_CRIS_ARCH_SWAB_H
3
4#include <asm/types.h>
5
6#define __SWAB_64_THRU_32__
7
8static inline __const__ __u32
9__arch_swab32(__u32 x)
10{
11 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
12 return (x);
13}
14#define __arch_swab32 __arch_swab32
15
16static inline __const__ __u16
17__arch_swab16(__u16 x)
18{
19 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
20 return (x);
21}
22#define __arch_swab16 __arch_swab16
23
24#endif /* _ASM_CRIS_ARCH_SWAB_H */
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/asm/byteorder.h
index cc8e418cfd14..bcd189798e26 100644
--- a/arch/cris/include/asm/byteorder.h
+++ b/arch/cris/include/asm/byteorder.h
@@ -1,25 +1,6 @@
1#ifndef _CRIS_BYTEORDER_H 1#ifndef _CRIS_BYTEORDER_H
2#define _CRIS_BYTEORDER_H 2#define _CRIS_BYTEORDER_H
3 3
4#ifdef __GNUC__
5
6#ifdef __KERNEL__
7#include <arch/byteorder.h>
8
9/* defines are necessary because the other files detect the presence
10 * of a defined __arch_swab32, not an inline
11 */
12#define __arch__swab32(x) ___arch__swab32(x)
13#define __arch__swab16(x) ___arch__swab16(x)
14#endif /* __KERNEL__ */
15
16#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
17# define __BYTEORDER_HAS_U64__
18# define __SWAB_64_THRU_32__
19#endif
20
21#endif /* __GNUC__ */
22
23#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
24 5
25#endif 6#endif
diff --git a/arch/cris/include/asm/swab.h b/arch/cris/include/asm/swab.h
new file mode 100644
index 000000000000..80668e88419c
--- /dev/null
+++ b/arch/cris/include/asm/swab.h
@@ -0,0 +1,8 @@
1#ifndef _CRIS_SWAB_H
2#define _CRIS_SWAB_H
3
4#ifdef __KERNEL__
5#include <arch/swab.h>
6#endif /* __KERNEL__ */
7
8#endif /* _CRIS_SWAB_H */
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 27b108a86b39..c68e1680da01 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -1,2 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/asm/byteorder.h
index c36b80a3dd84..13539da99efd 100644
--- a/arch/h8300/include/asm/byteorder.h
+++ b/arch/h8300/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _H8300_BYTEORDER_H 1#ifndef _H8300_BYTEORDER_H
2#define _H8300_BYTEORDER_H 2#define _H8300_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _H8300_BYTEORDER_H */ 6#endif /* _H8300_BYTEORDER_H */
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index 54e21c3f2057..4eb67faac633 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -103,7 +103,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
103 .long SYMBOL_NAME(sys_uselib) 103 .long SYMBOL_NAME(sys_uselib)
104 .long SYMBOL_NAME(sys_swapon) 104 .long SYMBOL_NAME(sys_swapon)
105 .long SYMBOL_NAME(sys_reboot) 105 .long SYMBOL_NAME(sys_reboot)
106 .long SYMBOL_NAME(old_readdir) 106 .long SYMBOL_NAME(sys_old_readdir)
107 .long SYMBOL_NAME(old_mmap) /* 90 */ 107 .long SYMBOL_NAME(old_mmap) /* 90 */
108 .long SYMBOL_NAME(sys_munmap) 108 .long SYMBOL_NAME(sys_munmap)
109 .long SYMBOL_NAME(sys_truncate) 109 .long SYMBOL_NAME(sys_truncate)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3d31636cbafb..6183aeccecf1 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -17,6 +17,7 @@ config IA64
17 select ACPI if (!IA64_HP_SIM) 17 select ACPI if (!IA64_HP_SIM)
18 select PM if (!IA64_HP_SIM) 18 select PM if (!IA64_HP_SIM)
19 select ARCH_SUPPORTS_MSI 19 select ARCH_SUPPORTS_MSI
20 select HAVE_UNSTABLE_SCHED_CLOCK
20 select HAVE_IDE 21 select HAVE_IDE
21 select HAVE_OPROFILE 22 select HAVE_OPROFILE
22 select HAVE_KPROBES 23 select HAVE_KPROBES
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 27eb67604c53..a109db30ce55 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -578,7 +578,7 @@ CONFIG_ATA_PIIX=y
578# CONFIG_SATA_SIS is not set 578# CONFIG_SATA_SIS is not set
579# CONFIG_SATA_ULI is not set 579# CONFIG_SATA_ULI is not set
580# CONFIG_SATA_VIA is not set 580# CONFIG_SATA_VIA is not set
581# CONFIG_SATA_VITESSE is not set 581CONFIG_SATA_VITESSE=y
582# CONFIG_SATA_INIC162X is not set 582# CONFIG_SATA_INIC162X is not set
583# CONFIG_PATA_ACPI is not set 583# CONFIG_PATA_ACPI is not set
584# CONFIG_PATA_ALI is not set 584# CONFIG_PATA_ALI is not set
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index a8cf19958850..a46f8395e9a5 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -220,7 +220,7 @@ ia32_syscall_table:
220 data8 sys_mkdir 220 data8 sys_mkdir
221 data8 sys_rmdir /* 40 */ 221 data8 sys_rmdir /* 40 */
222 data8 sys_dup 222 data8 sys_dup
223 data8 sys_pipe 223 data8 sys_ia64_pipe
224 data8 compat_sys_times 224 data8 compat_sys_times
225 data8 sys_ni_syscall /* old prof syscall holder */ 225 data8 sys_ni_syscall /* old prof syscall holder */
226 data8 sys32_brk /* 45 */ 226 data8 sys32_brk /* 45 */
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 3b25bd9dca91..ccbe8ae47a61 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -14,4 +14,3 @@ unifdef-y += gcc_intrin.h
14unifdef-y += intrinsics.h 14unifdef-y += intrinsics.h
15unifdef-y += perfmon.h 15unifdef-y += perfmon.h
16unifdef-y += ustack.h 16unifdef-y += ustack.h
17unifdef-y += swab.h
diff --git a/arch/ia64/include/asm/byteorder.h b/arch/ia64/include/asm/byteorder.h
index 0f84c5cb703d..a8dd73558150 100644
--- a/arch/ia64/include/asm/byteorder.h
+++ b/arch/ia64/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_IA64_BYTEORDER_H 1#ifndef _ASM_IA64_BYTEORDER_H
2#define _ASM_IA64_BYTEORDER_H 2#define _ASM_IA64_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ASM_IA64_BYTEORDER_H */ 6#endif /* _ASM_IA64_BYTEORDER_H */
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index bbab7e2b0fc9..1f912d927585 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -9,6 +9,8 @@
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <asm/swiotlb.h> 10#include <asm/swiotlb.h>
11 11
12#define ARCH_HAS_DMA_GET_REQUIRED_MASK
13
12struct dma_mapping_ops { 14struct dma_mapping_ops {
13 int (*mapping_error)(struct device *dev, 15 int (*mapping_error)(struct device *dev,
14 dma_addr_t dma_addr); 16 dma_addr_t dma_addr);
diff --git a/arch/ia64/include/asm/machvec.h b/arch/ia64/include/asm/machvec.h
index 59c17e446683..fe87b2121707 100644
--- a/arch/ia64/include/asm/machvec.h
+++ b/arch/ia64/include/asm/machvec.h
@@ -62,6 +62,7 @@ typedef dma_addr_t ia64_mv_dma_map_single_attrs (struct device *, void *, size_t
62typedef void ia64_mv_dma_unmap_single_attrs (struct device *, dma_addr_t, size_t, int, struct dma_attrs *); 62typedef void ia64_mv_dma_unmap_single_attrs (struct device *, dma_addr_t, size_t, int, struct dma_attrs *);
63typedef int ia64_mv_dma_map_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *); 63typedef int ia64_mv_dma_map_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
64typedef void ia64_mv_dma_unmap_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *); 64typedef void ia64_mv_dma_unmap_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
65typedef u64 ia64_mv_dma_get_required_mask (struct device *);
65 66
66/* 67/*
67 * WARNING: The legacy I/O space is _architected_. Platforms are 68 * WARNING: The legacy I/O space is _architected_. Platforms are
@@ -159,6 +160,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
159# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device 160# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device
160# define platform_dma_mapping_error ia64_mv.dma_mapping_error 161# define platform_dma_mapping_error ia64_mv.dma_mapping_error
161# define platform_dma_supported ia64_mv.dma_supported 162# define platform_dma_supported ia64_mv.dma_supported
163# define platform_dma_get_required_mask ia64_mv.dma_get_required_mask
162# define platform_irq_to_vector ia64_mv.irq_to_vector 164# define platform_irq_to_vector ia64_mv.irq_to_vector
163# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq 165# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq
164# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem 166# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem
@@ -213,6 +215,7 @@ struct ia64_machine_vector {
213 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device; 215 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device;
214 ia64_mv_dma_mapping_error *dma_mapping_error; 216 ia64_mv_dma_mapping_error *dma_mapping_error;
215 ia64_mv_dma_supported *dma_supported; 217 ia64_mv_dma_supported *dma_supported;
218 ia64_mv_dma_get_required_mask *dma_get_required_mask;
216 ia64_mv_irq_to_vector *irq_to_vector; 219 ia64_mv_irq_to_vector *irq_to_vector;
217 ia64_mv_local_vector_to_irq *local_vector_to_irq; 220 ia64_mv_local_vector_to_irq *local_vector_to_irq;
218 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem; 221 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem;
@@ -263,6 +266,7 @@ struct ia64_machine_vector {
263 platform_dma_sync_sg_for_device, \ 266 platform_dma_sync_sg_for_device, \
264 platform_dma_mapping_error, \ 267 platform_dma_mapping_error, \
265 platform_dma_supported, \ 268 platform_dma_supported, \
269 platform_dma_get_required_mask, \
266 platform_irq_to_vector, \ 270 platform_irq_to_vector, \
267 platform_local_vector_to_irq, \ 271 platform_local_vector_to_irq, \
268 platform_pci_get_legacy_mem, \ 272 platform_pci_get_legacy_mem, \
@@ -366,6 +370,9 @@ extern void machvec_init_from_cmdline(const char *cmdline);
366#ifndef platform_dma_supported 370#ifndef platform_dma_supported
367# define platform_dma_supported swiotlb_dma_supported 371# define platform_dma_supported swiotlb_dma_supported
368#endif 372#endif
373#ifndef platform_dma_get_required_mask
374# define platform_dma_get_required_mask ia64_dma_get_required_mask
375#endif
369#ifndef platform_irq_to_vector 376#ifndef platform_irq_to_vector
370# define platform_irq_to_vector __ia64_irq_to_vector 377# define platform_irq_to_vector __ia64_irq_to_vector
371#endif 378#endif
diff --git a/arch/ia64/include/asm/machvec_init.h b/arch/ia64/include/asm/machvec_init.h
index ef964b286842..37a469849ab9 100644
--- a/arch/ia64/include/asm/machvec_init.h
+++ b/arch/ia64/include/asm/machvec_init.h
@@ -3,6 +3,7 @@
3 3
4extern ia64_mv_send_ipi_t ia64_send_ipi; 4extern ia64_mv_send_ipi_t ia64_send_ipi;
5extern ia64_mv_global_tlb_purge_t ia64_global_tlb_purge; 5extern ia64_mv_global_tlb_purge_t ia64_global_tlb_purge;
6extern ia64_mv_dma_get_required_mask ia64_dma_get_required_mask;
6extern ia64_mv_irq_to_vector __ia64_irq_to_vector; 7extern ia64_mv_irq_to_vector __ia64_irq_to_vector;
7extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq; 8extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq;
8extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem; 9extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem;
diff --git a/arch/ia64/include/asm/machvec_sn2.h b/arch/ia64/include/asm/machvec_sn2.h
index 781308ea7b88..f1a6e0d6dfa5 100644
--- a/arch/ia64/include/asm/machvec_sn2.h
+++ b/arch/ia64/include/asm/machvec_sn2.h
@@ -67,6 +67,7 @@ extern ia64_mv_dma_sync_single_for_device sn_dma_sync_single_for_device;
67extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device; 67extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device;
68extern ia64_mv_dma_mapping_error sn_dma_mapping_error; 68extern ia64_mv_dma_mapping_error sn_dma_mapping_error;
69extern ia64_mv_dma_supported sn_dma_supported; 69extern ia64_mv_dma_supported sn_dma_supported;
70extern ia64_mv_dma_get_required_mask sn_dma_get_required_mask;
70extern ia64_mv_migrate_t sn_migrate; 71extern ia64_mv_migrate_t sn_migrate;
71extern ia64_mv_kernel_launch_event_t sn_kernel_launch_event; 72extern ia64_mv_kernel_launch_event_t sn_kernel_launch_event;
72extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq; 73extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq;
@@ -123,6 +124,7 @@ extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
123#define platform_dma_sync_sg_for_device sn_dma_sync_sg_for_device 124#define platform_dma_sync_sg_for_device sn_dma_sync_sg_for_device
124#define platform_dma_mapping_error sn_dma_mapping_error 125#define platform_dma_mapping_error sn_dma_mapping_error
125#define platform_dma_supported sn_dma_supported 126#define platform_dma_supported sn_dma_supported
127#define platform_dma_get_required_mask sn_dma_get_required_mask
126#define platform_migrate sn_migrate 128#define platform_migrate sn_migrate
127#define platform_kernel_launch_event sn_kernel_launch_event 129#define platform_kernel_launch_event sn_kernel_launch_event
128#ifdef CONFIG_PCI_MSI 130#ifdef CONFIG_PCI_MSI
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index f791576355ad..9015979ebe0f 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -364,7 +364,7 @@ struct pt_regs;
364struct sigaction; 364struct sigaction;
365long sys_execve(char __user *filename, char __user * __user *argv, 365long sys_execve(char __user *filename, char __user * __user *argv,
366 char __user * __user *envp, struct pt_regs *regs); 366 char __user * __user *envp, struct pt_regs *regs);
367asmlinkage long sys_pipe(void); 367asmlinkage long sys_ia64_pipe(void);
368asmlinkage long sys_rt_sigaction(int sig, 368asmlinkage long sys_rt_sigaction(int sig,
369 const struct sigaction __user *act, 369 const struct sigaction __user *act,
370 struct sigaction __user *oact, 370 struct sigaction __user *oact,
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d435f4a7a96c..e5341e2c1175 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1442,7 +1442,7 @@ sys_call_table:
1442 data8 sys_mkdir // 1055 1442 data8 sys_mkdir // 1055
1443 data8 sys_rmdir 1443 data8 sys_rmdir
1444 data8 sys_dup 1444 data8 sys_dup
1445 data8 sys_pipe 1445 data8 sys_ia64_pipe
1446 data8 sys_times 1446 data8 sys_times
1447 data8 ia64_brk // 1060 1447 data8 ia64_brk // 1060
1448 data8 sys_setgid 1448 data8 sys_setgid
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index f90be51b1123..9adac441ac9b 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -870,7 +870,7 @@ static int __kprobes pre_kprobes_handler(struct die_args *args)
870 return 1; 870 return 1;
871 871
872ss_probe: 872ss_probe:
873#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PM) 873#if !defined(CONFIG_PREEMPT) || defined(CONFIG_FREEZER)
874 if (p->ainsn.inst_flag == INST_FLAG_BOOSTABLE && !p->post_handler) { 874 if (p->ainsn.inst_flag == INST_FLAG_BOOSTABLE && !p->post_handler) {
875 /* Boost up -- we can execute copied instructions directly */ 875 /* Boost up -- we can execute copied instructions directly */
876 ia64_psr(regs)->ri = p->ainsn.slot; 876 ia64_psr(regs)->ri = p->ainsn.slot;
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index bcbb6d8792d3..92ed83f34036 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -154,7 +154,7 @@ out:
154 * and r9) as this is faster than doing a copy_to_user(). 154 * and r9) as this is faster than doing a copy_to_user().
155 */ 155 */
156asmlinkage long 156asmlinkage long
157sys_pipe (void) 157sys_ia64_pipe (void)
158{ 158{
159 struct pt_regs *regs = task_pt_regs(current); 159 struct pt_regs *regs = task_pt_regs(current);
160 int fd[2]; 160 int fd[2];
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index ff0e7c10faa7..6db08599ebbc 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -59,6 +59,7 @@ dump (const char *str, void *vp, size_t len)
59 * (i.e. don't allow attacker to fill up logs with unaligned accesses). 59 * (i.e. don't allow attacker to fill up logs with unaligned accesses).
60 */ 60 */
61int no_unaligned_warning; 61int no_unaligned_warning;
62int unaligned_dump_stack;
62static int noprint_warning; 63static int noprint_warning;
63 64
64/* 65/*
@@ -1371,9 +1372,12 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1371 } 1372 }
1372 } 1373 }
1373 } else { 1374 } else {
1374 if (within_logging_rate_limit()) 1375 if (within_logging_rate_limit()) {
1375 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n", 1376 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n",
1376 ifa, regs->cr_iip + ipsr->ri); 1377 ifa, regs->cr_iip + ipsr->ri);
1378 if (unaligned_dump_stack)
1379 dump_stack();
1380 }
1377 set_fs(KERNEL_DS); 1381 set_fs(KERNEL_DS);
1378 } 1382 }
1379 1383
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 211fcfd115f9..61f1af5c23c1 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -19,6 +19,7 @@
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/bootmem.h>
22 23
23#include <asm/machvec.h> 24#include <asm/machvec.h>
24#include <asm/page.h> 25#include <asm/page.h>
@@ -748,6 +749,32 @@ static void __init set_pci_cacheline_size(void)
748 pci_cache_line_size = (1 << cci.pcci_line_size) / 4; 749 pci_cache_line_size = (1 << cci.pcci_line_size) / 4;
749} 750}
750 751
752u64 ia64_dma_get_required_mask(struct device *dev)
753{
754 u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
755 u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT));
756 u64 mask;
757
758 if (!high_totalram) {
759 /* convert to mask just covering totalram */
760 low_totalram = (1 << (fls(low_totalram) - 1));
761 low_totalram += low_totalram - 1;
762 mask = low_totalram;
763 } else {
764 high_totalram = (1 << (fls(high_totalram) - 1));
765 high_totalram += high_totalram - 1;
766 mask = (((u64)high_totalram) << 32) + 0xffffffff;
767 }
768 return mask;
769}
770EXPORT_SYMBOL_GPL(ia64_dma_get_required_mask);
771
772u64 dma_get_required_mask(struct device *dev)
773{
774 return platform_dma_get_required_mask(dev);
775}
776EXPORT_SYMBOL_GPL(dma_get_required_mask);
777
751static int __init pcibios_init(void) 778static int __init pcibios_init(void)
752{ 779{
753 set_pci_cacheline_size(); 780 set_pci_cacheline_size();
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 53ebb6484495..863f5017baae 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -356,6 +356,12 @@ int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
356} 356}
357EXPORT_SYMBOL(sn_dma_mapping_error); 357EXPORT_SYMBOL(sn_dma_mapping_error);
358 358
359u64 sn_dma_get_required_mask(struct device *dev)
360{
361 return DMA_64BIT_MASK;
362}
363EXPORT_SYMBOL_GPL(sn_dma_get_required_mask);
364
359char *sn_pci_get_legacy_mem(struct pci_bus *bus) 365char *sn_pci_get_legacy_mem(struct pci_bus *bus)
360{ 366{
361 if (!SN_PCIBUS_BUSSOFT(bus)) 367 if (!SN_PCIBUS_BUSSOFT(bus))
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index d15a94c330fb..68d6204c3f16 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -129,8 +129,8 @@ consider_steal_time(unsigned long new_itm)
129 blocked = stolentick; 129 blocked = stolentick;
130 130
131 if (stolen > 0 || blocked > 0) { 131 if (stolen > 0 || blocked > 0) {
132 account_steal_time(NULL, jiffies_to_cputime(stolen)); 132 account_steal_ticks(stolen);
133 account_steal_time(idle_task(cpu), jiffies_to_cputime(blocked)); 133 account_idle_ticks(blocked);
134 run_local_timers(); 134 run_local_timers();
135 135
136 if (rcu_pending(cpu)) 136 if (rcu_pending(cpu))
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 5b780826647c..5c332f2b9b83 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -513,7 +513,7 @@ sys_call_table:
513 .long sys_uselib 513 .long sys_uselib
514 .long sys_swapon 514 .long sys_swapon
515 .long sys_reboot 515 .long sys_reboot
516 .long old_readdir 516 .long sys_old_readdir
517 .long old_mmap /* 90 */ 517 .long old_mmap /* 90 */
518 .long sys_munmap 518 .long sys_munmap
519 .long sys_truncate 519 .long sys_truncate
diff --git a/arch/m68knommu/include/asm/Kbuild b/arch/m68knommu/include/asm/Kbuild
index 58c02a454130..c68e1680da01 100644
--- a/arch/m68knommu/include/asm/Kbuild
+++ b/arch/m68knommu/include/asm/Kbuild
@@ -1,3 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2
3unifdef-y += swab.h
diff --git a/arch/m68knommu/include/asm/byteorder.h b/arch/m68knommu/include/asm/byteorder.h
index a6f0b8f7f622..9c6c76a15041 100644
--- a/arch/m68knommu/include/asm/byteorder.h
+++ b/arch/m68knommu/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _M68KNOMMU_BYTEORDER_H 1#ifndef _M68KNOMMU_BYTEORDER_H
2#define _M68KNOMMU_BYTEORDER_H 2#define _M68KNOMMU_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _M68KNOMMU_BYTEORDER_H */ 6#endif /* _M68KNOMMU_BYTEORDER_H */
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
index 812f8d8b7a85..5c3e3f62194a 100644
--- a/arch/m68knommu/kernel/syscalltable.S
+++ b/arch/m68knommu/kernel/syscalltable.S
@@ -107,7 +107,7 @@ ENTRY(sys_call_table)
107 .long sys_uselib 107 .long sys_uselib
108 .long sys_ni_syscall /* sys_swapon */ 108 .long sys_ni_syscall /* sys_swapon */
109 .long sys_reboot 109 .long sys_reboot
110 .long old_readdir 110 .long sys_old_readdir
111 .long old_mmap /* 90 */ 111 .long old_mmap /* 90 */
112 .long sys_munmap 112 .long sys_munmap
113 .long sys_truncate 113 .long sys_truncate
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 023866c0c102..7897f05e3165 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += cachectl.h sgidefs.h sysmips.h 3header-y += cachectl.h sgidefs.h sysmips.h
4header-y += swab.h
diff --git a/arch/mips/include/asm/byteorder.h b/arch/mips/include/asm/byteorder.h
index 607b71830707..9579051ff1c7 100644
--- a/arch/mips/include/asm/byteorder.h
+++ b/arch/mips/include/asm/byteorder.h
@@ -8,8 +8,6 @@
8#ifndef _ASM_BYTEORDER_H 8#ifndef _ASM_BYTEORDER_H
9#define _ASM_BYTEORDER_H 9#define _ASM_BYTEORDER_H
10 10
11#include <asm/swab.h>
12
13#if defined(__MIPSEB__) 11#if defined(__MIPSEB__)
14#include <linux/byteorder/big_endian.h> 12#include <linux/byteorder/big_endian.h>
15#elif defined(__MIPSEL__) 13#elif defined(__MIPSEL__)
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d0916a55cd77..51d1ba415b90 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -398,7 +398,7 @@ einval: li v0, -ENOSYS
398 sys sys_uselib 1 398 sys sys_uselib 1
399 sys sys_swapon 2 399 sys sys_swapon 2
400 sys sys_reboot 3 400 sys sys_reboot 3
401 sys old_readdir 3 401 sys sys_old_readdir 3
402 sys old_mmap 6 /* 4090 */ 402 sys old_mmap 6 /* 4090 */
403 sys sys_munmap 2 403 sys sys_munmap 2
404 sys sys_truncate 2 404 sys sys_truncate 2
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 62fba8aa9b6e..ceeaaaa359e2 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -478,7 +478,7 @@ ENTRY(sys_call_table)
478 .long sys_uselib 478 .long sys_uselib
479 .long sys_swapon 479 .long sys_swapon
480 .long sys_reboot 480 .long sys_reboot
481 .long old_readdir 481 .long sys_old_readdir
482 .long old_mmap /* 90 */ 482 .long old_mmap /* 90 */
483 .long sys_munmap 483 .long sys_munmap
484 .long sys_truncate 484 .long sys_truncate
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 2121d99f8364..f88b252e419c 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += pdc.h 3unifdef-y += pdc.h
4unifdef-y += swab.h
diff --git a/arch/parisc/include/asm/byteorder.h b/arch/parisc/include/asm/byteorder.h
index da66029c4cb2..58af2c5f5d61 100644
--- a/arch/parisc/include/asm/byteorder.h
+++ b/arch/parisc/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _PARISC_BYTEORDER_H 1#ifndef _PARISC_BYTEORDER_H
2#define _PARISC_BYTEORDER_H 2#define _PARISC_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _PARISC_BYTEORDER_H */ 6#endif /* _PARISC_BYTEORDER_H */
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 84b861316ce7..e39b73bc0ff8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -123,6 +123,7 @@ config PPC
123 select HAVE_DMA_ATTRS if PPC64 123 select HAVE_DMA_ATTRS if PPC64
124 select USE_GENERIC_SMP_HELPERS if SMP 124 select USE_GENERIC_SMP_HELPERS if SMP
125 select HAVE_OPROFILE 125 select HAVE_OPROFILE
126 select HAVE_SYSCALL_WRAPPERS if PPC64
126 127
127config EARLY_PRINTK 128config EARLY_PRINTK
128 bool 129 bool
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 072c9b0f8c8e..71784165b77e 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -255,7 +255,7 @@
255 device_type = "serial"; 255 device_type = "serial";
256 compatible = "ns16550"; 256 compatible = "ns16550";
257 reg = <0x4500 0x100>; 257 reg = <0x4500 0x100>;
258 clock-frequency = <0>; 258 clock-frequency = <133333333>;
259 interrupts = <9 0x8>; 259 interrupts = <9 0x8>;
260 interrupt-parent = <&ipic>; 260 interrupt-parent = <&ipic>;
261 }; 261 };
@@ -265,7 +265,7 @@
265 device_type = "serial"; 265 device_type = "serial";
266 compatible = "ns16550"; 266 compatible = "ns16550";
267 reg = <0x4600 0x100>; 267 reg = <0x4600 0x100>;
268 clock-frequency = <0>; 268 clock-frequency = <133333333>;
269 interrupts = <10 0x8>; 269 interrupts = <10 0x8>;
270 interrupt-parent = <&ipic>; 270 interrupt-parent = <&ipic>;
271 }; 271 };
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index b9da42105066..0668d1048779 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -313,7 +313,7 @@
313 0x1000000 0x0 0x0 0xe1010000 0x0 0x10000>; 313 0x1000000 0x0 0x0 0xe1010000 0x0 0x10000>;
314 clock-frequency = <33333333>; 314 clock-frequency = <33333333>;
315 interrupt-parent = <&mpic>; 315 interrupt-parent = <&mpic>;
316 interrupts = <26 2>; 316 interrupts = <25 2>;
317 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 317 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
318 interrupt-map = < 318 interrupt-map = <
319 /* IDSEL 0x0 */ 319 /* IDSEL 0x0 */
@@ -350,7 +350,7 @@
350 0x1000000 0x0 0x0 0xe1020000 0x0 0x10000>; 350 0x1000000 0x0 0x0 0xe1020000 0x0 0x10000>;
351 clock-frequency = <33333333>; 351 clock-frequency = <33333333>;
352 interrupt-parent = <&mpic>; 352 interrupt-parent = <&mpic>;
353 interrupts = <25 2>; 353 interrupts = <26 2>;
354 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 354 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
355 interrupt-map = < 355 interrupt-map = <
356 /* IDSEL 0x0 */ 356 /* IDSEL 0x0 */
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index 21459e161d02..3dcc001b8ed3 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -724,7 +724,7 @@
724 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x00010000>; 724 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x00010000>;
725 clock-frequency = <33333333>; 725 clock-frequency = <33333333>;
726 interrupt-parent = <&mpic>; 726 interrupt-parent = <&mpic>;
727 interrupts = <26 2>; 727 interrupts = <25 2>;
728 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 728 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
729 interrupt-map = < 729 interrupt-map = <
730 /* IDSEL 0x0 */ 730 /* IDSEL 0x0 */
@@ -761,7 +761,7 @@
761 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x00010000>; 761 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x00010000>;
762 clock-frequency = <33333333>; 762 clock-frequency = <33333333>;
763 interrupt-parent = <&mpic>; 763 interrupt-parent = <&mpic>;
764 interrupts = <27 2>; 764 interrupts = <26 2>;
765 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 765 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
766 interrupt-map = < 766 interrupt-map = <
767 /* IDSEL 0x0 */ 767 /* IDSEL 0x0 */
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
index c114c4ee9931..fd462efa9e61 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
@@ -457,7 +457,7 @@
457 0x1000000 0x0 0x0 0xffc10000 0x0 0x10000>; 457 0x1000000 0x0 0x0 0xffc10000 0x0 0x10000>;
458 clock-frequency = <33333333>; 458 clock-frequency = <33333333>;
459 interrupt-parent = <&mpic>; 459 interrupt-parent = <&mpic>;
460 interrupts = <26 2>; 460 interrupts = <25 2>;
461 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 461 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
462 interrupt-map = < 462 interrupt-map = <
463 /* IDSEL 0x0 */ 463 /* IDSEL 0x0 */
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
index 04ecda18d206..e35230f2ac93 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
@@ -208,7 +208,7 @@
208 0x1000000 0x0 0x0 0xffc20000 0x0 0x10000>; 208 0x1000000 0x0 0x0 0xffc20000 0x0 0x10000>;
209 clock-frequency = <33333333>; 209 clock-frequency = <33333333>;
210 interrupt-parent = <&mpic>; 210 interrupt-parent = <&mpic>;
211 interrupts = <27 2>; 211 interrupts = <26 2>;
212 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 212 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
213 interrupt-map = < 213 interrupt-map = <
214 /* IDSEL 0x0 */ 214 /* IDSEL 0x0 */
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 069ae1bbac29..d4685d1c0be8 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -211,11 +211,28 @@ CONFIG_PPC_PASEMI=y
211CONFIG_PPC_PASEMI_IOMMU=y 211CONFIG_PPC_PASEMI_IOMMU=y
212# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set 212# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
213CONFIG_PPC_PASEMI_MDIO=y 213CONFIG_PPC_PASEMI_MDIO=y
214# CONFIG_PPC_PS3 is not set 214CONFIG_PPC_PS3=y
215
216#
217# PS3 Platform Options
218#
219# CONFIG_PS3_ADVANCED is not set
220CONFIG_PS3_HTAB_SIZE=20
221# CONFIG_PS3_DYNAMIC_DMA is not set
222CONFIG_PS3_VUART=y
223CONFIG_PS3_PS3AV=y
224CONFIG_PS3_SYS_MANAGER=y
225CONFIG_PS3_STORAGE=m
226CONFIG_PS3_DISK=m
227CONFIG_PS3_ROM=m
228CONFIG_PS3_FLASH=m
229CONFIG_PS3_LPM=m
215CONFIG_PPC_CELL=y 230CONFIG_PPC_CELL=y
231CONFIG_PPC_CELL_COMMON=y
216CONFIG_PPC_CELL_NATIVE=y 232CONFIG_PPC_CELL_NATIVE=y
217CONFIG_PPC_IBM_CELL_BLADE=y 233CONFIG_PPC_IBM_CELL_BLADE=y
218CONFIG_PPC_CELLEB=y 234CONFIG_PPC_CELLEB=y
235CONFIG_PPC_CELL_QPACE=y
219 236
220# 237#
221# Cell Broadband Engine options 238# Cell Broadband Engine options
@@ -981,6 +998,9 @@ CONFIG_E1000=y
981CONFIG_TIGON3=y 998CONFIG_TIGON3=y
982# CONFIG_BNX2 is not set 999# CONFIG_BNX2 is not set
983CONFIG_SPIDER_NET=m 1000CONFIG_SPIDER_NET=m
1001CONFIG_GELIC_NET=m
1002CONFIG_GELIC_WIRELESS=y
1003# CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE is not set
984# CONFIG_QLA3XXX is not set 1004# CONFIG_QLA3XXX is not set
985# CONFIG_ATL1 is not set 1005# CONFIG_ATL1 is not set
986# CONFIG_ATL1E is not set 1006# CONFIG_ATL1E is not set
@@ -1370,6 +1390,8 @@ CONFIG_FB_RADEON_BACKLIGHT=y
1370# CONFIG_FB_PM3 is not set 1390# CONFIG_FB_PM3 is not set
1371# CONFIG_FB_CARMINE is not set 1391# CONFIG_FB_CARMINE is not set
1372CONFIG_FB_IBM_GXT4500=y 1392CONFIG_FB_IBM_GXT4500=y
1393CONFIG_FB_PS3=m
1394CONFIG_FB_PS3_DEFAULT_SIZE_M=9
1373# CONFIG_FB_VIRTUAL is not set 1395# CONFIG_FB_VIRTUAL is not set
1374# CONFIG_FB_METRONOME is not set 1396# CONFIG_FB_METRONOME is not set
1375CONFIG_BACKLIGHT_LCD_SUPPORT=y 1397CONFIG_BACKLIGHT_LCD_SUPPORT=y
@@ -1492,6 +1514,8 @@ CONFIG_SND_PCI=y
1492CONFIG_SND_PPC=y 1514CONFIG_SND_PPC=y
1493CONFIG_SND_POWERMAC=m 1515CONFIG_SND_POWERMAC=m
1494CONFIG_SND_POWERMAC_AUTO_DRC=y 1516CONFIG_SND_POWERMAC_AUTO_DRC=y
1517CONFIG_SND_PS3=m
1518CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
1495CONFIG_SND_AOA=m 1519CONFIG_SND_AOA=m
1496CONFIG_SND_AOA_FABRIC_LAYOUT=m 1520CONFIG_SND_AOA_FABRIC_LAYOUT=m
1497CONFIG_SND_AOA_ONYX=m 1521CONFIG_SND_AOA_ONYX=m
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 9268602de5d0..5ab7d7fe198c 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -35,4 +35,3 @@ unifdef-y += spu_info.h
35unifdef-y += termios.h 35unifdef-y += termios.h
36unifdef-y += types.h 36unifdef-y += types.h
37unifdef-y += unistd.h 37unifdef-y += unistd.h
38unifdef-y += swab.h
diff --git a/arch/powerpc/include/asm/byteorder.h b/arch/powerpc/include/asm/byteorder.h
index 5cca27a41532..aa6cc4fac965 100644
--- a/arch/powerpc/include/asm/byteorder.h
+++ b/arch/powerpc/include/asm/byteorder.h
@@ -7,8 +7,6 @@
7 * as published by the Free Software Foundation; either version 7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10
11#include <asm/swab.h>
12#include <linux/byteorder/big_endian.h> 10#include <linux/byteorder/big_endian.h>
13 11
14#endif /* _ASM_POWERPC_BYTEORDER_H */ 12#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index eead5c67197a..67f1812698d2 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -103,10 +103,10 @@ struct ps3_dma_region_ops {
103 int (*map)(struct ps3_dma_region *, 103 int (*map)(struct ps3_dma_region *,
104 unsigned long virt_addr, 104 unsigned long virt_addr,
105 unsigned long len, 105 unsigned long len,
106 unsigned long *bus_addr, 106 dma_addr_t *bus_addr,
107 u64 iopte_pp); 107 u64 iopte_pp);
108 int (*unmap)(struct ps3_dma_region *, 108 int (*unmap)(struct ps3_dma_region *,
109 unsigned long bus_addr, 109 dma_addr_t bus_addr,
110 unsigned long len); 110 unsigned long len);
111}; 111};
112/** 112/**
@@ -124,9 +124,9 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev,
124int ps3_dma_region_create(struct ps3_dma_region *r); 124int ps3_dma_region_create(struct ps3_dma_region *r);
125int ps3_dma_region_free(struct ps3_dma_region *r); 125int ps3_dma_region_free(struct ps3_dma_region *r);
126int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, 126int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
127 unsigned long len, unsigned long *bus_addr, 127 unsigned long len, dma_addr_t *bus_addr,
128 u64 iopte_pp); 128 u64 iopte_pp);
129int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, 129int ps3_dma_unmap(struct ps3_dma_region *r, dma_addr_t bus_addr,
130 unsigned long len); 130 unsigned long len);
131 131
132/* mmio routines */ 132/* mmio routines */
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index a0a15311d0d8..2701753d9937 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -624,7 +624,7 @@ struct ucc_slow_pram {
624#define UCC_GETH_UCCE_RXF1 0x00000002 624#define UCC_GETH_UCCE_RXF1 0x00000002
625#define UCC_GETH_UCCE_RXF0 0x00000001 625#define UCC_GETH_UCCE_RXF0 0x00000001
626 626
627/* UPSMR, when used as a UART */ 627/* UCC Protocol Specific Mode Register (UPSMR), when used for UART */
628#define UCC_UART_UPSMR_FLC 0x8000 628#define UCC_UART_UPSMR_FLC 0x8000
629#define UCC_UART_UPSMR_SL 0x4000 629#define UCC_UART_UPSMR_SL 0x4000
630#define UCC_UART_UPSMR_CL_MASK 0x3000 630#define UCC_UART_UPSMR_CL_MASK 0x3000
@@ -652,6 +652,23 @@ struct ucc_slow_pram {
652#define UCC_UART_UPSMR_TPM_EVEN 0x0002 652#define UCC_UART_UPSMR_TPM_EVEN 0x0002
653#define UCC_UART_UPSMR_TPM_HIGH 0x0003 653#define UCC_UART_UPSMR_TPM_HIGH 0x0003
654 654
655/* UCC Protocol Specific Mode Register (UPSMR), when used for Ethernet */
656#define UCC_GETH_UPSMR_FTFE 0x80000000
657#define UCC_GETH_UPSMR_PTPE 0x40000000
658#define UCC_GETH_UPSMR_ECM 0x04000000
659#define UCC_GETH_UPSMR_HSE 0x02000000
660#define UCC_GETH_UPSMR_PRO 0x00400000
661#define UCC_GETH_UPSMR_CAP 0x00200000
662#define UCC_GETH_UPSMR_RSH 0x00100000
663#define UCC_GETH_UPSMR_RPM 0x00080000
664#define UCC_GETH_UPSMR_R10M 0x00040000
665#define UCC_GETH_UPSMR_RLPB 0x00020000
666#define UCC_GETH_UPSMR_TBIM 0x00010000
667#define UCC_GETH_UPSMR_RES1 0x00002000
668#define UCC_GETH_UPSMR_RMM 0x00001000
669#define UCC_GETH_UPSMR_CAM 0x00000400
670#define UCC_GETH_UPSMR_BRO 0x00000200
671
655/* UCC Transmit On Demand Register (UTODR) */ 672/* UCC Transmit On Demand Register (UTODR) */
656#define UCC_SLOW_TOD 0x8000 673#define UCC_SLOW_TOD 0x8000
657#define UCC_FAST_TOD 0x8000 674#define UCC_FAST_TOD 0x8000
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index e0175beb4462..0aa0315fb7e8 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20#define RTAS_UNKNOWN_SERVICE (-1) 20#define RTAS_UNKNOWN_SERVICE (-1)
21#define RTAS_INSTANTIATE_MAX (1UL<<30) /* Don't instantiate rtas at/above this value */ 21#define RTAS_INSTANTIATE_MAX (1ULL<<30) /* Don't instantiate rtas at/above this value */
22 22
23/* Buffer size for ppc_rtas system call. */ 23/* Buffer size for ppc_rtas system call. */
24#define RTAS_RMOBUF_MAX (64 * 1024) 24#define RTAS_RMOBUF_MAX (64 * 1024)
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index da300c4d2888..4c8095f6bec0 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -92,7 +92,7 @@ COMPAT_SYS_SPU(readlink)
92SYSCALL(uselib) 92SYSCALL(uselib)
93SYSCALL(swapon) 93SYSCALL(swapon)
94SYSCALL(reboot) 94SYSCALL(reboot)
95SYSX(sys_ni_syscall,compat_sys_old_readdir,old_readdir) 95SYSX(sys_ni_syscall,compat_sys_old_readdir,sys_old_readdir)
96SYSCALL_SPU(mmap) 96SYSCALL_SPU(mmap)
97SYSCALL_SPU(munmap) 97SYSCALL_SPU(munmap)
98SYSCALL_SPU(truncate) 98SYSCALL_SPU(truncate)
diff --git a/arch/powerpc/include/asm/types.h b/arch/powerpc/include/asm/types.h
index c004c13f291e..7ce27a52bb34 100644
--- a/arch/powerpc/include/asm/types.h
+++ b/arch/powerpc/include/asm/types.h
@@ -1,7 +1,12 @@
1#ifndef _ASM_POWERPC_TYPES_H 1#ifndef _ASM_POWERPC_TYPES_H
2#define _ASM_POWERPC_TYPES_H 2#define _ASM_POWERPC_TYPES_H
3 3
4#ifdef __powerpc64__ 4/*
5 * This is here because we used to use l64 for 64bit powerpc
6 * and we don't want to impact user mode with our change to ll64
7 * in the kernel.
8 */
9#if defined(__powerpc64__) && !defined(__KERNEL__)
5# include <asm-generic/int-l64.h> 10# include <asm-generic/int-l64.h>
6#else 11#else
7# include <asm-generic/int-ll64.h> 12# include <asm-generic/int-ll64.h>
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index ce3f8f12f731..3734973f7394 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -56,6 +56,10 @@
56#include "head_booke.h" 56#include "head_booke.h"
57#endif 57#endif
58 58
59#if defined(CONFIG_FSL_BOOKE)
60#include "../mm/mmu_decl.h"
61#endif
62
59int main(void) 63int main(void)
60{ 64{
61 DEFINE(THREAD, offsetof(struct task_struct, thread)); 65 DEFINE(THREAD, offsetof(struct task_struct, thread));
@@ -383,6 +387,9 @@ int main(void)
383 DEFINE(PGD_T_LOG2, PGD_T_LOG2); 387 DEFINE(PGD_T_LOG2, PGD_T_LOG2);
384 DEFINE(PTE_T_LOG2, PTE_T_LOG2); 388 DEFINE(PTE_T_LOG2, PTE_T_LOG2);
385#endif 389#endif
390#ifdef CONFIG_FSL_BOOKE
391 DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam));
392#endif
386 393
387#ifdef CONFIG_KVM_EXIT_TIMING 394#ifdef CONFIG_KVM_EXIT_TIMING
388 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu, 395 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu,
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index b33f0417a4bf..bb37b1d19a58 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -113,7 +113,7 @@ struct cache {
113 struct cache *next_local; /* next cache of >= level */ 113 struct cache *next_local; /* next cache of >= level */
114}; 114};
115 115
116static DEFINE_PER_CPU(struct cache_dir *, cache_dir); 116static DEFINE_PER_CPU(struct cache_dir *, cache_dir_pcpu);
117 117
118/* traversal/modification of this list occurs only at cpu hotplug time; 118/* traversal/modification of this list occurs only at cpu hotplug time;
119 * access is serialized by cpu hotplug locking 119 * access is serialized by cpu hotplug locking
@@ -468,9 +468,9 @@ static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_i
468 468
469 cache_dir->kobj = kobj; 469 cache_dir->kobj = kobj;
470 470
471 WARN_ON_ONCE(per_cpu(cache_dir, cpu_id) != NULL); 471 WARN_ON_ONCE(per_cpu(cache_dir_pcpu, cpu_id) != NULL);
472 472
473 per_cpu(cache_dir, cpu_id) = cache_dir; 473 per_cpu(cache_dir_pcpu, cpu_id) = cache_dir;
474 474
475 return cache_dir; 475 return cache_dir;
476err: 476err:
@@ -820,13 +820,13 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)
820 820
821 /* Prevent userspace from seeing inconsistent state - remove 821 /* Prevent userspace from seeing inconsistent state - remove
822 * the sysfs hierarchy first */ 822 * the sysfs hierarchy first */
823 cache_dir = per_cpu(cache_dir, cpu_id); 823 cache_dir = per_cpu(cache_dir_pcpu, cpu_id);
824 824
825 /* careful, sysfs population may have failed */ 825 /* careful, sysfs population may have failed */
826 if (cache_dir) 826 if (cache_dir)
827 remove_cache_dir(cache_dir); 827 remove_cache_dir(cache_dir);
828 828
829 per_cpu(cache_dir, cpu_id) = NULL; 829 per_cpu(cache_dir_pcpu, cpu_id) = NULL;
830 830
831 /* clear the CPU's bit in its cache chain, possibly freeing 831 /* clear the CPU's bit in its cache chain, possibly freeing
832 * cache objects */ 832 * cache objects */
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 14183af1b3fb..2983adac8cc3 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -79,10 +79,10 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
79 "Warning: IOMMU offset too big for device mask\n"); 79 "Warning: IOMMU offset too big for device mask\n");
80 if (tbl) 80 if (tbl)
81 printk(KERN_INFO 81 printk(KERN_INFO
82 "mask: 0x%08lx, table offset: 0x%08lx\n", 82 "mask: 0x%08llx, table offset: 0x%08lx\n",
83 mask, tbl->it_offset); 83 mask, tbl->it_offset);
84 else 84 else
85 printk(KERN_INFO "mask: 0x%08lx, table unavailable\n", 85 printk(KERN_INFO "mask: 0x%08llx, table unavailable\n",
86 mask); 86 mask);
87 return 0; 87 return 0;
88 } else 88 } else
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index b4bcf5a930fa..ebaedafc8e67 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1518,6 +1518,15 @@ _GLOBAL(pmac_secondary_start)
1518 /* turn on 64-bit mode */ 1518 /* turn on 64-bit mode */
1519 bl .enable_64b_mode 1519 bl .enable_64b_mode
1520 1520
1521 li r0,0
1522 mfspr r3,SPRN_HID4
1523 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
1524 sync
1525 mtspr SPRN_HID4,r3
1526 isync
1527 sync
1528 slbia
1529
1521 /* get TOC pointer (real address) */ 1530 /* get TOC pointer (real address) */
1522 bl .relative_toc 1531 bl .relative_toc
1523 1532
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 11b549acc034..36ffb3504a4f 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -389,10 +389,6 @@ skpinv: addi r6,r6,1 /* Increment */
389#endif 389#endif
390#endif 390#endif
391 391
392 mfspr r3,SPRN_TLB1CFG
393 andi. r3,r3,0xfff
394 lis r4,num_tlbcam_entries@ha
395 stw r3,num_tlbcam_entries@l(r4)
396/* 392/*
397 * Decide what sort of machine this is and initialize the MMU. 393 * Decide what sort of machine this is and initialize the MMU.
398 */ 394 */
@@ -711,7 +707,7 @@ interrupt_base:
711 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD) 707 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD)
712 708
713#ifdef CONFIG_PPC_E500MC 709#ifdef CONFIG_PPC_E500MC
714 EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_EE) 710 EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_STD)
715#endif 711#endif
716 712
717 /* Debug Interrupt */ 713 /* Debug Interrupt */
@@ -909,7 +905,7 @@ KernelSPE:
909_GLOBAL(loadcam_entry) 905_GLOBAL(loadcam_entry)
910 lis r4,TLBCAM@ha 906 lis r4,TLBCAM@ha
911 addi r4,r4,TLBCAM@l 907 addi r4,r4,TLBCAM@l
912 mulli r5,r3,20 908 mulli r5,r3,TLBCAM_SIZE
913 add r3,r5,r4 909 add r3,r5,r4
914 lwz r4,0(r3) 910 lwz r4,0(r3)
915 mtspr SPRN_MAS0,r4 911 mtspr SPRN_MAS0,r4
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 1bfa706b96e7..fd51578e29dd 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -239,12 +239,12 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
239 if (printk_ratelimit()) { 239 if (printk_ratelimit()) {
240 printk(KERN_INFO "iommu_free: invalid entry\n"); 240 printk(KERN_INFO "iommu_free: invalid entry\n");
241 printk(KERN_INFO "\tentry = 0x%lx\n", entry); 241 printk(KERN_INFO "\tentry = 0x%lx\n", entry);
242 printk(KERN_INFO "\tdma_addr = 0x%lx\n", (u64)dma_addr); 242 printk(KERN_INFO "\tdma_addr = 0x%llx\n", (u64)dma_addr);
243 printk(KERN_INFO "\tTable = 0x%lx\n", (u64)tbl); 243 printk(KERN_INFO "\tTable = 0x%llx\n", (u64)tbl);
244 printk(KERN_INFO "\tbus# = 0x%lx\n", (u64)tbl->it_busno); 244 printk(KERN_INFO "\tbus# = 0x%llx\n", (u64)tbl->it_busno);
245 printk(KERN_INFO "\tsize = 0x%lx\n", (u64)tbl->it_size); 245 printk(KERN_INFO "\tsize = 0x%llx\n", (u64)tbl->it_size);
246 printk(KERN_INFO "\tstartOff = 0x%lx\n", (u64)tbl->it_offset); 246 printk(KERN_INFO "\tstartOff = 0x%llx\n", (u64)tbl->it_offset);
247 printk(KERN_INFO "\tindex = 0x%lx\n", (u64)tbl->it_index); 247 printk(KERN_INFO "\tindex = 0x%llx\n", (u64)tbl->it_index);
248 WARN_ON(1); 248 WARN_ON(1);
249 } 249 }
250 return; 250 return;
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index d051e8cbcd03..182e0f642f36 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -240,7 +240,7 @@ static void parse_ppp_data(struct seq_file *m)
240 if (rc) 240 if (rc)
241 return; 241 return;
242 242
243 seq_printf(m, "partition_entitled_capacity=%ld\n", 243 seq_printf(m, "partition_entitled_capacity=%lld\n",
244 ppp_data.entitlement); 244 ppp_data.entitlement);
245 seq_printf(m, "group=%d\n", ppp_data.group_num); 245 seq_printf(m, "group=%d\n", ppp_data.group_num);
246 seq_printf(m, "system_active_processors=%d\n", 246 seq_printf(m, "system_active_processors=%d\n",
@@ -265,7 +265,7 @@ static void parse_ppp_data(struct seq_file *m)
265 ppp_data.unallocated_weight); 265 ppp_data.unallocated_weight);
266 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight); 266 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight);
267 seq_printf(m, "capped=%d\n", ppp_data.capped); 267 seq_printf(m, "capped=%d\n", ppp_data.capped);
268 seq_printf(m, "unallocated_capacity=%ld\n", 268 seq_printf(m, "unallocated_capacity=%lld\n",
269 ppp_data.unallocated_entitlement); 269 ppp_data.unallocated_entitlement);
270} 270}
271 271
@@ -509,10 +509,10 @@ static ssize_t update_ppp(u64 *entitlement, u8 *weight)
509 } else 509 } else
510 return -EINVAL; 510 return -EINVAL;
511 511
512 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 512 pr_debug("%s: current_entitled = %llu, current_weight = %u\n",
513 __func__, ppp_data.entitlement, ppp_data.weight); 513 __func__, ppp_data.entitlement, ppp_data.weight);
514 514
515 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 515 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
516 __func__, new_entitled, new_weight); 516 __func__, new_entitled, new_weight);
517 517
518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight); 518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
@@ -558,7 +558,7 @@ static ssize_t update_mpp(u64 *entitlement, u8 *weight)
558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight); 559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight);
560 560
561 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 561 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
562 __func__, new_entitled, new_weight); 562 __func__, new_entitled, new_weight);
563 563
564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight); 564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index b3abebb7ee64..d59e2b1bdcba 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -93,10 +93,35 @@ void __init reserve_crashkernel(void)
93 KDUMP_KERNELBASE); 93 KDUMP_KERNELBASE);
94 94
95 crashk_res.start = KDUMP_KERNELBASE; 95 crashk_res.start = KDUMP_KERNELBASE;
96#else
97 if (!crashk_res.start) {
98 /*
99 * unspecified address, choose a region of specified size
100 * can overlap with initrd (ignoring corruption when retained)
101 * ppc64 requires kernel and some stacks to be in first segemnt
102 */
103 crashk_res.start = KDUMP_KERNELBASE;
104 }
105
106 crash_base = PAGE_ALIGN(crashk_res.start);
107 if (crash_base != crashk_res.start) {
108 printk("Crash kernel base must be aligned to 0x%lx\n",
109 PAGE_SIZE);
110 crashk_res.start = crash_base;
111 }
112
96#endif 113#endif
97 crash_size = PAGE_ALIGN(crash_size); 114 crash_size = PAGE_ALIGN(crash_size);
98 crashk_res.end = crashk_res.start + crash_size - 1; 115 crashk_res.end = crashk_res.start + crash_size - 1;
99 116
117 /* The crash region must not overlap the current kernel */
118 if (overlaps_crashkernel(__pa(_stext), _end - _stext)) {
119 printk(KERN_WARNING
120 "Crash kernel can not overlap current kernel\n");
121 crashk_res.start = crashk_res.end = 0;
122 return;
123 }
124
100 /* Crash kernel trumps memory limit */ 125 /* Crash kernel trumps memory limit */
101 if (memory_limit && memory_limit <= crashk_res.end) { 126 if (memory_limit && memory_limit <= crashk_res.end) {
102 memory_limit = crashk_res.end + 1; 127 memory_limit = crashk_res.end + 1;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 586962f65c2a..ea8eda8c87cf 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -470,7 +470,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
470 if (bus->self) { 470 if (bus->self) {
471 pr_debug("IO mapping for PCI-PCI bridge %s\n", 471 pr_debug("IO mapping for PCI-PCI bridge %s\n",
472 pci_name(bus->self)); 472 pci_name(bus->self));
473 pr_debug(" virt=0x%016lx...0x%016lx\n", 473 pr_debug(" virt=0x%016llx...0x%016llx\n",
474 bus->resource[0]->start + _IO_BASE, 474 bus->resource[0]->start + _IO_BASE,
475 bus->resource[0]->end + _IO_BASE); 475 bus->resource[0]->end + _IO_BASE);
476 return 0; 476 return 0;
@@ -502,7 +502,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
502 hose->io_base_phys - phys_page); 502 hose->io_base_phys - phys_page);
503 503
504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name); 504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name);
505 pr_debug(" phys=0x%016lx, virt=0x%p (alloc=0x%p)\n", 505 pr_debug(" phys=0x%016llx, virt=0x%p (alloc=0x%p)\n",
506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc); 506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n", 507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n",
508 hose->pci_io_size, size_page); 508 hose->pci_io_size, size_page);
@@ -517,7 +517,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
517 hose->io_resource.start += io_virt_offset; 517 hose->io_resource.start += io_virt_offset;
518 hose->io_resource.end += io_virt_offset; 518 hose->io_resource.end += io_virt_offset;
519 519
520 pr_debug(" hose->io_resource=0x%016lx...0x%016lx\n", 520 pr_debug(" hose->io_resource=0x%016llx...0x%016llx\n",
521 hose->io_resource.start, hose->io_resource.end); 521 hose->io_resource.start, hose->io_resource.end);
522 522
523 return 0; 523 return 0;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c09cffafb6ee..f00f83109ab3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -590,6 +590,11 @@ static void __init check_cpu_slb_size(unsigned long node)
590{ 590{
591 u32 *slb_size_ptr; 591 u32 *slb_size_ptr;
592 592
593 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
594 if (slb_size_ptr != NULL) {
595 mmu_slb_size = *slb_size_ptr;
596 return;
597 }
593 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL); 598 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
594 if (slb_size_ptr != NULL) { 599 if (slb_size_ptr != NULL) {
595 mmu_slb_size = *slb_size_ptr; 600 mmu_slb_size = *slb_size_ptr;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d8bd2161e738..2d34196bba8c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -434,8 +434,8 @@ void __init setup_system(void)
434 printk("Starting Linux PPC64 %s\n", init_utsname()->version); 434 printk("Starting Linux PPC64 %s\n", init_utsname()->version);
435 435
436 printk("-----------------------------------------------------\n"); 436 printk("-----------------------------------------------------\n");
437 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 437 printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size);
438 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); 438 printk("physicalMemorySize = 0x%llx\n", lmb_phys_mem_size());
439 if (ppc64_caches.dline_size != 0x80) 439 if (ppc64_caches.dline_size != 0x80)
440 printk("ppc64_caches.dcache_line_size = 0x%x\n", 440 printk("ppc64_caches.dcache_line_size = 0x%x\n",
441 ppc64_caches.dline_size); 441 ppc64_caches.dline_size);
@@ -493,7 +493,7 @@ static void __init emergency_stack_init(void)
493 * bringup, we need to get at them in real mode. This means they 493 * bringup, we need to get at them in real mode. This means they
494 * must also be within the RMO region. 494 * must also be within the RMO region.
495 */ 495 */
496 limit = min(0x10000000UL, lmb.rmo_size); 496 limit = min(0x10000000ULL, lmb.rmo_size);
497 497
498 for_each_possible_cpu(i) { 498 for_each_possible_cpu(i) {
499 unsigned long sp; 499 unsigned long sp;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 04e8ecea9b40..295ccc5e86b1 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -87,7 +87,9 @@ SECTIONS
87 /* The dummy segment contents for the bug workaround mentioned above 87 /* The dummy segment contents for the bug workaround mentioned above
88 near PHDRS. */ 88 near PHDRS. */
89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { 89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) {
90 LONG(0xf177) 90 LONG(0)
91 LONG(0)
92 LONG(0)
91 } :kernel :dummy 93 } :kernel :dummy
92 94
93/* 95/*
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 23cee39534fd..1971e4ee3d6e 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -56,18 +56,11 @@
56 56
57extern void loadcam_entry(unsigned int index); 57extern void loadcam_entry(unsigned int index);
58unsigned int tlbcam_index; 58unsigned int tlbcam_index;
59unsigned int num_tlbcam_entries;
60static unsigned long __cam0, __cam1, __cam2; 59static unsigned long __cam0, __cam1, __cam2;
61 60
62#define NUM_TLBCAMS (16) 61#define NUM_TLBCAMS (16)
63 62
64struct tlbcam { 63struct tlbcam TLBCAM[NUM_TLBCAMS];
65 u32 MAS0;
66 u32 MAS1;
67 u32 MAS2;
68 u32 MAS3;
69 u32 MAS7;
70} TLBCAM[NUM_TLBCAMS];
71 64
72struct tlbcamrange { 65struct tlbcamrange {
73 unsigned long start; 66 unsigned long start;
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index ad123bced404..d1f9c62dc177 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -75,6 +75,15 @@ extern void _tlbia(void);
75#endif /* CONFIG_PPC_MMU_NOHASH */ 75#endif /* CONFIG_PPC_MMU_NOHASH */
76 76
77#ifdef CONFIG_PPC32 77#ifdef CONFIG_PPC32
78
79struct tlbcam {
80 u32 MAS0;
81 u32 MAS1;
82 u32 MAS2;
83 u32 MAS3;
84 u32 MAS7;
85};
86
78extern void mapin_ram(void); 87extern void mapin_ram(void);
79extern int map_page(unsigned long va, phys_addr_t pa, int flags); 88extern int map_page(unsigned long va, phys_addr_t pa, int flags);
80extern void setbat(int index, unsigned long virt, phys_addr_t phys, 89extern void setbat(int index, unsigned long virt, phys_addr_t phys,
@@ -90,8 +99,6 @@ extern unsigned int rtas_data, rtas_size;
90struct hash_pte; 99struct hash_pte;
91extern struct hash_pte *Hash, *Hash_end; 100extern struct hash_pte *Hash, *Hash_end;
92extern unsigned long Hash_size, Hash_mask; 101extern unsigned long Hash_size, Hash_mask;
93
94extern unsigned int num_tlbcam_entries;
95#endif 102#endif
96 103
97extern unsigned long ioremap_bot; 104extern unsigned long ioremap_bot;
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index db44e02e045b..ba5194817f8a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -710,9 +710,18 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
710 unsigned long len) 710 unsigned long len)
711{ 711{
712 struct slice_mask mask, available; 712 struct slice_mask mask, available;
713 unsigned int psize = mm->context.user_psize;
713 714
714 mask = slice_range_to_mask(addr, len); 715 mask = slice_range_to_mask(addr, len);
715 available = slice_mask_for_size(mm, mm->context.user_psize); 716 available = slice_mask_for_size(mm, psize);
717#ifdef CONFIG_PPC_64K_PAGES
718 /* We need to account for 4k slices too */
719 if (psize == MMU_PAGE_64K) {
720 struct slice_mask compat_mask;
721 compat_mask = slice_mask_for_size(mm, MMU_PAGE_4K);
722 or_mask(available, compat_mask);
723 }
724#endif
716 725
717#if 0 /* too verbose */ 726#if 0 /* too verbose */
718 slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n", 727 slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n",
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 60e6032a8088..98cd1dc2ae75 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -251,8 +251,8 @@ void __init stabs_alloc(void)
251 251
252 paca[cpu].stab_addr = newstab; 252 paca[cpu].stab_addr = newstab;
253 paca[cpu].stab_real = virt_to_abs(newstab); 253 paca[cpu].stab_real = virt_to_abs(newstab);
254 printk(KERN_INFO "Segment table for CPU %d at 0x%lx " 254 printk(KERN_INFO "Segment table for CPU %d at 0x%llx "
255 "virtual, 0x%lx absolute\n", 255 "virtual, 0x%llx absolute\n",
256 cpu, paca[cpu].stab_addr, paca[cpu].stab_real); 256 cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
257 } 257 }
258} 258}
diff --git a/arch/powerpc/oprofile/op_model_pa6t.c b/arch/powerpc/oprofile/op_model_pa6t.c
index c40de461fd4e..42f778dff919 100644
--- a/arch/powerpc/oprofile/op_model_pa6t.c
+++ b/arch/powerpc/oprofile/op_model_pa6t.c
@@ -132,7 +132,7 @@ static int pa6t_reg_setup(struct op_counter_config *ctr,
132 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) { 132 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) {
133 /* counters are 40 bit. Move to cputable at some point? */ 133 /* counters are 40 bit. Move to cputable at some point? */
134 reset_value[pmc] = (0x1UL << 39) - ctr[pmc].count; 134 reset_value[pmc] = (0x1UL << 39) - ctr[pmc].count;
135 pr_debug("reset_value for pmc%u inited to 0x%lx\n", 135 pr_debug("reset_value for pmc%u inited to 0x%llx\n",
136 pmc, reset_value[pmc]); 136 pmc, reset_value[pmc]);
137 } 137 }
138 138
@@ -177,7 +177,7 @@ static int pa6t_start(struct op_counter_config *ctr)
177 177
178 oprofile_running = 1; 178 oprofile_running = 1;
179 179
180 pr_debug("start on cpu %d, mmcr0 %lx\n", smp_processor_id(), mmcr0); 180 pr_debug("start on cpu %d, mmcr0 %llx\n", smp_processor_id(), mmcr0);
181 181
182 return 0; 182 return 0;
183} 183}
@@ -193,7 +193,7 @@ static void pa6t_stop(void)
193 193
194 oprofile_running = 0; 194 oprofile_running = 0;
195 195
196 pr_debug("stop on cpu %d, mmcr0 %lx\n", smp_processor_id(), mmcr0); 196 pr_debug("stop on cpu %d, mmcr0 %llx\n", smp_processor_id(), mmcr0);
197} 197}
198 198
199/* handle the perfmon overflow vector */ 199/* handle the perfmon overflow vector */
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index f416014ee727..1bcff94eb924 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -56,12 +56,12 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
56 int dev_match = 0; 56 int dev_match = 0;
57 int id_match = 0; 57 int id_match = 0;
58 58
59 if (dev == NULL && id == NULL) 59 if (dev == NULL || id == NULL)
60 return NULL; 60 return NULL;
61 61
62 mutex_lock(&clocks_mutex); 62 mutex_lock(&clocks_mutex);
63 list_for_each_entry(p, &clocks, node) { 63 list_for_each_entry(p, &clocks, node) {
64 if (dev && dev == p->dev) 64 if (dev == p->dev)
65 dev_match++; 65 dev_match++;
66 if (strcmp(id, p->name) == 0) 66 if (strcmp(id, p->name) == 0)
67 id_match++; 67 id_match++;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 8a455ebce98d..07f89ae46d04 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -363,11 +363,8 @@ static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio)
363{ 363{
364 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 364 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
365 struct mpc52xx_gpt __iomem *regs = mm_gc->regs; 365 struct mpc52xx_gpt __iomem *regs = mm_gc->regs;
366 unsigned int ret;
367 366
368 return (in_be32(&regs->status) & (1 << (31 - 23))) ? 1 : 0; 367 return (in_be32(&regs->status) & (1 << (31 - 23))) ? 1 : 0;
369
370 return ret;
371} 368}
372 369
373static void 370static void
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 72865e8e4b51..0a093f03c758 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -196,6 +196,7 @@ static void mpc52xx_extirq_ack(unsigned int virq)
196 196
197static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type) 197static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
198{ 198{
199 struct irq_desc *desc = get_irq_desc(virq);
199 u32 ctrl_reg, type; 200 u32 ctrl_reg, type;
200 int irq; 201 int irq;
201 int l2irq; 202 int l2irq;
@@ -222,6 +223,11 @@ static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
222 type = 0; 223 type = 0;
223 } 224 }
224 225
226 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
227 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
228 if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
229 desc->status |= IRQ_LEVEL;
230
225 ctrl_reg = in_be32(&intr->ctrl); 231 ctrl_reg = in_be32(&intr->ctrl);
226 ctrl_reg &= ~(0x3 << (22 - (l2irq * 2))); 232 ctrl_reg &= ~(0x3 << (22 - (l2irq * 2)));
227 ctrl_reg |= (type << (22 - (l2irq * 2))); 233 ctrl_reg |= (type << (22 - (l2irq * 2)));
@@ -231,7 +237,7 @@ static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
231} 237}
232 238
233static struct irq_chip mpc52xx_extirq_irqchip = { 239static struct irq_chip mpc52xx_extirq_irqchip = {
234 .typename = " MPC52xx IRQ[0-3] ", 240 .typename = "MPC52xx External",
235 .mask = mpc52xx_extirq_mask, 241 .mask = mpc52xx_extirq_mask,
236 .unmask = mpc52xx_extirq_unmask, 242 .unmask = mpc52xx_extirq_unmask,
237 .ack = mpc52xx_extirq_ack, 243 .ack = mpc52xx_extirq_ack,
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index ba5028e29890..051777c542c7 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -3,6 +3,7 @@
3# 3#
4obj-y := misc.o usb.o 4obj-y := misc.o usb.o
5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o 5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o
6obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
6obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o 7obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o
7obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o 8obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
8obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o 9obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
diff --git a/drivers/i2c/chips/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 82a9bcb858b6..82a9bcb858b6 100644
--- a/drivers/i2c/chips/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 47fe2bea9865..200b9cb900ea 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -323,4 +323,15 @@ config SIMPLE_GPIO
323 chip-selects, Ethernet/USB PHY's power and various other small 323 chip-selects, Ethernet/USB PHY's power and various other small
324 on-board peripherals. 324 on-board peripherals.
325 325
326config MCU_MPC8349EMITX
327 tristate "MPC8349E-mITX MCU driver"
328 depends on I2C && PPC_83xx
329 select GENERIC_GPIO
330 select ARCH_REQUIRE_GPIOLIB
331 help
332 Say Y here to enable soft power-off functionality on the Freescale
333 boards with the MPC8349E-mITX-compatible MCU chips. This driver will
334 also register MCU GPIOs with the generic GPIO API, so you'll able
335 to use MCU pins as GPIOs.
336
326endmenu 337endmenu
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c
index 192a93509372..72254848a228 100644
--- a/arch/powerpc/platforms/cell/beat_interrupt.c
+++ b/arch/powerpc/platforms/cell/beat_interrupt.c
@@ -99,7 +99,7 @@ static void beatic_end_irq(unsigned int irq_plug)
99 err = beat_downcount_of_interrupt(irq_plug); 99 err = beat_downcount_of_interrupt(irq_plug);
100 if (err != 0) { 100 if (err != 0) {
101 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */ 101 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */
102 panic("Failed to downcount IRQ! Error = %16lx", err); 102 panic("Failed to downcount IRQ! Error = %16llx", err);
103 103
104 printk(KERN_ERR "IRQ over-downcounted, plug %d\n", irq_plug); 104 printk(KERN_ERR "IRQ over-downcounted, plug %d\n", irq_plug);
105 } 105 }
diff --git a/arch/powerpc/platforms/cell/celleb_scc_epci.c b/arch/powerpc/platforms/cell/celleb_scc_epci.c
index 08c285b10e30..48ec88a38a12 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_epci.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_epci.c
@@ -405,7 +405,7 @@ static int __init celleb_setup_epci(struct device_node *node,
405 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); 405 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1));
406 if (!hose->cfg_addr) 406 if (!hose->cfg_addr)
407 goto error; 407 goto error;
408 pr_debug("EPCI: cfg_addr map 0x%016lx->0x%016lx + 0x%016lx\n", 408 pr_debug("EPCI: cfg_addr map 0x%016llx->0x%016lx + 0x%016llx\n",
409 r.start, (unsigned long)hose->cfg_addr, (r.end - r.start + 1)); 409 r.start, (unsigned long)hose->cfg_addr, (r.end - r.start + 1));
410 410
411 if (of_address_to_resource(node, 2, &r)) 411 if (of_address_to_resource(node, 2, &r))
@@ -413,7 +413,7 @@ static int __init celleb_setup_epci(struct device_node *node,
413 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1)); 413 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1));
414 if (!hose->cfg_data) 414 if (!hose->cfg_data)
415 goto error; 415 goto error;
416 pr_debug("EPCI: cfg_data map 0x%016lx->0x%016lx + 0x%016lx\n", 416 pr_debug("EPCI: cfg_data map 0x%016llx->0x%016lx + 0x%016llx\n",
417 r.start, (unsigned long)hose->cfg_data, (r.end - r.start + 1)); 417 r.start, (unsigned long)hose->cfg_data, (r.end - r.start + 1));
418 418
419 hose->ops = &celleb_epci_ops; 419 hose->ops = &celleb_epci_ops;
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 88d94b59a7cb..ee5033eddf01 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -855,7 +855,7 @@ static int __init cell_iommu_init_disabled(void)
855 */ 855 */
856 if (np && size < lmb_end_of_DRAM()) { 856 if (np && size < lmb_end_of_DRAM()) {
857 printk(KERN_WARNING "iommu: force-enabled, dma window" 857 printk(KERN_WARNING "iommu: force-enabled, dma window"
858 " (%ldMB) smaller than total memory (%ldMB)\n", 858 " (%ldMB) smaller than total memory (%lldMB)\n",
859 size >> 20, lmb_end_of_DRAM() >> 20); 859 size >> 20, lmb_end_of_DRAM() >> 20);
860 return -ENODEV; 860 return -ENODEV;
861 } 861 }
@@ -985,7 +985,7 @@ static void cell_dma_dev_setup_fixed(struct device *dev)
985 addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base; 985 addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base;
986 archdata->dma_data = (void *)addr; 986 archdata->dma_data = (void *)addr;
987 987
988 dev_dbg(dev, "iommu: fixed addr = %lx\n", addr); 988 dev_dbg(dev, "iommu: fixed addr = %llx\n", addr);
989} 989}
990 990
991static void insert_16M_pte(unsigned long addr, unsigned long *ptab, 991static void insert_16M_pte(unsigned long addr, unsigned long *ptab,
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 7b4cefa2199b..5f961c464cc4 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -38,16 +38,16 @@ static void dump_fir(int cpu)
38 /* Todo: do some nicer parsing of bits and based on them go down 38 /* Todo: do some nicer parsing of bits and based on them go down
39 * to other sub-units FIRs and not only IIC 39 * to other sub-units FIRs and not only IIC
40 */ 40 */
41 printk(KERN_ERR "Global Checkstop FIR : 0x%016lx\n", 41 printk(KERN_ERR "Global Checkstop FIR : 0x%016llx\n",
42 in_be64(&pregs->checkstop_fir)); 42 in_be64(&pregs->checkstop_fir));
43 printk(KERN_ERR "Global Recoverable FIR : 0x%016lx\n", 43 printk(KERN_ERR "Global Recoverable FIR : 0x%016llx\n",
44 in_be64(&pregs->checkstop_fir)); 44 in_be64(&pregs->checkstop_fir));
45 printk(KERN_ERR "Global MachineCheck FIR : 0x%016lx\n", 45 printk(KERN_ERR "Global MachineCheck FIR : 0x%016llx\n",
46 in_be64(&pregs->spec_att_mchk_fir)); 46 in_be64(&pregs->spec_att_mchk_fir));
47 47
48 if (iregs == NULL) 48 if (iregs == NULL)
49 return; 49 return;
50 printk(KERN_ERR "IOC FIR : 0x%016lx\n", 50 printk(KERN_ERR "IOC FIR : 0x%016llx\n",
51 in_be64(&iregs->ioc_fir)); 51 in_be64(&iregs->ioc_fir));
52 52
53} 53}
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index a5bdb89a17c3..e487ad68ac11 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -151,7 +151,7 @@ static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb)
151{ 151{
152 struct spu_priv2 __iomem *priv2 = spu->priv2; 152 struct spu_priv2 __iomem *priv2 = spu->priv2;
153 153
154 pr_debug("%s: adding SLB[%d] 0x%016lx 0x%016lx\n", 154 pr_debug("%s: adding SLB[%d] 0x%016llx 0x%016llx\n",
155 __func__, slbe, slb->vsid, slb->esid); 155 __func__, slbe, slb->vsid, slb->esid);
156 156
157 out_be64(&priv2->slb_index_W, slbe); 157 out_be64(&priv2->slb_index_W, slbe);
@@ -221,7 +221,7 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
221{ 221{
222 int ret; 222 int ret;
223 223
224 pr_debug("%s, %lx, %lx\n", __func__, dsisr, ea); 224 pr_debug("%s, %llx, %lx\n", __func__, dsisr, ea);
225 225
226 /* 226 /*
227 * Handle kernel space hash faults immediately. User hash 227 * Handle kernel space hash faults immediately. User hash
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
index 19f6bfdbb933..fec1495e6b12 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -54,7 +54,7 @@ long spu_sys_callback(struct spu_syscall_block *s)
54 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); 54 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
55 55
56 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { 56 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
57 pr_debug("%s: invalid syscall #%ld", __func__, s->nr_ret); 57 pr_debug("%s: invalid syscall #%lld", __func__, s->nr_ret);
58 return -ENOSYS; 58 return -ENOSYS;
59 } 59 }
60 60
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index af116aadba10..c4d4a19235e0 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -42,7 +42,7 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
42 return spufs_coredump_read[num].read(ctx, buffer, size, off); 42 return spufs_coredump_read[num].read(ctx, buffer, size, off);
43 43
44 data = spufs_coredump_read[num].get(ctx); 44 data = spufs_coredump_read[num].get(ctx);
45 ret = snprintf(buffer, size, "0x%.16lx", data); 45 ret = snprintf(buffer, size, "0x%.16llx", data);
46 if (ret >= size) 46 if (ret >= size)
47 return size; 47 return size;
48 return ++ret; /* count trailing NULL */ 48 return ++ret; /* count trailing NULL */
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index f093a581ac74..a4dd3ae7223a 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -132,7 +132,7 @@ int spufs_handle_class1(struct spu_context *ctx)
132 132
133 spuctx_switch_state(ctx, SPU_UTIL_IOWAIT); 133 spuctx_switch_state(ctx, SPU_UTIL_IOWAIT);
134 134
135 pr_debug("ctx %p: ea %016lx, dsisr %016lx state %d\n", ctx, ea, 135 pr_debug("ctx %p: ea %016llx, dsisr %016llx state %d\n", ctx, ea,
136 dsisr, ctx->state); 136 dsisr, ctx->state);
137 137
138 ctx->stats.hash_flt++; 138 ctx->stats.hash_flt++;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 7106b63d401b..0da7f2bf5ee1 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1654,7 +1654,7 @@ out:
1654 1654
1655static int spufs_check_valid_dma(struct mfc_dma_command *cmd) 1655static int spufs_check_valid_dma(struct mfc_dma_command *cmd)
1656{ 1656{
1657 pr_debug("queueing DMA %x %lx %x %x %x\n", cmd->lsa, 1657 pr_debug("queueing DMA %x %llx %x %x %x\n", cmd->lsa,
1658 cmd->ea, cmd->size, cmd->tag, cmd->cmd); 1658 cmd->ea, cmd->size, cmd->tag, cmd->cmd);
1659 1659
1660 switch (cmd->cmd) { 1660 switch (cmd->cmd) {
@@ -1671,7 +1671,7 @@ static int spufs_check_valid_dma(struct mfc_dma_command *cmd)
1671 } 1671 }
1672 1672
1673 if ((cmd->lsa & 0xf) != (cmd->ea &0xf)) { 1673 if ((cmd->lsa & 0xf) != (cmd->ea &0xf)) {
1674 pr_debug("invalid DMA alignment, ea %lx lsa %x\n", 1674 pr_debug("invalid DMA alignment, ea %llx lsa %x\n",
1675 cmd->ea, cmd->lsa); 1675 cmd->ea, cmd->lsa);
1676 return -EIO; 1676 return -EIO;
1677 } 1677 }
@@ -2633,7 +2633,7 @@ static int spufs_show_ctx(struct seq_file *s, void *private)
2633 } 2633 }
2634 2634
2635 seq_printf(s, "%c flgs(%lx) sflgs(%lx) pri(%d) ts(%d) spu(%02d)" 2635 seq_printf(s, "%c flgs(%lx) sflgs(%lx) pri(%d) ts(%d) spu(%02d)"
2636 " %c %lx %lx %lx %lx %x %x\n", 2636 " %c %llx %llx %llx %llx %x %x\n",
2637 ctx->state == SPU_STATE_SAVED ? 'S' : 'R', 2637 ctx->state == SPU_STATE_SAVED ? 'S' : 'R',
2638 ctx->flags, 2638 ctx->flags,
2639 ctx->sched_flags, 2639 ctx->sched_flags,
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 8c619963becc..1db6b9e037fc 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -249,6 +249,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
249DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229); 249DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
250DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249); 250DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
251DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575); 251DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
252DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
252 253
253static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev) 254static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev)
254{ 255{
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index bbe828f1b885..6ed75bffc8ab 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -66,7 +66,7 @@ static int tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
66 66
67 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce); 67 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce);
68 if (rc) 68 if (rc)
69 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n", 69 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%llx\n",
70 rc); 70 rc);
71 index++; 71 index++;
72 uaddr += TCE_PAGE_SIZE; 72 uaddr += TCE_PAGE_SIZE;
@@ -81,7 +81,7 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages)
81 while (npages--) { 81 while (npages--) {
82 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 0); 82 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 0);
83 if (rc) 83 if (rc)
84 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n", 84 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%llx\n",
85 rc); 85 rc);
86 index++; 86 index++;
87 } 87 }
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 6b0711c15eca..bd8817b00fa4 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -53,7 +53,7 @@
53#include <asm/pmac_low_i2c.h> 53#include <asm/pmac_low_i2c.h>
54#include <asm/pmac_pfunc.h> 54#include <asm/pmac_pfunc.h>
55 55
56#define DEBUG 56#undef DEBUG
57 57
58#ifdef DEBUG 58#ifdef DEBUG
59#define DBG(fmt...) udbg_printf(fmt) 59#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index ca71a12b764c..bb028f165fb3 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -82,7 +82,7 @@ static int __init ps3_register_lpm_devices(void)
82 goto fail_rights; 82 goto fail_rights;
83 } 83 }
84 84
85 pr_debug("%s:%d: pu_id %lu, rights %lu(%lxh)\n", 85 pr_debug("%s:%d: pu_id %llu, rights %llu(%llxh)\n",
86 __func__, __LINE__, dev->lpm.pu_id, dev->lpm.rights, 86 __func__, __LINE__, dev->lpm.pu_id, dev->lpm.rights,
87 dev->lpm.rights); 87 dev->lpm.rights);
88 88
@@ -348,7 +348,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
348 return -ENODEV; 348 return -ENODEV;
349 } 349 }
350 350
351 pr_debug("%s:%u: (%u:%u:%u): port %lu blk_size %lu num_blocks %lu " 351 pr_debug("%s:%u: (%u:%u:%u): port %llu blk_size %llu num_blocks %llu "
352 "num_regions %u\n", __func__, __LINE__, repo->bus_index, 352 "num_regions %u\n", __func__, __LINE__, repo->bus_index,
353 repo->dev_index, repo->dev_type, port, blk_size, num_blocks, 353 repo->dev_index, repo->dev_type, port, blk_size, num_blocks,
354 num_regions); 354 num_regions);
@@ -394,7 +394,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
394 result = -ENODEV; 394 result = -ENODEV;
395 goto fail_read_region; 395 goto fail_read_region;
396 } 396 }
397 pr_debug("%s:%u: region %u: id %u start %lu size %lu\n", 397 pr_debug("%s:%u: region %u: id %u start %llu size %llu\n",
398 __func__, __LINE__, i, id, start, size); 398 __func__, __LINE__, i, id, start, size);
399 399
400 p->regions[i].id = id; 400 p->regions[i].id = id;
@@ -662,13 +662,13 @@ static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
662 if (rem) 662 if (rem)
663 break; 663 break;
664 } 664 }
665 pr_warning("%s:%u: device %lu:%lu not found\n", __func__, __LINE__, 665 pr_warning("%s:%u: device %llu:%llu not found\n", __func__, __LINE__,
666 bus_id, dev_id); 666 bus_id, dev_id);
667 return; 667 return;
668 668
669found: 669found:
670 if (retries) 670 if (retries)
671 pr_debug("%s:%u: device %lu:%lu found after %u retries\n", 671 pr_debug("%s:%u: device %llu:%llu found after %u retries\n",
672 __func__, __LINE__, bus_id, dev_id, retries); 672 __func__, __LINE__, bus_id, dev_id, retries);
673 673
674 ps3_setup_dynamic_device(&repo); 674 ps3_setup_dynamic_device(&repo);
@@ -715,14 +715,14 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data)
715 res = lv1_storage_get_async_status(PS3_NOTIFICATION_DEV_ID, &tag, 715 res = lv1_storage_get_async_status(PS3_NOTIFICATION_DEV_ID, &tag,
716 &status); 716 &status);
717 if (tag != dev->tag) 717 if (tag != dev->tag)
718 pr_err("%s:%u: tag mismatch, got %lx, expected %lx\n", 718 pr_err("%s:%u: tag mismatch, got %llx, expected %llx\n",
719 __func__, __LINE__, tag, dev->tag); 719 __func__, __LINE__, tag, dev->tag);
720 720
721 if (res) { 721 if (res) {
722 pr_err("%s:%u: res %d status 0x%lx\n", __func__, __LINE__, res, 722 pr_err("%s:%u: res %d status 0x%llx\n", __func__, __LINE__, res,
723 status); 723 status);
724 } else { 724 } else {
725 pr_debug("%s:%u: completed, status 0x%lx\n", __func__, 725 pr_debug("%s:%u: completed, status 0x%llx\n", __func__,
726 __LINE__, status); 726 __LINE__, status);
727 dev->lv1_status = status; 727 dev->lv1_status = status;
728 complete(&dev->done); 728 complete(&dev->done);
@@ -761,7 +761,7 @@ static int ps3_notification_read_write(struct ps3_notification_device *dev,
761 } 761 }
762 762
763 if (dev->lv1_status) { 763 if (dev->lv1_status) {
764 pr_err("%s:%u: %s not completed, status 0x%lx\n", __func__, 764 pr_err("%s:%u: %s not completed, status 0x%llx\n", __func__,
765 __LINE__, op, dev->lv1_status); 765 __LINE__, op, dev->lv1_status);
766 return -EIO; 766 return -EIO;
767 } 767 }
@@ -850,16 +850,16 @@ static int ps3_probe_thread(void *data)
850 if (res) 850 if (res)
851 break; 851 break;
852 852
853 pr_debug("%s:%u: notify event type 0x%lx bus id %lu dev id %lu" 853 pr_debug("%s:%u: notify event type 0x%llx bus id %llu dev id %llu"
854 " type %lu port %lu\n", __func__, __LINE__, 854 " type %llu port %llu\n", __func__, __LINE__,
855 notify_event->event_type, notify_event->bus_id, 855 notify_event->event_type, notify_event->bus_id,
856 notify_event->dev_id, notify_event->dev_type, 856 notify_event->dev_id, notify_event->dev_type,
857 notify_event->dev_port); 857 notify_event->dev_port);
858 858
859 if (notify_event->event_type != notify_region_probe || 859 if (notify_event->event_type != notify_region_probe ||
860 notify_event->bus_id != dev.sbd.bus_id) { 860 notify_event->bus_id != dev.sbd.bus_id) {
861 pr_warning("%s:%u: bad notify_event: event %lu, " 861 pr_warning("%s:%u: bad notify_event: event %llu, "
862 "dev_id %lu, dev_type %lu\n", 862 "dev_id %llu, dev_type %llu\n",
863 __func__, __LINE__, notify_event->event_type, 863 __func__, __LINE__, notify_event->event_type,
864 notify_event->dev_id, 864 notify_event->dev_id,
865 notify_event->dev_type); 865 notify_event->dev_type);
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 6eb1d4d182c9..1e8a1e39dfe8 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -75,7 +75,7 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va,
75 75
76 if (result) { 76 if (result) {
77 /* all entries bolted !*/ 77 /* all entries bolted !*/
78 pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%lx r=%lx\n", 78 pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%llx r=%llx\n",
79 __func__, result, va, pa, hpte_group, hpte_v, hpte_r); 79 __func__, result, va, pa, hpte_group, hpte_v, hpte_r);
80 BUG(); 80 BUG();
81 } 81 }
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index e59634f7af96..8ec5ccf76b19 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -60,6 +60,8 @@
60 * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note 60 * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note
61 * that there is no constraint on how many in this set an individual thread 61 * that there is no constraint on how many in this set an individual thread
62 * can acquire. 62 * can acquire.
63 *
64 * The mask is declared as unsigned long so we can use set/clear_bit on it.
63 */ 65 */
64 66
65#define PS3_BMP_MINALIGN 64 67#define PS3_BMP_MINALIGN 64
@@ -68,7 +70,7 @@ struct ps3_bmp {
68 struct { 70 struct {
69 u64 status; 71 u64 status;
70 u64 unused_1[3]; 72 u64 unused_1[3];
71 u64 mask; 73 unsigned long mask;
72 u64 unused_2[3]; 74 u64 unused_2[3];
73 }; 75 };
74 u64 ipi_debug_brk_mask; 76 u64 ipi_debug_brk_mask;
@@ -102,7 +104,7 @@ static void ps3_chip_mask(unsigned int virq)
102 struct ps3_private *pd = get_irq_chip_data(virq); 104 struct ps3_private *pd = get_irq_chip_data(virq);
103 unsigned long flags; 105 unsigned long flags;
104 106
105 pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__, 107 pr_debug("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__,
106 pd->thread_id, virq); 108 pd->thread_id, virq);
107 109
108 local_irq_save(flags); 110 local_irq_save(flags);
@@ -123,7 +125,7 @@ static void ps3_chip_unmask(unsigned int virq)
123 struct ps3_private *pd = get_irq_chip_data(virq); 125 struct ps3_private *pd = get_irq_chip_data(virq);
124 unsigned long flags; 126 unsigned long flags;
125 127
126 pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__, 128 pr_debug("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__,
127 pd->thread_id, virq); 129 pd->thread_id, virq);
128 130
129 local_irq_save(flags); 131 local_irq_save(flags);
@@ -221,7 +223,7 @@ static int ps3_virq_destroy(unsigned int virq)
221{ 223{
222 const struct ps3_private *pd = get_irq_chip_data(virq); 224 const struct ps3_private *pd = get_irq_chip_data(virq);
223 225
224 pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__, 226 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__,
225 __LINE__, pd->ppe_id, pd->thread_id, virq); 227 __LINE__, pd->ppe_id, pd->thread_id, virq);
226 228
227 set_irq_chip_data(virq, NULL); 229 set_irq_chip_data(virq, NULL);
@@ -291,7 +293,7 @@ int ps3_irq_plug_destroy(unsigned int virq)
291 int result; 293 int result;
292 const struct ps3_private *pd = get_irq_chip_data(virq); 294 const struct ps3_private *pd = get_irq_chip_data(virq);
293 295
294 pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__, 296 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__,
295 __LINE__, pd->ppe_id, pd->thread_id, virq); 297 __LINE__, pd->ppe_id, pd->thread_id, virq);
296 298
297 ps3_chip_mask(virq); 299 ps3_chip_mask(virq);
@@ -322,7 +324,7 @@ EXPORT_SYMBOL_GPL(ps3_irq_plug_destroy);
322int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq) 324int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq)
323{ 325{
324 int result; 326 int result;
325 unsigned long outlet; 327 u64 outlet;
326 328
327 result = lv1_construct_event_receive_port(&outlet); 329 result = lv1_construct_event_receive_port(&outlet);
328 330
@@ -468,7 +470,7 @@ int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
468 unsigned int *virq) 470 unsigned int *virq)
469{ 471{
470 int result; 472 int result;
471 unsigned long outlet; 473 u64 outlet;
472 474
473 result = lv1_construct_io_irq_outlet(interrupt_id, &outlet); 475 result = lv1_construct_io_irq_outlet(interrupt_id, &outlet);
474 476
@@ -525,7 +527,7 @@ int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
525 unsigned int *virq) 527 unsigned int *virq)
526{ 528{
527 int result; 529 int result;
528 unsigned long outlet; 530 u64 outlet;
529 u64 lpar_addr; 531 u64 lpar_addr;
530 532
531 BUG_ON(!is_kernel_addr((u64)virt_addr_bmp)); 533 BUG_ON(!is_kernel_addr((u64)virt_addr_bmp));
@@ -581,7 +583,7 @@ int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id,
581 unsigned int class, unsigned int *virq) 583 unsigned int class, unsigned int *virq)
582{ 584{
583 int result; 585 int result;
584 unsigned long outlet; 586 u64 outlet;
585 587
586 BUG_ON(class > 2); 588 BUG_ON(class > 2);
587 589
@@ -691,7 +693,7 @@ void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
691 693
692 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq; 694 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq;
693 695
694 pr_debug("%s:%d: cpu %u, virq %u, mask %lxh\n", __func__, __LINE__, 696 pr_debug("%s:%d: cpu %u, virq %u, mask %llxh\n", __func__, __LINE__,
695 cpu, virq, pd->bmp.ipi_debug_brk_mask); 697 cpu, virq, pd->bmp.ipi_debug_brk_mask);
696} 698}
697 699
@@ -710,7 +712,7 @@ static unsigned int ps3_get_irq(void)
710 plug &= 0x3f; 712 plug &= 0x3f;
711 713
712 if (unlikely(plug == NO_IRQ)) { 714 if (unlikely(plug == NO_IRQ)) {
713 pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__, 715 pr_debug("%s:%d: no plug found: thread_id %llu\n", __func__,
714 __LINE__, pd->thread_id); 716 __LINE__, pd->thread_id);
715 dump_bmp(&per_cpu(ps3_private, 0)); 717 dump_bmp(&per_cpu(ps3_private, 0));
716 dump_bmp(&per_cpu(ps3_private, 1)); 718 dump_bmp(&per_cpu(ps3_private, 1));
@@ -745,7 +747,7 @@ void __init ps3_init_IRQ(void)
745 pd->thread_id = get_hard_smp_processor_id(cpu); 747 pd->thread_id = get_hard_smp_processor_id(cpu);
746 spin_lock_init(&pd->bmp.lock); 748 spin_lock_init(&pd->bmp.lock);
747 749
748 pr_debug("%s:%d: ppe_id %lu, thread_id %lu, bmp %lxh\n", 750 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, bmp %lxh\n",
749 __func__, __LINE__, pd->ppe_id, pd->thread_id, 751 __func__, __LINE__, pd->ppe_id, pd->thread_id,
750 ps3_mm_phys_to_lpar(__pa(&pd->bmp))); 752 ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
751 753
@@ -770,6 +772,6 @@ void ps3_shutdown_IRQ(int cpu)
770 lv1_get_logical_ppe_id(&ppe_id); 772 lv1_get_logical_ppe_id(&ppe_id);
771 result = lv1_configure_irq_state_bitmap(ppe_id, thread_id, 0); 773 result = lv1_configure_irq_state_bitmap(ppe_id, thread_id, 0);
772 774
773 DBG("%s:%d: lv1_configure_irq_state_bitmap (%lu:%lu/%d) %s\n", __func__, 775 DBG("%s:%d: lv1_configure_irq_state_bitmap (%llu:%llu/%d) %s\n", __func__,
774 __LINE__, ppe_id, thread_id, cpu, ps3_result(result)); 776 __LINE__, ppe_id, thread_id, cpu, ps3_result(result));
775} 777}
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index a4d49dd9e8a9..67de6bf3db3d 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -79,8 +79,8 @@ enum {
79 */ 79 */
80 80
81struct mem_region { 81struct mem_region {
82 unsigned long base; 82 u64 base;
83 unsigned long size; 83 u64 size;
84 unsigned long offset; 84 unsigned long offset;
85}; 85};
86 86
@@ -103,9 +103,9 @@ struct mem_region {
103 */ 103 */
104 104
105struct map { 105struct map {
106 unsigned long total; 106 u64 total;
107 unsigned long vas_id; 107 u64 vas_id;
108 unsigned long htab_size; 108 u64 htab_size;
109 struct mem_region rm; 109 struct mem_region rm;
110 struct mem_region r1; 110 struct mem_region r1;
111}; 111};
@@ -114,13 +114,13 @@ struct map {
114static void __maybe_unused _debug_dump_map(const struct map *m, 114static void __maybe_unused _debug_dump_map(const struct map *m,
115 const char *func, int line) 115 const char *func, int line)
116{ 116{
117 DBG("%s:%d: map.total = %lxh\n", func, line, m->total); 117 DBG("%s:%d: map.total = %llxh\n", func, line, m->total);
118 DBG("%s:%d: map.rm.size = %lxh\n", func, line, m->rm.size); 118 DBG("%s:%d: map.rm.size = %llxh\n", func, line, m->rm.size);
119 DBG("%s:%d: map.vas_id = %lu\n", func, line, m->vas_id); 119 DBG("%s:%d: map.vas_id = %llu\n", func, line, m->vas_id);
120 DBG("%s:%d: map.htab_size = %lxh\n", func, line, m->htab_size); 120 DBG("%s:%d: map.htab_size = %llxh\n", func, line, m->htab_size);
121 DBG("%s:%d: map.r1.base = %lxh\n", func, line, m->r1.base); 121 DBG("%s:%d: map.r1.base = %llxh\n", func, line, m->r1.base);
122 DBG("%s:%d: map.r1.offset = %lxh\n", func, line, m->r1.offset); 122 DBG("%s:%d: map.r1.offset = %lxh\n", func, line, m->r1.offset);
123 DBG("%s:%d: map.r1.size = %lxh\n", func, line, m->r1.size); 123 DBG("%s:%d: map.r1.size = %llxh\n", func, line, m->r1.size);
124} 124}
125 125
126static struct map map; 126static struct map map;
@@ -146,11 +146,11 @@ EXPORT_SYMBOL(ps3_mm_phys_to_lpar);
146void __init ps3_mm_vas_create(unsigned long* htab_size) 146void __init ps3_mm_vas_create(unsigned long* htab_size)
147{ 147{
148 int result; 148 int result;
149 unsigned long start_address; 149 u64 start_address;
150 unsigned long size; 150 u64 size;
151 unsigned long access_right; 151 u64 access_right;
152 unsigned long max_page_size; 152 u64 max_page_size;
153 unsigned long flags; 153 u64 flags;
154 154
155 result = lv1_query_logical_partition_address_region_info(0, 155 result = lv1_query_logical_partition_address_region_info(0,
156 &start_address, &size, &access_right, &max_page_size, 156 &start_address, &size, &access_right, &max_page_size,
@@ -164,7 +164,7 @@ void __init ps3_mm_vas_create(unsigned long* htab_size)
164 } 164 }
165 165
166 if (max_page_size < PAGE_SHIFT_16M) { 166 if (max_page_size < PAGE_SHIFT_16M) {
167 DBG("%s:%d: bad max_page_size %lxh\n", __func__, __LINE__, 167 DBG("%s:%d: bad max_page_size %llxh\n", __func__, __LINE__,
168 max_page_size); 168 max_page_size);
169 goto fail; 169 goto fail;
170 } 170 }
@@ -208,7 +208,7 @@ void ps3_mm_vas_destroy(void)
208{ 208{
209 int result; 209 int result;
210 210
211 DBG("%s:%d: map.vas_id = %lu\n", __func__, __LINE__, map.vas_id); 211 DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id);
212 212
213 if (map.vas_id) { 213 if (map.vas_id) {
214 result = lv1_select_virtual_address_space(0); 214 result = lv1_select_virtual_address_space(0);
@@ -235,15 +235,14 @@ void ps3_mm_vas_destroy(void)
235static int ps3_mm_region_create(struct mem_region *r, unsigned long size) 235static int ps3_mm_region_create(struct mem_region *r, unsigned long size)
236{ 236{
237 int result; 237 int result;
238 unsigned long muid; 238 u64 muid;
239 239
240 r->size = _ALIGN_DOWN(size, 1 << PAGE_SHIFT_16M); 240 r->size = _ALIGN_DOWN(size, 1 << PAGE_SHIFT_16M);
241 241
242 DBG("%s:%d requested %lxh\n", __func__, __LINE__, size); 242 DBG("%s:%d requested %lxh\n", __func__, __LINE__, size);
243 DBG("%s:%d actual %lxh\n", __func__, __LINE__, r->size); 243 DBG("%s:%d actual %llxh\n", __func__, __LINE__, r->size);
244 DBG("%s:%d difference %lxh (%luMB)\n", __func__, __LINE__, 244 DBG("%s:%d difference %llxh (%lluMB)\n", __func__, __LINE__,
245 (unsigned long)(size - r->size), 245 size - r->size, (size - r->size) / 1024 / 1024);
246 (size - r->size) / 1024 / 1024);
247 246
248 if (r->size == 0) { 247 if (r->size == 0) {
249 DBG("%s:%d: size == 0\n", __func__, __LINE__); 248 DBG("%s:%d: size == 0\n", __func__, __LINE__);
@@ -277,7 +276,7 @@ static void ps3_mm_region_destroy(struct mem_region *r)
277{ 276{
278 int result; 277 int result;
279 278
280 DBG("%s:%d: r->base = %lxh\n", __func__, __LINE__, r->base); 279 DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base);
281 if (r->base) { 280 if (r->base) {
282 result = lv1_release_memory(r->base); 281 result = lv1_release_memory(r->base);
283 BUG_ON(result); 282 BUG_ON(result);
@@ -355,7 +354,7 @@ static unsigned long dma_sb_lpar_to_bus(struct ps3_dma_region *r,
355static void __maybe_unused _dma_dump_region(const struct ps3_dma_region *r, 354static void __maybe_unused _dma_dump_region(const struct ps3_dma_region *r,
356 const char *func, int line) 355 const char *func, int line)
357{ 356{
358 DBG("%s:%d: dev %lu:%lu\n", func, line, r->dev->bus_id, 357 DBG("%s:%d: dev %llu:%llu\n", func, line, r->dev->bus_id,
359 r->dev->dev_id); 358 r->dev->dev_id);
360 DBG("%s:%d: page_size %u\n", func, line, r->page_size); 359 DBG("%s:%d: page_size %u\n", func, line, r->page_size);
361 DBG("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr); 360 DBG("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr);
@@ -390,7 +389,7 @@ struct dma_chunk {
390static void _dma_dump_chunk (const struct dma_chunk* c, const char* func, 389static void _dma_dump_chunk (const struct dma_chunk* c, const char* func,
391 int line) 390 int line)
392{ 391{
393 DBG("%s:%d: r.dev %lu:%lu\n", func, line, 392 DBG("%s:%d: r.dev %llu:%llu\n", func, line,
394 c->region->dev->bus_id, c->region->dev->dev_id); 393 c->region->dev->bus_id, c->region->dev->dev_id);
395 DBG("%s:%d: r.bus_addr %lxh\n", func, line, c->region->bus_addr); 394 DBG("%s:%d: r.bus_addr %lxh\n", func, line, c->region->bus_addr);
396 DBG("%s:%d: r.page_size %u\n", func, line, c->region->page_size); 395 DBG("%s:%d: r.page_size %u\n", func, line, c->region->page_size);
@@ -596,7 +595,7 @@ static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr,
596 595
597 /* build ioptes for the area */ 596 /* build ioptes for the area */
598 pages = len >> r->page_size; 597 pages = len >> r->page_size;
599 DBG("%s: pgsize=%#x len=%#lx pages=%#x iopteflag=%#lx\n", __func__, 598 DBG("%s: pgsize=%#x len=%#lx pages=%#x iopteflag=%#llx\n", __func__,
600 r->page_size, r->len, pages, iopte_flag); 599 r->page_size, r->len, pages, iopte_flag);
601 for (iopage = 0; iopage < pages; iopage++) { 600 for (iopage = 0; iopage < pages; iopage++) {
602 offset = (1 << r->page_size) * iopage; 601 offset = (1 << r->page_size) * iopage;
@@ -648,13 +647,14 @@ fail_alloc:
648static int dma_sb_region_create(struct ps3_dma_region *r) 647static int dma_sb_region_create(struct ps3_dma_region *r)
649{ 648{
650 int result; 649 int result;
650 u64 bus_addr;
651 651
652 DBG(" -> %s:%d:\n", __func__, __LINE__); 652 DBG(" -> %s:%d:\n", __func__, __LINE__);
653 653
654 BUG_ON(!r); 654 BUG_ON(!r);
655 655
656 if (!r->dev->bus_id) { 656 if (!r->dev->bus_id) {
657 pr_info("%s:%d: %lu:%lu no dma\n", __func__, __LINE__, 657 pr_info("%s:%d: %llu:%llu no dma\n", __func__, __LINE__,
658 r->dev->bus_id, r->dev->dev_id); 658 r->dev->bus_id, r->dev->dev_id);
659 return 0; 659 return 0;
660 } 660 }
@@ -671,7 +671,8 @@ static int dma_sb_region_create(struct ps3_dma_region *r)
671 671
672 result = lv1_allocate_device_dma_region(r->dev->bus_id, r->dev->dev_id, 672 result = lv1_allocate_device_dma_region(r->dev->bus_id, r->dev->dev_id,
673 roundup_pow_of_two(r->len), r->page_size, r->region_type, 673 roundup_pow_of_two(r->len), r->page_size, r->region_type,
674 &r->bus_addr); 674 &bus_addr);
675 r->bus_addr = bus_addr;
675 676
676 if (result) { 677 if (result) {
677 DBG("%s:%d: lv1_allocate_device_dma_region failed: %s\n", 678 DBG("%s:%d: lv1_allocate_device_dma_region failed: %s\n",
@@ -685,6 +686,7 @@ static int dma_sb_region_create(struct ps3_dma_region *r)
685static int dma_ioc0_region_create(struct ps3_dma_region *r) 686static int dma_ioc0_region_create(struct ps3_dma_region *r)
686{ 687{
687 int result; 688 int result;
689 u64 bus_addr;
688 690
689 INIT_LIST_HEAD(&r->chunk_list.head); 691 INIT_LIST_HEAD(&r->chunk_list.head);
690 spin_lock_init(&r->chunk_list.lock); 692 spin_lock_init(&r->chunk_list.lock);
@@ -692,7 +694,8 @@ static int dma_ioc0_region_create(struct ps3_dma_region *r)
692 result = lv1_allocate_io_segment(0, 694 result = lv1_allocate_io_segment(0,
693 r->len, 695 r->len,
694 r->page_size, 696 r->page_size,
695 &r->bus_addr); 697 &bus_addr);
698 r->bus_addr = bus_addr;
696 if (result) { 699 if (result) {
697 DBG("%s:%d: lv1_allocate_io_segment failed: %s\n", 700 DBG("%s:%d: lv1_allocate_io_segment failed: %s\n",
698 __func__, __LINE__, ps3_result(result)); 701 __func__, __LINE__, ps3_result(result));
@@ -720,7 +723,7 @@ static int dma_sb_region_free(struct ps3_dma_region *r)
720 BUG_ON(!r); 723 BUG_ON(!r);
721 724
722 if (!r->dev->bus_id) { 725 if (!r->dev->bus_id) {
723 pr_info("%s:%d: %lu:%lu no dma\n", __func__, __LINE__, 726 pr_info("%s:%d: %llu:%llu no dma\n", __func__, __LINE__,
724 r->dev->bus_id, r->dev->dev_id); 727 r->dev->bus_id, r->dev->dev_id);
725 return 0; 728 return 0;
726 } 729 }
@@ -777,7 +780,7 @@ static int dma_ioc0_region_free(struct ps3_dma_region *r)
777 */ 780 */
778 781
779static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr, 782static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
780 unsigned long len, unsigned long *bus_addr, 783 unsigned long len, dma_addr_t *bus_addr,
781 u64 iopte_flag) 784 u64 iopte_flag)
782{ 785{
783 int result; 786 int result;
@@ -800,7 +803,7 @@ static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
800 DBG("%s:%d lpar_addr %lxh\n", __func__, __LINE__, 803 DBG("%s:%d lpar_addr %lxh\n", __func__, __LINE__,
801 lpar_addr); 804 lpar_addr);
802 DBG("%s:%d len %lxh\n", __func__, __LINE__, len); 805 DBG("%s:%d len %lxh\n", __func__, __LINE__, len);
803 DBG("%s:%d bus_addr %lxh (%lxh)\n", __func__, __LINE__, 806 DBG("%s:%d bus_addr %llxh (%lxh)\n", __func__, __LINE__,
804 *bus_addr, len); 807 *bus_addr, len);
805 } 808 }
806 809
@@ -832,7 +835,7 @@ static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
832} 835}
833 836
834static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr, 837static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
835 unsigned long len, unsigned long *bus_addr, 838 unsigned long len, dma_addr_t *bus_addr,
836 u64 iopte_flag) 839 u64 iopte_flag)
837{ 840{
838 int result; 841 int result;
@@ -872,7 +875,7 @@ static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
872 return result; 875 return result;
873 } 876 }
874 *bus_addr = c->bus_addr + phys_addr - aligned_phys; 877 *bus_addr = c->bus_addr + phys_addr - aligned_phys;
875 DBG("%s: va=%#lx pa=%#lx a_pa=%#lx bus=%#lx\n", __func__, 878 DBG("%s: va=%#lx pa=%#lx a_pa=%#lx bus=%#llx\n", __func__,
876 virt_addr, phys_addr, aligned_phys, *bus_addr); 879 virt_addr, phys_addr, aligned_phys, *bus_addr);
877 c->usage_count = 1; 880 c->usage_count = 1;
878 881
@@ -889,7 +892,7 @@ static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
889 * This is the common dma unmap routine. 892 * This is the common dma unmap routine.
890 */ 893 */
891 894
892static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr, 895static int dma_sb_unmap_area(struct ps3_dma_region *r, dma_addr_t bus_addr,
893 unsigned long len) 896 unsigned long len)
894{ 897{
895 unsigned long flags; 898 unsigned long flags;
@@ -903,7 +906,7 @@ static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr,
903 1 << r->page_size); 906 1 << r->page_size);
904 unsigned long aligned_len = _ALIGN_UP(len + bus_addr 907 unsigned long aligned_len = _ALIGN_UP(len + bus_addr
905 - aligned_bus, 1 << r->page_size); 908 - aligned_bus, 1 << r->page_size);
906 DBG("%s:%d: not found: bus_addr %lxh\n", 909 DBG("%s:%d: not found: bus_addr %llxh\n",
907 __func__, __LINE__, bus_addr); 910 __func__, __LINE__, bus_addr);
908 DBG("%s:%d: not found: len %lxh\n", 911 DBG("%s:%d: not found: len %lxh\n",
909 __func__, __LINE__, len); 912 __func__, __LINE__, len);
@@ -926,12 +929,12 @@ static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr,
926} 929}
927 930
928static int dma_ioc0_unmap_area(struct ps3_dma_region *r, 931static int dma_ioc0_unmap_area(struct ps3_dma_region *r,
929 unsigned long bus_addr, unsigned long len) 932 dma_addr_t bus_addr, unsigned long len)
930{ 933{
931 unsigned long flags; 934 unsigned long flags;
932 struct dma_chunk *c; 935 struct dma_chunk *c;
933 936
934 DBG("%s: start a=%#lx l=%#lx\n", __func__, bus_addr, len); 937 DBG("%s: start a=%#llx l=%#lx\n", __func__, bus_addr, len);
935 spin_lock_irqsave(&r->chunk_list.lock, flags); 938 spin_lock_irqsave(&r->chunk_list.lock, flags);
936 c = dma_find_chunk(r, bus_addr, len); 939 c = dma_find_chunk(r, bus_addr, len);
937 940
@@ -941,7 +944,7 @@ static int dma_ioc0_unmap_area(struct ps3_dma_region *r,
941 unsigned long aligned_len = _ALIGN_UP(len + bus_addr 944 unsigned long aligned_len = _ALIGN_UP(len + bus_addr
942 - aligned_bus, 945 - aligned_bus,
943 1 << r->page_size); 946 1 << r->page_size);
944 DBG("%s:%d: not found: bus_addr %lxh\n", 947 DBG("%s:%d: not found: bus_addr %llxh\n",
945 __func__, __LINE__, bus_addr); 948 __func__, __LINE__, bus_addr);
946 DBG("%s:%d: not found: len %lxh\n", 949 DBG("%s:%d: not found: len %lxh\n",
947 __func__, __LINE__, len); 950 __func__, __LINE__, len);
@@ -975,7 +978,8 @@ static int dma_ioc0_unmap_area(struct ps3_dma_region *r,
975static int dma_sb_region_create_linear(struct ps3_dma_region *r) 978static int dma_sb_region_create_linear(struct ps3_dma_region *r)
976{ 979{
977 int result; 980 int result;
978 unsigned long virt_addr, len, tmp; 981 unsigned long virt_addr, len;
982 dma_addr_t tmp;
979 983
980 if (r->len > 16*1024*1024) { /* FIXME: need proper fix */ 984 if (r->len > 16*1024*1024) { /* FIXME: need proper fix */
981 /* force 16M dma pages for linear mapping */ 985 /* force 16M dma pages for linear mapping */
@@ -1027,7 +1031,8 @@ static int dma_sb_region_create_linear(struct ps3_dma_region *r)
1027static int dma_sb_region_free_linear(struct ps3_dma_region *r) 1031static int dma_sb_region_free_linear(struct ps3_dma_region *r)
1028{ 1032{
1029 int result; 1033 int result;
1030 unsigned long bus_addr, len, lpar_addr; 1034 dma_addr_t bus_addr;
1035 unsigned long len, lpar_addr;
1031 1036
1032 if (r->offset < map.rm.size) { 1037 if (r->offset < map.rm.size) {
1033 /* Unmap (part of) 1st RAM chunk */ 1038 /* Unmap (part of) 1st RAM chunk */
@@ -1072,7 +1077,7 @@ static int dma_sb_region_free_linear(struct ps3_dma_region *r)
1072 */ 1077 */
1073 1078
1074static int dma_sb_map_area_linear(struct ps3_dma_region *r, 1079static int dma_sb_map_area_linear(struct ps3_dma_region *r,
1075 unsigned long virt_addr, unsigned long len, unsigned long *bus_addr, 1080 unsigned long virt_addr, unsigned long len, dma_addr_t *bus_addr,
1076 u64 iopte_flag) 1081 u64 iopte_flag)
1077{ 1082{
1078 unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr) 1083 unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr)
@@ -1091,7 +1096,7 @@ static int dma_sb_map_area_linear(struct ps3_dma_region *r,
1091 */ 1096 */
1092 1097
1093static int dma_sb_unmap_area_linear(struct ps3_dma_region *r, 1098static int dma_sb_unmap_area_linear(struct ps3_dma_region *r,
1094 unsigned long bus_addr, unsigned long len) 1099 dma_addr_t bus_addr, unsigned long len)
1095{ 1100{
1096 return 0; 1101 return 0;
1097}; 1102};
@@ -1169,13 +1174,13 @@ int ps3_dma_region_free(struct ps3_dma_region *r)
1169EXPORT_SYMBOL(ps3_dma_region_free); 1174EXPORT_SYMBOL(ps3_dma_region_free);
1170 1175
1171int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, 1176int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
1172 unsigned long len, unsigned long *bus_addr, 1177 unsigned long len, dma_addr_t *bus_addr,
1173 u64 iopte_flag) 1178 u64 iopte_flag)
1174{ 1179{
1175 return r->region_ops->map(r, virt_addr, len, bus_addr, iopte_flag); 1180 return r->region_ops->map(r, virt_addr, len, bus_addr, iopte_flag);
1176} 1181}
1177 1182
1178int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, 1183int ps3_dma_unmap(struct ps3_dma_region *r, dma_addr_t bus_addr,
1179 unsigned long len) 1184 unsigned long len)
1180{ 1185{
1181 return r->region_ops->unmap(r, bus_addr, len); 1186 return r->region_ops->unmap(r, bus_addr, len);
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 1d201782d4e5..e1c83c23b435 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -306,7 +306,7 @@ static void _dump_params(const struct os_area_params *p, const char *func,
306{ 306{
307 pr_debug("%s:%d: p.boot_flag: %u\n", func, line, p->boot_flag); 307 pr_debug("%s:%d: p.boot_flag: %u\n", func, line, p->boot_flag);
308 pr_debug("%s:%d: p.num_params: %u\n", func, line, p->num_params); 308 pr_debug("%s:%d: p.num_params: %u\n", func, line, p->num_params);
309 pr_debug("%s:%d: p.rtc_diff %ld\n", func, line, p->rtc_diff); 309 pr_debug("%s:%d: p.rtc_diff %lld\n", func, line, p->rtc_diff);
310 pr_debug("%s:%d: p.av_multi_out %u\n", func, line, p->av_multi_out); 310 pr_debug("%s:%d: p.av_multi_out %u\n", func, line, p->av_multi_out);
311 pr_debug("%s:%d: p.ctrl_button: %u\n", func, line, p->ctrl_button); 311 pr_debug("%s:%d: p.ctrl_button: %u\n", func, line, p->ctrl_button);
312 pr_debug("%s:%d: p.static_ip_addr: %u.%u.%u.%u\n", func, line, 312 pr_debug("%s:%d: p.static_ip_addr: %u.%u.%u.%u\n", func, line,
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index 22063adeb38b..5e304c292f68 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -44,7 +44,7 @@ static void _dump_field(const char *hdr, u64 n, const char *func, int line)
44 s[i] = (in[i] <= 126 && in[i] >= 32) ? in[i] : '.'; 44 s[i] = (in[i] <= 126 && in[i] >= 32) ? in[i] : '.';
45 s[i] = 0; 45 s[i] = 0;
46 46
47 pr_debug("%s:%d: %s%016lx : %s\n", func, line, hdr, n, s); 47 pr_debug("%s:%d: %s%016llx : %s\n", func, line, hdr, n, s);
48#endif 48#endif
49} 49}
50 50
@@ -70,8 +70,8 @@ static void _dump_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
70 _dump_field("n2: ", n2, func, line); 70 _dump_field("n2: ", n2, func, line);
71 _dump_field("n3: ", n3, func, line); 71 _dump_field("n3: ", n3, func, line);
72 _dump_field("n4: ", n4, func, line); 72 _dump_field("n4: ", n4, func, line);
73 pr_debug("%s:%d: v1: %016lx\n", func, line, v1); 73 pr_debug("%s:%d: v1: %016llx\n", func, line, v1);
74 pr_debug("%s:%d: v2: %016lx\n", func, line, v2); 74 pr_debug("%s:%d: v2: %016llx\n", func, line, v2);
75} 75}
76 76
77/** 77/**
@@ -149,10 +149,10 @@ static int read_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
149 *_v2 = v2; 149 *_v2 = v2;
150 150
151 if (v1 && !_v1) 151 if (v1 && !_v1)
152 pr_debug("%s:%d: warning: discarding non-zero v1: %016lx\n", 152 pr_debug("%s:%d: warning: discarding non-zero v1: %016llx\n",
153 __func__, __LINE__, v1); 153 __func__, __LINE__, v1);
154 if (v2 && !_v2) 154 if (v2 && !_v2)
155 pr_debug("%s:%d: warning: discarding non-zero v2: %016lx\n", 155 pr_debug("%s:%d: warning: discarding non-zero v2: %016llx\n",
156 __func__, __LINE__, v2); 156 __func__, __LINE__, v2);
157 157
158 return 0; 158 return 0;
@@ -327,7 +327,7 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
327 return result; 327 return result;
328 } 328 }
329 329
330 pr_debug("%s:%d: bus_type %u, bus_index %u, bus_id %lu, num_dev %u\n", 330 pr_debug("%s:%d: bus_type %u, bus_index %u, bus_id %llu, num_dev %u\n",
331 __func__, __LINE__, tmp.bus_type, tmp.bus_index, tmp.bus_id, 331 __func__, __LINE__, tmp.bus_type, tmp.bus_index, tmp.bus_id,
332 num_dev); 332 num_dev);
333 333
@@ -353,7 +353,7 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
353 return result; 353 return result;
354 } 354 }
355 355
356 pr_debug("%s:%d: found: dev_type %u, dev_index %u, dev_id %lu\n", 356 pr_debug("%s:%d: found: dev_type %u, dev_index %u, dev_id %llu\n",
357 __func__, __LINE__, tmp.dev_type, tmp.dev_index, tmp.dev_id); 357 __func__, __LINE__, tmp.dev_type, tmp.dev_index, tmp.dev_id);
358 358
359 *repo = tmp; 359 *repo = tmp;
@@ -367,7 +367,7 @@ int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
367 struct ps3_repository_device tmp; 367 struct ps3_repository_device tmp;
368 unsigned int num_dev; 368 unsigned int num_dev;
369 369
370 pr_debug(" -> %s:%u: find device by id %lu:%lu\n", __func__, __LINE__, 370 pr_debug(" -> %s:%u: find device by id %llu:%llu\n", __func__, __LINE__,
371 bus_id, dev_id); 371 bus_id, dev_id);
372 372
373 for (tmp.bus_index = 0; tmp.bus_index < 10; tmp.bus_index++) { 373 for (tmp.bus_index = 0; tmp.bus_index < 10; tmp.bus_index++) {
@@ -382,7 +382,7 @@ int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
382 if (tmp.bus_id == bus_id) 382 if (tmp.bus_id == bus_id)
383 goto found_bus; 383 goto found_bus;
384 384
385 pr_debug("%s:%u: skip, bus_id %lu\n", __func__, __LINE__, 385 pr_debug("%s:%u: skip, bus_id %llu\n", __func__, __LINE__,
386 tmp.bus_id); 386 tmp.bus_id);
387 } 387 }
388 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__); 388 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__);
@@ -416,7 +416,7 @@ found_bus:
416 if (tmp.dev_id == dev_id) 416 if (tmp.dev_id == dev_id)
417 goto found_dev; 417 goto found_dev;
418 418
419 pr_debug("%s:%u: skip, dev_id %lu\n", __func__, __LINE__, 419 pr_debug("%s:%u: skip, dev_id %llu\n", __func__, __LINE__,
420 tmp.dev_id); 420 tmp.dev_id);
421 } 421 }
422 pr_debug(" <- %s:%u: dev not found\n", __func__, __LINE__); 422 pr_debug(" <- %s:%u: dev not found\n", __func__, __LINE__);
@@ -430,7 +430,7 @@ found_dev:
430 return result; 430 return result;
431 } 431 }
432 432
433 pr_debug(" <- %s:%u: found: type (%u:%u) index (%u:%u) id (%lu:%lu)\n", 433 pr_debug(" <- %s:%u: found: type (%u:%u) index (%u:%u) id (%llu:%llu)\n",
434 __func__, __LINE__, tmp.bus_type, tmp.dev_type, tmp.bus_index, 434 __func__, __LINE__, tmp.bus_type, tmp.dev_type, tmp.bus_index,
435 tmp.dev_index, tmp.bus_id, tmp.dev_id); 435 tmp.dev_index, tmp.bus_id, tmp.dev_id);
436 *repo = tmp; 436 *repo = tmp;
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 35f3e85cf60e..3331ccbb8d38 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -186,7 +186,7 @@ early_param("ps3flash", early_parse_ps3flash);
186#define prealloc_ps3flash_bounce_buffer() do { } while (0) 186#define prealloc_ps3flash_bounce_buffer() do { } while (0)
187#endif 187#endif
188 188
189static int ps3_set_dabr(u64 dabr) 189static int ps3_set_dabr(unsigned long dabr)
190{ 190{
191 enum {DABR_USER = 1, DABR_KERNEL = 2,}; 191 enum {DABR_USER = 1, DABR_KERNEL = 2,};
192 192
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index ccae3d446b98..b3c6a993f9f3 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(ps3_get_spe_id);
149 149
150static unsigned long get_vas_id(void) 150static unsigned long get_vas_id(void)
151{ 151{
152 unsigned long id; 152 u64 id;
153 153
154 lv1_get_logical_ppe_id(&id); 154 lv1_get_logical_ppe_id(&id);
155 lv1_get_virtual_address_space_id_of_ppe(id, &id); 155 lv1_get_virtual_address_space_id_of_ppe(id, &id);
@@ -160,14 +160,18 @@ static unsigned long get_vas_id(void)
160static int __init construct_spu(struct spu *spu) 160static int __init construct_spu(struct spu *spu)
161{ 161{
162 int result; 162 int result;
163 unsigned long unused; 163 u64 unused;
164 u64 problem_phys;
165 u64 local_store_phys;
164 166
165 result = lv1_construct_logical_spe(PAGE_SHIFT, PAGE_SHIFT, PAGE_SHIFT, 167 result = lv1_construct_logical_spe(PAGE_SHIFT, PAGE_SHIFT, PAGE_SHIFT,
166 PAGE_SHIFT, PAGE_SHIFT, get_vas_id(), SPE_TYPE_LOGICAL, 168 PAGE_SHIFT, PAGE_SHIFT, get_vas_id(), SPE_TYPE_LOGICAL,
167 &spu_pdata(spu)->priv2_addr, &spu->problem_phys, 169 &spu_pdata(spu)->priv2_addr, &problem_phys,
168 &spu->local_store_phys, &unused, 170 &local_store_phys, &unused,
169 &spu_pdata(spu)->shadow_addr, 171 &spu_pdata(spu)->shadow_addr,
170 &spu_pdata(spu)->spe_id); 172 &spu_pdata(spu)->spe_id);
173 spu->problem_phys = problem_phys;
174 spu->local_store_phys = local_store_phys;
171 175
172 if (result) { 176 if (result) {
173 pr_debug("%s:%d: lv1_construct_logical_spe failed: %s\n", 177 pr_debug("%s:%d: lv1_construct_logical_spe failed: %s\n",
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index ee0d22911621..58311a867851 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -182,7 +182,7 @@ int ps3_open_hv_device(struct ps3_system_bus_device *dev)
182 case PS3_MATCH_ID_SYSTEM_MANAGER: 182 case PS3_MATCH_ID_SYSTEM_MANAGER:
183 pr_debug("%s:%d: unsupported match_id: %u\n", __func__, 183 pr_debug("%s:%d: unsupported match_id: %u\n", __func__,
184 __LINE__, dev->match_id); 184 __LINE__, dev->match_id);
185 pr_debug("%s:%d: bus_id: %lu\n", __func__, __LINE__, 185 pr_debug("%s:%d: bus_id: %llu\n", __func__, __LINE__,
186 dev->bus_id); 186 dev->bus_id);
187 BUG(); 187 BUG();
188 return -EINVAL; 188 return -EINVAL;
@@ -220,7 +220,7 @@ int ps3_close_hv_device(struct ps3_system_bus_device *dev)
220 case PS3_MATCH_ID_SYSTEM_MANAGER: 220 case PS3_MATCH_ID_SYSTEM_MANAGER:
221 pr_debug("%s:%d: unsupported match_id: %u\n", __func__, 221 pr_debug("%s:%d: unsupported match_id: %u\n", __func__,
222 __LINE__, dev->match_id); 222 __LINE__, dev->match_id);
223 pr_debug("%s:%d: bus_id: %lu\n", __func__, __LINE__, 223 pr_debug("%s:%d: bus_id: %llu\n", __func__, __LINE__,
224 dev->bus_id); 224 dev->bus_id);
225 BUG(); 225 BUG();
226 return -EINVAL; 226 return -EINVAL;
@@ -240,7 +240,7 @@ EXPORT_SYMBOL_GPL(ps3_close_hv_device);
240static void _dump_mmio_region(const struct ps3_mmio_region* r, 240static void _dump_mmio_region(const struct ps3_mmio_region* r,
241 const char* func, int line) 241 const char* func, int line)
242{ 242{
243 pr_debug("%s:%d: dev %lu:%lu\n", func, line, r->dev->bus_id, 243 pr_debug("%s:%d: dev %llu:%llu\n", func, line, r->dev->bus_id,
244 r->dev->dev_id); 244 r->dev->dev_id);
245 pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr); 245 pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr);
246 pr_debug("%s:%d: len %lxh\n", func, line, r->len); 246 pr_debug("%s:%d: len %lxh\n", func, line, r->len);
@@ -250,9 +250,11 @@ static void _dump_mmio_region(const struct ps3_mmio_region* r,
250static int ps3_sb_mmio_region_create(struct ps3_mmio_region *r) 250static int ps3_sb_mmio_region_create(struct ps3_mmio_region *r)
251{ 251{
252 int result; 252 int result;
253 u64 lpar_addr;
253 254
254 result = lv1_map_device_mmio_region(r->dev->bus_id, r->dev->dev_id, 255 result = lv1_map_device_mmio_region(r->dev->bus_id, r->dev->dev_id,
255 r->bus_addr, r->len, r->page_size, &r->lpar_addr); 256 r->bus_addr, r->len, r->page_size, &lpar_addr);
257 r->lpar_addr = lpar_addr;
256 258
257 if (result) { 259 if (result) {
258 pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n", 260 pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n",
@@ -568,7 +570,7 @@ static dma_addr_t ps3_sb_map_page(struct device *_dev, struct page *page,
568{ 570{
569 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 571 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
570 int result; 572 int result;
571 unsigned long bus_addr; 573 dma_addr_t bus_addr;
572 void *ptr = page_address(page) + offset; 574 void *ptr = page_address(page) + offset;
573 575
574 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, 576 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size,
@@ -590,7 +592,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page,
590{ 592{
591 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 593 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
592 int result; 594 int result;
593 unsigned long bus_addr; 595 dma_addr_t bus_addr;
594 u64 iopte_flag; 596 u64 iopte_flag;
595 void *ptr = page_address(page) + offset; 597 void *ptr = page_address(page) + offset;
596 598
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index c90817acb472..3ee01b4f4257 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -127,10 +127,10 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
127 } 127 }
128 128
129 if (rc && printk_ratelimit()) { 129 if (rc && printk_ratelimit()) {
130 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 130 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%lld\n", rc);
131 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 131 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
132 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 132 printk("\ttcenum = 0x%llx\n", (u64)tcenum);
133 printk("\ttce val = 0x%lx\n", tce ); 133 printk("\ttce val = 0x%llx\n", tce );
134 show_stack(current, (unsigned long *)__get_SP()); 134 show_stack(current, (unsigned long *)__get_SP());
135 } 135 }
136 136
@@ -210,10 +210,10 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
210 } 210 }
211 211
212 if (rc && printk_ratelimit()) { 212 if (rc && printk_ratelimit()) {
213 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 213 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%lld\n", rc);
214 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 214 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
215 printk("\tnpages = 0x%lx\n", (u64)npages); 215 printk("\tnpages = 0x%llx\n", (u64)npages);
216 printk("\ttce[0] val = 0x%lx\n", tcep[0]); 216 printk("\ttce[0] val = 0x%llx\n", tcep[0]);
217 show_stack(current, (unsigned long *)__get_SP()); 217 show_stack(current, (unsigned long *)__get_SP());
218 } 218 }
219 return ret; 219 return ret;
@@ -227,9 +227,9 @@ static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages
227 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0); 227 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0);
228 228
229 if (rc && printk_ratelimit()) { 229 if (rc && printk_ratelimit()) {
230 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 230 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%lld\n", rc);
231 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 231 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
232 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 232 printk("\ttcenum = 0x%llx\n", (u64)tcenum);
233 show_stack(current, (unsigned long *)__get_SP()); 233 show_stack(current, (unsigned long *)__get_SP());
234 } 234 }
235 235
@@ -246,9 +246,9 @@ static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long n
246 246
247 if (rc && printk_ratelimit()) { 247 if (rc && printk_ratelimit()) {
248 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n"); 248 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");
249 printk("\trc = %ld\n", rc); 249 printk("\trc = %lld\n", rc);
250 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 250 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
251 printk("\tnpages = 0x%lx\n", (u64)npages); 251 printk("\tnpages = 0x%llx\n", (u64)npages);
252 show_stack(current, (unsigned long *)__get_SP()); 252 show_stack(current, (unsigned long *)__get_SP());
253 } 253 }
254} 254}
@@ -261,10 +261,9 @@ static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum)
261 rc = plpar_tce_get((u64)tbl->it_index, (u64)tcenum << 12, &tce_ret); 261 rc = plpar_tce_get((u64)tbl->it_index, (u64)tcenum << 12, &tce_ret);
262 262
263 if (rc && printk_ratelimit()) { 263 if (rc && printk_ratelimit()) {
264 printk("tce_get_pSeriesLP: plpar_tce_get failed. rc=%ld\n", 264 printk("tce_get_pSeriesLP: plpar_tce_get failed. rc=%lld\n", rc);
265 rc); 265 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
266 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 266 printk("\ttcenum = 0x%llx\n", (u64)tcenum);
267 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
268 show_stack(current, (unsigned long *)__get_SP()); 267 show_stack(current, (unsigned long *)__get_SP());
269 } 268 }
270 269
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index f611d0369cc8..9817f63723dd 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -28,63 +28,104 @@
28#include <sysdev/fsl_pci.h> 28#include <sysdev/fsl_pci.h>
29 29
30#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) 30#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx)
31static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
32 unsigned int index, const struct resource *res,
33 resource_size_t offset)
34{
35 resource_size_t pci_addr = res->start - offset;
36 resource_size_t phys_addr = res->start;
37 resource_size_t size = res->end - res->start + 1;
38 u32 flags = 0x80044000; /* enable & mem R/W */
39 unsigned int i;
40
41 pr_debug("PCI MEM resource start 0x%016llx, size 0x%016llx.\n",
42 (u64)res->start, (u64)size);
43
44 if (res->flags & IORESOURCE_PREFETCH)
45 flags |= 0x10000000; /* enable relaxed ordering */
46
47 for (i = 0; size > 0; i++) {
48 unsigned int bits = min(__ilog2(size),
49 __ffs(pci_addr | phys_addr));
50
51 if (index + i >= 5)
52 return -1;
53
54 out_be32(&pci->pow[index + i].potar, pci_addr >> 12);
55 out_be32(&pci->pow[index + i].potear, (u64)pci_addr >> 44);
56 out_be32(&pci->pow[index + i].powbar, phys_addr >> 12);
57 out_be32(&pci->pow[index + i].powar, flags | (bits - 1));
58
59 pci_addr += (resource_size_t)1U << bits;
60 phys_addr += (resource_size_t)1U << bits;
61 size -= (resource_size_t)1U << bits;
62 }
63
64 return i;
65}
66
31/* atmu setup for fsl pci/pcie controller */ 67/* atmu setup for fsl pci/pcie controller */
32static void __init setup_pci_atmu(struct pci_controller *hose, 68static void __init setup_pci_atmu(struct pci_controller *hose,
33 struct resource *rsrc) 69 struct resource *rsrc)
34{ 70{
35 struct ccsr_pci __iomem *pci; 71 struct ccsr_pci __iomem *pci;
36 int i; 72 int i, j, n;
37 73
38 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n", 74 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
39 (u64)rsrc->start, (u64)rsrc->end - (u64)rsrc->start + 1); 75 (u64)rsrc->start, (u64)rsrc->end - (u64)rsrc->start + 1);
40 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1); 76 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1);
77 if (!pci) {
78 dev_err(hose->parent, "Unable to map ATMU registers\n");
79 return;
80 }
41 81
42 /* Disable all windows (except powar0 since its ignored) */ 82 /* Disable all windows (except powar0 since it's ignored) */
43 for(i = 1; i < 5; i++) 83 for(i = 1; i < 5; i++)
44 out_be32(&pci->pow[i].powar, 0); 84 out_be32(&pci->pow[i].powar, 0);
45 for(i = 0; i < 3; i++) 85 for(i = 0; i < 3; i++)
46 out_be32(&pci->piw[i].piwar, 0); 86 out_be32(&pci->piw[i].piwar, 0);
47 87
48 /* Setup outbound MEM window */ 88 /* Setup outbound MEM window */
49 for(i = 0; i < 3; i++) 89 for(i = 0, j = 1; i < 3; i++) {
50 if (hose->mem_resources[i].flags & IORESOURCE_MEM){ 90 if (!(hose->mem_resources[i].flags & IORESOURCE_MEM))
51 resource_size_t pci_addr_start = 91 continue;
52 hose->mem_resources[i].start - 92
53 hose->pci_mem_offset; 93 n = setup_one_atmu(pci, j, &hose->mem_resources[i],
54 pr_debug("PCI MEM resource start 0x%016llx, size 0x%016llx.\n", 94 hose->pci_mem_offset);
55 (u64)hose->mem_resources[i].start, 95
56 (u64)hose->mem_resources[i].end 96 if (n < 0 || j >= 5) {
57 - (u64)hose->mem_resources[i].start + 1); 97 pr_err("Ran out of outbound PCI ATMUs for resource %d!\n", i);
58 out_be32(&pci->pow[i+1].potar, (pci_addr_start >> 12)); 98 hose->mem_resources[i].flags |= IORESOURCE_DISABLED;
59 out_be32(&pci->pow[i+1].potear, 0); 99 } else
60 out_be32(&pci->pow[i+1].powbar, 100 j += n;
61 (hose->mem_resources[i].start >> 12)); 101 }
62 /* Enable, Mem R/W */
63 out_be32(&pci->pow[i+1].powar, 0x80044000
64 | (__ilog2(hose->mem_resources[i].end
65 - hose->mem_resources[i].start + 1) - 1));
66 }
67 102
68 /* Setup outbound IO window */ 103 /* Setup outbound IO window */
69 if (hose->io_resource.flags & IORESOURCE_IO){ 104 if (hose->io_resource.flags & IORESOURCE_IO) {
70 pr_debug("PCI IO resource start 0x%016llx, size 0x%016llx, " 105 if (j >= 5) {
71 "phy base 0x%016llx.\n", 106 pr_err("Ran out of outbound PCI ATMUs for IO resource\n");
72 (u64)hose->io_resource.start, 107 } else {
73 (u64)hose->io_resource.end - (u64)hose->io_resource.start + 1, 108 pr_debug("PCI IO resource start 0x%016llx, size 0x%016llx, "
74 (u64)hose->io_base_phys); 109 "phy base 0x%016llx.\n",
75 out_be32(&pci->pow[i+1].potar, (hose->io_resource.start >> 12)); 110 (u64)hose->io_resource.start,
76 out_be32(&pci->pow[i+1].potear, 0); 111 (u64)hose->io_resource.end - (u64)hose->io_resource.start + 1,
77 out_be32(&pci->pow[i+1].powbar, (hose->io_base_phys >> 12)); 112 (u64)hose->io_base_phys);
78 /* Enable, IO R/W */ 113 out_be32(&pci->pow[j].potar, (hose->io_resource.start >> 12));
79 out_be32(&pci->pow[i+1].powar, 0x80088000 114 out_be32(&pci->pow[j].potear, 0);
80 | (__ilog2(hose->io_resource.end 115 out_be32(&pci->pow[j].powbar, (hose->io_base_phys >> 12));
81 - hose->io_resource.start + 1) - 1)); 116 /* Enable, IO R/W */
117 out_be32(&pci->pow[j].powar, 0x80088000
118 | (__ilog2(hose->io_resource.end
119 - hose->io_resource.start + 1) - 1));
120 }
82 } 121 }
83 122
84 /* Setup 2G inbound Memory Window @ 1 */ 123 /* Setup 2G inbound Memory Window @ 1 */
85 out_be32(&pci->piw[2].pitar, 0x00000000); 124 out_be32(&pci->piw[2].pitar, 0x00000000);
86 out_be32(&pci->piw[2].piwbar,0x00000000); 125 out_be32(&pci->piw[2].piwbar,0x00000000);
87 out_be32(&pci->piw[2].piwar, PIWAR_2G); 126 out_be32(&pci->piw[2].piwar, PIWAR_2G);
127
128 iounmap(pci);
88} 129}
89 130
90static void __init setup_pci_cmd(struct pci_controller *hose) 131static void __init setup_pci_cmd(struct pci_controller *hose)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 0afd21f9a222..532e205303a2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -435,7 +435,7 @@ static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem *devbase,
435 addr = addr | ((u64)readl(base + HT_MSI_ADDR_HI) << 32); 435 addr = addr | ((u64)readl(base + HT_MSI_ADDR_HI) << 32);
436 } 436 }
437 437
438 printk(KERN_DEBUG "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%lx\n", 438 printk(KERN_DEBUG "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%llx\n",
439 PCI_SLOT(devfn), PCI_FUNC(devfn), 439 PCI_SLOT(devfn), PCI_FUNC(devfn),
440 flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr); 440 flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr);
441 441
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index a94a3c3ae932..6b0a3538dc63 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -77,6 +77,7 @@ mainmenu "Linux Kernel Configuration"
77config S390 77config S390
78 def_bool y 78 def_bool y
79 select USE_GENERIC_SMP_HELPERS if SMP 79 select USE_GENERIC_SMP_HELPERS if SMP
80 select HAVE_SYSCALL_WRAPPERS
80 select HAVE_FUNCTION_TRACER 81 select HAVE_FUNCTION_TRACER
81 select HAVE_OPROFILE 82 select HAVE_OPROFILE
82 select HAVE_KPROBES 83 select HAVE_KPROBES
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index f2af4167bd5f..63a23415fba6 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -13,4 +13,3 @@ unifdef-y += cmb.h
13unifdef-y += debug.h 13unifdef-y += debug.h
14unifdef-y += chpid.h 14unifdef-y += chpid.h
15unifdef-y += schid.h 15unifdef-y += schid.h
16unifdef-y += swab.h
diff --git a/arch/s390/include/asm/byteorder.h b/arch/s390/include/asm/byteorder.h
index b95a2b2933fb..a332e59e26fc 100644
--- a/arch/s390/include/asm/byteorder.h
+++ b/arch/s390/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _S390_BYTEORDER_H 1#ifndef _S390_BYTEORDER_H
2#define _S390_BYTEORDER_H 2#define _S390_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _S390_BYTEORDER_H */ 6#endif /* _S390_BYTEORDER_H */
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index fc2c97197a53..6035cd20c7a7 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -547,7 +547,7 @@ sys32_setdomainname_wrapper:
547 .globl sys32_newuname_wrapper 547 .globl sys32_newuname_wrapper
548sys32_newuname_wrapper: 548sys32_newuname_wrapper:
549 llgtr %r2,%r2 # struct new_utsname * 549 llgtr %r2,%r2 # struct new_utsname *
550 jg s390x_newuname # branch to system call 550 jg sys_s390_newuname # branch to system call
551 551
552 .globl compat_sys_adjtimex_wrapper 552 .globl compat_sys_adjtimex_wrapper
553compat_sys_adjtimex_wrapper: 553compat_sys_adjtimex_wrapper:
@@ -615,7 +615,7 @@ sys32_sysfs_wrapper:
615 .globl sys32_personality_wrapper 615 .globl sys32_personality_wrapper
616sys32_personality_wrapper: 616sys32_personality_wrapper:
617 llgfr %r2,%r2 # unsigned long 617 llgfr %r2,%r2 # unsigned long
618 jg s390x_personality # branch to system call 618 jg sys_s390_personality # branch to system call
619 619
620 .globl sys32_setfsuid16_wrapper 620 .globl sys32_setfsuid16_wrapper
621sys32_setfsuid16_wrapper: 621sys32_setfsuid16_wrapper:
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index a65afc91e8aa..950c59c6688b 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -30,23 +30,23 @@ struct fadvise64_64_args;
30struct old_sigaction; 30struct old_sigaction;
31struct sel_arg_struct; 31struct sel_arg_struct;
32 32
33long sys_pipe(unsigned long __user *fildes);
34long sys_mmap2(struct mmap_arg_struct __user *arg); 33long sys_mmap2(struct mmap_arg_struct __user *arg);
35long old_mmap(struct mmap_arg_struct __user *arg); 34long sys_s390_old_mmap(struct mmap_arg_struct __user *arg);
36long sys_ipc(uint call, int first, unsigned long second, 35long sys_ipc(uint call, int first, unsigned long second,
37 unsigned long third, void __user *ptr); 36 unsigned long third, void __user *ptr);
38long s390x_newuname(struct new_utsname __user *name); 37long sys_s390_newuname(struct new_utsname __user *name);
39long s390x_personality(unsigned long personality); 38long sys_s390_personality(unsigned long personality);
40long s390_fadvise64(int fd, u32 offset_high, u32 offset_low, 39long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
41 size_t len, int advice); 40 size_t len, int advice);
42long s390_fadvise64_64(struct fadvise64_64_args __user *args); 41long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
43long s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, u32 len_low); 42long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
43 u32 len_low);
44long sys_fork(void); 44long sys_fork(void);
45long sys_clone(void); 45long sys_clone(void);
46long sys_vfork(void); 46long sys_vfork(void);
47void execve_tail(void); 47void execve_tail(void);
48long sys_execve(void); 48long sys_execve(void);
49int sys_sigsuspend(int history0, int history1, old_sigset_t mask); 49long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
50long sys_sigaction(int sig, const struct old_sigaction __user *act, 50long sys_sigaction(int sig, const struct old_sigaction __user *act,
51 struct old_sigaction __user *oact); 51 struct old_sigaction __user *oact);
52long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss); 52long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss);
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index b6110bdf8dc2..5cd38a90e64d 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -39,6 +39,7 @@
39#include <linux/tick.h> 39#include <linux/tick.h>
40#include <linux/elfcore.h> 40#include <linux/elfcore.h>
41#include <linux/kernel_stat.h> 41#include <linux/kernel_stat.h>
42#include <linux/syscalls.h>
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
43#include <asm/pgtable.h> 44#include <asm/pgtable.h>
44#include <asm/system.h> 45#include <asm/system.h>
@@ -225,13 +226,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
225 return 0; 226 return 0;
226} 227}
227 228
228asmlinkage long sys_fork(void) 229SYSCALL_DEFINE0(fork)
229{ 230{
230 struct pt_regs *regs = task_pt_regs(current); 231 struct pt_regs *regs = task_pt_regs(current);
231 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL); 232 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL);
232} 233}
233 234
234asmlinkage long sys_clone(void) 235SYSCALL_DEFINE0(clone)
235{ 236{
236 struct pt_regs *regs = task_pt_regs(current); 237 struct pt_regs *regs = task_pt_regs(current);
237 unsigned long clone_flags; 238 unsigned long clone_flags;
@@ -258,7 +259,7 @@ asmlinkage long sys_clone(void)
258 * do not have enough call-clobbered registers to hold all 259 * do not have enough call-clobbered registers to hold all
259 * the information you need. 260 * the information you need.
260 */ 261 */
261asmlinkage long sys_vfork(void) 262SYSCALL_DEFINE0(vfork)
262{ 263{
263 struct pt_regs *regs = task_pt_regs(current); 264 struct pt_regs *regs = task_pt_regs(current);
264 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 265 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
@@ -278,7 +279,7 @@ asmlinkage void execve_tail(void)
278/* 279/*
279 * sys_execve() executes a new program. 280 * sys_execve() executes a new program.
280 */ 281 */
281asmlinkage long sys_execve(void) 282SYSCALL_DEFINE0(execve)
282{ 283{
283 struct pt_regs *regs = task_pt_regs(current); 284 struct pt_regs *regs = task_pt_regs(current);
284 char *filename; 285 char *filename;
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 8e6812a22670..3cf74c3ccb69 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -25,6 +25,7 @@
25#include <linux/personality.h> 25#include <linux/personality.h>
26#include <linux/binfmts.h> 26#include <linux/binfmts.h>
27#include <linux/tracehook.h> 27#include <linux/tracehook.h>
28#include <linux/syscalls.h>
28#include <asm/ucontext.h> 29#include <asm/ucontext.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/lowcore.h> 31#include <asm/lowcore.h>
@@ -53,8 +54,7 @@ typedef struct
53/* 54/*
54 * Atomically swap in the new signal mask, and wait for a signal. 55 * Atomically swap in the new signal mask, and wait for a signal.
55 */ 56 */
56asmlinkage int 57SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
57sys_sigsuspend(int history0, int history1, old_sigset_t mask)
58{ 58{
59 mask &= _BLOCKABLE; 59 mask &= _BLOCKABLE;
60 spin_lock_irq(&current->sighand->siglock); 60 spin_lock_irq(&current->sighand->siglock);
@@ -70,9 +70,8 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask)
70 return -ERESTARTNOHAND; 70 return -ERESTARTNOHAND;
71} 71}
72 72
73asmlinkage long 73SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act,
74sys_sigaction(int sig, const struct old_sigaction __user *act, 74 struct old_sigaction __user *, oact)
75 struct old_sigaction __user *oact)
76{ 75{
77 struct k_sigaction new_ka, old_ka; 76 struct k_sigaction new_ka, old_ka;
78 int ret; 77 int ret;
@@ -102,15 +101,13 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
102 return ret; 101 return ret;
103} 102}
104 103
105asmlinkage long 104SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
106sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) 105 stack_t __user *, uoss)
107{ 106{
108 struct pt_regs *regs = task_pt_regs(current); 107 struct pt_regs *regs = task_pt_regs(current);
109 return do_sigaltstack(uss, uoss, regs->gprs[15]); 108 return do_sigaltstack(uss, uoss, regs->gprs[15]);
110} 109}
111 110
112
113
114/* Returns non-zero on fault. */ 111/* Returns non-zero on fault. */
115static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs) 112static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
116{ 113{
@@ -164,7 +161,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
164 return 0; 161 return 0;
165} 162}
166 163
167asmlinkage long sys_sigreturn(void) 164SYSCALL_DEFINE0(sigreturn)
168{ 165{
169 struct pt_regs *regs = task_pt_regs(current); 166 struct pt_regs *regs = task_pt_regs(current);
170 sigframe __user *frame = (sigframe __user *)regs->gprs[15]; 167 sigframe __user *frame = (sigframe __user *)regs->gprs[15];
@@ -191,7 +188,7 @@ badframe:
191 return 0; 188 return 0;
192} 189}
193 190
194asmlinkage long sys_rt_sigreturn(void) 191SYSCALL_DEFINE0(rt_sigreturn)
195{ 192{
196 struct pt_regs *regs = task_pt_regs(current); 193 struct pt_regs *regs = task_pt_regs(current);
197 rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; 194 rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index c34be4568b80..c7ae4b17e0e3 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -29,6 +29,7 @@
29#include <linux/personality.h> 29#include <linux/personality.h>
30#include <linux/unistd.h> 30#include <linux/unistd.h>
31#include <linux/ipc.h> 31#include <linux/ipc.h>
32#include <linux/syscalls.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include "entry.h" 34#include "entry.h"
34 35
@@ -74,7 +75,7 @@ struct mmap_arg_struct {
74 unsigned long offset; 75 unsigned long offset;
75}; 76};
76 77
77asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg) 78SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg)
78{ 79{
79 struct mmap_arg_struct a; 80 struct mmap_arg_struct a;
80 int error = -EFAULT; 81 int error = -EFAULT;
@@ -86,7 +87,7 @@ out:
86 return error; 87 return error;
87} 88}
88 89
89asmlinkage long old_mmap(struct mmap_arg_struct __user *arg) 90SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
90{ 91{
91 struct mmap_arg_struct a; 92 struct mmap_arg_struct a;
92 long error = -EFAULT; 93 long error = -EFAULT;
@@ -108,8 +109,8 @@ out:
108 * 109 *
109 * This is really horribly ugly. 110 * This is really horribly ugly.
110 */ 111 */
111asmlinkage long sys_ipc(uint call, int first, unsigned long second, 112SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
112 unsigned long third, void __user *ptr) 113 unsigned long, third, void __user *, ptr)
113{ 114{
114 struct ipc_kludge tmp; 115 struct ipc_kludge tmp;
115 int ret; 116 int ret;
@@ -175,7 +176,7 @@ asmlinkage long sys_ipc(uint call, int first, unsigned long second,
175} 176}
176 177
177#ifdef CONFIG_64BIT 178#ifdef CONFIG_64BIT
178asmlinkage long s390x_newuname(struct new_utsname __user *name) 179SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name)
179{ 180{
180 int ret = sys_newuname(name); 181 int ret = sys_newuname(name);
181 182
@@ -186,7 +187,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user *name)
186 return ret; 187 return ret;
187} 188}
188 189
189asmlinkage long s390x_personality(unsigned long personality) 190SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
190{ 191{
191 int ret; 192 int ret;
192 193
@@ -205,15 +206,13 @@ asmlinkage long s390x_personality(unsigned long personality)
205 */ 206 */
206#ifndef CONFIG_64BIT 207#ifndef CONFIG_64BIT
207 208
208asmlinkage long 209SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
209s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice) 210 size_t, len, int, advice)
210{ 211{
211 return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low, 212 return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
212 len, advice); 213 len, advice);
213} 214}
214 215
215#endif
216
217struct fadvise64_64_args { 216struct fadvise64_64_args {
218 int fd; 217 int fd;
219 long long offset; 218 long long offset;
@@ -221,8 +220,7 @@ struct fadvise64_64_args {
221 int advice; 220 int advice;
222}; 221};
223 222
224asmlinkage long 223SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
225s390_fadvise64_64(struct fadvise64_64_args __user *args)
226{ 224{
227 struct fadvise64_64_args a; 225 struct fadvise64_64_args a;
228 226
@@ -231,7 +229,6 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
231 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); 229 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
232} 230}
233 231
234#ifndef CONFIG_64BIT
235/* 232/*
236 * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last 233 * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
237 * 64 bit argument "len" is split into the upper and lower 32 bits. The 234 * 64 bit argument "len" is split into the upper and lower 32 bits. The
@@ -244,9 +241,19 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
244 * to 241 * to
245 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len 242 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
246 */ 243 */
247asmlinkage long s390_fallocate(int fd, int mode, loff_t offset, 244SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
248 u32 len_high, u32 len_low) 245 u32 len_high, u32 len_low)
249{ 246{
250 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); 247 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
251} 248}
249#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
250asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
251 long len_high, long len_low)
252{
253 return SYSC_s390_fallocate((int) fd, (int) mode, offset,
254 (u32) len_high, (u32) len_low);
255}
256SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
257#endif
258
252#endif 259#endif
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 2d61787949d5..76d16e0140bb 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper)
98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) 98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper)
99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) 99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper)
100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ 100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */
101SYSCALL(old_mmap,old_mmap,old32_mmap_wrapper) /* 90 */ 101SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */
102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) 102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper)
103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) 103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper)
104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) 104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper)
@@ -130,7 +130,7 @@ SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
133SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
@@ -144,7 +144,7 @@ SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper)
144SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper) 144SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper)
145SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper) 145SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper)
146SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */ 146SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */
147SYSCALL(sys_personality,s390x_personality,sys32_personality_wrapper) 147SYSCALL(sys_personality,sys_s390_personality,sys32_personality_wrapper)
148NI_SYSCALL /* for afs_syscall */ 148NI_SYSCALL /* for afs_syscall */
149SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */ 149SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */
150SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */ 150SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */
@@ -261,7 +261,7 @@ SYSCALL(sys_epoll_create,sys_epoll_create,sys_epoll_create_wrapper)
261SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */ 261SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */
262SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper) 262SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper)
263SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper) 263SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper)
264SYSCALL(s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper) 264SYSCALL(sys_s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper)
265SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper) 265SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper)
266SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */ 266SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */
267SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper) 267SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper)
@@ -272,7 +272,7 @@ SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260
272SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper) 272SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
273SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper) 273SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
274NI_SYSCALL /* reserved for vserver */ 274NI_SYSCALL /* reserved for vserver */
275SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) 275SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
276SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper) 276SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
277SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper) 277SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
278SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper) 278SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper)
@@ -322,7 +322,7 @@ NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper) 323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper)
324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) 324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
325SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper) 325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ 326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */
327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) 327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper)
328NI_SYSCALL /* 317 old sys_timer_fd */ 328NI_SYSCALL /* 317 old sys_timer_fd */
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index f1a2a0d1c79c..43910cdf78a5 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -6,4 +6,3 @@ unifdef-y += unistd_32.h
6unifdef-y += unistd_64.h 6unifdef-y += unistd_64.h
7unifdef-y += posix_types_32.h 7unifdef-y += posix_types_32.h
8unifdef-y += posix_types_64.h 8unifdef-y += posix_types_64.h
9unifdef-y += swab.h
diff --git a/arch/sh/include/asm/byteorder.h b/arch/sh/include/asm/byteorder.h
index e95c41a5c8cc..db2f5d7cb17d 100644
--- a/arch/sh/include/asm/byteorder.h
+++ b/arch/sh/include/asm/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_SH_BYTEORDER_H 1#ifndef __ASM_SH_BYTEORDER_H
2#define __ASM_SH_BYTEORDER_H 2#define __ASM_SH_BYTEORDER_H
3 3
4#include <asm/swab.h>
5
6#ifdef __LITTLE_ENDIAN__ 4#ifdef __LITTLE_ENDIAN__
7#include <linux/byteorder/little_endian.h> 5#include <linux/byteorder/little_endian.h>
8#else 6#else
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 104c5e686106..8b30200305c3 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -36,9 +36,9 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
36asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, 36asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
37 unsigned long r6, unsigned long r7, 37 unsigned long r6, unsigned long r7,
38 struct pt_regs __regs); 38 struct pt_regs __regs);
39asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, 39asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5,
40 unsigned long r6, unsigned long r7, 40 unsigned long r6, unsigned long r7,
41 struct pt_regs __regs); 41 struct pt_regs __regs);
42asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf, 42asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
43 size_t count, long dummy, loff_t pos); 43 size_t count, long dummy, loff_t pos);
44asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf, 44asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c
index dbba1e1833d4..63ba12836eae 100644
--- a/arch/sh/kernel/sys_sh32.c
+++ b/arch/sh/kernel/sys_sh32.c
@@ -22,7 +22,7 @@
22 * sys_pipe() is the normal C calling standard for creating 22 * sys_pipe() is the normal C calling standard for creating
23 * a pipe. It's not the way Unix traditionally does this, though. 23 * a pipe. It's not the way Unix traditionally does this, though.
24 */ 24 */
25asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, 25asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5,
26 unsigned long r6, unsigned long r7, 26 unsigned long r6, unsigned long r7,
27 struct pt_regs __regs) 27 struct pt_regs __regs)
28{ 28{
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 0af693e65764..e67c1733e1b9 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -58,7 +58,7 @@ ENTRY(sys_call_table)
58 .long sys_mkdir 58 .long sys_mkdir
59 .long sys_rmdir /* 40 */ 59 .long sys_rmdir /* 40 */
60 .long sys_dup 60 .long sys_dup
61 .long sys_pipe 61 .long sys_sh_pipe
62 .long sys_times 62 .long sys_times
63 .long sys_ni_syscall /* old prof syscall holder */ 63 .long sys_ni_syscall /* old prof syscall holder */
64 .long sys_brk /* 45 */ 64 .long sys_brk /* 45 */
@@ -105,7 +105,7 @@ ENTRY(sys_call_table)
105 .long sys_uselib 105 .long sys_uselib
106 .long sys_swapon 106 .long sys_swapon
107 .long sys_reboot 107 .long sys_reboot
108 .long old_readdir 108 .long sys_old_readdir
109 .long old_mmap /* 90 */ 109 .long old_mmap /* 90 */
110 .long sys_munmap 110 .long sys_munmap
111 .long sys_truncate 111 .long sys_truncate
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 0b436aa3cad7..557cb91f5caf 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -109,7 +109,7 @@ sys_call_table:
109 .long sys_uselib 109 .long sys_uselib
110 .long sys_swapon 110 .long sys_swapon
111 .long sys_reboot 111 .long sys_reboot
112 .long old_readdir 112 .long sys_old_readdir
113 .long old_mmap /* 90 */ 113 .long old_mmap /* 90 */
114 .long sys_munmap 114 .long sys_munmap
115 .long sys_truncate 115 .long sys_truncate
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 95e38a43dff0..deeb0fba8029 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -17,4 +17,3 @@ header-y += traps.h
17header-y += uctx.h 17header-y += uctx.h
18header-y += utrap.h 18header-y += utrap.h
19header-y += watchdog.h 19header-y += watchdog.h
20header-y += swab.h
diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h
index 48a047cd6fa9..ccc1b6b7de6c 100644
--- a/arch/sparc/include/asm/byteorder.h
+++ b/arch/sparc/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _SPARC_BYTEORDER_H 1#ifndef _SPARC_BYTEORDER_H
2#define _SPARC_BYTEORDER_H 2#define _SPARC_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _SPARC_BYTEORDER_H */ 6#endif /* _SPARC_BYTEORDER_H */
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index faf9ccd9ef5d..f41ecc5ac0b4 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1088,8 +1088,8 @@ sunos_execv:
1088 ld [%sp + STACKFRAME_SZ + PT_I0], %o0 1088 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
1089 1089
1090 .align 4 1090 .align 4
1091 .globl sys_pipe 1091 .globl sys_sparc_pipe
1092sys_pipe: 1092sys_sparc_pipe:
1093 mov %o7, %l5 1093 mov %o7, %l5
1094 add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg 1094 add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
1095 call sparc_pipe 1095 call sparc_pipe
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c
index da8f804feb49..0f26066a08d9 100644
--- a/arch/sparc/kernel/sparc_ksyms_64.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -9,7 +9,6 @@
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h> 10#include <linux/init.h>
11 11
12#include <asm/spinlock.h>
13#include <asm/system.h> 12#include <asm/system.h>
14#include <asm/cpudata.h> 13#include <asm/cpudata.h>
15#include <asm/uaccess.h> 14#include <asm/uaccess.h>
@@ -23,16 +22,6 @@ struct poll {
23 short revents; 22 short revents;
24}; 23};
25 24
26/* used by various drivers */
27#ifdef CONFIG_SMP
28/* Out of line rw-locking implementation. */
29EXPORT_SYMBOL(__read_lock);
30EXPORT_SYMBOL(__read_unlock);
31EXPORT_SYMBOL(__write_lock);
32EXPORT_SYMBOL(__write_unlock);
33EXPORT_SYMBOL(__write_trylock);
34#endif /* CONFIG_SMP */
35
36/* from helpers.S */ 25/* from helpers.S */
37EXPORT_SYMBOL(__flushw_user); 26EXPORT_SYMBOL(__flushw_user);
38EXPORT_SYMBOL_GPL(real_hard_smp_processor_id); 27EXPORT_SYMBOL_GPL(real_hard_smp_processor_id);
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 7a6786a71363..87f5a3b8a253 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -20,7 +20,7 @@ execve_merge:
20 add %sp, PTREGS_OFF, %o0 20 add %sp, PTREGS_OFF, %o0
21 21
22 .align 32 22 .align 32
23sys_pipe: 23sys_sparc_pipe:
24 ba,pt %xcc, sparc_pipe 24 ba,pt %xcc, sparc_pipe
25 add %sp, PTREGS_OFF, %o0 25 add %sp, PTREGS_OFF, %o0
26sys_nis_syscall: 26sys_nis_syscall:
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 7d0807586442..dccc95df0c7f 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -24,7 +24,7 @@ sys_call_table:
24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause 24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
26/*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile 26/*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile
27/*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_getuid 27/*40*/ .long sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_getuid
28/*45*/ .long sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16 28/*45*/ .long sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16
29/*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl 29/*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl
30/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve 30/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve
@@ -56,7 +56,7 @@ sys_call_table:
56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname 56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl 57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl
58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask 58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask
59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, old_readdir 59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir
60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
62/*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex 62/*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 9fc78cf354bd..e6007bb37046 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -26,7 +26,7 @@ sys_call_table32:
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause 26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
28 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile 28 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
29/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid 29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid
30 .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16 30 .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16
31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl 31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
32 .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve 32 .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve
@@ -100,7 +100,7 @@ sys_call_table:
100/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall 100/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
101/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice 101/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
102 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64 102 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64
103/*40*/ .word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall 103/*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall
104 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid 104 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
105/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl 105/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
106 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve 106 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index a9f8a814a1f7..4a8e80cdcfa5 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -22,4 +22,3 @@ unifdef-y += unistd_32.h
22unifdef-y += unistd_64.h 22unifdef-y += unistd_64.h
23unifdef-y += vm86.h 23unifdef-y += vm86.h
24unifdef-y += vsyscall.h 24unifdef-y += vsyscall.h
25unifdef-y += swab.h
diff --git a/arch/x86/include/asm/byteorder.h b/arch/x86/include/asm/byteorder.h
index 7c49917e3d9d..b13a7a88f3eb 100644
--- a/arch/x86/include/asm/byteorder.h
+++ b/arch/x86/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_X86_BYTEORDER_H 1#ifndef _ASM_X86_BYTEORDER_H
2#define _ASM_X86_BYTEORDER_H 2#define _ASM_X86_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ASM_X86_BYTEORDER_H */ 6#endif /* _ASM_X86_BYTEORDER_H */
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 884d985b8b82..e948b28a5a9a 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -446,7 +446,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
446static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs, 446static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
447 struct kprobe_ctlblk *kcb) 447 struct kprobe_ctlblk *kcb)
448{ 448{
449#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PM) 449#if !defined(CONFIG_PREEMPT) || defined(CONFIG_FREEZER)
450 if (p->ainsn.boostable == 1 && !p->post_handler) { 450 if (p->ainsn.boostable == 1 && !p->post_handler) {
451 /* Boost up -- we can execute copied instructions directly */ 451 /* Boost up -- we can execute copied instructions directly */
452 reset_current_kprobe(); 452 reset_current_kprobe();
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index 496726ddcea1..0c4d601bc853 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -88,7 +88,7 @@ ENTRY(sys_call_table)
88 .long sys_uselib 88 .long sys_uselib
89 .long sys_swapon 89 .long sys_swapon
90 .long sys_reboot 90 .long sys_reboot
91 .long old_readdir 91 .long sys_old_readdir
92 .long old_mmap /* 90 */ 92 .long old_mmap /* 90 */
93 .long sys_munmap 93 .long sys_munmap
94 .long sys_truncate 94 .long sys_truncate
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 4cf30dee8161..e89d24815f26 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -555,12 +555,10 @@ repeat:
555 if (!pte_val(old_pte)) { 555 if (!pte_val(old_pte)) {
556 if (!primary) 556 if (!primary)
557 return 0; 557 return 0;
558 558 WARN(1, KERN_WARNING "CPA: called for zero pte. "
559 /* 559 "vaddr = %lx cpa->vaddr = %lx\n", address,
560 * Special error value returned, indicating that the mapping 560 *cpa->vaddr);
561 * did not exist at this address. 561 return -EINVAL;
562 */
563 return -EFAULT;
564 } 562 }
565 563
566 if (level == PG_LEVEL_4K) { 564 if (level == PG_LEVEL_4K) {
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 3be399013de6..c9488513fd70 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -522,35 +522,6 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
522} 522}
523#endif /* CONFIG_STRICT_DEVMEM */ 523#endif /* CONFIG_STRICT_DEVMEM */
524 524
525/*
526 * Change the memory type for the physial address range in kernel identity
527 * mapping space if that range is a part of identity map.
528 */
529static int kernel_map_sync_memtype(u64 base, unsigned long size,
530 unsigned long flags)
531{
532 unsigned long id_sz;
533 int ret;
534
535 if (!pat_enabled || base >= __pa(high_memory))
536 return 0;
537
538 id_sz = (__pa(high_memory) < base + size) ?
539 __pa(high_memory) - base :
540 size;
541
542 ret = ioremap_change_attr((unsigned long)__va(base), id_sz, flags);
543 /*
544 * -EFAULT return means that the addr was not valid and did not have
545 * any identity mapping. That case is a success for
546 * kernel_map_sync_memtype.
547 */
548 if (ret == -EFAULT)
549 ret = 0;
550
551 return ret;
552}
553
554int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, 525int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
555 unsigned long size, pgprot_t *vma_prot) 526 unsigned long size, pgprot_t *vma_prot)
556{ 527{
@@ -601,7 +572,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
601 if (retval < 0) 572 if (retval < 0)
602 return 0; 573 return 0;
603 574
604 if (kernel_map_sync_memtype(offset, size, flags)) { 575 if (((pfn < max_low_pfn_mapped) ||
576 (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn < max_pfn_mapped)) &&
577 ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
605 free_memtype(offset, offset + size); 578 free_memtype(offset, offset + size);
606 printk(KERN_INFO 579 printk(KERN_INFO
607 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", 580 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
@@ -649,7 +622,7 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
649 int strict_prot) 622 int strict_prot)
650{ 623{
651 int is_ram = 0; 624 int is_ram = 0;
652 int ret; 625 int id_sz, ret;
653 unsigned long flags; 626 unsigned long flags;
654 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); 627 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK);
655 628
@@ -690,7 +663,15 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
690 flags); 663 flags);
691 } 664 }
692 665
693 if (kernel_map_sync_memtype(paddr, size, flags)) { 666 /* Need to keep identity mapping in sync */
667 if (paddr >= __pa(high_memory))
668 return 0;
669
670 id_sz = (__pa(high_memory) < paddr + size) ?
671 __pa(high_memory) - paddr :
672 size;
673
674 if (ioremap_change_attr((unsigned long)__va(paddr), id_sz, flags) < 0) {
694 free_memtype(paddr, paddr + size); 675 free_memtype(paddr, paddr + size);
695 printk(KERN_ERR 676 printk(KERN_ERR
696 "%s:%d reserve_pfn_range ioremap_change_attr failed %s " 677 "%s:%d reserve_pfn_range ioremap_change_attr failed %s "
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 58c02a454130..c68e1680da01 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1,3 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2
3unifdef-y += swab.h
diff --git a/arch/xtensa/include/asm/byteorder.h b/arch/xtensa/include/asm/byteorder.h
index 329b94591ca4..54eb6315349c 100644
--- a/arch/xtensa/include/asm/byteorder.h
+++ b/arch/xtensa/include/asm/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef _XTENSA_BYTEORDER_H 1#ifndef _XTENSA_BYTEORDER_H
2#define _XTENSA_BYTEORDER_H 2#define _XTENSA_BYTEORDER_H
3 3
4#include <asm/swab.h>
5
6#ifdef __XTENSA_EL__ 4#ifdef __XTENSA_EL__
7#include <linux/byteorder/little_endian.h> 5#include <linux/byteorder/little_endian.h>
8#elif defined(__XTENSA_EB__) 6#elif defined(__XTENSA_EB__)
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index d80f4cc2e0da..65d90c720b5a 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -19,7 +19,7 @@ obj-y += osl.o utils.o reboot.o\
19 19
20# sleep related files 20# sleep related files
21obj-y += wakeup.o 21obj-y += wakeup.o
22obj-y += main.o 22obj-y += sleep.o
23obj-$(CONFIG_ACPI_SLEEP) += proc.o 23obj-$(CONFIG_ACPI_SLEEP) += proc.o
24 24
25 25
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 8dfcbb8aff73..a2b82c90a683 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -120,31 +120,6 @@ static struct acpi_ec {
120 spinlock_t curr_lock; 120 spinlock_t curr_lock;
121} *boot_ec, *first_ec; 121} *boot_ec, *first_ec;
122 122
123/*
124 * Some Asus system have exchanged ECDT data/command IO addresses.
125 */
126static int print_ecdt_error(const struct dmi_system_id *id)
127{
128 printk(KERN_NOTICE PREFIX "%s detected - "
129 "ECDT has exchanged control/data I/O address\n",
130 id->ident);
131 return 0;
132}
133
134static struct dmi_system_id __cpuinitdata ec_dmi_table[] = {
135 {
136 print_ecdt_error, "Asus L4R", {
137 DMI_MATCH(DMI_BIOS_VERSION, "1008.006"),
138 DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),
139 DMI_MATCH(DMI_BOARD_NAME, "L4R") }, NULL},
140 {
141 print_ecdt_error, "Asus M6R", {
142 DMI_MATCH(DMI_BIOS_VERSION, "0207"),
143 DMI_MATCH(DMI_PRODUCT_NAME, "M6R"),
144 DMI_MATCH(DMI_BOARD_NAME, "M6R") }, NULL},
145 {},
146};
147
148/* -------------------------------------------------------------------------- 123/* --------------------------------------------------------------------------
149 Transaction Management 124 Transaction Management
150 -------------------------------------------------------------------------- */ 125 -------------------------------------------------------------------------- */
@@ -983,8 +958,8 @@ static const struct acpi_device_id ec_device_ids[] = {
983int __init acpi_ec_ecdt_probe(void) 958int __init acpi_ec_ecdt_probe(void)
984{ 959{
985 acpi_status status; 960 acpi_status status;
961 struct acpi_ec *saved_ec = NULL;
986 struct acpi_table_ecdt *ecdt_ptr; 962 struct acpi_table_ecdt *ecdt_ptr;
987 acpi_handle dummy;
988 963
989 boot_ec = make_acpi_ec(); 964 boot_ec = make_acpi_ec();
990 if (!boot_ec) 965 if (!boot_ec)
@@ -998,21 +973,16 @@ int __init acpi_ec_ecdt_probe(void)
998 pr_info(PREFIX "EC description table is found, configuring boot EC\n"); 973 pr_info(PREFIX "EC description table is found, configuring boot EC\n");
999 boot_ec->command_addr = ecdt_ptr->control.address; 974 boot_ec->command_addr = ecdt_ptr->control.address;
1000 boot_ec->data_addr = ecdt_ptr->data.address; 975 boot_ec->data_addr = ecdt_ptr->data.address;
1001 if (dmi_check_system(ec_dmi_table)) {
1002 /*
1003 * If the board falls into ec_dmi_table, it means
1004 * that ECDT table gives the incorrect command/status
1005 * & data I/O address. Just fix it.
1006 */
1007 boot_ec->data_addr = ecdt_ptr->control.address;
1008 boot_ec->command_addr = ecdt_ptr->data.address;
1009 }
1010 boot_ec->gpe = ecdt_ptr->gpe; 976 boot_ec->gpe = ecdt_ptr->gpe;
1011 boot_ec->handle = ACPI_ROOT_OBJECT; 977 boot_ec->handle = ACPI_ROOT_OBJECT;
1012 acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); 978 acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
1013 /* Add some basic check against completely broken table */ 979 /* Don't trust ECDT, which comes from ASUSTek */
1014 if (boot_ec->data_addr != boot_ec->command_addr) 980 if (!dmi_name_in_vendors("ASUS"))
1015 goto install; 981 goto install;
982 saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
983 if (!saved_ec)
984 return -ENOMEM;
985 memcpy(&saved_ec, boot_ec, sizeof(saved_ec));
1016 /* fall through */ 986 /* fall through */
1017 } 987 }
1018 /* This workaround is needed only on some broken machines, 988 /* This workaround is needed only on some broken machines,
@@ -1023,12 +993,29 @@ int __init acpi_ec_ecdt_probe(void)
1023 /* Check that acpi_get_devices actually find something */ 993 /* Check that acpi_get_devices actually find something */
1024 if (ACPI_FAILURE(status) || !boot_ec->handle) 994 if (ACPI_FAILURE(status) || !boot_ec->handle)
1025 goto error; 995 goto error;
1026 /* We really need to limit this workaround, the only ASUS, 996 if (saved_ec) {
1027 * which needs it, has fake EC._INI method, so use it as flag. 997 /* try to find good ECDT from ASUSTek */
1028 * Keep boot_ec struct as it will be needed soon. 998 if (saved_ec->command_addr != boot_ec->command_addr ||
1029 */ 999 saved_ec->data_addr != boot_ec->data_addr ||
1030 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy))) 1000 saved_ec->gpe != boot_ec->gpe ||
1031 return -ENODEV; 1001 saved_ec->handle != boot_ec->handle)
1002 pr_info(PREFIX "ASUSTek keeps feeding us with broken "
1003 "ECDT tables, which are very hard to workaround. "
1004 "Trying to use DSDT EC info instead. Please send "
1005 "output of acpidump to linux-acpi@vger.kernel.org\n");
1006 kfree(saved_ec);
1007 saved_ec = NULL;
1008 } else {
1009 /* We really need to limit this workaround, the only ASUS,
1010 * which needs it, has fake EC._INI method, so use it as flag.
1011 * Keep boot_ec struct as it will be needed soon.
1012 */
1013 acpi_handle dummy;
1014 if (!dmi_name_in_vendors("ASUS") ||
1015 ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI",
1016 &dummy)))
1017 return -ENODEV;
1018 }
1032install: 1019install:
1033 if (!ec_install_handlers(boot_ec)) { 1020 if (!ec_install_handlers(boot_ec)) {
1034 first_ec = boot_ec; 1021 first_ec = boot_ec;
diff --git a/drivers/acpi/main.c b/drivers/acpi/sleep.c
index 7e3c609cbef2..7e3c609cbef2 100644
--- a/drivers/acpi/main.c
+++ b/drivers/acpi/sleep.c
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 073ff09218a9..99e6f1f8ea45 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -416,7 +416,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
416 } 416 }
417 417
418 /* Passive (optional) */ 418 /* Passive (optional) */
419 if (flag & ACPI_TRIPS_PASSIVE) { 419 if (((flag & ACPI_TRIPS_PASSIVE) && tz->trips.passive.flags.valid) ||
420 (flag == ACPI_TRIPS_INIT)) {
420 valid = tz->trips.passive.flags.valid; 421 valid = tz->trips.passive.flags.valid;
421 if (psv == -1) { 422 if (psv == -1) {
422 status = AE_SUPPORT; 423 status = AE_SUPPORT;
@@ -462,8 +463,11 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
462 memset(&devices, 0, sizeof(struct acpi_handle_list)); 463 memset(&devices, 0, sizeof(struct acpi_handle_list));
463 status = acpi_evaluate_reference(tz->device->handle, "_PSL", 464 status = acpi_evaluate_reference(tz->device->handle, "_PSL",
464 NULL, &devices); 465 NULL, &devices);
465 if (ACPI_FAILURE(status)) 466 if (ACPI_FAILURE(status)) {
467 printk(KERN_WARNING PREFIX
468 "Invalid passive threshold\n");
466 tz->trips.passive.flags.valid = 0; 469 tz->trips.passive.flags.valid = 0;
470 }
467 else 471 else
468 tz->trips.passive.flags.valid = 1; 472 tz->trips.passive.flags.valid = 1;
469 473
@@ -487,7 +491,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
487 if (act == -1) 491 if (act == -1)
488 break; /* disable all active trip points */ 492 break; /* disable all active trip points */
489 493
490 if (flag & ACPI_TRIPS_ACTIVE) { 494 if ((flag == ACPI_TRIPS_INIT) || ((flag & ACPI_TRIPS_ACTIVE) &&
495 tz->trips.active[i].flags.valid)) {
491 status = acpi_evaluate_integer(tz->device->handle, 496 status = acpi_evaluate_integer(tz->device->handle,
492 name, NULL, &tmp); 497 name, NULL, &tmp);
493 if (ACPI_FAILURE(status)) { 498 if (ACPI_FAILURE(status)) {
@@ -521,8 +526,11 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
521 memset(&devices, 0, sizeof(struct acpi_handle_list)); 526 memset(&devices, 0, sizeof(struct acpi_handle_list));
522 status = acpi_evaluate_reference(tz->device->handle, 527 status = acpi_evaluate_reference(tz->device->handle,
523 name, NULL, &devices); 528 name, NULL, &devices);
524 if (ACPI_FAILURE(status)) 529 if (ACPI_FAILURE(status)) {
530 printk(KERN_WARNING PREFIX
531 "Invalid active%d threshold\n", i);
525 tz->trips.active[i].flags.valid = 0; 532 tz->trips.active[i].flags.valid = 0;
533 }
526 else 534 else
527 tz->trips.active[i].flags.valid = 1; 535 tz->trips.active[i].flags.valid = 1;
528 536
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 1a7be96d627b..503a908afc80 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -698,6 +698,15 @@ config PATA_IXP4XX_CF
698 698
699 If unsure, say N. 699 If unsure, say N.
700 700
701config PATA_OCTEON_CF
702 tristate "OCTEON Boot Bus Compact Flash support"
703 depends on CPU_CAVIUM_OCTEON
704 help
705 This option enables a polled compact flash driver for use with
706 compact flash cards attached to the OCTEON boot bus.
707
708 If unsure, say N.
709
701config PATA_SCC 710config PATA_SCC
702 tristate "Toshiba's Cell Reference Set IDE support" 711 tristate "Toshiba's Cell Reference Set IDE support"
703 depends on PCI && PPC_CELLEB 712 depends on PCI && PPC_CELLEB
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 674965fa326d..7f1ecf99528c 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o
69obj-$(CONFIG_PATA_SCC) += pata_scc.o 69obj-$(CONFIG_PATA_SCC) += pata_scc.o
70obj-$(CONFIG_PATA_SCH) += pata_sch.o 70obj-$(CONFIG_PATA_SCH) += pata_sch.o
71obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o 71obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o
72obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o
72obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o 73obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o
73obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o 74obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o
74obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o 75obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 71218d76d75e..88c242856dae 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3029,33 +3029,33 @@ int sata_set_spd(struct ata_link *link)
3029 */ 3029 */
3030 3030
3031static const struct ata_timing ata_timing[] = { 3031static const struct ata_timing ata_timing[] = {
3032/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960, 0 }, */ 3032/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 0, 960, 0 }, */
3033 { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0 }, 3033 { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 0, 600, 0 },
3034 { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 383, 0 }, 3034 { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 0, 383, 0 },
3035 { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 240, 0 }, 3035 { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 0, 240, 0 },
3036 { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 }, 3036 { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 0, 180, 0 },
3037 { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 }, 3037 { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 0, 120, 0 },
3038 { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 100, 0 }, 3038 { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 0, 100, 0 },
3039 { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 80, 0 }, 3039 { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 0, 80, 0 },
3040 3040
3041 { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, 3041 { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 50, 960, 0 },
3042 { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, 3042 { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 30, 480, 0 },
3043 { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 240, 0 }, 3043 { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 20, 240, 0 },
3044 3044
3045 { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 480, 0 }, 3045 { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 20, 480, 0 },
3046 { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 150, 0 }, 3046 { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 5, 150, 0 },
3047 { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 120, 0 }, 3047 { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 5, 120, 0 },
3048 { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 100, 0 }, 3048 { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 5, 100, 0 },
3049 { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 80, 0 }, 3049 { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 5, 80, 0 },
3050 3050
3051/* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 150 }, */ 3051/* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 0, 150 }, */
3052 { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, 3052 { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 0, 120 },
3053 { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 }, 3053 { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 0, 80 },
3054 { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 }, 3054 { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 0, 60 },
3055 { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, 3055 { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 0, 45 },
3056 { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, 3056 { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 0, 30 },
3057 { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 20 }, 3057 { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 0, 20 },
3058 { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 15 }, 3058 { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 0, 15 },
3059 3059
3060 { 0xFF } 3060 { 0xFF }
3061}; 3061};
@@ -3065,14 +3065,15 @@ static const struct ata_timing ata_timing[] = {
3065 3065
3066static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) 3066static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
3067{ 3067{
3068 q->setup = EZ(t->setup * 1000, T); 3068 q->setup = EZ(t->setup * 1000, T);
3069 q->act8b = EZ(t->act8b * 1000, T); 3069 q->act8b = EZ(t->act8b * 1000, T);
3070 q->rec8b = EZ(t->rec8b * 1000, T); 3070 q->rec8b = EZ(t->rec8b * 1000, T);
3071 q->cyc8b = EZ(t->cyc8b * 1000, T); 3071 q->cyc8b = EZ(t->cyc8b * 1000, T);
3072 q->active = EZ(t->active * 1000, T); 3072 q->active = EZ(t->active * 1000, T);
3073 q->recover = EZ(t->recover * 1000, T); 3073 q->recover = EZ(t->recover * 1000, T);
3074 q->cycle = EZ(t->cycle * 1000, T); 3074 q->dmack_hold = EZ(t->dmack_hold * 1000, T);
3075 q->udma = EZ(t->udma * 1000, UT); 3075 q->cycle = EZ(t->cycle * 1000, T);
3076 q->udma = EZ(t->udma * 1000, UT);
3076} 3077}
3077 3078
3078void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b, 3079void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
@@ -3084,6 +3085,7 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
3084 if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b); 3085 if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b);
3085 if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active); 3086 if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active);
3086 if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover); 3087 if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
3088 if (what & ATA_TIMING_DMACK_HOLD) m->dmack_hold = max(a->dmack_hold, b->dmack_hold);
3087 if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle); 3089 if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle);
3088 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); 3090 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
3089} 3091}
@@ -6638,7 +6640,6 @@ EXPORT_SYMBOL_GPL(ata_dev_pair);
6638EXPORT_SYMBOL_GPL(ata_port_disable); 6640EXPORT_SYMBOL_GPL(ata_port_disable);
6639EXPORT_SYMBOL_GPL(ata_ratelimit); 6641EXPORT_SYMBOL_GPL(ata_ratelimit);
6640EXPORT_SYMBOL_GPL(ata_wait_register); 6642EXPORT_SYMBOL_GPL(ata_wait_register);
6641EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
6642EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 6643EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
6643EXPORT_SYMBOL_GPL(ata_scsi_slave_config); 6644EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
6644EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy); 6645EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9e92107691f2..a1a6e6298c33 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -423,9 +423,9 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
423 * RETURNS: 423 * RETURNS:
424 * Zero on success, negative errno on error. 424 * Zero on success, negative errno on error.
425 */ 425 */
426static int ata_get_identity(struct scsi_device *sdev, void __user *arg) 426static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
427 void __user *arg)
427{ 428{
428 struct ata_port *ap = ata_shost_to_port(sdev->host);
429 struct ata_device *dev = ata_scsi_find_dev(ap, sdev); 429 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
430 u16 __user *dst = arg; 430 u16 __user *dst = arg;
431 char buf[40]; 431 char buf[40];
@@ -645,7 +645,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
645 return rc; 645 return rc;
646} 646}
647 647
648int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) 648int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev,
649 int cmd, void __user *arg)
649{ 650{
650 int val = -EINVAL, rc = -EINVAL; 651 int val = -EINVAL, rc = -EINVAL;
651 652
@@ -663,7 +664,7 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
663 return 0; 664 return 0;
664 665
665 case HDIO_GET_IDENTITY: 666 case HDIO_GET_IDENTITY:
666 return ata_get_identity(scsidev, arg); 667 return ata_get_identity(ap, scsidev, arg);
667 668
668 case HDIO_DRIVE_CMD: 669 case HDIO_DRIVE_CMD:
669 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 670 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
@@ -682,6 +683,14 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
682 683
683 return rc; 684 return rc;
684} 685}
686EXPORT_SYMBOL_GPL(ata_sas_scsi_ioctl);
687
688int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
689{
690 return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host),
691 scsidev, cmd, arg);
692}
693EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
685 694
686/** 695/**
687 * ata_scsi_qc_new - acquire new ata_queued_cmd reference 696 * ata_scsi_qc_new - acquire new ata_queued_cmd reference
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index a7999c19f0c9..eb99dbe78081 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -41,7 +41,7 @@ static int ali_atapi_dma = 0;
41module_param_named(atapi_dma, ali_atapi_dma, int, 0644); 41module_param_named(atapi_dma, ali_atapi_dma, int, 0644);
42MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); 42MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)");
43 43
44static struct pci_dev *isa_bridge; 44static struct pci_dev *ali_isa_bridge;
45 45
46/* 46/*
47 * Cable special cases 47 * Cable special cases
@@ -346,13 +346,13 @@ static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes)
346 int port_bit = 4 << link->ap->port_no; 346 int port_bit = 4 << link->ap->port_no;
347 347
348 /* If our bridge is an ALI 1533 then do the extra work */ 348 /* If our bridge is an ALI 1533 then do the extra work */
349 if (isa_bridge) { 349 if (ali_isa_bridge) {
350 /* Tristate and re-enable the bus signals */ 350 /* Tristate and re-enable the bus signals */
351 pci_read_config_byte(isa_bridge, 0x58, &r); 351 pci_read_config_byte(ali_isa_bridge, 0x58, &r);
352 r &= ~port_bit; 352 r &= ~port_bit;
353 pci_write_config_byte(isa_bridge, 0x58, r); 353 pci_write_config_byte(ali_isa_bridge, 0x58, r);
354 r |= port_bit; 354 r |= port_bit;
355 pci_write_config_byte(isa_bridge, 0x58, r); 355 pci_write_config_byte(ali_isa_bridge, 0x58, r);
356 } 356 }
357 ata_sff_postreset(link, classes); 357 ata_sff_postreset(link, classes);
358} 358}
@@ -467,14 +467,14 @@ static void ali_init_chipset(struct pci_dev *pdev)
467 pci_write_config_byte(pdev, 0x53, tmp); 467 pci_write_config_byte(pdev, 0x53, tmp);
468 } 468 }
469 north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); 469 north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
470 if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) { 470 if (north && north->vendor == PCI_VENDOR_ID_AL && ali_isa_bridge) {
471 /* Configure the ALi bridge logic. For non ALi rely on BIOS. 471 /* Configure the ALi bridge logic. For non ALi rely on BIOS.
472 Set the south bridge enable bit */ 472 Set the south bridge enable bit */
473 pci_read_config_byte(isa_bridge, 0x79, &tmp); 473 pci_read_config_byte(ali_isa_bridge, 0x79, &tmp);
474 if (pdev->revision == 0xC2) 474 if (pdev->revision == 0xC2)
475 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); 475 pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x04);
476 else if (pdev->revision > 0xC2 && pdev->revision < 0xC5) 476 else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
477 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); 477 pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x02);
478 } 478 }
479 pci_dev_put(north); 479 pci_dev_put(north);
480 ata_pci_bmdma_clear_simplex(pdev); 480 ata_pci_bmdma_clear_simplex(pdev);
@@ -571,9 +571,9 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
571 571
572 ali_init_chipset(pdev); 572 ali_init_chipset(pdev);
573 573
574 if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { 574 if (ali_isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
575 /* Are we paired with a UDMA capable chip */ 575 /* Are we paired with a UDMA capable chip */
576 pci_read_config_byte(isa_bridge, 0x5E, &tmp); 576 pci_read_config_byte(ali_isa_bridge, 0x5E, &tmp);
577 if ((tmp & 0x1E) == 0x12) 577 if ((tmp & 0x1E) == 0x12)
578 ppi[0] = &info_20_udma; 578 ppi[0] = &info_20_udma;
579 } 579 }
@@ -617,11 +617,11 @@ static struct pci_driver ali_pci_driver = {
617static int __init ali_init(void) 617static int __init ali_init(void)
618{ 618{
619 int ret; 619 int ret;
620 isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); 620 ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
621 621
622 ret = pci_register_driver(&ali_pci_driver); 622 ret = pci_register_driver(&ali_pci_driver);
623 if (ret < 0) 623 if (ret < 0)
624 pci_dev_put(isa_bridge); 624 pci_dev_put(ali_isa_bridge);
625 return ret; 625 return ret;
626} 626}
627 627
@@ -629,7 +629,7 @@ static int __init ali_init(void)
629static void __exit ali_exit(void) 629static void __exit ali_exit(void)
630{ 630{
631 pci_unregister_driver(&ali_pci_driver); 631 pci_unregister_driver(&ali_pci_driver);
632 pci_dev_put(isa_bridge); 632 pci_dev_put(ali_isa_bridge);
633} 633}
634 634
635 635
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 0e2cde8f9973..506adde8ebb3 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -32,21 +32,6 @@ enum {
32 ATIIXP_IDE_UDMA_MODE = 0x56 32 ATIIXP_IDE_UDMA_MODE = 0x56
33}; 33};
34 34
35static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline)
36{
37 struct ata_port *ap = link->ap;
38 static const struct pci_bits atiixp_enable_bits[] = {
39 { 0x48, 1, 0x01, 0x00 },
40 { 0x48, 1, 0x08, 0x00 }
41 };
42 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
43
44 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no]))
45 return -ENOENT;
46
47 return ata_sff_prereset(link, deadline);
48}
49
50static int atiixp_cable_detect(struct ata_port *ap) 35static int atiixp_cable_detect(struct ata_port *ap)
51{ 36{
52 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 37 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -229,10 +214,9 @@ static struct ata_port_operations atiixp_port_ops = {
229 .cable_detect = atiixp_cable_detect, 214 .cable_detect = atiixp_cable_detect,
230 .set_piomode = atiixp_set_piomode, 215 .set_piomode = atiixp_set_piomode,
231 .set_dmamode = atiixp_set_dmamode, 216 .set_dmamode = atiixp_set_dmamode,
232 .prereset = atiixp_pre_reset,
233}; 217};
234 218
235static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 219static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
236{ 220{
237 static const struct ata_port_info info = { 221 static const struct ata_port_info info = {
238 .flags = ATA_FLAG_SLAVE_POSS, 222 .flags = ATA_FLAG_SLAVE_POSS,
@@ -241,8 +225,18 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
241 .udma_mask = 0x3F, 225 .udma_mask = 0x3F,
242 .port_ops = &atiixp_port_ops 226 .port_ops = &atiixp_port_ops
243 }; 227 };
244 const struct ata_port_info *ppi[] = { &info, NULL }; 228 static const struct pci_bits atiixp_enable_bits[] = {
245 return ata_pci_sff_init_one(dev, ppi, &atiixp_sht, NULL); 229 { 0x48, 1, 0x01, 0x00 },
230 { 0x48, 1, 0x08, 0x00 }
231 };
232 const struct ata_port_info *ppi[] = { &info, &info };
233 int i;
234
235 for (i = 0; i < 2; i++)
236 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i]))
237 ppi[i] = &ata_dummy_port_info;
238
239 return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL);
246} 240}
247 241
248static const struct pci_device_id atiixp[] = { 242static const struct pci_device_id atiixp[] = {
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
new file mode 100644
index 000000000000..0fe4ef309c62
--- /dev/null
+++ b/drivers/ata/pata_octeon_cf.c
@@ -0,0 +1,965 @@
1/*
2 * Driver for the Octeon bootbus compact flash.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 - 2009 Cavium Networks
9 * Copyright (C) 2008 Wind River Systems
10 */
11
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/libata.h>
15#include <linux/irq.h>
16#include <linux/platform_device.h>
17#include <linux/workqueue.h>
18#include <scsi/scsi_host.h>
19
20#include <asm/octeon/octeon.h>
21
22/*
23 * The Octeon bootbus compact flash interface is connected in at least
24 * 3 different configurations on various evaluation boards:
25 *
26 * -- 8 bits no irq, no DMA
27 * -- 16 bits no irq, no DMA
28 * -- 16 bits True IDE mode with DMA, but no irq.
29 *
30 * In the last case the DMA engine can generate an interrupt when the
31 * transfer is complete. For the first two cases only PIO is supported.
32 *
33 */
34
35#define DRV_NAME "pata_octeon_cf"
36#define DRV_VERSION "2.1"
37
38
39struct octeon_cf_port {
40 struct workqueue_struct *wq;
41 struct delayed_work delayed_finish;
42 struct ata_port *ap;
43 int dma_finished;
44};
45
46static struct scsi_host_template octeon_cf_sht = {
47 ATA_PIO_SHT(DRV_NAME),
48};
49
50/**
51 * Convert nanosecond based time to setting used in the
52 * boot bus timing register, based on timing multiple
53 */
54static unsigned int ns_to_tim_reg(unsigned int tim_mult, unsigned int nsecs)
55{
56 unsigned int val;
57
58 /*
59 * Compute # of eclock periods to get desired duration in
60 * nanoseconds.
61 */
62 val = DIV_ROUND_UP(nsecs * (octeon_get_clock_rate() / 1000000),
63 1000 * tim_mult);
64
65 return val;
66}
67
68static void octeon_cf_set_boot_reg_cfg(int cs)
69{
70 union cvmx_mio_boot_reg_cfgx reg_cfg;
71 reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs));
72 reg_cfg.s.dmack = 0; /* Don't assert DMACK on access */
73 reg_cfg.s.tim_mult = 2; /* Timing mutiplier 2x */
74 reg_cfg.s.rd_dly = 0; /* Sample on falling edge of BOOT_OE */
75 reg_cfg.s.sam = 0; /* Don't combine write and output enable */
76 reg_cfg.s.we_ext = 0; /* No write enable extension */
77 reg_cfg.s.oe_ext = 0; /* No read enable extension */
78 reg_cfg.s.en = 1; /* Enable this region */
79 reg_cfg.s.orbit = 0; /* Don't combine with previous region */
80 reg_cfg.s.ale = 0; /* Don't do address multiplexing */
81 cvmx_write_csr(CVMX_MIO_BOOT_REG_CFGX(cs), reg_cfg.u64);
82}
83
84/**
85 * Called after libata determines the needed PIO mode. This
86 * function programs the Octeon bootbus regions to support the
87 * timing requirements of the PIO mode.
88 *
89 * @ap: ATA port information
90 * @dev: ATA device
91 */
92static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev)
93{
94 struct octeon_cf_data *ocd = ap->dev->platform_data;
95 union cvmx_mio_boot_reg_timx reg_tim;
96 int cs = ocd->base_region;
97 int T;
98 struct ata_timing timing;
99
100 int use_iordy;
101 int trh;
102 int pause;
103 /* These names are timing parameters from the ATA spec */
104 int t1;
105 int t2;
106 int t2i;
107
108 T = (int)(2000000000000LL / octeon_get_clock_rate());
109
110 if (ata_timing_compute(dev, dev->pio_mode, &timing, T, T))
111 BUG();
112
113 t1 = timing.setup;
114 if (t1)
115 t1--;
116 t2 = timing.active;
117 if (t2)
118 t2--;
119 t2i = timing.act8b;
120 if (t2i)
121 t2i--;
122
123 trh = ns_to_tim_reg(2, 20);
124 if (trh)
125 trh--;
126
127 pause = timing.cycle - timing.active - timing.setup - trh;
128 if (pause)
129 pause--;
130
131 octeon_cf_set_boot_reg_cfg(cs);
132 if (ocd->dma_engine >= 0)
133 /* True IDE mode, program both chip selects. */
134 octeon_cf_set_boot_reg_cfg(cs + 1);
135
136
137 use_iordy = ata_pio_need_iordy(dev);
138
139 reg_tim.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_TIMX(cs));
140 /* Disable page mode */
141 reg_tim.s.pagem = 0;
142 /* Enable dynamic timing */
143 reg_tim.s.waitm = use_iordy;
144 /* Pages are disabled */
145 reg_tim.s.pages = 0;
146 /* We don't use multiplexed address mode */
147 reg_tim.s.ale = 0;
148 /* Not used */
149 reg_tim.s.page = 0;
150 /* Time after IORDY to coninue to assert the data */
151 reg_tim.s.wait = 0;
152 /* Time to wait to complete the cycle. */
153 reg_tim.s.pause = pause;
154 /* How long to hold after a write to de-assert CE. */
155 reg_tim.s.wr_hld = trh;
156 /* How long to wait after a read to de-assert CE. */
157 reg_tim.s.rd_hld = trh;
158 /* How long write enable is asserted */
159 reg_tim.s.we = t2;
160 /* How long read enable is asserted */
161 reg_tim.s.oe = t2;
162 /* Time after CE that read/write starts */
163 reg_tim.s.ce = ns_to_tim_reg(2, 5);
164 /* Time before CE that address is valid */
165 reg_tim.s.adr = 0;
166
167 /* Program the bootbus region timing for the data port chip select. */
168 cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs), reg_tim.u64);
169 if (ocd->dma_engine >= 0)
170 /* True IDE mode, program both chip selects. */
171 cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs + 1), reg_tim.u64);
172}
173
174static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev)
175{
176 struct octeon_cf_data *ocd = dev->link->ap->dev->platform_data;
177 union cvmx_mio_boot_dma_timx dma_tim;
178 unsigned int oe_a;
179 unsigned int oe_n;
180 unsigned int dma_ackh;
181 unsigned int dma_arq;
182 unsigned int pause;
183 unsigned int T0, Tkr, Td;
184 unsigned int tim_mult;
185
186 const struct ata_timing *timing;
187
188 timing = ata_timing_find_mode(dev->dma_mode);
189 T0 = timing->cycle;
190 Td = timing->active;
191 Tkr = timing->recover;
192 dma_ackh = timing->dmack_hold;
193
194 dma_tim.u64 = 0;
195 /* dma_tim.s.tim_mult = 0 --> 4x */
196 tim_mult = 4;
197
198 /* not spec'ed, value in eclocks, not affected by tim_mult */
199 dma_arq = 8;
200 pause = 25 - dma_arq * 1000 /
201 (octeon_get_clock_rate() / 1000000); /* Tz */
202
203 oe_a = Td;
204 /* Tkr from cf spec, lengthened to meet T0 */
205 oe_n = max(T0 - oe_a, Tkr);
206
207 dma_tim.s.dmack_pi = 1;
208
209 dma_tim.s.oe_n = ns_to_tim_reg(tim_mult, oe_n);
210 dma_tim.s.oe_a = ns_to_tim_reg(tim_mult, oe_a);
211
212 /*
213 * This is tI, C.F. spec. says 0, but Sony CF card requires
214 * more, we use 20 nS.
215 */
216 dma_tim.s.dmack_s = ns_to_tim_reg(tim_mult, 20);;
217 dma_tim.s.dmack_h = ns_to_tim_reg(tim_mult, dma_ackh);
218
219 dma_tim.s.dmarq = dma_arq;
220 dma_tim.s.pause = ns_to_tim_reg(tim_mult, pause);
221
222 dma_tim.s.rd_dly = 0; /* Sample right on edge */
223
224 /* writes only */
225 dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n);
226 dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a);
227
228 pr_debug("ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
229 ns_to_tim_reg(tim_mult, 60));
230 pr_debug("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: "
231 "%d, dmarq: %d, pause: %d\n",
232 dma_tim.s.oe_n, dma_tim.s.oe_a, dma_tim.s.dmack_s,
233 dma_tim.s.dmack_h, dma_tim.s.dmarq, dma_tim.s.pause);
234
235 cvmx_write_csr(CVMX_MIO_BOOT_DMA_TIMX(ocd->dma_engine),
236 dma_tim.u64);
237
238}
239
240/**
241 * Handle an 8 bit I/O request.
242 *
243 * @dev: Device to access
244 * @buffer: Data buffer
245 * @buflen: Length of the buffer.
246 * @rw: True to write.
247 */
248static unsigned int octeon_cf_data_xfer8(struct ata_device *dev,
249 unsigned char *buffer,
250 unsigned int buflen,
251 int rw)
252{
253 struct ata_port *ap = dev->link->ap;
254 void __iomem *data_addr = ap->ioaddr.data_addr;
255 unsigned long words;
256 int count;
257
258 words = buflen;
259 if (rw) {
260 count = 16;
261 while (words--) {
262 iowrite8(*buffer, data_addr);
263 buffer++;
264 /*
265 * Every 16 writes do a read so the bootbus
266 * FIFO doesn't fill up.
267 */
268 if (--count == 0) {
269 ioread8(ap->ioaddr.altstatus_addr);
270 count = 16;
271 }
272 }
273 } else {
274 ioread8_rep(data_addr, buffer, words);
275 }
276 return buflen;
277}
278
279/**
280 * Handle a 16 bit I/O request.
281 *
282 * @dev: Device to access
283 * @buffer: Data buffer
284 * @buflen: Length of the buffer.
285 * @rw: True to write.
286 */
287static unsigned int octeon_cf_data_xfer16(struct ata_device *dev,
288 unsigned char *buffer,
289 unsigned int buflen,
290 int rw)
291{
292 struct ata_port *ap = dev->link->ap;
293 void __iomem *data_addr = ap->ioaddr.data_addr;
294 unsigned long words;
295 int count;
296
297 words = buflen / 2;
298 if (rw) {
299 count = 16;
300 while (words--) {
301 iowrite16(*(uint16_t *)buffer, data_addr);
302 buffer += sizeof(uint16_t);
303 /*
304 * Every 16 writes do a read so the bootbus
305 * FIFO doesn't fill up.
306 */
307 if (--count == 0) {
308 ioread8(ap->ioaddr.altstatus_addr);
309 count = 16;
310 }
311 }
312 } else {
313 while (words--) {
314 *(uint16_t *)buffer = ioread16(data_addr);
315 buffer += sizeof(uint16_t);
316 }
317 }
318 /* Transfer trailing 1 byte, if any. */
319 if (unlikely(buflen & 0x01)) {
320 __le16 align_buf[1] = { 0 };
321
322 if (rw == READ) {
323 align_buf[0] = cpu_to_le16(ioread16(data_addr));
324 memcpy(buffer, align_buf, 1);
325 } else {
326 memcpy(align_buf, buffer, 1);
327 iowrite16(le16_to_cpu(align_buf[0]), data_addr);
328 }
329 words++;
330 }
331 return buflen;
332}
333
334/**
335 * Read the taskfile for 16bit non-True IDE only.
336 */
337static void octeon_cf_tf_read16(struct ata_port *ap, struct ata_taskfile *tf)
338{
339 u16 blob;
340 /* The base of the registers is at ioaddr.data_addr. */
341 void __iomem *base = ap->ioaddr.data_addr;
342
343 blob = __raw_readw(base + 0xc);
344 tf->feature = blob >> 8;
345
346 blob = __raw_readw(base + 2);
347 tf->nsect = blob & 0xff;
348 tf->lbal = blob >> 8;
349
350 blob = __raw_readw(base + 4);
351 tf->lbam = blob & 0xff;
352 tf->lbah = blob >> 8;
353
354 blob = __raw_readw(base + 6);
355 tf->device = blob & 0xff;
356 tf->command = blob >> 8;
357
358 if (tf->flags & ATA_TFLAG_LBA48) {
359 if (likely(ap->ioaddr.ctl_addr)) {
360 iowrite8(tf->ctl | ATA_HOB, ap->ioaddr.ctl_addr);
361
362 blob = __raw_readw(base + 0xc);
363 tf->hob_feature = blob >> 8;
364
365 blob = __raw_readw(base + 2);
366 tf->hob_nsect = blob & 0xff;
367 tf->hob_lbal = blob >> 8;
368
369 blob = __raw_readw(base + 4);
370 tf->hob_lbam = blob & 0xff;
371 tf->hob_lbah = blob >> 8;
372
373 iowrite8(tf->ctl, ap->ioaddr.ctl_addr);
374 ap->last_ctl = tf->ctl;
375 } else {
376 WARN_ON(1);
377 }
378 }
379}
380
381static u8 octeon_cf_check_status16(struct ata_port *ap)
382{
383 u16 blob;
384 void __iomem *base = ap->ioaddr.data_addr;
385
386 blob = __raw_readw(base + 6);
387 return blob >> 8;
388}
389
390static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
391 unsigned long deadline)
392{
393 struct ata_port *ap = link->ap;
394 void __iomem *base = ap->ioaddr.data_addr;
395 int rc;
396 u8 err;
397
398 DPRINTK("about to softreset\n");
399 __raw_writew(ap->ctl, base + 0xe);
400 udelay(20);
401 __raw_writew(ap->ctl | ATA_SRST, base + 0xe);
402 udelay(20);
403 __raw_writew(ap->ctl, base + 0xe);
404
405 rc = ata_sff_wait_after_reset(link, 1, deadline);
406 if (rc) {
407 ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
408 return rc;
409 }
410
411 /* determine by signature whether we have ATA or ATAPI devices */
412 classes[0] = ata_sff_dev_classify(&link->device[0], 1, &err);
413 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
414 return 0;
415}
416
417/**
418 * Load the taskfile for 16bit non-True IDE only. The device_addr is
419 * not loaded, we do this as part of octeon_cf_exec_command16.
420 */
421static void octeon_cf_tf_load16(struct ata_port *ap,
422 const struct ata_taskfile *tf)
423{
424 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
425 /* The base of the registers is at ioaddr.data_addr. */
426 void __iomem *base = ap->ioaddr.data_addr;
427
428 if (tf->ctl != ap->last_ctl) {
429 iowrite8(tf->ctl, ap->ioaddr.ctl_addr);
430 ap->last_ctl = tf->ctl;
431 ata_wait_idle(ap);
432 }
433 if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
434 __raw_writew(tf->hob_feature << 8, base + 0xc);
435 __raw_writew(tf->hob_nsect | tf->hob_lbal << 8, base + 2);
436 __raw_writew(tf->hob_lbam | tf->hob_lbah << 8, base + 4);
437 VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
438 tf->hob_feature,
439 tf->hob_nsect,
440 tf->hob_lbal,
441 tf->hob_lbam,
442 tf->hob_lbah);
443 }
444 if (is_addr) {
445 __raw_writew(tf->feature << 8, base + 0xc);
446 __raw_writew(tf->nsect | tf->lbal << 8, base + 2);
447 __raw_writew(tf->lbam | tf->lbah << 8, base + 4);
448 VPRINTK("feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
449 tf->feature,
450 tf->nsect,
451 tf->lbal,
452 tf->lbam,
453 tf->lbah);
454 }
455 ata_wait_idle(ap);
456}
457
458
459static void octeon_cf_dev_select(struct ata_port *ap, unsigned int device)
460{
461/* There is only one device, do nothing. */
462 return;
463}
464
465/*
466 * Issue ATA command to host controller. The device_addr is also sent
467 * as it must be written in a combined write with the command.
468 */
469static void octeon_cf_exec_command16(struct ata_port *ap,
470 const struct ata_taskfile *tf)
471{
472 /* The base of the registers is at ioaddr.data_addr. */
473 void __iomem *base = ap->ioaddr.data_addr;
474 u16 blob;
475
476 if (tf->flags & ATA_TFLAG_DEVICE) {
477 VPRINTK("device 0x%X\n", tf->device);
478 blob = tf->device;
479 } else {
480 blob = 0;
481 }
482
483 DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
484 blob |= (tf->command << 8);
485 __raw_writew(blob, base + 6);
486
487
488 ata_wait_idle(ap);
489}
490
491static u8 octeon_cf_irq_on(struct ata_port *ap)
492{
493 return 0;
494}
495
496static void octeon_cf_irq_clear(struct ata_port *ap)
497{
498 return;
499}
500
501static void octeon_cf_dma_setup(struct ata_queued_cmd *qc)
502{
503 struct ata_port *ap = qc->ap;
504 struct octeon_cf_port *cf_port;
505
506 cf_port = (struct octeon_cf_port *)ap->private_data;
507 DPRINTK("ENTER\n");
508 /* issue r/w command */
509 qc->cursg = qc->sg;
510 cf_port->dma_finished = 0;
511 ap->ops->sff_exec_command(ap, &qc->tf);
512 DPRINTK("EXIT\n");
513}
514
515/**
516 * Start a DMA transfer that was already setup
517 *
518 * @qc: Information about the DMA
519 */
520static void octeon_cf_dma_start(struct ata_queued_cmd *qc)
521{
522 struct octeon_cf_data *ocd = qc->ap->dev->platform_data;
523 union cvmx_mio_boot_dma_cfgx mio_boot_dma_cfg;
524 union cvmx_mio_boot_dma_intx mio_boot_dma_int;
525 struct scatterlist *sg;
526
527 VPRINTK("%d scatterlists\n", qc->n_elem);
528
529 /* Get the scatter list entry we need to DMA into */
530 sg = qc->cursg;
531 BUG_ON(!sg);
532
533 /*
534 * Clear the DMA complete status.
535 */
536 mio_boot_dma_int.u64 = 0;
537 mio_boot_dma_int.s.done = 1;
538 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine),
539 mio_boot_dma_int.u64);
540
541 /* Enable the interrupt. */
542 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine),
543 mio_boot_dma_int.u64);
544
545 /* Set the direction of the DMA */
546 mio_boot_dma_cfg.u64 = 0;
547 mio_boot_dma_cfg.s.en = 1;
548 mio_boot_dma_cfg.s.rw = ((qc->tf.flags & ATA_TFLAG_WRITE) != 0);
549
550 /*
551 * Don't stop the DMA if the device deasserts DMARQ. Many
552 * compact flashes deassert DMARQ for a short time between
553 * sectors. Instead of stopping and restarting the DMA, we'll
554 * let the hardware do it. If the DMA is really stopped early
555 * due to an error condition, a later timeout will force us to
556 * stop.
557 */
558 mio_boot_dma_cfg.s.clr = 0;
559
560 /* Size is specified in 16bit words and minus one notation */
561 mio_boot_dma_cfg.s.size = sg_dma_len(sg) / 2 - 1;
562
563 /* We need to swap the high and low bytes of every 16 bits */
564 mio_boot_dma_cfg.s.swap8 = 1;
565
566 mio_boot_dma_cfg.s.adr = sg_dma_address(sg);
567
568 VPRINTK("%s %d bytes address=%p\n",
569 (mio_boot_dma_cfg.s.rw) ? "write" : "read", sg->length,
570 (void *)(unsigned long)mio_boot_dma_cfg.s.adr);
571
572 cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine),
573 mio_boot_dma_cfg.u64);
574}
575
576/**
577 *
578 * LOCKING:
579 * spin_lock_irqsave(host lock)
580 *
581 */
582static unsigned int octeon_cf_dma_finished(struct ata_port *ap,
583 struct ata_queued_cmd *qc)
584{
585 struct ata_eh_info *ehi = &ap->link.eh_info;
586 struct octeon_cf_data *ocd = ap->dev->platform_data;
587 union cvmx_mio_boot_dma_cfgx dma_cfg;
588 union cvmx_mio_boot_dma_intx dma_int;
589 struct octeon_cf_port *cf_port;
590 u8 status;
591
592 VPRINTK("ata%u: protocol %d task_state %d\n",
593 ap->print_id, qc->tf.protocol, ap->hsm_task_state);
594
595
596 if (ap->hsm_task_state != HSM_ST_LAST)
597 return 0;
598
599 cf_port = (struct octeon_cf_port *)ap->private_data;
600
601 dma_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine));
602 if (dma_cfg.s.size != 0xfffff) {
603 /* Error, the transfer was not complete. */
604 qc->err_mask |= AC_ERR_HOST_BUS;
605 ap->hsm_task_state = HSM_ST_ERR;
606 }
607
608 /* Stop and clear the dma engine. */
609 dma_cfg.u64 = 0;
610 dma_cfg.s.size = -1;
611 cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine), dma_cfg.u64);
612
613 /* Disable the interrupt. */
614 dma_int.u64 = 0;
615 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine), dma_int.u64);
616
617 /* Clear the DMA complete status */
618 dma_int.s.done = 1;
619 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine), dma_int.u64);
620
621 status = ap->ops->sff_check_status(ap);
622
623 ata_sff_hsm_move(ap, qc, status, 0);
624
625 if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA))
626 ata_ehi_push_desc(ehi, "DMA stat 0x%x", status);
627
628 return 1;
629}
630
631/*
632 * Check if any queued commands have more DMAs, if so start the next
633 * transfer, else do end of transfer handling.
634 */
635static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
636{
637 struct ata_host *host = dev_instance;
638 struct octeon_cf_port *cf_port;
639 int i;
640 unsigned int handled = 0;
641 unsigned long flags;
642
643 spin_lock_irqsave(&host->lock, flags);
644
645 DPRINTK("ENTER\n");
646 for (i = 0; i < host->n_ports; i++) {
647 u8 status;
648 struct ata_port *ap;
649 struct ata_queued_cmd *qc;
650 union cvmx_mio_boot_dma_intx dma_int;
651 union cvmx_mio_boot_dma_cfgx dma_cfg;
652 struct octeon_cf_data *ocd;
653
654 ap = host->ports[i];
655 ocd = ap->dev->platform_data;
656 if (!ap || (ap->flags & ATA_FLAG_DISABLED))
657 continue;
658
659 ocd = ap->dev->platform_data;
660 cf_port = (struct octeon_cf_port *)ap->private_data;
661 dma_int.u64 =
662 cvmx_read_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine));
663 dma_cfg.u64 =
664 cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine));
665
666 qc = ata_qc_from_tag(ap, ap->link.active_tag);
667
668 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
669 (qc->flags & ATA_QCFLAG_ACTIVE)) {
670 if (dma_int.s.done && !dma_cfg.s.en) {
671 if (!sg_is_last(qc->cursg)) {
672 qc->cursg = sg_next(qc->cursg);
673 handled = 1;
674 octeon_cf_dma_start(qc);
675 continue;
676 } else {
677 cf_port->dma_finished = 1;
678 }
679 }
680 if (!cf_port->dma_finished)
681 continue;
682 status = ioread8(ap->ioaddr.altstatus_addr);
683 if (status & (ATA_BUSY | ATA_DRQ)) {
684 /*
685 * We are busy, try to handle it
686 * later. This is the DMA finished
687 * interrupt, and it could take a
688 * little while for the card to be
689 * ready for more commands.
690 */
691 /* Clear DMA irq. */
692 dma_int.u64 = 0;
693 dma_int.s.done = 1;
694 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine),
695 dma_int.u64);
696
697 queue_delayed_work(cf_port->wq,
698 &cf_port->delayed_finish, 1);
699 handled = 1;
700 } else {
701 handled |= octeon_cf_dma_finished(ap, qc);
702 }
703 }
704 }
705 spin_unlock_irqrestore(&host->lock, flags);
706 DPRINTK("EXIT\n");
707 return IRQ_RETVAL(handled);
708}
709
710static void octeon_cf_delayed_finish(struct work_struct *work)
711{
712 struct octeon_cf_port *cf_port = container_of(work,
713 struct octeon_cf_port,
714 delayed_finish.work);
715 struct ata_port *ap = cf_port->ap;
716 struct ata_host *host = ap->host;
717 struct ata_queued_cmd *qc;
718 unsigned long flags;
719 u8 status;
720
721 spin_lock_irqsave(&host->lock, flags);
722
723 /*
724 * If the port is not waiting for completion, it must have
725 * handled it previously. The hsm_task_state is
726 * protected by host->lock.
727 */
728 if (ap->hsm_task_state != HSM_ST_LAST || !cf_port->dma_finished)
729 goto out;
730
731 status = ioread8(ap->ioaddr.altstatus_addr);
732 if (status & (ATA_BUSY | ATA_DRQ)) {
733 /* Still busy, try again. */
734 queue_delayed_work(cf_port->wq,
735 &cf_port->delayed_finish, 1);
736 goto out;
737 }
738 qc = ata_qc_from_tag(ap, ap->link.active_tag);
739 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
740 (qc->flags & ATA_QCFLAG_ACTIVE))
741 octeon_cf_dma_finished(ap, qc);
742out:
743 spin_unlock_irqrestore(&host->lock, flags);
744}
745
746static void octeon_cf_dev_config(struct ata_device *dev)
747{
748 /*
749 * A maximum of 2^20 - 1 16 bit transfers are possible with
750 * the bootbus DMA. So we need to throttle max_sectors to
751 * (2^12 - 1 == 4095) to assure that this can never happen.
752 */
753 dev->max_sectors = min(dev->max_sectors, 4095U);
754}
755
756/*
757 * Trap if driver tries to do standard bmdma commands. They are not
758 * supported.
759 */
760static void unreachable_qc(struct ata_queued_cmd *qc)
761{
762 BUG();
763}
764
765static u8 unreachable_port(struct ata_port *ap)
766{
767 BUG();
768}
769
770/*
771 * We don't do ATAPI DMA so return 0.
772 */
773static int octeon_cf_check_atapi_dma(struct ata_queued_cmd *qc)
774{
775 return 0;
776}
777
778static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc)
779{
780 struct ata_port *ap = qc->ap;
781
782 switch (qc->tf.protocol) {
783 case ATA_PROT_DMA:
784 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
785
786 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */
787 octeon_cf_dma_setup(qc); /* set up dma */
788 octeon_cf_dma_start(qc); /* initiate dma */
789 ap->hsm_task_state = HSM_ST_LAST;
790 break;
791
792 case ATAPI_PROT_DMA:
793 dev_err(ap->dev, "Error, ATAPI not supported\n");
794 BUG();
795
796 default:
797 return ata_sff_qc_issue(qc);
798 }
799
800 return 0;
801}
802
803static struct ata_port_operations octeon_cf_ops = {
804 .inherits = &ata_sff_port_ops,
805 .check_atapi_dma = octeon_cf_check_atapi_dma,
806 .qc_prep = ata_noop_qc_prep,
807 .qc_issue = octeon_cf_qc_issue,
808 .sff_dev_select = octeon_cf_dev_select,
809 .sff_irq_on = octeon_cf_irq_on,
810 .sff_irq_clear = octeon_cf_irq_clear,
811 .bmdma_setup = unreachable_qc,
812 .bmdma_start = unreachable_qc,
813 .bmdma_stop = unreachable_qc,
814 .bmdma_status = unreachable_port,
815 .cable_detect = ata_cable_40wire,
816 .set_piomode = octeon_cf_set_piomode,
817 .set_dmamode = octeon_cf_set_dmamode,
818 .dev_config = octeon_cf_dev_config,
819};
820
821static int __devinit octeon_cf_probe(struct platform_device *pdev)
822{
823 struct resource *res_cs0, *res_cs1;
824
825 void __iomem *cs0;
826 void __iomem *cs1 = NULL;
827 struct ata_host *host;
828 struct ata_port *ap;
829 struct octeon_cf_data *ocd;
830 int irq = 0;
831 irq_handler_t irq_handler = NULL;
832 void __iomem *base;
833 struct octeon_cf_port *cf_port;
834
835 res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
836
837 if (!res_cs0)
838 return -EINVAL;
839
840 ocd = pdev->dev.platform_data;
841
842 cs0 = devm_ioremap_nocache(&pdev->dev, res_cs0->start,
843 res_cs0->end - res_cs0->start + 1);
844
845 if (!cs0)
846 return -ENOMEM;
847
848 /* Determine from availability of DMA if True IDE mode or not */
849 if (ocd->dma_engine >= 0) {
850 res_cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
851 if (!res_cs1)
852 return -EINVAL;
853
854 cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start,
855 res_cs0->end - res_cs1->start + 1);
856
857 if (!cs1)
858 return -ENOMEM;
859 }
860
861 cf_port = kzalloc(sizeof(*cf_port), GFP_KERNEL);
862 if (!cf_port)
863 return -ENOMEM;
864
865 /* allocate host */
866 host = ata_host_alloc(&pdev->dev, 1);
867 if (!host)
868 goto free_cf_port;
869
870 ap = host->ports[0];
871 ap->private_data = cf_port;
872 cf_port->ap = ap;
873 ap->ops = &octeon_cf_ops;
874 ap->pio_mask = 0x7f; /* Support PIO 0-6 */
875 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY
876 | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING;
877
878 base = cs0 + ocd->base_region_bias;
879 if (!ocd->is16bit) {
880 ap->ioaddr.cmd_addr = base;
881 ata_sff_std_ports(&ap->ioaddr);
882
883 ap->ioaddr.altstatus_addr = base + 0xe;
884 ap->ioaddr.ctl_addr = base + 0xe;
885 octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer8;
886 } else if (cs1) {
887 /* Presence of cs1 indicates True IDE mode. */
888 ap->ioaddr.cmd_addr = base + (ATA_REG_CMD << 1) + 1;
889 ap->ioaddr.data_addr = base + (ATA_REG_DATA << 1);
890 ap->ioaddr.error_addr = base + (ATA_REG_ERR << 1) + 1;
891 ap->ioaddr.feature_addr = base + (ATA_REG_FEATURE << 1) + 1;
892 ap->ioaddr.nsect_addr = base + (ATA_REG_NSECT << 1) + 1;
893 ap->ioaddr.lbal_addr = base + (ATA_REG_LBAL << 1) + 1;
894 ap->ioaddr.lbam_addr = base + (ATA_REG_LBAM << 1) + 1;
895 ap->ioaddr.lbah_addr = base + (ATA_REG_LBAH << 1) + 1;
896 ap->ioaddr.device_addr = base + (ATA_REG_DEVICE << 1) + 1;
897 ap->ioaddr.status_addr = base + (ATA_REG_STATUS << 1) + 1;
898 ap->ioaddr.command_addr = base + (ATA_REG_CMD << 1) + 1;
899 ap->ioaddr.altstatus_addr = cs1 + (6 << 1) + 1;
900 ap->ioaddr.ctl_addr = cs1 + (6 << 1) + 1;
901 octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16;
902
903 ap->mwdma_mask = 0x1f; /* Support MWDMA 0-4 */
904 irq = platform_get_irq(pdev, 0);
905 irq_handler = octeon_cf_interrupt;
906
907 /* True IDE mode needs delayed work to poll for not-busy. */
908 cf_port->wq = create_singlethread_workqueue(DRV_NAME);
909 if (!cf_port->wq)
910 goto free_cf_port;
911 INIT_DELAYED_WORK(&cf_port->delayed_finish,
912 octeon_cf_delayed_finish);
913
914 } else {
915 /* 16 bit but not True IDE */
916 octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16;
917 octeon_cf_ops.softreset = octeon_cf_softreset16;
918 octeon_cf_ops.sff_check_status = octeon_cf_check_status16;
919 octeon_cf_ops.sff_tf_read = octeon_cf_tf_read16;
920 octeon_cf_ops.sff_tf_load = octeon_cf_tf_load16;
921 octeon_cf_ops.sff_exec_command = octeon_cf_exec_command16;
922
923 ap->ioaddr.data_addr = base + ATA_REG_DATA;
924 ap->ioaddr.nsect_addr = base + ATA_REG_NSECT;
925 ap->ioaddr.lbal_addr = base + ATA_REG_LBAL;
926 ap->ioaddr.ctl_addr = base + 0xe;
927 ap->ioaddr.altstatus_addr = base + 0xe;
928 }
929
930 ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
931
932
933 dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
934 (ocd->is16bit) ? 16 : 8,
935 (cs1) ? ", True IDE" : "");
936
937
938 return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht);
939
940free_cf_port:
941 kfree(cf_port);
942 return -ENOMEM;
943}
944
945static struct platform_driver octeon_cf_driver = {
946 .probe = octeon_cf_probe,
947 .driver = {
948 .name = DRV_NAME,
949 .owner = THIS_MODULE,
950 },
951};
952
953static int __init octeon_cf_init(void)
954{
955 return platform_driver_register(&octeon_cf_driver);
956}
957
958
959MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
960MODULE_DESCRIPTION("low-level driver for Cavium OCTEON Compact Flash PATA");
961MODULE_LICENSE("GPL");
962MODULE_VERSION(DRV_VERSION);
963MODULE_ALIAS("platform:" DRV_NAME);
964
965module_init(octeon_cf_init);
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 1a56db92ff7a..55bc88c1707b 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1288,7 +1288,7 @@ static const struct ata_port_info sata_fsl_port_info[] = {
1288static int sata_fsl_probe(struct of_device *ofdev, 1288static int sata_fsl_probe(struct of_device *ofdev,
1289 const struct of_device_id *match) 1289 const struct of_device_id *match)
1290{ 1290{
1291 int retval = 0; 1291 int retval = -ENXIO;
1292 void __iomem *hcr_base = NULL; 1292 void __iomem *hcr_base = NULL;
1293 void __iomem *ssr_base = NULL; 1293 void __iomem *ssr_base = NULL;
1294 void __iomem *csr_base = NULL; 1294 void __iomem *csr_base = NULL;
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index c18935f0bda2..5c62da9cd491 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -92,6 +92,8 @@ static const struct pci_device_id svia_pci_tbl[] = {
92 { PCI_VDEVICE(VIA, 0x5372), vt6420 }, 92 { PCI_VDEVICE(VIA, 0x5372), vt6420 },
93 { PCI_VDEVICE(VIA, 0x7372), vt6420 }, 93 { PCI_VDEVICE(VIA, 0x7372), vt6420 },
94 { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */ 94 { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */
95 { PCI_VDEVICE(VIA, 0x9000), vt8251 },
96 { PCI_VDEVICE(VIA, 0x9040), vt8251 },
95 97
96 { } /* terminate list */ 98 { } /* terminate list */
97}; 99};
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7bcc1d8bc967..34f80fa6fed1 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -406,6 +406,7 @@ static int nbd_do_it(struct nbd_device *lo)
406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); 406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
407 if (ret) { 407 if (ret) {
408 printk(KERN_ERR "nbd: sysfs_create_file failed!"); 408 printk(KERN_ERR "nbd: sysfs_create_file failed!");
409 lo->pid = 0;
409 return ret; 410 return ret;
410 } 411 }
411 412
@@ -413,6 +414,7 @@ static int nbd_do_it(struct nbd_device *lo)
413 nbd_end_request(req); 414 nbd_end_request(req);
414 415
415 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); 416 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
417 lo->pid = 0;
416 return 0; 418 return 0;
417} 419}
418 420
@@ -648,6 +650,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
648 set_capacity(lo->disk, lo->bytesize >> 9); 650 set_capacity(lo->disk, lo->bytesize >> 9);
649 return 0; 651 return 0;
650 case NBD_DO_IT: 652 case NBD_DO_IT:
653 if (lo->pid)
654 return -EBUSY;
651 if (!lo->file) 655 if (!lo->file)
652 return -EINVAL; 656 return -EINVAL;
653 thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); 657 thread = kthread_create(nbd_thread, lo, lo->disk->disk_name);
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index 936466f62afd..bccc42bb9212 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -141,7 +141,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
141 141
142 start_sector = req->sector * priv->blocking_factor; 142 start_sector = req->sector * priv->blocking_factor;
143 sectors = req->nr_sectors * priv->blocking_factor; 143 sectors = req->nr_sectors * priv->blocking_factor;
144 dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n", 144 dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n",
145 __func__, __LINE__, op, sectors, start_sector); 145 __func__, __LINE__, op, sectors, start_sector);
146 146
147 if (write) { 147 if (write) {
@@ -178,7 +178,7 @@ static int ps3disk_submit_flush_request(struct ps3_storage_device *dev,
178 LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 178 LV1_STORAGE_ATA_HDDOUT, 0, 0, 0,
179 0, &dev->tag); 179 0, &dev->tag);
180 if (res) { 180 if (res) {
181 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n", 181 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n",
182 __func__, __LINE__, res); 182 __func__, __LINE__, res);
183 end_request(req, 0); 183 end_request(req, 0);
184 return 0; 184 return 0;
@@ -238,11 +238,11 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
238 238
239 if (tag != dev->tag) 239 if (tag != dev->tag)
240 dev_err(&dev->sbd.core, 240 dev_err(&dev->sbd.core,
241 "%s:%u: tag mismatch, got %lx, expected %lx\n", 241 "%s:%u: tag mismatch, got %llx, expected %llx\n",
242 __func__, __LINE__, tag, dev->tag); 242 __func__, __LINE__, tag, dev->tag);
243 243
244 if (res) { 244 if (res) {
245 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", 245 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
246 __func__, __LINE__, res, status); 246 __func__, __LINE__, res, status);
247 return IRQ_HANDLED; 247 return IRQ_HANDLED;
248 } 248 }
@@ -269,7 +269,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
269 op = read ? "read" : "write"; 269 op = read ? "read" : "write";
270 } 270 }
271 if (status) { 271 if (status) {
272 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 272 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
273 __LINE__, op, status); 273 __LINE__, op, status);
274 error = -EIO; 274 error = -EIO;
275 } else { 275 } else {
@@ -297,7 +297,7 @@ static int ps3disk_sync_cache(struct ps3_storage_device *dev)
297 297
298 res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0); 298 res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0);
299 if (res) { 299 if (res) {
300 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n", 300 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n",
301 __func__, __LINE__, res); 301 __func__, __LINE__, res);
302 return -EIO; 302 return -EIO;
303 } 303 }
@@ -388,7 +388,7 @@ static int ps3disk_identify(struct ps3_storage_device *dev)
388 sizeof(ata_cmnd), ata_cmnd.buffer, 388 sizeof(ata_cmnd), ata_cmnd.buffer,
389 ata_cmnd.arglen); 389 ata_cmnd.arglen);
390 if (res) { 390 if (res) {
391 dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%lx\n", 391 dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%llx\n",
392 __func__, __LINE__, res); 392 __func__, __LINE__, res);
393 return -EIO; 393 return -EIO;
394 } 394 }
@@ -426,7 +426,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
426 426
427 if (dev->blk_size < 512) { 427 if (dev->blk_size < 512) {
428 dev_err(&dev->sbd.core, 428 dev_err(&dev->sbd.core,
429 "%s:%u: cannot handle block size %lu\n", __func__, 429 "%s:%u: cannot handle block size %llu\n", __func__,
430 __LINE__, dev->blk_size); 430 __LINE__, dev->blk_size);
431 return -EINVAL; 431 return -EINVAL;
432 } 432 }
@@ -512,7 +512,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
512 dev->regions[dev->region_idx].size*priv->blocking_factor); 512 dev->regions[dev->region_idx].size*priv->blocking_factor);
513 513
514 dev_info(&dev->sbd.core, 514 dev_info(&dev->sbd.core,
515 "%s is a %s (%lu MiB total, %lu MiB for OtherOS)\n", 515 "%s is a %s (%llu MiB total, %lu MiB for OtherOS)\n",
516 gendisk->disk_name, priv->model, priv->raw_capacity >> 11, 516 gendisk->disk_name, priv->model, priv->raw_capacity >> 11,
517 get_capacity(gendisk) >> 11); 517 get_capacity(gendisk) >> 11);
518 518
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 29e1dfafb7c6..381d686fc1a3 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1206,6 +1206,7 @@ static struct of_device_id ace_of_match[] __devinitdata = {
1206 { .compatible = "xlnx,opb-sysace-1.00.b", }, 1206 { .compatible = "xlnx,opb-sysace-1.00.b", },
1207 { .compatible = "xlnx,opb-sysace-1.00.c", }, 1207 { .compatible = "xlnx,opb-sysace-1.00.c", },
1208 { .compatible = "xlnx,xps-sysace-1.00.a", }, 1208 { .compatible = "xlnx,xps-sysace-1.00.a", },
1209 { .compatible = "xlnx,sysace", },
1209 {}, 1210 {},
1210}; 1211};
1211MODULE_DEVICE_TABLE(of, ace_of_match); 1212MODULE_DEVICE_TABLE(of, ace_of_match);
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 977dfb1096a0..f6094ae0ef33 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -103,7 +103,7 @@ static ssize_t
103bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) 103bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf)
104{ 104{
105 struct bsr_dev *bsr_dev = dev_get_drvdata(dev); 105 struct bsr_dev *bsr_dev = dev_get_drvdata(dev);
106 return sprintf(buf, "%lu\n", bsr_dev->bsr_len); 106 return sprintf(buf, "%llu\n", bsr_dev->bsr_len);
107} 107}
108 108
109static struct device_attribute bsr_dev_attrs[] = { 109static struct device_attribute bsr_dev_attrs[] = {
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 5a8a4c28c867..94e7e3c8c05a 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -318,7 +318,6 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
318 } /* else count == 0 */ 318 } /* else count == 0 */
319 319
320 tty->driver_data = hp; 320 tty->driver_data = hp;
321 tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */
322 321
323 hp->tty = tty; 322 hp->tty = tty;
324 323
@@ -764,13 +763,11 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data,
764 return ERR_PTR(err); 763 return ERR_PTR(err);
765 } 764 }
766 765
767 hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, 766 hp = kzalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
768 GFP_KERNEL); 767 GFP_KERNEL);
769 if (!hp) 768 if (!hp)
770 return ERR_PTR(-ENOMEM); 769 return ERR_PTR(-ENOMEM);
771 770
772 memset(hp, 0x00, sizeof(*hp));
773
774 hp->vtermno = vtermno; 771 hp->vtermno = vtermno;
775 hp->data = data; 772 hp->data = data;
776 hp->ops = ops; 773 hp->ops = ops;
@@ -876,8 +873,11 @@ static int hvc_init(void)
876 goto stop_thread; 873 goto stop_thread;
877 } 874 }
878 875
879 /* FIXME: This mb() seems completely random. Remove it. */ 876 /*
880 mb(); 877 * Make sure tty is fully registered before allowing it to be
878 * found by hvc_console_device.
879 */
880 smp_mb();
881 hvc_driver = drv; 881 hvc_driver = drv;
882 return 0; 882 return 0;
883 883
diff --git a/drivers/char/hvc_irq.c b/drivers/char/hvc_irq.c
index d09e5688d449..2623e177e8d6 100644
--- a/drivers/char/hvc_irq.c
+++ b/drivers/char/hvc_irq.c
@@ -37,7 +37,7 @@ int notifier_add_irq(struct hvc_struct *hp, int irq)
37 37
38void notifier_del_irq(struct hvc_struct *hp, int irq) 38void notifier_del_irq(struct hvc_struct *hp, int irq)
39{ 39{
40 if (!irq) 40 if (!hp->irq_requested)
41 return; 41 return;
42 free_irq(irq, hp); 42 free_irq(irq, hp);
43 hp->irq_requested = 0; 43 hp->irq_requested = 0;
diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c
index 79b6f461be75..afbe45676d71 100644
--- a/drivers/char/ps3flash.c
+++ b/drivers/char/ps3flash.c
@@ -44,7 +44,7 @@ static ssize_t ps3flash_read_write_sectors(struct ps3_storage_device *dev,
44 u64 res = ps3stor_read_write_sectors(dev, lpar, start_sector, sectors, 44 u64 res = ps3stor_read_write_sectors(dev, lpar, start_sector, sectors,
45 write); 45 write);
46 if (res) { 46 if (res) {
47 dev_err(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 47 dev_err(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
48 __LINE__, write ? "write" : "read", res); 48 __LINE__, write ? "write" : "read", res);
49 return -EIO; 49 return -EIO;
50 } 50 }
@@ -59,7 +59,7 @@ static ssize_t ps3flash_read_sectors(struct ps3_storage_device *dev,
59 59
60 max_sectors = dev->bounce_size / dev->blk_size; 60 max_sectors = dev->bounce_size / dev->blk_size;
61 if (sectors > max_sectors) { 61 if (sectors > max_sectors) {
62 dev_dbg(&dev->sbd.core, "%s:%u Limiting sectors to %lu\n", 62 dev_dbg(&dev->sbd.core, "%s:%u Limiting sectors to %llu\n",
63 __func__, __LINE__, max_sectors); 63 __func__, __LINE__, max_sectors);
64 sectors = max_sectors; 64 sectors = max_sectors;
65 } 65 }
@@ -144,7 +144,7 @@ static ssize_t ps3flash_read(struct file *file, char __user *buf, size_t count,
144 goto fail; 144 goto fail;
145 } 145 }
146 146
147 n = min(remaining, sectors_read*dev->blk_size-offset); 147 n = min_t(u64, remaining, sectors_read*dev->blk_size-offset);
148 dev_dbg(&dev->sbd.core, 148 dev_dbg(&dev->sbd.core,
149 "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n", 149 "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n",
150 __func__, __LINE__, n, dev->bounce_buf+offset, buf); 150 __func__, __LINE__, n, dev->bounce_buf+offset, buf);
@@ -225,7 +225,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
225 if (end_read_sector >= start_read_sector) { 225 if (end_read_sector >= start_read_sector) {
226 /* Merge head and tail */ 226 /* Merge head and tail */
227 dev_dbg(&dev->sbd.core, 227 dev_dbg(&dev->sbd.core,
228 "Merged head and tail: %lu sectors at %lu\n", 228 "Merged head and tail: %llu sectors at %llu\n",
229 chunk_sectors, start_write_sector); 229 chunk_sectors, start_write_sector);
230 res = ps3flash_read_sectors(dev, start_write_sector, 230 res = ps3flash_read_sectors(dev, start_write_sector,
231 chunk_sectors, 0); 231 chunk_sectors, 0);
@@ -235,7 +235,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
235 if (head) { 235 if (head) {
236 /* Read head */ 236 /* Read head */
237 dev_dbg(&dev->sbd.core, 237 dev_dbg(&dev->sbd.core,
238 "head: %lu sectors at %lu\n", head, 238 "head: %llu sectors at %llu\n", head,
239 start_write_sector); 239 start_write_sector);
240 res = ps3flash_read_sectors(dev, 240 res = ps3flash_read_sectors(dev,
241 start_write_sector, 241 start_write_sector,
@@ -247,7 +247,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
247 start_write_sector+chunk_sectors) { 247 start_write_sector+chunk_sectors) {
248 /* Read tail */ 248 /* Read tail */
249 dev_dbg(&dev->sbd.core, 249 dev_dbg(&dev->sbd.core,
250 "tail: %lu sectors at %lu\n", tail, 250 "tail: %llu sectors at %llu\n", tail,
251 start_read_sector); 251 start_read_sector);
252 sec_off = start_read_sector-start_write_sector; 252 sec_off = start_read_sector-start_write_sector;
253 res = ps3flash_read_sectors(dev, 253 res = ps3flash_read_sectors(dev,
@@ -258,7 +258,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
258 } 258 }
259 } 259 }
260 260
261 n = min(remaining, dev->bounce_size-offset); 261 n = min_t(u64, remaining, dev->bounce_size-offset);
262 dev_dbg(&dev->sbd.core, 262 dev_dbg(&dev->sbd.core,
263 "%s:%u: copy %lu bytes from user 0x%p to 0x%p\n", 263 "%s:%u: copy %lu bytes from user 0x%p to 0x%p\n",
264 __func__, __LINE__, n, buf, dev->bounce_buf+offset); 264 __func__, __LINE__, n, buf, dev->bounce_buf+offset);
@@ -299,11 +299,11 @@ static irqreturn_t ps3flash_interrupt(int irq, void *data)
299 299
300 if (tag != dev->tag) 300 if (tag != dev->tag)
301 dev_err(&dev->sbd.core, 301 dev_err(&dev->sbd.core,
302 "%s:%u: tag mismatch, got %lx, expected %lx\n", 302 "%s:%u: tag mismatch, got %llx, expected %llx\n",
303 __func__, __LINE__, tag, dev->tag); 303 __func__, __LINE__, tag, dev->tag);
304 304
305 if (res) { 305 if (res) {
306 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", 306 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
307 __func__, __LINE__, res, status); 307 __func__, __LINE__, res, status);
308 } else { 308 } else {
309 dev->lv1_status = status; 309 dev->lv1_status = status;
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 53544e21f191..f329f459817c 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: synclink_gt.c,v 4.50 2007/07/25 19:29:25 paulkf Exp $
3 *
4 * Device driver for Microgate SyncLink GT serial adapters. 2 * Device driver for Microgate SyncLink GT serial adapters.
5 * 3 *
6 * written by Paul Fulghum for Microgate Corporation 4 * written by Paul Fulghum for Microgate Corporation
@@ -91,7 +89,6 @@
91 * module identification 89 * module identification
92 */ 90 */
93static char *driver_name = "SyncLink GT"; 91static char *driver_name = "SyncLink GT";
94static char *driver_version = "$Revision: 4.50 $";
95static char *tty_driver_name = "synclink_gt"; 92static char *tty_driver_name = "synclink_gt";
96static char *tty_dev_prefix = "ttySLG"; 93static char *tty_dev_prefix = "ttySLG";
97MODULE_LICENSE("GPL"); 94MODULE_LICENSE("GPL");
@@ -1309,7 +1306,7 @@ static int read_proc(char *page, char **start, off_t off, int count,
1309 off_t begin = 0; 1306 off_t begin = 0;
1310 struct slgt_info *info; 1307 struct slgt_info *info;
1311 1308
1312 len += sprintf(page, "synclink_gt driver:%s\n", driver_version); 1309 len += sprintf(page, "synclink_gt driver\n");
1313 1310
1314 info = slgt_device_list; 1311 info = slgt_device_list;
1315 while( info ) { 1312 while( info ) {
@@ -2441,7 +2438,7 @@ static void program_hw(struct slgt_info *info)
2441 info->ri_chkcount = 0; 2438 info->ri_chkcount = 0;
2442 info->dsr_chkcount = 0; 2439 info->dsr_chkcount = 0;
2443 2440
2444 slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR); 2441 slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI);
2445 get_signals(info); 2442 get_signals(info);
2446 2443
2447 if (info->netcount || 2444 if (info->netcount ||
@@ -3576,7 +3573,7 @@ static void slgt_cleanup(void)
3576 struct slgt_info *info; 3573 struct slgt_info *info;
3577 struct slgt_info *tmp; 3574 struct slgt_info *tmp;
3578 3575
3579 printk("unload %s %s\n", driver_name, driver_version); 3576 printk(KERN_INFO "unload %s\n", driver_name);
3580 3577
3581 if (serial_driver) { 3578 if (serial_driver) {
3582 for (info=slgt_device_list ; info != NULL ; info=info->next_device) 3579 for (info=slgt_device_list ; info != NULL ; info=info->next_device)
@@ -3619,7 +3616,7 @@ static int __init slgt_init(void)
3619{ 3616{
3620 int rc; 3617 int rc;
3621 3618
3622 printk("%s %s\n", driver_name, driver_version); 3619 printk(KERN_INFO "%s\n", driver_name);
3623 3620
3624 serial_driver = alloc_tty_driver(MAX_DEVICES); 3621 serial_driver = alloc_tty_driver(MAX_DEVICES);
3625 if (!serial_driver) { 3622 if (!serial_driver) {
@@ -3650,9 +3647,8 @@ static int __init slgt_init(void)
3650 goto error; 3647 goto error;
3651 } 3648 }
3652 3649
3653 printk("%s %s, tty major#%d\n", 3650 printk(KERN_INFO "%s, tty major#%d\n",
3654 driver_name, driver_version, 3651 driver_name, serial_driver->major);
3655 serial_driver->major);
3656 3652
3657 slgt_device_count = 0; 3653 slgt_device_count = 0;
3658 if ((rc = pci_register_driver(&pci_driver)) < 0) { 3654 if ((rc = pci_register_driver(&pci_driver)) < 0) {
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 5a3eab0882a0..fa71b84f217b 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -475,6 +475,12 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
475 unsigned long flags; 475 unsigned long flags;
476 476
477 spin_lock_irqsave(&sysrq_key_table_lock, flags); 477 spin_lock_irqsave(&sysrq_key_table_lock, flags);
478 /*
479 * Raise the apparent loglevel to maximum so that the sysrq header
480 * is shown to provide the user with positive feedback. We do not
481 * simply emit this at KERN_EMERG as that would change message
482 * routing in the consumers of /proc/kmsg.
483 */
478 orig_log_level = console_loglevel; 484 orig_log_level = console_loglevel;
479 console_loglevel = 7; 485 console_loglevel = 7;
480 printk(KERN_INFO "SysRq : "); 486 printk(KERN_INFO "SysRq : ");
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index a408c8e487ec..6f4c7d0a53bf 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -1057,7 +1057,7 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg)
1057 if (retval) 1057 if (retval)
1058 return retval; 1058 return retval;
1059 1059
1060 ld = tty_ldisc_ref(tty); 1060 ld = tty_ldisc_ref_wait(tty);
1061 switch (arg) { 1061 switch (arg) {
1062 case TCIFLUSH: 1062 case TCIFLUSH:
1063 if (ld && ld->ops->flush_buffer) 1063 if (ld && ld->ops->flush_buffer)
diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 8b24d784db93..3e7f4e06386e 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -217,8 +217,10 @@ static int __devinit max7301_probe(struct spi_device *spi)
217 int i, ret; 217 int i, ret;
218 218
219 pdata = spi->dev.platform_data; 219 pdata = spi->dev.platform_data;
220 if (!pdata || !pdata->base) 220 if (!pdata || !pdata->base) {
221 return -ENODEV; 221 dev_dbg(&spi->dev, "incorrect or missing platform data\n");
222 return -EINVAL;
223 }
222 224
223 /* 225 /*
224 * bits_per_word cannot be configured in platform data 226 * bits_per_word cannot be configured in platform data
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c
index 55ae9a41897a..f7868243af89 100644
--- a/drivers/gpio/max732x.c
+++ b/drivers/gpio/max732x.c
@@ -267,8 +267,10 @@ static int __devinit max732x_probe(struct i2c_client *client,
267 int ret, nr_port; 267 int ret, nr_port;
268 268
269 pdata = client->dev.platform_data; 269 pdata = client->dev.platform_data;
270 if (pdata == NULL) 270 if (pdata == NULL) {
271 return -ENODEV; 271 dev_dbg(&client->dev, "no platform data\n");
272 return -EINVAL;
273 }
272 274
273 chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL); 275 chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL);
274 if (chip == NULL) 276 if (chip == NULL)
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index 89c1d222e9d1..f6fae0e50e65 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -310,8 +310,10 @@ static int mcp23s08_probe(struct spi_device *spi)
310 unsigned base; 310 unsigned base;
311 311
312 pdata = spi->dev.platform_data; 312 pdata = spi->dev.platform_data;
313 if (!pdata || !gpio_is_valid(pdata->base)) 313 if (!pdata || !gpio_is_valid(pdata->base)) {
314 return -ENODEV; 314 dev_dbg(&spi->dev, "invalid or missing platform data\n");
315 return -EINVAL;
316 }
315 317
316 for (addr = 0; addr < 4; addr++) { 318 for (addr = 0; addr < 4; addr++) {
317 if (!pdata->chip[addr].is_present) 319 if (!pdata->chip[addr].is_present)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 37f35388a2ae..8dc0164bd51e 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -202,8 +202,10 @@ static int __devinit pca953x_probe(struct i2c_client *client,
202 int ret; 202 int ret;
203 203
204 pdata = client->dev.platform_data; 204 pdata = client->dev.platform_data;
205 if (pdata == NULL) 205 if (pdata == NULL) {
206 return -ENODEV; 206 dev_dbg(&client->dev, "no platform data\n");
207 return -EINVAL;
208 }
207 209
208 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); 210 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
209 if (chip == NULL) 211 if (chip == NULL)
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c
index 4bc2070dd4a1..9525724be731 100644
--- a/drivers/gpio/pcf857x.c
+++ b/drivers/gpio/pcf857x.c
@@ -188,8 +188,10 @@ static int pcf857x_probe(struct i2c_client *client,
188 int status; 188 int status;
189 189
190 pdata = client->dev.platform_data; 190 pdata = client->dev.platform_data;
191 if (!pdata) 191 if (!pdata) {
192 return -ENODEV; 192 dev_dbg(&client->dev, "no platform data\n");
193 return -EINVAL;
194 }
193 195
194 /* Allocate, initialize, and register this gpio_chip. */ 196 /* Allocate, initialize, and register this gpio_chip. */
195 gpio = kzalloc(sizeof *gpio, GFP_KERNEL); 197 gpio = kzalloc(sizeof *gpio, GFP_KERNEL);
@@ -248,8 +250,10 @@ static int pcf857x_probe(struct i2c_client *client,
248 else 250 else
249 status = i2c_read_le16(client); 251 status = i2c_read_le16(client);
250 252
251 } else 253 } else {
252 status = -ENODEV; 254 dev_dbg(&client->dev, "unsupported number of gpios\n");
255 status = -EINVAL;
256 }
253 257
254 if (status < 0) 258 if (status < 0)
255 goto fail; 259 goto fail;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index d8a982b71296..964c5eb1fada 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -36,7 +36,7 @@
36/* 36/*
37 * Detailed mode info for 800x600@60Hz 37 * Detailed mode info for 800x600@60Hz
38 */ 38 */
39static struct drm_display_mode std_mode[] = { 39static struct drm_display_mode std_modes[] = {
40 { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840, 40 { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840,
41 968, 1056, 0, 600, 601, 605, 628, 0, 41 968, 1056, 0, 600, 601, 605, 628, 0,
42 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 42 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
@@ -60,15 +60,18 @@ static struct drm_display_mode std_mode[] = {
60 * changes have occurred. 60 * changes have occurred.
61 * 61 *
62 * FIXME: take into account monitor limits 62 * FIXME: take into account monitor limits
63 *
64 * RETURNS:
65 * Number of modes found on @connector.
63 */ 66 */
64void drm_helper_probe_single_connector_modes(struct drm_connector *connector, 67int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
65 uint32_t maxX, uint32_t maxY) 68 uint32_t maxX, uint32_t maxY)
66{ 69{
67 struct drm_device *dev = connector->dev; 70 struct drm_device *dev = connector->dev;
68 struct drm_display_mode *mode, *t; 71 struct drm_display_mode *mode, *t;
69 struct drm_connector_helper_funcs *connector_funcs = 72 struct drm_connector_helper_funcs *connector_funcs =
70 connector->helper_private; 73 connector->helper_private;
71 int ret; 74 int count = 0;
72 75
73 DRM_DEBUG("%s\n", drm_get_connector_name(connector)); 76 DRM_DEBUG("%s\n", drm_get_connector_name(connector));
74 /* set all modes to the unverified state */ 77 /* set all modes to the unverified state */
@@ -81,14 +84,14 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
81 DRM_DEBUG("%s is disconnected\n", 84 DRM_DEBUG("%s is disconnected\n",
82 drm_get_connector_name(connector)); 85 drm_get_connector_name(connector));
83 /* TODO set EDID to NULL */ 86 /* TODO set EDID to NULL */
84 return; 87 return 0;
85 } 88 }
86 89
87 ret = (*connector_funcs->get_modes)(connector); 90 count = (*connector_funcs->get_modes)(connector);
91 if (!count)
92 return 0;
88 93
89 if (ret) { 94 drm_mode_connector_list_update(connector);
90 drm_mode_connector_list_update(connector);
91 }
92 95
93 if (maxX && maxY) 96 if (maxX && maxY)
94 drm_mode_validate_size(dev, &connector->modes, maxX, 97 drm_mode_validate_size(dev, &connector->modes, maxX,
@@ -102,25 +105,8 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
102 105
103 drm_mode_prune_invalid(dev, &connector->modes, true); 106 drm_mode_prune_invalid(dev, &connector->modes, true);
104 107
105 if (list_empty(&connector->modes)) { 108 if (list_empty(&connector->modes))
106 struct drm_display_mode *stdmode; 109 return 0;
107
108 DRM_DEBUG("No valid modes on %s\n",
109 drm_get_connector_name(connector));
110
111 /* Should we do this here ???
112 * When no valid EDID modes are available we end up
113 * here and bailed in the past, now we add a standard
114 * 640x480@60Hz mode and carry on.
115 */
116 stdmode = drm_mode_duplicate(dev, &std_mode[0]);
117 drm_mode_probed_add(connector, stdmode);
118 drm_mode_list_concat(&connector->probed_modes,
119 &connector->modes);
120
121 DRM_DEBUG("Adding standard 640x480 @ 60Hz to %s\n",
122 drm_get_connector_name(connector));
123 }
124 110
125 drm_mode_sort(&connector->modes); 111 drm_mode_sort(&connector->modes);
126 112
@@ -131,20 +117,58 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
131 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 117 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
132 drm_mode_debug_printmodeline(mode); 118 drm_mode_debug_printmodeline(mode);
133 } 119 }
120
121 return count;
134} 122}
135EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); 123EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
136 124
137void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX, 125int drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,
138 uint32_t maxY) 126 uint32_t maxY)
139{ 127{
140 struct drm_connector *connector; 128 struct drm_connector *connector;
129 int count = 0;
141 130
142 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 131 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
143 drm_helper_probe_single_connector_modes(connector, maxX, maxY); 132 count += drm_helper_probe_single_connector_modes(connector,
133 maxX, maxY);
144 } 134 }
135
136 return count;
145} 137}
146EXPORT_SYMBOL(drm_helper_probe_connector_modes); 138EXPORT_SYMBOL(drm_helper_probe_connector_modes);
147 139
140static void drm_helper_add_std_modes(struct drm_device *dev,
141 struct drm_connector *connector)
142{
143 struct drm_display_mode *mode, *t;
144 int i;
145
146 for (i = 0; i < ARRAY_SIZE(std_modes); i++) {
147 struct drm_display_mode *stdmode;
148
149 /*
150 * When no valid EDID modes are available we end up
151 * here and bailed in the past, now we add some standard
152 * modes and move on.
153 */
154 stdmode = drm_mode_duplicate(dev, &std_modes[i]);
155 drm_mode_probed_add(connector, stdmode);
156 drm_mode_list_concat(&connector->probed_modes,
157 &connector->modes);
158
159 DRM_DEBUG("Adding mode %s to %s\n", stdmode->name,
160 drm_get_connector_name(connector));
161 }
162 drm_mode_sort(&connector->modes);
163
164 DRM_DEBUG("Added std modes on %s\n", drm_get_connector_name(connector));
165 list_for_each_entry_safe(mode, t, &connector->modes, head) {
166 mode->vrefresh = drm_mode_vrefresh(mode);
167
168 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
169 drm_mode_debug_printmodeline(mode);
170 }
171}
148 172
149/** 173/**
150 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config 174 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
@@ -237,6 +261,8 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled)
237 261
238 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 262 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
239 enabled[i] = drm_connector_enabled(connector, true); 263 enabled[i] = drm_connector_enabled(connector, true);
264 DRM_DEBUG("connector %d enabled? %s\n", connector->base.id,
265 enabled[i] ? "yes" : "no");
240 any_enabled |= enabled[i]; 266 any_enabled |= enabled[i];
241 i++; 267 i++;
242 } 268 }
@@ -265,11 +291,17 @@ static bool drm_target_preferred(struct drm_device *dev,
265 continue; 291 continue;
266 } 292 }
267 293
294 DRM_DEBUG("looking for preferred mode on connector %d\n",
295 connector->base.id);
296
268 modes[i] = drm_has_preferred_mode(connector, width, height); 297 modes[i] = drm_has_preferred_mode(connector, width, height);
269 if (!modes[i]) { 298 /* No preferred modes, pick one off the list */
299 if (!modes[i] && !list_empty(&connector->modes)) {
270 list_for_each_entry(modes[i], &connector->modes, head) 300 list_for_each_entry(modes[i], &connector->modes, head)
271 break; 301 break;
272 } 302 }
303 DRM_DEBUG("found mode %s\n", modes[i] ? modes[i]->name :
304 "none");
273 i++; 305 i++;
274 } 306 }
275 return true; 307 return true;
@@ -369,6 +401,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
369 int width, height; 401 int width, height;
370 int i, ret; 402 int i, ret;
371 403
404 DRM_DEBUG("\n");
405
372 width = dev->mode_config.max_width; 406 width = dev->mode_config.max_width;
373 height = dev->mode_config.max_height; 407 height = dev->mode_config.max_height;
374 408
@@ -390,6 +424,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
390 if (!ret) 424 if (!ret)
391 DRM_ERROR("Unable to find initial modes\n"); 425 DRM_ERROR("Unable to find initial modes\n");
392 426
427 DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height);
428
393 drm_pick_crtcs(dev, crtcs, modes, 0, width, height); 429 drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
394 430
395 i = 0; 431 i = 0;
@@ -403,6 +439,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
403 } 439 }
404 440
405 if (mode && crtc) { 441 if (mode && crtc) {
442 DRM_DEBUG("desired mode %s set on crtc %d\n",
443 mode->name, crtc->base.id);
406 crtc->desired_mode = mode; 444 crtc->desired_mode = mode;
407 connector->encoder->crtc = crtc; 445 connector->encoder->crtc = crtc;
408 } else 446 } else
@@ -442,6 +480,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
442 int saved_x, saved_y; 480 int saved_x, saved_y;
443 struct drm_encoder *encoder; 481 struct drm_encoder *encoder;
444 bool ret = true; 482 bool ret = true;
483 bool depth_changed, bpp_changed;
445 484
446 adjusted_mode = drm_mode_duplicate(dev, mode); 485 adjusted_mode = drm_mode_duplicate(dev, mode);
447 486
@@ -450,6 +489,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
450 if (!crtc->enabled) 489 if (!crtc->enabled)
451 return true; 490 return true;
452 491
492 if (old_fb && crtc->fb) {
493 depth_changed = (old_fb->depth != crtc->fb->depth);
494 bpp_changed = (old_fb->bits_per_pixel !=
495 crtc->fb->bits_per_pixel);
496 } else {
497 depth_changed = true;
498 bpp_changed = true;
499 }
500
453 saved_mode = crtc->mode; 501 saved_mode = crtc->mode;
454 saved_x = crtc->x; 502 saved_x = crtc->x;
455 saved_y = crtc->y; 503 saved_y = crtc->y;
@@ -462,7 +510,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
462 crtc->y = y; 510 crtc->y = y;
463 511
464 if (drm_mode_equal(&saved_mode, &crtc->mode)) { 512 if (drm_mode_equal(&saved_mode, &crtc->mode)) {
465 if (saved_x != crtc->x || saved_y != crtc->y) { 513 if (saved_x != crtc->x || saved_y != crtc->y ||
514 depth_changed || bpp_changed) {
466 crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, 515 crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y,
467 old_fb); 516 old_fb);
468 goto done; 517 goto done;
@@ -568,8 +617,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
568 struct drm_encoder **save_encoders, *new_encoder; 617 struct drm_encoder **save_encoders, *new_encoder;
569 struct drm_framebuffer *old_fb; 618 struct drm_framebuffer *old_fb;
570 bool save_enabled; 619 bool save_enabled;
571 bool changed = false; 620 bool mode_changed = false;
572 bool flip_or_move = false; 621 bool fb_changed = false;
573 struct drm_connector *connector; 622 struct drm_connector *connector;
574 int count = 0, ro, fail = 0; 623 int count = 0, ro, fail = 0;
575 struct drm_crtc_helper_funcs *crtc_funcs; 624 struct drm_crtc_helper_funcs *crtc_funcs;
@@ -597,7 +646,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
597 /* save previous config */ 646 /* save previous config */
598 save_enabled = set->crtc->enabled; 647 save_enabled = set->crtc->enabled;
599 648
600 /* this is meant to be num_connector not num_crtc */ 649 /*
650 * We do mode_config.num_connectors here since we'll look at the
651 * CRTC and encoder associated with each connector later.
652 */
601 save_crtcs = kzalloc(dev->mode_config.num_connector * 653 save_crtcs = kzalloc(dev->mode_config.num_connector *
602 sizeof(struct drm_crtc *), GFP_KERNEL); 654 sizeof(struct drm_crtc *), GFP_KERNEL);
603 if (!save_crtcs) 655 if (!save_crtcs)
@@ -613,21 +665,25 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
613 /* We should be able to check here if the fb has the same properties 665 /* We should be able to check here if the fb has the same properties
614 * and then just flip_or_move it */ 666 * and then just flip_or_move it */
615 if (set->crtc->fb != set->fb) { 667 if (set->crtc->fb != set->fb) {
616 /* if we have no fb then its a change not a flip */ 668 /* If we have no fb then treat it as a full mode set */
617 if (set->crtc->fb == NULL) 669 if (set->crtc->fb == NULL)
618 changed = true; 670 mode_changed = true;
671 else if ((set->fb->bits_per_pixel !=
672 set->crtc->fb->bits_per_pixel) ||
673 set->fb->depth != set->crtc->fb->depth)
674 fb_changed = true;
619 else 675 else
620 flip_or_move = true; 676 fb_changed = true;
621 } 677 }
622 678
623 if (set->x != set->crtc->x || set->y != set->crtc->y) 679 if (set->x != set->crtc->x || set->y != set->crtc->y)
624 flip_or_move = true; 680 fb_changed = true;
625 681
626 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { 682 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
627 DRM_DEBUG("modes are different\n"); 683 DRM_DEBUG("modes are different\n");
628 drm_mode_debug_printmodeline(&set->crtc->mode); 684 drm_mode_debug_printmodeline(&set->crtc->mode);
629 drm_mode_debug_printmodeline(set->mode); 685 drm_mode_debug_printmodeline(set->mode);
630 changed = true; 686 mode_changed = true;
631 } 687 }
632 688
633 /* a) traverse passed in connector list and get encoders for them */ 689 /* a) traverse passed in connector list and get encoders for them */
@@ -650,7 +706,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
650 } 706 }
651 707
652 if (new_encoder != connector->encoder) { 708 if (new_encoder != connector->encoder) {
653 changed = true; 709 mode_changed = true;
654 connector->encoder = new_encoder; 710 connector->encoder = new_encoder;
655 } 711 }
656 } 712 }
@@ -677,16 +733,16 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
677 new_crtc = set->crtc; 733 new_crtc = set->crtc;
678 } 734 }
679 if (new_crtc != connector->encoder->crtc) { 735 if (new_crtc != connector->encoder->crtc) {
680 changed = true; 736 mode_changed = true;
681 connector->encoder->crtc = new_crtc; 737 connector->encoder->crtc = new_crtc;
682 } 738 }
683 } 739 }
684 740
685 /* mode_set_base is not a required function */ 741 /* mode_set_base is not a required function */
686 if (flip_or_move && !crtc_funcs->mode_set_base) 742 if (fb_changed && !crtc_funcs->mode_set_base)
687 changed = true; 743 mode_changed = true;
688 744
689 if (changed) { 745 if (mode_changed) {
690 old_fb = set->crtc->fb; 746 old_fb = set->crtc->fb;
691 set->crtc->fb = set->fb; 747 set->crtc->fb = set->fb;
692 set->crtc->enabled = (set->mode != NULL); 748 set->crtc->enabled = (set->mode != NULL);
@@ -705,7 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
705 set->crtc->desired_mode = set->mode; 761 set->crtc->desired_mode = set->mode;
706 } 762 }
707 drm_helper_disable_unused_functions(dev); 763 drm_helper_disable_unused_functions(dev);
708 } else if (flip_or_move) { 764 } else if (fb_changed) {
709 old_fb = set->crtc->fb; 765 old_fb = set->crtc->fb;
710 if (set->crtc->fb != set->fb) 766 if (set->crtc->fb != set->fb)
711 set->crtc->fb = set->fb; 767 set->crtc->fb = set->fb;
@@ -764,10 +820,31 @@ bool drm_helper_plugged_event(struct drm_device *dev)
764 */ 820 */
765bool drm_helper_initial_config(struct drm_device *dev, bool can_grow) 821bool drm_helper_initial_config(struct drm_device *dev, bool can_grow)
766{ 822{
767 int ret = false; 823 struct drm_connector *connector;
824 int count = 0;
768 825
769 drm_helper_plugged_event(dev); 826 count = drm_helper_probe_connector_modes(dev,
770 return ret; 827 dev->mode_config.max_width,
828 dev->mode_config.max_height);
829
830 /*
831 * None of the available connectors had any modes, so add some
832 * and try to light them up anyway
833 */
834 if (!count) {
835 DRM_ERROR("connectors have no modes, using standard modes\n");
836 list_for_each_entry(connector,
837 &dev->mode_config.connector_list,
838 head)
839 drm_helper_add_std_modes(dev, connector);
840 }
841
842 drm_setup_crtcs(dev);
843
844 /* alert the driver fb layer */
845 dev->mode_config.funcs->fb_changed(dev);
846
847 return 0;
771} 848}
772EXPORT_SYMBOL(drm_helper_initial_config); 849EXPORT_SYMBOL(drm_helper_initial_config);
773 850
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 724e505873cf..477caa1b1e4b 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -267,7 +267,8 @@ EXPORT_SYMBOL(drm_irq_install);
267 */ 267 */
268int drm_irq_uninstall(struct drm_device * dev) 268int drm_irq_uninstall(struct drm_device * dev)
269{ 269{
270 int irq_enabled; 270 unsigned long irqflags;
271 int irq_enabled, i;
271 272
272 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 273 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
273 return -EINVAL; 274 return -EINVAL;
@@ -277,6 +278,16 @@ int drm_irq_uninstall(struct drm_device * dev)
277 dev->irq_enabled = 0; 278 dev->irq_enabled = 0;
278 mutex_unlock(&dev->struct_mutex); 279 mutex_unlock(&dev->struct_mutex);
279 280
281 /*
282 * Wake up any waiters so they don't hang.
283 */
284 spin_lock_irqsave(&dev->vbl_lock, irqflags);
285 for (i = 0; i < dev->num_crtcs; i++) {
286 DRM_WAKEUP(&dev->vbl_queue[i]);
287 dev->vblank_enabled[i] = 0;
288 }
289 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
290
280 if (!irq_enabled) 291 if (!irq_enabled)
281 return -EINVAL; 292 return -EINVAL;
282 293
@@ -652,8 +663,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
652 vblwait->request.sequence, crtc); 663 vblwait->request.sequence, crtc);
653 dev->last_vblank_wait[crtc] = vblwait->request.sequence; 664 dev->last_vblank_wait[crtc] = vblwait->request.sequence;
654 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, 665 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
655 ((drm_vblank_count(dev, crtc) 666 (((drm_vblank_count(dev, crtc) -
656 - vblwait->request.sequence) <= (1 << 23))); 667 vblwait->request.sequence) <= (1 << 23)) ||
668 !dev->irq_enabled));
657 669
658 if (ret != -EINTR) { 670 if (ret != -EINTR) {
659 struct timeval now; 671 struct timeval now;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 62a4bf7b49df..bbadf1c04142 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -177,6 +177,14 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
177 drm_i915_private_t *dev_priv = dev->dev_private; 177 drm_i915_private_t *dev_priv = dev->dev_private;
178 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; 178 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
179 179
180 master_priv->sarea = drm_getsarea(dev);
181 if (master_priv->sarea) {
182 master_priv->sarea_priv = (drm_i915_sarea_t *)
183 ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset);
184 } else {
185 DRM_DEBUG("sarea not found assuming DRI2 userspace\n");
186 }
187
180 if (init->ring_size != 0) { 188 if (init->ring_size != 0) {
181 if (dev_priv->ring.ring_obj != NULL) { 189 if (dev_priv->ring.ring_obj != NULL) {
182 i915_dma_cleanup(dev); 190 i915_dma_cleanup(dev);
@@ -1152,6 +1160,8 @@ int i915_driver_unload(struct drm_device *dev)
1152 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 1160 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1153 intel_modeset_cleanup(dev); 1161 intel_modeset_cleanup(dev);
1154 1162
1163 i915_gem_free_all_phys_object(dev);
1164
1155 mutex_lock(&dev->struct_mutex); 1165 mutex_lock(&dev->struct_mutex);
1156 i915_gem_cleanup_ringbuffer(dev); 1166 i915_gem_cleanup_ringbuffer(dev);
1157 mutex_unlock(&dev->struct_mutex); 1167 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 563de18063fd..e13518252007 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -72,6 +72,18 @@ enum pipe {
72#define WATCH_INACTIVE 0 72#define WATCH_INACTIVE 0
73#define WATCH_PWRITE 0 73#define WATCH_PWRITE 0
74 74
75#define I915_GEM_PHYS_CURSOR_0 1
76#define I915_GEM_PHYS_CURSOR_1 2
77#define I915_GEM_PHYS_OVERLAY_REGS 3
78#define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
79
80struct drm_i915_gem_phys_object {
81 int id;
82 struct page **page_list;
83 drm_dma_handle_t *handle;
84 struct drm_gem_object *cur_obj;
85};
86
75typedef struct _drm_i915_ring_buffer { 87typedef struct _drm_i915_ring_buffer {
76 int tail_mask; 88 int tail_mask;
77 unsigned long Size; 89 unsigned long Size;
@@ -358,6 +370,9 @@ typedef struct drm_i915_private {
358 uint32_t bit_6_swizzle_x; 370 uint32_t bit_6_swizzle_x;
359 /** Bit 6 swizzling required for Y tiling */ 371 /** Bit 6 swizzling required for Y tiling */
360 uint32_t bit_6_swizzle_y; 372 uint32_t bit_6_swizzle_y;
373
374 /* storage for physical objects */
375 struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
361 } mm; 376 } mm;
362} drm_i915_private_t; 377} drm_i915_private_t;
363 378
@@ -436,6 +451,9 @@ struct drm_i915_gem_object {
436 /** User space pin count and filp owning the pin */ 451 /** User space pin count and filp owning the pin */
437 uint32_t user_pin_count; 452 uint32_t user_pin_count;
438 struct drm_file *pin_filp; 453 struct drm_file *pin_filp;
454
455 /** for phy allocated objects */
456 struct drm_i915_gem_phys_object *phys_obj;
439}; 457};
440 458
441/** 459/**
@@ -598,6 +616,11 @@ int i915_gem_do_init(struct drm_device *dev, unsigned long start,
598int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); 616int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
599int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, 617int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
600 int write); 618 int write);
619int i915_gem_attach_phys_object(struct drm_device *dev,
620 struct drm_gem_object *obj, int id);
621void i915_gem_detach_phys_object(struct drm_device *dev,
622 struct drm_gem_object *obj);
623void i915_gem_free_all_phys_object(struct drm_device *dev);
601 624
602/* i915_gem_tiling.c */ 625/* i915_gem_tiling.c */
603void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); 626void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1384d6686555..96316fd47233 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -55,6 +55,9 @@ static int i915_gem_object_bind_to_gtt(struct drm_gem_object *obj,
55static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj); 55static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj);
56static void i915_gem_clear_fence_reg(struct drm_gem_object *obj); 56static void i915_gem_clear_fence_reg(struct drm_gem_object *obj);
57static int i915_gem_evict_something(struct drm_device *dev); 57static int i915_gem_evict_something(struct drm_device *dev);
58static int i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
59 struct drm_i915_gem_pwrite *args,
60 struct drm_file *file_priv);
58 61
59int i915_gem_do_init(struct drm_device *dev, unsigned long start, 62int i915_gem_do_init(struct drm_device *dev, unsigned long start,
60 unsigned long end) 63 unsigned long end)
@@ -386,8 +389,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
386 * pread/pwrite currently are reading and writing from the CPU 389 * pread/pwrite currently are reading and writing from the CPU
387 * perspective, requiring manual detiling by the client. 390 * perspective, requiring manual detiling by the client.
388 */ 391 */
389 if (obj_priv->tiling_mode == I915_TILING_NONE && 392 if (obj_priv->phys_obj)
390 dev->gtt_total != 0) 393 ret = i915_gem_phys_pwrite(dev, obj, args, file_priv);
394 else if (obj_priv->tiling_mode == I915_TILING_NONE &&
395 dev->gtt_total != 0)
391 ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv); 396 ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv);
392 else 397 else
393 ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv); 398 ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv);
@@ -2858,6 +2863,9 @@ void i915_gem_free_object(struct drm_gem_object *obj)
2858 while (obj_priv->pin_count > 0) 2863 while (obj_priv->pin_count > 0)
2859 i915_gem_object_unpin(obj); 2864 i915_gem_object_unpin(obj);
2860 2865
2866 if (obj_priv->phys_obj)
2867 i915_gem_detach_phys_object(dev, obj);
2868
2861 i915_gem_object_unbind(obj); 2869 i915_gem_object_unbind(obj);
2862 2870
2863 list = &obj->map_list; 2871 list = &obj->map_list;
@@ -3293,3 +3301,180 @@ i915_gem_load(struct drm_device *dev)
3293 3301
3294 i915_gem_detect_bit_6_swizzle(dev); 3302 i915_gem_detect_bit_6_swizzle(dev);
3295} 3303}
3304
3305/*
3306 * Create a physically contiguous memory object for this object
3307 * e.g. for cursor + overlay regs
3308 */
3309int i915_gem_init_phys_object(struct drm_device *dev,
3310 int id, int size)
3311{
3312 drm_i915_private_t *dev_priv = dev->dev_private;
3313 struct drm_i915_gem_phys_object *phys_obj;
3314 int ret;
3315
3316 if (dev_priv->mm.phys_objs[id - 1] || !size)
3317 return 0;
3318
3319 phys_obj = drm_calloc(1, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER);
3320 if (!phys_obj)
3321 return -ENOMEM;
3322
3323 phys_obj->id = id;
3324
3325 phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
3326 if (!phys_obj->handle) {
3327 ret = -ENOMEM;
3328 goto kfree_obj;
3329 }
3330#ifdef CONFIG_X86
3331 set_memory_wc((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE);
3332#endif
3333
3334 dev_priv->mm.phys_objs[id - 1] = phys_obj;
3335
3336 return 0;
3337kfree_obj:
3338 drm_free(phys_obj, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER);
3339 return ret;
3340}
3341
3342void i915_gem_free_phys_object(struct drm_device *dev, int id)
3343{
3344 drm_i915_private_t *dev_priv = dev->dev_private;
3345 struct drm_i915_gem_phys_object *phys_obj;
3346
3347 if (!dev_priv->mm.phys_objs[id - 1])
3348 return;
3349
3350 phys_obj = dev_priv->mm.phys_objs[id - 1];
3351 if (phys_obj->cur_obj) {
3352 i915_gem_detach_phys_object(dev, phys_obj->cur_obj);
3353 }
3354
3355#ifdef CONFIG_X86
3356 set_memory_wb((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE);
3357#endif
3358 drm_pci_free(dev, phys_obj->handle);
3359 kfree(phys_obj);
3360 dev_priv->mm.phys_objs[id - 1] = NULL;
3361}
3362
3363void i915_gem_free_all_phys_object(struct drm_device *dev)
3364{
3365 int i;
3366
3367 for (i = 0; i < I915_MAX_PHYS_OBJECT; i++)
3368 i915_gem_free_phys_object(dev, i);
3369}
3370
3371void i915_gem_detach_phys_object(struct drm_device *dev,
3372 struct drm_gem_object *obj)
3373{
3374 struct drm_i915_gem_object *obj_priv;
3375 int i;
3376 int ret;
3377 int page_count;
3378
3379 obj_priv = obj->driver_private;
3380 if (!obj_priv->phys_obj)
3381 return;
3382
3383 ret = i915_gem_object_get_page_list(obj);
3384 if (ret)
3385 goto out;
3386
3387 page_count = obj->size / PAGE_SIZE;
3388
3389 for (i = 0; i < page_count; i++) {
3390 char *dst = kmap_atomic(obj_priv->page_list[i], KM_USER0);
3391 char *src = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
3392
3393 memcpy(dst, src, PAGE_SIZE);
3394 kunmap_atomic(dst, KM_USER0);
3395 }
3396 drm_clflush_pages(obj_priv->page_list, page_count);
3397 drm_agp_chipset_flush(dev);
3398out:
3399 obj_priv->phys_obj->cur_obj = NULL;
3400 obj_priv->phys_obj = NULL;
3401}
3402
3403int
3404i915_gem_attach_phys_object(struct drm_device *dev,
3405 struct drm_gem_object *obj, int id)
3406{
3407 drm_i915_private_t *dev_priv = dev->dev_private;
3408 struct drm_i915_gem_object *obj_priv;
3409 int ret = 0;
3410 int page_count;
3411 int i;
3412
3413 if (id > I915_MAX_PHYS_OBJECT)
3414 return -EINVAL;
3415
3416 obj_priv = obj->driver_private;
3417
3418 if (obj_priv->phys_obj) {
3419 if (obj_priv->phys_obj->id == id)
3420 return 0;
3421 i915_gem_detach_phys_object(dev, obj);
3422 }
3423
3424
3425 /* create a new object */
3426 if (!dev_priv->mm.phys_objs[id - 1]) {
3427 ret = i915_gem_init_phys_object(dev, id,
3428 obj->size);
3429 if (ret) {
3430 DRM_ERROR("failed to init phys object %d size: %d\n", id, obj->size);
3431 goto out;
3432 }
3433 }
3434
3435 /* bind to the object */
3436 obj_priv->phys_obj = dev_priv->mm.phys_objs[id - 1];
3437 obj_priv->phys_obj->cur_obj = obj;
3438
3439 ret = i915_gem_object_get_page_list(obj);
3440 if (ret) {
3441 DRM_ERROR("failed to get page list\n");
3442 goto out;
3443 }
3444
3445 page_count = obj->size / PAGE_SIZE;
3446
3447 for (i = 0; i < page_count; i++) {
3448 char *src = kmap_atomic(obj_priv->page_list[i], KM_USER0);
3449 char *dst = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
3450
3451 memcpy(dst, src, PAGE_SIZE);
3452 kunmap_atomic(src, KM_USER0);
3453 }
3454
3455 return 0;
3456out:
3457 return ret;
3458}
3459
3460static int
3461i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
3462 struct drm_i915_gem_pwrite *args,
3463 struct drm_file *file_priv)
3464{
3465 struct drm_i915_gem_object *obj_priv = obj->driver_private;
3466 void *obj_addr;
3467 int ret;
3468 char __user *user_data;
3469
3470 user_data = (char __user *) (uintptr_t) args->data_ptr;
3471 obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset;
3472
3473 DRM_ERROR("obj_addr %p, %lld\n", obj_addr, args->size);
3474 ret = copy_from_user(obj_addr, user_data, args->size);
3475 if (ret)
3476 return -EFAULT;
3477
3478 drm_agp_chipset_flush(dev);
3479 return 0;
3480}
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 0cadafbef411..6290219de6c8 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -411,6 +411,12 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
411{ 411{
412 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 412 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
413 unsigned long irqflags; 413 unsigned long irqflags;
414 int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
415 u32 pipeconf;
416
417 pipeconf = I915_READ(pipeconf_reg);
418 if (!(pipeconf & PIPEACONF_ENABLE))
419 return -EINVAL;
414 420
415 spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags); 421 spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
416 if (IS_I965G(dev)) 422 if (IS_I965G(dev))
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8ccb9c3ab868..31c3732b7a69 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -401,6 +401,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
401 I915_WRITE(dspstride, crtc->fb->pitch); 401 I915_WRITE(dspstride, crtc->fb->pitch);
402 402
403 dspcntr = I915_READ(dspcntr_reg); 403 dspcntr = I915_READ(dspcntr_reg);
404 /* Mask out pixel format bits in case we change it */
405 dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
404 switch (crtc->fb->bits_per_pixel) { 406 switch (crtc->fb->bits_per_pixel) {
405 case 8: 407 case 8:
406 dspcntr |= DISPPLANE_8BPP; 408 dspcntr |= DISPPLANE_8BPP;
@@ -1014,21 +1016,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1014 1016
1015 if (bo->size < width * height * 4) { 1017 if (bo->size < width * height * 4) {
1016 DRM_ERROR("buffer is to small\n"); 1018 DRM_ERROR("buffer is to small\n");
1017 drm_gem_object_unreference(bo); 1019 ret = -ENOMEM;
1018 return -ENOMEM; 1020 goto fail;
1019 } 1021 }
1020 1022
1021 if (dev_priv->cursor_needs_physical) { 1023 /* we only need to pin inside GTT if cursor is non-phy */
1022 addr = dev->agp->base + obj_priv->gtt_offset; 1024 if (!dev_priv->cursor_needs_physical) {
1023 } else { 1025 ret = i915_gem_object_pin(bo, PAGE_SIZE);
1026 if (ret) {
1027 DRM_ERROR("failed to pin cursor bo\n");
1028 goto fail;
1029 }
1024 addr = obj_priv->gtt_offset; 1030 addr = obj_priv->gtt_offset;
1025 } 1031 } else {
1026 1032 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
1027 ret = i915_gem_object_pin(bo, PAGE_SIZE); 1033 if (ret) {
1028 if (ret) { 1034 DRM_ERROR("failed to attach phys object\n");
1029 DRM_ERROR("failed to pin cursor bo\n"); 1035 goto fail;
1030 drm_gem_object_unreference(bo); 1036 }
1031 return ret; 1037 addr = obj_priv->phys_obj->handle->busaddr;
1032 } 1038 }
1033 1039
1034 temp = 0; 1040 temp = 0;
@@ -1041,14 +1047,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1041 I915_WRITE(base, addr); 1047 I915_WRITE(base, addr);
1042 1048
1043 if (intel_crtc->cursor_bo) { 1049 if (intel_crtc->cursor_bo) {
1044 i915_gem_object_unpin(intel_crtc->cursor_bo); 1050 if (dev_priv->cursor_needs_physical) {
1051 if (intel_crtc->cursor_bo != bo)
1052 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
1053 } else
1054 i915_gem_object_unpin(intel_crtc->cursor_bo);
1055 mutex_lock(&dev->struct_mutex);
1045 drm_gem_object_unreference(intel_crtc->cursor_bo); 1056 drm_gem_object_unreference(intel_crtc->cursor_bo);
1057 mutex_unlock(&dev->struct_mutex);
1046 } 1058 }
1047 1059
1048 intel_crtc->cursor_addr = addr; 1060 intel_crtc->cursor_addr = addr;
1049 intel_crtc->cursor_bo = bo; 1061 intel_crtc->cursor_bo = bo;
1050 1062
1051 return 0; 1063 return 0;
1064fail:
1065 mutex_lock(&dev->struct_mutex);
1066 drm_gem_object_unreference(bo);
1067 mutex_unlock(&dev->struct_mutex);
1068 return ret;
1052} 1069}
1053 1070
1054static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) 1071static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index ccecfaf6307b..2fafdcc108fe 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -456,6 +456,13 @@ void intel_lvds_init(struct drm_device *dev)
456 dev_priv->panel_fixed_mode = 456 dev_priv->panel_fixed_mode =
457 drm_mode_duplicate(dev, dev_priv->vbt_mode); 457 drm_mode_duplicate(dev, dev_priv->vbt_mode);
458 mutex_unlock(&dev->mode_config.mutex); 458 mutex_unlock(&dev->mode_config.mutex);
459 if (dev_priv->panel_fixed_mode) {
460 dev_priv->panel_fixed_mode->type |=
461 DRM_MODE_TYPE_PREFERRED;
462 drm_mode_probed_add(connector,
463 dev_priv->panel_fixed_mode);
464 goto out;
465 }
459 } 466 }
460 467
461 /* 468 /*
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 4b33bc82cc24..b84bf066879b 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -189,6 +189,16 @@ config SENSORS_ADT7473
189 This driver can also be built as a module. If so, the module 189 This driver can also be built as a module. If so, the module
190 will be called adt7473. 190 will be called adt7473.
191 191
192config SENSORS_ADT7475
193 tristate "Analog Devices ADT7475"
194 depends on I2C && EXPERIMENTAL
195 help
196 If you say yes here you get support for the Analog Devices
197 ADT7475 hardware monitoring chips.
198
199 This driver can also be build as a module. If so, the module
200 will be called adt7475.
201
192config SENSORS_K8TEMP 202config SENSORS_K8TEMP
193 tristate "AMD Athlon64/FX or Opteron temperature sensor" 203 tristate "AMD Athlon64/FX or Opteron temperature sensor"
194 depends on X86 && PCI && EXPERIMENTAL 204 depends on X86 && PCI && EXPERIMENTAL
@@ -861,6 +871,8 @@ config SENSORS_HDAPS
861config SENSORS_LIS3LV02D 871config SENSORS_LIS3LV02D
862 tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" 872 tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer"
863 depends on ACPI && INPUT 873 depends on ACPI && INPUT
874 select NEW_LEDS
875 select LEDS_CLASS
864 default n 876 default n
865 help 877 help
866 This driver provides support for the LIS3LV02Dx accelerometer. In 878 This driver provides support for the LIS3LV02Dx accelerometer. In
@@ -872,10 +884,16 @@ config SENSORS_LIS3LV02D
872 /sys/devices/platform/lis3lv02d. 884 /sys/devices/platform/lis3lv02d.
873 885
874 This driver also provides an absolute input class device, allowing 886 This driver also provides an absolute input class device, allowing
875 the laptop to act as a pinball machine-esque joystick. 887 the laptop to act as a pinball machine-esque joystick. On HP laptops,
888 if the led infrastructure is activated, support for a led indicating
889 disk protection will be provided as hp:red:hddprotection.
876 890
877 This driver can also be built as a module. If so, the module 891 This driver can also be built as modules. If so, the core module
878 will be called lis3lv02d. 892 will be called lis3lv02d and a specific module for HP laptops will be
893 called hp_accel.
894
895 Say Y here if you have an applicable laptop and want to experience
896 the awesome power of lis3lv02d.
879 897
880config SENSORS_APPLESMC 898config SENSORS_APPLESMC
881 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" 899 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)"
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 19cb1ace3eb4..2e80f37f39eb 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -28,6 +28,8 @@ obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o
28obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o 28obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o
29obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o 29obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
30obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o 30obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o
31obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o
32
31obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o 33obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
32obj-$(CONFIG_SENSORS_AMS) += ams/ 34obj-$(CONFIG_SENSORS_AMS) += ams/
33obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o 35obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index 70bb854086df..e52b38806d03 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
279 { "OTES1 Fan", 36, 2, 60, 1, 0 }, 279 { "OTES1 Fan", 36, 2, 60, 1, 0 },
280 { NULL, 0, 0, 0, 0, 0 } } 280 { NULL, 0, 0, 0, 0, 0 } }
281 }, 281 },
282 { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", { 282 { 0x0011, "AT8 32X", {
283 { "CPU Core", 0, 0, 10, 1, 0 }, 283 { "CPU Core", 0, 0, 10, 1, 0 },
284 { "DDR", 1, 0, 20, 1, 0 }, 284 { "DDR", 1, 0, 20, 1, 0 },
285 { "DDR VTT", 2, 0, 10, 1, 0 }, 285 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
402 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 402 { "AUX3 Fan", 36, 2, 60, 1, 0 },
403 { NULL, 0, 0, 0, 0, 0 } } 403 { NULL, 0, 0, 0, 0, 0 } }
404 }, 404 },
405 { 0x0016, "AW9D-MAX (Intel i975-ICH7)", { 405 { 0x0016, "AW9D-MAX", {
406 { "CPU Core", 0, 0, 10, 1, 0 }, 406 { "CPU Core", 0, 0, 10, 1, 0 },
407 { "DDR2", 1, 0, 20, 1, 0 }, 407 { "DDR2", 1, 0, 20, 1, 0 },
408 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 408 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -482,7 +482,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
482 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 482 { "AUX3 Fan", 36, 2, 60, 1, 0 },
483 { NULL, 0, 0, 0, 0, 0 } } 483 { NULL, 0, 0, 0, 0, 0 } }
484 }, 484 },
485 { 0x0019, NULL /* Unknown, need DMI string */, { 485 { 0x0019, "IN9 32X MAX", {
486 { "CPU Core", 7, 0, 10, 1, 0 }, 486 { "CPU Core", 7, 0, 10, 1, 0 },
487 { "DDR2", 13, 0, 20, 1, 0 }, 487 { "DDR2", 13, 0, 20, 1, 0 },
488 { "DDR2 VTT", 14, 0, 10, 1, 0 }, 488 { "DDR2 VTT", 14, 0, 10, 1, 0 },
@@ -509,7 +509,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
509 { "AUX3 FAN", 36, 2, 60, 1, 0 }, 509 { "AUX3 FAN", 36, 2, 60, 1, 0 },
510 { NULL, 0, 0, 0, 0, 0 } } 510 { NULL, 0, 0, 0, 0, 0 } }
511 }, 511 },
512 { 0x001A, "IP35 Pro(Intel P35-ICH9R)", { 512 { 0x001A, "IP35 Pro", {
513 { "CPU Core", 0, 0, 10, 1, 0 }, 513 { "CPU Core", 0, 0, 10, 1, 0 },
514 { "DDR2", 1, 0, 20, 1, 0 }, 514 { "DDR2", 1, 0, 20, 1, 0 },
515 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 515 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -1128,6 +1128,7 @@ static int __init abituguru3_dmi_detect(void)
1128{ 1128{
1129 const char *board_vendor, *board_name; 1129 const char *board_vendor, *board_name;
1130 int i, err = (force) ? 1 : -ENODEV; 1130 int i, err = (force) ? 1 : -ENODEV;
1131 size_t sublen;
1131 1132
1132 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); 1133 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
1133 if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) 1134 if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/"))
@@ -1137,9 +1138,20 @@ static int __init abituguru3_dmi_detect(void)
1137 if (!board_name) 1138 if (!board_name)
1138 return err; 1139 return err;
1139 1140
1141 /* At the moment, we don't care about the part of the vendor
1142 * DMI string contained in brackets. Truncate the string at
1143 * the first occurrence of a bracket. Trim any trailing space
1144 * from the substring.
1145 */
1146 sublen = strcspn(board_name, "(");
1147 while (sublen > 0 && board_name[sublen - 1] == ' ')
1148 sublen--;
1149
1140 for (i = 0; abituguru3_motherboards[i].id; i++) { 1150 for (i = 0; abituguru3_motherboards[i].id; i++) {
1141 const char *dmi_name = abituguru3_motherboards[i].dmi_name; 1151 const char *dmi_name = abituguru3_motherboards[i].dmi_name;
1142 if (dmi_name && !strcmp(dmi_name, board_name)) 1152 if (!dmi_name || strlen(dmi_name) != sublen)
1153 continue;
1154 if (!strncasecmp(board_name, dmi_name, sublen))
1143 break; 1155 break;
1144 } 1156 }
1145 1157
@@ -1153,7 +1165,7 @@ static int __init abituguru3_dmi_detect(void)
1153 1165
1154static inline int abituguru3_dmi_detect(void) 1166static inline int abituguru3_dmi_detect(void)
1155{ 1167{
1156 return -ENODEV; 1168 return 1;
1157} 1169}
1158 1170
1159#endif /* CONFIG_DMI */ 1171#endif /* CONFIG_DMI */
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
new file mode 100644
index 000000000000..d39877a7da63
--- /dev/null
+++ b/drivers/hwmon/adt7475.c
@@ -0,0 +1,1221 @@
1/*
2 * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives
3 * Copyright (C) 2007-2008, Advanced Micro Devices, Inc.
4 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
5 * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com>
6
7 * Derived from the lm83 driver by Jean Delvare
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/slab.h>
17#include <linux/i2c.h>
18#include <linux/hwmon.h>
19#include <linux/hwmon-sysfs.h>
20#include <linux/err.h>
21
22/* Indexes for the sysfs hooks */
23
24#define INPUT 0
25#define MIN 1
26#define MAX 2
27#define CONTROL 3
28#define OFFSET 3
29#define AUTOMIN 4
30#define THERM 5
31#define HYSTERSIS 6
32
33/* These are unique identifiers for the sysfs functions - unlike the
34 numbers above, these are not also indexes into an array
35*/
36
37#define ALARM 9
38#define FAULT 10
39
40/* 7475 Common Registers */
41
42#define REG_VOLTAGE_BASE 0x21
43#define REG_TEMP_BASE 0x25
44#define REG_TACH_BASE 0x28
45#define REG_PWM_BASE 0x30
46#define REG_PWM_MAX_BASE 0x38
47
48#define REG_DEVID 0x3D
49#define REG_VENDID 0x3E
50
51#define REG_STATUS1 0x41
52#define REG_STATUS2 0x42
53
54#define REG_VOLTAGE_MIN_BASE 0x46
55#define REG_VOLTAGE_MAX_BASE 0x47
56
57#define REG_TEMP_MIN_BASE 0x4E
58#define REG_TEMP_MAX_BASE 0x4F
59
60#define REG_TACH_MIN_BASE 0x54
61
62#define REG_PWM_CONFIG_BASE 0x5C
63
64#define REG_TEMP_TRANGE_BASE 0x5F
65
66#define REG_PWM_MIN_BASE 0x64
67
68#define REG_TEMP_TMIN_BASE 0x67
69#define REG_TEMP_THERM_BASE 0x6A
70
71#define REG_REMOTE1_HYSTERSIS 0x6D
72#define REG_REMOTE2_HYSTERSIS 0x6E
73
74#define REG_TEMP_OFFSET_BASE 0x70
75
76#define REG_EXTEND1 0x76
77#define REG_EXTEND2 0x77
78#define REG_CONFIG5 0x7C
79
80#define CONFIG5_TWOSCOMP 0x01
81#define CONFIG5_TEMPOFFSET 0x02
82
83/* ADT7475 Settings */
84
85#define ADT7475_VOLTAGE_COUNT 2
86#define ADT7475_TEMP_COUNT 3
87#define ADT7475_TACH_COUNT 4
88#define ADT7475_PWM_COUNT 3
89
90/* Macro to read the registers */
91
92#define adt7475_read(reg) i2c_smbus_read_byte_data(client, (reg))
93
94/* Macros to easily index the registers */
95
96#define TACH_REG(idx) (REG_TACH_BASE + ((idx) * 2))
97#define TACH_MIN_REG(idx) (REG_TACH_MIN_BASE + ((idx) * 2))
98
99#define PWM_REG(idx) (REG_PWM_BASE + (idx))
100#define PWM_MAX_REG(idx) (REG_PWM_MAX_BASE + (idx))
101#define PWM_MIN_REG(idx) (REG_PWM_MIN_BASE + (idx))
102#define PWM_CONFIG_REG(idx) (REG_PWM_CONFIG_BASE + (idx))
103
104#define VOLTAGE_REG(idx) (REG_VOLTAGE_BASE + (idx))
105#define VOLTAGE_MIN_REG(idx) (REG_VOLTAGE_MIN_BASE + ((idx) * 2))
106#define VOLTAGE_MAX_REG(idx) (REG_VOLTAGE_MAX_BASE + ((idx) * 2))
107
108#define TEMP_REG(idx) (REG_TEMP_BASE + (idx))
109#define TEMP_MIN_REG(idx) (REG_TEMP_MIN_BASE + ((idx) * 2))
110#define TEMP_MAX_REG(idx) (REG_TEMP_MAX_BASE + ((idx) * 2))
111#define TEMP_TMIN_REG(idx) (REG_TEMP_TMIN_BASE + (idx))
112#define TEMP_THERM_REG(idx) (REG_TEMP_THERM_BASE + (idx))
113#define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx))
114#define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx))
115
116static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END };
117
118I2C_CLIENT_INSMOD_1(adt7475);
119
120static const struct i2c_device_id adt7475_id[] = {
121 { "adt7475", adt7475 },
122 { }
123};
124MODULE_DEVICE_TABLE(i2c, adt7475_id);
125
126struct adt7475_data {
127 struct device *hwmon_dev;
128 struct mutex lock;
129
130 unsigned long measure_updated;
131 unsigned long limits_updated;
132 char valid;
133
134 u8 config5;
135 u16 alarms;
136 u16 voltage[3][3];
137 u16 temp[7][3];
138 u16 tach[2][4];
139 u8 pwm[4][3];
140 u8 range[3];
141 u8 pwmctl[3];
142 u8 pwmchan[3];
143};
144
145static struct i2c_driver adt7475_driver;
146static struct adt7475_data *adt7475_update_device(struct device *dev);
147static void adt7475_read_hystersis(struct i2c_client *client);
148static void adt7475_read_pwm(struct i2c_client *client, int index);
149
150/* Given a temp value, convert it to register value */
151
152static inline u16 temp2reg(struct adt7475_data *data, long val)
153{
154 u16 ret;
155
156 if (!(data->config5 & CONFIG5_TWOSCOMP)) {
157 val = SENSORS_LIMIT(val, -64000, 191000);
158 ret = (val + 64500) / 1000;
159 } else {
160 val = SENSORS_LIMIT(val, -128000, 127000);
161 if (val < -500)
162 ret = (256500 + val) / 1000;
163 else
164 ret = (val + 500) / 1000;
165 }
166
167 return ret << 2;
168}
169
170/* Given a register value, convert it to a real temp value */
171
172static inline int reg2temp(struct adt7475_data *data, u16 reg)
173{
174 if (data->config5 & CONFIG5_TWOSCOMP) {
175 if (reg >= 512)
176 return (reg - 1024) * 250;
177 else
178 return reg * 250;
179 } else
180 return (reg - 256) * 250;
181}
182
183static inline int tach2rpm(u16 tach)
184{
185 if (tach == 0 || tach == 0xFFFF)
186 return 0;
187
188 return (90000 * 60) / tach;
189}
190
191static inline u16 rpm2tach(unsigned long rpm)
192{
193 if (rpm == 0)
194 return 0;
195
196 return SENSORS_LIMIT((90000 * 60) / rpm, 1, 0xFFFF);
197}
198
199static inline int reg2vcc(u16 reg)
200{
201 return (4296 * reg) / 1000;
202}
203
204static inline int reg2vccp(u16 reg)
205{
206 return (2929 * reg) / 1000;
207}
208
209static inline u16 vcc2reg(long vcc)
210{
211 vcc = SENSORS_LIMIT(vcc, 0, 4396);
212 return (vcc * 1000) / 4296;
213}
214
215static inline u16 vccp2reg(long vcc)
216{
217 vcc = SENSORS_LIMIT(vcc, 0, 2998);
218 return (vcc * 1000) / 2929;
219}
220
221static u16 adt7475_read_word(struct i2c_client *client, int reg)
222{
223 u16 val;
224
225 val = i2c_smbus_read_byte_data(client, reg);
226 val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8);
227
228 return val;
229}
230
231static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
232{
233 i2c_smbus_write_byte_data(client, reg + 1, val >> 8);
234 i2c_smbus_write_byte_data(client, reg, val & 0xFF);
235}
236
237/* Find the nearest value in a table - used for pwm frequency and
238 auto temp range */
239static int find_nearest(long val, const int *array, int size)
240{
241 int i;
242
243 if (val < array[0])
244 return 0;
245
246 if (val > array[size - 1])
247 return size - 1;
248
249 for (i = 0; i < size - 1; i++) {
250 int a, b;
251
252 if (val > array[i + 1])
253 continue;
254
255 a = val - array[i];
256 b = array[i + 1] - val;
257
258 return (a <= b) ? i : i + 1;
259 }
260
261 return 0;
262}
263
264static ssize_t show_voltage(struct device *dev, struct device_attribute *attr,
265 char *buf)
266{
267 struct adt7475_data *data = adt7475_update_device(dev);
268 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
269 unsigned short val;
270
271 switch (sattr->nr) {
272 case ALARM:
273 return sprintf(buf, "%d\n",
274 (data->alarms >> (sattr->index + 1)) & 1);
275 default:
276 val = data->voltage[sattr->nr][sattr->index];
277 return sprintf(buf, "%d\n",
278 sattr->index ==
279 0 ? reg2vccp(val) : reg2vcc(val));
280 }
281}
282
283static ssize_t set_voltage(struct device *dev, struct device_attribute *attr,
284 const char *buf, size_t count)
285{
286
287 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
288 struct i2c_client *client = to_i2c_client(dev);
289 struct adt7475_data *data = i2c_get_clientdata(client);
290 unsigned char reg;
291 long val;
292
293 if (strict_strtol(buf, 10, &val))
294 return -EINVAL;
295
296 mutex_lock(&data->lock);
297
298 data->voltage[sattr->nr][sattr->index] =
299 sattr->index ? vcc2reg(val) : vccp2reg(val);
300
301 if (sattr->nr == MIN)
302 reg = VOLTAGE_MIN_REG(sattr->index);
303 else
304 reg = VOLTAGE_MAX_REG(sattr->index);
305
306 i2c_smbus_write_byte_data(client, reg,
307 data->voltage[sattr->nr][sattr->index] >> 2);
308 mutex_unlock(&data->lock);
309
310 return count;
311}
312
313static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
314 char *buf)
315{
316 struct adt7475_data *data = adt7475_update_device(dev);
317 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
318 int out;
319
320 switch (sattr->nr) {
321 case HYSTERSIS:
322 mutex_lock(&data->lock);
323 out = data->temp[sattr->nr][sattr->index];
324 if (sattr->index != 1)
325 out = (out >> 4) & 0xF;
326 else
327 out = (out & 0xF);
328 /* Show the value as an absolute number tied to
329 * THERM */
330 out = reg2temp(data, data->temp[THERM][sattr->index]) -
331 out * 1000;
332 mutex_unlock(&data->lock);
333 break;
334
335 case OFFSET:
336 /* Offset is always 2's complement, regardless of the
337 * setting in CONFIG5 */
338 mutex_lock(&data->lock);
339 out = (s8)data->temp[sattr->nr][sattr->index];
340 if (data->config5 & CONFIG5_TEMPOFFSET)
341 out *= 1000;
342 else
343 out *= 500;
344 mutex_unlock(&data->lock);
345 break;
346
347 case ALARM:
348 out = (data->alarms >> (sattr->index + 4)) & 1;
349 break;
350
351 case FAULT:
352 /* Note - only for remote1 and remote2 */
353 out = data->alarms & (sattr->index ? 0x8000 : 0x4000);
354 out = out ? 0 : 1;
355 break;
356
357 default:
358 /* All other temp values are in the configured format */
359 out = reg2temp(data, data->temp[sattr->nr][sattr->index]);
360 }
361
362 return sprintf(buf, "%d\n", out);
363}
364
365static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
366 const char *buf, size_t count)
367{
368 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
369 struct i2c_client *client = to_i2c_client(dev);
370 struct adt7475_data *data = i2c_get_clientdata(client);
371 unsigned char reg = 0;
372 u8 out;
373 int temp;
374 long val;
375
376 if (strict_strtol(buf, 10, &val))
377 return -EINVAL;
378
379 mutex_lock(&data->lock);
380
381 /* We need the config register in all cases for temp <-> reg conv. */
382 data->config5 = adt7475_read(REG_CONFIG5);
383
384 switch (sattr->nr) {
385 case OFFSET:
386 if (data->config5 & CONFIG5_TEMPOFFSET) {
387 val = SENSORS_LIMIT(val, -63000, 127000);
388 out = data->temp[OFFSET][sattr->index] = val / 1000;
389 } else {
390 val = SENSORS_LIMIT(val, -63000, 64000);
391 out = data->temp[OFFSET][sattr->index] = val / 500;
392 }
393 break;
394
395 case HYSTERSIS:
396 /* The value will be given as an absolute value, turn it
397 into an offset based on THERM */
398
399 /* Read fresh THERM and HYSTERSIS values from the chip */
400 data->temp[THERM][sattr->index] =
401 adt7475_read(TEMP_THERM_REG(sattr->index)) << 2;
402 adt7475_read_hystersis(client);
403
404 temp = reg2temp(data, data->temp[THERM][sattr->index]);
405 val = SENSORS_LIMIT(val, temp - 15000, temp);
406 val = (temp - val) / 1000;
407
408 if (sattr->index != 1) {
409 data->temp[HYSTERSIS][sattr->index] &= 0xF0;
410 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4;
411 } else {
412 data->temp[HYSTERSIS][sattr->index] &= 0x0F;
413 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF);
414 }
415
416 out = data->temp[HYSTERSIS][sattr->index];
417 break;
418
419 default:
420 data->temp[sattr->nr][sattr->index] = temp2reg(data, val);
421
422 /* We maintain an extra 2 digits of precision for simplicity
423 * - shift those back off before writing the value */
424 out = (u8) (data->temp[sattr->nr][sattr->index] >> 2);
425 }
426
427 switch (sattr->nr) {
428 case MIN:
429 reg = TEMP_MIN_REG(sattr->index);
430 break;
431 case MAX:
432 reg = TEMP_MAX_REG(sattr->index);
433 break;
434 case OFFSET:
435 reg = TEMP_OFFSET_REG(sattr->index);
436 break;
437 case AUTOMIN:
438 reg = TEMP_TMIN_REG(sattr->index);
439 break;
440 case THERM:
441 reg = TEMP_THERM_REG(sattr->index);
442 break;
443 case HYSTERSIS:
444 if (sattr->index != 2)
445 reg = REG_REMOTE1_HYSTERSIS;
446 else
447 reg = REG_REMOTE2_HYSTERSIS;
448
449 break;
450 }
451
452 i2c_smbus_write_byte_data(client, reg, out);
453
454 mutex_unlock(&data->lock);
455 return count;
456}
457
458/* Table of autorange values - the user will write the value in millidegrees,
459 and we'll convert it */
460static const int autorange_table[] = {
461 2000, 2500, 3330, 4000, 5000, 6670, 8000,
462 10000, 13330, 16000, 20000, 26670, 32000, 40000,
463 53330, 80000
464};
465
466static ssize_t show_point2(struct device *dev, struct device_attribute *attr,
467 char *buf)
468{
469 struct adt7475_data *data = adt7475_update_device(dev);
470 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
471 int out, val;
472
473 mutex_lock(&data->lock);
474 out = (data->range[sattr->index] >> 4) & 0x0F;
475 val = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
476 mutex_unlock(&data->lock);
477
478 return sprintf(buf, "%d\n", val + autorange_table[out]);
479}
480
481static ssize_t set_point2(struct device *dev, struct device_attribute *attr,
482 const char *buf, size_t count)
483{
484 struct i2c_client *client = to_i2c_client(dev);
485 struct adt7475_data *data = i2c_get_clientdata(client);
486 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
487 int temp;
488 long val;
489
490 if (strict_strtol(buf, 10, &val))
491 return -EINVAL;
492
493 mutex_lock(&data->lock);
494
495 /* Get a fresh copy of the needed registers */
496 data->config5 = adt7475_read(REG_CONFIG5);
497 data->temp[AUTOMIN][sattr->index] =
498 adt7475_read(TEMP_TMIN_REG(sattr->index)) << 2;
499 data->range[sattr->index] =
500 adt7475_read(TEMP_TRANGE_REG(sattr->index));
501
502 /* The user will write an absolute value, so subtract the start point
503 to figure the range */
504 temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
505 val = SENSORS_LIMIT(val, temp + autorange_table[0],
506 temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]);
507 val -= temp;
508
509 /* Find the nearest table entry to what the user wrote */
510 val = find_nearest(val, autorange_table, ARRAY_SIZE(autorange_table));
511
512 data->range[sattr->index] &= ~0xF0;
513 data->range[sattr->index] |= val << 4;
514
515 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index),
516 data->range[sattr->index]);
517
518 mutex_unlock(&data->lock);
519 return count;
520}
521
522static ssize_t show_tach(struct device *dev, struct device_attribute *attr,
523 char *buf)
524{
525 struct adt7475_data *data = adt7475_update_device(dev);
526 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
527 int out;
528
529 if (sattr->nr == ALARM)
530 out = (data->alarms >> (sattr->index + 10)) & 1;
531 else
532 out = tach2rpm(data->tach[sattr->nr][sattr->index]);
533
534 return sprintf(buf, "%d\n", out);
535}
536
537static ssize_t set_tach(struct device *dev, struct device_attribute *attr,
538 const char *buf, size_t count)
539{
540
541 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
542 struct i2c_client *client = to_i2c_client(dev);
543 struct adt7475_data *data = i2c_get_clientdata(client);
544 unsigned long val;
545
546 if (strict_strtoul(buf, 10, &val))
547 return -EINVAL;
548
549 mutex_lock(&data->lock);
550
551 data->tach[MIN][sattr->index] = rpm2tach(val);
552
553 adt7475_write_word(client, TACH_MIN_REG(sattr->index),
554 data->tach[MIN][sattr->index]);
555
556 mutex_unlock(&data->lock);
557 return count;
558}
559
560static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
561 char *buf)
562{
563 struct adt7475_data *data = adt7475_update_device(dev);
564 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
565
566 return sprintf(buf, "%d\n", data->pwm[sattr->nr][sattr->index]);
567}
568
569static ssize_t show_pwmchan(struct device *dev, struct device_attribute *attr,
570 char *buf)
571{
572 struct adt7475_data *data = adt7475_update_device(dev);
573 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
574
575 return sprintf(buf, "%d\n", data->pwmchan[sattr->index]);
576}
577
578static ssize_t show_pwmctrl(struct device *dev, struct device_attribute *attr,
579 char *buf)
580{
581 struct adt7475_data *data = adt7475_update_device(dev);
582 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
583
584 return sprintf(buf, "%d\n", data->pwmctl[sattr->index]);
585}
586
587static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
588 const char *buf, size_t count)
589{
590
591 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
592 struct i2c_client *client = to_i2c_client(dev);
593 struct adt7475_data *data = i2c_get_clientdata(client);
594 unsigned char reg = 0;
595 long val;
596
597 if (strict_strtol(buf, 10, &val))
598 return -EINVAL;
599
600 mutex_lock(&data->lock);
601
602 switch (sattr->nr) {
603 case INPUT:
604 /* Get a fresh value for CONTROL */
605 data->pwm[CONTROL][sattr->index] =
606 adt7475_read(PWM_CONFIG_REG(sattr->index));
607
608 /* If we are not in manual mode, then we shouldn't allow
609 * the user to set the pwm speed */
610 if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) {
611 mutex_unlock(&data->lock);
612 return count;
613 }
614
615 reg = PWM_REG(sattr->index);
616 break;
617
618 case MIN:
619 reg = PWM_MIN_REG(sattr->index);
620 break;
621
622 case MAX:
623 reg = PWM_MAX_REG(sattr->index);
624 break;
625 }
626
627 data->pwm[sattr->nr][sattr->index] = SENSORS_LIMIT(val, 0, 0xFF);
628 i2c_smbus_write_byte_data(client, reg,
629 data->pwm[sattr->nr][sattr->index]);
630
631 mutex_unlock(&data->lock);
632
633 return count;
634}
635
636/* Called by set_pwmctrl and set_pwmchan */
637
638static int hw_set_pwm(struct i2c_client *client, int index,
639 unsigned int pwmctl, unsigned int pwmchan)
640{
641 struct adt7475_data *data = i2c_get_clientdata(client);
642 long val = 0;
643
644 switch (pwmctl) {
645 case 0:
646 val = 0x03; /* Run at full speed */
647 break;
648 case 1:
649 val = 0x07; /* Manual mode */
650 break;
651 case 2:
652 switch (pwmchan) {
653 case 1:
654 /* Remote1 controls PWM */
655 val = 0x00;
656 break;
657 case 2:
658 /* local controls PWM */
659 val = 0x01;
660 break;
661 case 4:
662 /* remote2 controls PWM */
663 val = 0x02;
664 break;
665 case 6:
666 /* local/remote2 control PWM */
667 val = 0x05;
668 break;
669 case 7:
670 /* All three control PWM */
671 val = 0x06;
672 break;
673 default:
674 return -EINVAL;
675 }
676 break;
677 default:
678 return -EINVAL;
679 }
680
681 data->pwmctl[index] = pwmctl;
682 data->pwmchan[index] = pwmchan;
683
684 data->pwm[CONTROL][index] &= ~0xE0;
685 data->pwm[CONTROL][index] |= (val & 7) << 5;
686
687 i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index),
688 data->pwm[CONTROL][index]);
689
690 return 0;
691}
692
693static ssize_t set_pwmchan(struct device *dev, struct device_attribute *attr,
694 const char *buf, size_t count)
695{
696 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
697 struct i2c_client *client = to_i2c_client(dev);
698 struct adt7475_data *data = i2c_get_clientdata(client);
699 int r;
700 long val;
701
702 if (strict_strtol(buf, 10, &val))
703 return -EINVAL;
704
705 mutex_lock(&data->lock);
706 /* Read Modify Write PWM values */
707 adt7475_read_pwm(client, sattr->index);
708 r = hw_set_pwm(client, sattr->index, data->pwmctl[sattr->index], val);
709 if (r)
710 count = r;
711 mutex_unlock(&data->lock);
712
713 return count;
714}
715
716static ssize_t set_pwmctrl(struct device *dev, struct device_attribute *attr,
717 const char *buf, size_t count)
718{
719 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
720 struct i2c_client *client = to_i2c_client(dev);
721 struct adt7475_data *data = i2c_get_clientdata(client);
722 int r;
723 long val;
724
725 if (strict_strtol(buf, 10, &val))
726 return -EINVAL;
727
728 mutex_lock(&data->lock);
729 /* Read Modify Write PWM values */
730 adt7475_read_pwm(client, sattr->index);
731 r = hw_set_pwm(client, sattr->index, val, data->pwmchan[sattr->index]);
732 if (r)
733 count = r;
734 mutex_unlock(&data->lock);
735
736 return count;
737}
738
739/* List of frequencies for the PWM */
740static const int pwmfreq_table[] = {
741 11, 14, 22, 29, 35, 44, 58, 88
742};
743
744static ssize_t show_pwmfreq(struct device *dev, struct device_attribute *attr,
745 char *buf)
746{
747 struct adt7475_data *data = adt7475_update_device(dev);
748 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
749
750 return sprintf(buf, "%d\n",
751 pwmfreq_table[data->range[sattr->index] & 7]);
752}
753
754static ssize_t set_pwmfreq(struct device *dev, struct device_attribute *attr,
755 const char *buf, size_t count)
756{
757 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
758 struct i2c_client *client = to_i2c_client(dev);
759 struct adt7475_data *data = i2c_get_clientdata(client);
760 int out;
761 long val;
762
763 if (strict_strtol(buf, 10, &val))
764 return -EINVAL;
765
766 out = find_nearest(val, pwmfreq_table, ARRAY_SIZE(pwmfreq_table));
767
768 mutex_lock(&data->lock);
769
770 data->range[sattr->index] =
771 adt7475_read(TEMP_TRANGE_REG(sattr->index));
772 data->range[sattr->index] &= ~7;
773 data->range[sattr->index] |= out;
774
775 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index),
776 data->range[sattr->index]);
777
778 mutex_unlock(&data->lock);
779 return count;
780}
781
782static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_voltage, NULL, INPUT, 0);
783static SENSOR_DEVICE_ATTR_2(in1_max, S_IRUGO | S_IWUSR, show_voltage,
784 set_voltage, MAX, 0);
785static SENSOR_DEVICE_ATTR_2(in1_min, S_IRUGO | S_IWUSR, show_voltage,
786 set_voltage, MIN, 0);
787static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, show_voltage, NULL, ALARM, 0);
788static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_voltage, NULL, INPUT, 1);
789static SENSOR_DEVICE_ATTR_2(in2_max, S_IRUGO | S_IWUSR, show_voltage,
790 set_voltage, MAX, 1);
791static SENSOR_DEVICE_ATTR_2(in2_min, S_IRUGO | S_IWUSR, show_voltage,
792 set_voltage, MIN, 1);
793static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, show_voltage, NULL, ALARM, 1);
794static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, INPUT, 0);
795static SENSOR_DEVICE_ATTR_2(temp1_alarm, S_IRUGO, show_temp, NULL, ALARM, 0);
796static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_temp, NULL, FAULT, 0);
797static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
798 MAX, 0);
799static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
800 MIN, 0);
801static SENSOR_DEVICE_ATTR_2(temp1_offset, S_IRUGO | S_IWUSR, show_temp,
802 set_temp, OFFSET, 0);
803static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO | S_IWUSR,
804 show_temp, set_temp, AUTOMIN, 0);
805static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IRUGO | S_IWUSR,
806 show_point2, set_point2, 0, 0);
807static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, set_temp,
808 THERM, 0);
809static SENSOR_DEVICE_ATTR_2(temp1_crit_hyst, S_IRUGO | S_IWUSR, show_temp,
810 set_temp, HYSTERSIS, 0);
811static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, INPUT, 1);
812static SENSOR_DEVICE_ATTR_2(temp2_alarm, S_IRUGO, show_temp, NULL, ALARM, 1);
813static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
814 MAX, 1);
815static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
816 MIN, 1);
817static SENSOR_DEVICE_ATTR_2(temp2_offset, S_IRUGO | S_IWUSR, show_temp,
818 set_temp, OFFSET, 1);
819static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IRUGO | S_IWUSR,
820 show_temp, set_temp, AUTOMIN, 1);
821static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IRUGO | S_IWUSR,
822 show_point2, set_point2, 0, 1);
823static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, set_temp,
824 THERM, 1);
825static SENSOR_DEVICE_ATTR_2(temp2_crit_hyst, S_IRUGO | S_IWUSR, show_temp,
826 set_temp, HYSTERSIS, 1);
827static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, INPUT, 2);
828static SENSOR_DEVICE_ATTR_2(temp3_alarm, S_IRUGO, show_temp, NULL, ALARM, 2);
829static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_temp, NULL, FAULT, 2);
830static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
831 MAX, 2);
832static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
833 MIN, 2);
834static SENSOR_DEVICE_ATTR_2(temp3_offset, S_IRUGO | S_IWUSR, show_temp,
835 set_temp, OFFSET, 2);
836static SENSOR_DEVICE_ATTR_2(temp3_auto_point1_temp, S_IRUGO | S_IWUSR,
837 show_temp, set_temp, AUTOMIN, 2);
838static SENSOR_DEVICE_ATTR_2(temp3_auto_point2_temp, S_IRUGO | S_IWUSR,
839 show_point2, set_point2, 0, 2);
840static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, set_temp,
841 THERM, 2);
842static SENSOR_DEVICE_ATTR_2(temp3_crit_hyst, S_IRUGO | S_IWUSR, show_temp,
843 set_temp, HYSTERSIS, 2);
844static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_tach, NULL, INPUT, 0);
845static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
846 MIN, 0);
847static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_tach, NULL, ALARM, 0);
848static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_tach, NULL, INPUT, 1);
849static SENSOR_DEVICE_ATTR_2(fan2_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
850 MIN, 1);
851static SENSOR_DEVICE_ATTR_2(fan2_alarm, S_IRUGO, show_tach, NULL, ALARM, 1);
852static SENSOR_DEVICE_ATTR_2(fan3_input, S_IRUGO, show_tach, NULL, INPUT, 2);
853static SENSOR_DEVICE_ATTR_2(fan3_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
854 MIN, 2);
855static SENSOR_DEVICE_ATTR_2(fan3_alarm, S_IRUGO, show_tach, NULL, ALARM, 2);
856static SENSOR_DEVICE_ATTR_2(fan4_input, S_IRUGO, show_tach, NULL, INPUT, 3);
857static SENSOR_DEVICE_ATTR_2(fan4_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
858 MIN, 3);
859static SENSOR_DEVICE_ATTR_2(fan4_alarm, S_IRUGO, show_tach, NULL, ALARM, 3);
860static SENSOR_DEVICE_ATTR_2(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT,
861 0);
862static SENSOR_DEVICE_ATTR_2(pwm1_freq, S_IRUGO | S_IWUSR, show_pwmfreq,
863 set_pwmfreq, INPUT, 0);
864static SENSOR_DEVICE_ATTR_2(pwm1_enable, S_IRUGO | S_IWUSR, show_pwmctrl,
865 set_pwmctrl, INPUT, 0);
866static SENSOR_DEVICE_ATTR_2(pwm1_auto_channel_temp, S_IRUGO | S_IWUSR,
867 show_pwmchan, set_pwmchan, INPUT, 0);
868static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm,
869 set_pwm, MIN, 0);
870static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm,
871 set_pwm, MAX, 0);
872static SENSOR_DEVICE_ATTR_2(pwm2, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT,
873 1);
874static SENSOR_DEVICE_ATTR_2(pwm2_freq, S_IRUGO | S_IWUSR, show_pwmfreq,
875 set_pwmfreq, INPUT, 1);
876static SENSOR_DEVICE_ATTR_2(pwm2_enable, S_IRUGO | S_IWUSR, show_pwmctrl,
877 set_pwmctrl, INPUT, 1);
878static SENSOR_DEVICE_ATTR_2(pwm2_auto_channel_temp, S_IRUGO | S_IWUSR,
879 show_pwmchan, set_pwmchan, INPUT, 1);
880static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm,
881 set_pwm, MIN, 1);
882static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm,
883 set_pwm, MAX, 1);
884static SENSOR_DEVICE_ATTR_2(pwm3, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT,
885 2);
886static SENSOR_DEVICE_ATTR_2(pwm3_freq, S_IRUGO | S_IWUSR, show_pwmfreq,
887 set_pwmfreq, INPUT, 2);
888static SENSOR_DEVICE_ATTR_2(pwm3_enable, S_IRUGO | S_IWUSR, show_pwmctrl,
889 set_pwmctrl, INPUT, 2);
890static SENSOR_DEVICE_ATTR_2(pwm3_auto_channel_temp, S_IRUGO | S_IWUSR,
891 show_pwmchan, set_pwmchan, INPUT, 2);
892static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm,
893 set_pwm, MIN, 2);
894static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm,
895 set_pwm, MAX, 2);
896
897static struct attribute *adt7475_attrs[] = {
898 &sensor_dev_attr_in1_input.dev_attr.attr,
899 &sensor_dev_attr_in1_max.dev_attr.attr,
900 &sensor_dev_attr_in1_min.dev_attr.attr,
901 &sensor_dev_attr_in1_alarm.dev_attr.attr,
902 &sensor_dev_attr_in2_input.dev_attr.attr,
903 &sensor_dev_attr_in2_max.dev_attr.attr,
904 &sensor_dev_attr_in2_min.dev_attr.attr,
905 &sensor_dev_attr_in2_alarm.dev_attr.attr,
906 &sensor_dev_attr_temp1_input.dev_attr.attr,
907 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
908 &sensor_dev_attr_temp1_fault.dev_attr.attr,
909 &sensor_dev_attr_temp1_max.dev_attr.attr,
910 &sensor_dev_attr_temp1_min.dev_attr.attr,
911 &sensor_dev_attr_temp1_offset.dev_attr.attr,
912 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
913 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
914 &sensor_dev_attr_temp1_crit.dev_attr.attr,
915 &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,
916 &sensor_dev_attr_temp2_input.dev_attr.attr,
917 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
918 &sensor_dev_attr_temp2_max.dev_attr.attr,
919 &sensor_dev_attr_temp2_min.dev_attr.attr,
920 &sensor_dev_attr_temp2_offset.dev_attr.attr,
921 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
922 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
923 &sensor_dev_attr_temp2_crit.dev_attr.attr,
924 &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr,
925 &sensor_dev_attr_temp3_input.dev_attr.attr,
926 &sensor_dev_attr_temp3_fault.dev_attr.attr,
927 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
928 &sensor_dev_attr_temp3_max.dev_attr.attr,
929 &sensor_dev_attr_temp3_min.dev_attr.attr,
930 &sensor_dev_attr_temp3_offset.dev_attr.attr,
931 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
932 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
933 &sensor_dev_attr_temp3_crit.dev_attr.attr,
934 &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr,
935 &sensor_dev_attr_fan1_input.dev_attr.attr,
936 &sensor_dev_attr_fan1_min.dev_attr.attr,
937 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
938 &sensor_dev_attr_fan2_input.dev_attr.attr,
939 &sensor_dev_attr_fan2_min.dev_attr.attr,
940 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
941 &sensor_dev_attr_fan3_input.dev_attr.attr,
942 &sensor_dev_attr_fan3_min.dev_attr.attr,
943 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
944 &sensor_dev_attr_fan4_input.dev_attr.attr,
945 &sensor_dev_attr_fan4_min.dev_attr.attr,
946 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
947 &sensor_dev_attr_pwm1.dev_attr.attr,
948 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
949 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
950 &sensor_dev_attr_pwm1_auto_channel_temp.dev_attr.attr,
951 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
952 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
953 &sensor_dev_attr_pwm2.dev_attr.attr,
954 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
955 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
956 &sensor_dev_attr_pwm2_auto_channel_temp.dev_attr.attr,
957 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
958 &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
959 &sensor_dev_attr_pwm3.dev_attr.attr,
960 &sensor_dev_attr_pwm3_freq.dev_attr.attr,
961 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
962 &sensor_dev_attr_pwm3_auto_channel_temp.dev_attr.attr,
963 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
964 &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
965 NULL,
966};
967
968struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs };
969
970static int adt7475_detect(struct i2c_client *client, int kind,
971 struct i2c_board_info *info)
972{
973 struct i2c_adapter *adapter = client->adapter;
974
975 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
976 return -ENODEV;
977
978 if (kind <= 0) {
979 if (adt7475_read(REG_VENDID) != 0x41 ||
980 adt7475_read(REG_DEVID) != 0x75) {
981 dev_err(&adapter->dev,
982 "Couldn't detect a adt7475 part at 0x%02x\n",
983 (unsigned int)client->addr);
984 return -ENODEV;
985 }
986 }
987
988 strlcpy(info->type, adt7475_id[0].name, I2C_NAME_SIZE);
989
990 return 0;
991}
992
993static int adt7475_probe(struct i2c_client *client,
994 const struct i2c_device_id *id)
995{
996 struct adt7475_data *data;
997 int i, ret = 0;
998
999 data = kzalloc(sizeof(*data), GFP_KERNEL);
1000 if (data == NULL)
1001 return -ENOMEM;
1002
1003 mutex_init(&data->lock);
1004 i2c_set_clientdata(client, data);
1005
1006 /* Call adt7475_read_pwm for all pwm's as this will reprogram any
1007 pwm's which are disabled to manual mode with 0% duty cycle */
1008 for (i = 0; i < ADT7475_PWM_COUNT; i++)
1009 adt7475_read_pwm(client, i);
1010
1011 ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group);
1012 if (ret)
1013 goto efree;
1014
1015 data->hwmon_dev = hwmon_device_register(&client->dev);
1016 if (IS_ERR(data->hwmon_dev)) {
1017 ret = PTR_ERR(data->hwmon_dev);
1018 goto eremove;
1019 }
1020
1021 return 0;
1022
1023eremove:
1024 sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group);
1025efree:
1026 kfree(data);
1027 return ret;
1028}
1029
1030static int adt7475_remove(struct i2c_client *client)
1031{
1032 struct adt7475_data *data = i2c_get_clientdata(client);
1033
1034 hwmon_device_unregister(data->hwmon_dev);
1035 sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group);
1036 kfree(data);
1037
1038 return 0;
1039}
1040
1041static struct i2c_driver adt7475_driver = {
1042 .class = I2C_CLASS_HWMON,
1043 .driver = {
1044 .name = "adt7475",
1045 },
1046 .probe = adt7475_probe,
1047 .remove = adt7475_remove,
1048 .id_table = adt7475_id,
1049 .detect = adt7475_detect,
1050 .address_data = &addr_data,
1051};
1052
1053static void adt7475_read_hystersis(struct i2c_client *client)
1054{
1055 struct adt7475_data *data = i2c_get_clientdata(client);
1056
1057 data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS);
1058 data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0];
1059 data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS);
1060}
1061
1062static void adt7475_read_pwm(struct i2c_client *client, int index)
1063{
1064 struct adt7475_data *data = i2c_get_clientdata(client);
1065 unsigned int v;
1066
1067 data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index));
1068
1069 /* Figure out the internal value for pwmctrl and pwmchan
1070 based on the current settings */
1071 v = (data->pwm[CONTROL][index] >> 5) & 7;
1072
1073 if (v == 3)
1074 data->pwmctl[index] = 0;
1075 else if (v == 7)
1076 data->pwmctl[index] = 1;
1077 else if (v == 4) {
1078 /* The fan is disabled - we don't want to
1079 support that, so change to manual mode and
1080 set the duty cycle to 0 instead
1081 */
1082 data->pwm[INPUT][index] = 0;
1083 data->pwm[CONTROL][index] &= ~0xE0;
1084 data->pwm[CONTROL][index] |= (7 << 5);
1085
1086 i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index),
1087 data->pwm[INPUT][index]);
1088
1089 i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index),
1090 data->pwm[CONTROL][index]);
1091
1092 data->pwmctl[index] = 1;
1093 } else {
1094 data->pwmctl[index] = 2;
1095
1096 switch (v) {
1097 case 0:
1098 data->pwmchan[index] = 1;
1099 break;
1100 case 1:
1101 data->pwmchan[index] = 2;
1102 break;
1103 case 2:
1104 data->pwmchan[index] = 4;
1105 break;
1106 case 5:
1107 data->pwmchan[index] = 6;
1108 break;
1109 case 6:
1110 data->pwmchan[index] = 7;
1111 break;
1112 }
1113 }
1114}
1115
1116static struct adt7475_data *adt7475_update_device(struct device *dev)
1117{
1118 struct i2c_client *client = to_i2c_client(dev);
1119 struct adt7475_data *data = i2c_get_clientdata(client);
1120 u8 ext;
1121 int i;
1122
1123 mutex_lock(&data->lock);
1124
1125 /* Measurement values update every 2 seconds */
1126 if (time_after(jiffies, data->measure_updated + HZ * 2) ||
1127 !data->valid) {
1128 data->alarms = adt7475_read(REG_STATUS2) << 8;
1129 data->alarms |= adt7475_read(REG_STATUS1);
1130
1131 ext = adt7475_read(REG_EXTEND1);
1132 for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++)
1133 data->voltage[INPUT][i] =
1134 (adt7475_read(VOLTAGE_REG(i)) << 2) |
1135 ((ext >> ((i + 1) * 2)) & 3);
1136
1137 ext = adt7475_read(REG_EXTEND2);
1138 for (i = 0; i < ADT7475_TEMP_COUNT; i++)
1139 data->temp[INPUT][i] =
1140 (adt7475_read(TEMP_REG(i)) << 2) |
1141 ((ext >> ((i + 1) * 2)) & 3);
1142
1143 for (i = 0; i < ADT7475_TACH_COUNT; i++)
1144 data->tach[INPUT][i] =
1145 adt7475_read_word(client, TACH_REG(i));
1146
1147 /* Updated by hw when in auto mode */
1148 for (i = 0; i < ADT7475_PWM_COUNT; i++)
1149 data->pwm[INPUT][i] = adt7475_read(PWM_REG(i));
1150
1151 data->measure_updated = jiffies;
1152 }
1153
1154 /* Limits and settings, should never change update every 60 seconds */
1155 if (time_after(jiffies, data->limits_updated + HZ * 2) ||
1156 !data->valid) {
1157 data->config5 = adt7475_read(REG_CONFIG5);
1158
1159 for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++) {
1160 /* Adjust values so they match the input precision */
1161 data->voltage[MIN][i] =
1162 adt7475_read(VOLTAGE_MIN_REG(i)) << 2;
1163 data->voltage[MAX][i] =
1164 adt7475_read(VOLTAGE_MAX_REG(i)) << 2;
1165 }
1166
1167 for (i = 0; i < ADT7475_TEMP_COUNT; i++) {
1168 /* Adjust values so they match the input precision */
1169 data->temp[MIN][i] =
1170 adt7475_read(TEMP_MIN_REG(i)) << 2;
1171 data->temp[MAX][i] =
1172 adt7475_read(TEMP_MAX_REG(i)) << 2;
1173 data->temp[AUTOMIN][i] =
1174 adt7475_read(TEMP_TMIN_REG(i)) << 2;
1175 data->temp[THERM][i] =
1176 adt7475_read(TEMP_THERM_REG(i)) << 2;
1177 data->temp[OFFSET][i] =
1178 adt7475_read(TEMP_OFFSET_REG(i));
1179 }
1180 adt7475_read_hystersis(client);
1181
1182 for (i = 0; i < ADT7475_TACH_COUNT; i++)
1183 data->tach[MIN][i] =
1184 adt7475_read_word(client, TACH_MIN_REG(i));
1185
1186 for (i = 0; i < ADT7475_PWM_COUNT; i++) {
1187 data->pwm[MAX][i] = adt7475_read(PWM_MAX_REG(i));
1188 data->pwm[MIN][i] = adt7475_read(PWM_MIN_REG(i));
1189 /* Set the channel and control information */
1190 adt7475_read_pwm(client, i);
1191 }
1192
1193 data->range[0] = adt7475_read(TEMP_TRANGE_REG(0));
1194 data->range[1] = adt7475_read(TEMP_TRANGE_REG(1));
1195 data->range[2] = adt7475_read(TEMP_TRANGE_REG(2));
1196
1197 data->limits_updated = jiffies;
1198 data->valid = 1;
1199 }
1200
1201 mutex_unlock(&data->lock);
1202
1203 return data;
1204}
1205
1206static int __init sensors_adt7475_init(void)
1207{
1208 return i2c_add_driver(&adt7475_driver);
1209}
1210
1211static void __exit sensors_adt7475_exit(void)
1212{
1213 i2c_del_driver(&adt7475_driver);
1214}
1215
1216MODULE_AUTHOR("Advanced Micro Devices, Inc");
1217MODULE_DESCRIPTION("adt7475 driver");
1218MODULE_LICENSE("GPL");
1219
1220module_init(sensors_adt7475_init);
1221module_exit(sensors_adt7475_exit);
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index dca47a591baf..e30186236588 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -590,6 +590,11 @@ static ssize_t applesmc_light_show(struct device *dev,
590 } 590 }
591 591
592 ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); 592 ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
593 /* newer macbooks report a single 10-bit bigendian value */
594 if (data_length == 10) {
595 left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
596 goto out;
597 }
593 left = buffer[2]; 598 left = buffer[2];
594 if (ret) 599 if (ret)
595 goto out; 600 goto out;
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index bf8d40580577..03705240000f 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007-2008 Yan Burman 4 * Copyright (C) 2007-2008 Yan Burman
5 * Copyright (C) 2008 Eric Piel 5 * Copyright (C) 2008 Eric Piel
6 * Copyright (C) 2008 Pavel Machek 6 * Copyright (C) 2008-2009 Pavel Machek
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@
36#include <linux/freezer.h> 36#include <linux/freezer.h>
37#include <linux/version.h> 37#include <linux/version.h>
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39#include <linux/leds.h>
39#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
40#include <asm/atomic.h> 41#include <asm/atomic.h>
41#include "lis3lv02d.h" 42#include "lis3lv02d.h"
@@ -43,6 +44,36 @@
43#define DRIVER_NAME "lis3lv02d" 44#define DRIVER_NAME "lis3lv02d"
44#define ACPI_MDPS_CLASS "accelerometer" 45#define ACPI_MDPS_CLASS "accelerometer"
45 46
47/* Delayed LEDs infrastructure ------------------------------------ */
48
49/* Special LED class that can defer work */
50struct delayed_led_classdev {
51 struct led_classdev led_classdev;
52 struct work_struct work;
53 enum led_brightness new_brightness;
54
55 unsigned int led; /* For driver */
56 void (*set_brightness)(struct delayed_led_classdev *data, enum led_brightness value);
57};
58
59static inline void delayed_set_status_worker(struct work_struct *work)
60{
61 struct delayed_led_classdev *data =
62 container_of(work, struct delayed_led_classdev, work);
63
64 data->set_brightness(data, data->new_brightness);
65}
66
67static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
68 enum led_brightness brightness)
69{
70 struct delayed_led_classdev *data = container_of(led_cdev,
71 struct delayed_led_classdev, led_classdev);
72 data->new_brightness = brightness;
73 schedule_work(&data->work);
74}
75
76/* HP-specific accelerometer driver ------------------------------------ */
46 77
47/* For automatic insertion of the module */ 78/* For automatic insertion of the module */
48static struct acpi_device_id lis3lv02d_device_ids[] = { 79static struct acpi_device_id lis3lv02d_device_ids[] = {
@@ -154,10 +185,33 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
154 */ 185 */
155}; 186};
156 187
188static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value)
189{
190 acpi_handle handle = adev.device->handle;
191 unsigned long long ret; /* Not used when writing */
192 union acpi_object in_obj[1];
193 struct acpi_object_list args = { 1, in_obj };
194
195 in_obj[0].type = ACPI_TYPE_INTEGER;
196 in_obj[0].integer.value = !!value;
197
198 acpi_evaluate_integer(handle, "ALED", &args, &ret);
199}
200
201static struct delayed_led_classdev hpled_led = {
202 .led_classdev = {
203 .name = "hp::hddprotect",
204 .default_trigger = "none",
205 .brightness_set = delayed_sysfs_set,
206 .flags = LED_CORE_SUSPENDRESUME,
207 },
208 .set_brightness = hpled_set,
209};
157 210
158static int lis3lv02d_add(struct acpi_device *device) 211static int lis3lv02d_add(struct acpi_device *device)
159{ 212{
160 u8 val; 213 u8 val;
214 int ret;
161 215
162 if (!device) 216 if (!device)
163 return -EINVAL; 217 return -EINVAL;
@@ -183,7 +237,19 @@ static int lis3lv02d_add(struct acpi_device *device)
183 adev.ac = lis3lv02d_axis_normal; 237 adev.ac = lis3lv02d_axis_normal;
184 } 238 }
185 239
186 return lis3lv02d_init_device(&adev); 240 INIT_WORK(&hpled_led.work, delayed_set_status_worker);
241 ret = led_classdev_register(NULL, &hpled_led.led_classdev);
242 if (ret)
243 return ret;
244
245 ret = lis3lv02d_init_device(&adev);
246 if (ret) {
247 flush_work(&hpled_led.work);
248 led_classdev_unregister(&hpled_led.led_classdev);
249 return ret;
250 }
251
252 return ret;
187} 253}
188 254
189static int lis3lv02d_remove(struct acpi_device *device, int type) 255static int lis3lv02d_remove(struct acpi_device *device, int type)
@@ -194,6 +260,9 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
194 lis3lv02d_joystick_disable(); 260 lis3lv02d_joystick_disable();
195 lis3lv02d_poweroff(device->handle); 261 lis3lv02d_poweroff(device->handle);
196 262
263 flush_work(&hpled_led.work);
264 led_classdev_unregister(&hpled_led.led_classdev);
265
197 return lis3lv02d_remove_fs(); 266 return lis3lv02d_remove_fs();
198} 267}
199 268
@@ -256,7 +325,7 @@ static void __exit lis3lv02d_exit_module(void)
256 acpi_bus_unregister_driver(&lis3lv02d_driver); 325 acpi_bus_unregister_driver(&lis3lv02d_driver);
257} 326}
258 327
259MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS"); 328MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED.");
260MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); 329MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
261MODULE_LICENSE("GPL"); 330MODULE_LICENSE("GPL");
262 331
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index bd2bde0ef95e..1fe995111841 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -31,6 +31,7 @@
31#include <linux/hwmon-sysfs.h> 31#include <linux/hwmon-sysfs.h>
32#include <linux/err.h> 32#include <linux/err.h>
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <asm/processor.h>
34 35
35#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) 36#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000)
36#define REG_TEMP 0xe4 37#define REG_TEMP 0xe4
@@ -47,6 +48,8 @@ struct k8temp_data {
47 /* registers values */ 48 /* registers values */
48 u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ 49 u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */
49 u32 temp[2][2]; /* core, place */ 50 u32 temp[2][2]; /* core, place */
51 u8 swap_core_select; /* meaning of SEL_CORE is inverted */
52 u32 temp_offset;
50}; 53};
51 54
52static struct k8temp_data *k8temp_update_device(struct device *dev) 55static struct k8temp_data *k8temp_update_device(struct device *dev)
@@ -114,10 +117,15 @@ static ssize_t show_temp(struct device *dev,
114 to_sensor_dev_attr_2(devattr); 117 to_sensor_dev_attr_2(devattr);
115 int core = attr->nr; 118 int core = attr->nr;
116 int place = attr->index; 119 int place = attr->index;
120 int temp;
117 struct k8temp_data *data = k8temp_update_device(dev); 121 struct k8temp_data *data = k8temp_update_device(dev);
118 122
119 return sprintf(buf, "%d\n", 123 if (data->swap_core_select)
120 TEMP_FROM_REG(data->temp[core][place])); 124 core = core ? 0 : 1;
125
126 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
127
128 return sprintf(buf, "%d\n", temp);
121} 129}
122 130
123/* core, place */ 131/* core, place */
@@ -141,20 +149,49 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
141 int err; 149 int err;
142 u8 scfg; 150 u8 scfg;
143 u32 temp; 151 u32 temp;
152 u8 model, stepping;
144 struct k8temp_data *data; 153 struct k8temp_data *data;
145 u32 cpuid = cpuid_eax(1);
146
147 /* this feature should be available since SH-C0 core */
148 if ((cpuid == 0xf40) || (cpuid == 0xf50) || (cpuid == 0xf51)) {
149 err = -ENODEV;
150 goto exit;
151 }
152 154
153 if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { 155 if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) {
154 err = -ENOMEM; 156 err = -ENOMEM;
155 goto exit; 157 goto exit;
156 } 158 }
157 159
160 model = boot_cpu_data.x86_model;
161 stepping = boot_cpu_data.x86_mask;
162
163 switch (boot_cpu_data.x86) {
164 case 0xf:
165 /* feature available since SH-C0, exclude older revisions */
166 if (((model == 4) && (stepping == 0)) ||
167 ((model == 5) && (stepping <= 1))) {
168 err = -ENODEV;
169 goto exit_free;
170 }
171
172 /*
173 * AMD NPT family 0fh, i.e. RevF and RevG:
174 * meaning of SEL_CORE bit is inverted
175 */
176 if (model >= 0x40) {
177 data->swap_core_select = 1;
178 dev_warn(&pdev->dev, "Temperature readouts might be "
179 "wrong - check erratum #141\n");
180 }
181
182 if ((model >= 0x69) &&
183 !(model == 0xc1 || model == 0x6c || model == 0x7c)) {
184 /*
185 * RevG desktop CPUs (i.e. no socket S1G1 parts)
186 * need additional offset, otherwise reported
187 * temperature is below ambient temperature
188 */
189 data->temp_offset = 21000;
190 }
191
192 break;
193 }
194
158 pci_read_config_byte(pdev, REG_TEMP, &scfg); 195 pci_read_config_byte(pdev, REG_TEMP, &scfg);
159 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ 196 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
160 pci_write_config_byte(pdev, REG_TEMP, scfg); 197 pci_write_config_byte(pdev, REG_TEMP, scfg);
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 59c3d23f5bdc..b9bef04b7be4 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -139,15 +139,4 @@ config SENSORS_TSL2550
139 This driver can also be built as a module. If so, the module 139 This driver can also be built as a module. If so, the module
140 will be called tsl2550. 140 will be called tsl2550.
141 141
142config MCU_MPC8349EMITX
143 tristate "MPC8349E-mITX MCU driver"
144 depends on I2C && PPC_83xx
145 select GENERIC_GPIO
146 select ARCH_REQUIRE_GPIOLIB
147 help
148 Say Y here to enable soft power-off functionality on the Freescale
149 boards with the MPC8349E-mITX-compatible MCU chips. This driver will
150 also register MCU GPIOs with the generic GPIO API, so you'll able
151 to use MCU pins as GPIOs.
152
153endmenu 142endmenu
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 83accaaf8164..00fcb5193ac2 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
19obj-$(CONFIG_PCF8575) += pcf8575.o 19obj-$(CONFIG_PCF8575) += pcf8575.o
20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
21obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 21obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
22obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
23 22
24ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) 23ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
25EXTRA_CFLAGS += -DDEBUG 24EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 3f9503867e6b..b1c6f68d98ce 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -701,11 +701,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
701 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX 701 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX
702endchoice 702endchoice
703 703
704config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
705 int "Maximum transfer size (KB) per request (up to 128)"
706 default "128"
707 depends on BLK_DEV_IDE_AU1XXX
708
709config BLK_DEV_IDE_TX4938 704config BLK_DEV_IDE_TX4938
710 tristate "TX4938 internal IDE support" 705 tristate "TX4938 internal IDE support"
711 depends on SOC_TX4938 706 depends on SOC_TX4938
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 4088a622873e..806760d24cef 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -633,7 +633,7 @@ static void ide_disk_setup(ide_drive_t *drive)
633 printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, 633 printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name,
634 q->max_sectors / 2); 634 q->max_sectors / 2);
635 635
636 if (ata_id_is_ssd(id) || ata_id_is_cfa(id)) 636 if (ata_id_is_ssd(id))
637 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); 637 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
638 638
639 /* calculate drive capacity, and select LBA if possible */ 639 /* calculate drive capacity, and select LBA if possible */
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index e728cfe7273f..753b92ebe0ae 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -493,7 +493,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti
493 stat = tp_ops->read_status(hwif); 493 stat = tp_ops->read_status(hwif);
494 494
495 if (stat & ATA_BUSY) { 495 if (stat & ATA_BUSY) {
496 local_irq_save(flags); 496 local_save_flags(flags);
497 local_irq_enable_in_hardirq(); 497 local_irq_enable_in_hardirq();
498 timeout += jiffies; 498 timeout += jiffies;
499 while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { 499 while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) {
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index 4b3bf6a06b70..60538d9c84ee 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -186,12 +186,10 @@ void ide_complete_pm_request(ide_drive_t *drive, struct request *rq)
186 blk_pm_suspend_request(rq) ? "suspend" : "resume"); 186 blk_pm_suspend_request(rq) ? "suspend" : "resume");
187#endif 187#endif
188 spin_lock_irqsave(q->queue_lock, flags); 188 spin_lock_irqsave(q->queue_lock, flags);
189 if (blk_pm_suspend_request(rq)) { 189 if (blk_pm_suspend_request(rq))
190 blk_stop_queue(q); 190 blk_stop_queue(q);
191 } else { 191 else
192 drive->dev_flags &= ~IDE_DFLAG_BLOCKED; 192 drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
193 blk_start_queue(q);
194 }
195 spin_unlock_irqrestore(q->queue_lock, flags); 193 spin_unlock_irqrestore(q->queue_lock, flags);
196 194
197 drive->hwif->rq = NULL; 195 drive->hwif->rq = NULL;
@@ -219,6 +217,8 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
219 * point. 217 * point.
220 */ 218 */
221 ide_hwif_t *hwif = drive->hwif; 219 ide_hwif_t *hwif = drive->hwif;
220 struct request_queue *q = drive->queue;
221 unsigned long flags;
222 int rc; 222 int rc;
223#ifdef DEBUG_PM 223#ifdef DEBUG_PM
224 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); 224 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name);
@@ -231,5 +231,9 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
231 rc = ide_wait_not_busy(hwif, 100000); 231 rc = ide_wait_not_busy(hwif, 100000);
232 if (rc) 232 if (rc)
233 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); 233 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
234
235 spin_lock_irqsave(q->queue_lock, flags);
236 blk_start_queue(q);
237 spin_unlock_irqrestore(q->queue_lock, flags);
234 } 238 }
235} 239}
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 0ccbb4459fb9..312127ea443a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -796,7 +796,7 @@ static int ide_probe_port(ide_hwif_t *hwif)
796 if (irqd) 796 if (irqd)
797 disable_irq(hwif->irq); 797 disable_irq(hwif->irq);
798 798
799 local_irq_save(flags); 799 local_save_flags(flags);
800 local_irq_enable_in_hardirq(); 800 local_irq_enable_in_hardirq();
801 801
802 if (ide_port_wait_ready(hwif) == -EBUSY) 802 if (ide_port_wait_ready(hwif) == -EBUSY)
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index 0be27ac1f077..e1c4f5437396 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -68,6 +68,8 @@
68 68
69#define DRV_NAME "it821x" 69#define DRV_NAME "it821x"
70 70
71#define QUIRK_VORTEX86 1
72
71struct it821x_dev 73struct it821x_dev
72{ 74{
73 unsigned int smart:1, /* Are we in smart raid mode */ 75 unsigned int smart:1, /* Are we in smart raid mode */
@@ -79,6 +81,7 @@ struct it821x_dev
79 u16 pio[2]; /* Cached PIO values */ 81 u16 pio[2]; /* Cached PIO values */
80 u16 mwdma[2]; /* Cached MWDMA values */ 82 u16 mwdma[2]; /* Cached MWDMA values */
81 u16 udma[2]; /* Cached UDMA values (per drive) */ 83 u16 udma[2]; /* Cached UDMA values (per drive) */
84 u16 quirks;
82}; 85};
83 86
84#define ATA_66 0 87#define ATA_66 0
@@ -557,8 +560,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
557 * this is necessary. 560 * this is necessary.
558 */ 561 */
559 562
560 pci_read_config_byte(dev, 0x08, &conf); 563 if (dev->revision == 0x10) {
561 if (conf == 0x10) {
562 idev->timing10 = 1; 564 idev->timing10 = 1;
563 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 565 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
564 if (idev->smart == 0) 566 if (idev->smart == 0)
@@ -577,6 +579,12 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
577 579
578 hwif->ultra_mask = ATA_UDMA6; 580 hwif->ultra_mask = ATA_UDMA6;
579 hwif->mwdma_mask = ATA_MWDMA2; 581 hwif->mwdma_mask = ATA_MWDMA2;
582
583 /* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */
584 if (idev->quirks & QUIRK_VORTEX86) {
585 if (dev->revision == 0x11)
586 hwif->ultra_mask = 0;
587 }
580} 588}
581 589
582static void it8212_disable_raid(struct pci_dev *dev) 590static void it8212_disable_raid(struct pci_dev *dev)
@@ -649,6 +657,8 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic
649 return -ENOMEM; 657 return -ENOMEM;
650 } 658 }
651 659
660 itdevs->quirks = id->driver_data;
661
652 rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); 662 rc = ide_pci_init_one(dev, &it821x_chipset, itdevs);
653 if (rc) 663 if (rc)
654 kfree(itdevs); 664 kfree(itdevs);
@@ -668,6 +678,7 @@ static void __devexit it821x_remove(struct pci_dev *dev)
668static const struct pci_device_id it821x_pci_tbl[] = { 678static const struct pci_device_id it821x_pci_tbl[] = {
669 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, 679 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 },
670 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, 680 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 },
681 { PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1010), QUIRK_VORTEX86 },
671 { 0, }, 682 { 0, },
672}; 683};
673 684
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index 48cc748c5043..6297956507c0 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -310,10 +310,6 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = {
310 .dma_ops = &sl82c105_dma_ops, 310 .dma_ops = &sl82c105_dma_ops,
311 .host_flags = IDE_HFLAG_IO_32BIT | 311 .host_flags = IDE_HFLAG_IO_32BIT |
312 IDE_HFLAG_UNMASK_IRQS | 312 IDE_HFLAG_UNMASK_IRQS |
313/* FIXME: check for Compatibility mode in generic IDE PCI code */
314#if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT)
315 IDE_HFLAG_FORCE_LEGACY_IRQS |
316#endif
317 IDE_HFLAG_SERIALIZE_DMA | 313 IDE_HFLAG_SERIALIZE_DMA |
318 IDE_HFLAG_NO_AUTODMA, 314 IDE_HFLAG_NO_AUTODMA,
319 .pio_mask = ATA_PIO5, 315 .pio_mask = ATA_PIO5,
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index b4ef218072cd..d9095345f7ca 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -202,7 +202,6 @@ static const struct ide_tp_ops tx4938ide_tp_ops = {
202 .exec_command = ide_exec_command, 202 .exec_command = ide_exec_command,
203 .read_status = ide_read_status, 203 .read_status = ide_read_status,
204 .read_altstatus = ide_read_altstatus, 204 .read_altstatus = ide_read_altstatus,
205 .read_sff_dma_status = ide_read_sff_dma_status,
206 205
207 .set_irq = ide_set_irq, 206 .set_irq = ide_set_irq,
208 207
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c
index fecc0e03c3fc..703c3eeb20a8 100644
--- a/drivers/ide/via82cxxx.c
+++ b/drivers/ide/via82cxxx.c
@@ -432,8 +432,6 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
432 if (via_clock < 20000 || via_clock > 50000) { 432 if (via_clock < 20000 || via_clock > 50000) {
433 printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " 433 printk(KERN_WARNING DRV_NAME ": User given PCI clock speed "
434 "impossible (%d), using 33 MHz instead.\n", via_clock); 434 "impossible (%d), using 33 MHz instead.\n", via_clock);
435 printk(KERN_WARNING DRV_NAME ": Use ide0=ata66 if you want "
436 "to assume 80-wire cable.\n");
437 via_clock = 33333; 435 via_clock = 33333;
438 } 436 }
439 437
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 7c5f97033b9f..cb8943da4f12 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -292,7 +292,9 @@ isdn_net_unbind_channel(isdn_net_local * lp)
292 lp->dialstate = 0; 292 lp->dialstate = 0;
293 dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; 293 dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
294 dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; 294 dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
295 isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET); 295 if (lp->isdn_device != -1 && lp->isdn_channel != -1)
296 isdn_free_channel(lp->isdn_device, lp->isdn_channel,
297 ISDN_USAGE_NET);
296 lp->flags &= ~ISDN_NET_CONNECTED; 298 lp->flags &= ~ISDN_NET_CONNECTED;
297 lp->isdn_device = -1; 299 lp->isdn_device = -1;
298 lp->isdn_channel = -1; 300 lp->isdn_channel = -1;
@@ -2513,7 +2515,6 @@ static const struct net_device_ops isdn_netdev_ops = {
2513 .ndo_stop = isdn_net_close, 2515 .ndo_stop = isdn_net_close,
2514 .ndo_do_ioctl = isdn_net_ioctl, 2516 .ndo_do_ioctl = isdn_net_ioctl,
2515 2517
2516 .ndo_validate_addr = NULL,
2517 .ndo_start_xmit = isdn_net_start_xmit, 2518 .ndo_start_xmit = isdn_net_start_xmit,
2518 .ndo_get_stats = isdn_net_get_stats, 2519 .ndo_get_stats = isdn_net_get_stats,
2519 .ndo_tx_timeout = isdn_net_tx_timeout, 2520 .ndo_tx_timeout = isdn_net_tx_timeout,
@@ -2528,12 +2529,8 @@ static void _isdn_setup(struct net_device *dev)
2528 2529
2529 ether_setup(dev); 2530 ether_setup(dev);
2530 2531
2531 dev->flags = IFF_NOARP | IFF_POINTOPOINT;
2532 /* Setup the generic properties */ 2532 /* Setup the generic properties */
2533 dev->mtu = 1500;
2534 dev->flags = IFF_NOARP|IFF_POINTOPOINT; 2533 dev->flags = IFF_NOARP|IFF_POINTOPOINT;
2535 dev->type = ARPHRD_ETHER;
2536 dev->addr_len = ETH_ALEN;
2537 dev->header_ops = NULL; 2534 dev->header_ops = NULL;
2538 dev->netdev_ops = &isdn_netdev_ops; 2535 dev->netdev_ops = &isdn_netdev_ops;
2539 2536
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index a4a1ae214630..742713611bc5 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -119,13 +119,6 @@ config LEDS_GPIO
119 outputs. To be useful the particular board must have LEDs 119 outputs. To be useful the particular board must have LEDs
120 and they must be connected to the GPIO lines. 120 and they must be connected to the GPIO lines.
121 121
122config LEDS_HP_DISK
123 tristate "LED Support for disk protection LED on HP notebooks"
124 depends on LEDS_CLASS && ACPI
125 help
126 This option enable support for disk protection LED, found on
127 newer HP notebooks.
128
129config LEDS_CLEVO_MAIL 122config LEDS_CLEVO_MAIL
130 tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" 123 tristate "Mail LED on Clevo notebook (EXPERIMENTAL)"
131 depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL 124 depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index bc247cb02e82..9d76f0f160a4 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
23obj-$(CONFIG_LEDS_FSG) += leds-fsg.o 23obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
24obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o 24obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
25obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o 25obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
26obj-$(CONFIG_LEDS_HP_DISK) += leds-hp-disk.o
27obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o 26obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
28 27
29# LED Triggers 28# LED Triggers
diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c
deleted file mode 100644
index d786adc8c5e3..000000000000
--- a/drivers/leds/leds-hp-disk.c
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * leds-hp-disk.c - driver for HP "hard disk protection" LED
3 *
4 * Copyright (C) 2008 Pavel Machek
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#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/dmi.h>
24#include <linux/module.h>
25#include <linux/types.h>
26#include <linux/platform_device.h>
27#include <linux/interrupt.h>
28#include <linux/input.h>
29#include <linux/kthread.h>
30#include <linux/leds.h>
31#include <acpi/acpi_drivers.h>
32
33#define DRIVER_NAME "leds-hp-disk"
34#define ACPI_MDPS_CLASS "led"
35
36/* For automatic insertion of the module */
37static struct acpi_device_id hpled_device_ids[] = {
38 {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
39 {"", 0},
40};
41MODULE_DEVICE_TABLE(acpi, hpled_device_ids);
42
43struct acpi_hpled {
44 struct acpi_device *device; /* The ACPI device */
45};
46
47static struct acpi_hpled adev;
48
49static acpi_status hpled_acpi_write(acpi_handle handle, int reg)
50{
51 unsigned long long ret; /* Not used when writing */
52 union acpi_object in_obj[1];
53 struct acpi_object_list args = { 1, in_obj };
54
55 in_obj[0].type = ACPI_TYPE_INTEGER;
56 in_obj[0].integer.value = reg;
57
58 return acpi_evaluate_integer(handle, "ALED", &args, &ret);
59}
60
61static void hpled_set(struct led_classdev *led_cdev,
62 enum led_brightness value)
63{
64 hpled_acpi_write(adev.device->handle, !!value);
65}
66
67static struct led_classdev hpled_led = {
68 .name = "hp:red:hddprotection",
69 .default_trigger = "heartbeat",
70 .brightness_set = hpled_set,
71 .flags = LED_CORE_SUSPENDRESUME,
72};
73
74static int hpled_add(struct acpi_device *device)
75{
76 int ret;
77
78 if (!device)
79 return -EINVAL;
80
81 adev.device = device;
82 strcpy(acpi_device_name(device), DRIVER_NAME);
83 strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);
84 device->driver_data = &adev;
85
86 ret = led_classdev_register(NULL, &hpled_led);
87 return ret;
88}
89
90static int hpled_remove(struct acpi_device *device, int type)
91{
92 if (!device)
93 return -EINVAL;
94
95 led_classdev_unregister(&hpled_led);
96 return 0;
97}
98
99
100
101static struct acpi_driver leds_hp_driver = {
102 .name = DRIVER_NAME,
103 .class = ACPI_MDPS_CLASS,
104 .ids = hpled_device_ids,
105 .ops = {
106 .add = hpled_add,
107 .remove = hpled_remove,
108 }
109};
110
111static int __init hpled_init_module(void)
112{
113 int ret;
114
115 if (acpi_disabled)
116 return -ENODEV;
117
118 ret = acpi_bus_register_driver(&leds_hp_driver);
119 if (ret < 0)
120 return ret;
121
122 printk(KERN_INFO DRIVER_NAME " driver loaded.\n");
123
124 return 0;
125}
126
127static void __exit hpled_exit_module(void)
128{
129 acpi_bus_unregister_driver(&leds_hp_driver);
130}
131
132MODULE_DESCRIPTION("Driver for HP disk protection LED");
133MODULE_AUTHOR("Pavel Machek <pavel@suse.cz>");
134MODULE_LICENSE("GPL");
135
136module_init(hpled_init_module);
137module_exit(hpled_exit_module);
diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h
index 10b6ef758725..11c0f461320e 100644
--- a/drivers/message/fusion/lsi/mpi.h
+++ b/drivers/message/fusion/lsi/mpi.h
@@ -6,7 +6,7 @@
6 * Title: MPI Message independent structures and definitions 6 * Title: MPI Message independent structures and definitions
7 * Creation Date: July 27, 2000 7 * Creation Date: July 27, 2000
8 * 8 *
9 * mpi.h Version: 01.05.13 9 * mpi.h Version: 01.05.16
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -79,6 +79,9 @@
79 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. 79 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
80 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. 80 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT.
81 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. 81 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT.
82 * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT.
83 * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT.
84 * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT.
82 * -------------------------------------------------------------------------- 85 * --------------------------------------------------------------------------
83 */ 86 */
84 87
@@ -109,7 +112,7 @@
109/* Note: The major versions of 0xe0 through 0xff are reserved */ 112/* Note: The major versions of 0xe0 through 0xff are reserved */
110 113
111/* versioning for this MPI header set */ 114/* versioning for this MPI header set */
112#define MPI_HEADER_VERSION_UNIT (0x10) 115#define MPI_HEADER_VERSION_UNIT (0x13)
113#define MPI_HEADER_VERSION_DEV (0x00) 116#define MPI_HEADER_VERSION_DEV (0x00)
114#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) 117#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00)
115#define MPI_HEADER_VERSION_UNIT_SHIFT (8) 118#define MPI_HEADER_VERSION_UNIT_SHIFT (8)
diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h b/drivers/message/fusion/lsi/mpi_cnfg.h
index b2db3330c591..013c7d881948 100644
--- a/drivers/message/fusion/lsi/mpi_cnfg.h
+++ b/drivers/message/fusion/lsi/mpi_cnfg.h
@@ -6,7 +6,7 @@
6 * Title: MPI Config message, structures, and Pages 6 * Title: MPI Config message, structures, and Pages
7 * Creation Date: July 27, 2000 7 * Creation Date: July 27, 2000
8 * 8 *
9 * mpi_cnfg.h Version: 01.05.15 9 * mpi_cnfg.h Version: 01.05.18
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -308,6 +308,20 @@
308 * Expander Page 0 Flags field. 308 * Expander Page 0 Flags field.
309 * Fixed define for 309 * Fixed define for
310 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. 310 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
311 * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
312 * define.
313 * Added BIOS Page 4 structure.
314 * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
315 * Physcial Disk Page 1.
316 * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of
317 * Manufacturing Page 4.
318 * Added Solid State Drives Supported bit to IOC Page 6
319 * Capabilities Flags.
320 * Added new value for AccessStatus field of SAS Device
321 * Page 0 (_SATA_NEEDS_INITIALIZATION).
322 * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field
323 * to control coercion size and the mixing of SAS and SATA
324 * SSD drives.
311 * -------------------------------------------------------------------------- 325 * --------------------------------------------------------------------------
312 */ 326 */
313 327
@@ -686,6 +700,14 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_4
686#define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01) 700#define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01)
687 701
688/* defines for the ExtFlags field */ 702/* defines for the ExtFlags field */
703#define MPI_MANPAGE4_EXTFLAGS_MASK_COERCION_SIZE (0x0180)
704#define MPI_MANPAGE4_EXTFLAGS_SHIFT_COERCION_SIZE (7)
705#define MPI_MANPAGE4_EXTFLAGS_1GB_COERCION_SIZE (0)
706#define MPI_MANPAGE4_EXTFLAGS_128MB_COERCION_SIZE (1)
707
708#define MPI_MANPAGE4_EXTFLAGS_NO_MIX_SSD_SAS_SATA (0x0040)
709#define MPI_MANPAGE4_EXTFLAGS_MIX_SSD_AND_NON_SSD (0x0020)
710#define MPI_MANPAGE4_EXTFLAGS_DUAL_PORT_SUPPORT (0x0010)
689#define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008) 711#define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008)
690#define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004) 712#define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004)
691#define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002) 713#define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002)
@@ -1159,6 +1181,8 @@ typedef struct _CONFIG_PAGE_IOC_6
1159 1181
1160/* IOC Page 6 Capabilities Flags */ 1182/* IOC Page 6 Capabilities Flags */
1161 1183
1184#define MPI_IOCPAGE6_CAP_FLAGS_SSD_SUPPORT (0x00000020)
1185#define MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT (0x00000010)
1162#define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008) 1186#define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008)
1163 1187
1164#define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006) 1188#define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006)
@@ -1428,6 +1452,15 @@ typedef struct _CONFIG_PAGE_BIOS_2
1428#define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05) 1452#define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05)
1429#define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06) 1453#define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06)
1430 1454
1455typedef struct _CONFIG_PAGE_BIOS_4
1456{
1457 CONFIG_PAGE_HEADER Header; /* 00h */
1458 U64 ReassignmentBaseWWID; /* 04h */
1459} CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4,
1460 BIOSPage4_t, MPI_POINTER pBIOSPage4_t;
1461
1462#define MPI_BIOSPAGE4_PAGEVERSION (0x00)
1463
1431 1464
1432/**************************************************************************** 1465/****************************************************************************
1433* SCSI Port Config Pages 1466* SCSI Port Config Pages
@@ -2419,6 +2452,15 @@ typedef struct _RAID_PHYS_DISK1_PATH
2419#define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002) 2452#define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002)
2420#define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001) 2453#define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001)
2421 2454
2455
2456/*
2457 * Host code (drivers, BIOS, utilities, etc.) should leave this define set to
2458 * one and check Header.PageLength or NumPhysDiskPaths at runtime.
2459 */
2460#ifndef MPI_RAID_PHYS_DISK1_PATH_MAX
2461#define MPI_RAID_PHYS_DISK1_PATH_MAX (1)
2462#endif
2463
2422typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 2464typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
2423{ 2465{
2424 CONFIG_PAGE_HEADER Header; /* 00h */ 2466 CONFIG_PAGE_HEADER Header; /* 00h */
@@ -2426,7 +2468,7 @@ typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
2426 U8 PhysDiskNum; /* 05h */ 2468 U8 PhysDiskNum; /* 05h */
2427 U16 Reserved2; /* 06h */ 2469 U16 Reserved2; /* 06h */
2428 U32 Reserved1; /* 08h */ 2470 U32 Reserved1; /* 08h */
2429 RAID_PHYS_DISK1_PATH Path[1]; /* 0Ch */ 2471 RAID_PHYS_DISK1_PATH Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */
2430} CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1, 2472} CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1,
2431 RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t; 2473 RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t;
2432 2474
@@ -2844,6 +2886,7 @@ typedef struct _CONFIG_PAGE_SAS_DEVICE_0
2844#define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01) 2886#define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01)
2845#define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02) 2887#define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02)
2846#define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03) 2888#define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03)
2889#define MPI_SAS_DEVICE0_ASTATUS_SATA_NEEDS_INITIALIZATION (0x04)
2847/* specific values for SATA Init failures */ 2890/* specific values for SATA Init failures */
2848#define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10) 2891#define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10)
2849#define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11) 2892#define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11)
diff --git a/drivers/message/fusion/lsi/mpi_fc.h b/drivers/message/fusion/lsi/mpi_fc.h
index 627acfbb8623..7d663ce76f8c 100644
--- a/drivers/message/fusion/lsi/mpi_fc.h
+++ b/drivers/message/fusion/lsi/mpi_fc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_fc.h 5 * Name: mpi_fc.h
diff --git a/drivers/message/fusion/lsi/mpi_history.txt b/drivers/message/fusion/lsi/mpi_history.txt
index 3f15fcfe4a2e..693e4b511354 100644
--- a/drivers/message/fusion/lsi/mpi_history.txt
+++ b/drivers/message/fusion/lsi/mpi_history.txt
@@ -3,28 +3,28 @@
3 MPI Header File Change History 3 MPI Header File Change History
4 ============================== 4 ==============================
5 5
6 Copyright (c) 2000-2007 LSI Corporation. 6 Copyright (c) 2000-2008 LSI Corporation.
7 7
8 --------------------------------------- 8 ---------------------------------------
9 Header Set Release Version: 01.05.16 9 Header Set Release Version: 01.05.19
10 Header Set Release Date: 05-24-07 10 Header Set Release Date: 03-28-08
11 --------------------------------------- 11 ---------------------------------------
12 12
13 Filename Current version Prior version 13 Filename Current version Prior version
14 ---------- --------------- ------------- 14 ---------- --------------- -------------
15 mpi.h 01.05.13 01.05.12 15 mpi.h 01.05.16 01.05.15
16 mpi_ioc.h 01.05.14 01.05.13 16 mpi_ioc.h 01.05.16 01.05.15
17 mpi_cnfg.h 01.05.15 01.05.14 17 mpi_cnfg.h 01.05.18 01.05.17
18 mpi_init.h 01.05.09 01.05.09 18 mpi_init.h 01.05.09 01.05.09
19 mpi_targ.h 01.05.06 01.05.06 19 mpi_targ.h 01.05.06 01.05.06
20 mpi_fc.h 01.05.01 01.05.01 20 mpi_fc.h 01.05.01 01.05.01
21 mpi_lan.h 01.05.01 01.05.01 21 mpi_lan.h 01.05.01 01.05.01
22 mpi_raid.h 01.05.03 01.05.03 22 mpi_raid.h 01.05.05 01.05.05
23 mpi_tool.h 01.05.03 01.05.03 23 mpi_tool.h 01.05.03 01.05.03
24 mpi_inb.h 01.05.01 01.05.01 24 mpi_inb.h 01.05.01 01.05.01
25 mpi_sas.h 01.05.04 01.05.04 25 mpi_sas.h 01.05.05 01.05.05
26 mpi_type.h 01.05.02 01.05.02 26 mpi_type.h 01.05.02 01.05.02
27 mpi_history.txt 01.05.14 01.05.14 27 mpi_history.txt 01.05.19 01.05.18
28 28
29 29
30 * Date Version Description 30 * Date Version Description
@@ -96,6 +96,9 @@ mpi.h
96 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. 96 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
97 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. 97 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT.
98 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. 98 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT.
99 * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT.
100 * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT.
101 * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT.
99 * -------------------------------------------------------------------------- 102 * --------------------------------------------------------------------------
100 103
101mpi_ioc.h 104mpi_ioc.h
@@ -127,7 +130,7 @@ mpi_ioc.h
127 * 08-08-01 01.02.01 Original release for v1.2 work. 130 * 08-08-01 01.02.01 Original release for v1.2 work.
128 * New format for FWVersion and ProductId in 131 * New format for FWVersion and ProductId in
129 * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER. 132 * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER.
130 * 08-31-01 01.02.02 Added event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and 133 * 08-31-01 01.02.02 Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and
131 * related structure and defines. 134 * related structure and defines.
132 * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED. 135 * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED.
133 * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE. 136 * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE.
@@ -187,7 +190,7 @@ mpi_ioc.h
187 * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED. 190 * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED.
188 * Added MaxInitiators field to PortFacts reply. 191 * Added MaxInitiators field to PortFacts reply.
189 * Added SAS Device Status Change ReasonCode for 192 * Added SAS Device Status Change ReasonCode for
190 * asynchronous notification. 193 * asynchronous notificaiton.
191 * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event 194 * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event
192 * data structure. 195 * data structure.
193 * Added new ImageType values for FWDownload and FWUpload 196 * Added new ImageType values for FWDownload and FWUpload
@@ -199,6 +202,16 @@ mpi_ioc.h
199 * added _MULTI_PORT_DOMAIN. 202 * added _MULTI_PORT_DOMAIN.
200 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. 203 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request.
201 * Added Common Boot Block type to FWUpload Request. 204 * Added Common Boot Block type to FWUpload Request.
205 * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
206 * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
207 * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
208 * Added SASAddress field to SAS Initiator Device Table
209 * Overflow event data structure.
210 * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status
211 * Change Event data to indicate completion of internally
212 * generated task management.
213 * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
214 * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
202 * -------------------------------------------------------------------------- 215 * --------------------------------------------------------------------------
203 216
204mpi_cnfg.h 217mpi_cnfg.h
@@ -213,7 +226,7 @@ mpi_cnfg.h
213 * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1 226 * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1
214 * page and updated the page version. 227 * page and updated the page version.
215 * Added Information field and _INFO_PARAMS_NEGOTIATED 228 * Added Information field and _INFO_PARAMS_NEGOTIATED
216 * definition to SCSI_DEVICE_0 page. 229 * definitionto SCSI_DEVICE_0 page.
217 * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the 230 * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the
218 * page version. 231 * page version.
219 * Added BucketsRemaining to LAN_1 page, redefined the 232 * Added BucketsRemaining to LAN_1 page, redefined the
@@ -496,6 +509,20 @@ mpi_cnfg.h
496 * Expander Page 0 Flags field. 509 * Expander Page 0 Flags field.
497 * Fixed define for 510 * Fixed define for
498 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. 511 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
512 * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
513 * define.
514 * Added BIOS Page 4 structure.
515 * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
516 * Physcial Disk Page 1.
517 * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of
518 * Manufacturing Page 4.
519 * Added Solid State Drives Supported bit to IOC Page 6
520 * Capabilities Flags.
521 * Added new value for AccessStatus field of SAS Device
522 * Page 0 (_SATA_NEEDS_INITIALIZATION).
523 * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field
524 * to control coercion size and the mixing of SAS and SATA
525 * SSD drives.
499 * -------------------------------------------------------------------------- 526 * --------------------------------------------------------------------------
500 527
501mpi_init.h 528mpi_init.h
@@ -661,6 +688,9 @@ mpi_raid.h
661 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. 688 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
662 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and 689 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and
663 * associated defines. 690 * associated defines.
691 * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord
692 * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
693 * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
664 * -------------------------------------------------------------------------- 694 * --------------------------------------------------------------------------
665 695
666mpi_tool.h 696mpi_tool.h
@@ -694,6 +724,10 @@ mpi_sas.h
694 * reply. 724 * reply.
695 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO 725 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO
696 * Unit Control request. 726 * Unit Control request.
727 * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
728 * including adding IOCParameter and IOCParameter value
729 * fields to SAS IO Unit Control Request.
730 * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
697 * -------------------------------------------------------------------------- 731 * --------------------------------------------------------------------------
698 732
699mpi_type.h 733mpi_type.h
@@ -709,20 +743,20 @@ mpi_type.h
709 743
710mpi_history.txt Parts list history 744mpi_history.txt Parts list history
711 745
712Filename 01.05.15 01.05.15 746Filename 01.05.19 01.05.18 01.05.17 01.05.16 01.05.15
713---------- -------- -------- 747---------- -------- -------- -------- -------- --------
714mpi.h 01.05.12 01.05.13 748mpi.h 01.05.16 01.05.15 01.05.14 01.05.13 01.05.12
715mpi_ioc.h 01.05.13 01.05.14 749mpi_ioc.h 01.05.16 01.05.15 01.05.15 01.05.14 01.05.13
716mpi_cnfg.h 01.05.14 01.05.15 750mpi_cnfg.h 01.05.18 01.05.17 01.05.16 01.05.15 01.05.14
717mpi_init.h 01.05.09 01.05.09 751mpi_init.h 01.05.09 01.05.09 01.05.09 01.05.09 01.05.09
718mpi_targ.h 01.05.06 01.05.06 752mpi_targ.h 01.05.06 01.05.06 01.05.06 01.05.06 01.05.06
719mpi_fc.h 01.05.01 01.05.01 753mpi_fc.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
720mpi_lan.h 01.05.01 01.05.01 754mpi_lan.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
721mpi_raid.h 01.05.03 01.05.03 755mpi_raid.h 01.05.05 01.05.05 01.05.04 01.05.03 01.05.03
722mpi_tool.h 01.05.03 01.05.03 756mpi_tool.h 01.05.03 01.05.03 01.05.03 01.05.03 01.05.03
723mpi_inb.h 01.05.01 01.05.01 757mpi_inb.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
724mpi_sas.h 01.05.04 01.05.04 758mpi_sas.h 01.05.05 01.05.05 01.05.04 01.05.04 01.05.04
725mpi_type.h 01.05.02 01.05.02 759mpi_type.h 01.05.02 01.05.02 01.05.02 01.05.02 01.05.02
726 760
727Filename 01.05.14 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09 761Filename 01.05.14 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09
728---------- -------- -------- -------- -------- -------- -------- 762---------- -------- -------- -------- -------- -------- --------
diff --git a/drivers/message/fusion/lsi/mpi_init.h b/drivers/message/fusion/lsi/mpi_init.h
index a9e3693601a7..4295d062caa7 100644
--- a/drivers/message/fusion/lsi/mpi_init.h
+++ b/drivers/message/fusion/lsi/mpi_init.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2007 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_init.h 5 * Name: mpi_init.h
diff --git a/drivers/message/fusion/lsi/mpi_ioc.h b/drivers/message/fusion/lsi/mpi_ioc.h
index 5cbb6bd048e1..8faa4fab7b89 100644
--- a/drivers/message/fusion/lsi/mpi_ioc.h
+++ b/drivers/message/fusion/lsi/mpi_ioc.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2000-2007 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_ioc.h 5 * Name: mpi_ioc.h
6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages 6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages
7 * Creation Date: August 11, 2000 7 * Creation Date: August 11, 2000
8 * 8 *
9 * mpi_ioc.h Version: 01.05.14 9 * mpi_ioc.h Version: 01.05.16
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -113,6 +113,16 @@
113 * added _MULTI_PORT_DOMAIN. 113 * added _MULTI_PORT_DOMAIN.
114 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. 114 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request.
115 * Added Common Boot Block type to FWUpload Request. 115 * Added Common Boot Block type to FWUpload Request.
116 * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
117 * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
118 * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
119 * Added SASAddress field to SAS Initiator Device Table
120 * Overflow event data structure.
121 * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status
122 * Change Event data to indicate completion of internally
123 * generated task management.
124 * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
125 * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
116 * -------------------------------------------------------------------------- 126 * --------------------------------------------------------------------------
117 */ 127 */
118 128
@@ -612,6 +622,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE
612#define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) 622#define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B)
613#define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) 623#define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C)
614#define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) 624#define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D)
625#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET (0x0E)
626#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL (0x0F)
615 627
616 628
617/* SCSI Event data for Queue Full event */ 629/* SCSI Event data for Queue Full event */
@@ -708,6 +720,8 @@ typedef struct _MPI_EVENT_DATA_IR2
708#define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) 720#define MPI_EVENT_IR2_RC_PD_REMOVED (0x05)
709#define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) 721#define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06)
710#define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) 722#define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07)
723#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED (0x08)
724#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED (0x09)
711 725
712/* defines for logical disk states */ 726/* defines for logical disk states */
713#define MPI_LD_STATE_OPTIMAL (0x00) 727#define MPI_LD_STATE_OPTIMAL (0x00)
@@ -867,6 +881,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERROR
867#define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) 881#define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800)
868#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) 882#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000)
869#define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) 883#define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000)
884#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE (0x00004000)
870 885
871/* SAS SMP Error Event data */ 886/* SAS SMP Error Event data */
872 887
@@ -902,6 +917,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE
902 917
903/* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ 918/* defines for the ReasonCode field of the SAS Initiator Device Status Change event */
904#define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) 919#define MPI_EVENT_SAS_INIT_RC_ADDED (0x01)
920#define MPI_EVENT_SAS_INIT_RC_REMOVED (0x02)
921#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE (0x03)
905 922
906/* SAS Initiator Device Table Overflow Event data */ 923/* SAS Initiator Device Table Overflow Event data */
907 924
@@ -910,6 +927,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW
910 U8 MaxInit; /* 00h */ 927 U8 MaxInit; /* 00h */
911 U8 CurrentInit; /* 01h */ 928 U8 CurrentInit; /* 01h */
912 U16 Reserved1; /* 02h */ 929 U16 Reserved1; /* 02h */
930 U64 SASAddress; /* 04h */
913} EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, 931} EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
914 MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, 932 MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
915 MpiEventDataSasInitTableOverflow_t, 933 MpiEventDataSasInitTableOverflow_t,
diff --git a/drivers/message/fusion/lsi/mpi_lan.h b/drivers/message/fusion/lsi/mpi_lan.h
index 03253b53b785..f41fcb69b359 100644
--- a/drivers/message/fusion/lsi/mpi_lan.h
+++ b/drivers/message/fusion/lsi/mpi_lan.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_lan.h 5 * Name: mpi_lan.h
diff --git a/drivers/message/fusion/lsi/mpi_log_fc.h b/drivers/message/fusion/lsi/mpi_log_fc.h
index e4dafcefeecd..face6e7acc72 100644
--- a/drivers/message/fusion/lsi/mpi_log_fc.h
+++ b/drivers/message/fusion/lsi/mpi_log_fc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2001 LSI Corporation. All rights reserved. 2 * Copyright (c) 2000-2008 LSI Corporation. All rights reserved.
3 * 3 *
4 * NAME: fc_log.h 4 * NAME: fc_log.h
5 * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips 5 * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips
diff --git a/drivers/message/fusion/lsi/mpi_log_sas.h b/drivers/message/fusion/lsi/mpi_log_sas.h
index af9da03e95e5..691620dbedd2 100644
--- a/drivers/message/fusion/lsi/mpi_log_sas.h
+++ b/drivers/message/fusion/lsi/mpi_log_sas.h
@@ -1,6 +1,6 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * Copyright 2003 LSI Corporation. All rights reserved. * 3 * Copyright (c) 2000-2008 LSI Corporation. All rights reserved. *
4 * * 4 * *
5 * Description * 5 * Description *
6 * ------------ * 6 * ------------ *
@@ -73,6 +73,8 @@
73#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO (0x00070004) 73#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO (0x00070004)
74#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ (0x00070005) 74#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ (0x00070005)
75 75
76#define IOP_LOGINFO_CODE_LOG_TIMESTAMP_EVENT (0x00080000)
77
76/****************************************************************************/ 78/****************************************************************************/
77/* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL */ 79/* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL */
78/****************************************************************************/ 80/****************************************************************************/
@@ -92,7 +94,7 @@
92#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP (0x0000000C) 94#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP (0x0000000C)
93#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D (0x0000000D) 95#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D (0x0000000D)
94#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL (0x0000000E) 96#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL (0x0000000E)
95#define PL_LOGINFO_SUB CODE_OPEN_FAIL_BAD_DEST (0x00000011) 97#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_BAD_DEST (0x00000011)
96#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP (0x00000012) 98#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP (0x00000012)
97#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP (0x00000013) 99#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP (0x00000013)
98#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0 (0x00000014) 100#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0 (0x00000014)
@@ -159,10 +161,11 @@
159 161
160#define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200) 162#define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200)
161#define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300) 163#define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300)
162#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */ 164#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400)
163 /* Bit 0 is Status Bit 0: FrameXferErr */ 165/* Bits 0-3 encode Transport Status Register (offset 0x08) */
164 /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ 166/* Bit 0 is Status Bit 0: FrameXferErr */
165 /* Bit 3 is Status Bit 18 WriteDataLengthGTDataLengthErr */ 167/* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
168/* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
166 169
167#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) 170#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500)
168#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) 171#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600)
@@ -177,6 +180,11 @@
177#define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01) 180#define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01)
178#define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00) 181#define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00)
179#define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000) 182#define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000)
183#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000)
184/* not currently used in mainline */
185#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK (0x00003000)
186#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP (0x00004000)
187#define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD (0x00005000)
180 188
181#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */ 189#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */
182#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */ 190#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */
@@ -243,6 +251,8 @@
243#define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014) 251#define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014)
244/* Activation failed trying to import the volume */ 252/* Activation failed trying to import the volume */
245#define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015) 253#define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015)
254/* Activation failed trying to import the volume */
255#define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_PHYS_DISKS (0x00010016)
246 256
247/* Phys Disk failed, too many phys disks */ 257/* Phys Disk failed, too many phys disks */
248#define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020) 258#define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020)
@@ -285,6 +295,21 @@
285/* Compatibility Error : IME size limited to < 2TB */ 295/* Compatibility Error : IME size limited to < 2TB */
286#define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D) 296#define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D)
287 297
298/* Device Firmware Update: DFU can only be started once */
299#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DFU_IN_PROGRESS (0x00010050)
300/* Device Firmware Update: Volume must be Optimal/Active/non-Quiesced */
301#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DEVICE_IN_INVALID_STATE (0x00010051)
302/* Device Firmware Update: DFU Timeout cannot be zero */
303#define IR_LOGINFO_DEV_FW_UPDATE_ERR_INVALID_TIMEOUT (0x00010052)
304/* Device Firmware Update: CREATE TIMER FAILED */
305#define IR_LOGINFO_DEV_FW_UPDATE_ERR_NO_TIMERS (0x00010053)
306/* Device Firmware Update: Failed to read SAS_IO_UNIT_PG_1 */
307#define IR_LOGINFO_DEV_FW_UPDATE_ERR_READING_CFG_PAGE (0x00010054)
308/* Device Firmware Update: Invalid SAS_IO_UNIT_PG_1 value(s) */
309#define IR_LOGINFO_DEV_FW_UPDATE_ERR_PORT_IO_TIMEOUTS_REQUIRED (0x00010055)
310/* Device Firmware Update: Unable to allocate memory for page */
311#define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE (0x00010056)
312
288 313
289/****************************************************************************/ 314/****************************************************************************/
290/* Defines for convenience */ 315/* Defines for convenience */
diff --git a/drivers/message/fusion/lsi/mpi_raid.h b/drivers/message/fusion/lsi/mpi_raid.h
index 2856108421d7..add60cc85be1 100644
--- a/drivers/message/fusion/lsi/mpi_raid.h
+++ b/drivers/message/fusion/lsi/mpi_raid.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2001-2007 LSI Corporation. 2 * Copyright (c) 2001-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_raid.h 5 * Name: mpi_raid.h
6 * Title: MPI RAID message and structures 6 * Title: MPI RAID message and structures
7 * Creation Date: February 27, 2001 7 * Creation Date: February 27, 2001
8 * 8 *
9 * mpi_raid.h Version: 01.05.03 9 * mpi_raid.h Version: 01.05.05
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -34,6 +34,9 @@
34 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. 34 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
35 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and 35 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and
36 * associated defines. 36 * associated defines.
37 * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord
38 * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
39 * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
37 * -------------------------------------------------------------------------- 40 * --------------------------------------------------------------------------
38 */ 41 */
39 42
@@ -93,6 +96,7 @@ typedef struct _MSG_RAID_ACTION
93#define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13) 96#define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13)
94#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14) 97#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14)
95#define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15) 98#define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15)
99#define MPI_RAID_ACTION_SET_VOLUME_NAME (0x16)
96 100
97/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */ 101/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
98#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001) 102#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001)
@@ -105,6 +109,9 @@ typedef struct _MSG_RAID_ACTION
105#define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) 109#define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000)
106#define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002) 110#define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002)
107 111
112/* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
113#define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD (0x00000001)
114
108/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */ 115/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
109#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001) 116#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001)
110 117
diff --git a/drivers/message/fusion/lsi/mpi_sas.h b/drivers/message/fusion/lsi/mpi_sas.h
index 33fca83cefc2..ab410036bbfc 100644
--- a/drivers/message/fusion/lsi/mpi_sas.h
+++ b/drivers/message/fusion/lsi/mpi_sas.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2004-2006 LSI Corporation. 2 * Copyright (c) 2004-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_sas.h 5 * Name: mpi_sas.h
6 * Title: MPI Serial Attached SCSI structures and definitions 6 * Title: MPI Serial Attached SCSI structures and definitions
7 * Creation Date: August 19, 2004 7 * Creation Date: August 19, 2004
8 * 8 *
9 * mpi_sas.h Version: 01.05.04 9 * mpi_sas.h Version: 01.05.05
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -23,6 +23,10 @@
23 * reply. 23 * reply.
24 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO 24 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO
25 * Unit Control request. 25 * Unit Control request.
26 * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
27 * including adding IOCParameter and IOCParameter value
28 * fields to SAS IO Unit Control Request.
29 * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
26 * -------------------------------------------------------------------------- 30 * --------------------------------------------------------------------------
27 */ 31 */
28 32
@@ -60,6 +64,8 @@
60 * Values for the SAS DeviceInfo field used in SAS Device Status Change Event 64 * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
61 * data and SAS IO Unit Configuration pages. 65 * data and SAS IO Unit Configuration pages.
62 */ 66 */
67#define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC (0xF0000000)
68
63#define MPI_SAS_DEVICE_INFO_SEP (0x00004000) 69#define MPI_SAS_DEVICE_INFO_SEP (0x00004000)
64#define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) 70#define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000)
65#define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) 71#define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000)
@@ -216,7 +222,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
216 U8 ChainOffset; /* 02h */ 222 U8 ChainOffset; /* 02h */
217 U8 Function; /* 03h */ 223 U8 Function; /* 03h */
218 U16 DevHandle; /* 04h */ 224 U16 DevHandle; /* 04h */
219 U8 Reserved3; /* 06h */ 225 U8 IOCParameter; /* 06h */
220 U8 MsgFlags; /* 07h */ 226 U8 MsgFlags; /* 07h */
221 U32 MsgContext; /* 08h */ 227 U32 MsgContext; /* 08h */
222 U8 TargetID; /* 0Ch */ 228 U8 TargetID; /* 0Ch */
@@ -225,7 +231,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
225 U8 PrimFlags; /* 0Fh */ 231 U8 PrimFlags; /* 0Fh */
226 U32 Primitive; /* 10h */ 232 U32 Primitive; /* 10h */
227 U64 SASAddress; /* 14h */ 233 U64 SASAddress; /* 14h */
228 U32 Reserved4; /* 1Ch */ 234 U32 IOCParameterValue; /* 1Ch */
229} MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST, 235} MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
230 SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t; 236 SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
231 237
@@ -241,6 +247,8 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
241#define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) 247#define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C)
242#define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */ 248#define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */
243#define MPI_SAS_OP_REMOVE_DEVICE (0x0D) 249#define MPI_SAS_OP_REMOVE_DEVICE (0x0D)
250#define MPI_SAS_OP_SET_IOC_PARAMETER (0x0E)
251#define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN (0x80)
244 252
245/* values for the PrimFlags field */ 253/* values for the PrimFlags field */
246#define MPI_SAS_PRIMFLAGS_SINGLE (0x08) 254#define MPI_SAS_PRIMFLAGS_SINGLE (0x08)
@@ -256,7 +264,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
256 U8 MsgLength; /* 02h */ 264 U8 MsgLength; /* 02h */
257 U8 Function; /* 03h */ 265 U8 Function; /* 03h */
258 U16 DevHandle; /* 04h */ 266 U16 DevHandle; /* 04h */
259 U8 Reserved3; /* 06h */ 267 U8 IOCParameter; /* 06h */
260 U8 MsgFlags; /* 07h */ 268 U8 MsgFlags; /* 07h */
261 U32 MsgContext; /* 08h */ 269 U32 MsgContext; /* 08h */
262 U16 Reserved4; /* 0Ch */ 270 U16 Reserved4; /* 0Ch */
diff --git a/drivers/message/fusion/lsi/mpi_targ.h b/drivers/message/fusion/lsi/mpi_targ.h
index ff8c37d3fdcb..c3dea7f6909d 100644
--- a/drivers/message/fusion/lsi/mpi_targ.h
+++ b/drivers/message/fusion/lsi/mpi_targ.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_targ.h 5 * Name: mpi_targ.h
diff --git a/drivers/message/fusion/lsi/mpi_tool.h b/drivers/message/fusion/lsi/mpi_tool.h
index 8834ae6ce0f2..53cd715aa7e4 100644
--- a/drivers/message/fusion/lsi/mpi_tool.h
+++ b/drivers/message/fusion/lsi/mpi_tool.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2001-2005 LSI Corporation. 2 * Copyright (c) 2001-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_tool.h 5 * Name: mpi_tool.h
diff --git a/drivers/message/fusion/lsi/mpi_type.h b/drivers/message/fusion/lsi/mpi_type.h
index 08dad9c1e446..888b26dbc413 100644
--- a/drivers/message/fusion/lsi/mpi_type.h
+++ b/drivers/message/fusion/lsi/mpi_type.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_type.h 5 * Name: mpi_type.h
6 * Title: MPI Basic type definitions 6 * Title: MPI Basic type definitions
7 * Creation Date: June 6, 2000 7 * Creation Date: June 6, 2000
8 * 8 *
9 * mpi_type.h Version: 01.05.01 9 * mpi_type.h Version: 01.05.02
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index c4e8b9aa3827..96ac88317b8e 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -79,9 +79,22 @@ MODULE_VERSION(my_VERSION);
79/* 79/*
80 * cmd line parameters 80 * cmd line parameters
81 */ 81 */
82static int mpt_msi_enable = -1; 82
83module_param(mpt_msi_enable, int, 0); 83static int mpt_msi_enable_spi;
84MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)"); 84module_param(mpt_msi_enable_spi, int, 0);
85MODULE_PARM_DESC(mpt_msi_enable_spi, " Enable MSI Support for SPI \
86 controllers (default=0)");
87
88static int mpt_msi_enable_fc;
89module_param(mpt_msi_enable_fc, int, 0);
90MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC \
91 controllers (default=0)");
92
93static int mpt_msi_enable_sas;
94module_param(mpt_msi_enable_sas, int, 1);
95MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS \
96 controllers (default=1)");
97
85 98
86static int mpt_channel_mapping; 99static int mpt_channel_mapping;
87module_param(mpt_channel_mapping, int, 0); 100module_param(mpt_channel_mapping, int, 0);
@@ -91,7 +104,17 @@ static int mpt_debug_level;
91static int mpt_set_debug_level(const char *val, struct kernel_param *kp); 104static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
92module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int, 105module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
93 &mpt_debug_level, 0600); 106 &mpt_debug_level, 0600);
94MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)"); 107MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h \
108 - (default=0)");
109
110int mpt_fwfault_debug;
111EXPORT_SYMBOL(mpt_fwfault_debug);
112module_param_call(mpt_fwfault_debug, param_set_int, param_get_int,
113 &mpt_fwfault_debug, 0600);
114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
115 " and halt Firmware on fault - (default=0)");
116
117
95 118
96#ifdef MFCNT 119#ifdef MFCNT
97static int mfcounter = 0; 120static int mfcounter = 0;
@@ -1751,16 +1774,25 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1751 ioc->bus_type = SAS; 1774 ioc->bus_type = SAS;
1752 } 1775 }
1753 1776
1754 if (mpt_msi_enable == -1) {
1755 /* Enable on SAS, disable on FC and SPI */
1756 if (ioc->bus_type == SAS)
1757 ioc->msi_enable = 1;
1758 else
1759 ioc->msi_enable = 0;
1760 } else
1761 /* follow flag: 0 - disable; 1 - enable */
1762 ioc->msi_enable = mpt_msi_enable;
1763 1777
1778 switch (ioc->bus_type) {
1779
1780 case SAS:
1781 ioc->msi_enable = mpt_msi_enable_sas;
1782 break;
1783
1784 case SPI:
1785 ioc->msi_enable = mpt_msi_enable_spi;
1786 break;
1787
1788 case FC:
1789 ioc->msi_enable = mpt_msi_enable_fc;
1790 break;
1791
1792 default:
1793 ioc->msi_enable = 0;
1794 break;
1795 }
1764 if (ioc->errata_flag_1064) 1796 if (ioc->errata_flag_1064)
1765 pci_disable_io_access(pdev); 1797 pci_disable_io_access(pdev);
1766 1798
@@ -6313,6 +6345,33 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6313 *size = y; 6345 *size = y;
6314} 6346}
6315 6347
6348
6349/**
6350 * mpt_halt_firmware - Halts the firmware if it is operational and panic
6351 * the kernel
6352 * @ioc: Pointer to MPT_ADAPTER structure
6353 *
6354 **/
6355void
6356mpt_halt_firmware(MPT_ADAPTER *ioc)
6357{
6358 u32 ioc_raw_state;
6359
6360 ioc_raw_state = mpt_GetIocState(ioc, 0);
6361
6362 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {
6363 printk(MYIOC_s_ERR_FMT "IOC is in FAULT state (%04xh)!!!\n",
6364 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
6365 panic("%s: IOC Fault (%04xh)!!!\n", ioc->name,
6366 ioc_raw_state & MPI_DOORBELL_DATA_MASK);
6367 } else {
6368 CHIPREG_WRITE32(&ioc->chip->Doorbell, 0xC0FFEE00);
6369 panic("%s: Firmware is halted due to command timeout\n",
6370 ioc->name);
6371 }
6372}
6373EXPORT_SYMBOL(mpt_halt_firmware);
6374
6316/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6375/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6317/* 6376/*
6318 * Reset Handling 6377 * Reset Handling
@@ -6345,6 +6404,8 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6345 printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name); 6404 printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name);
6346 printk("MF count 0x%x !\n", ioc->mfcnt); 6405 printk("MF count 0x%x !\n", ioc->mfcnt);
6347#endif 6406#endif
6407 if (mpt_fwfault_debug)
6408 mpt_halt_firmware(ioc);
6348 6409
6349 /* Reset the adapter. Prevent more than 1 call to 6410 /* Reset the adapter. Prevent more than 1 call to
6350 * mpt_do_ioc_recovery at any instant in time. 6411 * mpt_do_ioc_recovery at any instant in time.
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index dff048cfa101..b3e981d2a506 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -922,11 +922,14 @@ extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
922extern int mpt_findImVolumes(MPT_ADAPTER *ioc); 922extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
923extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); 923extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
924extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk); 924extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk);
925extern void mpt_halt_firmware(MPT_ADAPTER *ioc);
926
925 927
926/* 928/*
927 * Public data decl's... 929 * Public data decl's...
928 */ 930 */
929extern struct list_head ioc_list; 931extern struct list_head ioc_list;
932extern int mpt_fwfault_debug;
930 933
931/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 934/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
932#endif /* } __KERNEL__ */ 935#endif /* } __KERNEL__ */
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index ee090413e598..e62c6bc4ad33 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1846,6 +1846,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1846 if (hd->timeouts < -1) 1846 if (hd->timeouts < -1)
1847 hd->timeouts++; 1847 hd->timeouts++;
1848 1848
1849 if (mpt_fwfault_debug)
1850 mpt_halt_firmware(ioc);
1851
1849 /* Most important! Set TaskMsgContext to SCpnt's MsgContext! 1852 /* Most important! Set TaskMsgContext to SCpnt's MsgContext!
1850 * (the IO to be ABORT'd) 1853 * (the IO to be ABORT'd)
1851 * 1854 *
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 9cf8ae6e4b39..d5749a7bc777 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
10obj-$(CONFIG_ICS932S401) += ics932s401.o 10obj-$(CONFIG_ICS932S401) += ics932s401.o
11obj-$(CONFIG_LKDTM) += lkdtm.o 11obj-$(CONFIG_LKDTM) += lkdtm.o
12obj-$(CONFIG_TIFM_CORE) += tifm_core.o 12obj-$(CONFIG_TIFM_CORE) += tifm_core.o
13obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
14obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o 13obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
15obj-$(CONFIG_PHANTOM) += phantom.o 14obj-$(CONFIG_PHANTOM) += phantom.o
16obj-$(CONFIG_SGI_IOC4) += ioc4.o 15obj-$(CONFIG_SGI_IOC4) += ioc4.o
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
index 73b7fb8de47a..82fb9958f22f 100644
--- a/drivers/misc/sgi-xp/xpc_sn2.c
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -899,7 +899,7 @@ xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
899 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", 899 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
900 part_sn2->remote_vars_pa); 900 part_sn2->remote_vars_pa);
901 901
902 part->last_heartbeat = remote_vars->heartbeat; 902 part->last_heartbeat = remote_vars->heartbeat - 1;
903 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", 903 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
904 part->last_heartbeat); 904 part->last_heartbeat);
905 905
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 745ac188babe..d15d8b79d8e5 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = {
646 .ndo_get_stats = ei_get_stats, 646 .ndo_get_stats = ei_get_stats,
647 .ndo_set_multicast_list = ei_set_multicast_list, 647 .ndo_set_multicast_list = ei_set_multicast_list,
648 .ndo_validate_addr = eth_validate_addr, 648 .ndo_validate_addr = eth_validate_addr,
649 .ndo_set_mac_addr = eth_set_mac_addr, 649 .ndo_set_mac_address = eth_set_mac_addr,
650 .ndo_change_mtu = eth_change_mtu, 650 .ndo_change_mtu = eth_change_mtu,
651#ifdef CONFIG_NET_POLL_CONTROLLER 651#ifdef CONFIG_NET_POLL_CONTROLLER
652 .ndo_poll_controller = ei_poll, 652 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 337488ec707c..a4eb6c40678c 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -37,7 +37,10 @@ static int phy_debug = 0;
37#define __ei_open ax_ei_open 37#define __ei_open ax_ei_open
38#define __ei_close ax_ei_close 38#define __ei_close ax_ei_close
39#define __ei_poll ax_ei_poll 39#define __ei_poll ax_ei_poll
40#define __ei_start_xmit ax_ei_start_xmit
40#define __ei_tx_timeout ax_ei_tx_timeout 41#define __ei_tx_timeout ax_ei_tx_timeout
42#define __ei_get_stats ax_ei_get_stats
43#define __ei_set_multicast_list ax_ei_set_multicast_list
41#define __ei_interrupt ax_ei_interrupt 44#define __ei_interrupt ax_ei_interrupt
42#define ____alloc_ei_netdev ax__alloc_ei_netdev 45#define ____alloc_ei_netdev ax__alloc_ei_netdev
43#define __NS8390_init ax_NS8390_init 46#define __NS8390_init ax_NS8390_init
@@ -623,6 +626,23 @@ static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom)
623} 626}
624#endif 627#endif
625 628
629static const struct net_device_ops ax_netdev_ops = {
630 .ndo_open = ax_open,
631 .ndo_stop = ax_close,
632 .ndo_do_ioctl = ax_ioctl,
633
634 .ndo_start_xmit = ax_ei_start_xmit,
635 .ndo_tx_timeout = ax_ei_tx_timeout,
636 .ndo_get_stats = ax_ei_get_stats,
637 .ndo_set_multicast_list = ax_ei_set_multicast_list,
638 .ndo_validate_addr = eth_validate_addr,
639 .ndo_set_mac_address = eth_mac_addr,
640 .ndo_change_mtu = eth_change_mtu,
641#ifdef CONFIG_NET_POLL_CONTROLLER
642 .ndo_poll_controller = ax_ei_poll,
643#endif
644};
645
626/* setup code */ 646/* setup code */
627 647
628static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) 648static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local)
@@ -738,9 +758,7 @@ static int ax_init_dev(struct net_device *dev, int first_init)
738 ei_status.get_8390_hdr = &ax_get_8390_hdr; 758 ei_status.get_8390_hdr = &ax_get_8390_hdr;
739 ei_status.priv = 0; 759 ei_status.priv = 0;
740 760
741 dev->open = ax_open; 761 dev->netdev_ops = &ax_netdev_ops;
742 dev->stop = ax_close;
743 dev->do_ioctl = ax_ioctl;
744 dev->ethtool_ops = &ax_ethtool_ops; 762 dev->ethtool_ops = &ax_ethtool_ops;
745 763
746 ax->msg_enable = NETIF_MSG_LINK; 764 ax->msg_enable = NETIF_MSG_LINK;
@@ -753,9 +771,6 @@ static int ax_init_dev(struct net_device *dev, int first_init)
753 ax->mii.mdio_write = ax_phy_write; 771 ax->mii.mdio_write = ax_phy_write;
754 ax->mii.dev = dev; 772 ax->mii.dev = dev;
755 773
756#ifdef CONFIG_NET_POLL_CONTROLLER
757 dev->poll_controller = ax_ei_poll;
758#endif
759 ax_NS8390_init(dev, 0); 774 ax_NS8390_init(dev, 0);
760 775
761 if (first_init) 776 if (first_init)
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 5ae131c147f9..c38512ebcea6 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -679,6 +679,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
679 dev_kfree_skb_any(skb); 679 dev_kfree_skb_any(skb);
680 return -ENOMEM; 680 return -ENOMEM;
681 } 681 }
682 bp->force_copybreak = 1;
682 } 683 }
683 684
684 rh = (struct rx_header *) skb->data; 685 rh = (struct rx_header *) skb->data;
@@ -800,7 +801,7 @@ static int b44_rx(struct b44 *bp, int budget)
800 /* Omit CRC. */ 801 /* Omit CRC. */
801 len -= 4; 802 len -= 4;
802 803
803 if (len > RX_COPY_THRESHOLD) { 804 if (!bp->force_copybreak && len > RX_COPY_THRESHOLD) {
804 int skb_size; 805 int skb_size;
805 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); 806 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
806 if (skb_size < 0) 807 if (skb_size < 0)
@@ -2152,6 +2153,7 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
2152 bp = netdev_priv(dev); 2153 bp = netdev_priv(dev);
2153 bp->sdev = sdev; 2154 bp->sdev = sdev;
2154 bp->dev = dev; 2155 bp->dev = dev;
2156 bp->force_copybreak = 0;
2155 2157
2156 bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); 2158 bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE);
2157 2159
diff --git a/drivers/net/b44.h b/drivers/net/b44.h
index 7db0c84a7950..e678498de6db 100644
--- a/drivers/net/b44.h
+++ b/drivers/net/b44.h
@@ -395,7 +395,7 @@ struct b44 {
395 u32 rx_pending; 395 u32 rx_pending;
396 u32 tx_pending; 396 u32 tx_pending;
397 u8 phy_addr; 397 u8 phy_addr;
398 398 u8 force_copybreak;
399 struct mii_if_info mii_if; 399 struct mii_if_info mii_if;
400}; 400};
401 401
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index fd705d1295a7..6fcccef4cf3d 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -20,6 +20,11 @@
20 * (you will need to reboot afterwards) */ 20 * (you will need to reboot afterwards) */
21/* #define BNX2X_STOP_ON_ERROR */ 21/* #define BNX2X_STOP_ON_ERROR */
22 22
23#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
24#define BCM_VLAN 1
25#endif
26
27
23/* error/debug prints */ 28/* error/debug prints */
24 29
25#define DRV_MODULE_NAME "bnx2x" 30#define DRV_MODULE_NAME "bnx2x"
@@ -78,11 +83,6 @@
78#endif 83#endif
79 84
80 85
81#ifdef NETIF_F_HW_VLAN_TX
82#define BCM_VLAN 1
83#endif
84
85
86#define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) 86#define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff)
87#define U64_HI(x) (u32)(((u64)(x)) >> 32) 87#define U64_HI(x) (u32)(((u64)(x)) >> 32)
88#define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) 88#define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo))
@@ -150,6 +150,9 @@ struct sw_rx_page {
150 150
151#define PAGES_PER_SGE_SHIFT 0 151#define PAGES_PER_SGE_SHIFT 0
152#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) 152#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT)
153#define SGE_PAGE_SIZE PAGE_SIZE
154#define SGE_PAGE_SHIFT PAGE_SHIFT
155#define SGE_PAGE_ALIGN(addr) PAGE_ALIGN(addr)
153 156
154#define BCM_RX_ETH_PAYLOAD_ALIGN 64 157#define BCM_RX_ETH_PAYLOAD_ALIGN 64
155 158
@@ -736,7 +739,7 @@ struct bnx2x {
736 struct bnx2x_fastpath fp[MAX_CONTEXT]; 739 struct bnx2x_fastpath fp[MAX_CONTEXT];
737 void __iomem *regview; 740 void __iomem *regview;
738 void __iomem *doorbells; 741 void __iomem *doorbells;
739#define BNX2X_DB_SIZE (16*2048) 742#define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE)
740 743
741 struct net_device *dev; 744 struct net_device *dev;
742 struct pci_dev *pdev; 745 struct pci_dev *pdev;
@@ -801,6 +804,8 @@ struct bnx2x {
801#define TPA_ENABLE_FLAG 0x80 804#define TPA_ENABLE_FLAG 0x80
802#define NO_MCP_FLAG 0x100 805#define NO_MCP_FLAG 0x100
803#define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) 806#define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG)
807#define HW_VLAN_TX_FLAG 0x400
808#define HW_VLAN_RX_FLAG 0x800
804 809
805 int func; 810 int func;
806#define BP_PORT(bp) (bp->func % PORT_MAX) 811#define BP_PORT(bp) (bp->func % PORT_MAX)
@@ -811,7 +816,7 @@ struct bnx2x {
811 int pm_cap; 816 int pm_cap;
812 int pcie_cap; 817 int pcie_cap;
813 818
814 struct work_struct sp_task; 819 struct delayed_work sp_task;
815 struct work_struct reset_task; 820 struct work_struct reset_task;
816 821
817 struct timer_list timer; 822 struct timer_list timer;
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 4be05847f86f..7c533797c064 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -38,9 +38,7 @@
38#include <linux/time.h> 38#include <linux/time.h>
39#include <linux/ethtool.h> 39#include <linux/ethtool.h>
40#include <linux/mii.h> 40#include <linux/mii.h>
41#ifdef NETIF_F_HW_VLAN_TX 41#include <linux/if_vlan.h>
42 #include <linux/if_vlan.h>
43#endif
44#include <net/ip.h> 42#include <net/ip.h>
45#include <net/tcp.h> 43#include <net/tcp.h>
46#include <net/checksum.h> 44#include <net/checksum.h>
@@ -95,6 +93,7 @@ MODULE_PARM_DESC(debug, "default debug msglevel");
95module_param(use_multi, int, 0); 93module_param(use_multi, int, 0);
96MODULE_PARM_DESC(use_multi, "use per-CPU queues"); 94MODULE_PARM_DESC(use_multi, "use per-CPU queues");
97#endif 95#endif
96static struct workqueue_struct *bnx2x_wq;
98 97
99enum bnx2x_board_type { 98enum bnx2x_board_type {
100 BCM57710 = 0, 99 BCM57710 = 0,
@@ -671,7 +670,8 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
671 synchronize_irq(bp->pdev->irq); 670 synchronize_irq(bp->pdev->irq);
672 671
673 /* make sure sp_task is not running */ 672 /* make sure sp_task is not running */
674 cancel_work_sync(&bp->sp_task); 673 cancel_delayed_work(&bp->sp_task);
674 flush_workqueue(bnx2x_wq);
675} 675}
676 676
677/* fast path */ 677/* fast path */
@@ -972,7 +972,7 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp,
972 return; 972 return;
973 973
974 pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping), 974 pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping),
975 BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); 975 SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE);
976 __free_pages(page, PAGES_PER_SGE_SHIFT); 976 __free_pages(page, PAGES_PER_SGE_SHIFT);
977 977
978 sw_buf->page = NULL; 978 sw_buf->page = NULL;
@@ -1000,7 +1000,7 @@ static inline int bnx2x_alloc_rx_sge(struct bnx2x *bp,
1000 if (unlikely(page == NULL)) 1000 if (unlikely(page == NULL))
1001 return -ENOMEM; 1001 return -ENOMEM;
1002 1002
1003 mapping = pci_map_page(bp->pdev, page, 0, BCM_PAGE_SIZE*PAGES_PER_SGE, 1003 mapping = pci_map_page(bp->pdev, page, 0, SGE_PAGE_SIZE*PAGES_PER_SGE,
1004 PCI_DMA_FROMDEVICE); 1004 PCI_DMA_FROMDEVICE);
1005 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { 1005 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
1006 __free_pages(page, PAGES_PER_SGE_SHIFT); 1006 __free_pages(page, PAGES_PER_SGE_SHIFT);
@@ -1096,9 +1096,9 @@ static void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp,
1096 struct eth_fast_path_rx_cqe *fp_cqe) 1096 struct eth_fast_path_rx_cqe *fp_cqe)
1097{ 1097{
1098 struct bnx2x *bp = fp->bp; 1098 struct bnx2x *bp = fp->bp;
1099 u16 sge_len = BCM_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) - 1099 u16 sge_len = SGE_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) -
1100 le16_to_cpu(fp_cqe->len_on_bd)) >> 1100 le16_to_cpu(fp_cqe->len_on_bd)) >>
1101 BCM_PAGE_SHIFT; 1101 SGE_PAGE_SHIFT;
1102 u16 last_max, last_elem, first_elem; 1102 u16 last_max, last_elem, first_elem;
1103 u16 delta = 0; 1103 u16 delta = 0;
1104 u16 i; 1104 u16 i;
@@ -1203,22 +1203,22 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1203 u16 cqe_idx) 1203 u16 cqe_idx)
1204{ 1204{
1205 struct sw_rx_page *rx_pg, old_rx_pg; 1205 struct sw_rx_page *rx_pg, old_rx_pg;
1206 struct page *sge;
1207 u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); 1206 u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd);
1208 u32 i, frag_len, frag_size, pages; 1207 u32 i, frag_len, frag_size, pages;
1209 int err; 1208 int err;
1210 int j; 1209 int j;
1211 1210
1212 frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd; 1211 frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd;
1213 pages = BCM_PAGE_ALIGN(frag_size) >> BCM_PAGE_SHIFT; 1212 pages = SGE_PAGE_ALIGN(frag_size) >> SGE_PAGE_SHIFT;
1214 1213
1215 /* This is needed in order to enable forwarding support */ 1214 /* This is needed in order to enable forwarding support */
1216 if (frag_size) 1215 if (frag_size)
1217 skb_shinfo(skb)->gso_size = min((u32)BCM_PAGE_SIZE, 1216 skb_shinfo(skb)->gso_size = min((u32)SGE_PAGE_SIZE,
1218 max(frag_size, (u32)len_on_bd)); 1217 max(frag_size, (u32)len_on_bd));
1219 1218
1220#ifdef BNX2X_STOP_ON_ERROR 1219#ifdef BNX2X_STOP_ON_ERROR
1221 if (pages > 8*PAGES_PER_SGE) { 1220 if (pages >
1221 min((u32)8, (u32)MAX_SKB_FRAGS) * SGE_PAGE_SIZE * PAGES_PER_SGE) {
1222 BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n", 1222 BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n",
1223 pages, cqe_idx); 1223 pages, cqe_idx);
1224 BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n", 1224 BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n",
@@ -1234,9 +1234,8 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1234 1234
1235 /* FW gives the indices of the SGE as if the ring is an array 1235 /* FW gives the indices of the SGE as if the ring is an array
1236 (meaning that "next" element will consume 2 indices) */ 1236 (meaning that "next" element will consume 2 indices) */
1237 frag_len = min(frag_size, (u32)(BCM_PAGE_SIZE*PAGES_PER_SGE)); 1237 frag_len = min(frag_size, (u32)(SGE_PAGE_SIZE*PAGES_PER_SGE));
1238 rx_pg = &fp->rx_page_ring[sge_idx]; 1238 rx_pg = &fp->rx_page_ring[sge_idx];
1239 sge = rx_pg->page;
1240 old_rx_pg = *rx_pg; 1239 old_rx_pg = *rx_pg;
1241 1240
1242 /* If we fail to allocate a substitute page, we simply stop 1241 /* If we fail to allocate a substitute page, we simply stop
@@ -1249,7 +1248,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1249 1248
1250 /* Unmap the page as we r going to pass it to the stack */ 1249 /* Unmap the page as we r going to pass it to the stack */
1251 pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping), 1250 pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping),
1252 BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); 1251 SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE);
1253 1252
1254 /* Add one frag and update the appropriate fields in the skb */ 1253 /* Add one frag and update the appropriate fields in the skb */
1255 skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len); 1254 skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len);
@@ -1282,6 +1281,13 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1282 if (likely(new_skb)) { 1281 if (likely(new_skb)) {
1283 /* fix ip xsum and give it to the stack */ 1282 /* fix ip xsum and give it to the stack */
1284 /* (no need to map the new skb) */ 1283 /* (no need to map the new skb) */
1284#ifdef BCM_VLAN
1285 int is_vlan_cqe =
1286 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
1287 PARSING_FLAGS_VLAN);
1288 int is_not_hwaccel_vlan_cqe =
1289 (is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG)));
1290#endif
1285 1291
1286 prefetch(skb); 1292 prefetch(skb);
1287 prefetch(((char *)(skb)) + 128); 1293 prefetch(((char *)(skb)) + 128);
@@ -1306,6 +1312,12 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1306 struct iphdr *iph; 1312 struct iphdr *iph;
1307 1313
1308 iph = (struct iphdr *)skb->data; 1314 iph = (struct iphdr *)skb->data;
1315#ifdef BCM_VLAN
1316 /* If there is no Rx VLAN offloading -
1317 take VLAN tag into an account */
1318 if (unlikely(is_not_hwaccel_vlan_cqe))
1319 iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN);
1320#endif
1309 iph->check = 0; 1321 iph->check = 0;
1310 iph->check = ip_fast_csum((u8 *)iph, iph->ihl); 1322 iph->check = ip_fast_csum((u8 *)iph, iph->ihl);
1311 } 1323 }
@@ -1313,9 +1325,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1313 if (!bnx2x_fill_frag_skb(bp, fp, skb, 1325 if (!bnx2x_fill_frag_skb(bp, fp, skb,
1314 &cqe->fast_path_cqe, cqe_idx)) { 1326 &cqe->fast_path_cqe, cqe_idx)) {
1315#ifdef BCM_VLAN 1327#ifdef BCM_VLAN
1316 if ((bp->vlgrp != NULL) && 1328 if ((bp->vlgrp != NULL) && is_vlan_cqe &&
1317 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & 1329 (!is_not_hwaccel_vlan_cqe))
1318 PARSING_FLAGS_VLAN))
1319 vlan_hwaccel_receive_skb(skb, bp->vlgrp, 1330 vlan_hwaccel_receive_skb(skb, bp->vlgrp,
1320 le16_to_cpu(cqe->fast_path_cqe. 1331 le16_to_cpu(cqe->fast_path_cqe.
1321 vlan_tag)); 1332 vlan_tag));
@@ -1355,11 +1366,23 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
1355 rx_prods.cqe_prod = rx_comp_prod; 1366 rx_prods.cqe_prod = rx_comp_prod;
1356 rx_prods.sge_prod = rx_sge_prod; 1367 rx_prods.sge_prod = rx_sge_prod;
1357 1368
1369 /*
1370 * Make sure that the BD and SGE data is updated before updating the
1371 * producers since FW might read the BD/SGE right after the producer
1372 * is updated.
1373 * This is only applicable for weak-ordered memory model archs such
1374 * as IA-64. The following barrier is also mandatory since FW will
1375 * assumes BDs must have buffers.
1376 */
1377 wmb();
1378
1358 for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++) 1379 for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++)
1359 REG_WR(bp, BAR_TSTRORM_INTMEM + 1380 REG_WR(bp, BAR_TSTRORM_INTMEM +
1360 TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4, 1381 TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4,
1361 ((u32 *)&rx_prods)[i]); 1382 ((u32 *)&rx_prods)[i]);
1362 1383
1384 mmiowb(); /* keep prod updates ordered */
1385
1363 DP(NETIF_MSG_RX_STATUS, 1386 DP(NETIF_MSG_RX_STATUS,
1364 "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n", 1387 "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n",
1365 bd_prod, rx_comp_prod, rx_sge_prod); 1388 bd_prod, rx_comp_prod, rx_sge_prod);
@@ -1415,7 +1438,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1415 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" 1438 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x"
1416 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), 1439 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags),
1417 cqe_fp_flags, cqe->fast_path_cqe.status_flags, 1440 cqe_fp_flags, cqe->fast_path_cqe.status_flags,
1418 cqe->fast_path_cqe.rss_hash_result, 1441 le32_to_cpu(cqe->fast_path_cqe.rss_hash_result),
1419 le16_to_cpu(cqe->fast_path_cqe.vlan_tag), 1442 le16_to_cpu(cqe->fast_path_cqe.vlan_tag),
1420 le16_to_cpu(cqe->fast_path_cqe.pkt_len)); 1443 le16_to_cpu(cqe->fast_path_cqe.pkt_len));
1421 1444
@@ -1547,7 +1570,7 @@ reuse_rx:
1547 } 1570 }
1548 1571
1549#ifdef BCM_VLAN 1572#ifdef BCM_VLAN
1550 if ((bp->vlgrp != NULL) && 1573 if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
1551 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & 1574 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
1552 PARSING_FLAGS_VLAN)) 1575 PARSING_FLAGS_VLAN))
1553 vlan_hwaccel_receive_skb(skb, bp->vlgrp, 1576 vlan_hwaccel_receive_skb(skb, bp->vlgrp,
@@ -1580,7 +1603,6 @@ next_cqe:
1580 /* Update producers */ 1603 /* Update producers */
1581 bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod, 1604 bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod,
1582 fp->rx_sge_prod); 1605 fp->rx_sge_prod);
1583 mmiowb(); /* keep prod updates ordered */
1584 1606
1585 fp->rx_pkt += rx_pkt; 1607 fp->rx_pkt += rx_pkt;
1586 fp->rx_calls++; 1608 fp->rx_calls++;
@@ -1660,7 +1682,7 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
1660 1682
1661 1683
1662 if (unlikely(status & 0x1)) { 1684 if (unlikely(status & 0x1)) {
1663 schedule_work(&bp->sp_task); 1685 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0);
1664 1686
1665 status &= ~0x1; 1687 status &= ~0x1;
1666 if (!status) 1688 if (!status)
@@ -1887,7 +1909,8 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode)
1887 1909
1888static void bnx2x_calc_fc_adv(struct bnx2x *bp) 1910static void bnx2x_calc_fc_adv(struct bnx2x *bp)
1889{ 1911{
1890 switch (bp->link_vars.ieee_fc) { 1912 switch (bp->link_vars.ieee_fc &
1913 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) {
1891 case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE: 1914 case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE:
1892 bp->port.advertising &= ~(ADVERTISED_Asym_Pause | 1915 bp->port.advertising &= ~(ADVERTISED_Asym_Pause |
1893 ADVERTISED_Pause); 1916 ADVERTISED_Pause);
@@ -1957,10 +1980,11 @@ static u8 bnx2x_initial_phy_init(struct bnx2x *bp)
1957 rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); 1980 rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
1958 bnx2x_release_phy_lock(bp); 1981 bnx2x_release_phy_lock(bp);
1959 1982
1983 bnx2x_calc_fc_adv(bp);
1984
1960 if (bp->link_vars.link_up) 1985 if (bp->link_vars.link_up)
1961 bnx2x_link_report(bp); 1986 bnx2x_link_report(bp);
1962 1987
1963 bnx2x_calc_fc_adv(bp);
1964 1988
1965 return rc; 1989 return rc;
1966 } 1990 }
@@ -2220,9 +2244,7 @@ static void bnx2x_link_attn(struct bnx2x *bp)
2220 /* Make sure that we are synced with the current statistics */ 2244 /* Make sure that we are synced with the current statistics */
2221 bnx2x_stats_handle(bp, STATS_EVENT_STOP); 2245 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
2222 2246
2223 bnx2x_acquire_phy_lock(bp);
2224 bnx2x_link_update(&bp->link_params, &bp->link_vars); 2247 bnx2x_link_update(&bp->link_params, &bp->link_vars);
2225 bnx2x_release_phy_lock(bp);
2226 2248
2227 if (bp->link_vars.link_up) { 2249 if (bp->link_vars.link_up) {
2228 2250
@@ -2471,6 +2493,8 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
2471 if (asserted & ATTN_HARD_WIRED_MASK) { 2493 if (asserted & ATTN_HARD_WIRED_MASK) {
2472 if (asserted & ATTN_NIG_FOR_FUNC) { 2494 if (asserted & ATTN_NIG_FOR_FUNC) {
2473 2495
2496 bnx2x_acquire_phy_lock(bp);
2497
2474 /* save nig interrupt mask */ 2498 /* save nig interrupt mask */
2475 bp->nig_mask = REG_RD(bp, nig_int_mask_addr); 2499 bp->nig_mask = REG_RD(bp, nig_int_mask_addr);
2476 REG_WR(bp, nig_int_mask_addr, 0); 2500 REG_WR(bp, nig_int_mask_addr, 0);
@@ -2526,8 +2550,10 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
2526 REG_WR(bp, hc_addr, asserted); 2550 REG_WR(bp, hc_addr, asserted);
2527 2551
2528 /* now set back the mask */ 2552 /* now set back the mask */
2529 if (asserted & ATTN_NIG_FOR_FUNC) 2553 if (asserted & ATTN_NIG_FOR_FUNC) {
2530 REG_WR(bp, nig_int_mask_addr, bp->nig_mask); 2554 REG_WR(bp, nig_int_mask_addr, bp->nig_mask);
2555 bnx2x_release_phy_lock(bp);
2556 }
2531} 2557}
2532 2558
2533static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) 2559static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
@@ -2795,8 +2821,10 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
2795static void bnx2x_attn_int(struct bnx2x *bp) 2821static void bnx2x_attn_int(struct bnx2x *bp)
2796{ 2822{
2797 /* read local copy of bits */ 2823 /* read local copy of bits */
2798 u32 attn_bits = bp->def_status_blk->atten_status_block.attn_bits; 2824 u32 attn_bits = le32_to_cpu(bp->def_status_blk->atten_status_block.
2799 u32 attn_ack = bp->def_status_blk->atten_status_block.attn_bits_ack; 2825 attn_bits);
2826 u32 attn_ack = le32_to_cpu(bp->def_status_blk->atten_status_block.
2827 attn_bits_ack);
2800 u32 attn_state = bp->attn_state; 2828 u32 attn_state = bp->attn_state;
2801 2829
2802 /* look for changed bits */ 2830 /* look for changed bits */
@@ -2820,7 +2848,7 @@ static void bnx2x_attn_int(struct bnx2x *bp)
2820 2848
2821static void bnx2x_sp_task(struct work_struct *work) 2849static void bnx2x_sp_task(struct work_struct *work)
2822{ 2850{
2823 struct bnx2x *bp = container_of(work, struct bnx2x, sp_task); 2851 struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work);
2824 u16 status; 2852 u16 status;
2825 2853
2826 2854
@@ -2844,7 +2872,7 @@ static void bnx2x_sp_task(struct work_struct *work)
2844 if (status & 0x2) 2872 if (status & 0x2)
2845 bp->stats_pending = 0; 2873 bp->stats_pending = 0;
2846 2874
2847 bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, bp->def_att_idx, 2875 bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, le16_to_cpu(bp->def_att_idx),
2848 IGU_INT_NOP, 1); 2876 IGU_INT_NOP, 1);
2849 bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx), 2877 bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx),
2850 IGU_INT_NOP, 1); 2878 IGU_INT_NOP, 1);
@@ -2875,7 +2903,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
2875 return IRQ_HANDLED; 2903 return IRQ_HANDLED;
2876#endif 2904#endif
2877 2905
2878 schedule_work(&bp->sp_task); 2906 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0);
2879 2907
2880 return IRQ_HANDLED; 2908 return IRQ_HANDLED;
2881} 2909}
@@ -2892,7 +2920,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
2892#define ADD_64(s_hi, a_hi, s_lo, a_lo) \ 2920#define ADD_64(s_hi, a_hi, s_lo, a_lo) \
2893 do { \ 2921 do { \
2894 s_lo += a_lo; \ 2922 s_lo += a_lo; \
2895 s_hi += a_hi + (s_lo < a_lo) ? 1 : 0; \ 2923 s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \
2896 } while (0) 2924 } while (0)
2897 2925
2898/* difference = minuend - subtrahend */ 2926/* difference = minuend - subtrahend */
@@ -4496,7 +4524,7 @@ static void bnx2x_init_context(struct bnx2x *bp)
4496 4524
4497static void bnx2x_init_ind_table(struct bnx2x *bp) 4525static void bnx2x_init_ind_table(struct bnx2x *bp)
4498{ 4526{
4499 int port = BP_PORT(bp); 4527 int func = BP_FUNC(bp);
4500 int i; 4528 int i;
4501 4529
4502 if (!is_multi(bp)) 4530 if (!is_multi(bp))
@@ -4505,10 +4533,8 @@ static void bnx2x_init_ind_table(struct bnx2x *bp)
4505 DP(NETIF_MSG_IFUP, "Initializing indirection table\n"); 4533 DP(NETIF_MSG_IFUP, "Initializing indirection table\n");
4506 for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) 4534 for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++)
4507 REG_WR8(bp, BAR_TSTRORM_INTMEM + 4535 REG_WR8(bp, BAR_TSTRORM_INTMEM +
4508 TSTORM_INDIRECTION_TABLE_OFFSET(port) + i, 4536 TSTORM_INDIRECTION_TABLE_OFFSET(func) + i,
4509 i % bp->num_queues); 4537 BP_CL_ID(bp) + (i % bp->num_queues));
4510
4511 REG_WR(bp, PRS_REG_A_PRSU_20, 0xf);
4512} 4538}
4513 4539
4514static void bnx2x_set_client_config(struct bnx2x *bp) 4540static void bnx2x_set_client_config(struct bnx2x *bp)
@@ -4517,12 +4543,12 @@ static void bnx2x_set_client_config(struct bnx2x *bp)
4517 int port = BP_PORT(bp); 4543 int port = BP_PORT(bp);
4518 int i; 4544 int i;
4519 4545
4520 tstorm_client.mtu = bp->dev->mtu + ETH_OVREHEAD; 4546 tstorm_client.mtu = bp->dev->mtu;
4521 tstorm_client.statistics_counter_id = BP_CL_ID(bp); 4547 tstorm_client.statistics_counter_id = BP_CL_ID(bp);
4522 tstorm_client.config_flags = 4548 tstorm_client.config_flags =
4523 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; 4549 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE;
4524#ifdef BCM_VLAN 4550#ifdef BCM_VLAN
4525 if (bp->rx_mode && bp->vlgrp) { 4551 if (bp->rx_mode && bp->vlgrp && (bp->flags & HW_VLAN_RX_FLAG)) {
4526 tstorm_client.config_flags |= 4552 tstorm_client.config_flags |=
4527 TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE; 4553 TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE;
4528 DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); 4554 DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
@@ -4531,7 +4557,7 @@ static void bnx2x_set_client_config(struct bnx2x *bp)
4531 4557
4532 if (bp->flags & TPA_ENABLE_FLAG) { 4558 if (bp->flags & TPA_ENABLE_FLAG) {
4533 tstorm_client.max_sges_for_packet = 4559 tstorm_client.max_sges_for_packet =
4534 BCM_PAGE_ALIGN(tstorm_client.mtu) >> BCM_PAGE_SHIFT; 4560 SGE_PAGE_ALIGN(tstorm_client.mtu) >> SGE_PAGE_SHIFT;
4535 tstorm_client.max_sges_for_packet = 4561 tstorm_client.max_sges_for_packet =
4536 ((tstorm_client.max_sges_for_packet + 4562 ((tstorm_client.max_sges_for_packet +
4537 PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >> 4563 PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >>
@@ -4714,10 +4740,11 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
4714 bp->e1hov); 4740 bp->e1hov);
4715 } 4741 }
4716 4742
4717 /* Init CQ ring mapping and aggregation size */ 4743 /* Init CQ ring mapping and aggregation size, the FW limit is 8 frags */
4718 max_agg_size = min((u32)(bp->rx_buf_size + 4744 max_agg_size =
4719 8*BCM_PAGE_SIZE*PAGES_PER_SGE), 4745 min((u32)(min((u32)8, (u32)MAX_SKB_FRAGS) *
4720 (u32)0xffff); 4746 SGE_PAGE_SIZE * PAGES_PER_SGE),
4747 (u32)0xffff);
4721 for_each_queue(bp, i) { 4748 for_each_queue(bp, i) {
4722 struct bnx2x_fastpath *fp = &bp->fp[i]; 4749 struct bnx2x_fastpath *fp = &bp->fp[i];
4723 4750
@@ -4785,6 +4812,15 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code)
4785 bnx2x_init_context(bp); 4812 bnx2x_init_context(bp);
4786 bnx2x_init_internal(bp, load_code); 4813 bnx2x_init_internal(bp, load_code);
4787 bnx2x_init_ind_table(bp); 4814 bnx2x_init_ind_table(bp);
4815 bnx2x_stats_init(bp);
4816
4817 /* At this point, we are ready for interrupts */
4818 atomic_set(&bp->intr_sem, 0);
4819
4820 /* flush all before enabling interrupts */
4821 mb();
4822 mmiowb();
4823
4788 bnx2x_int_enable(bp); 4824 bnx2x_int_enable(bp);
4789} 4825}
4790 4826
@@ -5134,7 +5170,6 @@ static int bnx2x_init_common(struct bnx2x *bp)
5134 REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); 5170 REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1);
5135 REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); 5171 REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1);
5136 REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); 5172 REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1);
5137 REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 1);
5138 5173
5139/* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ 5174/* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */
5140 REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); 5175 REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1);
@@ -5212,6 +5247,7 @@ static int bnx2x_init_common(struct bnx2x *bp)
5212 } 5247 }
5213 5248
5214 bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); 5249 bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END);
5250 REG_WR(bp, PRS_REG_A_PRSU_20, 0xf);
5215 /* set NIC mode */ 5251 /* set NIC mode */
5216 REG_WR(bp, PRS_REG_NIC_MODE, 1); 5252 REG_WR(bp, PRS_REG_NIC_MODE, 1);
5217 if (CHIP_IS_E1H(bp)) 5253 if (CHIP_IS_E1H(bp))
@@ -6393,17 +6429,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6393 } 6429 }
6394 } 6430 }
6395 6431
6396 bnx2x_stats_init(bp);
6397
6398 bp->state = BNX2X_STATE_OPENING_WAIT4_PORT; 6432 bp->state = BNX2X_STATE_OPENING_WAIT4_PORT;
6399 6433
6400 /* Enable Rx interrupt handling before sending the ramrod
6401 as it's completed on Rx FP queue */
6402 bnx2x_napi_enable(bp);
6403
6404 /* Enable interrupt handling */
6405 atomic_set(&bp->intr_sem, 0);
6406
6407 rc = bnx2x_setup_leading(bp); 6434 rc = bnx2x_setup_leading(bp);
6408 if (rc) { 6435 if (rc) {
6409 BNX2X_ERR("Setup leading failed!\n"); 6436 BNX2X_ERR("Setup leading failed!\n");
@@ -7501,7 +7528,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
7501 7528
7502 mutex_init(&bp->port.phy_mutex); 7529 mutex_init(&bp->port.phy_mutex);
7503 7530
7504 INIT_WORK(&bp->sp_task, bnx2x_sp_task); 7531 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
7505 INIT_WORK(&bp->reset_task, bnx2x_reset_task); 7532 INIT_WORK(&bp->reset_task, bnx2x_reset_task);
7506 7533
7507 rc = bnx2x_get_hwinfo(bp); 7534 rc = bnx2x_get_hwinfo(bp);
@@ -8727,6 +8754,8 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
8727 tx_bd->general_data = ((UNICAST_ADDRESS << 8754 tx_bd->general_data = ((UNICAST_ADDRESS <<
8728 ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1); 8755 ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1);
8729 8756
8757 wmb();
8758
8730 fp->hw_tx_prods->bds_prod = 8759 fp->hw_tx_prods->bds_prod =
8731 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1); 8760 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1);
8732 mb(); /* FW restriction: must not reorder writing nbd and packets */ 8761 mb(); /* FW restriction: must not reorder writing nbd and packets */
@@ -8778,7 +8807,6 @@ test_loopback_rx_exit:
8778 /* Update producers */ 8807 /* Update producers */
8779 bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, 8808 bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod,
8780 fp->rx_sge_prod); 8809 fp->rx_sge_prod);
8781 mmiowb(); /* keep prod updates ordered */
8782 8810
8783test_loopback_exit: 8811test_loopback_exit:
8784 bp->link_params.loopback_mode = LOOPBACK_NONE; 8812 bp->link_params.loopback_mode = LOOPBACK_NONE;
@@ -9549,11 +9577,14 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9549 "sending pkt %u @%p next_idx %u bd %u @%p\n", 9577 "sending pkt %u @%p next_idx %u bd %u @%p\n",
9550 pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd); 9578 pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd);
9551 9579
9552 if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb)) { 9580#ifdef BCM_VLAN
9581 if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb) &&
9582 (bp->flags & HW_VLAN_TX_FLAG)) {
9553 tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb)); 9583 tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb));
9554 tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG; 9584 tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG;
9555 vlan_off += 4; 9585 vlan_off += 4;
9556 } else 9586 } else
9587#endif
9557 tx_bd->vlan = cpu_to_le16(pkt_prod); 9588 tx_bd->vlan = cpu_to_le16(pkt_prod);
9558 9589
9559 if (xmit_type) { 9590 if (xmit_type) {
@@ -9705,6 +9736,15 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9705 9736
9706 DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); 9737 DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod);
9707 9738
9739 /*
9740 * Make sure that the BD data is updated before updating the producer
9741 * since FW might read the BD right after the producer is updated.
9742 * This is only applicable for weak-ordered memory model archs such
9743 * as IA-64. The following barrier is also mandatory since FW will
9744 * assumes packets must have BDs.
9745 */
9746 wmb();
9747
9708 fp->hw_tx_prods->bds_prod = 9748 fp->hw_tx_prods->bds_prod =
9709 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd); 9749 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd);
9710 mb(); /* FW restriction: must not reorder writing nbd and packets */ 9750 mb(); /* FW restriction: must not reorder writing nbd and packets */
@@ -9718,6 +9758,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9718 dev->trans_start = jiffies; 9758 dev->trans_start = jiffies;
9719 9759
9720 if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) { 9760 if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) {
9761 /* We want bnx2x_tx_int to "see" the updated tx_bd_prod
9762 if we put Tx into XOFF state. */
9763 smp_mb();
9721 netif_stop_queue(dev); 9764 netif_stop_queue(dev);
9722 bp->eth_stats.driver_xoff++; 9765 bp->eth_stats.driver_xoff++;
9723 if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3) 9766 if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3)
@@ -9987,6 +10030,16 @@ static void bnx2x_vlan_rx_register(struct net_device *dev,
9987 struct bnx2x *bp = netdev_priv(dev); 10030 struct bnx2x *bp = netdev_priv(dev);
9988 10031
9989 bp->vlgrp = vlgrp; 10032 bp->vlgrp = vlgrp;
10033
10034 /* Set flags according to the required capabilities */
10035 bp->flags &= ~(HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
10036
10037 if (dev->features & NETIF_F_HW_VLAN_TX)
10038 bp->flags |= HW_VLAN_TX_FLAG;
10039
10040 if (dev->features & NETIF_F_HW_VLAN_RX)
10041 bp->flags |= HW_VLAN_RX_FLAG;
10042
9990 if (netif_running(dev)) 10043 if (netif_running(dev))
9991 bnx2x_set_client_config(bp); 10044 bnx2x_set_client_config(bp);
9992} 10045}
@@ -10143,6 +10196,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
10143 dev->features |= NETIF_F_HIGHDMA; 10196 dev->features |= NETIF_F_HIGHDMA;
10144#ifdef BCM_VLAN 10197#ifdef BCM_VLAN
10145 dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 10198 dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
10199 bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
10146#endif 10200#endif
10147 dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); 10201 dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
10148 dev->features |= NETIF_F_TSO6; 10202 dev->features |= NETIF_F_TSO6;
@@ -10519,12 +10573,20 @@ static struct pci_driver bnx2x_pci_driver = {
10519 10573
10520static int __init bnx2x_init(void) 10574static int __init bnx2x_init(void)
10521{ 10575{
10576 bnx2x_wq = create_singlethread_workqueue("bnx2x");
10577 if (bnx2x_wq == NULL) {
10578 printk(KERN_ERR PFX "Cannot create workqueue\n");
10579 return -ENOMEM;
10580 }
10581
10522 return pci_register_driver(&bnx2x_pci_driver); 10582 return pci_register_driver(&bnx2x_pci_driver);
10523} 10583}
10524 10584
10525static void __exit bnx2x_cleanup(void) 10585static void __exit bnx2x_cleanup(void)
10526{ 10586{
10527 pci_unregister_driver(&bnx2x_pci_driver); 10587 pci_unregister_driver(&bnx2x_pci_driver);
10588
10589 destroy_workqueue(bnx2x_wq);
10528} 10590}
10529 10591
10530module_init(bnx2x_init); 10592module_init(bnx2x_init);
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index e3131ea629cd..dfe92264e825 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -132,7 +132,7 @@ void ehea_dump(void *adr, int len, char *msg)
132 int x; 132 int x;
133 unsigned char *deb = adr; 133 unsigned char *deb = adr;
134 for (x = 0; x < len; x += 16) { 134 for (x = 0; x < len; x += 16) {
135 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, 135 printk(DRV_NAME " %s adr=%p ofs=%04x %016llx %016llx\n", msg,
136 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); 136 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8]));
137 deb += 16; 137 deb += 16;
138 } 138 }
@@ -883,7 +883,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
883 883
884 while (eqe) { 884 while (eqe) {
885 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 885 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
886 ehea_error("QP aff_err: entry=0x%lx, token=0x%x", 886 ehea_error("QP aff_err: entry=0x%llx, token=0x%x",
887 eqe->entry, qp_token); 887 eqe->entry, qp_token);
888 888
889 qp = port->port_res[qp_token].qp; 889 qp = port->port_res[qp_token].qp;
@@ -1159,7 +1159,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
1159 netif_stop_queue(port->netdev); 1159 netif_stop_queue(port->netdev);
1160 break; 1160 break;
1161 default: 1161 default:
1162 ehea_error("unknown event code %x, eqe=0x%lX", ec, eqe); 1162 ehea_error("unknown event code %x, eqe=0x%llX", ec, eqe);
1163 break; 1163 break;
1164 } 1164 }
1165} 1165}
@@ -1971,7 +1971,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
1971 } 1971 }
1972 1972
1973 if (dev->mc_count > port->adapter->max_mc_mac) { 1973 if (dev->mc_count > port->adapter->max_mc_mac) {
1974 ehea_info("Mcast registration limit reached (0x%lx). " 1974 ehea_info("Mcast registration limit reached (0x%llx). "
1975 "Use ALLMULTI!", 1975 "Use ALLMULTI!",
1976 port->adapter->max_mc_mac); 1976 port->adapter->max_mc_mac);
1977 goto out; 1977 goto out;
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 225c692b5d99..49d766ebbcf4 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -168,7 +168,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
168 cq->fw_handle, rpage, 1); 168 cq->fw_handle, rpage, 1);
169 if (hret < H_SUCCESS) { 169 if (hret < H_SUCCESS) {
170 ehea_error("register_rpage_cq failed ehea_cq=%p " 170 ehea_error("register_rpage_cq failed ehea_cq=%p "
171 "hret=%lx counter=%i act_pages=%i", 171 "hret=%llx counter=%i act_pages=%i",
172 cq, hret, counter, cq->attr.nr_pages); 172 cq, hret, counter, cq->attr.nr_pages);
173 goto out_kill_hwq; 173 goto out_kill_hwq;
174 } 174 }
@@ -178,13 +178,13 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
178 178
179 if ((hret != H_SUCCESS) || (vpage)) { 179 if ((hret != H_SUCCESS) || (vpage)) {
180 ehea_error("registration of pages not " 180 ehea_error("registration of pages not "
181 "complete hret=%lx\n", hret); 181 "complete hret=%llx\n", hret);
182 goto out_kill_hwq; 182 goto out_kill_hwq;
183 } 183 }
184 } else { 184 } else {
185 if (hret != H_PAGE_REGISTERED) { 185 if (hret != H_PAGE_REGISTERED) {
186 ehea_error("CQ: registration of page failed " 186 ehea_error("CQ: registration of page failed "
187 "hret=%lx\n", hret); 187 "hret=%llx\n", hret);
188 goto out_kill_hwq; 188 goto out_kill_hwq;
189 } 189 }
190 } 190 }
@@ -986,15 +986,15 @@ void print_error_data(u64 *data)
986 length = EHEA_PAGESIZE; 986 length = EHEA_PAGESIZE;
987 987
988 if (type == 0x8) /* Queue Pair */ 988 if (type == 0x8) /* Queue Pair */
989 ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, " 989 ehea_error("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, "
990 "port=%lX", resource, data[6], data[12], data[22]); 990 "port=%llX", resource, data[6], data[12], data[22]);
991 991
992 if (type == 0x4) /* Completion Queue */ 992 if (type == 0x4) /* Completion Queue */
993 ehea_error("CQ (resource=%lX) state: AER=0x%lX", resource, 993 ehea_error("CQ (resource=%llX) state: AER=0x%llX", resource,
994 data[6]); 994 data[6]);
995 995
996 if (type == 0x3) /* Event Queue */ 996 if (type == 0x3) /* Event Queue */
997 ehea_error("EQ (resource=%lX) state: AER=0x%lX", resource, 997 ehea_error("EQ (resource=%llX) state: AER=0x%llX", resource,
998 data[6]); 998 data[6]);
999 999
1000 ehea_dump(data, length, "error data"); 1000 ehea_dump(data, length, "error data");
@@ -1016,11 +1016,11 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
1016 rblock); 1016 rblock);
1017 1017
1018 if (ret == H_R_STATE) 1018 if (ret == H_R_STATE)
1019 ehea_error("No error data is available: %lX.", res_handle); 1019 ehea_error("No error data is available: %llX.", res_handle);
1020 else if (ret == H_SUCCESS) 1020 else if (ret == H_SUCCESS)
1021 print_error_data(rblock); 1021 print_error_data(rblock);
1022 else 1022 else
1023 ehea_error("Error data could not be fetched: %lX", res_handle); 1023 ehea_error("Error data could not be fetched: %llX", res_handle);
1024 1024
1025 kfree(rblock); 1025 kfree(rblock);
1026} 1026}
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 4e6a9195fe5f..ce900e54d8d1 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -795,6 +795,7 @@ static int fs_enet_open(struct net_device *dev)
795 795
796 err = fs_init_phy(dev); 796 err = fs_init_phy(dev);
797 if (err) { 797 if (err) {
798 free_irq(fep->interrupt, dev);
798 if (fep->fpi->use_napi) 799 if (fep->fpi->use_napi)
799 napi_disable(&fep->napi); 800 napi_disable(&fep->napi);
800 return err; 801 return err;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index efcbeb6c8673..ea530673236e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1622,10 +1622,18 @@ static int gfar_clean_tx_ring(struct net_device *dev)
1622static void gfar_schedule_cleanup(struct net_device *dev) 1622static void gfar_schedule_cleanup(struct net_device *dev)
1623{ 1623{
1624 struct gfar_private *priv = netdev_priv(dev); 1624 struct gfar_private *priv = netdev_priv(dev);
1625 unsigned long flags;
1626
1627 spin_lock_irqsave(&priv->txlock, flags);
1628 spin_lock(&priv->rxlock);
1629
1625 if (netif_rx_schedule_prep(&priv->napi)) { 1630 if (netif_rx_schedule_prep(&priv->napi)) {
1626 gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED); 1631 gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED);
1627 __netif_rx_schedule(&priv->napi); 1632 __netif_rx_schedule(&priv->napi);
1628 } 1633 }
1634
1635 spin_unlock(&priv->rxlock);
1636 spin_unlock_irqrestore(&priv->txlock, flags);
1629} 1637}
1630 1638
1631/* Interrupt Handler for Transmit complete */ 1639/* Interrupt Handler for Transmit complete */
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index ecf9798987fa..2a2fc17b2878 100644
--- a/drivers/net/ibm_newemac/mal.c
+++ b/drivers/net/ibm_newemac/mal.c
@@ -613,7 +613,9 @@ static int __devinit mal_probe(struct of_device *ofdev,
613 INIT_LIST_HEAD(&mal->list); 613 INIT_LIST_HEAD(&mal->list);
614 spin_lock_init(&mal->lock); 614 spin_lock_init(&mal->lock);
615 615
616 netif_napi_add(NULL, &mal->napi, mal_poll, 616 init_dummy_netdev(&mal->dummy_dev);
617
618 netif_napi_add(&mal->dummy_dev, &mal->napi, mal_poll,
617 CONFIG_IBM_NEW_EMAC_POLL_WEIGHT); 619 CONFIG_IBM_NEW_EMAC_POLL_WEIGHT);
618 620
619 /* Load power-on reset defaults */ 621 /* Load power-on reset defaults */
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h
index 2f0a87360844..9ededfbf0726 100644
--- a/drivers/net/ibm_newemac/mal.h
+++ b/drivers/net/ibm_newemac/mal.h
@@ -214,6 +214,8 @@ struct mal_instance {
214 int index; 214 int index;
215 spinlock_t lock; 215 spinlock_t lock;
216 216
217 struct net_device dummy_dev;
218
217 unsigned int features; 219 unsigned int features;
218}; 220};
219 221
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index ca3bb9f7321b..dfa6348ac1dc 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -602,7 +602,7 @@ static int ibmveth_open(struct net_device *netdev)
602 602
603 if(lpar_rc != H_SUCCESS) { 603 if(lpar_rc != H_SUCCESS) {
604 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); 604 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc);
605 ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", 605 ibmveth_error_printk("buffer TCE:0x%llx filter TCE:0x%llx rxq desc:0x%llx MAC:0x%llx\n",
606 adapter->buffer_list_dma, 606 adapter->buffer_list_dma,
607 adapter->filter_list_dma, 607 adapter->filter_list_dma,
608 rxq_desc.desc, 608 rxq_desc.desc,
@@ -1378,13 +1378,13 @@ static int ibmveth_show(struct seq_file *seq, void *v)
1378 seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); 1378 seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac);
1379 1379
1380 seq_printf(seq, "\nAdapter Statistics:\n"); 1380 seq_printf(seq, "\nAdapter Statistics:\n");
1381 seq_printf(seq, " TX: vio_map_single failres: %ld\n", adapter->tx_map_failed); 1381 seq_printf(seq, " TX: vio_map_single failres: %lld\n", adapter->tx_map_failed);
1382 seq_printf(seq, " send failures: %ld\n", adapter->tx_send_failed); 1382 seq_printf(seq, " send failures: %lld\n", adapter->tx_send_failed);
1383 seq_printf(seq, " RX: replenish task cycles: %ld\n", adapter->replenish_task_cycles); 1383 seq_printf(seq, " RX: replenish task cycles: %lld\n", adapter->replenish_task_cycles);
1384 seq_printf(seq, " alloc_skb_failures: %ld\n", adapter->replenish_no_mem); 1384 seq_printf(seq, " alloc_skb_failures: %lld\n", adapter->replenish_no_mem);
1385 seq_printf(seq, " add buffer failures: %ld\n", adapter->replenish_add_buff_failure); 1385 seq_printf(seq, " add buffer failures: %lld\n", adapter->replenish_add_buff_failure);
1386 seq_printf(seq, " invalid buffers: %ld\n", adapter->rx_invalid_buffer); 1386 seq_printf(seq, " invalid buffers: %lld\n", adapter->rx_invalid_buffer);
1387 seq_printf(seq, " no buffers: %ld\n", adapter->rx_no_buffer); 1387 seq_printf(seq, " no buffers: %lld\n", adapter->rx_no_buffer);
1388 1388
1389 return 0; 1389 return 0;
1390} 1390}
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 29118f58a141..3a22dc41b656 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1073,7 +1073,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1073{ 1073{
1074 unsigned int i; 1074 unsigned int i;
1075 int ret; 1075 int ret;
1076 char stir421x_fw_name[11]; 1076 char stir421x_fw_name[12];
1077 const struct firmware *fw; 1077 const struct firmware *fw;
1078 const unsigned char *fw_version_ptr; /* pointer to version string */ 1078 const unsigned char *fw_version_ptr; /* pointer to version string */
1079 unsigned long fw_version = 0; 1079 unsigned long fw_version = 0;
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index c7457f97259d..cb793c2bade2 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -429,7 +429,7 @@ SIMPLE_PORT_ATTR(promiscuous);
429SIMPLE_PORT_ATTR(num_mcast); 429SIMPLE_PORT_ATTR(num_mcast);
430CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); 430CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map);
431CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); 431CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map);
432CUSTOM_PORT_ATTR(mac_addr, "0x%lX\n", port->mac_addr); 432CUSTOM_PORT_ATTR(mac_addr, "0x%llX\n", port->mac_addr);
433 433
434#define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) 434#define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr)
435static struct attribute *veth_port_default_attrs[] = { 435static struct attribute *veth_port_default_attrs[] = {
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 4a5580c1126a..1d6e48e13366 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -84,7 +84,10 @@
84#define KORINA_NUM_RDS 64 /* number of receive descriptors */ 84#define KORINA_NUM_RDS 64 /* number of receive descriptors */
85#define KORINA_NUM_TDS 64 /* number of transmit descriptors */ 85#define KORINA_NUM_TDS 64 /* number of transmit descriptors */
86 86
87#define KORINA_RBSIZE 536 /* size of one resource buffer = Ether MTU */ 87/* KORINA_RBSIZE is the hardware's default maximum receive
88 * frame size in bytes. Having this hardcoded means that there
89 * is no support for MTU sizes greater than 1500. */
90#define KORINA_RBSIZE 1536 /* size of one resource buffer = Ether MTU */
88#define KORINA_RDS_MASK (KORINA_NUM_RDS - 1) 91#define KORINA_RDS_MASK (KORINA_NUM_RDS - 1)
89#define KORINA_TDS_MASK (KORINA_NUM_TDS - 1) 92#define KORINA_TDS_MASK (KORINA_NUM_TDS - 1)
90#define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc)) 93#define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc))
@@ -196,7 +199,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
196 struct korina_private *lp = netdev_priv(dev); 199 struct korina_private *lp = netdev_priv(dev);
197 unsigned long flags; 200 unsigned long flags;
198 u32 length; 201 u32 length;
199 u32 chain_index; 202 u32 chain_prev, chain_next;
200 struct dma_desc *td; 203 struct dma_desc *td;
201 204
202 spin_lock_irqsave(&lp->lock, flags); 205 spin_lock_irqsave(&lp->lock, flags);
@@ -228,8 +231,8 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
228 /* Setup the transmit descriptor. */ 231 /* Setup the transmit descriptor. */
229 dma_cache_inv((u32) td, sizeof(*td)); 232 dma_cache_inv((u32) td, sizeof(*td));
230 td->ca = CPHYSADDR(skb->data); 233 td->ca = CPHYSADDR(skb->data);
231 chain_index = (lp->tx_chain_tail - 1) & 234 chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
232 KORINA_TDS_MASK; 235 chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
233 236
234 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { 237 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) {
235 if (lp->tx_chain_status == desc_empty) { 238 if (lp->tx_chain_status == desc_empty) {
@@ -237,7 +240,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
237 td->control = DMA_COUNT(length) | 240 td->control = DMA_COUNT(length) |
238 DMA_DESC_COF | DMA_DESC_IOF; 241 DMA_DESC_COF | DMA_DESC_IOF;
239 /* Move tail */ 242 /* Move tail */
240 lp->tx_chain_tail = chain_index; 243 lp->tx_chain_tail = chain_next;
241 /* Write to NDPTR */ 244 /* Write to NDPTR */
242 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 245 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
243 &lp->tx_dma_regs->dmandptr); 246 &lp->tx_dma_regs->dmandptr);
@@ -248,12 +251,12 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
248 td->control = DMA_COUNT(length) | 251 td->control = DMA_COUNT(length) |
249 DMA_DESC_COF | DMA_DESC_IOF; 252 DMA_DESC_COF | DMA_DESC_IOF;
250 /* Link to prev */ 253 /* Link to prev */
251 lp->td_ring[chain_index].control &= 254 lp->td_ring[chain_prev].control &=
252 ~DMA_DESC_COF; 255 ~DMA_DESC_COF;
253 /* Link to prev */ 256 /* Link to prev */
254 lp->td_ring[chain_index].link = CPHYSADDR(td); 257 lp->td_ring[chain_prev].link = CPHYSADDR(td);
255 /* Move tail */ 258 /* Move tail */
256 lp->tx_chain_tail = chain_index; 259 lp->tx_chain_tail = chain_next;
257 /* Write to NDPTR */ 260 /* Write to NDPTR */
258 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 261 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
259 &(lp->tx_dma_regs->dmandptr)); 262 &(lp->tx_dma_regs->dmandptr));
@@ -267,17 +270,16 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
267 td->control = DMA_COUNT(length) | 270 td->control = DMA_COUNT(length) |
268 DMA_DESC_COF | DMA_DESC_IOF; 271 DMA_DESC_COF | DMA_DESC_IOF;
269 /* Move tail */ 272 /* Move tail */
270 lp->tx_chain_tail = chain_index; 273 lp->tx_chain_tail = chain_next;
271 lp->tx_chain_status = desc_filled; 274 lp->tx_chain_status = desc_filled;
272 netif_stop_queue(dev);
273 } else { 275 } else {
274 /* Update tail */ 276 /* Update tail */
275 td->control = DMA_COUNT(length) | 277 td->control = DMA_COUNT(length) |
276 DMA_DESC_COF | DMA_DESC_IOF; 278 DMA_DESC_COF | DMA_DESC_IOF;
277 lp->td_ring[chain_index].control &= 279 lp->td_ring[chain_prev].control &=
278 ~DMA_DESC_COF; 280 ~DMA_DESC_COF;
279 lp->td_ring[chain_index].link = CPHYSADDR(td); 281 lp->td_ring[chain_prev].link = CPHYSADDR(td);
280 lp->tx_chain_tail = chain_index; 282 lp->tx_chain_tail = chain_next;
281 } 283 }
282 } 284 }
283 dma_cache_wback((u32) td, sizeof(*td)); 285 dma_cache_wback((u32) td, sizeof(*td));
@@ -327,13 +329,13 @@ static irqreturn_t korina_rx_dma_interrupt(int irq, void *dev_id)
327 329
328 dmas = readl(&lp->rx_dma_regs->dmas); 330 dmas = readl(&lp->rx_dma_regs->dmas);
329 if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) { 331 if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) {
330 netif_rx_schedule_prep(&lp->napi);
331
332 dmasm = readl(&lp->rx_dma_regs->dmasm); 332 dmasm = readl(&lp->rx_dma_regs->dmasm);
333 writel(dmasm | (DMA_STAT_DONE | 333 writel(dmasm | (DMA_STAT_DONE |
334 DMA_STAT_HALT | DMA_STAT_ERR), 334 DMA_STAT_HALT | DMA_STAT_ERR),
335 &lp->rx_dma_regs->dmasm); 335 &lp->rx_dma_regs->dmasm);
336 336
337 netif_rx_schedule(&lp->napi);
338
337 if (dmas & DMA_STAT_ERR) 339 if (dmas & DMA_STAT_ERR)
338 printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name); 340 printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name);
339 341
@@ -350,15 +352,20 @@ static int korina_rx(struct net_device *dev, int limit)
350 struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; 352 struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done];
351 struct sk_buff *skb, *skb_new; 353 struct sk_buff *skb, *skb_new;
352 u8 *pkt_buf; 354 u8 *pkt_buf;
353 u32 devcs, pkt_len, dmas, rx_free_desc; 355 u32 devcs, pkt_len, dmas;
354 int count; 356 int count;
355 357
356 dma_cache_inv((u32)rd, sizeof(*rd)); 358 dma_cache_inv((u32)rd, sizeof(*rd));
357 359
358 for (count = 0; count < limit; count++) { 360 for (count = 0; count < limit; count++) {
361 skb = lp->rx_skb[lp->rx_next_done];
362 skb_new = NULL;
359 363
360 devcs = rd->devcs; 364 devcs = rd->devcs;
361 365
366 if ((KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) == 0)
367 break;
368
362 /* Update statistics counters */ 369 /* Update statistics counters */
363 if (devcs & ETH_RX_CRC) 370 if (devcs & ETH_RX_CRC)
364 dev->stats.rx_crc_errors++; 371 dev->stats.rx_crc_errors++;
@@ -381,63 +388,55 @@ static int korina_rx(struct net_device *dev, int limit)
381 * in Rc32434 (errata ref #077) */ 388 * in Rc32434 (errata ref #077) */
382 dev->stats.rx_errors++; 389 dev->stats.rx_errors++;
383 dev->stats.rx_dropped++; 390 dev->stats.rx_dropped++;
384 } 391 } else if ((devcs & ETH_RX_ROK)) {
385
386 while ((rx_free_desc = KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) != 0) {
387 /* init the var. used for the later
388 * operations within the while loop */
389 skb_new = NULL;
390 pkt_len = RCVPKT_LENGTH(devcs); 392 pkt_len = RCVPKT_LENGTH(devcs);
391 skb = lp->rx_skb[lp->rx_next_done]; 393
392 394 /* must be the (first and) last
393 if ((devcs & ETH_RX_ROK)) { 395 * descriptor then */
394 /* must be the (first and) last 396 pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data;
395 * descriptor then */ 397
396 pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; 398 /* invalidate the cache */
397 399 dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4);
398 /* invalidate the cache */ 400
399 dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4); 401 /* Malloc up new buffer. */
400 402 skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2);
401 /* Malloc up new buffer. */ 403
402 skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2); 404 if (!skb_new)
403 405 break;
404 if (!skb_new) 406 /* Do not count the CRC */
405 break; 407 skb_put(skb, pkt_len - 4);
406 /* Do not count the CRC */ 408 skb->protocol = eth_type_trans(skb, dev);
407 skb_put(skb, pkt_len - 4); 409
408 skb->protocol = eth_type_trans(skb, dev); 410 /* Pass the packet to upper layers */
409 411 netif_receive_skb(skb);
410 /* Pass the packet to upper layers */ 412 dev->stats.rx_packets++;
411 netif_receive_skb(skb); 413 dev->stats.rx_bytes += pkt_len;
412 dev->stats.rx_packets++; 414
413 dev->stats.rx_bytes += pkt_len; 415 /* Update the mcast stats */
414 416 if (devcs & ETH_RX_MP)
415 /* Update the mcast stats */ 417 dev->stats.multicast++;
416 if (devcs & ETH_RX_MP) 418
417 dev->stats.multicast++; 419 lp->rx_skb[lp->rx_next_done] = skb_new;
418
419 lp->rx_skb[lp->rx_next_done] = skb_new;
420 }
421
422 rd->devcs = 0;
423
424 /* Restore descriptor's curr_addr */
425 if (skb_new)
426 rd->ca = CPHYSADDR(skb_new->data);
427 else
428 rd->ca = CPHYSADDR(skb->data);
429
430 rd->control = DMA_COUNT(KORINA_RBSIZE) |
431 DMA_DESC_COD | DMA_DESC_IOD;
432 lp->rd_ring[(lp->rx_next_done - 1) &
433 KORINA_RDS_MASK].control &=
434 ~DMA_DESC_COD;
435
436 lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK;
437 dma_cache_wback((u32)rd, sizeof(*rd));
438 rd = &lp->rd_ring[lp->rx_next_done];
439 writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas);
440 } 420 }
421
422 rd->devcs = 0;
423
424 /* Restore descriptor's curr_addr */
425 if (skb_new)
426 rd->ca = CPHYSADDR(skb_new->data);
427 else
428 rd->ca = CPHYSADDR(skb->data);
429
430 rd->control = DMA_COUNT(KORINA_RBSIZE) |
431 DMA_DESC_COD | DMA_DESC_IOD;
432 lp->rd_ring[(lp->rx_next_done - 1) &
433 KORINA_RDS_MASK].control &=
434 ~DMA_DESC_COD;
435
436 lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK;
437 dma_cache_wback((u32)rd, sizeof(*rd));
438 rd = &lp->rd_ring[lp->rx_next_done];
439 writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas);
441 } 440 }
442 441
443 dmas = readl(&lp->rx_dma_regs->dmas); 442 dmas = readl(&lp->rx_dma_regs->dmas);
@@ -623,12 +622,12 @@ korina_tx_dma_interrupt(int irq, void *dev_id)
623 dmas = readl(&lp->tx_dma_regs->dmas); 622 dmas = readl(&lp->tx_dma_regs->dmas);
624 623
625 if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) { 624 if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) {
626 korina_tx(dev);
627
628 dmasm = readl(&lp->tx_dma_regs->dmasm); 625 dmasm = readl(&lp->tx_dma_regs->dmasm);
629 writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR), 626 writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR),
630 &lp->tx_dma_regs->dmasm); 627 &lp->tx_dma_regs->dmasm);
631 628
629 korina_tx(dev);
630
632 if (lp->tx_chain_status == desc_filled && 631 if (lp->tx_chain_status == desc_filled &&
633 (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { 632 (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) {
634 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 633 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
@@ -901,6 +900,8 @@ static int korina_restart(struct net_device *dev)
901 900
902 korina_free_ring(dev); 901 korina_free_ring(dev);
903 902
903 napi_disable(&lp->napi);
904
904 ret = korina_init(dev); 905 ret = korina_init(dev);
905 if (ret < 0) { 906 if (ret < 0) {
906 printk(KERN_ERR DRV_NAME "%s: cannot restart device\n", 907 printk(KERN_ERR DRV_NAME "%s: cannot restart device\n",
@@ -999,14 +1000,14 @@ static int korina_open(struct net_device *dev)
999 * that handles the Done Finished 1000 * that handles the Done Finished
1000 * Ovr and Und Events */ 1001 * Ovr and Und Events */
1001 ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, 1002 ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt,
1002 IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Rx", dev); 1003 IRQF_DISABLED, "Korina ethernet Rx", dev);
1003 if (ret < 0) { 1004 if (ret < 0) {
1004 printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n", 1005 printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n",
1005 dev->name, lp->rx_irq); 1006 dev->name, lp->rx_irq);
1006 goto err_release; 1007 goto err_release;
1007 } 1008 }
1008 ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, 1009 ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt,
1009 IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Tx", dev); 1010 IRQF_DISABLED, "Korina ethernet Tx", dev);
1010 if (ret < 0) { 1011 if (ret < 0) {
1011 printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n", 1012 printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n",
1012 dev->name, lp->tx_irq); 1013 dev->name, lp->tx_irq);
@@ -1015,7 +1016,7 @@ static int korina_open(struct net_device *dev)
1015 1016
1016 /* Install handler for overrun error. */ 1017 /* Install handler for overrun error. */
1017 ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, 1018 ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt,
1018 IRQF_SHARED | IRQF_DISABLED, "Ethernet Overflow", dev); 1019 IRQF_DISABLED, "Ethernet Overflow", dev);
1019 if (ret < 0) { 1020 if (ret < 0) {
1020 printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n", 1021 printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n",
1021 dev->name, lp->ovr_irq); 1022 dev->name, lp->ovr_irq);
@@ -1024,7 +1025,7 @@ static int korina_open(struct net_device *dev)
1024 1025
1025 /* Install handler for underflow error. */ 1026 /* Install handler for underflow error. */
1026 ret = request_irq(lp->und_irq, &korina_und_interrupt, 1027 ret = request_irq(lp->und_irq, &korina_und_interrupt,
1027 IRQF_SHARED | IRQF_DISABLED, "Ethernet Underflow", dev); 1028 IRQF_DISABLED, "Ethernet Underflow", dev);
1028 if (ret < 0) { 1029 if (ret < 0) {
1029 printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n", 1030 printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n",
1030 dev->name, lp->und_irq); 1031 dev->name, lp->und_irq);
@@ -1067,6 +1068,8 @@ static int korina_close(struct net_device *dev)
1067 1068
1068 korina_free_ring(dev); 1069 korina_free_ring(dev);
1069 1070
1071 napi_disable(&lp->napi);
1072
1070 free_irq(lp->rx_irq, dev); 1073 free_irq(lp->rx_irq, dev);
1071 free_irq(lp->tx_irq, dev); 1074 free_irq(lp->tx_irq, dev);
1072 free_irq(lp->ovr_irq, dev); 1075 free_irq(lp->ovr_irq, dev);
@@ -1089,7 +1092,6 @@ static int korina_probe(struct platform_device *pdev)
1089 return -ENOMEM; 1092 return -ENOMEM;
1090 } 1093 }
1091 SET_NETDEV_DEV(dev, &pdev->dev); 1094 SET_NETDEV_DEV(dev, &pdev->dev);
1092 platform_set_drvdata(pdev, dev);
1093 lp = netdev_priv(dev); 1095 lp = netdev_priv(dev);
1094 1096
1095 bif->dev = dev; 1097 bif->dev = dev;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index f8e601c51da7..c11c568fd7db 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -308,27 +308,16 @@ struct netxen_ring_ctx {
308#define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ 308#define netxen_set_cmd_desc_ctxid(cmd_desc, var) \
309 ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) 309 ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0))
310 310
311#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 311#define netxen_set_tx_port(_desc, _port) \
312 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ 312 (_desc)->port_ctxid = ((_port) & 0xf) | (((_port) << 4) & 0xf0)
313 ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) 313
314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 314#define netxen_set_tx_flags_opcode(_desc, _flags, _opcode) \
315 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ 315 (_desc)->flags_opcode = \
316 ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) 316 cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7))
317 317
318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 318#define netxen_set_tx_frags_len(_desc, _frags, _len) \
319 (cmd_desc)->num_of_buffers_total_length = \ 319 (_desc)->num_of_buffers_total_length = \
320 ((cmd_desc)->num_of_buffers_total_length & \ 320 cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8))
321 ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
322#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
323 (cmd_desc)->num_of_buffers_total_length = \
324 ((cmd_desc)->num_of_buffers_total_length & \
325 ~cpu_to_le32((u32)0xffffff << 8)) | \
326 cpu_to_le32(((val) & 0xffffff) << 8)
327
328#define netxen_get_cmd_desc_opcode(cmd_desc) \
329 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
330#define netxen_get_cmd_desc_totallength(cmd_desc) \
331 ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
332 321
333struct cmd_desc_type0 { 322struct cmd_desc_type0 {
334 u8 tcp_hdr_offset; /* For LSO only */ 323 u8 tcp_hdr_offset; /* For LSO only */
@@ -510,7 +499,8 @@ typedef enum {
510 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, 499 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a,
511 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, 500 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b,
512 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, 501 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031,
513 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032 502 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032,
503 NETXEN_BRDTYPE_P3_10G_TP = 0x0080
514 504
515} netxen_brdtype_t; 505} netxen_brdtype_t;
516 506
@@ -757,7 +747,7 @@ extern char netxen_nic_driver_name[];
757 */ 747 */
758struct netxen_skb_frag { 748struct netxen_skb_frag {
759 u64 dma; 749 u64 dma;
760 u32 length; 750 ulong length;
761}; 751};
762 752
763#define _netxen_set_bits(config_word, start, bits, val) {\ 753#define _netxen_set_bits(config_word, start, bits, val) {\
@@ -783,13 +773,7 @@ struct netxen_skb_frag {
783struct netxen_cmd_buffer { 773struct netxen_cmd_buffer {
784 struct sk_buff *skb; 774 struct sk_buff *skb;
785 struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; 775 struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1];
786 u32 total_length; 776 u32 frag_count;
787 u32 mss;
788 u16 port;
789 u8 cmd;
790 u8 frag_count;
791 unsigned long time_stamp;
792 u32 state;
793}; 777};
794 778
795/* In rx_buffer, we do not need multiple fragments as is a single buffer */ 779/* In rx_buffer, we do not need multiple fragments as is a single buffer */
@@ -876,7 +860,6 @@ struct nx_host_rds_ring {
876 u32 skb_size; 860 u32 skb_size;
877 struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ 861 struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */
878 struct list_head free_list; 862 struct list_head free_list;
879 int begin_alloc;
880}; 863};
881 864
882/* 865/*
@@ -995,31 +978,31 @@ struct netxen_recv_context {
995 */ 978 */
996 979
997typedef struct { 980typedef struct {
998 u64 host_phys_addr; /* Ring base addr */ 981 __le64 host_phys_addr; /* Ring base addr */
999 u32 ring_size; /* Ring entries */ 982 __le32 ring_size; /* Ring entries */
1000 u16 msi_index; 983 __le16 msi_index;
1001 u16 rsvd; /* Padding */ 984 __le16 rsvd; /* Padding */
1002} nx_hostrq_sds_ring_t; 985} nx_hostrq_sds_ring_t;
1003 986
1004typedef struct { 987typedef struct {
1005 u64 host_phys_addr; /* Ring base addr */ 988 __le64 host_phys_addr; /* Ring base addr */
1006 u64 buff_size; /* Packet buffer size */ 989 __le64 buff_size; /* Packet buffer size */
1007 u32 ring_size; /* Ring entries */ 990 __le32 ring_size; /* Ring entries */
1008 u32 ring_kind; /* Class of ring */ 991 __le32 ring_kind; /* Class of ring */
1009} nx_hostrq_rds_ring_t; 992} nx_hostrq_rds_ring_t;
1010 993
1011typedef struct { 994typedef struct {
1012 u64 host_rsp_dma_addr; /* Response dma'd here */ 995 __le64 host_rsp_dma_addr; /* Response dma'd here */
1013 u32 capabilities[4]; /* Flag bit vector */ 996 __le32 capabilities[4]; /* Flag bit vector */
1014 u32 host_int_crb_mode; /* Interrupt crb usage */ 997 __le32 host_int_crb_mode; /* Interrupt crb usage */
1015 u32 host_rds_crb_mode; /* RDS crb usage */ 998 __le32 host_rds_crb_mode; /* RDS crb usage */
1016 /* These ring offsets are relative to data[0] below */ 999 /* These ring offsets are relative to data[0] below */
1017 u32 rds_ring_offset; /* Offset to RDS config */ 1000 __le32 rds_ring_offset; /* Offset to RDS config */
1018 u32 sds_ring_offset; /* Offset to SDS config */ 1001 __le32 sds_ring_offset; /* Offset to SDS config */
1019 u16 num_rds_rings; /* Count of RDS rings */ 1002 __le16 num_rds_rings; /* Count of RDS rings */
1020 u16 num_sds_rings; /* Count of SDS rings */ 1003 __le16 num_sds_rings; /* Count of SDS rings */
1021 u16 rsvd1; /* Padding */ 1004 __le16 rsvd1; /* Padding */
1022 u16 rsvd2; /* Padding */ 1005 __le16 rsvd2; /* Padding */
1023 u8 reserved[128]; /* reserve space for future expansion*/ 1006 u8 reserved[128]; /* reserve space for future expansion*/
1024 /* MUST BE 64-bit aligned. 1007 /* MUST BE 64-bit aligned.
1025 The following is packed: 1008 The following is packed:
@@ -1029,24 +1012,24 @@ typedef struct {
1029} nx_hostrq_rx_ctx_t; 1012} nx_hostrq_rx_ctx_t;
1030 1013
1031typedef struct { 1014typedef struct {
1032 u32 host_producer_crb; /* Crb to use */ 1015 __le32 host_producer_crb; /* Crb to use */
1033 u32 rsvd1; /* Padding */ 1016 __le32 rsvd1; /* Padding */
1034} nx_cardrsp_rds_ring_t; 1017} nx_cardrsp_rds_ring_t;
1035 1018
1036typedef struct { 1019typedef struct {
1037 u32 host_consumer_crb; /* Crb to use */ 1020 __le32 host_consumer_crb; /* Crb to use */
1038 u32 interrupt_crb; /* Crb to use */ 1021 __le32 interrupt_crb; /* Crb to use */
1039} nx_cardrsp_sds_ring_t; 1022} nx_cardrsp_sds_ring_t;
1040 1023
1041typedef struct { 1024typedef struct {
1042 /* These ring offsets are relative to data[0] below */ 1025 /* These ring offsets are relative to data[0] below */
1043 u32 rds_ring_offset; /* Offset to RDS config */ 1026 __le32 rds_ring_offset; /* Offset to RDS config */
1044 u32 sds_ring_offset; /* Offset to SDS config */ 1027 __le32 sds_ring_offset; /* Offset to SDS config */
1045 u32 host_ctx_state; /* Starting State */ 1028 __le32 host_ctx_state; /* Starting State */
1046 u32 num_fn_per_port; /* How many PCI fn share the port */ 1029 __le32 num_fn_per_port; /* How many PCI fn share the port */
1047 u16 num_rds_rings; /* Count of RDS rings */ 1030 __le16 num_rds_rings; /* Count of RDS rings */
1048 u16 num_sds_rings; /* Count of SDS rings */ 1031 __le16 num_sds_rings; /* Count of SDS rings */
1049 u16 context_id; /* Handle for context */ 1032 __le16 context_id; /* Handle for context */
1050 u8 phys_port; /* Physical id of port */ 1033 u8 phys_port; /* Physical id of port */
1051 u8 virt_port; /* Virtual/Logical id of port */ 1034 u8 virt_port; /* Virtual/Logical id of port */
1052 u8 reserved[128]; /* save space for future expansion */ 1035 u8 reserved[128]; /* save space for future expansion */
@@ -1072,34 +1055,34 @@ typedef struct {
1072 */ 1055 */
1073 1056
1074typedef struct { 1057typedef struct {
1075 u64 host_phys_addr; /* Ring base addr */ 1058 __le64 host_phys_addr; /* Ring base addr */
1076 u32 ring_size; /* Ring entries */ 1059 __le32 ring_size; /* Ring entries */
1077 u32 rsvd; /* Padding */ 1060 __le32 rsvd; /* Padding */
1078} nx_hostrq_cds_ring_t; 1061} nx_hostrq_cds_ring_t;
1079 1062
1080typedef struct { 1063typedef struct {
1081 u64 host_rsp_dma_addr; /* Response dma'd here */ 1064 __le64 host_rsp_dma_addr; /* Response dma'd here */
1082 u64 cmd_cons_dma_addr; /* */ 1065 __le64 cmd_cons_dma_addr; /* */
1083 u64 dummy_dma_addr; /* */ 1066 __le64 dummy_dma_addr; /* */
1084 u32 capabilities[4]; /* Flag bit vector */ 1067 __le32 capabilities[4]; /* Flag bit vector */
1085 u32 host_int_crb_mode; /* Interrupt crb usage */ 1068 __le32 host_int_crb_mode; /* Interrupt crb usage */
1086 u32 rsvd1; /* Padding */ 1069 __le32 rsvd1; /* Padding */
1087 u16 rsvd2; /* Padding */ 1070 __le16 rsvd2; /* Padding */
1088 u16 interrupt_ctl; 1071 __le16 interrupt_ctl;
1089 u16 msi_index; 1072 __le16 msi_index;
1090 u16 rsvd3; /* Padding */ 1073 __le16 rsvd3; /* Padding */
1091 nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ 1074 nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */
1092 u8 reserved[128]; /* future expansion */ 1075 u8 reserved[128]; /* future expansion */
1093} nx_hostrq_tx_ctx_t; 1076} nx_hostrq_tx_ctx_t;
1094 1077
1095typedef struct { 1078typedef struct {
1096 u32 host_producer_crb; /* Crb to use */ 1079 __le32 host_producer_crb; /* Crb to use */
1097 u32 interrupt_crb; /* Crb to use */ 1080 __le32 interrupt_crb; /* Crb to use */
1098} nx_cardrsp_cds_ring_t; 1081} nx_cardrsp_cds_ring_t;
1099 1082
1100typedef struct { 1083typedef struct {
1101 u32 host_ctx_state; /* Starting state */ 1084 __le32 host_ctx_state; /* Starting state */
1102 u16 context_id; /* Handle for context */ 1085 __le16 context_id; /* Handle for context */
1103 u8 phys_port; /* Physical id of port */ 1086 u8 phys_port; /* Physical id of port */
1104 u8 virt_port; /* Virtual/Logical id of port */ 1087 u8 virt_port; /* Virtual/Logical id of port */
1105 nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ 1088 nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */
@@ -1202,9 +1185,9 @@ enum {
1202#define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ 1185#define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */
1203 1186
1204typedef struct { 1187typedef struct {
1205 u64 qhdr; 1188 __le64 qhdr;
1206 u64 req_hdr; 1189 __le64 req_hdr;
1207 u64 words[6]; 1190 __le64 words[6];
1208} nx_nic_req_t; 1191} nx_nic_req_t;
1209 1192
1210typedef struct { 1193typedef struct {
@@ -1486,8 +1469,6 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter);
1486 1469
1487void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); 1470void netxen_initialize_adapter_ops(struct netxen_adapter *adapter);
1488int netxen_init_firmware(struct netxen_adapter *adapter); 1471int netxen_init_firmware(struct netxen_adapter *adapter);
1489void netxen_tso_check(struct netxen_adapter *adapter,
1490 struct cmd_desc_type0 *desc, struct sk_buff *skb);
1491void netxen_nic_clear_stats(struct netxen_adapter *adapter); 1472void netxen_nic_clear_stats(struct netxen_adapter *adapter);
1492void netxen_watchdog_task(struct work_struct *work); 1473void netxen_watchdog_task(struct work_struct *work);
1493void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, 1474void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx,
@@ -1496,6 +1477,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter);
1496u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); 1477u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max);
1497void netxen_p2_nic_set_multi(struct net_device *netdev); 1478void netxen_p2_nic_set_multi(struct net_device *netdev);
1498void netxen_p3_nic_set_multi(struct net_device *netdev); 1479void netxen_p3_nic_set_multi(struct net_device *netdev);
1480void netxen_p3_free_mac_list(struct netxen_adapter *adapter);
1499int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); 1481int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32);
1500int netxen_config_intr_coalesce(struct netxen_adapter *adapter); 1482int netxen_config_intr_coalesce(struct netxen_adapter *adapter);
1501 1483
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 64b51643c626..746bdb470418 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -76,7 +76,7 @@ netxen_api_unlock(struct netxen_adapter *adapter)
76static u32 76static u32
77netxen_poll_rsp(struct netxen_adapter *adapter) 77netxen_poll_rsp(struct netxen_adapter *adapter)
78{ 78{
79 u32 raw_rsp, rsp = NX_CDRP_RSP_OK; 79 u32 rsp = NX_CDRP_RSP_OK;
80 int timeout = 0; 80 int timeout = 0;
81 81
82 do { 82 do {
@@ -86,10 +86,7 @@ netxen_poll_rsp(struct netxen_adapter *adapter)
86 if (++timeout > NX_OS_CRB_RETRY_COUNT) 86 if (++timeout > NX_OS_CRB_RETRY_COUNT)
87 return NX_CDRP_RSP_TIMEOUT; 87 return NX_CDRP_RSP_TIMEOUT;
88 88
89 netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, 89 netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, &rsp);
90 &raw_rsp);
91
92 rsp = le32_to_cpu(raw_rsp);
93 } while (!NX_CDRP_IS_RSP(rsp)); 90 } while (!NX_CDRP_IS_RSP(rsp));
94 91
95 return rsp; 92 return rsp;
@@ -109,20 +106,16 @@ netxen_issue_cmd(struct netxen_adapter *adapter,
109 if (netxen_api_lock(adapter)) 106 if (netxen_api_lock(adapter))
110 return NX_RCODE_TIMEOUT; 107 return NX_RCODE_TIMEOUT;
111 108
112 netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, 109 netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, signature);
113 cpu_to_le32(signature));
114 110
115 netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, 111 netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, arg1);
116 cpu_to_le32(arg1));
117 112
118 netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, 113 netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, arg2);
119 cpu_to_le32(arg2));
120 114
121 netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, 115 netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, arg3);
122 cpu_to_le32(arg3));
123 116
124 netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, 117 netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET,
125 cpu_to_le32(NX_CDRP_FORM_CMD(cmd))); 118 NX_CDRP_FORM_CMD(cmd));
126 119
127 rsp = netxen_poll_rsp(adapter); 120 rsp = netxen_poll_rsp(adapter);
128 121
@@ -133,7 +126,6 @@ netxen_issue_cmd(struct netxen_adapter *adapter,
133 rcode = NX_RCODE_TIMEOUT; 126 rcode = NX_RCODE_TIMEOUT;
134 } else if (rsp == NX_CDRP_RSP_FAIL) { 127 } else if (rsp == NX_CDRP_RSP_FAIL) {
135 netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); 128 netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode);
136 rcode = le32_to_cpu(rcode);
137 129
138 printk(KERN_ERR "%s: failed card response code:0x%x\n", 130 printk(KERN_ERR "%s: failed card response code:0x%x\n",
139 netxen_nic_driver_name, rcode); 131 netxen_nic_driver_name, rcode);
@@ -183,7 +175,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
183 175
184 int i, nrds_rings, nsds_rings; 176 int i, nrds_rings, nsds_rings;
185 size_t rq_size, rsp_size; 177 size_t rq_size, rsp_size;
186 u32 cap, reg; 178 u32 cap, reg, val;
187 179
188 int err; 180 int err;
189 181
@@ -225,11 +217,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
225 217
226 prq->num_rds_rings = cpu_to_le16(nrds_rings); 218 prq->num_rds_rings = cpu_to_le16(nrds_rings);
227 prq->num_sds_rings = cpu_to_le16(nsds_rings); 219 prq->num_sds_rings = cpu_to_le16(nsds_rings);
228 prq->rds_ring_offset = 0; 220 prq->rds_ring_offset = cpu_to_le32(0);
229 prq->sds_ring_offset = prq->rds_ring_offset + 221
222 val = le32_to_cpu(prq->rds_ring_offset) +
230 (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); 223 (sizeof(nx_hostrq_rds_ring_t) * nrds_rings);
224 prq->sds_ring_offset = cpu_to_le32(val);
231 225
232 prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + prq->rds_ring_offset); 226 prq_rds = (nx_hostrq_rds_ring_t *)(prq->data +
227 le32_to_cpu(prq->rds_ring_offset));
233 228
234 for (i = 0; i < nrds_rings; i++) { 229 for (i = 0; i < nrds_rings; i++) {
235 230
@@ -241,17 +236,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
241 prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); 236 prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size);
242 } 237 }
243 238
244 prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + prq->sds_ring_offset); 239 prq_sds = (nx_hostrq_sds_ring_t *)(prq->data +
240 le32_to_cpu(prq->sds_ring_offset));
245 241
246 prq_sds[0].host_phys_addr = 242 prq_sds[0].host_phys_addr =
247 cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); 243 cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr);
248 prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); 244 prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count);
249 /* only one msix vector for now */ 245 /* only one msix vector for now */
250 prq_sds[0].msi_index = cpu_to_le32(0); 246 prq_sds[0].msi_index = cpu_to_le16(0);
251
252 /* now byteswap offsets */
253 prq->rds_ring_offset = cpu_to_le32(prq->rds_ring_offset);
254 prq->sds_ring_offset = cpu_to_le32(prq->sds_ring_offset);
255 247
256 phys_addr = hostrq_phys_addr; 248 phys_addr = hostrq_phys_addr;
257 err = netxen_issue_cmd(adapter, 249 err = netxen_issue_cmd(adapter,
@@ -269,9 +261,9 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
269 261
270 262
271 prsp_rds = ((nx_cardrsp_rds_ring_t *) 263 prsp_rds = ((nx_cardrsp_rds_ring_t *)
272 &prsp->data[prsp->rds_ring_offset]); 264 &prsp->data[le32_to_cpu(prsp->rds_ring_offset)]);
273 265
274 for (i = 0; i < le32_to_cpu(prsp->num_rds_rings); i++) { 266 for (i = 0; i < le16_to_cpu(prsp->num_rds_rings); i++) {
275 rds_ring = &recv_ctx->rds_rings[i]; 267 rds_ring = &recv_ctx->rds_rings[i];
276 268
277 reg = le32_to_cpu(prsp_rds[i].host_producer_crb); 269 reg = le32_to_cpu(prsp_rds[i].host_producer_crb);
@@ -279,7 +271,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
279 } 271 }
280 272
281 prsp_sds = ((nx_cardrsp_sds_ring_t *) 273 prsp_sds = ((nx_cardrsp_sds_ring_t *)
282 &prsp->data[prsp->sds_ring_offset]); 274 &prsp->data[le32_to_cpu(prsp->sds_ring_offset)]);
283 reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); 275 reg = le32_to_cpu(prsp_sds[0].host_consumer_crb);
284 recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); 276 recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200);
285 277
@@ -288,7 +280,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
288 280
289 recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); 281 recv_ctx->state = le32_to_cpu(prsp->host_ctx_state);
290 recv_ctx->context_id = le16_to_cpu(prsp->context_id); 282 recv_ctx->context_id = le16_to_cpu(prsp->context_id);
291 recv_ctx->virt_port = le16_to_cpu(prsp->virt_port); 283 recv_ctx->virt_port = prsp->virt_port;
292 284
293out_free_rsp: 285out_free_rsp:
294 pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); 286 pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index e45ce2951729..c0bd40fcf708 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -136,11 +136,9 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
136 136
137 ecmd->port = PORT_TP; 137 ecmd->port = PORT_TP;
138 138
139 if (netif_running(dev)) { 139 ecmd->speed = adapter->link_speed;
140 ecmd->speed = adapter->link_speed; 140 ecmd->duplex = adapter->link_duplex;
141 ecmd->duplex = adapter->link_duplex; 141 ecmd->autoneg = adapter->link_autoneg;
142 ecmd->autoneg = adapter->link_autoneg;
143 }
144 142
145 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 143 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
146 u32 val; 144 u32 val;
@@ -171,7 +169,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
171 } else 169 } else
172 return -EIO; 170 return -EIO;
173 171
174 ecmd->phy_address = adapter->portnum; 172 ecmd->phy_address = adapter->physical_port;
175 ecmd->transceiver = XCVR_EXTERNAL; 173 ecmd->transceiver = XCVR_EXTERNAL;
176 174
177 switch ((netxen_brdtype_t) boardinfo->board_type) { 175 switch ((netxen_brdtype_t) boardinfo->board_type) {
@@ -180,13 +178,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
180 case NETXEN_BRDTYPE_P3_REF_QG: 178 case NETXEN_BRDTYPE_P3_REF_QG:
181 case NETXEN_BRDTYPE_P3_4_GB: 179 case NETXEN_BRDTYPE_P3_4_GB:
182 case NETXEN_BRDTYPE_P3_4_GB_MM: 180 case NETXEN_BRDTYPE_P3_4_GB_MM:
183 case NETXEN_BRDTYPE_P3_10000_BASE_T:
184 181
185 ecmd->supported |= SUPPORTED_Autoneg; 182 ecmd->supported |= SUPPORTED_Autoneg;
186 ecmd->advertising |= ADVERTISED_Autoneg; 183 ecmd->advertising |= ADVERTISED_Autoneg;
187 case NETXEN_BRDTYPE_P2_SB31_10G_CX4: 184 case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
188 case NETXEN_BRDTYPE_P3_10G_CX4: 185 case NETXEN_BRDTYPE_P3_10G_CX4:
189 case NETXEN_BRDTYPE_P3_10G_CX4_LP: 186 case NETXEN_BRDTYPE_P3_10G_CX4_LP:
187 case NETXEN_BRDTYPE_P3_10000_BASE_T:
190 ecmd->supported |= SUPPORTED_TP; 188 ecmd->supported |= SUPPORTED_TP;
191 ecmd->advertising |= ADVERTISED_TP; 189 ecmd->advertising |= ADVERTISED_TP;
192 ecmd->port = PORT_TP; 190 ecmd->port = PORT_TP;
@@ -204,16 +202,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
204 ecmd->port = PORT_FIBRE; 202 ecmd->port = PORT_FIBRE;
205 ecmd->autoneg = AUTONEG_DISABLE; 203 ecmd->autoneg = AUTONEG_DISABLE;
206 break; 204 break;
207 case NETXEN_BRDTYPE_P2_SB31_10G:
208 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: 205 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS:
209 case NETXEN_BRDTYPE_P3_10G_SFP_CT: 206 case NETXEN_BRDTYPE_P3_10G_SFP_CT:
210 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 207 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
208 ecmd->advertising |= ADVERTISED_TP;
209 ecmd->supported |= SUPPORTED_TP;
210 case NETXEN_BRDTYPE_P2_SB31_10G:
211 case NETXEN_BRDTYPE_P3_10G_XFP: 211 case NETXEN_BRDTYPE_P3_10G_XFP:
212 ecmd->supported |= SUPPORTED_FIBRE; 212 ecmd->supported |= SUPPORTED_FIBRE;
213 ecmd->advertising |= ADVERTISED_FIBRE; 213 ecmd->advertising |= ADVERTISED_FIBRE;
214 ecmd->port = PORT_FIBRE; 214 ecmd->port = PORT_FIBRE;
215 ecmd->autoneg = AUTONEG_DISABLE; 215 ecmd->autoneg = AUTONEG_DISABLE;
216 break; 216 break;
217 case NETXEN_BRDTYPE_P3_10G_TP:
218 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
219 ecmd->autoneg = AUTONEG_DISABLE;
220 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
221 ecmd->advertising |=
222 (ADVERTISED_FIBRE | ADVERTISED_TP);
223 ecmd->port = PORT_FIBRE;
224 } else {
225 ecmd->autoneg = AUTONEG_ENABLE;
226 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
227 ecmd->advertising |=
228 (ADVERTISED_TP | ADVERTISED_Autoneg);
229 ecmd->port = PORT_TP;
230 }
231 break;
217 default: 232 default:
218 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", 233 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
219 (netxen_brdtype_t) boardinfo->board_type); 234 (netxen_brdtype_t) boardinfo->board_type);
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index aa6e603bfcbf..821cff68b3f3 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -503,17 +503,15 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
503 503
504 i = 0; 504 i = 0;
505 505
506 netif_tx_lock_bh(adapter->netdev);
507
506 producer = adapter->cmd_producer; 508 producer = adapter->cmd_producer;
507 do { 509 do {
508 cmd_desc = &cmd_desc_arr[i]; 510 cmd_desc = &cmd_desc_arr[i];
509 511
510 pbuf = &adapter->cmd_buf_arr[producer]; 512 pbuf = &adapter->cmd_buf_arr[producer];
511 pbuf->mss = 0;
512 pbuf->total_length = 0;
513 pbuf->skb = NULL; 513 pbuf->skb = NULL;
514 pbuf->cmd = 0;
515 pbuf->frag_count = 0; 514 pbuf->frag_count = 0;
516 pbuf->port = 0;
517 515
518 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ 516 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */
519 memcpy(&adapter->ahw.cmd_desc_head[producer], 517 memcpy(&adapter->ahw.cmd_desc_head[producer],
@@ -531,6 +529,8 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
531 529
532 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); 530 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer);
533 531
532 netif_tx_unlock_bh(adapter->netdev);
533
534 return 0; 534 return 0;
535} 535}
536 536
@@ -539,16 +539,19 @@ static int nx_p3_sre_macaddr_change(struct net_device *dev,
539{ 539{
540 struct netxen_adapter *adapter = netdev_priv(dev); 540 struct netxen_adapter *adapter = netdev_priv(dev);
541 nx_nic_req_t req; 541 nx_nic_req_t req;
542 nx_mac_req_t mac_req; 542 nx_mac_req_t *mac_req;
543 u64 word;
543 int rv; 544 int rv;
544 545
545 memset(&req, 0, sizeof(nx_nic_req_t)); 546 memset(&req, 0, sizeof(nx_nic_req_t));
546 req.qhdr |= (NX_NIC_REQUEST << 23); 547 req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
547 req.req_hdr |= NX_MAC_EVENT; 548
548 req.req_hdr |= ((u64)adapter->portnum << 16); 549 word = NX_MAC_EVENT | ((u64)adapter->portnum << 16);
549 mac_req.op = op; 550 req.req_hdr = cpu_to_le64(word);
550 memcpy(&mac_req.mac_addr, addr, 6); 551
551 req.words[0] = cpu_to_le64(*(u64 *)&mac_req); 552 mac_req = (nx_mac_req_t *)&req.words[0];
553 mac_req->op = op;
554 memcpy(mac_req->mac_addr, addr, 6);
552 555
553 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); 556 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
554 if (rv != 0) { 557 if (rv != 0) {
@@ -612,18 +615,35 @@ send_fw_cmd:
612int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) 615int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
613{ 616{
614 nx_nic_req_t req; 617 nx_nic_req_t req;
618 u64 word;
615 619
616 memset(&req, 0, sizeof(nx_nic_req_t)); 620 memset(&req, 0, sizeof(nx_nic_req_t));
617 621
618 req.qhdr |= (NX_HOST_REQUEST << 23); 622 req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
619 req.req_hdr |= NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE; 623
620 req.req_hdr |= ((u64)adapter->portnum << 16); 624 word = NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE |
625 ((u64)adapter->portnum << 16);
626 req.req_hdr = cpu_to_le64(word);
627
621 req.words[0] = cpu_to_le64(mode); 628 req.words[0] = cpu_to_le64(mode);
622 629
623 return netxen_send_cmd_descs(adapter, 630 return netxen_send_cmd_descs(adapter,
624 (struct cmd_desc_type0 *)&req, 1); 631 (struct cmd_desc_type0 *)&req, 1);
625} 632}
626 633
634void netxen_p3_free_mac_list(struct netxen_adapter *adapter)
635{
636 nx_mac_list_t *cur, *next;
637
638 cur = adapter->mac_list;
639
640 while (cur) {
641 next = cur->next;
642 kfree(cur);
643 cur = next;
644 }
645}
646
627#define NETXEN_CONFIG_INTR_COALESCE 3 647#define NETXEN_CONFIG_INTR_COALESCE 3
628 648
629/* 649/*
@@ -632,13 +652,15 @@ int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
632int netxen_config_intr_coalesce(struct netxen_adapter *adapter) 652int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
633{ 653{
634 nx_nic_req_t req; 654 nx_nic_req_t req;
655 u64 word;
635 int rv; 656 int rv;
636 657
637 memset(&req, 0, sizeof(nx_nic_req_t)); 658 memset(&req, 0, sizeof(nx_nic_req_t));
638 659
639 req.qhdr |= (NX_NIC_REQUEST << 23); 660 req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
640 req.req_hdr |= NETXEN_CONFIG_INTR_COALESCE; 661
641 req.req_hdr |= ((u64)adapter->portnum << 16); 662 word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16);
663 req.req_hdr = cpu_to_le64(word);
642 664
643 memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); 665 memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal));
644 666
@@ -772,13 +794,10 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac)
772 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); 794 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4);
773 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); 795 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4);
774 796
775 mac_hi = cpu_to_le32(mac_hi);
776 mac_lo = cpu_to_le32(mac_lo);
777
778 if (pci_func & 1) 797 if (pci_func & 1)
779 *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); 798 *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16));
780 else 799 else
781 *mac = ((mac_lo) | ((u64)mac_hi << 32)); 800 *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32));
782 801
783 return 0; 802 return 0;
784} 803}
@@ -937,7 +956,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter)
937{ 956{
938 int i; 957 int i;
939 u32 data, size = 0; 958 u32 data, size = 0;
940 u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; 959 u32 flashaddr = NETXEN_BOOTLD_START;
941 960
942 size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; 961 size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4;
943 962
@@ -949,10 +968,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter)
949 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) 968 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0)
950 return -EIO; 969 return -EIO;
951 970
952 adapter->pci_mem_write(adapter, memaddr, &data, 4); 971 adapter->pci_mem_write(adapter, flashaddr, &data, 4);
953 flashaddr += 4; 972 flashaddr += 4;
954 memaddr += 4;
955 cond_resched();
956 } 973 }
957 msleep(1); 974 msleep(1);
958 975
@@ -2034,7 +2051,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2034 rv = -1; 2051 rv = -1;
2035 } 2052 }
2036 2053
2037 DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); 2054 if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) {
2055 u32 gpio = netxen_nic_reg_read(adapter,
2056 NETXEN_ROMUSB_GLB_PAD_GPIO_I);
2057 if ((gpio & 0x8000) == 0)
2058 boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP;
2059 }
2060
2038 switch ((netxen_brdtype_t) boardinfo->board_type) { 2061 switch ((netxen_brdtype_t) boardinfo->board_type) {
2039 case NETXEN_BRDTYPE_P2_SB35_4G: 2062 case NETXEN_BRDTYPE_P2_SB35_4G:
2040 adapter->ahw.board_type = NETXEN_NIC_GBE; 2063 adapter->ahw.board_type = NETXEN_NIC_GBE;
@@ -2053,7 +2076,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2053 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 2076 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
2054 case NETXEN_BRDTYPE_P3_10G_XFP: 2077 case NETXEN_BRDTYPE_P3_10G_XFP:
2055 case NETXEN_BRDTYPE_P3_10000_BASE_T: 2078 case NETXEN_BRDTYPE_P3_10000_BASE_T:
2056
2057 adapter->ahw.board_type = NETXEN_NIC_XGBE; 2079 adapter->ahw.board_type = NETXEN_NIC_XGBE;
2058 break; 2080 break;
2059 case NETXEN_BRDTYPE_P1_BD: 2081 case NETXEN_BRDTYPE_P1_BD:
@@ -2063,9 +2085,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2063 case NETXEN_BRDTYPE_P3_REF_QG: 2085 case NETXEN_BRDTYPE_P3_REF_QG:
2064 case NETXEN_BRDTYPE_P3_4_GB: 2086 case NETXEN_BRDTYPE_P3_4_GB:
2065 case NETXEN_BRDTYPE_P3_4_GB_MM: 2087 case NETXEN_BRDTYPE_P3_4_GB_MM:
2066
2067 adapter->ahw.board_type = NETXEN_NIC_GBE; 2088 adapter->ahw.board_type = NETXEN_NIC_GBE;
2068 break; 2089 break;
2090 case NETXEN_BRDTYPE_P3_10G_TP:
2091 adapter->ahw.board_type = (adapter->portnum < 2) ?
2092 NETXEN_NIC_XGBE : NETXEN_NIC_GBE;
2093 break;
2069 default: 2094 default:
2070 printk("%s: Unknown(%x)\n", netxen_nic_driver_name, 2095 printk("%s: Unknown(%x)\n", netxen_nic_driver_name,
2071 boardinfo->board_type); 2096 boardinfo->board_type);
@@ -2110,12 +2135,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2110{ 2135{
2111 __u32 status; 2136 __u32 status;
2112 __u32 autoneg; 2137 __u32 autoneg;
2113 __u32 mode;
2114 __u32 port_mode; 2138 __u32 port_mode;
2115 2139
2116 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); 2140 if (!netif_carrier_ok(adapter->netdev)) {
2117 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ 2141 adapter->link_speed = 0;
2142 adapter->link_duplex = -1;
2143 adapter->link_autoneg = AUTONEG_ENABLE;
2144 return;
2145 }
2118 2146
2147 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
2119 adapter->hw_read_wx(adapter, 2148 adapter->hw_read_wx(adapter,
2120 NETXEN_PORT_MODE_ADDR, &port_mode, 4); 2149 NETXEN_PORT_MODE_ADDR, &port_mode, 4);
2121 if (port_mode == NETXEN_PORT_MODE_802_3_AP) { 2150 if (port_mode == NETXEN_PORT_MODE_802_3_AP) {
@@ -2141,7 +2170,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2141 adapter->link_speed = SPEED_1000; 2170 adapter->link_speed = SPEED_1000;
2142 break; 2171 break;
2143 default: 2172 default:
2144 adapter->link_speed = -1; 2173 adapter->link_speed = 0;
2145 break; 2174 break;
2146 } 2175 }
2147 switch (netxen_get_phy_duplex(status)) { 2176 switch (netxen_get_phy_duplex(status)) {
@@ -2164,7 +2193,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2164 goto link_down; 2193 goto link_down;
2165 } else { 2194 } else {
2166 link_down: 2195 link_down:
2167 adapter->link_speed = -1; 2196 adapter->link_speed = 0;
2168 adapter->link_duplex = -1; 2197 adapter->link_duplex = -1;
2169 } 2198 }
2170 } 2199 }
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index d924468e506e..ca7c8d8050c9 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -308,7 +308,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
308 } 308 }
309 memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); 309 memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE);
310 INIT_LIST_HEAD(&rds_ring->free_list); 310 INIT_LIST_HEAD(&rds_ring->free_list);
311 rds_ring->begin_alloc = 0;
312 /* 311 /*
313 * Now go through all of them, set reference handles 312 * Now go through all of them, set reference handles
314 * and put them in the queues. 313 * and put them in the queues.
@@ -439,6 +438,8 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter)
439 long timeout = 0; 438 long timeout = 0;
440 long done = 0; 439 long done = 0;
441 440
441 cond_resched();
442
442 while (done == 0) { 443 while (done == 0) {
443 done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); 444 done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS);
444 done &= 2; 445 done &= 2;
@@ -533,12 +534,9 @@ static int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
533static int do_rom_fast_read(struct netxen_adapter *adapter, 534static int do_rom_fast_read(struct netxen_adapter *adapter,
534 int addr, int *valp) 535 int addr, int *valp)
535{ 536{
536 cond_resched();
537
538 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); 537 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
539 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
540 udelay(100); /* prevent bursting on CRB */
541 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 538 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
539 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
542 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); 540 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
543 if (netxen_wait_rom_done(adapter)) { 541 if (netxen_wait_rom_done(adapter)) {
544 printk("Error waiting for rom done\n"); 542 printk("Error waiting for rom done\n");
@@ -546,7 +544,7 @@ static int do_rom_fast_read(struct netxen_adapter *adapter,
546 } 544 }
547 /* reset abyte_cnt and dummy_byte_cnt */ 545 /* reset abyte_cnt and dummy_byte_cnt */
548 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); 546 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
549 udelay(100); /* prevent bursting on CRB */ 547 udelay(10);
550 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 548 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
551 549
552 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); 550 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA);
@@ -884,14 +882,16 @@ int netxen_flash_unlock(struct netxen_adapter *adapter)
884int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) 882int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
885{ 883{
886 int addr, val; 884 int addr, val;
887 int i, init_delay = 0; 885 int i, n, init_delay = 0;
888 struct crb_addr_pair *buf; 886 struct crb_addr_pair *buf;
889 unsigned offset, n; 887 unsigned offset;
890 u32 off; 888 u32 off;
891 889
892 /* resetall */ 890 /* resetall */
891 rom_lock(adapter);
893 netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 892 netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET,
894 0xffffffff); 893 0xffffffff);
894 netxen_rom_unlock(adapter);
895 895
896 if (verbose) { 896 if (verbose) {
897 if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) 897 if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0)
@@ -910,7 +910,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
910 910
911 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 911 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
912 if (netxen_rom_fast_read(adapter, 0, &n) != 0 || 912 if (netxen_rom_fast_read(adapter, 0, &n) != 0 ||
913 (n != 0xcafecafeUL) || 913 (n != 0xcafecafe) ||
914 netxen_rom_fast_read(adapter, 4, &n) != 0) { 914 netxen_rom_fast_read(adapter, 4, &n) != 0) {
915 printk(KERN_ERR "%s: ERROR Reading crb_init area: " 915 printk(KERN_ERR "%s: ERROR Reading crb_init area: "
916 "n: %08x\n", netxen_nic_driver_name, n); 916 "n: %08x\n", netxen_nic_driver_name, n);
@@ -975,6 +975,14 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
975 /* do not reset PCI */ 975 /* do not reset PCI */
976 if (off == (ROMUSB_GLB + 0xbc)) 976 if (off == (ROMUSB_GLB + 0xbc))
977 continue; 977 continue;
978 if (off == (ROMUSB_GLB + 0xa8))
979 continue;
980 if (off == (ROMUSB_GLB + 0xc8)) /* core clock */
981 continue;
982 if (off == (ROMUSB_GLB + 0x24)) /* MN clock */
983 continue;
984 if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */
985 continue;
978 if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) 986 if (off == (NETXEN_CRB_PEG_NET_1 + 0x18))
979 buf[i].data = 0x1020; 987 buf[i].data = 0x1020;
980 /* skip the function enable register */ 988 /* skip the function enable register */
@@ -992,23 +1000,21 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
992 continue; 1000 continue;
993 } 1001 }
994 1002
1003 init_delay = 1;
995 /* After writing this register, HW needs time for CRB */ 1004 /* After writing this register, HW needs time for CRB */
996 /* to quiet down (else crb_window returns 0xffffffff) */ 1005 /* to quiet down (else crb_window returns 0xffffffff) */
997 if (off == NETXEN_ROMUSB_GLB_SW_RESET) { 1006 if (off == NETXEN_ROMUSB_GLB_SW_RESET) {
998 init_delay = 1; 1007 init_delay = 1000;
999 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 1008 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
1000 /* hold xdma in reset also */ 1009 /* hold xdma in reset also */
1001 buf[i].data = NETXEN_NIC_XDMA_RESET; 1010 buf[i].data = NETXEN_NIC_XDMA_RESET;
1011 buf[i].data = 0x8000ff;
1002 } 1012 }
1003 } 1013 }
1004 1014
1005 adapter->hw_write_wx(adapter, off, &buf[i].data, 4); 1015 adapter->hw_write_wx(adapter, off, &buf[i].data, 4);
1006 1016
1007 if (init_delay == 1) { 1017 msleep(init_delay);
1008 msleep(1000);
1009 init_delay = 0;
1010 }
1011 msleep(1);
1012 } 1018 }
1013 kfree(buf); 1019 kfree(buf);
1014 1020
@@ -1277,7 +1283,7 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1277 1283
1278 dev_kfree_skb_any(skb); 1284 dev_kfree_skb_any(skb);
1279 for (i = 0; i < nr_frags; i++) { 1285 for (i = 0; i < nr_frags; i++) {
1280 index = frag_desc->frag_handles[i]; 1286 index = le16_to_cpu(frag_desc->frag_handles[i]);
1281 skb = netxen_process_rxbuf(adapter, 1287 skb = netxen_process_rxbuf(adapter,
1282 rds_ring, index, cksum); 1288 rds_ring, index, cksum);
1283 if (skb) 1289 if (skb)
@@ -1428,7 +1434,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1428 struct rcv_desc *pdesc; 1434 struct rcv_desc *pdesc;
1429 struct netxen_rx_buffer *buffer; 1435 struct netxen_rx_buffer *buffer;
1430 int count = 0; 1436 int count = 0;
1431 int index = 0;
1432 netxen_ctx_msg msg = 0; 1437 netxen_ctx_msg msg = 0;
1433 dma_addr_t dma; 1438 dma_addr_t dma;
1434 struct list_head *head; 1439 struct list_head *head;
@@ -1436,7 +1441,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1436 rds_ring = &recv_ctx->rds_rings[ringid]; 1441 rds_ring = &recv_ctx->rds_rings[ringid];
1437 1442
1438 producer = rds_ring->producer; 1443 producer = rds_ring->producer;
1439 index = rds_ring->begin_alloc;
1440 head = &rds_ring->free_list; 1444 head = &rds_ring->free_list;
1441 1445
1442 /* We can start writing rx descriptors into the phantom memory. */ 1446 /* We can start writing rx descriptors into the phantom memory. */
@@ -1444,39 +1448,37 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1444 1448
1445 skb = dev_alloc_skb(rds_ring->skb_size); 1449 skb = dev_alloc_skb(rds_ring->skb_size);
1446 if (unlikely(!skb)) { 1450 if (unlikely(!skb)) {
1447 rds_ring->begin_alloc = index;
1448 break; 1451 break;
1449 } 1452 }
1450 1453
1454 if (!adapter->ahw.cut_through)
1455 skb_reserve(skb, 2);
1456
1457 dma = pci_map_single(pdev, skb->data,
1458 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
1459 if (pci_dma_mapping_error(pdev, dma)) {
1460 dev_kfree_skb_any(skb);
1461 break;
1462 }
1463
1464 count++;
1451 buffer = list_entry(head->next, struct netxen_rx_buffer, list); 1465 buffer = list_entry(head->next, struct netxen_rx_buffer, list);
1452 list_del(&buffer->list); 1466 list_del(&buffer->list);
1453 1467
1454 count++; /* now there should be no failure */
1455 pdesc = &rds_ring->desc_head[producer];
1456
1457 if (!adapter->ahw.cut_through)
1458 skb_reserve(skb, 2);
1459 /* This will be setup when we receive the
1460 * buffer after it has been filled FSL TBD TBD
1461 * skb->dev = netdev;
1462 */
1463 dma = pci_map_single(pdev, skb->data, rds_ring->dma_size,
1464 PCI_DMA_FROMDEVICE);
1465 pdesc->addr_buffer = cpu_to_le64(dma);
1466 buffer->skb = skb; 1468 buffer->skb = skb;
1467 buffer->state = NETXEN_BUFFER_BUSY; 1469 buffer->state = NETXEN_BUFFER_BUSY;
1468 buffer->dma = dma; 1470 buffer->dma = dma;
1471
1469 /* make a rcv descriptor */ 1472 /* make a rcv descriptor */
1473 pdesc = &rds_ring->desc_head[producer];
1474 pdesc->addr_buffer = cpu_to_le64(dma);
1470 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); 1475 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1471 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); 1476 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size);
1472 DPRINTK(INFO, "done writing descripter\n"); 1477
1473 producer = 1478 producer = get_next_index(producer, rds_ring->max_rx_desc_count);
1474 get_next_index(producer, rds_ring->max_rx_desc_count);
1475 index = get_next_index(index, rds_ring->max_rx_desc_count);
1476 } 1479 }
1477 /* if we did allocate buffers, then write the count to Phantom */ 1480 /* if we did allocate buffers, then write the count to Phantom */
1478 if (count) { 1481 if (count) {
1479 rds_ring->begin_alloc = index;
1480 rds_ring->producer = producer; 1482 rds_ring->producer = producer;
1481 /* Window = 1 */ 1483 /* Window = 1 */
1482 adapter->pci_write_normalize(adapter, 1484 adapter->pci_write_normalize(adapter,
@@ -1515,49 +1517,50 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
1515 struct rcv_desc *pdesc; 1517 struct rcv_desc *pdesc;
1516 struct netxen_rx_buffer *buffer; 1518 struct netxen_rx_buffer *buffer;
1517 int count = 0; 1519 int count = 0;
1518 int index = 0;
1519 struct list_head *head; 1520 struct list_head *head;
1521 dma_addr_t dma;
1520 1522
1521 rds_ring = &recv_ctx->rds_rings[ringid]; 1523 rds_ring = &recv_ctx->rds_rings[ringid];
1522 1524
1523 producer = rds_ring->producer; 1525 producer = rds_ring->producer;
1524 index = rds_ring->begin_alloc;
1525 head = &rds_ring->free_list; 1526 head = &rds_ring->free_list;
1526 /* We can start writing rx descriptors into the phantom memory. */ 1527 /* We can start writing rx descriptors into the phantom memory. */
1527 while (!list_empty(head)) { 1528 while (!list_empty(head)) {
1528 1529
1529 skb = dev_alloc_skb(rds_ring->skb_size); 1530 skb = dev_alloc_skb(rds_ring->skb_size);
1530 if (unlikely(!skb)) { 1531 if (unlikely(!skb)) {
1531 rds_ring->begin_alloc = index;
1532 break; 1532 break;
1533 } 1533 }
1534 1534
1535 if (!adapter->ahw.cut_through)
1536 skb_reserve(skb, 2);
1537
1538 dma = pci_map_single(pdev, skb->data,
1539 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
1540 if (pci_dma_mapping_error(pdev, dma)) {
1541 dev_kfree_skb_any(skb);
1542 break;
1543 }
1544
1545 count++;
1535 buffer = list_entry(head->next, struct netxen_rx_buffer, list); 1546 buffer = list_entry(head->next, struct netxen_rx_buffer, list);
1536 list_del(&buffer->list); 1547 list_del(&buffer->list);
1537 1548
1538 count++; /* now there should be no failure */
1539 pdesc = &rds_ring->desc_head[producer];
1540 if (!adapter->ahw.cut_through)
1541 skb_reserve(skb, 2);
1542 buffer->skb = skb; 1549 buffer->skb = skb;
1543 buffer->state = NETXEN_BUFFER_BUSY; 1550 buffer->state = NETXEN_BUFFER_BUSY;
1544 buffer->dma = pci_map_single(pdev, skb->data, 1551 buffer->dma = dma;
1545 rds_ring->dma_size,
1546 PCI_DMA_FROMDEVICE);
1547 1552
1548 /* make a rcv descriptor */ 1553 /* make a rcv descriptor */
1554 pdesc = &rds_ring->desc_head[producer];
1549 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); 1555 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1550 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); 1556 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size);
1551 pdesc->addr_buffer = cpu_to_le64(buffer->dma); 1557 pdesc->addr_buffer = cpu_to_le64(buffer->dma);
1552 producer = 1558
1553 get_next_index(producer, rds_ring->max_rx_desc_count); 1559 producer = get_next_index(producer, rds_ring->max_rx_desc_count);
1554 index = get_next_index(index, rds_ring->max_rx_desc_count);
1555 buffer = &rds_ring->rx_buf_arr[index];
1556 } 1560 }
1557 1561
1558 /* if we did allocate buffers, then write the count to Phantom */ 1562 /* if we did allocate buffers, then write the count to Phantom */
1559 if (count) { 1563 if (count) {
1560 rds_ring->begin_alloc = index;
1561 rds_ring->producer = producer; 1564 rds_ring->producer = producer;
1562 /* Window = 1 */ 1565 /* Window = 1 */
1563 adapter->pci_write_normalize(adapter, 1566 adapter->pci_write_normalize(adapter,
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index ba01524b5531..d854f07ef4d3 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -39,7 +39,9 @@
39#include "netxen_nic_phan_reg.h" 39#include "netxen_nic_phan_reg.h"
40 40
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/if_vlan.h>
42#include <net/ip.h> 43#include <net/ip.h>
44#include <linux/ipv6.h>
43 45
44MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); 46MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
45MODULE_LICENSE("GPL"); 47MODULE_LICENSE("GPL");
@@ -242,7 +244,7 @@ static void netxen_check_options(struct netxen_adapter *adapter)
242 case NETXEN_BRDTYPE_P3_4_GB: 244 case NETXEN_BRDTYPE_P3_4_GB:
243 case NETXEN_BRDTYPE_P3_4_GB_MM: 245 case NETXEN_BRDTYPE_P3_4_GB_MM:
244 adapter->msix_supported = !!use_msi_x; 246 adapter->msix_supported = !!use_msi_x;
245 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; 247 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
246 break; 248 break;
247 249
248 case NETXEN_BRDTYPE_P2_SB35_4G: 250 case NETXEN_BRDTYPE_P2_SB35_4G:
@@ -251,6 +253,14 @@ static void netxen_check_options(struct netxen_adapter *adapter)
251 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 253 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
252 break; 254 break;
253 255
256 case NETXEN_BRDTYPE_P3_10G_TP:
257 adapter->msix_supported = !!use_msi_x;
258 if (adapter->ahw.board_type == NETXEN_NIC_XGBE)
259 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G;
260 else
261 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
262 break;
263
254 default: 264 default:
255 adapter->msix_supported = 0; 265 adapter->msix_supported = 0;
256 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 266 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
@@ -271,10 +281,15 @@ static void netxen_check_options(struct netxen_adapter *adapter)
271static int 281static int
272netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) 282netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot)
273{ 283{
274 int ret = 0; 284 u32 val, timeout;
275 285
276 if (first_boot == 0x55555555) { 286 if (first_boot == 0x55555555) {
277 /* This is the first boot after power up */ 287 /* This is the first boot after power up */
288 adapter->pci_write_normalize(adapter,
289 NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC);
290
291 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id))
292 return 0;
278 293
279 /* PCI bus master workaround */ 294 /* PCI bus master workaround */
280 adapter->hw_read_wx(adapter, 295 adapter->hw_read_wx(adapter,
@@ -294,18 +309,26 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot)
294 /* clear the register for future unloads/loads */ 309 /* clear the register for future unloads/loads */
295 adapter->pci_write_normalize(adapter, 310 adapter->pci_write_normalize(adapter,
296 NETXEN_CAM_RAM(0x1fc), 0); 311 NETXEN_CAM_RAM(0x1fc), 0);
297 ret = -1; 312 return -EIO;
298 } 313 }
299 314
300 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 315 /* Start P2 boot loader */
301 /* Start P2 boot loader */ 316 val = adapter->pci_read_normalize(adapter,
302 adapter->pci_write_normalize(adapter, 317 NETXEN_ROMUSB_GLB_PEGTUNE_DONE);
303 NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); 318 adapter->pci_write_normalize(adapter,
304 adapter->pci_write_normalize(adapter, 319 NETXEN_ROMUSB_GLB_PEGTUNE_DONE, val | 0x1);
305 NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); 320 timeout = 0;
306 } 321 do {
322 msleep(1);
323 val = adapter->pci_read_normalize(adapter,
324 NETXEN_CAM_RAM(0x1fc));
325
326 if (++timeout > 5000)
327 return -EIO;
328
329 } while (val == NETXEN_BDINFO_MAGIC);
307 } 330 }
308 return ret; 331 return 0;
309} 332}
310 333
311static void netxen_set_port_mode(struct netxen_adapter *adapter) 334static void netxen_set_port_mode(struct netxen_adapter *adapter)
@@ -784,8 +807,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
784 CRB_CMDPEG_STATE, 0); 807 CRB_CMDPEG_STATE, 0);
785 netxen_pinit_from_rom(adapter, 0); 808 netxen_pinit_from_rom(adapter, 0);
786 msleep(1); 809 msleep(1);
787 netxen_load_firmware(adapter);
788 } 810 }
811 netxen_load_firmware(adapter);
789 812
790 if (NX_IS_REVISION_P3(revision_id)) 813 if (NX_IS_REVISION_P3(revision_id))
791 netxen_pcie_strap_init(adapter); 814 netxen_pcie_strap_init(adapter);
@@ -801,13 +824,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
801 824
802 } 825 }
803 826
804 if ((first_boot == 0x55555555) &&
805 (NX_IS_REVISION_P2(revision_id))) {
806 /* Unlock the HW, prompting the boot sequence */
807 adapter->pci_write_normalize(adapter,
808 NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1);
809 }
810
811 err = netxen_initialize_adapter_offload(adapter); 827 err = netxen_initialize_adapter_offload(adapter);
812 if (err) 828 if (err)
813 goto err_out_iounmap; 829 goto err_out_iounmap;
@@ -821,7 +837,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
821 adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); 837 adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i);
822 838
823 /* Handshake with the card before we register the devices. */ 839 /* Handshake with the card before we register the devices. */
824 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 840 err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
841 if (err)
842 goto err_out_free_offload;
825 843
826 } /* first_driver */ 844 } /* first_driver */
827 845
@@ -925,6 +943,7 @@ err_out_disable_msi:
925 if (adapter->flags & NETXEN_NIC_MSI_ENABLED) 943 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
926 pci_disable_msi(pdev); 944 pci_disable_msi(pdev);
927 945
946err_out_free_offload:
928 if (first_driver) 947 if (first_driver)
929 netxen_free_adapter_offload(adapter); 948 netxen_free_adapter_offload(adapter);
930 949
@@ -968,6 +987,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
968 netxen_free_hw_resources(adapter); 987 netxen_free_hw_resources(adapter);
969 netxen_release_rx_buffers(adapter); 988 netxen_release_rx_buffers(adapter);
970 netxen_free_sw_resources(adapter); 989 netxen_free_sw_resources(adapter);
990
991 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
992 netxen_p3_free_mac_list(adapter);
971 } 993 }
972 994
973 if (adapter->portnum == 0) 995 if (adapter->portnum == 0)
@@ -983,8 +1005,10 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
983 1005
984 iounmap(adapter->ahw.db_base); 1006 iounmap(adapter->ahw.db_base);
985 iounmap(adapter->ahw.pci_base0); 1007 iounmap(adapter->ahw.pci_base0);
986 iounmap(adapter->ahw.pci_base1); 1008 if (adapter->ahw.pci_base1 != NULL)
987 iounmap(adapter->ahw.pci_base2); 1009 iounmap(adapter->ahw.pci_base1);
1010 if (adapter->ahw.pci_base2 != NULL)
1011 iounmap(adapter->ahw.pci_base2);
988 1012
989 pci_release_regions(pdev); 1013 pci_release_regions(pdev);
990 pci_disable_device(pdev); 1014 pci_disable_device(pdev);
@@ -1137,29 +1161,64 @@ static int netxen_nic_close(struct net_device *netdev)
1137 return 0; 1161 return 0;
1138} 1162}
1139 1163
1140void netxen_tso_check(struct netxen_adapter *adapter, 1164static bool netxen_tso_check(struct net_device *netdev,
1141 struct cmd_desc_type0 *desc, struct sk_buff *skb) 1165 struct cmd_desc_type0 *desc, struct sk_buff *skb)
1142{ 1166{
1143 if (desc->mss) { 1167 bool tso = false;
1144 desc->total_hdr_length = (sizeof(struct ethhdr) + 1168 u8 opcode = TX_ETHER_PKT;
1145 ip_hdrlen(skb) + tcp_hdrlen(skb));
1146 1169
1147 if ((NX_IS_REVISION_P3(adapter->ahw.revision_id)) && 1170 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
1148 (skb->protocol == htons(ETH_P_IPV6))) 1171 skb_shinfo(skb)->gso_size > 0) {
1149 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO6); 1172
1150 else 1173 desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
1151 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); 1174 desc->total_hdr_length =
1175 skb_transport_offset(skb) + tcp_hdrlen(skb);
1176
1177 opcode = (skb->protocol == htons(ETH_P_IPV6)) ?
1178 TX_TCP_LSO6 : TX_TCP_LSO;
1179 tso = true;
1152 1180
1153 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 1181 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
1154 if (ip_hdr(skb)->protocol == IPPROTO_TCP) 1182 u8 l4proto;
1155 netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); 1183
1156 else if (ip_hdr(skb)->protocol == IPPROTO_UDP) 1184 if (skb->protocol == htons(ETH_P_IP)) {
1157 netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); 1185 l4proto = ip_hdr(skb)->protocol;
1158 else 1186
1159 return; 1187 if (l4proto == IPPROTO_TCP)
1188 opcode = TX_TCP_PKT;
1189 else if(l4proto == IPPROTO_UDP)
1190 opcode = TX_UDP_PKT;
1191 } else if (skb->protocol == htons(ETH_P_IPV6)) {
1192 l4proto = ipv6_hdr(skb)->nexthdr;
1193
1194 if (l4proto == IPPROTO_TCP)
1195 opcode = TX_TCPV6_PKT;
1196 else if(l4proto == IPPROTO_UDP)
1197 opcode = TX_UDPV6_PKT;
1198 }
1160 } 1199 }
1161 desc->tcp_hdr_offset = skb_transport_offset(skb); 1200 desc->tcp_hdr_offset = skb_transport_offset(skb);
1162 desc->ip_hdr_offset = skb_network_offset(skb); 1201 desc->ip_hdr_offset = skb_network_offset(skb);
1202 netxen_set_tx_flags_opcode(desc, 0, opcode);
1203 return tso;
1204}
1205
1206static void
1207netxen_clean_tx_dma_mapping(struct pci_dev *pdev,
1208 struct netxen_cmd_buffer *pbuf, int last)
1209{
1210 int k;
1211 struct netxen_skb_frag *buffrag;
1212
1213 buffrag = &pbuf->frag_array[0];
1214 pci_unmap_single(pdev, buffrag->dma,
1215 buffrag->length, PCI_DMA_TODEVICE);
1216
1217 for (k = 1; k < last; k++) {
1218 buffrag = &pbuf->frag_array[k];
1219 pci_unmap_page(pdev, buffrag->dma,
1220 buffrag->length, PCI_DMA_TODEVICE);
1221 }
1163} 1222}
1164 1223
1165static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1224static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
@@ -1167,33 +1226,22 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1167 struct netxen_adapter *adapter = netdev_priv(netdev); 1226 struct netxen_adapter *adapter = netdev_priv(netdev);
1168 struct netxen_hardware_context *hw = &adapter->ahw; 1227 struct netxen_hardware_context *hw = &adapter->ahw;
1169 unsigned int first_seg_len = skb->len - skb->data_len; 1228 unsigned int first_seg_len = skb->len - skb->data_len;
1229 struct netxen_cmd_buffer *pbuf;
1170 struct netxen_skb_frag *buffrag; 1230 struct netxen_skb_frag *buffrag;
1171 unsigned int i; 1231 struct cmd_desc_type0 *hwdesc;
1232 struct pci_dev *pdev = adapter->pdev;
1233 dma_addr_t temp_dma;
1234 int i, k;
1172 1235
1173 u32 producer, consumer; 1236 u32 producer, consumer;
1174 u32 saved_producer = 0; 1237 int frag_count, no_of_desc;
1175 struct cmd_desc_type0 *hwdesc;
1176 int k;
1177 struct netxen_cmd_buffer *pbuf = NULL;
1178 int frag_count;
1179 int no_of_desc;
1180 u32 num_txd = adapter->max_tx_desc_count; 1238 u32 num_txd = adapter->max_tx_desc_count;
1239 bool is_tso = false;
1181 1240
1182 frag_count = skb_shinfo(skb)->nr_frags + 1; 1241 frag_count = skb_shinfo(skb)->nr_frags + 1;
1183 1242
1184 /* There 4 fragments per descriptor */ 1243 /* There 4 fragments per descriptor */
1185 no_of_desc = (frag_count + 3) >> 2; 1244 no_of_desc = (frag_count + 3) >> 2;
1186 if (netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) {
1187 if (skb_shinfo(skb)->gso_size > 0) {
1188
1189 no_of_desc++;
1190 if ((ip_hdrlen(skb) + tcp_hdrlen(skb) +
1191 sizeof(struct ethhdr)) >
1192 (sizeof(struct cmd_desc_type0) - 2)) {
1193 no_of_desc++;
1194 }
1195 }
1196 }
1197 1245
1198 producer = adapter->cmd_producer; 1246 producer = adapter->cmd_producer;
1199 smp_mb(); 1247 smp_mb();
@@ -1205,34 +1253,26 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1205 } 1253 }
1206 1254
1207 /* Copy the descriptors into the hardware */ 1255 /* Copy the descriptors into the hardware */
1208 saved_producer = producer;
1209 hwdesc = &hw->cmd_desc_head[producer]; 1256 hwdesc = &hw->cmd_desc_head[producer];
1210 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1257 memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
1211 /* Take skb->data itself */ 1258 /* Take skb->data itself */
1212 pbuf = &adapter->cmd_buf_arr[producer]; 1259 pbuf = &adapter->cmd_buf_arr[producer];
1213 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && 1260
1214 skb_shinfo(skb)->gso_size > 0) { 1261 is_tso = netxen_tso_check(netdev, hwdesc, skb);
1215 pbuf->mss = skb_shinfo(skb)->gso_size; 1262
1216 hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
1217 } else {
1218 pbuf->mss = 0;
1219 hwdesc->mss = 0;
1220 }
1221 pbuf->total_length = skb->len;
1222 pbuf->skb = skb; 1263 pbuf->skb = skb;
1223 pbuf->cmd = TX_ETHER_PKT;
1224 pbuf->frag_count = frag_count; 1264 pbuf->frag_count = frag_count;
1225 pbuf->port = adapter->portnum;
1226 buffrag = &pbuf->frag_array[0]; 1265 buffrag = &pbuf->frag_array[0];
1227 buffrag->dma = pci_map_single(adapter->pdev, skb->data, first_seg_len, 1266 temp_dma = pci_map_single(pdev, skb->data, first_seg_len,
1228 PCI_DMA_TODEVICE); 1267 PCI_DMA_TODEVICE);
1268 if (pci_dma_mapping_error(pdev, temp_dma))
1269 goto drop_packet;
1270
1271 buffrag->dma = temp_dma;
1229 buffrag->length = first_seg_len; 1272 buffrag->length = first_seg_len;
1230 netxen_set_cmd_desc_totallength(hwdesc, skb->len); 1273 netxen_set_tx_frags_len(hwdesc, frag_count, skb->len);
1231 netxen_set_cmd_desc_num_of_buff(hwdesc, frag_count); 1274 netxen_set_tx_port(hwdesc, adapter->portnum);
1232 netxen_set_cmd_desc_opcode(hwdesc, TX_ETHER_PKT);
1233 1275
1234 netxen_set_cmd_desc_port(hwdesc, adapter->portnum);
1235 netxen_set_cmd_desc_ctxid(hwdesc, adapter->portnum);
1236 hwdesc->buffer1_length = cpu_to_le16(first_seg_len); 1276 hwdesc->buffer1_length = cpu_to_le16(first_seg_len);
1237 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); 1277 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma);
1238 1278
@@ -1240,7 +1280,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1240 struct skb_frag_struct *frag; 1280 struct skb_frag_struct *frag;
1241 int len, temp_len; 1281 int len, temp_len;
1242 unsigned long offset; 1282 unsigned long offset;
1243 dma_addr_t temp_dma;
1244 1283
1245 /* move to next desc. if there is a need */ 1284 /* move to next desc. if there is a need */
1246 if ((i & 0x3) == 0) { 1285 if ((i & 0x3) == 0) {
@@ -1256,8 +1295,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1256 offset = frag->page_offset; 1295 offset = frag->page_offset;
1257 1296
1258 temp_len = len; 1297 temp_len = len;
1259 temp_dma = pci_map_page(adapter->pdev, frag->page, offset, 1298 temp_dma = pci_map_page(pdev, frag->page, offset,
1260 len, PCI_DMA_TODEVICE); 1299 len, PCI_DMA_TODEVICE);
1300 if (pci_dma_mapping_error(pdev, temp_dma)) {
1301 netxen_clean_tx_dma_mapping(pdev, pbuf, i);
1302 goto drop_packet;
1303 }
1261 1304
1262 buffrag++; 1305 buffrag++;
1263 buffrag->dma = temp_dma; 1306 buffrag->dma = temp_dma;
@@ -1285,16 +1328,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1285 } 1328 }
1286 producer = get_next_index(producer, num_txd); 1329 producer = get_next_index(producer, num_txd);
1287 1330
1288 /* might change opcode to TX_TCP_LSO */
1289 netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb);
1290
1291 /* For LSO, we need to copy the MAC/IP/TCP headers into 1331 /* For LSO, we need to copy the MAC/IP/TCP headers into
1292 * the descriptor ring 1332 * the descriptor ring
1293 */ 1333 */
1294 if (netxen_get_cmd_desc_opcode(&hw->cmd_desc_head[saved_producer]) 1334 if (is_tso) {
1295 == TX_TCP_LSO) {
1296 int hdr_len, first_hdr_len, more_hdr; 1335 int hdr_len, first_hdr_len, more_hdr;
1297 hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; 1336 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
1298 if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { 1337 if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) {
1299 first_hdr_len = sizeof(struct cmd_desc_type0) - 2; 1338 first_hdr_len = sizeof(struct cmd_desc_type0) - 2;
1300 more_hdr = 1; 1339 more_hdr = 1;
@@ -1336,6 +1375,11 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1336 netdev->trans_start = jiffies; 1375 netdev->trans_start = jiffies;
1337 1376
1338 return NETDEV_TX_OK; 1377 return NETDEV_TX_OK;
1378
1379drop_packet:
1380 adapter->stats.txdropped++;
1381 dev_kfree_skb_any(skb);
1382 return NETDEV_TX_OK;
1339} 1383}
1340 1384
1341static int netxen_nic_check_temp(struct netxen_adapter *adapter) 1385static int netxen_nic_check_temp(struct netxen_adapter *adapter)
@@ -1407,6 +1451,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1407 netif_carrier_off(netdev); 1451 netif_carrier_off(netdev);
1408 netif_stop_queue(netdev); 1452 netif_stop_queue(netdev);
1409 } 1453 }
1454
1455 netxen_nic_set_link_parameters(adapter);
1410 } else if (!adapter->ahw.linkup && linkup) { 1456 } else if (!adapter->ahw.linkup && linkup) {
1411 printk(KERN_INFO "%s: %s NIC Link is up\n", 1457 printk(KERN_INFO "%s: %s NIC Link is up\n",
1412 netxen_nic_driver_name, netdev->name); 1458 netxen_nic_driver_name, netdev->name);
@@ -1415,6 +1461,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1415 netif_carrier_on(netdev); 1461 netif_carrier_on(netdev);
1416 netif_wake_queue(netdev); 1462 netif_wake_queue(netdev);
1417 } 1463 }
1464
1465 netxen_nic_set_link_parameters(adapter);
1418 } 1466 }
1419} 1467}
1420 1468
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 5b7a574ce571..d0349e7d73ea 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -712,7 +712,7 @@ static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac,
712 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); 712 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
713 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); 713 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno));
714 714
715 printk(KERN_ERR "pasemi_mac: rx error. macrx %016lx, rx status %lx\n", 715 printk(KERN_ERR "pasemi_mac: rx error. macrx %016llx, rx status %llx\n",
716 macrx, *chan->status); 716 macrx, *chan->status);
717 717
718 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", 718 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n",
@@ -730,8 +730,8 @@ static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac,
730 730
731 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); 731 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno));
732 732
733 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016lx, "\ 733 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016llx, "\
734 "tx status 0x%016lx\n", mactx, *chan->status); 734 "tx status 0x%016llx\n", mactx, *chan->status);
735 735
736 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); 736 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta);
737} 737}
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index e35460165bf7..0a06e4fd37d9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -231,15 +231,6 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr)
231 if ((phy_id & 0x1fffffff) == 0x1fffffff) 231 if ((phy_id & 0x1fffffff) == 0x1fffffff)
232 return NULL; 232 return NULL;
233 233
234 /*
235 * Broken hardware is sometimes missing the pull-up resistor on the
236 * MDIO line, which results in reads to non-existent devices returning
237 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
238 * device as well.
239 */
240 if (phy_id == 0)
241 return NULL;
242
243 dev = phy_device_create(bus, addr, phy_id); 234 dev = phy_device_create(bus, addr, phy_id);
244 235
245 return dev; 236 return dev;
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 06b448285eb5..7b2728b8f1b7 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -250,6 +250,7 @@ static int ppp_connect_channel(struct channel *pch, int unit);
250static int ppp_disconnect_channel(struct channel *pch); 250static int ppp_disconnect_channel(struct channel *pch);
251static void ppp_destroy_channel(struct channel *pch); 251static void ppp_destroy_channel(struct channel *pch);
252static int unit_get(struct idr *p, void *ptr); 252static int unit_get(struct idr *p, void *ptr);
253static int unit_set(struct idr *p, void *ptr, int n);
253static void unit_put(struct idr *p, int n); 254static void unit_put(struct idr *p, int n);
254static void *unit_find(struct idr *p, int n); 255static void *unit_find(struct idr *p, int n);
255 256
@@ -2432,11 +2433,18 @@ ppp_create_interface(int unit, int *retp)
2432 } else { 2433 } else {
2433 if (unit_find(&ppp_units_idr, unit)) 2434 if (unit_find(&ppp_units_idr, unit))
2434 goto out2; /* unit already exists */ 2435 goto out2; /* unit already exists */
2435 else { 2436 /*
2436 /* darn, someone is cheating us? */ 2437 * if caller need a specified unit number
2437 *retp = -EINVAL; 2438 * lets try to satisfy him, otherwise --
2439 * he should better ask us for new unit number
2440 *
2441 * NOTE: yes I know that returning EEXIST it's not
2442 * fair but at least pppd will ask us to allocate
2443 * new unit in this case so user is happy :)
2444 */
2445 unit = unit_set(&ppp_units_idr, ppp, unit);
2446 if (unit < 0)
2438 goto out2; 2447 goto out2;
2439 }
2440 } 2448 }
2441 2449
2442 /* Initialize the new ppp unit */ 2450 /* Initialize the new ppp unit */
@@ -2677,14 +2685,37 @@ static void __exit ppp_cleanup(void)
2677 * by holding all_ppp_mutex 2685 * by holding all_ppp_mutex
2678 */ 2686 */
2679 2687
2688/* associate pointer with specified number */
2689static int unit_set(struct idr *p, void *ptr, int n)
2690{
2691 int unit, err;
2692
2693again:
2694 if (!idr_pre_get(p, GFP_KERNEL)) {
2695 printk(KERN_ERR "PPP: No free memory for idr\n");
2696 return -ENOMEM;
2697 }
2698
2699 err = idr_get_new_above(p, ptr, n, &unit);
2700 if (err == -EAGAIN)
2701 goto again;
2702
2703 if (unit != n) {
2704 idr_remove(p, unit);
2705 return -EINVAL;
2706 }
2707
2708 return unit;
2709}
2710
2680/* get new free unit number and associate pointer with it */ 2711/* get new free unit number and associate pointer with it */
2681static int unit_get(struct idr *p, void *ptr) 2712static int unit_get(struct idr *p, void *ptr)
2682{ 2713{
2683 int unit, err; 2714 int unit, err;
2684 2715
2685again: 2716again:
2686 if (idr_pre_get(p, GFP_KERNEL) == 0) { 2717 if (!idr_pre_get(p, GFP_KERNEL)) {
2687 printk(KERN_ERR "Out of memory expanding drawable idr\n"); 2718 printk(KERN_ERR "PPP: No free memory for idr\n");
2688 return -ENOMEM; 2719 return -ENOMEM;
2689 } 2720 }
2690 2721
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 6cbefcae9ac2..be4465bc0a69 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -509,10 +509,10 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
509 else 509 else
510 ret = sis900_get_mac_addr(pci_dev, net_dev); 510 ret = sis900_get_mac_addr(pci_dev, net_dev);
511 511
512 if (ret == 0) { 512 if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) {
513 printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name); 513 random_ether_addr(net_dev->dev_addr);
514 ret = -ENODEV; 514 printk(KERN_WARNING "%s: Unreadable or invalid MAC address,"
515 goto err_unmap_rx; 515 "using random generated one\n", dev_name);
516 } 516 }
517 517
518 /* 630ET : set the mii access mode as software-mode */ 518 /* 630ET : set the mii access mode as software-mode */
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index c4918b86ed19..0d0fa91c0251 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
1297 /* setup */ 1297 /* setup */
1298 spin_lock_irq(&serial->serial_lock); 1298 spin_lock_irq(&serial->serial_lock);
1299 tty->driver_data = serial; 1299 tty->driver_data = serial;
1300 tty_kref_put(serial->tty);
1300 serial->tty = tty_kref_get(tty); 1301 serial->tty = tty_kref_get(tty);
1301 spin_unlock_irq(&serial->serial_lock); 1302 spin_unlock_irq(&serial->serial_lock);
1302 1303
@@ -1792,8 +1793,8 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port,
1792 1793
1793 /* initialize */ 1794 /* initialize */
1794 ctrl_req->wValue = 0; 1795 ctrl_req->wValue = 0;
1795 ctrl_req->wIndex = hso_port_to_mux(port); 1796 ctrl_req->wIndex = cpu_to_le16(hso_port_to_mux(port));
1796 ctrl_req->wLength = size; 1797 ctrl_req->wLength = cpu_to_le16(size);
1797 1798
1798 if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) { 1799 if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) {
1799 /* Reading command */ 1800 /* Reading command */
@@ -2043,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2043 return -2; 2044 return -2;
2044 } 2045 }
2045 2046
2046 spin_lock(&serial->serial_lock); 2047 /* All callers to put_rxbuf_data hold serial_lock */
2047 tty = tty_kref_get(serial->tty); 2048 tty = tty_kref_get(serial->tty);
2048 spin_unlock(&serial->serial_lock);
2049 2049
2050 /* Push data to tty */ 2050 /* Push data to tty */
2051 if (tty) { 2051 if (tty) {
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2053 serial->curr_rx_urb_offset; 2053 serial->curr_rx_urb_offset;
2054 D1("data to push to tty"); 2054 D1("data to push to tty");
2055 while (write_length_remaining) { 2055 while (write_length_remaining) {
2056 if (test_bit(TTY_THROTTLED, &tty->flags)) 2056 if (test_bit(TTY_THROTTLED, &tty->flags)) {
2057 tty_kref_put(tty);
2057 return -1; 2058 return -1;
2059 }
2058 curr_write_len = tty_insert_flip_string 2060 curr_write_len = tty_insert_flip_string
2059 (tty, urb->transfer_buffer + 2061 (tty, urb->transfer_buffer +
2060 serial->curr_rx_urb_offset, 2062 serial->curr_rx_urb_offset,
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 2dc241689d37..0dbd85b0162d 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -622,7 +622,7 @@ static void hss_hdlc_rx_irq(void *pdev)
622 printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); 622 printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name);
623#endif 623#endif
624 qmgr_disable_irq(queue_ids[port->id].rx); 624 qmgr_disable_irq(queue_ids[port->id].rx);
625 netif_rx_schedule(dev, &port->napi); 625 netif_rx_schedule(&port->napi);
626} 626}
627 627
628static int hss_hdlc_poll(struct napi_struct *napi, int budget) 628static int hss_hdlc_poll(struct napi_struct *napi, int budget)
@@ -651,7 +651,7 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget)
651 printk(KERN_DEBUG "%s: hss_hdlc_poll" 651 printk(KERN_DEBUG "%s: hss_hdlc_poll"
652 " netif_rx_complete\n", dev->name); 652 " netif_rx_complete\n", dev->name);
653#endif 653#endif
654 netif_rx_complete(dev, napi); 654 netif_rx_complete(napi);
655 qmgr_enable_irq(rxq); 655 qmgr_enable_irq(rxq);
656 if (!qmgr_stat_empty(rxq) && 656 if (!qmgr_stat_empty(rxq) &&
657 netif_rx_reschedule(napi)) { 657 netif_rx_reschedule(napi)) {
@@ -1069,7 +1069,7 @@ static int hss_hdlc_open(struct net_device *dev)
1069 hss_start_hdlc(port); 1069 hss_start_hdlc(port);
1070 1070
1071 /* we may already have RX data, enables IRQ */ 1071 /* we may already have RX data, enables IRQ */
1072 netif_rx_schedule(dev, &port->napi); 1072 netif_rx_schedule(&port->napi);
1073 return 0; 1073 return 0;
1074 1074
1075err_unlock: 1075err_unlock:
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index ea543fcf2687..e4f9f747de88 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -111,7 +111,7 @@ config WLAN_80211
111 lets you choose drivers. 111 lets you choose drivers.
112 112
113config PCMCIA_RAYCS 113config PCMCIA_RAYCS
114 tristate "Aviator/Raytheon 2.4MHz wireless support" 114 tristate "Aviator/Raytheon 2.4GHz wireless support"
115 depends on PCMCIA && WLAN_80211 115 depends on PCMCIA && WLAN_80211
116 select WIRELESS_EXT 116 select WIRELESS_EXT
117 ---help--- 117 ---help---
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 4af2607deec0..8ef87356e083 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -2644,7 +2644,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2644 if (skb_headroom(skb) < padsize) { 2644 if (skb_headroom(skb) < padsize) {
2645 ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" 2645 ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough"
2646 " headroom to pad %d\n", hdrlen, padsize); 2646 " headroom to pad %d\n", hdrlen, padsize);
2647 return -1; 2647 return NETDEV_TX_BUSY;
2648 } 2648 }
2649 skb_push(skb, padsize); 2649 skb_push(skb, padsize);
2650 memmove(skb->data, skb->data+padsize, hdrlen); 2650 memmove(skb->data, skb->data+padsize, hdrlen);
@@ -2655,7 +2655,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2655 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); 2655 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n");
2656 spin_unlock_irqrestore(&sc->txbuflock, flags); 2656 spin_unlock_irqrestore(&sc->txbuflock, flags);
2657 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); 2657 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb));
2658 return -1; 2658 return NETDEV_TX_BUSY;
2659 } 2659 }
2660 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); 2660 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list);
2661 list_del(&bf->list); 2661 list_del(&bf->list);
@@ -2673,10 +2673,10 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2673 sc->txbuf_len++; 2673 sc->txbuf_len++;
2674 spin_unlock_irqrestore(&sc->txbuflock, flags); 2674 spin_unlock_irqrestore(&sc->txbuflock, flags);
2675 dev_kfree_skb_any(skb); 2675 dev_kfree_skb_any(skb);
2676 return 0; 2676 return NETDEV_TX_OK;
2677 } 2677 }
2678 2678
2679 return 0; 2679 return NETDEV_TX_OK;
2680} 2680}
2681 2681
2682static int 2682static int
diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c
index 0cac05c6a9ce..75eb9f43c741 100644
--- a/drivers/net/wireless/ath5k/pcu.c
+++ b/drivers/net/wireless/ath5k/pcu.c
@@ -65,7 +65,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)
65 if (ah->ah_version == AR5K_AR5210) 65 if (ah->ah_version == AR5K_AR5210)
66 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 66 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
67 else 67 else
68 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); 68 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
69 break; 69 break;
70 70
71 case NL80211_IFTYPE_AP: 71 case NL80211_IFTYPE_AP:
@@ -75,7 +75,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)
75 if (ah->ah_version == AR5K_AR5210) 75 if (ah->ah_version == AR5K_AR5210)
76 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 76 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
77 else 77 else
78 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); 78 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
79 break; 79 break;
80 80
81 case NL80211_IFTYPE_STATION: 81 case NL80211_IFTYPE_STATION:
diff --git a/drivers/net/wireless/ath5k/reg.h b/drivers/net/wireless/ath5k/reg.h
index 91aaeaf88199..9189ab13286c 100644
--- a/drivers/net/wireless/ath5k/reg.h
+++ b/drivers/net/wireless/ath5k/reg.h
@@ -73,7 +73,7 @@
73#define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ 73#define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */
74#define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ 74#define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */
75#define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ 75#define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */
76#define AR5K_CFG_ADHOC 0x00000020 /* AP/Adhoc indication [5211+] */ 76#define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */
77#define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ 77#define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */
78#define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ 78#define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */
79#define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ 79#define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */
diff --git a/drivers/net/wireless/ath9k/Kconfig b/drivers/net/wireless/ath9k/Kconfig
index c43bd321f97f..90a8dd873786 100644
--- a/drivers/net/wireless/ath9k/Kconfig
+++ b/drivers/net/wireless/ath9k/Kconfig
@@ -1,6 +1,7 @@
1config ATH9K 1config ATH9K
2 tristate "Atheros 802.11n wireless cards support" 2 tristate "Atheros 802.11n wireless cards support"
3 depends on PCI && MAC80211 && WLAN_80211 3 depends on PCI && MAC80211 && WLAN_80211
4 depends on RFKILL || RFKILL=n
4 select MAC80211_LEDS 5 select MAC80211_LEDS
5 select LEDS_CLASS 6 select LEDS_CLASS
6 select NEW_LEDS 7 select NEW_LEDS
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 191eec50dc75..727f067aca4f 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -2164,13 +2164,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2164 conf->ht.channel_type); 2164 conf->ht.channel_type);
2165 } 2165 }
2166 2166
2167 ath_update_chainmask(sc, conf->ht.enabled);
2168
2167 if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) { 2169 if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) {
2168 DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n"); 2170 DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n");
2169 mutex_unlock(&sc->mutex); 2171 mutex_unlock(&sc->mutex);
2170 return -EINVAL; 2172 return -EINVAL;
2171 } 2173 }
2172
2173 ath_update_chainmask(sc, conf->ht.enabled);
2174 } 2174 }
2175 2175
2176 if (changed & IEEE80211_CONF_CHANGE_POWER) 2176 if (changed & IEEE80211_CONF_CHANGE_POWER)
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 3bfc3b90f256..c92f0c6e4adc 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -126,15 +126,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
126 tx_info->flags |= IEEE80211_TX_STAT_ACK; 126 tx_info->flags |= IEEE80211_TX_STAT_ACK;
127 } 127 }
128 128
129 tx_info->status.rates[0].count = tx_status->retries; 129 tx_info->status.rates[0].count = tx_status->retries + 1;
130 if (tx_info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
131 /* Change idx from internal table index to MCS index */
132 int idx = tx_info->status.rates[0].idx;
133 struct ath_rate_table *rate_table = sc->cur_rate_table;
134 if (idx >= 0 && idx < rate_table->rate_cnt)
135 tx_info->status.rates[0].idx =
136 rate_table->info[idx].ratecode & 0x7f;
137 }
138 130
139 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 131 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
140 padsize = hdrlen & 3; 132 padsize = hdrlen & 3;
@@ -264,25 +256,22 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb,
264 } 256 }
265 257
266 /* Get seqno */ 258 /* Get seqno */
267 259 /* For HT capable stations, we save tidno for later use.
268 if (ieee80211_is_data(fc) && !is_pae(skb)) { 260 * We also override seqno set by upper layer with the one
269 /* For HT capable stations, we save tidno for later use. 261 * in tx aggregation state.
270 * We also override seqno set by upper layer with the one 262 *
271 * in tx aggregation state. 263 * If fragmentation is on, the sequence number is
272 * 264 * not overridden, since it has been
273 * If fragmentation is on, the sequence number is 265 * incremented by the fragmentation routine.
274 * not overridden, since it has been 266 *
275 * incremented by the fragmentation routine. 267 * FIXME: check if the fragmentation threshold exceeds
276 * 268 * IEEE80211 max.
277 * FIXME: check if the fragmentation threshold exceeds 269 */
278 * IEEE80211 max. 270 tid = ATH_AN_2_TID(an, bf->bf_tidno);
279 */ 271 hdr->seq_ctrl = cpu_to_le16(tid->seq_next <<
280 tid = ATH_AN_2_TID(an, bf->bf_tidno); 272 IEEE80211_SEQ_SEQ_SHIFT);
281 hdr->seq_ctrl = cpu_to_le16(tid->seq_next << 273 bf->bf_seqno = tid->seq_next;
282 IEEE80211_SEQ_SEQ_SHIFT); 274 INCR(tid->seq_next, IEEE80211_SEQ_MAX);
283 bf->bf_seqno = tid->seq_next;
284 INCR(tid->seq_next, IEEE80211_SEQ_MAX);
285 }
286} 275}
287 276
288static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb, 277static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb,
@@ -1718,11 +1707,10 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
1718 1707
1719 /* Assign seqno, tidno */ 1708 /* Assign seqno, tidno */
1720 1709
1721 if (bf_isht(bf) && (sc->sc_flags & SC_OP_TXAGGR)) 1710 if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR))
1722 assign_aggr_tid_seqno(skb, bf); 1711 assign_aggr_tid_seqno(skb, bf);
1723 1712
1724 /* DMA setup */ 1713 /* DMA setup */
1725
1726 bf->bf_mpdu = skb; 1714 bf->bf_mpdu = skb;
1727 1715
1728 bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, 1716 bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data,
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 7b31a327b24a..c788bad10661 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3261,7 +3261,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan)
3261 struct b43_wldev *down_dev; 3261 struct b43_wldev *down_dev;
3262 struct b43_wldev *d; 3262 struct b43_wldev *d;
3263 int err; 3263 int err;
3264 bool gmode; 3264 bool uninitialized_var(gmode);
3265 int prev_status; 3265 int prev_status;
3266 3266
3267 /* Find a device and PHY which supports the band. */ 3267 /* Find a device and PHY which supports the band. */
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index c1324e31d2f6..fb996c27a19b 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2465,7 +2465,7 @@ static void b43legacy_put_phy_into_reset(struct b43legacy_wldev *dev)
2465static int b43legacy_switch_phymode(struct b43legacy_wl *wl, 2465static int b43legacy_switch_phymode(struct b43legacy_wl *wl,
2466 unsigned int new_mode) 2466 unsigned int new_mode)
2467{ 2467{
2468 struct b43legacy_wldev *up_dev; 2468 struct b43legacy_wldev *uninitialized_var(up_dev);
2469 struct b43legacy_wldev *down_dev; 2469 struct b43legacy_wldev *down_dev;
2470 int err; 2470 int err;
2471 bool gmode = 0; 2471 bool gmode = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 8fdb34222c0a..45cfa1cf194a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2219,7 +2219,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
2219 /* set tx power value for all OFDM rates */ 2219 /* set tx power value for all OFDM rates */
2220 for (rate_index = 0; rate_index < IWL_OFDM_RATES; 2220 for (rate_index = 0; rate_index < IWL_OFDM_RATES;
2221 rate_index++) { 2221 rate_index++) {
2222 s32 power_idx; 2222 s32 uninitialized_var(power_idx);
2223 int rc; 2223 int rc;
2224 2224
2225 /* use channel group's clip-power table, 2225 /* use channel group's clip-power table,
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 52966ffbef6e..ba997204c8d4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -255,7 +255,7 @@ struct iwl_cmd_header {
255 * 0x3) 54 Mbps 255 * 0x3) 54 Mbps
256 * 256 *
257 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 257 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
258 * 3-0: 10) 1 Mbps 258 * 6-0: 10) 1 Mbps
259 * 20) 2 Mbps 259 * 20) 2 Mbps
260 * 55) 5.5 Mbps 260 * 55) 5.5 Mbps
261 * 110) 11 Mbps 261 * 110) 11 Mbps
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index 01a2169cecec..8c71ad4f88c5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -51,6 +51,7 @@ const char *get_cmd_string(u8 cmd)
51 IWL_CMD(REPLY_REMOVE_STA); 51 IWL_CMD(REPLY_REMOVE_STA);
52 IWL_CMD(REPLY_REMOVE_ALL_STA); 52 IWL_CMD(REPLY_REMOVE_ALL_STA);
53 IWL_CMD(REPLY_WEPKEY); 53 IWL_CMD(REPLY_WEPKEY);
54 IWL_CMD(REPLY_3945_RX);
54 IWL_CMD(REPLY_TX); 55 IWL_CMD(REPLY_TX);
55 IWL_CMD(REPLY_RATE_SCALE); 56 IWL_CMD(REPLY_RATE_SCALE);
56 IWL_CMD(REPLY_LEDS_CMD); 57 IWL_CMD(REPLY_LEDS_CMD);
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index d1fc305de5fe..e7289e2e7f16 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -206,7 +206,7 @@ static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
206 * there are no buffered multicast frames to send 206 * there are no buffered multicast frames to send
207 */ 207 */
208 ieee80211_stop_queues(priv->hw); 208 ieee80211_stop_queues(priv->hw);
209 return 0; 209 return NETDEV_TX_OK;
210} 210}
211 211
212static void lbtf_tx_work(struct work_struct *work) 212static void lbtf_tx_work(struct work_struct *work)
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
index bc84e2792f8a..c3bb85e0251e 100644
--- a/drivers/net/wireless/orinoco/orinoco.c
+++ b/drivers/net/wireless/orinoco/orinoco.c
@@ -1610,6 +1610,16 @@ static void orinoco_rx_isr_tasklet(unsigned long data)
1610 struct orinoco_rx_data *rx_data, *temp; 1610 struct orinoco_rx_data *rx_data, *temp;
1611 struct hermes_rx_descriptor *desc; 1611 struct hermes_rx_descriptor *desc;
1612 struct sk_buff *skb; 1612 struct sk_buff *skb;
1613 unsigned long flags;
1614
1615 /* orinoco_rx requires the driver lock, and we also need to
1616 * protect priv->rx_list, so just hold the lock over the
1617 * lot.
1618 *
1619 * If orinoco_lock fails, we've unplugged the card. In this
1620 * case just abort. */
1621 if (orinoco_lock(priv, &flags) != 0)
1622 return;
1613 1623
1614 /* extract desc and skb from queue */ 1624 /* extract desc and skb from queue */
1615 list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { 1625 list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
@@ -1622,6 +1632,8 @@ static void orinoco_rx_isr_tasklet(unsigned long data)
1622 1632
1623 kfree(desc); 1633 kfree(desc);
1624 } 1634 }
1635
1636 orinoco_unlock(priv, &flags);
1625} 1637}
1626 1638
1627/********************************************************************/ 1639/********************************************************************/
@@ -3645,12 +3657,22 @@ struct net_device
3645void free_orinocodev(struct net_device *dev) 3657void free_orinocodev(struct net_device *dev)
3646{ 3658{
3647 struct orinoco_private *priv = netdev_priv(dev); 3659 struct orinoco_private *priv = netdev_priv(dev);
3660 struct orinoco_rx_data *rx_data, *temp;
3648 3661
3649 /* No need to empty priv->rx_list: if the tasklet is scheduled 3662 /* If the tasklet is scheduled when we call tasklet_kill it
3650 * when we call tasklet_kill it will run one final time, 3663 * will run one final time. However the tasklet will only
3651 * emptying the list */ 3664 * drain priv->rx_list if the hw is still available. */
3652 tasklet_kill(&priv->rx_tasklet); 3665 tasklet_kill(&priv->rx_tasklet);
3653 3666
3667 /* Explicitly drain priv->rx_list */
3668 list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
3669 list_del(&rx_data->list);
3670
3671 dev_kfree_skb(rx_data->skb);
3672 kfree(rx_data->desc);
3673 kfree(rx_data);
3674 }
3675
3654 unregister_pm_notifier(&priv->pm_notifier); 3676 unregister_pm_notifier(&priv->pm_notifier);
3655 orinoco_uncache_fw(priv); 3677 orinoco_uncache_fw(priv);
3656 3678
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index f127602670ec..0b32215d3f5d 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -435,6 +435,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
435 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ 435 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */
436 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ 436 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */
437 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ 437 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */
438 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0003), /* ARtem Onair Comcard 11 */
438 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ 439 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */
439 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ 440 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */
440 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ 441 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 82354b974a04..c6a370fa9bcb 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -138,6 +138,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
138 u8 *fw_version = NULL; 138 u8 *fw_version = NULL;
139 size_t len; 139 size_t len;
140 int i; 140 int i;
141 int maxlen;
141 142
142 if (priv->rx_start) 143 if (priv->rx_start)
143 return 0; 144 return 0;
@@ -195,6 +196,16 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
195 else 196 else
196 priv->rx_mtu = (size_t) 197 priv->rx_mtu = (size_t)
197 0x620 - priv->tx_hdr_len; 198 0x620 - priv->tx_hdr_len;
199 maxlen = priv->tx_hdr_len + /* USB devices */
200 sizeof(struct p54_rx_data) +
201 4 + /* rx alignment */
202 IEEE80211_MAX_FRAG_THRESHOLD;
203 if (priv->rx_mtu > maxlen && PAGE_SIZE == 4096) {
204 printk(KERN_INFO "p54: rx_mtu reduced from %d "
205 "to %d\n", priv->rx_mtu,
206 maxlen);
207 priv->rx_mtu = maxlen;
208 }
198 break; 209 break;
199 } 210 }
200 case BR_CODE_EXPOSED_IF: 211 case BR_CODE_EXPOSED_IF:
@@ -575,6 +586,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
575 u16 freq = le16_to_cpu(hdr->freq); 586 u16 freq = le16_to_cpu(hdr->freq);
576 size_t header_len = sizeof(*hdr); 587 size_t header_len = sizeof(*hdr);
577 u32 tsf32; 588 u32 tsf32;
589 u8 rate = hdr->rate & 0xf;
578 590
579 /* 591 /*
580 * If the device is in a unspecified state we have to 592 * If the device is in a unspecified state we have to
@@ -603,8 +615,11 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
603 rx_status.qual = (100 * hdr->rssi) / 127; 615 rx_status.qual = (100 * hdr->rssi) / 127;
604 if (hdr->rate & 0x10) 616 if (hdr->rate & 0x10)
605 rx_status.flag |= RX_FLAG_SHORTPRE; 617 rx_status.flag |= RX_FLAG_SHORTPRE;
606 rx_status.rate_idx = (dev->conf.channel->band == IEEE80211_BAND_2GHZ ? 618 if (dev->conf.channel->band == IEEE80211_BAND_5GHZ)
607 hdr->rate : (hdr->rate - 4)) & 0xf; 619 rx_status.rate_idx = (rate < 4) ? 0 : rate - 4;
620 else
621 rx_status.rate_idx = rate;
622
608 rx_status.freq = freq; 623 rx_status.freq = freq;
609 rx_status.band = dev->conf.channel->band; 624 rx_status.band = dev->conf.channel->band;
610 rx_status.antenna = hdr->antenna; 625 rx_status.antenna = hdr->antenna;
@@ -798,6 +813,16 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
798 info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 813 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
799 info->status.ack_signal = p54_rssi_to_dbm(dev, 814 info->status.ack_signal = p54_rssi_to_dbm(dev,
800 (int)payload->ack_rssi); 815 (int)payload->ack_rssi);
816
817 if (entry_data->key_type == P54_CRYPTO_TKIPMICHAEL) {
818 u8 *iv = (u8 *)(entry_data->align + pad +
819 entry_data->crypt_offset);
820
821 /* Restore the original TKIP IV. */
822 iv[2] = iv[0];
823 iv[0] = iv[1];
824 iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */
825 }
801 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 826 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
802 ieee80211_tx_status_irqsafe(dev, entry); 827 ieee80211_tx_status_irqsafe(dev, entry);
803 goto out; 828 goto out;
@@ -1383,7 +1408,6 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1383 hdr->tries = ridx; 1408 hdr->tries = ridx;
1384 txhdr->rts_rate_idx = 0; 1409 txhdr->rts_rate_idx = 0;
1385 if (info->control.hw_key) { 1410 if (info->control.hw_key) {
1386 crypt_offset += info->control.hw_key->iv_len;
1387 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); 1411 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg);
1388 txhdr->key_len = min((u8)16, info->control.hw_key->keylen); 1412 txhdr->key_len = min((u8)16, info->control.hw_key->keylen);
1389 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); 1413 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len);
@@ -1397,6 +1421,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1397 } 1421 }
1398 /* reserve some space for ICV */ 1422 /* reserve some space for ICV */
1399 len += info->control.hw_key->icv_len; 1423 len += info->control.hw_key->icv_len;
1424 memset(skb_put(skb, info->control.hw_key->icv_len), 0,
1425 info->control.hw_key->icv_len);
1400 } else { 1426 } else {
1401 txhdr->key_type = 0; 1427 txhdr->key_type = 0;
1402 txhdr->key_len = 0; 1428 txhdr->key_len = 0;
@@ -1824,7 +1850,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
1824 1850
1825static int p54_config(struct ieee80211_hw *dev, u32 changed) 1851static int p54_config(struct ieee80211_hw *dev, u32 changed)
1826{ 1852{
1827 int ret; 1853 int ret = 0;
1828 struct p54_common *priv = dev->priv; 1854 struct p54_common *priv = dev->priv;
1829 struct ieee80211_conf *conf = &dev->conf; 1855 struct ieee80211_conf *conf = &dev->conf;
1830 1856
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index c44a200059d2..6a6a72f6f82c 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -56,6 +56,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
56 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ 56 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
57 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ 57 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
58 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ 58 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
59 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
59 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 60 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
60 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 61 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
61 {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ 62 {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */
@@ -284,6 +285,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb)
284 usb_fill_bulk_urb(data_urb, priv->udev, 285 usb_fill_bulk_urb(data_urb, priv->udev,
285 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 286 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
286 skb->data, skb->len, p54u_tx_cb, skb); 287 skb->data, skb->len, p54u_tx_cb, skb);
288 data_urb->transfer_flags |= URB_ZERO_PACKET;
287 289
288 usb_anchor_urb(data_urb, &priv->submitted); 290 usb_anchor_urb(data_urb, &priv->submitted);
289 if (usb_submit_urb(data_urb, GFP_ATOMIC)) { 291 if (usb_submit_urb(data_urb, GFP_ATOMIC)) {
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 30028e2422fc..af6b5847be5c 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -38,7 +38,7 @@
38/* 38/*
39 * Allow hardware encryption to be disabled. 39 * Allow hardware encryption to be disabled.
40 */ 40 */
41static int modparam_nohwcrypt = 1; 41static int modparam_nohwcrypt = 0;
42module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); 42module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
43MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 43MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
44 44
@@ -376,11 +376,11 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
376 376
377 /* 377 /*
378 * The driver does not support the IV/EIV generation 378 * The driver does not support the IV/EIV generation
379 * in hardware. However it doesn't support the IV/EIV 379 * in hardware. However it demands the data to be provided
380 * inside the ieee80211 frame either, but requires it 380 * both seperately as well as inside the frame.
381 * to be provided seperately for the descriptor. 381 * We already provided the CONFIG_CRYPTO_COPY_IV to rt2x00lib
382 * rt2x00lib will cut the IV/EIV data out of all frames 382 * to ensure rt2x00lib will not strip the data from the
383 * given to us by mac80211, but we must tell mac80211 383 * frame after the copy, now we must tell mac80211
384 * to generate the IV/EIV data. 384 * to generate the IV/EIV data.
385 */ 385 */
386 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 386 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
@@ -1181,7 +1181,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1181 test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); 1181 test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags));
1182 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); 1182 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
1183 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); 1183 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len);
1184 rt2x00_set_field32(&word, TXD_W0_CIPHER, txdesc->cipher); 1184 rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher);
1185 rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); 1185 rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx);
1186 rt2x00_desc_write(txd, 0, word); 1186 rt2x00_desc_write(txd, 0, word);
1187} 1187}
@@ -1334,14 +1334,7 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1334 1334
1335 /* ICV is located at the end of frame */ 1335 /* ICV is located at the end of frame */
1336 1336
1337 /* 1337 rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
1338 * Hardware has stripped IV/EIV data from 802.11 frame during
1339 * decryption. It has provided the data seperately but rt2x00lib
1340 * should decide if it should be reinserted.
1341 */
1342 rxdesc->flags |= RX_FLAG_IV_STRIPPED;
1343 if (rxdesc->cipher != CIPHER_TKIP)
1344 rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
1345 if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) 1338 if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
1346 rxdesc->flags |= RX_FLAG_DECRYPTED; 1339 rxdesc->flags |= RX_FLAG_DECRYPTED;
1347 else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) 1340 else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 6d92542fcf0d..87c0f2c83077 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -807,13 +807,11 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry,
807{ 807{
808 entry->flags = 0; 808 entry->flags = 0;
809 entry->bitrate = rate->bitrate; 809 entry->bitrate = rate->bitrate;
810 entry->hw_value = rt2x00_create_rate_hw_value(index, 0); 810 entry->hw_value =index;
811 entry->hw_value_short = entry->hw_value; 811 entry->hw_value_short = index;
812 812
813 if (rate->flags & DEV_RATE_SHORT_PREAMBLE) { 813 if (rate->flags & DEV_RATE_SHORT_PREAMBLE)
814 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; 814 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
815 entry->hw_value_short |= rt2x00_create_rate_hw_value(index, 1);
816 }
817} 815}
818 816
819static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, 817static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.c b/drivers/net/wireless/rt2x00/rt2x00leds.c
index 68f4e0fc35b9..a0cd35b6beb5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00leds.c
+++ b/drivers/net/wireless/rt2x00/rt2x00leds.c
@@ -97,7 +97,7 @@ void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled)
97 97
98void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) 98void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled)
99{ 99{
100 if (rt2x00dev->led_radio.type == LED_TYPE_ASSOC) 100 if (rt2x00dev->led_radio.type == LED_TYPE_RADIO)
101 rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); 101 rt2x00led_led_simple(&rt2x00dev->led_radio, enabled);
102} 102}
103 103
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 03024327767b..86cd26fbf769 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -52,22 +52,11 @@ struct rt2x00_rate {
52 52
53extern const struct rt2x00_rate rt2x00_supported_rates[12]; 53extern const struct rt2x00_rate rt2x00_supported_rates[12];
54 54
55static inline u16 rt2x00_create_rate_hw_value(const u16 index,
56 const u16 short_preamble)
57{
58 return (short_preamble << 8) | (index & 0xff);
59}
60
61static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) 55static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
62{ 56{
63 return &rt2x00_supported_rates[hw_value & 0xff]; 57 return &rt2x00_supported_rates[hw_value & 0xff];
64} 58}
65 59
66static inline int rt2x00_get_rate_preamble(const u16 hw_value)
67{
68 return (hw_value & 0xff00);
69}
70
71/* 60/*
72 * Radio control handlers. 61 * Radio control handlers.
73 */ 62 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index eaec6bd93ed5..746a8f36b931 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -313,7 +313,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
313 * When preamble is enabled we should set the 313 * When preamble is enabled we should set the
314 * preamble bit for the signal. 314 * preamble bit for the signal.
315 */ 315 */
316 if (rt2x00_get_rate_preamble(rate->hw_value)) 316 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
317 txdesc->signal |= 0x08; 317 txdesc->signal |= 0x08;
318 } 318 }
319} 319}
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 83df312ac56f..0b29d767a258 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -434,11 +434,11 @@ static int rt2x00usb_find_endpoints(struct rt2x00_dev *rt2x00dev)
434 434
435 if (usb_endpoint_is_bulk_in(ep_desc)) { 435 if (usb_endpoint_is_bulk_in(ep_desc)) {
436 rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); 436 rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc);
437 } else if (usb_endpoint_is_bulk_out(ep_desc)) { 437 } else if (usb_endpoint_is_bulk_out(ep_desc) &&
438 (queue != queue_end(rt2x00dev))) {
438 rt2x00usb_assign_endpoint(queue, ep_desc); 439 rt2x00usb_assign_endpoint(queue, ep_desc);
440 queue = queue_next(queue);
439 441
440 if (queue != queue_end(rt2x00dev))
441 queue = queue_next(queue);
442 tx_ep_desc = ep_desc; 442 tx_ep_desc = ep_desc;
443 } 443 }
444 } 444 }
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index d638a8a59370..96a8d69f8790 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2321,6 +2321,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2321 /* Linksys */ 2321 /* Linksys */
2322 { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, 2322 { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) },
2323 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, 2323 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) },
2324 { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) },
2324 /* MSI */ 2325 /* MSI */
2325 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, 2326 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) },
2326 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, 2327 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
index 5f887fb137a9..387c133ec0f2 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
@@ -897,6 +897,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,
897 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 897 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
898 IEEE80211_HW_RX_INCLUDES_FCS | 898 IEEE80211_HW_RX_INCLUDES_FCS |
899 IEEE80211_HW_SIGNAL_UNSPEC; 899 IEEE80211_HW_SIGNAL_UNSPEC;
900 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
900 dev->queues = 1; 901 dev->queues = 1;
901 dev->max_signal = 65; 902 dev->max_signal = 65;
902 903
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 00ce3ef39abe..6ad6bac37706 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -213,7 +213,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
213 urb = usb_alloc_urb(0, GFP_ATOMIC); 213 urb = usb_alloc_urb(0, GFP_ATOMIC);
214 if (!urb) { 214 if (!urb) {
215 kfree_skb(skb); 215 kfree_skb(skb);
216 return -ENOMEM; 216 return NETDEV_TX_OK;
217 } 217 }
218 218
219 flags = skb->len; 219 flags = skb->len;
@@ -281,7 +281,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
281 } 281 }
282 usb_free_urb(urb); 282 usb_free_urb(urb);
283 283
284 return rc; 284 return NETDEV_TX_OK;
285} 285}
286 286
287static void rtl8187_rx_cb(struct urb *urb) 287static void rtl8187_rx_cb(struct urb *urb)
@@ -1471,6 +1471,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf)
1471 ieee80211_unregister_hw(dev); 1471 ieee80211_unregister_hw(dev);
1472 1472
1473 priv = dev->priv; 1473 priv = dev->priv;
1474 usb_reset_device(priv->udev);
1474 usb_put_dev(interface_to_usbdev(intf)); 1475 usb_put_dev(interface_to_usbdev(intf));
1475 ieee80211_free_hw(dev); 1476 ieee80211_free_hw(dev);
1476} 1477}
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index e1b0ad6e918f..fa65a2b2ae2e 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -66,4 +66,23 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
66} 66}
67EXPORT_SYMBOL(of_register_i2c_devices); 67EXPORT_SYMBOL(of_register_i2c_devices);
68 68
69static int of_dev_node_match(struct device *dev, void *data)
70{
71 return dev_archdata_get_node(&dev->archdata) == data;
72}
73
74/* must call put_device() when done with returned i2c_client device */
75struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
76{
77 struct device *dev;
78
79 dev = bus_find_device(&i2c_bus_type, NULL, node,
80 of_dev_node_match);
81 if (!dev)
82 return NULL;
83
84 return to_i2c_client(dev);
85}
86EXPORT_SYMBOL(of_find_i2c_device_by_node);
87
69MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index f09b1010d477..803d9ddd6e75 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -266,6 +266,8 @@ static int detect_ejectable_slots(struct pci_bus *pbus)
266 int found = acpi_pci_detect_ejectable(pbus); 266 int found = acpi_pci_detect_ejectable(pbus);
267 if (!found) { 267 if (!found) {
268 acpi_handle bridge_handle = acpi_pci_get_bridge_handle(pbus); 268 acpi_handle bridge_handle = acpi_pci_get_bridge_handle(pbus);
269 if (!bridge_handle)
270 return 0;
269 acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, (u32)1, 271 acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, (u32)1,
270 is_pci_dock_device, (void *)&found, NULL); 272 is_pci_dock_device, (void *)&found, NULL);
271 } 273 }
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c12f6c790698..e491fdedf705 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1260,15 +1260,14 @@ void pci_pm_init(struct pci_dev *dev)
1260 /* find PCI PM capability in list */ 1260 /* find PCI PM capability in list */
1261 pm = pci_find_capability(dev, PCI_CAP_ID_PM); 1261 pm = pci_find_capability(dev, PCI_CAP_ID_PM);
1262 if (!pm) 1262 if (!pm)
1263 goto Exit; 1263 return;
1264
1265 /* Check device's ability to generate PME# */ 1264 /* Check device's ability to generate PME# */
1266 pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc); 1265 pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc);
1267 1266
1268 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { 1267 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
1269 dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n", 1268 dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n",
1270 pmc & PCI_PM_CAP_VER_MASK); 1269 pmc & PCI_PM_CAP_VER_MASK);
1271 goto Exit; 1270 return;
1272 } 1271 }
1273 1272
1274 dev->pm_cap = pm; 1273 dev->pm_cap = pm;
@@ -1307,9 +1306,6 @@ void pci_pm_init(struct pci_dev *dev)
1307 } else { 1306 } else {
1308 dev->pme_support = 0; 1307 dev->pme_support = 0;
1309 } 1308 }
1310
1311 Exit:
1312 pci_update_current_state(dev, PCI_D0);
1313} 1309}
1314 1310
1315/** 1311/**
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index 645d7a60e412..ec22284eed30 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -14,10 +14,8 @@
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include "pci.h" 15#include "pci.h"
16 16
17asmlinkage long 17SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
18sys_pciconfig_read(unsigned long bus, unsigned long dfn, 18 unsigned long, off, unsigned long, len, void __user *, buf)
19 unsigned long off, unsigned long len,
20 void __user *buf)
21{ 19{
22 struct pci_dev *dev; 20 struct pci_dev *dev;
23 u8 byte; 21 u8 byte;
@@ -86,10 +84,8 @@ error:
86 return err; 84 return err;
87} 85}
88 86
89asmlinkage long 87SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
90sys_pciconfig_write(unsigned long bus, unsigned long dfn, 88 unsigned long, off, unsigned long, len, void __user *, buf)
91 unsigned long off, unsigned long len,
92 void __user *buf)
93{ 89{
94 struct pci_dev *dev; 90 struct pci_dev *dev;
95 u8 byte; 91 u8 byte;
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index a34284b1482a..d187ba4c5e0e 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -297,7 +297,7 @@ static int __devinit electra_cf_probe(struct of_device *ofdev,
297 goto fail3; 297 goto fail3;
298 } 298 }
299 299
300 dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n", 300 dev_info(device, "at mem 0x%lx io 0x%llx irq %d\n",
301 cf->mem_phys, io.start, cf->irq); 301 cf->mem_phys, io.start, cf->irq);
302 302
303 cf->active = 1; 303 cf->active = 1;
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index e65448e99b48..1a266d4ab5f1 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -54,6 +54,18 @@ config ASUS_LAPTOP
54 54
55 If you have an ACPI-compatible ASUS laptop, say Y or M here. 55 If you have an ACPI-compatible ASUS laptop, say Y or M here.
56 56
57config DELL_LAPTOP
58 tristate "Dell Laptop Extras (EXPERIMENTAL)"
59 depends on X86
60 depends on DCDBAS
61 depends on EXPERIMENTAL
62 depends on BACKLIGHT_CLASS_DEVICE
63 depends on RFKILL
64 default n
65 ---help---
66 This driver adds support for rfkill and backlight control to Dell
67 laptops.
68
57config FUJITSU_LAPTOP 69config FUJITSU_LAPTOP
58 tristate "Fujitsu Laptop Extras" 70 tristate "Fujitsu Laptop Extras"
59 depends on ACPI 71 depends on ACPI
@@ -192,6 +204,17 @@ config THINKPAD_ACPI
192 204
193 If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. 205 If you have an IBM or Lenovo ThinkPad laptop, say Y or M here.
194 206
207config THINKPAD_ACPI_DEBUGFACILITIES
208 bool "Maintainer debug facilities"
209 depends on THINKPAD_ACPI
210 default n
211 ---help---
212 Enables extra stuff in the thinkpad-acpi which is completely useless
213 for normal use. Read the driver source to find out what it does.
214
215 Say N here, unless you were told by a kernel maintainer to do
216 otherwise.
217
195config THINKPAD_ACPI_DEBUG 218config THINKPAD_ACPI_DEBUG
196 bool "Verbose debug mode" 219 bool "Verbose debug mode"
197 depends on THINKPAD_ACPI 220 depends on THINKPAD_ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 1e9de2ae0de5..e29065120be9 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
6obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o 6obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
7obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 7obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
8obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o 8obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
9obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
9obj-$(CONFIG_ACER_WMI) += acer-wmi.o 10obj-$(CONFIG_ACER_WMI) += acer-wmi.o
10obj-$(CONFIG_HP_WMI) += hp-wmi.o 11obj-$(CONFIG_HP_WMI) += hp-wmi.o
11obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o 12obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
diff --git a/drivers/misc/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 4d33a2068b7a..16e11c2ee19a 100644
--- a/drivers/misc/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -22,7 +22,7 @@
22#include <linux/rfkill.h> 22#include <linux/rfkill.h>
23#include <linux/power_supply.h> 23#include <linux/power_supply.h>
24#include <linux/acpi.h> 24#include <linux/acpi.h>
25#include "../firmware/dcdbas.h" 25#include "../../firmware/dcdbas.h"
26 26
27#define BRIGHTNESS_TOKEN 0x7d 27#define BRIGHTNESS_TOKEN 0x7d
28 28
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 02fe2b8b8939..9d93cb971e59 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -90,7 +90,7 @@ enum {
90}; 90};
91 91
92static const char *cm_getv[] = { 92static const char *cm_getv[] = {
93 "WLDG", NULL, NULL, NULL, 93 "WLDG", "BTHG", NULL, NULL,
94 "CAMG", NULL, NULL, NULL, 94 "CAMG", NULL, NULL, NULL,
95 NULL, "PBLG", NULL, NULL, 95 NULL, "PBLG", NULL, NULL,
96 "CFVG", NULL, NULL, NULL, 96 "CFVG", NULL, NULL, NULL,
@@ -99,7 +99,7 @@ static const char *cm_getv[] = {
99}; 99};
100 100
101static const char *cm_setv[] = { 101static const char *cm_setv[] = {
102 "WLDS", NULL, NULL, NULL, 102 "WLDS", "BTHS", NULL, NULL,
103 "CAMS", NULL, NULL, NULL, 103 "CAMS", NULL, NULL, NULL,
104 "SDSP", "PBLS", "HDPS", NULL, 104 "SDSP", "PBLS", "HDPS", NULL,
105 "CFVS", NULL, NULL, NULL, 105 "CFVS", NULL, NULL, NULL,
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 3478453eba7a..bcbc05107ba8 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -21,7 +21,7 @@
21 * 02110-1301, USA. 21 * 02110-1301, USA.
22 */ 22 */
23 23
24#define TPACPI_VERSION "0.21" 24#define TPACPI_VERSION "0.22"
25#define TPACPI_SYSFS_VERSION 0x020200 25#define TPACPI_SYSFS_VERSION 0x020200
26 26
27/* 27/*
@@ -122,6 +122,27 @@ enum {
122#define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */ 122#define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */
123#define TPACPI_HKEY_INPUT_VERSION 0x4101 123#define TPACPI_HKEY_INPUT_VERSION 0x4101
124 124
125/* ACPI \WGSV commands */
126enum {
127 TP_ACPI_WGSV_GET_STATE = 0x01, /* Get state information */
128 TP_ACPI_WGSV_PWR_ON_ON_RESUME = 0x02, /* Resume WWAN powered on */
129 TP_ACPI_WGSV_PWR_OFF_ON_RESUME = 0x03, /* Resume WWAN powered off */
130 TP_ACPI_WGSV_SAVE_STATE = 0x04, /* Save state for S4/S5 */
131};
132
133/* TP_ACPI_WGSV_GET_STATE bits */
134enum {
135 TP_ACPI_WGSV_STATE_WWANEXIST = 0x0001, /* WWAN hw available */
136 TP_ACPI_WGSV_STATE_WWANPWR = 0x0002, /* WWAN radio enabled */
137 TP_ACPI_WGSV_STATE_WWANPWRRES = 0x0004, /* WWAN state at resume */
138 TP_ACPI_WGSV_STATE_WWANBIOSOFF = 0x0008, /* WWAN disabled in BIOS */
139 TP_ACPI_WGSV_STATE_BLTHEXIST = 0x0001, /* BLTH hw available */
140 TP_ACPI_WGSV_STATE_BLTHPWR = 0x0002, /* BLTH radio enabled */
141 TP_ACPI_WGSV_STATE_BLTHPWRRES = 0x0004, /* BLTH state at resume */
142 TP_ACPI_WGSV_STATE_BLTHBIOSOFF = 0x0008, /* BLTH disabled in BIOS */
143 TP_ACPI_WGSV_STATE_UWBEXIST = 0x0010, /* UWB hw available */
144 TP_ACPI_WGSV_STATE_UWBPWR = 0x0020, /* UWB radio enabled */
145};
125 146
126/**************************************************************************** 147/****************************************************************************
127 * Main driver 148 * Main driver
@@ -148,14 +169,17 @@ enum {
148enum { 169enum {
149 TPACPI_RFK_BLUETOOTH_SW_ID = 0, 170 TPACPI_RFK_BLUETOOTH_SW_ID = 0,
150 TPACPI_RFK_WWAN_SW_ID, 171 TPACPI_RFK_WWAN_SW_ID,
172 TPACPI_RFK_UWB_SW_ID,
151}; 173};
152 174
153/* Debugging */ 175/* Debugging */
154#define TPACPI_LOG TPACPI_FILE ": " 176#define TPACPI_LOG TPACPI_FILE ": "
155#define TPACPI_ERR KERN_ERR TPACPI_LOG 177#define TPACPI_ALERT KERN_ALERT TPACPI_LOG
156#define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG 178#define TPACPI_CRIT KERN_CRIT TPACPI_LOG
157#define TPACPI_INFO KERN_INFO TPACPI_LOG 179#define TPACPI_ERR KERN_ERR TPACPI_LOG
158#define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG 180#define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG
181#define TPACPI_INFO KERN_INFO TPACPI_LOG
182#define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG
159 183
160#define TPACPI_DBG_ALL 0xffff 184#define TPACPI_DBG_ALL 0xffff
161#define TPACPI_DBG_INIT 0x0001 185#define TPACPI_DBG_INIT 0x0001
@@ -201,6 +225,7 @@ struct ibm_struct {
201 void (*exit) (void); 225 void (*exit) (void);
202 void (*resume) (void); 226 void (*resume) (void);
203 void (*suspend) (pm_message_t state); 227 void (*suspend) (pm_message_t state);
228 void (*shutdown) (void);
204 229
205 struct list_head all_drivers; 230 struct list_head all_drivers;
206 231
@@ -239,6 +264,7 @@ static struct {
239 u32 bright_16levels:1; 264 u32 bright_16levels:1;
240 u32 bright_acpimode:1; 265 u32 bright_acpimode:1;
241 u32 wan:1; 266 u32 wan:1;
267 u32 uwb:1;
242 u32 fan_ctrl_status_undef:1; 268 u32 fan_ctrl_status_undef:1;
243 u32 input_device_registered:1; 269 u32 input_device_registered:1;
244 u32 platform_drv_registered:1; 270 u32 platform_drv_registered:1;
@@ -288,6 +314,18 @@ struct tpacpi_led_classdev {
288 unsigned int led; 314 unsigned int led;
289}; 315};
290 316
317#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
318static int dbg_wlswemul;
319static int tpacpi_wlsw_emulstate;
320static int dbg_bluetoothemul;
321static int tpacpi_bluetooth_emulstate;
322static int dbg_wwanemul;
323static int tpacpi_wwan_emulstate;
324static int dbg_uwbemul;
325static int tpacpi_uwb_emulstate;
326#endif
327
328
291/**************************************************************************** 329/****************************************************************************
292 **************************************************************************** 330 ****************************************************************************
293 * 331 *
@@ -728,6 +766,18 @@ static int tpacpi_resume_handler(struct platform_device *pdev)
728 return 0; 766 return 0;
729} 767}
730 768
769static void tpacpi_shutdown_handler(struct platform_device *pdev)
770{
771 struct ibm_struct *ibm, *itmp;
772
773 list_for_each_entry_safe(ibm, itmp,
774 &tpacpi_all_drivers,
775 all_drivers) {
776 if (ibm->shutdown)
777 (ibm->shutdown)();
778 }
779}
780
731static struct platform_driver tpacpi_pdriver = { 781static struct platform_driver tpacpi_pdriver = {
732 .driver = { 782 .driver = {
733 .name = TPACPI_DRVR_NAME, 783 .name = TPACPI_DRVR_NAME,
@@ -735,6 +785,7 @@ static struct platform_driver tpacpi_pdriver = {
735 }, 785 },
736 .suspend = tpacpi_suspend_handler, 786 .suspend = tpacpi_suspend_handler,
737 .resume = tpacpi_resume_handler, 787 .resume = tpacpi_resume_handler,
788 .shutdown = tpacpi_shutdown_handler,
738}; 789};
739 790
740static struct platform_driver tpacpi_hwmon_pdriver = { 791static struct platform_driver tpacpi_hwmon_pdriver = {
@@ -922,11 +973,27 @@ static int __init tpacpi_new_rfkill(const unsigned int id,
922 struct rfkill **rfk, 973 struct rfkill **rfk,
923 const enum rfkill_type rfktype, 974 const enum rfkill_type rfktype,
924 const char *name, 975 const char *name,
976 const bool set_default,
925 int (*toggle_radio)(void *, enum rfkill_state), 977 int (*toggle_radio)(void *, enum rfkill_state),
926 int (*get_state)(void *, enum rfkill_state *)) 978 int (*get_state)(void *, enum rfkill_state *))
927{ 979{
928 int res; 980 int res;
929 enum rfkill_state initial_state; 981 enum rfkill_state initial_state = RFKILL_STATE_SOFT_BLOCKED;
982
983 res = get_state(NULL, &initial_state);
984 if (res < 0) {
985 printk(TPACPI_ERR
986 "failed to read initial state for %s, error %d; "
987 "will turn radio off\n", name, res);
988 } else if (set_default) {
989 /* try to set the initial state as the default for the rfkill
990 * type, since we ask the firmware to preserve it across S5 in
991 * NVRAM */
992 rfkill_set_default(rfktype,
993 (initial_state == RFKILL_STATE_UNBLOCKED) ?
994 RFKILL_STATE_UNBLOCKED :
995 RFKILL_STATE_SOFT_BLOCKED);
996 }
930 997
931 *rfk = rfkill_allocate(&tpacpi_pdev->dev, rfktype); 998 *rfk = rfkill_allocate(&tpacpi_pdev->dev, rfktype);
932 if (!*rfk) { 999 if (!*rfk) {
@@ -938,9 +1005,7 @@ static int __init tpacpi_new_rfkill(const unsigned int id,
938 (*rfk)->name = name; 1005 (*rfk)->name = name;
939 (*rfk)->get_state = get_state; 1006 (*rfk)->get_state = get_state;
940 (*rfk)->toggle_radio = toggle_radio; 1007 (*rfk)->toggle_radio = toggle_radio;
941 1008 (*rfk)->state = initial_state;
942 if (!get_state(NULL, &initial_state))
943 (*rfk)->state = initial_state;
944 1009
945 res = rfkill_register(*rfk); 1010 res = rfkill_register(*rfk);
946 if (res < 0) { 1011 if (res < 0) {
@@ -1006,6 +1071,119 @@ static DRIVER_ATTR(version, S_IRUGO,
1006 1071
1007/* --------------------------------------------------------------------- */ 1072/* --------------------------------------------------------------------- */
1008 1073
1074#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
1075
1076static void tpacpi_send_radiosw_update(void);
1077
1078/* wlsw_emulstate ------------------------------------------------------ */
1079static ssize_t tpacpi_driver_wlsw_emulstate_show(struct device_driver *drv,
1080 char *buf)
1081{
1082 return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wlsw_emulstate);
1083}
1084
1085static ssize_t tpacpi_driver_wlsw_emulstate_store(struct device_driver *drv,
1086 const char *buf, size_t count)
1087{
1088 unsigned long t;
1089
1090 if (parse_strtoul(buf, 1, &t))
1091 return -EINVAL;
1092
1093 if (tpacpi_wlsw_emulstate != t) {
1094 tpacpi_wlsw_emulstate = !!t;
1095 tpacpi_send_radiosw_update();
1096 } else
1097 tpacpi_wlsw_emulstate = !!t;
1098
1099 return count;
1100}
1101
1102static DRIVER_ATTR(wlsw_emulstate, S_IWUSR | S_IRUGO,
1103 tpacpi_driver_wlsw_emulstate_show,
1104 tpacpi_driver_wlsw_emulstate_store);
1105
1106/* bluetooth_emulstate ------------------------------------------------- */
1107static ssize_t tpacpi_driver_bluetooth_emulstate_show(
1108 struct device_driver *drv,
1109 char *buf)
1110{
1111 return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_bluetooth_emulstate);
1112}
1113
1114static ssize_t tpacpi_driver_bluetooth_emulstate_store(
1115 struct device_driver *drv,
1116 const char *buf, size_t count)
1117{
1118 unsigned long t;
1119
1120 if (parse_strtoul(buf, 1, &t))
1121 return -EINVAL;
1122
1123 tpacpi_bluetooth_emulstate = !!t;
1124
1125 return count;
1126}
1127
1128static DRIVER_ATTR(bluetooth_emulstate, S_IWUSR | S_IRUGO,
1129 tpacpi_driver_bluetooth_emulstate_show,
1130 tpacpi_driver_bluetooth_emulstate_store);
1131
1132/* wwan_emulstate ------------------------------------------------- */
1133static ssize_t tpacpi_driver_wwan_emulstate_show(
1134 struct device_driver *drv,
1135 char *buf)
1136{
1137 return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wwan_emulstate);
1138}
1139
1140static ssize_t tpacpi_driver_wwan_emulstate_store(
1141 struct device_driver *drv,
1142 const char *buf, size_t count)
1143{
1144 unsigned long t;
1145
1146 if (parse_strtoul(buf, 1, &t))
1147 return -EINVAL;
1148
1149 tpacpi_wwan_emulstate = !!t;
1150
1151 return count;
1152}
1153
1154static DRIVER_ATTR(wwan_emulstate, S_IWUSR | S_IRUGO,
1155 tpacpi_driver_wwan_emulstate_show,
1156 tpacpi_driver_wwan_emulstate_store);
1157
1158/* uwb_emulstate ------------------------------------------------- */
1159static ssize_t tpacpi_driver_uwb_emulstate_show(
1160 struct device_driver *drv,
1161 char *buf)
1162{
1163 return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_uwb_emulstate);
1164}
1165
1166static ssize_t tpacpi_driver_uwb_emulstate_store(
1167 struct device_driver *drv,
1168 const char *buf, size_t count)
1169{
1170 unsigned long t;
1171
1172 if (parse_strtoul(buf, 1, &t))
1173 return -EINVAL;
1174
1175 tpacpi_uwb_emulstate = !!t;
1176
1177 return count;
1178}
1179
1180static DRIVER_ATTR(uwb_emulstate, S_IWUSR | S_IRUGO,
1181 tpacpi_driver_uwb_emulstate_show,
1182 tpacpi_driver_uwb_emulstate_store);
1183#endif
1184
1185/* --------------------------------------------------------------------- */
1186
1009static struct driver_attribute *tpacpi_driver_attributes[] = { 1187static struct driver_attribute *tpacpi_driver_attributes[] = {
1010 &driver_attr_debug_level, &driver_attr_version, 1188 &driver_attr_debug_level, &driver_attr_version,
1011 &driver_attr_interface_version, 1189 &driver_attr_interface_version,
@@ -1022,6 +1200,17 @@ static int __init tpacpi_create_driver_attributes(struct device_driver *drv)
1022 i++; 1200 i++;
1023 } 1201 }
1024 1202
1203#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
1204 if (!res && dbg_wlswemul)
1205 res = driver_create_file(drv, &driver_attr_wlsw_emulstate);
1206 if (!res && dbg_bluetoothemul)
1207 res = driver_create_file(drv, &driver_attr_bluetooth_emulstate);
1208 if (!res && dbg_wwanemul)
1209 res = driver_create_file(drv, &driver_attr_wwan_emulstate);
1210 if (!res && dbg_uwbemul)
1211 res = driver_create_file(drv, &driver_attr_uwb_emulstate);
1212#endif
1213
1025 return res; 1214 return res;
1026} 1215}
1027 1216
@@ -1031,6 +1220,13 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv)
1031 1220
1032 for (i = 0; i < ARRAY_SIZE(tpacpi_driver_attributes); i++) 1221 for (i = 0; i < ARRAY_SIZE(tpacpi_driver_attributes); i++)
1033 driver_remove_file(drv, tpacpi_driver_attributes[i]); 1222 driver_remove_file(drv, tpacpi_driver_attributes[i]);
1223
1224#ifdef THINKPAD_ACPI_DEBUGFACILITIES
1225 driver_remove_file(drv, &driver_attr_wlsw_emulstate);
1226 driver_remove_file(drv, &driver_attr_bluetooth_emulstate);
1227 driver_remove_file(drv, &driver_attr_wwan_emulstate);
1228 driver_remove_file(drv, &driver_attr_uwb_emulstate);
1229#endif
1034} 1230}
1035 1231
1036/**************************************************************************** 1232/****************************************************************************
@@ -1216,6 +1412,12 @@ static struct attribute_set *hotkey_dev_attributes;
1216 1412
1217static int hotkey_get_wlsw(int *status) 1413static int hotkey_get_wlsw(int *status)
1218{ 1414{
1415#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
1416 if (dbg_wlswemul) {
1417 *status = !!tpacpi_wlsw_emulstate;
1418 return 0;
1419 }
1420#endif
1219 if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) 1421 if (!acpi_evalf(hkey_handle, status, "WLSW", "d"))
1220 return -EIO; 1422 return -EIO;
1221 return 0; 1423 return 0;
@@ -1678,7 +1880,7 @@ static ssize_t hotkey_mask_show(struct device *dev,
1678{ 1880{
1679 int res; 1881 int res;
1680 1882
1681 if (mutex_lock_interruptible(&hotkey_mutex)) 1883 if (mutex_lock_killable(&hotkey_mutex))
1682 return -ERESTARTSYS; 1884 return -ERESTARTSYS;
1683 res = hotkey_mask_get(); 1885 res = hotkey_mask_get();
1684 mutex_unlock(&hotkey_mutex); 1886 mutex_unlock(&hotkey_mutex);
@@ -1697,7 +1899,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
1697 if (parse_strtoul(buf, 0xffffffffUL, &t)) 1899 if (parse_strtoul(buf, 0xffffffffUL, &t))
1698 return -EINVAL; 1900 return -EINVAL;
1699 1901
1700 if (mutex_lock_interruptible(&hotkey_mutex)) 1902 if (mutex_lock_killable(&hotkey_mutex))
1701 return -ERESTARTSYS; 1903 return -ERESTARTSYS;
1702 1904
1703 res = hotkey_mask_set(t); 1905 res = hotkey_mask_set(t);
@@ -1783,7 +1985,7 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
1783 ((t & ~TPACPI_HKEY_NVRAM_KNOWN_MASK) != 0)) 1985 ((t & ~TPACPI_HKEY_NVRAM_KNOWN_MASK) != 0))
1784 return -EINVAL; 1986 return -EINVAL;
1785 1987
1786 if (mutex_lock_interruptible(&hotkey_mutex)) 1988 if (mutex_lock_killable(&hotkey_mutex))
1787 return -ERESTARTSYS; 1989 return -ERESTARTSYS;
1788 1990
1789 HOTKEY_CONFIG_CRITICAL_START 1991 HOTKEY_CONFIG_CRITICAL_START
@@ -1818,7 +2020,7 @@ static ssize_t hotkey_poll_freq_store(struct device *dev,
1818 if (parse_strtoul(buf, 25, &t)) 2020 if (parse_strtoul(buf, 25, &t))
1819 return -EINVAL; 2021 return -EINVAL;
1820 2022
1821 if (mutex_lock_interruptible(&hotkey_mutex)) 2023 if (mutex_lock_killable(&hotkey_mutex))
1822 return -ERESTARTSYS; 2024 return -ERESTARTSYS;
1823 2025
1824 hotkey_poll_freq = t; 2026 hotkey_poll_freq = t;
@@ -1958,6 +2160,7 @@ static struct attribute *hotkey_mask_attributes[] __initdata = {
1958 2160
1959static void bluetooth_update_rfk(void); 2161static void bluetooth_update_rfk(void);
1960static void wan_update_rfk(void); 2162static void wan_update_rfk(void);
2163static void uwb_update_rfk(void);
1961static void tpacpi_send_radiosw_update(void) 2164static void tpacpi_send_radiosw_update(void)
1962{ 2165{
1963 int wlsw; 2166 int wlsw;
@@ -1967,6 +2170,8 @@ static void tpacpi_send_radiosw_update(void)
1967 bluetooth_update_rfk(); 2170 bluetooth_update_rfk();
1968 if (tp_features.wan) 2171 if (tp_features.wan)
1969 wan_update_rfk(); 2172 wan_update_rfk();
2173 if (tp_features.uwb)
2174 uwb_update_rfk();
1970 2175
1971 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { 2176 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1972 mutex_lock(&tpacpi_inputdev_send_mutex); 2177 mutex_lock(&tpacpi_inputdev_send_mutex);
@@ -2222,6 +2427,13 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2222 hotkey_source_mask, hotkey_poll_freq); 2427 hotkey_source_mask, hotkey_poll_freq);
2223#endif 2428#endif
2224 2429
2430#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
2431 if (dbg_wlswemul) {
2432 tp_features.hotkey_wlsw = 1;
2433 printk(TPACPI_INFO
2434 "radio switch emulation enabled\n");
2435 } else
2436#endif
2225 /* Not all thinkpads have a hardware radio switch */ 2437 /* Not all thinkpads have a hardware radio switch */
2226 if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { 2438 if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) {
2227 tp_features.hotkey_wlsw = 1; 2439 tp_features.hotkey_wlsw = 1;
@@ -2361,13 +2573,154 @@ err_exit:
2361 return (res < 0)? res : 1; 2573 return (res < 0)? res : 1;
2362} 2574}
2363 2575
2576static bool hotkey_notify_hotkey(const u32 hkey,
2577 bool *send_acpi_ev,
2578 bool *ignore_acpi_ev)
2579{
2580 /* 0x1000-0x1FFF: key presses */
2581 unsigned int scancode = hkey & 0xfff;
2582 *send_acpi_ev = true;
2583 *ignore_acpi_ev = false;
2584
2585 if (scancode > 0 && scancode < 0x21) {
2586 scancode--;
2587 if (!(hotkey_source_mask & (1 << scancode))) {
2588 tpacpi_input_send_key(scancode);
2589 *send_acpi_ev = false;
2590 } else {
2591 *ignore_acpi_ev = true;
2592 }
2593 return true;
2594 }
2595 return false;
2596}
2597
2598static bool hotkey_notify_wakeup(const u32 hkey,
2599 bool *send_acpi_ev,
2600 bool *ignore_acpi_ev)
2601{
2602 /* 0x2000-0x2FFF: Wakeup reason */
2603 *send_acpi_ev = true;
2604 *ignore_acpi_ev = false;
2605
2606 switch (hkey) {
2607 case 0x2304: /* suspend, undock */
2608 case 0x2404: /* hibernation, undock */
2609 hotkey_wakeup_reason = TP_ACPI_WAKEUP_UNDOCK;
2610 *ignore_acpi_ev = true;
2611 break;
2612
2613 case 0x2305: /* suspend, bay eject */
2614 case 0x2405: /* hibernation, bay eject */
2615 hotkey_wakeup_reason = TP_ACPI_WAKEUP_BAYEJ;
2616 *ignore_acpi_ev = true;
2617 break;
2618
2619 case 0x2313: /* Battery on critical low level (S3) */
2620 case 0x2413: /* Battery on critical low level (S4) */
2621 printk(TPACPI_ALERT
2622 "EMERGENCY WAKEUP: battery almost empty\n");
2623 /* how to auto-heal: */
2624 /* 2313: woke up from S3, go to S4/S5 */
2625 /* 2413: woke up from S4, go to S5 */
2626 break;
2627
2628 default:
2629 return false;
2630 }
2631
2632 if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) {
2633 printk(TPACPI_INFO
2634 "woke up due to a hot-unplug "
2635 "request...\n");
2636 hotkey_wakeup_reason_notify_change();
2637 }
2638 return true;
2639}
2640
2641static bool hotkey_notify_usrevent(const u32 hkey,
2642 bool *send_acpi_ev,
2643 bool *ignore_acpi_ev)
2644{
2645 /* 0x5000-0x5FFF: human interface helpers */
2646 *send_acpi_ev = true;
2647 *ignore_acpi_ev = false;
2648
2649 switch (hkey) {
2650 case 0x5010: /* Lenovo new BIOS: brightness changed */
2651 case 0x500b: /* X61t: tablet pen inserted into bay */
2652 case 0x500c: /* X61t: tablet pen removed from bay */
2653 return true;
2654
2655 case 0x5009: /* X41t-X61t: swivel up (tablet mode) */
2656 case 0x500a: /* X41t-X61t: swivel down (normal mode) */
2657 tpacpi_input_send_tabletsw();
2658 hotkey_tablet_mode_notify_change();
2659 *send_acpi_ev = false;
2660 return true;
2661
2662 case 0x5001:
2663 case 0x5002:
2664 /* LID switch events. Do not propagate */
2665 *ignore_acpi_ev = true;
2666 return true;
2667
2668 default:
2669 return false;
2670 }
2671}
2672
2673static bool hotkey_notify_thermal(const u32 hkey,
2674 bool *send_acpi_ev,
2675 bool *ignore_acpi_ev)
2676{
2677 /* 0x6000-0x6FFF: thermal alarms */
2678 *send_acpi_ev = true;
2679 *ignore_acpi_ev = false;
2680
2681 switch (hkey) {
2682 case 0x6011:
2683 printk(TPACPI_CRIT
2684 "THERMAL ALARM: battery is too hot!\n");
2685 /* recommended action: warn user through gui */
2686 return true;
2687 case 0x6012:
2688 printk(TPACPI_ALERT
2689 "THERMAL EMERGENCY: battery is extremely hot!\n");
2690 /* recommended action: immediate sleep/hibernate */
2691 return true;
2692 case 0x6021:
2693 printk(TPACPI_CRIT
2694 "THERMAL ALARM: "
2695 "a sensor reports something is too hot!\n");
2696 /* recommended action: warn user through gui, that */
2697 /* some internal component is too hot */
2698 return true;
2699 case 0x6022:
2700 printk(TPACPI_ALERT
2701 "THERMAL EMERGENCY: "
2702 "a sensor reports something is extremely hot!\n");
2703 /* recommended action: immediate sleep/hibernate */
2704 return true;
2705 case 0x6030:
2706 printk(TPACPI_INFO
2707 "EC reports that Thermal Table has changed\n");
2708 /* recommended action: do nothing, we don't have
2709 * Lenovo ATM information */
2710 return true;
2711 default:
2712 printk(TPACPI_ALERT
2713 "THERMAL ALERT: unknown thermal alarm received\n");
2714 return false;
2715 }
2716}
2717
2364static void hotkey_notify(struct ibm_struct *ibm, u32 event) 2718static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2365{ 2719{
2366 u32 hkey; 2720 u32 hkey;
2367 unsigned int scancode; 2721 bool send_acpi_ev;
2368 int send_acpi_ev; 2722 bool ignore_acpi_ev;
2369 int ignore_acpi_ev; 2723 bool known_ev;
2370 int unk_ev;
2371 2724
2372 if (event != 0x80) { 2725 if (event != 0x80) {
2373 printk(TPACPI_ERR 2726 printk(TPACPI_ERR
@@ -2375,7 +2728,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2375 /* forward it to userspace, maybe it knows how to handle it */ 2728 /* forward it to userspace, maybe it knows how to handle it */
2376 acpi_bus_generate_netlink_event( 2729 acpi_bus_generate_netlink_event(
2377 ibm->acpi->device->pnp.device_class, 2730 ibm->acpi->device->pnp.device_class,
2378 ibm->acpi->device->dev.bus_id, 2731 dev_name(&ibm->acpi->device->dev),
2379 event, 0); 2732 event, 0);
2380 return; 2733 return;
2381 } 2734 }
@@ -2391,107 +2744,72 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2391 return; 2744 return;
2392 } 2745 }
2393 2746
2394 send_acpi_ev = 1; 2747 send_acpi_ev = true;
2395 ignore_acpi_ev = 0; 2748 ignore_acpi_ev = false;
2396 unk_ev = 0;
2397 2749
2398 switch (hkey >> 12) { 2750 switch (hkey >> 12) {
2399 case 1: 2751 case 1:
2400 /* 0x1000-0x1FFF: key presses */ 2752 /* 0x1000-0x1FFF: key presses */
2401 scancode = hkey & 0xfff; 2753 known_ev = hotkey_notify_hotkey(hkey, &send_acpi_ev,
2402 if (scancode > 0 && scancode < 0x21) { 2754 &ignore_acpi_ev);
2403 scancode--;
2404 if (!(hotkey_source_mask & (1 << scancode))) {
2405 tpacpi_input_send_key(scancode);
2406 send_acpi_ev = 0;
2407 } else {
2408 ignore_acpi_ev = 1;
2409 }
2410 } else {
2411 unk_ev = 1;
2412 }
2413 break; 2755 break;
2414 case 2: 2756 case 2:
2415 /* Wakeup reason */ 2757 /* 0x2000-0x2FFF: Wakeup reason */
2416 switch (hkey) { 2758 known_ev = hotkey_notify_wakeup(hkey, &send_acpi_ev,
2417 case 0x2304: /* suspend, undock */ 2759 &ignore_acpi_ev);
2418 case 0x2404: /* hibernation, undock */
2419 hotkey_wakeup_reason = TP_ACPI_WAKEUP_UNDOCK;
2420 ignore_acpi_ev = 1;
2421 break;
2422 case 0x2305: /* suspend, bay eject */
2423 case 0x2405: /* hibernation, bay eject */
2424 hotkey_wakeup_reason = TP_ACPI_WAKEUP_BAYEJ;
2425 ignore_acpi_ev = 1;
2426 break;
2427 default:
2428 unk_ev = 1;
2429 }
2430 if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) {
2431 printk(TPACPI_INFO
2432 "woke up due to a hot-unplug "
2433 "request...\n");
2434 hotkey_wakeup_reason_notify_change();
2435 }
2436 break; 2760 break;
2437 case 3: 2761 case 3:
2438 /* bay-related wakeups */ 2762 /* 0x3000-0x3FFF: bay-related wakeups */
2439 if (hkey == 0x3003) { 2763 if (hkey == 0x3003) {
2440 hotkey_autosleep_ack = 1; 2764 hotkey_autosleep_ack = 1;
2441 printk(TPACPI_INFO 2765 printk(TPACPI_INFO
2442 "bay ejected\n"); 2766 "bay ejected\n");
2443 hotkey_wakeup_hotunplug_complete_notify_change(); 2767 hotkey_wakeup_hotunplug_complete_notify_change();
2768 known_ev = true;
2444 } else { 2769 } else {
2445 unk_ev = 1; 2770 known_ev = false;
2446 } 2771 }
2447 break; 2772 break;
2448 case 4: 2773 case 4:
2449 /* dock-related wakeups */ 2774 /* 0x4000-0x4FFF: dock-related wakeups */
2450 if (hkey == 0x4003) { 2775 if (hkey == 0x4003) {
2451 hotkey_autosleep_ack = 1; 2776 hotkey_autosleep_ack = 1;
2452 printk(TPACPI_INFO 2777 printk(TPACPI_INFO
2453 "undocked\n"); 2778 "undocked\n");
2454 hotkey_wakeup_hotunplug_complete_notify_change(); 2779 hotkey_wakeup_hotunplug_complete_notify_change();
2780 known_ev = true;
2455 } else { 2781 } else {
2456 unk_ev = 1; 2782 known_ev = false;
2457 } 2783 }
2458 break; 2784 break;
2459 case 5: 2785 case 5:
2460 /* 0x5000-0x5FFF: human interface helpers */ 2786 /* 0x5000-0x5FFF: human interface helpers */
2461 switch (hkey) { 2787 known_ev = hotkey_notify_usrevent(hkey, &send_acpi_ev,
2462 case 0x5010: /* Lenovo new BIOS: brightness changed */ 2788 &ignore_acpi_ev);
2463 case 0x500b: /* X61t: tablet pen inserted into bay */ 2789 break;
2464 case 0x500c: /* X61t: tablet pen removed from bay */ 2790 case 6:
2465 break; 2791 /* 0x6000-0x6FFF: thermal alarms */
2466 case 0x5009: /* X41t-X61t: swivel up (tablet mode) */ 2792 known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev,
2467 case 0x500a: /* X41t-X61t: swivel down (normal mode) */ 2793 &ignore_acpi_ev);
2468 tpacpi_input_send_tabletsw();
2469 hotkey_tablet_mode_notify_change();
2470 send_acpi_ev = 0;
2471 break;
2472 case 0x5001:
2473 case 0x5002:
2474 /* LID switch events. Do not propagate */
2475 ignore_acpi_ev = 1;
2476 break;
2477 default:
2478 unk_ev = 1;
2479 }
2480 break; 2794 break;
2481 case 7: 2795 case 7:
2482 /* 0x7000-0x7FFF: misc */ 2796 /* 0x7000-0x7FFF: misc */
2483 if (tp_features.hotkey_wlsw && hkey == 0x7000) { 2797 if (tp_features.hotkey_wlsw && hkey == 0x7000) {
2484 tpacpi_send_radiosw_update(); 2798 tpacpi_send_radiosw_update();
2485 send_acpi_ev = 0; 2799 send_acpi_ev = 0;
2800 known_ev = true;
2486 break; 2801 break;
2487 } 2802 }
2488 /* fallthrough to default */ 2803 /* fallthrough to default */
2489 default: 2804 default:
2490 unk_ev = 1; 2805 known_ev = false;
2491 } 2806 }
2492 if (unk_ev) { 2807 if (!known_ev) {
2493 printk(TPACPI_NOTICE 2808 printk(TPACPI_NOTICE
2494 "unhandled HKEY event 0x%04x\n", hkey); 2809 "unhandled HKEY event 0x%04x\n", hkey);
2810 printk(TPACPI_NOTICE
2811 "please report the conditions when this "
2812 "event happened to %s\n", TPACPI_MAIL);
2495 } 2813 }
2496 2814
2497 /* Legacy events */ 2815 /* Legacy events */
@@ -2505,7 +2823,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2505 if (!ignore_acpi_ev && send_acpi_ev) { 2823 if (!ignore_acpi_ev && send_acpi_ev) {
2506 acpi_bus_generate_netlink_event( 2824 acpi_bus_generate_netlink_event(
2507 ibm->acpi->device->pnp.device_class, 2825 ibm->acpi->device->pnp.device_class,
2508 ibm->acpi->device->dev.bus_id, 2826 dev_name(&ibm->acpi->device->dev),
2509 event, hkey); 2827 event, hkey);
2510 } 2828 }
2511 } 2829 }
@@ -2544,7 +2862,7 @@ static int hotkey_read(char *p)
2544 return len; 2862 return len;
2545 } 2863 }
2546 2864
2547 if (mutex_lock_interruptible(&hotkey_mutex)) 2865 if (mutex_lock_killable(&hotkey_mutex))
2548 return -ERESTARTSYS; 2866 return -ERESTARTSYS;
2549 res = hotkey_status_get(&status); 2867 res = hotkey_status_get(&status);
2550 if (!res) 2868 if (!res)
@@ -2575,7 +2893,7 @@ static int hotkey_write(char *buf)
2575 if (!tp_features.hotkey) 2893 if (!tp_features.hotkey)
2576 return -ENODEV; 2894 return -ENODEV;
2577 2895
2578 if (mutex_lock_interruptible(&hotkey_mutex)) 2896 if (mutex_lock_killable(&hotkey_mutex))
2579 return -ERESTARTSYS; 2897 return -ERESTARTSYS;
2580 2898
2581 status = -1; 2899 status = -1;
@@ -2640,11 +2958,28 @@ enum {
2640 /* ACPI GBDC/SBDC bits */ 2958 /* ACPI GBDC/SBDC bits */
2641 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ 2959 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */
2642 TP_ACPI_BLUETOOTH_RADIOSSW = 0x02, /* Bluetooth radio enabled */ 2960 TP_ACPI_BLUETOOTH_RADIOSSW = 0x02, /* Bluetooth radio enabled */
2643 TP_ACPI_BLUETOOTH_UNK = 0x04, /* unknown function */ 2961 TP_ACPI_BLUETOOTH_RESUMECTRL = 0x04, /* Bluetooth state at resume:
2962 off / last state */
2963};
2964
2965enum {
2966 /* ACPI \BLTH commands */
2967 TP_ACPI_BLTH_GET_ULTRAPORT_ID = 0x00, /* Get Ultraport BT ID */
2968 TP_ACPI_BLTH_GET_PWR_ON_RESUME = 0x01, /* Get power-on-resume state */
2969 TP_ACPI_BLTH_PWR_ON_ON_RESUME = 0x02, /* Resume powered on */
2970 TP_ACPI_BLTH_PWR_OFF_ON_RESUME = 0x03, /* Resume powered off */
2971 TP_ACPI_BLTH_SAVE_STATE = 0x05, /* Save state for S4/S5 */
2644}; 2972};
2645 2973
2646static struct rfkill *tpacpi_bluetooth_rfkill; 2974static struct rfkill *tpacpi_bluetooth_rfkill;
2647 2975
2976static void bluetooth_suspend(pm_message_t state)
2977{
2978 /* Try to make sure radio will resume powered off */
2979 acpi_evalf(NULL, NULL, "\\BLTH", "vd",
2980 TP_ACPI_BLTH_PWR_OFF_ON_RESUME);
2981}
2982
2648static int bluetooth_get_radiosw(void) 2983static int bluetooth_get_radiosw(void)
2649{ 2984{
2650 int status; 2985 int status;
@@ -2656,6 +2991,12 @@ static int bluetooth_get_radiosw(void)
2656 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) 2991 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
2657 return RFKILL_STATE_HARD_BLOCKED; 2992 return RFKILL_STATE_HARD_BLOCKED;
2658 2993
2994#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
2995 if (dbg_bluetoothemul)
2996 return (tpacpi_bluetooth_emulstate) ?
2997 RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED;
2998#endif
2999
2659 if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) 3000 if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
2660 return -EIO; 3001 return -EIO;
2661 3002
@@ -2689,12 +3030,20 @@ static int bluetooth_set_radiosw(int radio_on, int update_rfk)
2689 && radio_on) 3030 && radio_on)
2690 return -EPERM; 3031 return -EPERM;
2691 3032
2692 if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) 3033#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
2693 return -EIO; 3034 if (dbg_bluetoothemul) {
3035 tpacpi_bluetooth_emulstate = !!radio_on;
3036 if (update_rfk)
3037 bluetooth_update_rfk();
3038 return 0;
3039 }
3040#endif
3041
3042 /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */
2694 if (radio_on) 3043 if (radio_on)
2695 status |= TP_ACPI_BLUETOOTH_RADIOSSW; 3044 status = TP_ACPI_BLUETOOTH_RADIOSSW;
2696 else 3045 else
2697 status &= ~TP_ACPI_BLUETOOTH_RADIOSSW; 3046 status = 0;
2698 if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) 3047 if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
2699 return -EIO; 3048 return -EIO;
2700 3049
@@ -2765,8 +3114,19 @@ static int tpacpi_bluetooth_rfk_set(void *data, enum rfkill_state state)
2765 return bluetooth_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); 3114 return bluetooth_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0);
2766} 3115}
2767 3116
3117static void bluetooth_shutdown(void)
3118{
3119 /* Order firmware to save current state to NVRAM */
3120 if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
3121 TP_ACPI_BLTH_SAVE_STATE))
3122 printk(TPACPI_NOTICE
3123 "failed to save bluetooth state to NVRAM\n");
3124}
3125
2768static void bluetooth_exit(void) 3126static void bluetooth_exit(void)
2769{ 3127{
3128 bluetooth_shutdown();
3129
2770 if (tpacpi_bluetooth_rfkill) 3130 if (tpacpi_bluetooth_rfkill)
2771 rfkill_unregister(tpacpi_bluetooth_rfkill); 3131 rfkill_unregister(tpacpi_bluetooth_rfkill);
2772 3132
@@ -2792,6 +3152,13 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm)
2792 str_supported(tp_features.bluetooth), 3152 str_supported(tp_features.bluetooth),
2793 status); 3153 status);
2794 3154
3155#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
3156 if (dbg_bluetoothemul) {
3157 tp_features.bluetooth = 1;
3158 printk(TPACPI_INFO
3159 "bluetooth switch emulation enabled\n");
3160 } else
3161#endif
2795 if (tp_features.bluetooth && 3162 if (tp_features.bluetooth &&
2796 !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) { 3163 !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) {
2797 /* no bluetooth hardware present in system */ 3164 /* no bluetooth hardware present in system */
@@ -2812,6 +3179,7 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm)
2812 &tpacpi_bluetooth_rfkill, 3179 &tpacpi_bluetooth_rfkill,
2813 RFKILL_TYPE_BLUETOOTH, 3180 RFKILL_TYPE_BLUETOOTH,
2814 "tpacpi_bluetooth_sw", 3181 "tpacpi_bluetooth_sw",
3182 true,
2815 tpacpi_bluetooth_rfk_set, 3183 tpacpi_bluetooth_rfk_set,
2816 tpacpi_bluetooth_rfk_get); 3184 tpacpi_bluetooth_rfk_get);
2817 if (res) { 3185 if (res) {
@@ -2864,6 +3232,8 @@ static struct ibm_struct bluetooth_driver_data = {
2864 .read = bluetooth_read, 3232 .read = bluetooth_read,
2865 .write = bluetooth_write, 3233 .write = bluetooth_write,
2866 .exit = bluetooth_exit, 3234 .exit = bluetooth_exit,
3235 .suspend = bluetooth_suspend,
3236 .shutdown = bluetooth_shutdown,
2867}; 3237};
2868 3238
2869/************************************************************************* 3239/*************************************************************************
@@ -2874,11 +3244,19 @@ enum {
2874 /* ACPI GWAN/SWAN bits */ 3244 /* ACPI GWAN/SWAN bits */
2875 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ 3245 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */
2876 TP_ACPI_WANCARD_RADIOSSW = 0x02, /* Wan radio enabled */ 3246 TP_ACPI_WANCARD_RADIOSSW = 0x02, /* Wan radio enabled */
2877 TP_ACPI_WANCARD_UNK = 0x04, /* unknown function */ 3247 TP_ACPI_WANCARD_RESUMECTRL = 0x04, /* Wan state at resume:
3248 off / last state */
2878}; 3249};
2879 3250
2880static struct rfkill *tpacpi_wan_rfkill; 3251static struct rfkill *tpacpi_wan_rfkill;
2881 3252
3253static void wan_suspend(pm_message_t state)
3254{
3255 /* Try to make sure radio will resume powered off */
3256 acpi_evalf(NULL, NULL, "\\WGSV", "qvd",
3257 TP_ACPI_WGSV_PWR_OFF_ON_RESUME);
3258}
3259
2882static int wan_get_radiosw(void) 3260static int wan_get_radiosw(void)
2883{ 3261{
2884 int status; 3262 int status;
@@ -2890,6 +3268,12 @@ static int wan_get_radiosw(void)
2890 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) 3268 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
2891 return RFKILL_STATE_HARD_BLOCKED; 3269 return RFKILL_STATE_HARD_BLOCKED;
2892 3270
3271#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
3272 if (dbg_wwanemul)
3273 return (tpacpi_wwan_emulstate) ?
3274 RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED;
3275#endif
3276
2893 if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) 3277 if (!acpi_evalf(hkey_handle, &status, "GWAN", "d"))
2894 return -EIO; 3278 return -EIO;
2895 3279
@@ -2923,12 +3307,20 @@ static int wan_set_radiosw(int radio_on, int update_rfk)
2923 && radio_on) 3307 && radio_on)
2924 return -EPERM; 3308 return -EPERM;
2925 3309
2926 if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) 3310#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
2927 return -EIO; 3311 if (dbg_wwanemul) {
3312 tpacpi_wwan_emulstate = !!radio_on;
3313 if (update_rfk)
3314 wan_update_rfk();
3315 return 0;
3316 }
3317#endif
3318
3319 /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */
2928 if (radio_on) 3320 if (radio_on)
2929 status |= TP_ACPI_WANCARD_RADIOSSW; 3321 status = TP_ACPI_WANCARD_RADIOSSW;
2930 else 3322 else
2931 status &= ~TP_ACPI_WANCARD_RADIOSSW; 3323 status = 0;
2932 if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) 3324 if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
2933 return -EIO; 3325 return -EIO;
2934 3326
@@ -2999,8 +3391,19 @@ static int tpacpi_wan_rfk_set(void *data, enum rfkill_state state)
2999 return wan_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); 3391 return wan_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0);
3000} 3392}
3001 3393
3394static void wan_shutdown(void)
3395{
3396 /* Order firmware to save current state to NVRAM */
3397 if (!acpi_evalf(NULL, NULL, "\\WGSV", "vd",
3398 TP_ACPI_WGSV_SAVE_STATE))
3399 printk(TPACPI_NOTICE
3400 "failed to save WWAN state to NVRAM\n");
3401}
3402
3002static void wan_exit(void) 3403static void wan_exit(void)
3003{ 3404{
3405 wan_shutdown();
3406
3004 if (tpacpi_wan_rfkill) 3407 if (tpacpi_wan_rfkill)
3005 rfkill_unregister(tpacpi_wan_rfkill); 3408 rfkill_unregister(tpacpi_wan_rfkill);
3006 3409
@@ -3024,6 +3427,13 @@ static int __init wan_init(struct ibm_init_struct *iibm)
3024 str_supported(tp_features.wan), 3427 str_supported(tp_features.wan),
3025 status); 3428 status);
3026 3429
3430#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
3431 if (dbg_wwanemul) {
3432 tp_features.wan = 1;
3433 printk(TPACPI_INFO
3434 "wwan switch emulation enabled\n");
3435 } else
3436#endif
3027 if (tp_features.wan && 3437 if (tp_features.wan &&
3028 !(status & TP_ACPI_WANCARD_HWPRESENT)) { 3438 !(status & TP_ACPI_WANCARD_HWPRESENT)) {
3029 /* no wan hardware present in system */ 3439 /* no wan hardware present in system */
@@ -3044,6 +3454,7 @@ static int __init wan_init(struct ibm_init_struct *iibm)
3044 &tpacpi_wan_rfkill, 3454 &tpacpi_wan_rfkill,
3045 RFKILL_TYPE_WWAN, 3455 RFKILL_TYPE_WWAN,
3046 "tpacpi_wwan_sw", 3456 "tpacpi_wwan_sw",
3457 true,
3047 tpacpi_wan_rfk_set, 3458 tpacpi_wan_rfk_set,
3048 tpacpi_wan_rfk_get); 3459 tpacpi_wan_rfk_get);
3049 if (res) { 3460 if (res) {
@@ -3096,6 +3507,164 @@ static struct ibm_struct wan_driver_data = {
3096 .read = wan_read, 3507 .read = wan_read,
3097 .write = wan_write, 3508 .write = wan_write,
3098 .exit = wan_exit, 3509 .exit = wan_exit,
3510 .suspend = wan_suspend,
3511 .shutdown = wan_shutdown,
3512};
3513
3514/*************************************************************************
3515 * UWB subdriver
3516 */
3517
3518enum {
3519 /* ACPI GUWB/SUWB bits */
3520 TP_ACPI_UWB_HWPRESENT = 0x01, /* UWB hw available */
3521 TP_ACPI_UWB_RADIOSSW = 0x02, /* UWB radio enabled */
3522};
3523
3524static struct rfkill *tpacpi_uwb_rfkill;
3525
3526static int uwb_get_radiosw(void)
3527{
3528 int status;
3529
3530 if (!tp_features.uwb)
3531 return -ENODEV;
3532
3533 /* WLSW overrides UWB in firmware/hardware, reflect that */
3534 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
3535 return RFKILL_STATE_HARD_BLOCKED;
3536
3537#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
3538 if (dbg_uwbemul)
3539 return (tpacpi_uwb_emulstate) ?
3540 RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED;
3541#endif
3542
3543 if (!acpi_evalf(hkey_handle, &status, "GUWB", "d"))
3544 return -EIO;
3545
3546 return ((status & TP_ACPI_UWB_RADIOSSW) != 0) ?
3547 RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED;
3548}
3549
3550static void uwb_update_rfk(void)
3551{
3552 int status;
3553
3554 if (!tpacpi_uwb_rfkill)
3555 return;
3556
3557 status = uwb_get_radiosw();
3558 if (status < 0)
3559 return;
3560 rfkill_force_state(tpacpi_uwb_rfkill, status);
3561}
3562
3563static int uwb_set_radiosw(int radio_on, int update_rfk)
3564{
3565 int status;
3566
3567 if (!tp_features.uwb)
3568 return -ENODEV;
3569
3570 /* WLSW overrides UWB in firmware/hardware, but there is no
3571 * reason to risk weird behaviour. */
3572 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status
3573 && radio_on)
3574 return -EPERM;
3575
3576#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
3577 if (dbg_uwbemul) {
3578 tpacpi_uwb_emulstate = !!radio_on;
3579 if (update_rfk)
3580 uwb_update_rfk();
3581 return 0;
3582 }
3583#endif
3584
3585 status = (radio_on) ? TP_ACPI_UWB_RADIOSSW : 0;
3586 if (!acpi_evalf(hkey_handle, NULL, "SUWB", "vd", status))
3587 return -EIO;
3588
3589 if (update_rfk)
3590 uwb_update_rfk();
3591
3592 return 0;
3593}
3594
3595/* --------------------------------------------------------------------- */
3596
3597static int tpacpi_uwb_rfk_get(void *data, enum rfkill_state *state)
3598{
3599 int uwbs = uwb_get_radiosw();
3600
3601 if (uwbs < 0)
3602 return uwbs;
3603
3604 *state = uwbs;
3605 return 0;
3606}
3607
3608static int tpacpi_uwb_rfk_set(void *data, enum rfkill_state state)
3609{
3610 return uwb_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0);
3611}
3612
3613static void uwb_exit(void)
3614{
3615 if (tpacpi_uwb_rfkill)
3616 rfkill_unregister(tpacpi_uwb_rfkill);
3617}
3618
3619static int __init uwb_init(struct ibm_init_struct *iibm)
3620{
3621 int res;
3622 int status = 0;
3623
3624 vdbg_printk(TPACPI_DBG_INIT, "initializing uwb subdriver\n");
3625
3626 TPACPI_ACPIHANDLE_INIT(hkey);
3627
3628 tp_features.uwb = hkey_handle &&
3629 acpi_evalf(hkey_handle, &status, "GUWB", "qd");
3630
3631 vdbg_printk(TPACPI_DBG_INIT, "uwb is %s, status 0x%02x\n",
3632 str_supported(tp_features.uwb),
3633 status);
3634
3635#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
3636 if (dbg_uwbemul) {
3637 tp_features.uwb = 1;
3638 printk(TPACPI_INFO
3639 "uwb switch emulation enabled\n");
3640 } else
3641#endif
3642 if (tp_features.uwb &&
3643 !(status & TP_ACPI_UWB_HWPRESENT)) {
3644 /* no uwb hardware present in system */
3645 tp_features.uwb = 0;
3646 dbg_printk(TPACPI_DBG_INIT,
3647 "uwb hardware not installed\n");
3648 }
3649
3650 if (!tp_features.uwb)
3651 return 1;
3652
3653 res = tpacpi_new_rfkill(TPACPI_RFK_UWB_SW_ID,
3654 &tpacpi_uwb_rfkill,
3655 RFKILL_TYPE_UWB,
3656 "tpacpi_uwb_sw",
3657 false,
3658 tpacpi_uwb_rfk_set,
3659 tpacpi_uwb_rfk_get);
3660
3661 return res;
3662}
3663
3664static struct ibm_struct uwb_driver_data = {
3665 .name = "uwb",
3666 .exit = uwb_exit,
3667 .flags.experimental = 1,
3099}; 3668};
3100 3669
3101/************************************************************************* 3670/*************************************************************************
@@ -3724,7 +4293,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
3724 } 4293 }
3725 acpi_bus_generate_proc_event(ibm->acpi->device, event, data); 4294 acpi_bus_generate_proc_event(ibm->acpi->device, event, data);
3726 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 4295 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
3727 ibm->acpi->device->dev.bus_id, 4296 dev_name(&ibm->acpi->device->dev),
3728 event, data); 4297 event, data);
3729} 4298}
3730 4299
@@ -3826,7 +4395,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event)
3826{ 4395{
3827 acpi_bus_generate_proc_event(ibm->acpi->device, event, 0); 4396 acpi_bus_generate_proc_event(ibm->acpi->device, event, 0);
3828 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 4397 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
3829 ibm->acpi->device->dev.bus_id, 4398 dev_name(&ibm->acpi->device->dev),
3830 event, 0); 4399 event, 0);
3831} 4400}
3832 4401
@@ -4850,7 +5419,7 @@ static int brightness_set(int value)
4850 value < 0) 5419 value < 0)
4851 return -EINVAL; 5420 return -EINVAL;
4852 5421
4853 res = mutex_lock_interruptible(&brightness_mutex); 5422 res = mutex_lock_killable(&brightness_mutex);
4854 if (res < 0) 5423 if (res < 0)
4855 return res; 5424 return res;
4856 5425
@@ -5334,6 +5903,60 @@ TPACPI_HANDLE(sfan, ec, "SFAN", /* 570 */
5334 ); /* all others */ 5903 ); /* all others */
5335 5904
5336/* 5905/*
5906 * Unitialized HFSP quirk: ACPI DSDT and EC fail to initialize the
5907 * HFSP register at boot, so it contains 0x07 but the Thinkpad could
5908 * be in auto mode (0x80).
5909 *
5910 * This is corrected by any write to HFSP either by the driver, or
5911 * by the firmware.
5912 *
5913 * We assume 0x07 really means auto mode while this quirk is active,
5914 * as this is far more likely than the ThinkPad being in level 7,
5915 * which is only used by the firmware during thermal emergencies.
5916 */
5917
5918static void fan_quirk1_detect(void)
5919{
5920 /* In some ThinkPads, neither the EC nor the ACPI
5921 * DSDT initialize the HFSP register, and it ends up
5922 * being initially set to 0x07 when it *could* be
5923 * either 0x07 or 0x80.
5924 *
5925 * Enable for TP-1Y (T43), TP-78 (R51e),
5926 * TP-76 (R52), TP-70 (T43, R52), which are known
5927 * to be buggy. */
5928 if (fan_control_initial_status == 0x07) {
5929 switch (thinkpad_id.ec_model) {
5930 case 0x5931: /* TP-1Y */
5931 case 0x3837: /* TP-78 */
5932 case 0x3637: /* TP-76 */
5933 case 0x3037: /* TP-70 */
5934 printk(TPACPI_NOTICE
5935 "fan_init: initial fan status is unknown, "
5936 "assuming it is in auto mode\n");
5937 tp_features.fan_ctrl_status_undef = 1;
5938 ;;
5939 }
5940 }
5941}
5942
5943static void fan_quirk1_handle(u8 *fan_status)
5944{
5945 if (unlikely(tp_features.fan_ctrl_status_undef)) {
5946 if (*fan_status != fan_control_initial_status) {
5947 /* something changed the HFSP regisnter since
5948 * driver init time, so it is not undefined
5949 * anymore */
5950 tp_features.fan_ctrl_status_undef = 0;
5951 } else {
5952 /* Return most likely status. In fact, it
5953 * might be the only possible status */
5954 *fan_status = TP_EC_FAN_AUTO;
5955 }
5956 }
5957}
5958
5959/*
5337 * Call with fan_mutex held 5960 * Call with fan_mutex held
5338 */ 5961 */
5339static void fan_update_desired_level(u8 status) 5962static void fan_update_desired_level(u8 status)
@@ -5371,8 +5994,10 @@ static int fan_get_status(u8 *status)
5371 if (unlikely(!acpi_ec_read(fan_status_offset, &s))) 5994 if (unlikely(!acpi_ec_read(fan_status_offset, &s)))
5372 return -EIO; 5995 return -EIO;
5373 5996
5374 if (likely(status)) 5997 if (likely(status)) {
5375 *status = s; 5998 *status = s;
5999 fan_quirk1_handle(status);
6000 }
5376 6001
5377 break; 6002 break;
5378 6003
@@ -5388,7 +6013,7 @@ static int fan_get_status_safe(u8 *status)
5388 int rc; 6013 int rc;
5389 u8 s; 6014 u8 s;
5390 6015
5391 if (mutex_lock_interruptible(&fan_mutex)) 6016 if (mutex_lock_killable(&fan_mutex))
5392 return -ERESTARTSYS; 6017 return -ERESTARTSYS;
5393 rc = fan_get_status(&s); 6018 rc = fan_get_status(&s);
5394 if (!rc) 6019 if (!rc)
@@ -5471,7 +6096,7 @@ static int fan_set_level_safe(int level)
5471 if (!fan_control_allowed) 6096 if (!fan_control_allowed)
5472 return -EPERM; 6097 return -EPERM;
5473 6098
5474 if (mutex_lock_interruptible(&fan_mutex)) 6099 if (mutex_lock_killable(&fan_mutex))
5475 return -ERESTARTSYS; 6100 return -ERESTARTSYS;
5476 6101
5477 if (level == TPACPI_FAN_LAST_LEVEL) 6102 if (level == TPACPI_FAN_LAST_LEVEL)
@@ -5493,7 +6118,7 @@ static int fan_set_enable(void)
5493 if (!fan_control_allowed) 6118 if (!fan_control_allowed)
5494 return -EPERM; 6119 return -EPERM;
5495 6120
5496 if (mutex_lock_interruptible(&fan_mutex)) 6121 if (mutex_lock_killable(&fan_mutex))
5497 return -ERESTARTSYS; 6122 return -ERESTARTSYS;
5498 6123
5499 switch (fan_control_access_mode) { 6124 switch (fan_control_access_mode) {
@@ -5548,7 +6173,7 @@ static int fan_set_disable(void)
5548 if (!fan_control_allowed) 6173 if (!fan_control_allowed)
5549 return -EPERM; 6174 return -EPERM;
5550 6175
5551 if (mutex_lock_interruptible(&fan_mutex)) 6176 if (mutex_lock_killable(&fan_mutex))
5552 return -ERESTARTSYS; 6177 return -ERESTARTSYS;
5553 6178
5554 rc = 0; 6179 rc = 0;
@@ -5586,7 +6211,7 @@ static int fan_set_speed(int speed)
5586 if (!fan_control_allowed) 6211 if (!fan_control_allowed)
5587 return -EPERM; 6212 return -EPERM;
5588 6213
5589 if (mutex_lock_interruptible(&fan_mutex)) 6214 if (mutex_lock_killable(&fan_mutex))
5590 return -ERESTARTSYS; 6215 return -ERESTARTSYS;
5591 6216
5592 rc = 0; 6217 rc = 0;
@@ -5682,16 +6307,6 @@ static ssize_t fan_pwm1_enable_show(struct device *dev,
5682 if (res) 6307 if (res)
5683 return res; 6308 return res;
5684 6309
5685 if (unlikely(tp_features.fan_ctrl_status_undef)) {
5686 if (status != fan_control_initial_status) {
5687 tp_features.fan_ctrl_status_undef = 0;
5688 } else {
5689 /* Return most likely status. In fact, it
5690 * might be the only possible status */
5691 status = TP_EC_FAN_AUTO;
5692 }
5693 }
5694
5695 if (status & TP_EC_FAN_FULLSPEED) { 6310 if (status & TP_EC_FAN_FULLSPEED) {
5696 mode = 0; 6311 mode = 0;
5697 } else if (status & TP_EC_FAN_AUTO) { 6312 } else if (status & TP_EC_FAN_AUTO) {
@@ -5756,14 +6371,6 @@ static ssize_t fan_pwm1_show(struct device *dev,
5756 if (res) 6371 if (res)
5757 return res; 6372 return res;
5758 6373
5759 if (unlikely(tp_features.fan_ctrl_status_undef)) {
5760 if (status != fan_control_initial_status) {
5761 tp_features.fan_ctrl_status_undef = 0;
5762 } else {
5763 status = TP_EC_FAN_AUTO;
5764 }
5765 }
5766
5767 if ((status & 6374 if ((status &
5768 (TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED)) != 0) 6375 (TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED)) != 0)
5769 status = fan_control_desired_level; 6376 status = fan_control_desired_level;
@@ -5788,7 +6395,7 @@ static ssize_t fan_pwm1_store(struct device *dev,
5788 /* scale down from 0-255 to 0-7 */ 6395 /* scale down from 0-255 to 0-7 */
5789 newlevel = (s >> 5) & 0x07; 6396 newlevel = (s >> 5) & 0x07;
5790 6397
5791 if (mutex_lock_interruptible(&fan_mutex)) 6398 if (mutex_lock_killable(&fan_mutex))
5792 return -ERESTARTSYS; 6399 return -ERESTARTSYS;
5793 6400
5794 rc = fan_get_status(&status); 6401 rc = fan_get_status(&status);
@@ -5895,29 +6502,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
5895 if (likely(acpi_ec_read(fan_status_offset, 6502 if (likely(acpi_ec_read(fan_status_offset,
5896 &fan_control_initial_status))) { 6503 &fan_control_initial_status))) {
5897 fan_status_access_mode = TPACPI_FAN_RD_TPEC; 6504 fan_status_access_mode = TPACPI_FAN_RD_TPEC;
5898 6505 fan_quirk1_detect();
5899 /* In some ThinkPads, neither the EC nor the ACPI
5900 * DSDT initialize the fan status, and it ends up
5901 * being set to 0x07 when it *could* be either
5902 * 0x07 or 0x80.
5903 *
5904 * Enable for TP-1Y (T43), TP-78 (R51e),
5905 * TP-76 (R52), TP-70 (T43, R52), which are known
5906 * to be buggy. */
5907 if (fan_control_initial_status == 0x07) {
5908 switch (thinkpad_id.ec_model) {
5909 case 0x5931: /* TP-1Y */
5910 case 0x3837: /* TP-78 */
5911 case 0x3637: /* TP-76 */
5912 case 0x3037: /* TP-70 */
5913 printk(TPACPI_NOTICE
5914 "fan_init: initial fan status "
5915 "is unknown, assuming it is "
5916 "in auto mode\n");
5917 tp_features.fan_ctrl_status_undef = 1;
5918 ;;
5919 }
5920 }
5921 } else { 6506 } else {
5922 printk(TPACPI_ERR 6507 printk(TPACPI_ERR
5923 "ThinkPad ACPI EC access misbehaving, " 6508 "ThinkPad ACPI EC access misbehaving, "
@@ -6106,15 +6691,6 @@ static int fan_read(char *p)
6106 if (rc < 0) 6691 if (rc < 0)
6107 return rc; 6692 return rc;
6108 6693
6109 if (unlikely(tp_features.fan_ctrl_status_undef)) {
6110 if (status != fan_control_initial_status)
6111 tp_features.fan_ctrl_status_undef = 0;
6112 else
6113 /* Return most likely status. In fact, it
6114 * might be the only possible status */
6115 status = TP_EC_FAN_AUTO;
6116 }
6117
6118 len += sprintf(p + len, "status:\t\t%s\n", 6694 len += sprintf(p + len, "status:\t\t%s\n",
6119 (status != 0) ? "enabled" : "disabled"); 6695 (status != 0) ? "enabled" : "disabled");
6120 6696
@@ -6563,6 +7139,10 @@ static struct ibm_init_struct ibms_init[] __initdata = {
6563 .init = wan_init, 7139 .init = wan_init,
6564 .data = &wan_driver_data, 7140 .data = &wan_driver_data,
6565 }, 7141 },
7142 {
7143 .init = uwb_init,
7144 .data = &uwb_driver_data,
7145 },
6566#ifdef CONFIG_THINKPAD_ACPI_VIDEO 7146#ifdef CONFIG_THINKPAD_ACPI_VIDEO
6567 { 7147 {
6568 .init = video_init, 7148 .init = video_init,
@@ -6701,6 +7281,32 @@ TPACPI_PARAM(brightness);
6701TPACPI_PARAM(volume); 7281TPACPI_PARAM(volume);
6702TPACPI_PARAM(fan); 7282TPACPI_PARAM(fan);
6703 7283
7284#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
7285module_param(dbg_wlswemul, uint, 0);
7286MODULE_PARM_DESC(dbg_wlswemul, "Enables WLSW emulation");
7287module_param_named(wlsw_state, tpacpi_wlsw_emulstate, bool, 0);
7288MODULE_PARM_DESC(wlsw_state,
7289 "Initial state of the emulated WLSW switch");
7290
7291module_param(dbg_bluetoothemul, uint, 0);
7292MODULE_PARM_DESC(dbg_bluetoothemul, "Enables bluetooth switch emulation");
7293module_param_named(bluetooth_state, tpacpi_bluetooth_emulstate, bool, 0);
7294MODULE_PARM_DESC(bluetooth_state,
7295 "Initial state of the emulated bluetooth switch");
7296
7297module_param(dbg_wwanemul, uint, 0);
7298MODULE_PARM_DESC(dbg_wwanemul, "Enables WWAN switch emulation");
7299module_param_named(wwan_state, tpacpi_wwan_emulstate, bool, 0);
7300MODULE_PARM_DESC(wwan_state,
7301 "Initial state of the emulated WWAN switch");
7302
7303module_param(dbg_uwbemul, uint, 0);
7304MODULE_PARM_DESC(dbg_uwbemul, "Enables UWB switch emulation");
7305module_param_named(uwb_state, tpacpi_uwb_emulstate, bool, 0);
7306MODULE_PARM_DESC(uwb_state,
7307 "Initial state of the emulated UWB switch");
7308#endif
7309
6704static void thinkpad_acpi_module_exit(void) 7310static void thinkpad_acpi_module_exit(void)
6705{ 7311{
6706 struct ibm_struct *ibm, *itmp; 7312 struct ibm_struct *ibm, *itmp;
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index 204158cf7a55..fe96793e3f08 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -732,7 +732,7 @@ static u64 pm_signal_group_to_ps3_lv1_signal_group(u64 group)
732 case 8: 732 case 8:
733 return pm_translate_signal_group_number_on_island8(subgroup); 733 return pm_translate_signal_group_number_on_island8(subgroup);
734 default: 734 default:
735 dev_dbg(sbd_core(), "%s:%u: island not found: %lu\n", __func__, 735 dev_dbg(sbd_core(), "%s:%u: island not found: %llu\n", __func__,
736 __LINE__, group); 736 __LINE__, group);
737 BUG(); 737 BUG();
738 break; 738 break;
@@ -765,7 +765,7 @@ static int __ps3_set_signal(u64 lv1_signal_group, u64 bus_select,
765 signal_select, attr1, attr2, attr3); 765 signal_select, attr1, attr2, attr3);
766 if (ret) 766 if (ret)
767 dev_err(sbd_core(), 767 dev_err(sbd_core(),
768 "%s:%u: error:%d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", 768 "%s:%u: error:%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n",
769 __func__, __LINE__, ret, lv1_signal_group, bus_select, 769 __func__, __LINE__, ret, lv1_signal_group, bus_select,
770 signal_select, attr1, attr2, attr3); 770 signal_select, attr1, attr2, attr3);
771 771
@@ -908,7 +908,7 @@ void ps3_disable_pm(u32 cpu)
908 908
909 lpm_priv->tb_count = tmp; 909 lpm_priv->tb_count = tmp;
910 910
911 dev_dbg(sbd_core(), "%s:%u: tb_count %lu (%lxh)\n", __func__, __LINE__, 911 dev_dbg(sbd_core(), "%s:%u: tb_count %llu (%llxh)\n", __func__, __LINE__,
912 lpm_priv->tb_count, lpm_priv->tb_count); 912 lpm_priv->tb_count, lpm_priv->tb_count);
913} 913}
914EXPORT_SYMBOL_GPL(ps3_disable_pm); 914EXPORT_SYMBOL_GPL(ps3_disable_pm);
@@ -938,7 +938,7 @@ int ps3_lpm_copy_tb(unsigned long offset, void *buf, unsigned long count,
938 if (offset >= lpm_priv->tb_count) 938 if (offset >= lpm_priv->tb_count)
939 return 0; 939 return 0;
940 940
941 count = min(count, lpm_priv->tb_count - offset); 941 count = min_t(u64, count, lpm_priv->tb_count - offset);
942 942
943 while (*bytes_copied < count) { 943 while (*bytes_copied < count) {
944 const unsigned long request = count - *bytes_copied; 944 const unsigned long request = count - *bytes_copied;
@@ -993,7 +993,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
993 if (offset >= lpm_priv->tb_count) 993 if (offset >= lpm_priv->tb_count)
994 return 0; 994 return 0;
995 995
996 count = min(count, lpm_priv->tb_count - offset); 996 count = min_t(u64, count, lpm_priv->tb_count - offset);
997 997
998 while (*bytes_copied < count) { 998 while (*bytes_copied < count) {
999 const unsigned long request = count - *bytes_copied; 999 const unsigned long request = count - *bytes_copied;
@@ -1013,7 +1013,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
1013 result = copy_to_user(buf, lpm_priv->tb_cache, tmp); 1013 result = copy_to_user(buf, lpm_priv->tb_cache, tmp);
1014 1014
1015 if (result) { 1015 if (result) {
1016 dev_dbg(sbd_core(), "%s:%u: 0x%lx bytes at 0x%p\n", 1016 dev_dbg(sbd_core(), "%s:%u: 0x%llx bytes at 0x%p\n",
1017 __func__, __LINE__, tmp, buf); 1017 __func__, __LINE__, tmp, buf);
1018 dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n", 1018 dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n",
1019 __func__, __LINE__, result); 1019 __func__, __LINE__, result);
@@ -1148,8 +1148,8 @@ int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache,
1148 lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT; 1148 lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT;
1149 lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT; 1149 lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT;
1150 1150
1151 dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%lx, outlet_id 0x%lx, " 1151 dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%llx, outlet_id 0x%llx, "
1152 "tb_size 0x%lx\n", __func__, __LINE__, lpm_priv->lpm_id, 1152 "tb_size 0x%llx\n", __func__, __LINE__, lpm_priv->lpm_id,
1153 lpm_priv->outlet_id, tb_size); 1153 lpm_priv->outlet_id, tb_size);
1154 1154
1155 return 0; 1155 return 0;
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
index 90c097a7a47a..e4ad5ba5d0a3 100644
--- a/drivers/ps3/ps3-vuart.c
+++ b/drivers/ps3/ps3-vuart.c
@@ -114,7 +114,7 @@ struct ports_bmp {
114static void __maybe_unused _dump_ports_bmp( 114static void __maybe_unused _dump_ports_bmp(
115 const struct ports_bmp *bmp, const char *func, int line) 115 const struct ports_bmp *bmp, const char *func, int line)
116{ 116{
117 pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status); 117 pr_debug("%s:%d: ports_bmp: %016llxh\n", func, line, bmp->status);
118} 118}
119 119
120#define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__) 120#define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__)
@@ -159,11 +159,13 @@ int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev,
159 struct vuart_triggers *trig) 159 struct vuart_triggers *trig)
160{ 160{
161 int result; 161 int result;
162 unsigned long size; 162 u64 size;
163 unsigned long val; 163 u64 val;
164 u64 tx;
164 165
165 result = lv1_get_virtual_uart_param(dev->port_number, 166 result = lv1_get_virtual_uart_param(dev->port_number,
166 PARAM_TX_TRIGGER, &trig->tx); 167 PARAM_TX_TRIGGER, &tx);
168 trig->tx = tx;
167 169
168 if (result) { 170 if (result) {
169 dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n", 171 dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n",
@@ -201,7 +203,7 @@ int ps3_vuart_set_triggers(struct ps3_system_bus_device *dev, unsigned int tx,
201 unsigned int rx) 203 unsigned int rx)
202{ 204{
203 int result; 205 int result;
204 unsigned long size; 206 u64 size;
205 207
206 result = lv1_set_virtual_uart_param(dev->port_number, 208 result = lv1_set_virtual_uart_param(dev->port_number,
207 PARAM_TX_TRIGGER, tx); 209 PARAM_TX_TRIGGER, tx);
@@ -248,7 +250,7 @@ static int ps3_vuart_get_rx_bytes_waiting(struct ps3_system_bus_device *dev,
248 dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n", 250 dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n",
249 __func__, __LINE__, ps3_result(result)); 251 __func__, __LINE__, ps3_result(result));
250 252
251 dev_dbg(&dev->core, "%s:%d: %lxh\n", __func__, __LINE__, 253 dev_dbg(&dev->core, "%s:%d: %llxh\n", __func__, __LINE__,
252 *bytes_waiting); 254 *bytes_waiting);
253 return result; 255 return result;
254} 256}
@@ -295,7 +297,7 @@ static int ps3_vuart_get_interrupt_status(struct ps3_system_bus_device *dev,
295 297
296 *status = tmp & priv->interrupt_mask; 298 *status = tmp & priv->interrupt_mask;
297 299
298 dev_dbg(&dev->core, "%s:%d: m %lxh, s %lxh, m&s %lxh\n", 300 dev_dbg(&dev->core, "%s:%d: m %llxh, s %llxh, m&s %lxh\n",
299 __func__, __LINE__, priv->interrupt_mask, tmp, *status); 301 __func__, __LINE__, priv->interrupt_mask, tmp, *status);
300 302
301 return result; 303 return result;
@@ -363,7 +365,7 @@ int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev)
363 */ 365 */
364 366
365static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, 367static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
366 const void *buf, unsigned int bytes, unsigned long *bytes_written) 368 const void *buf, unsigned int bytes, u64 *bytes_written)
367{ 369{
368 int result; 370 int result;
369 struct ps3_vuart_port_priv *priv = to_port_priv(dev); 371 struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -379,7 +381,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
379 381
380 priv->stats.bytes_written += *bytes_written; 382 priv->stats.bytes_written += *bytes_written;
381 383
382 dev_dbg(&dev->core, "%s:%d: wrote %lxh/%xh=>%lxh\n", __func__, __LINE__, 384 dev_dbg(&dev->core, "%s:%d: wrote %llxh/%xh=>%lxh\n", __func__, __LINE__,
383 *bytes_written, bytes, priv->stats.bytes_written); 385 *bytes_written, bytes, priv->stats.bytes_written);
384 386
385 return result; 387 return result;
@@ -393,7 +395,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
393 */ 395 */
394 396
395static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf, 397static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf,
396 unsigned int bytes, unsigned long *bytes_read) 398 unsigned int bytes, u64 *bytes_read)
397{ 399{
398 int result; 400 int result;
399 struct ps3_vuart_port_priv *priv = to_port_priv(dev); 401 struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -411,7 +413,7 @@ static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf,
411 413
412 priv->stats.bytes_read += *bytes_read; 414 priv->stats.bytes_read += *bytes_read;
413 415
414 dev_dbg(&dev->core, "%s:%d: read %lxh/%xh=>%lxh\n", __func__, __LINE__, 416 dev_dbg(&dev->core, "%s:%d: read %llxh/%xh=>%lxh\n", __func__, __LINE__,
415 *bytes_read, bytes, priv->stats.bytes_read); 417 *bytes_read, bytes, priv->stats.bytes_read);
416 418
417 return result; 419 return result;
@@ -500,7 +502,7 @@ int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
500 spin_lock_irqsave(&priv->tx_list.lock, flags); 502 spin_lock_irqsave(&priv->tx_list.lock, flags);
501 503
502 if (list_empty(&priv->tx_list.head)) { 504 if (list_empty(&priv->tx_list.head)) {
503 unsigned long bytes_written; 505 u64 bytes_written;
504 506
505 result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written); 507 result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written);
506 508
@@ -592,7 +594,7 @@ static int ps3_vuart_queue_rx_bytes(struct ps3_system_bus_device *dev,
592 list_add_tail(&lb->link, &priv->rx_list.head); 594 list_add_tail(&lb->link, &priv->rx_list.head);
593 priv->rx_list.bytes_held += bytes; 595 priv->rx_list.bytes_held += bytes;
594 596
595 dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %lxh bytes\n", 597 dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %llxh bytes\n",
596 __func__, __LINE__, lb->dbg_number, bytes); 598 __func__, __LINE__, lb->dbg_number, bytes);
597 599
598 *bytes_queued = bytes; 600 *bytes_queued = bytes;
@@ -745,7 +747,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev)
745 747
746 list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) { 748 list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) {
747 749
748 unsigned long bytes_written; 750 u64 bytes_written;
749 751
750 result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head, 752 result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head,
751 &bytes_written); 753 &bytes_written);
@@ -762,7 +764,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev)
762 if (bytes_written < lb->tail - lb->head) { 764 if (bytes_written < lb->tail - lb->head) {
763 lb->head += bytes_written; 765 lb->head += bytes_written;
764 dev_dbg(&dev->core, 766 dev_dbg(&dev->core,
765 "%s:%d cleared buf_%lu, %lxh bytes\n", 767 "%s:%d cleared buf_%lu, %llxh bytes\n",
766 __func__, __LINE__, lb->dbg_number, 768 __func__, __LINE__, lb->dbg_number,
767 bytes_written); 769 bytes_written);
768 goto port_full; 770 goto port_full;
diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
index 55955f16ad91..18066d555397 100644
--- a/drivers/ps3/ps3stor_lib.c
+++ b/drivers/ps3/ps3stor_lib.c
@@ -70,7 +70,7 @@ static int ps3stor_probe_access(struct ps3_storage_device *dev)
70 __func__, __LINE__, n); 70 __func__, __LINE__, n);
71 dev->region_idx = __ffs(dev->accessible_regions); 71 dev->region_idx = __ffs(dev->accessible_regions);
72 dev_info(&dev->sbd.core, 72 dev_info(&dev->sbd.core,
73 "First accessible region has index %u start %lu size %lu\n", 73 "First accessible region has index %u start %llu size %llu\n",
74 dev->region_idx, dev->regions[dev->region_idx].start, 74 dev->region_idx, dev->regions[dev->region_idx].start,
75 dev->regions[dev->region_idx].size); 75 dev->regions[dev->region_idx].size);
76 76
@@ -220,7 +220,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
220 const char *op = write ? "write" : "read"; 220 const char *op = write ? "write" : "read";
221 int res; 221 int res;
222 222
223 dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n", 223 dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n",
224 __func__, __LINE__, op, sectors, start_sector); 224 __func__, __LINE__, op, sectors, start_sector);
225 225
226 init_completion(&dev->done); 226 init_completion(&dev->done);
@@ -238,7 +238,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
238 238
239 wait_for_completion(&dev->done); 239 wait_for_completion(&dev->done);
240 if (dev->lv1_status) { 240 if (dev->lv1_status) {
241 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 241 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
242 __LINE__, op, dev->lv1_status); 242 __LINE__, op, dev->lv1_status);
243 return dev->lv1_status; 243 return dev->lv1_status;
244 } 244 }
@@ -268,7 +268,7 @@ u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd, u64 arg1,
268{ 268{
269 int res; 269 int res;
270 270
271 dev_dbg(&dev->sbd.core, "%s:%u: send device command 0x%lx\n", __func__, 271 dev_dbg(&dev->sbd.core, "%s:%u: send device command 0x%llx\n", __func__,
272 __LINE__, cmd); 272 __LINE__, cmd);
273 273
274 init_completion(&dev->done); 274 init_completion(&dev->done);
@@ -277,19 +277,19 @@ u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd, u64 arg1,
277 arg2, arg3, arg4, &dev->tag); 277 arg2, arg3, arg4, &dev->tag);
278 if (res) { 278 if (res) {
279 dev_err(&dev->sbd.core, 279 dev_err(&dev->sbd.core,
280 "%s:%u: send_device_command 0x%lx failed %d\n", 280 "%s:%u: send_device_command 0x%llx failed %d\n",
281 __func__, __LINE__, cmd, res); 281 __func__, __LINE__, cmd, res);
282 return -1; 282 return -1;
283 } 283 }
284 284
285 wait_for_completion(&dev->done); 285 wait_for_completion(&dev->done);
286 if (dev->lv1_status) { 286 if (dev->lv1_status) {
287 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%lx failed 0x%lx\n", 287 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%llx failed 0x%llx\n",
288 __func__, __LINE__, cmd, dev->lv1_status); 288 __func__, __LINE__, cmd, dev->lv1_status);
289 return dev->lv1_status; 289 return dev->lv1_status;
290 } 290 }
291 291
292 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%lx completed\n", __func__, 292 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%llx completed\n", __func__,
293 __LINE__, cmd); 293 __LINE__, cmd);
294 294
295 return 0; 295 return 0;
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index cc7eb8767b82..bd56a033bfd0 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -27,6 +27,8 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <mach/hardware.h>
31
30#define TIMER_FREQ CLOCK_TICK_RATE 32#define TIMER_FREQ CLOCK_TICK_RATE
31#define RTC_DEF_DIVIDER (32768 - 1) 33#define RTC_DEF_DIVIDER (32768 - 1)
32#define RTC_DEF_TRIM 0 34#define RTC_DEF_TRIM 0
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index 8ce5f74ee45b..ad35f76c46b7 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -120,7 +120,7 @@ static int twl4030_rtc_write_u8(u8 data, u8 reg)
120static unsigned char rtc_irq_bits; 120static unsigned char rtc_irq_bits;
121 121
122/* 122/*
123 * Enable timer and/or alarm interrupts. 123 * Enable 1/second update and/or alarm interrupts.
124 */ 124 */
125static int set_rtc_irq_bit(unsigned char bit) 125static int set_rtc_irq_bit(unsigned char bit)
126{ 126{
@@ -128,6 +128,7 @@ static int set_rtc_irq_bit(unsigned char bit)
128 int ret; 128 int ret;
129 129
130 val = rtc_irq_bits | bit; 130 val = rtc_irq_bits | bit;
131 val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M;
131 ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); 132 ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
132 if (ret == 0) 133 if (ret == 0)
133 rtc_irq_bits = val; 134 rtc_irq_bits = val;
@@ -136,7 +137,7 @@ static int set_rtc_irq_bit(unsigned char bit)
136} 137}
137 138
138/* 139/*
139 * Disable timer and/or alarm interrupts. 140 * Disable update and/or alarm interrupts.
140 */ 141 */
141static int mask_rtc_irq_bit(unsigned char bit) 142static int mask_rtc_irq_bit(unsigned char bit)
142{ 143{
@@ -151,7 +152,7 @@ static int mask_rtc_irq_bit(unsigned char bit)
151 return ret; 152 return ret;
152} 153}
153 154
154static inline int twl4030_rtc_alarm_irq_set_state(int enabled) 155static int twl4030_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
155{ 156{
156 int ret; 157 int ret;
157 158
@@ -163,7 +164,7 @@ static inline int twl4030_rtc_alarm_irq_set_state(int enabled)
163 return ret; 164 return ret;
164} 165}
165 166
166static inline int twl4030_rtc_irq_set_state(int enabled) 167static int twl4030_rtc_update_irq_enable(struct device *dev, unsigned enabled)
167{ 168{
168 int ret; 169 int ret;
169 170
@@ -292,7 +293,7 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
292 unsigned char alarm_data[ALL_TIME_REGS + 1]; 293 unsigned char alarm_data[ALL_TIME_REGS + 1];
293 int ret; 294 int ret;
294 295
295 ret = twl4030_rtc_alarm_irq_set_state(0); 296 ret = twl4030_rtc_alarm_irq_enable(dev, 0);
296 if (ret) 297 if (ret)
297 goto out; 298 goto out;
298 299
@@ -312,35 +313,11 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
312 } 313 }
313 314
314 if (alm->enabled) 315 if (alm->enabled)
315 ret = twl4030_rtc_alarm_irq_set_state(1); 316 ret = twl4030_rtc_alarm_irq_enable(dev, 1);
316out: 317out:
317 return ret; 318 return ret;
318} 319}
319 320
320#ifdef CONFIG_RTC_INTF_DEV
321
322static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
323 unsigned long arg)
324{
325 switch (cmd) {
326 case RTC_AIE_OFF:
327 return twl4030_rtc_alarm_irq_set_state(0);
328 case RTC_AIE_ON:
329 return twl4030_rtc_alarm_irq_set_state(1);
330 case RTC_UIE_OFF:
331 return twl4030_rtc_irq_set_state(0);
332 case RTC_UIE_ON:
333 return twl4030_rtc_irq_set_state(1);
334
335 default:
336 return -ENOIOCTLCMD;
337 }
338}
339
340#else
341#define twl4030_rtc_ioctl NULL
342#endif
343
344static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) 321static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
345{ 322{
346 unsigned long events = 0; 323 unsigned long events = 0;
@@ -400,11 +377,12 @@ out:
400} 377}
401 378
402static struct rtc_class_ops twl4030_rtc_ops = { 379static struct rtc_class_ops twl4030_rtc_ops = {
403 .ioctl = twl4030_rtc_ioctl,
404 .read_time = twl4030_rtc_read_time, 380 .read_time = twl4030_rtc_read_time,
405 .set_time = twl4030_rtc_set_time, 381 .set_time = twl4030_rtc_set_time,
406 .read_alarm = twl4030_rtc_read_alarm, 382 .read_alarm = twl4030_rtc_read_alarm,
407 .set_alarm = twl4030_rtc_set_alarm, 383 .set_alarm = twl4030_rtc_set_alarm,
384 .alarm_irq_enable = twl4030_rtc_alarm_irq_enable,
385 .update_irq_enable = twl4030_rtc_update_irq_enable,
408}; 386};
409 387
410/*----------------------------------------------------------------------*/ 388/*----------------------------------------------------------------------*/
@@ -422,7 +400,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
422 rtc = rtc_device_register(pdev->name, 400 rtc = rtc_device_register(pdev->name,
423 &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); 401 &pdev->dev, &twl4030_rtc_ops, THIS_MODULE);
424 if (IS_ERR(rtc)) { 402 if (IS_ERR(rtc)) {
425 ret = -EINVAL; 403 ret = PTR_ERR(rtc);
426 dev_err(&pdev->dev, "can't register RTC device, err %ld\n", 404 dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
427 PTR_ERR(rtc)); 405 PTR_ERR(rtc));
428 goto out0; 406 goto out0;
@@ -432,7 +410,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
432 platform_set_drvdata(pdev, rtc); 410 platform_set_drvdata(pdev, rtc);
433 411
434 ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); 412 ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
435
436 if (ret < 0) 413 if (ret < 0)
437 goto out1; 414 goto out1;
438 415
@@ -475,7 +452,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
475 452
476 return ret; 453 return ret;
477 454
478
479out2: 455out2:
480 free_irq(irq, rtc); 456 free_irq(irq, rtc);
481out1: 457out1:
@@ -506,8 +482,9 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev)
506 482
507static void twl4030_rtc_shutdown(struct platform_device *pdev) 483static void twl4030_rtc_shutdown(struct platform_device *pdev)
508{ 484{
509 mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M | 485 /* mask timer interrupts, but leave alarm interrupts on to enable
510 BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); 486 power-on when alarm is triggered */
487 mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
511} 488}
512 489
513#ifdef CONFIG_PM 490#ifdef CONFIG_PM
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index ee0739b217b6..91ef669d98f6 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -933,7 +933,7 @@ static void ibmvfc_get_host_speed(struct Scsi_Host *shost)
933 fc_host_speed(shost) = FC_PORTSPEED_16GBIT; 933 fc_host_speed(shost) = FC_PORTSPEED_16GBIT;
934 break; 934 break;
935 default: 935 default:
936 ibmvfc_log(vhost, 3, "Unknown port speed: %ld Gbit\n", 936 ibmvfc_log(vhost, 3, "Unknown port speed: %lld Gbit\n",
937 vhost->login_buf->resp.link_speed / 100); 937 vhost->login_buf->resp.link_speed / 100);
938 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 938 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
939 break; 939 break;
@@ -2149,8 +2149,8 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
2149{ 2149{
2150 const char *desc = ibmvfc_get_ae_desc(crq->event); 2150 const char *desc = ibmvfc_get_ae_desc(crq->event);
2151 2151
2152 ibmvfc_log(vhost, 3, "%s event received. scsi_id: %lx, wwpn: %lx," 2152 ibmvfc_log(vhost, 3, "%s event received. scsi_id: %llx, wwpn: %llx,"
2153 " node_name: %lx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name); 2153 " node_name: %llx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name);
2154 2154
2155 switch (crq->event) { 2155 switch (crq->event) {
2156 case IBMVFC_AE_LINK_UP: 2156 case IBMVFC_AE_LINK_UP:
@@ -2184,7 +2184,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
2184 ibmvfc_link_down(vhost, IBMVFC_HALTED); 2184 ibmvfc_link_down(vhost, IBMVFC_HALTED);
2185 break; 2185 break;
2186 default: 2186 default:
2187 dev_err(vhost->dev, "Unknown async event received: %ld\n", crq->event); 2187 dev_err(vhost->dev, "Unknown async event received: %lld\n", crq->event);
2188 break; 2188 break;
2189 }; 2189 };
2190} 2190}
@@ -2261,13 +2261,13 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost)
2261 * actually sent 2261 * actually sent
2262 */ 2262 */
2263 if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) { 2263 if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) {
2264 dev_err(vhost->dev, "Returned correlation_token 0x%08lx is invalid!\n", 2264 dev_err(vhost->dev, "Returned correlation_token 0x%08llx is invalid!\n",
2265 crq->ioba); 2265 crq->ioba);
2266 return; 2266 return;
2267 } 2267 }
2268 2268
2269 if (unlikely(atomic_read(&evt->free))) { 2269 if (unlikely(atomic_read(&evt->free))) {
2270 dev_err(vhost->dev, "Received duplicate correlation_token 0x%08lx!\n", 2270 dev_err(vhost->dev, "Received duplicate correlation_token 0x%08llx!\n",
2271 crq->ioba); 2271 crq->ioba);
2272 return; 2272 return;
2273 } 2273 }
@@ -3259,7 +3259,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id)
3259 3259
3260 tgt = mempool_alloc(vhost->tgt_pool, GFP_KERNEL); 3260 tgt = mempool_alloc(vhost->tgt_pool, GFP_KERNEL);
3261 if (!tgt) { 3261 if (!tgt) {
3262 dev_err(vhost->dev, "Target allocation failure for scsi id %08lx\n", 3262 dev_err(vhost->dev, "Target allocation failure for scsi id %08llx\n",
3263 scsi_id); 3263 scsi_id);
3264 return -ENOMEM; 3264 return -ENOMEM;
3265 } 3265 }
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index babdf3db59df..87dafd0f8d44 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -691,13 +691,13 @@ struct ibmvfc_host {
691#define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0) 691#define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0)
692 692
693#define tgt_dbg(t, fmt, ...) \ 693#define tgt_dbg(t, fmt, ...) \
694 DBG_CMD(dev_info((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__)) 694 DBG_CMD(dev_info((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__))
695 695
696#define tgt_info(t, fmt, ...) \ 696#define tgt_info(t, fmt, ...) \
697 dev_info((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__) 697 dev_info((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__)
698 698
699#define tgt_err(t, fmt, ...) \ 699#define tgt_err(t, fmt, ...) \
700 dev_err((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__) 700 dev_err((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__)
701 701
702#define ibmvfc_dbg(vhost, ...) \ 702#define ibmvfc_dbg(vhost, ...) \
703 DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__)) 703 DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__))
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 5c541f7850f9..74d07d137dae 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1061,7 +1061,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1061 } 1061 }
1062 1062
1063 sdev_printk(KERN_INFO, cmd->device, 1063 sdev_printk(KERN_INFO, cmd->device,
1064 "aborting command. lun 0x%lx, tag 0x%lx\n", 1064 "aborting command. lun 0x%llx, tag 0x%llx\n",
1065 (((u64) lun) << 48), (u64) found_evt); 1065 (((u64) lun) << 48), (u64) found_evt);
1066 1066
1067 wait_for_completion(&evt->comp); 1067 wait_for_completion(&evt->comp);
@@ -1082,7 +1082,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1082 if (rsp_rc) { 1082 if (rsp_rc) {
1083 if (printk_ratelimit()) 1083 if (printk_ratelimit())
1084 sdev_printk(KERN_WARNING, cmd->device, 1084 sdev_printk(KERN_WARNING, cmd->device,
1085 "abort code %d for task tag 0x%lx\n", 1085 "abort code %d for task tag 0x%llx\n",
1086 rsp_rc, tsk_mgmt->task_tag); 1086 rsp_rc, tsk_mgmt->task_tag);
1087 return FAILED; 1087 return FAILED;
1088 } 1088 }
@@ -1102,12 +1102,12 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1102 1102
1103 if (found_evt == NULL) { 1103 if (found_evt == NULL) {
1104 spin_unlock_irqrestore(hostdata->host->host_lock, flags); 1104 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
1105 sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%lx completed\n", 1105 sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%llx completed\n",
1106 tsk_mgmt->task_tag); 1106 tsk_mgmt->task_tag);
1107 return SUCCESS; 1107 return SUCCESS;
1108 } 1108 }
1109 1109
1110 sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%lx\n", 1110 sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%llx\n",
1111 tsk_mgmt->task_tag); 1111 tsk_mgmt->task_tag);
1112 1112
1113 cmd->result = (DID_ABORT << 16); 1113 cmd->result = (DID_ABORT << 16);
@@ -1182,7 +1182,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1182 return FAILED; 1182 return FAILED;
1183 } 1183 }
1184 1184
1185 sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%lx\n", 1185 sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%llx\n",
1186 (((u64) lun) << 48)); 1186 (((u64) lun) << 48));
1187 1187
1188 wait_for_completion(&evt->comp); 1188 wait_for_completion(&evt->comp);
@@ -1203,7 +1203,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1203 if (rsp_rc) { 1203 if (rsp_rc) {
1204 if (printk_ratelimit()) 1204 if (printk_ratelimit())
1205 sdev_printk(KERN_WARNING, cmd->device, 1205 sdev_printk(KERN_WARNING, cmd->device,
1206 "reset code %d for task tag 0x%lx\n", 1206 "reset code %d for task tag 0x%llx\n",
1207 rsp_rc, tsk_mgmt->task_tag); 1207 rsp_rc, tsk_mgmt->task_tag);
1208 return FAILED; 1208 return FAILED;
1209 } 1209 }
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 841f460edbc4..07829009a8be 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4912,7 +4912,7 @@ static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
4912 if (res && ipr_is_gata(res)) { 4912 if (res && ipr_is_gata(res)) {
4913 if (cmd == HDIO_GET_IDENTITY) 4913 if (cmd == HDIO_GET_IDENTITY)
4914 return -ENOTTY; 4914 return -ENOTTY;
4915 return ata_scsi_ioctl(sdev, cmd, arg); 4915 return ata_sas_scsi_ioctl(res->sata_port->ap, sdev, cmd, arg);
4916 } 4916 }
4917 4917
4918 return -EINVAL; 4918 return -EINVAL;
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index a745f91d2928..e7705d3532c9 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -177,7 +177,6 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
177 struct iscsi_segment *segment, int recv, 177 struct iscsi_segment *segment, int recv,
178 unsigned copied) 178 unsigned copied)
179{ 179{
180 static unsigned char padbuf[ISCSI_PAD_LEN];
181 struct scatterlist sg; 180 struct scatterlist sg;
182 unsigned int pad; 181 unsigned int pad;
183 182
@@ -233,7 +232,7 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
233 debug_tcp("consume %d pad bytes\n", pad); 232 debug_tcp("consume %d pad bytes\n", pad);
234 segment->total_size += pad; 233 segment->total_size += pad;
235 segment->size = pad; 234 segment->size = pad;
236 segment->data = padbuf; 235 segment->data = segment->padbuf;
237 return 0; 236 return 0;
238 } 237 }
239 } 238 }
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 744838780ada..1c558d3bce18 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -717,7 +717,7 @@ int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
717 struct domain_device *dev = sdev_to_domain_dev(sdev); 717 struct domain_device *dev = sdev_to_domain_dev(sdev);
718 718
719 if (dev_is_sata(dev)) 719 if (dev_is_sata(dev))
720 return ata_scsi_ioctl(sdev, cmd, arg); 720 return ata_sas_scsi_ioctl(dev->sata_dev.ap, sdev, cmd, arg);
721 721
722 return -EINVAL; 722 return -EINVAL;
723} 723}
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index ce48e2d0193c..ca0dd33497ec 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -290,11 +290,11 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data)
290 290
291 if (tag != dev->tag) 291 if (tag != dev->tag)
292 dev_err(&dev->sbd.core, 292 dev_err(&dev->sbd.core,
293 "%s:%u: tag mismatch, got %lx, expected %lx\n", 293 "%s:%u: tag mismatch, got %llx, expected %llx\n",
294 __func__, __LINE__, tag, dev->tag); 294 __func__, __LINE__, tag, dev->tag);
295 295
296 if (res) { 296 if (res) {
297 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", 297 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
298 __func__, __LINE__, res, status); 298 __func__, __LINE__, res, status);
299 return IRQ_HANDLED; 299 return IRQ_HANDLED;
300 } 300 }
@@ -364,7 +364,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev)
364 364
365 if (dev->blk_size != CD_FRAMESIZE) { 365 if (dev->blk_size != CD_FRAMESIZE) {
366 dev_err(&dev->sbd.core, 366 dev_err(&dev->sbd.core,
367 "%s:%u: cannot handle block size %lu\n", __func__, 367 "%s:%u: cannot handle block size %llu\n", __func__,
368 __LINE__, dev->blk_size); 368 __LINE__, dev->blk_size);
369 return -EINVAL; 369 return -EINVAL;
370 } 370 }
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2d4f32b4df5c..9ad4d0968e5c 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
1258{ 1258{
1259 int rval; 1259 int rval;
1260 unsigned long flags = 0; 1260 unsigned long flags = 0;
1261 int cnt; 1261 int cnt, que;
1262 struct qla_hw_data *ha = vha->hw; 1262 struct qla_hw_data *ha = vha->hw;
1263 struct req_que *req = ha->req_q_map[0]; 1263 struct req_que *req;
1264 struct rsp_que *rsp = ha->rsp_q_map[0]; 1264 struct rsp_que *rsp;
1265 struct scsi_qla_host *vp;
1265 struct mid_init_cb_24xx *mid_init_cb = 1266 struct mid_init_cb_24xx *mid_init_cb =
1266 (struct mid_init_cb_24xx *) ha->init_cb; 1267 (struct mid_init_cb_24xx *) ha->init_cb;
1267 1268
1268 spin_lock_irqsave(&ha->hardware_lock, flags); 1269 spin_lock_irqsave(&ha->hardware_lock, flags);
1269 1270
1270 /* Clear outstanding commands array. */ 1271 /* Clear outstanding commands array. */
1271 for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) 1272 for (que = 0; que < ha->max_queues; que++) {
1272 req->outstanding_cmds[cnt] = NULL; 1273 req = ha->req_q_map[que];
1274 if (!req)
1275 continue;
1276 for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
1277 req->outstanding_cmds[cnt] = NULL;
1273 1278
1274 req->current_outstanding_cmd = 0; 1279 req->current_outstanding_cmd = 0;
1275 1280
1276 /* Clear RSCN queue. */ 1281 /* Initialize firmware. */
1277 vha->rscn_in_ptr = 0; 1282 req->ring_ptr = req->ring;
1278 vha->rscn_out_ptr = 0; 1283 req->ring_index = 0;
1284 req->cnt = req->length;
1285 }
1279 1286
1280 /* Initialize firmware. */ 1287 for (que = 0; que < ha->max_queues; que++) {
1281 req->ring_ptr = req->ring; 1288 rsp = ha->rsp_q_map[que];
1282 req->ring_index = 0; 1289 if (!rsp)
1283 req->cnt = req->length; 1290 continue;
1284 rsp->ring_ptr = rsp->ring; 1291 rsp->ring_ptr = rsp->ring;
1285 rsp->ring_index = 0; 1292 rsp->ring_index = 0;
1286 1293
1287 /* Initialize response queue entries */ 1294 /* Initialize response queue entries */
1288 qla2x00_init_response_q_entries(rsp); 1295 qla2x00_init_response_q_entries(rsp);
1296 }
1289 1297
1298 /* Clear RSCN queue. */
1299 list_for_each_entry(vp, &ha->vp_list, list) {
1300 vp->rscn_in_ptr = 0;
1301 vp->rscn_out_ptr = 0;
1302 }
1290 ha->isp_ops->config_rings(vha); 1303 ha->isp_ops->config_rings(vha);
1291 1304
1292 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1305 spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -3212,8 +3225,8 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
3212 int rval = QLA_SUCCESS; 3225 int rval = QLA_SUCCESS;
3213 uint32_t wait_time; 3226 uint32_t wait_time;
3214 struct qla_hw_data *ha = vha->hw; 3227 struct qla_hw_data *ha = vha->hw;
3215 struct req_que *req = ha->req_q_map[0]; 3228 struct req_que *req = ha->req_q_map[vha->req_ques[0]];
3216 struct rsp_que *rsp = ha->rsp_q_map[0]; 3229 struct rsp_que *rsp = req->rsp;
3217 3230
3218 atomic_set(&vha->loop_state, LOOP_UPDATE); 3231 atomic_set(&vha->loop_state, LOOP_UPDATE);
3219 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); 3232 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
@@ -3492,6 +3505,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
3492 } 3505 }
3493 req = ha->req_q_map[i]; 3506 req = ha->req_q_map[i];
3494 if (req) { 3507 if (req) {
3508 /* Clear outstanding commands array. */
3495 req->options &= ~BIT_0; 3509 req->options &= ~BIT_0;
3496 ret = qla25xx_init_req_que(base_vha, req, req->options); 3510 ret = qla25xx_init_req_que(base_vha, req, req->options);
3497 if (ret != QLA_SUCCESS) 3511 if (ret != QLA_SUCCESS)
@@ -3500,7 +3514,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
3500 req->id)); 3514 req->id));
3501 else 3515 else
3502 DEBUG2_17(printk(KERN_WARNING 3516 DEBUG2_17(printk(KERN_WARNING
3503 "%s Rsp que:%d inited\n", __func__, 3517 "%s Req que:%d inited\n", __func__,
3504 req->id)); 3518 req->id));
3505 } 3519 }
3506 } 3520 }
@@ -4151,8 +4165,8 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
4151 uint16_t mb[MAILBOX_REGISTER_COUNT]; 4165 uint16_t mb[MAILBOX_REGISTER_COUNT];
4152 struct qla_hw_data *ha = vha->hw; 4166 struct qla_hw_data *ha = vha->hw;
4153 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); 4167 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
4154 struct req_que *req = ha->req_q_map[0]; 4168 struct req_que *req = ha->req_q_map[vha->req_ques[0]];
4155 struct rsp_que *rsp = ha->rsp_q_map[0]; 4169 struct rsp_que *rsp = req->rsp;
4156 4170
4157 if (!vha->vp_idx) 4171 if (!vha->vp_idx)
4158 return -EINVAL; 4172 return -EINVAL;
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 886323130fcc..f53179c46423 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -629,6 +629,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
629 req->ring_index = 0; 629 req->ring_index = 0;
630 req->cnt = req->length; 630 req->cnt = req->length;
631 req->id = que_id; 631 req->id = que_id;
632 req->max_q_depth = ha->req_q_map[0]->max_q_depth;
632 mutex_unlock(&ha->vport_lock); 633 mutex_unlock(&ha->vport_lock);
633 634
634 ret = qla25xx_init_req_que(base_vha, req, options); 635 ret = qla25xx_init_req_que(base_vha, req, options);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 4a71f522f925..cf32653fe01a 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1158,8 +1158,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
1158 struct req_que *req; 1158 struct req_que *req;
1159 1159
1160 spin_lock_irqsave(&ha->hardware_lock, flags); 1160 spin_lock_irqsave(&ha->hardware_lock, flags);
1161 for (que = 0; que < QLA_MAX_HOST_QUES; que++) { 1161 for (que = 0; que < ha->max_queues; que++) {
1162 req = ha->req_q_map[vha->req_ques[que]]; 1162 req = ha->req_q_map[que];
1163 if (!req) 1163 if (!req)
1164 continue; 1164 continue;
1165 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { 1165 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
@@ -1193,7 +1193,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1193 scsi_qla_host_t *vha = shost_priv(sdev->host); 1193 scsi_qla_host_t *vha = shost_priv(sdev->host);
1194 struct qla_hw_data *ha = vha->hw; 1194 struct qla_hw_data *ha = vha->hw;
1195 struct fc_rport *rport = starget_to_rport(sdev->sdev_target); 1195 struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
1196 struct req_que *req = ha->req_q_map[0]; 1196 struct req_que *req = ha->req_q_map[vha->req_ques[0]];
1197 1197
1198 if (sdev->tagged_supported) 1198 if (sdev->tagged_supported)
1199 scsi_activate_tcq(sdev, req->max_q_depth); 1199 scsi_activate_tcq(sdev, req->max_q_depth);
@@ -1998,7 +1998,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1998 return 0; 1998 return 0;
1999 1999
2000probe_failed: 2000probe_failed:
2001 qla2x00_free_que(ha, req, rsp);
2002 qla2x00_free_device(base_vha); 2001 qla2x00_free_device(base_vha);
2003 2002
2004 scsi_host_put(base_vha->host); 2003 scsi_host_put(base_vha->host);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 42e72a2c1f98..cbcd3f681b62 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1095,7 +1095,8 @@ EXPORT_SYMBOL(__starget_for_each_device);
1095 * Description: Looks up the scsi_device with the specified @lun for a given 1095 * Description: Looks up the scsi_device with the specified @lun for a given
1096 * @starget. The returned scsi_device does not have an additional 1096 * @starget. The returned scsi_device does not have an additional
1097 * reference. You must hold the host's host_lock over this call and 1097 * reference. You must hold the host's host_lock over this call and
1098 * any access to the returned scsi_device. 1098 * any access to the returned scsi_device. A scsi_device in state
1099 * SDEV_DEL is skipped.
1099 * 1100 *
1100 * Note: The only reason why drivers should use this is because 1101 * Note: The only reason why drivers should use this is because
1101 * they need to access the device list in irq context. Otherwise you 1102 * they need to access the device list in irq context. Otherwise you
@@ -1107,6 +1108,8 @@ struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget,
1107 struct scsi_device *sdev; 1108 struct scsi_device *sdev;
1108 1109
1109 list_for_each_entry(sdev, &starget->devices, same_target_siblings) { 1110 list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
1111 if (sdev->sdev_state == SDEV_DEL)
1112 continue;
1110 if (sdev->lun ==lun) 1113 if (sdev->lun ==lun)
1111 return sdev; 1114 return sdev;
1112 } 1115 }
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 4969e4ec75ea..099b5455bbce 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -224,6 +224,7 @@ static struct {
224 {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, 224 {"SGI", "TP9100", "*", BLIST_REPORTLUN2},
225 {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 225 {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
226 {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 226 {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
227 {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
227 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, 228 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
228 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, 229 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
229 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ 230 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index c088146b7513..2a3671233b15 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -602,6 +602,10 @@ static int pci_netmos_init(struct pci_dev *dev)
602 /* subdevice 0x00PS means <P> parallel, <S> serial */ 602 /* subdevice 0x00PS means <P> parallel, <S> serial */
603 unsigned int num_serial = dev->subsystem_device & 0xf; 603 unsigned int num_serial = dev->subsystem_device & 0xf;
604 604
605 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
606 dev->subsystem_device == 0x0299)
607 return 0;
608
605 if (num_serial == 0) 609 if (num_serial == 0)
606 return -ENODEV; 610 return -ENODEV;
607 return num_serial; 611 return num_serial;
@@ -3096,6 +3100,10 @@ static struct pci_device_id serial_pci_tbl[] = {
3096 0, 3100 0,
3097 pbn_b0_8_115200 }, 3101 pbn_b0_8_115200 },
3098 3102
3103 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
3104 PCI_VENDOR_ID_IBM, 0x0299,
3105 0, 0, pbn_b0_bt_2_115200 },
3106
3099 /* 3107 /*
3100 * These entries match devices with class COMMUNICATION_SERIAL, 3108 * These entries match devices with class COMMUNICATION_SERIAL,
3101 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL 3109 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index fde7f9ccf57e..bbcfc26a3b6d 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -270,6 +270,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
270 { "RSS0250", 0 }, 270 { "RSS0250", 0 },
271 /* SupraExpress 28.8 Data/Fax PnP modem */ 271 /* SupraExpress 28.8 Data/Fax PnP modem */
272 { "SUP1310", 0 }, 272 { "SUP1310", 0 },
273 /* SupraExpress 336i PnP Voice Modem */
274 { "SUP1381", 0 },
273 /* SupraExpress 33.6 Data/Fax PnP modem */ 275 /* SupraExpress 33.6 Data/Fax PnP modem */
274 { "SUP1421", 0 }, 276 { "SUP1421", 0 },
275 /* SupraExpress 33.6 Data/Fax PnP modem */ 277 /* SupraExpress 33.6 Data/Fax PnP modem */
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index d5efd6c77904..89362d733d62 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -579,7 +579,7 @@ static void atmel_tx_dma(struct uart_port *port)
579 /* disable PDC transmit */ 579 /* disable PDC transmit */
580 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); 580 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
581 581
582 if (!uart_circ_empty(xmit)) { 582 if (!uart_circ_empty(xmit) && !uart_tx_stopped(port)) {
583 dma_sync_single_for_device(port->dev, 583 dma_sync_single_for_device(port->dev,
584 pdc->dma_addr, 584 pdc->dma_addr,
585 pdc->dma_size, 585 pdc->dma_size,
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index a821e3a3d664..14f8fa9135be 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -163,6 +163,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
163 { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, 163 { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, },
164 { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, 164 { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, },
165 { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, 165 { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, },
166 { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, },
166#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL 167#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
167 { .type = "serial", .compatible = "ibm,qpace-nwp-serial", 168 { .type = "serial", .compatible = "ibm,qpace-nwp-serial",
168 .data = (void *)PORT_NWPSERIAL, }, 169 .data = (void *)PORT_NWPSERIAL, },
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 22e30d21225e..1bb8f1b45767 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | 187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); 188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { 189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
190 ch = serial_in(sport, PNX8XXX_FIFO); 190 ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
191 191
192 sport->port.icount.rx++; 192 sport->port.icount.rx++;
193 193
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
198 * out of the main execution path 198 * out of the main execution path
199 */ 199 */
200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | 200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
201 PNX8XXX_UART_FIFO_RXPAR) | 201 PNX8XXX_UART_FIFO_RXPAR |
202 PNX8XXX_UART_FIFO_RXBRK) |
202 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { 203 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
203 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) 204 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) {
205 status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
206 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR));
207 sport->port.icount.brk++;
208 if (uart_handle_break(&sport->port))
209 goto ignore_char;
210 } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
204 sport->port.icount.parity++; 211 sport->port.icount.parity++;
205 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) 212 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
206 sport->port.icount.frame++; 213 sport->port.icount.frame++;
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
284 /* Get the interrupts */ 291 /* Get the interrupts */
285 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); 292 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
286 293
287 /* Break signal received */ 294 /* Byte or break signal received */
288 if (status & PNX8XXX_UART_INT_BREAK) { 295 if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK))
289 sport->port.icount.brk++;
290 uart_handle_break(&sport->port);
291 }
292
293 /* Byte received */
294 if (status & PNX8XXX_UART_INT_RX)
295 pnx8xxx_rx_chars(sport); 296 pnx8xxx_rx_chars(sport);
296 297
297 /* TX holding register empty - transmit a byte */ 298 /* TX holding register empty - transmit a byte */
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 5e39bac9c51b..56ff3e6864ea 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -670,8 +670,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
670 dev_dbg(controller, "new message %p submitted for %s\n", 670 dev_dbg(controller, "new message %p submitted for %s\n",
671 msg, spi->dev.bus_id); 671 msg, spi->dev.bus_id);
672 672
673 if (unlikely(list_empty(&msg->transfers) 673 if (unlikely(list_empty(&msg->transfers)))
674 || !spi->max_speed_hz))
675 return -EINVAL; 674 return -EINVAL;
676 675
677 if (as->stopping) 676 if (as->stopping)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 68d6f4988fb5..fe7e5f35e5d0 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -15,12 +15,15 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18
19#include <linux/of_platform.h>
20#include <linux/of_device.h>
21#include <linux/of_spi.h>
22
18#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
19#include <linux/spi/spi_bitbang.h> 24#include <linux/spi/spi_bitbang.h>
20#include <linux/io.h> 25#include <linux/io.h>
21 26
22#include <syslib/virtex_devices.h>
23
24#define XILINX_SPI_NAME "xilinx_spi" 27#define XILINX_SPI_NAME "xilinx_spi"
25 28
26/* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e) 29/* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e)
@@ -144,23 +147,14 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
144 struct spi_transfer *t) 147 struct spi_transfer *t)
145{ 148{
146 u8 bits_per_word; 149 u8 bits_per_word;
147 u32 hz;
148 struct xilinx_spi *xspi = spi_master_get_devdata(spi->master);
149 150
150 bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; 151 bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
151 hz = (t) ? t->speed_hz : spi->max_speed_hz;
152 if (bits_per_word != 8) { 152 if (bits_per_word != 8) {
153 dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", 153 dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
154 __func__, bits_per_word); 154 __func__, bits_per_word);
155 return -EINVAL; 155 return -EINVAL;
156 } 156 }
157 157
158 if (hz && xspi->speed_hz > hz) {
159 dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n",
160 __func__, hz);
161 return -EINVAL;
162 }
163
164 return 0; 158 return 0;
165} 159}
166 160
@@ -304,32 +298,38 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
304 return IRQ_HANDLED; 298 return IRQ_HANDLED;
305} 299}
306 300
307static int __init xilinx_spi_probe(struct platform_device *dev) 301static int __init xilinx_spi_of_probe(struct of_device *ofdev,
302 const struct of_device_id *match)
308{ 303{
309 int ret = 0;
310 struct spi_master *master; 304 struct spi_master *master;
311 struct xilinx_spi *xspi; 305 struct xilinx_spi *xspi;
312 struct xspi_platform_data *pdata; 306 struct resource r_irq_struct;
313 struct resource *r; 307 struct resource r_mem_struct;
308
309 struct resource *r_irq = &r_irq_struct;
310 struct resource *r_mem = &r_mem_struct;
311 int rc = 0;
312 const u32 *prop;
313 int len;
314 314
315 /* Get resources(memory, IRQ) associated with the device */ 315 /* Get resources(memory, IRQ) associated with the device */
316 master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); 316 master = spi_alloc_master(&ofdev->dev, sizeof(struct xilinx_spi));
317 317
318 if (master == NULL) { 318 if (master == NULL) {
319 return -ENOMEM; 319 return -ENOMEM;
320 } 320 }
321 321
322 platform_set_drvdata(dev, master); 322 dev_set_drvdata(&ofdev->dev, master);
323 pdata = dev->dev.platform_data;
324 323
325 if (pdata == NULL) { 324 rc = of_address_to_resource(ofdev->node, 0, r_mem);
326 ret = -ENODEV; 325 if (rc) {
326 dev_warn(&ofdev->dev, "invalid address\n");
327 goto put_master; 327 goto put_master;
328 } 328 }
329 329
330 r = platform_get_resource(dev, IORESOURCE_MEM, 0); 330 rc = of_irq_to_resource(ofdev->node, 0, r_irq);
331 if (r == NULL) { 331 if (rc == NO_IRQ) {
332 ret = -ENODEV; 332 dev_warn(&ofdev->dev, "no IRQ found\n");
333 goto put_master; 333 goto put_master;
334 } 334 }
335 335
@@ -341,47 +341,57 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
341 xspi->bitbang.master->setup = xilinx_spi_setup; 341 xspi->bitbang.master->setup = xilinx_spi_setup;
342 init_completion(&xspi->done); 342 init_completion(&xspi->done);
343 343
344 if (!request_mem_region(r->start, 344 xspi->irq = r_irq->start;
345 r->end - r->start + 1, XILINX_SPI_NAME)) { 345
346 ret = -ENXIO; 346 if (!request_mem_region(r_mem->start,
347 r_mem->end - r_mem->start + 1, XILINX_SPI_NAME)) {
348 rc = -ENXIO;
349 dev_warn(&ofdev->dev, "memory request failure\n");
347 goto put_master; 350 goto put_master;
348 } 351 }
349 352
350 xspi->regs = ioremap(r->start, r->end - r->start + 1); 353 xspi->regs = ioremap(r_mem->start, r_mem->end - r_mem->start + 1);
351 if (xspi->regs == NULL) { 354 if (xspi->regs == NULL) {
352 ret = -ENOMEM; 355 rc = -ENOMEM;
356 dev_warn(&ofdev->dev, "ioremap failure\n");
353 goto put_master; 357 goto put_master;
354 } 358 }
359 xspi->irq = r_irq->start;
355 360
356 ret = platform_get_irq(dev, 0); 361 /* dynamic bus assignment */
357 if (ret < 0) { 362 master->bus_num = -1;
358 ret = -ENXIO;
359 goto unmap_io;
360 }
361 xspi->irq = ret;
362 363
363 master->bus_num = pdata->bus_num; 364 /* number of slave select bits is required */
364 master->num_chipselect = pdata->num_chipselect; 365 prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len);
365 xspi->speed_hz = pdata->speed_hz; 366 if (!prop || len < sizeof(*prop)) {
367 dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n");
368 goto put_master;
369 }
370 master->num_chipselect = *prop;
366 371
367 /* SPI controller initializations */ 372 /* SPI controller initializations */
368 xspi_init_hw(xspi->regs); 373 xspi_init_hw(xspi->regs);
369 374
370 /* Register for SPI Interrupt */ 375 /* Register for SPI Interrupt */
371 ret = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); 376 rc = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi);
372 if (ret != 0) 377 if (rc != 0) {
378 dev_warn(&ofdev->dev, "irq request failure: %d\n", xspi->irq);
373 goto unmap_io; 379 goto unmap_io;
380 }
374 381
375 ret = spi_bitbang_start(&xspi->bitbang); 382 rc = spi_bitbang_start(&xspi->bitbang);
376 if (ret != 0) { 383 if (rc != 0) {
377 dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); 384 dev_err(&ofdev->dev, "spi_bitbang_start FAILED\n");
378 goto free_irq; 385 goto free_irq;
379 } 386 }
380 387
381 dev_info(&dev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", 388 dev_info(&ofdev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n",
382 r->start, (u32)xspi->regs, xspi->irq); 389 (unsigned int)r_mem->start, (u32)xspi->regs, xspi->irq);
383 390
384 return ret; 391 /* Add any subnodes on the SPI bus */
392 of_register_spi_devices(master, ofdev->node);
393
394 return rc;
385 395
386free_irq: 396free_irq:
387 free_irq(xspi->irq, xspi); 397 free_irq(xspi->irq, xspi);
@@ -389,21 +399,21 @@ unmap_io:
389 iounmap(xspi->regs); 399 iounmap(xspi->regs);
390put_master: 400put_master:
391 spi_master_put(master); 401 spi_master_put(master);
392 return ret; 402 return rc;
393} 403}
394 404
395static int __devexit xilinx_spi_remove(struct platform_device *dev) 405static int __devexit xilinx_spi_remove(struct of_device *ofdev)
396{ 406{
397 struct xilinx_spi *xspi; 407 struct xilinx_spi *xspi;
398 struct spi_master *master; 408 struct spi_master *master;
399 409
400 master = platform_get_drvdata(dev); 410 master = platform_get_drvdata(ofdev);
401 xspi = spi_master_get_devdata(master); 411 xspi = spi_master_get_devdata(master);
402 412
403 spi_bitbang_stop(&xspi->bitbang); 413 spi_bitbang_stop(&xspi->bitbang);
404 free_irq(xspi->irq, xspi); 414 free_irq(xspi->irq, xspi);
405 iounmap(xspi->regs); 415 iounmap(xspi->regs);
406 platform_set_drvdata(dev, 0); 416 dev_set_drvdata(&ofdev->dev, 0);
407 spi_master_put(xspi->bitbang.master); 417 spi_master_put(xspi->bitbang.master);
408 418
409 return 0; 419 return 0;
@@ -412,27 +422,42 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev)
412/* work with hotplug and coldplug */ 422/* work with hotplug and coldplug */
413MODULE_ALIAS("platform:" XILINX_SPI_NAME); 423MODULE_ALIAS("platform:" XILINX_SPI_NAME);
414 424
415static struct platform_driver xilinx_spi_driver = { 425static int __exit xilinx_spi_of_remove(struct of_device *op)
416 .probe = xilinx_spi_probe, 426{
417 .remove = __devexit_p(xilinx_spi_remove), 427 return xilinx_spi_remove(op);
428}
429
430static struct of_device_id xilinx_spi_of_match[] = {
431 { .compatible = "xlnx,xps-spi-2.00.a", },
432 { .compatible = "xlnx,xps-spi-2.00.b", },
433 {}
434};
435
436MODULE_DEVICE_TABLE(of, xilinx_spi_of_match);
437
438static struct of_platform_driver xilinx_spi_of_driver = {
439 .owner = THIS_MODULE,
440 .name = "xilinx-xps-spi",
441 .match_table = xilinx_spi_of_match,
442 .probe = xilinx_spi_of_probe,
443 .remove = __exit_p(xilinx_spi_of_remove),
418 .driver = { 444 .driver = {
419 .name = XILINX_SPI_NAME, 445 .name = "xilinx-xps-spi",
420 .owner = THIS_MODULE, 446 .owner = THIS_MODULE,
421 }, 447 },
422}; 448};
423 449
424static int __init xilinx_spi_init(void) 450static int __init xilinx_spi_init(void)
425{ 451{
426 return platform_driver_register(&xilinx_spi_driver); 452 return of_register_platform_driver(&xilinx_spi_of_driver);
427} 453}
428module_init(xilinx_spi_init); 454module_init(xilinx_spi_init);
429 455
430static void __exit xilinx_spi_exit(void) 456static void __exit xilinx_spi_exit(void)
431{ 457{
432 platform_driver_unregister(&xilinx_spi_driver); 458 of_unregister_platform_driver(&xilinx_spi_of_driver);
433} 459}
434module_exit(xilinx_spi_exit); 460module_exit(xilinx_spi_exit);
435
436MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 461MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>");
437MODULE_DESCRIPTION("Xilinx SPI driver"); 462MODULE_DESCRIPTION("Xilinx SPI driver");
438MODULE_LICENSE("GPL"); 463MODULE_LICENSE("GPL");
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index d5d0e40b1e2d..94d5ee263c20 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1554,7 +1554,7 @@ static int usb_configure_device_otg(struct usb_device *udev)
1554 * (Includes HNP test device.) 1554 * (Includes HNP test device.)
1555 */ 1555 */
1556 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { 1556 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
1557 err = usb_port_suspend(udev); 1557 err = usb_port_suspend(udev, PMSG_SUSPEND);
1558 if (err < 0) 1558 if (err < 0)
1559 dev_dbg(&udev->dev, "HNP fail, %d\n", err); 1559 dev_dbg(&udev->dev, "HNP fail, %d\n", err);
1560 } 1560 }
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index ef6cfa5a447f..c70a8f667d85 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2030,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work)
2030 spin_unlock_irqrestore(&priv->rx_lock, flags); 2030 spin_unlock_irqrestore(&priv->rx_lock, flags);
2031 dbg("%s - deferring remainder until unthrottled", 2031 dbg("%s - deferring remainder until unthrottled",
2032 __func__); 2032 __func__);
2033 return; 2033 goto out;
2034 } 2034 }
2035 spin_unlock_irqrestore(&priv->rx_lock, flags); 2035 spin_unlock_irqrestore(&priv->rx_lock, flags);
2036 /* if the port is closed stop trying to read */ 2036 /* if the port is closed stop trying to read */
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index 7644ed249564..37e60b1d2ed9 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -335,7 +335,20 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var,
335 struct fb_info *info) 335 struct fb_info *info)
336{ 336{
337 337
338 if (var->bits_per_pixel != LCD_BPP) { 338 switch (var->bits_per_pixel) {
339 case 24:/* TRUECOLOUR, 16m */
340 var->red.offset = 16;
341 var->green.offset = 8;
342 var->blue.offset = 0;
343 var->red.length = var->green.length = var->blue.length = 8;
344 var->transp.offset = 0;
345 var->transp.length = 0;
346 var->transp.msb_right = 0;
347 var->red.msb_right = 0;
348 var->green.msb_right = 0;
349 var->blue.msb_right = 0;
350 break;
351 default:
339 pr_debug("%s: depth not supported: %u BPP\n", __func__, 352 pr_debug("%s: depth not supported: %u BPP\n", __func__,
340 var->bits_per_pixel); 353 var->bits_per_pixel);
341 return -EINVAL; 354 return -EINVAL;
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
index a9b3ada05d99..2a423d3a2a8e 100644
--- a/drivers/video/bfin-t350mcqb-fb.c
+++ b/drivers/video/bfin-t350mcqb-fb.c
@@ -254,7 +254,20 @@ static int bfin_t350mcqb_fb_check_var(struct fb_var_screeninfo *var,
254 struct fb_info *info) 254 struct fb_info *info)
255{ 255{
256 256
257 if (var->bits_per_pixel != LCD_BPP) { 257 switch (var->bits_per_pixel) {
258 case 24:/* TRUECOLOUR, 16m */
259 var->red.offset = 0;
260 var->green.offset = 8;
261 var->blue.offset = 16;
262 var->red.length = var->green.length = var->blue.length = 8;
263 var->transp.offset = 0;
264 var->transp.length = 0;
265 var->transp.msb_right = 0;
266 var->red.msb_right = 0;
267 var->green.msb_right = 0;
268 var->blue.msb_right = 0;
269 break;
270 default:
258 pr_debug("%s: depth not supported: %u BPP\n", __func__, 271 pr_debug("%s: depth not supported: %u BPP\n", __func__,
259 var->bits_per_pixel); 272 var->bits_per_pixel);
260 return -EINVAL; 273 return -EINVAL;
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 38ac805db97d..87f826e4c958 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1006,7 +1006,7 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev)
1006 __func__, status); 1006 __func__, status);
1007 return -ENXIO; 1007 return -ENXIO;
1008 } 1008 }
1009 dev_dbg(dev, "video:%p ioif:%lx lpar:%lx size:%lx\n", 1009 dev_dbg(dev, "video:%p ioif:%lx lpar:%llx size:%lx\n",
1010 ps3fb_videomemory.address, GPU_IOIF, xdr_lpar, 1010 ps3fb_videomemory.address, GPU_IOIF, xdr_lpar,
1011 ps3fb_videomemory.size); 1011 ps3fb_videomemory.size);
1012 1012
@@ -1133,7 +1133,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1133 __func__, status); 1133 __func__, status);
1134 goto err; 1134 goto err;
1135 } 1135 }
1136 dev_dbg(&dev->core, "ddr:lpar:0x%lx\n", ddr_lpar); 1136 dev_dbg(&dev->core, "ddr:lpar:0x%llx\n", ddr_lpar);
1137 1137
1138 status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0, 1138 status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0,
1139 &ps3fb.context_handle, 1139 &ps3fb.context_handle,
diff --git a/fs/aio.c b/fs/aio.c
index d6f89d3c15e8..8fa77e233944 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1270,7 +1270,7 @@ static void io_destroy(struct kioctx *ioctx)
1270 * pointer is passed for ctxp. Will fail with -ENOSYS if not 1270 * pointer is passed for ctxp. Will fail with -ENOSYS if not
1271 * implemented. 1271 * implemented.
1272 */ 1272 */
1273asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp) 1273SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
1274{ 1274{
1275 struct kioctx *ioctx = NULL; 1275 struct kioctx *ioctx = NULL;
1276 unsigned long ctx; 1276 unsigned long ctx;
@@ -1308,7 +1308,7 @@ out:
1308 * implemented. May fail with -EFAULT if the context pointed to 1308 * implemented. May fail with -EFAULT if the context pointed to
1309 * is invalid. 1309 * is invalid.
1310 */ 1310 */
1311asmlinkage long sys_io_destroy(aio_context_t ctx) 1311SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
1312{ 1312{
1313 struct kioctx *ioctx = lookup_ioctx(ctx); 1313 struct kioctx *ioctx = lookup_ioctx(ctx);
1314 if (likely(NULL != ioctx)) { 1314 if (likely(NULL != ioctx)) {
@@ -1662,8 +1662,8 @@ out_put_req:
1662 * are available to queue any iocbs. Will return 0 if nr is 0. Will 1662 * are available to queue any iocbs. Will return 0 if nr is 0. Will
1663 * fail with -ENOSYS if not implemented. 1663 * fail with -ENOSYS if not implemented.
1664 */ 1664 */
1665asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr, 1665SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
1666 struct iocb __user * __user *iocbpp) 1666 struct iocb __user * __user *, iocbpp)
1667{ 1667{
1668 struct kioctx *ctx; 1668 struct kioctx *ctx;
1669 long ret = 0; 1669 long ret = 0;
@@ -1737,8 +1737,8 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
1737 * invalid. May fail with -EAGAIN if the iocb specified was not 1737 * invalid. May fail with -EAGAIN if the iocb specified was not
1738 * cancelled. Will fail with -ENOSYS if not implemented. 1738 * cancelled. Will fail with -ENOSYS if not implemented.
1739 */ 1739 */
1740asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, 1740SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
1741 struct io_event __user *result) 1741 struct io_event __user *, result)
1742{ 1742{
1743 int (*cancel)(struct kiocb *iocb, struct io_event *res); 1743 int (*cancel)(struct kiocb *iocb, struct io_event *res);
1744 struct kioctx *ctx; 1744 struct kioctx *ctx;
@@ -1799,11 +1799,11 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1799 * will be updated if not NULL and the operation blocks. Will fail 1799 * will be updated if not NULL and the operation blocks. Will fail
1800 * with -ENOSYS if not implemented. 1800 * with -ENOSYS if not implemented.
1801 */ 1801 */
1802asmlinkage long sys_io_getevents(aio_context_t ctx_id, 1802SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
1803 long min_nr, 1803 long, min_nr,
1804 long nr, 1804 long, nr,
1805 struct io_event __user *events, 1805 struct io_event __user *, events,
1806 struct timespec __user *timeout) 1806 struct timespec __user *, timeout)
1807{ 1807{
1808 struct kioctx *ioctx = lookup_ioctx(ctx_id); 1808 struct kioctx *ioctx = lookup_ioctx(ctx_id);
1809 long ret = -EINVAL; 1809 long ret = -EINVAL;
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index 78049ea208db..b320b103fa13 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -22,13 +22,20 @@
22 22
23#define BTRFS_IOCTL_MAGIC 0x94 23#define BTRFS_IOCTL_MAGIC 0x94
24#define BTRFS_VOL_NAME_MAX 255 24#define BTRFS_VOL_NAME_MAX 255
25#define BTRFS_PATH_NAME_MAX 3072 25#define BTRFS_PATH_NAME_MAX 4087
26 26
27/* this should be 4k */
27struct btrfs_ioctl_vol_args { 28struct btrfs_ioctl_vol_args {
28 __s64 fd; 29 __s64 fd;
29 char name[BTRFS_PATH_NAME_MAX + 1]; 30 char name[BTRFS_PATH_NAME_MAX + 1];
30}; 31};
31 32
33struct btrfs_ioctl_clone_range_args {
34 __s64 src_fd;
35 __u64 src_offset, src_length;
36 __u64 dest_offset;
37};
38
32#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ 39#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
33 struct btrfs_ioctl_vol_args) 40 struct btrfs_ioctl_vol_args)
34#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ 41#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -52,11 +59,6 @@ struct btrfs_ioctl_vol_args {
52 struct btrfs_ioctl_vol_args) 59 struct btrfs_ioctl_vol_args)
53#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ 60#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
54 struct btrfs_ioctl_vol_args) 61 struct btrfs_ioctl_vol_args)
55struct btrfs_ioctl_clone_range_args {
56 __s64 src_fd;
57 __u64 src_offset, src_length;
58 __u64 dest_offset;
59};
60 62
61#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ 63#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
62 struct btrfs_ioctl_clone_range_args) 64 struct btrfs_ioctl_clone_range_args)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0a14b495532f..db9fb3bc1e33 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -38,6 +38,7 @@
38#include <linux/namei.h> 38#include <linux/namei.h>
39#include <linux/miscdevice.h> 39#include <linux/miscdevice.h>
40#include <linux/version.h> 40#include <linux/version.h>
41#include <linux/magic.h>
41#include "compat.h" 42#include "compat.h"
42#include "ctree.h" 43#include "ctree.h"
43#include "disk-io.h" 44#include "disk-io.h"
@@ -51,7 +52,6 @@
51#include "export.h" 52#include "export.h"
52#include "compression.h" 53#include "compression.h"
53 54
54#define BTRFS_SUPER_MAGIC 0x9123683E
55 55
56static struct super_operations btrfs_super_ops; 56static struct super_operations btrfs_super_ops;
57 57
@@ -582,7 +582,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
582{ 582{
583 struct btrfs_ioctl_vol_args *vol; 583 struct btrfs_ioctl_vol_args *vol;
584 struct btrfs_fs_devices *fs_devices; 584 struct btrfs_fs_devices *fs_devices;
585 int ret = 0; 585 int ret = -ENOTTY;
586 int len; 586 int len;
587 587
588 if (!capable(CAP_SYS_ADMIN)) 588 if (!capable(CAP_SYS_ADMIN))
@@ -594,6 +594,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
594 goto out; 594 goto out;
595 } 595 }
596 len = strnlen(vol->name, BTRFS_PATH_NAME_MAX); 596 len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
597
597 switch (cmd) { 598 switch (cmd) {
598 case BTRFS_IOC_SCAN_DEV: 599 case BTRFS_IOC_SCAN_DEV:
599 ret = btrfs_scan_one_device(vol->name, FMODE_READ, 600 ret = btrfs_scan_one_device(vol->name, FMODE_READ,
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b187b537888e..3451e1cca2b5 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -220,6 +220,7 @@ loop:
220 tail->bi_next = old_head; 220 tail->bi_next = old_head;
221 else 221 else
222 device->pending_bio_tail = tail; 222 device->pending_bio_tail = tail;
223 device->running_pending = 0;
223 224
224 spin_unlock(&device->io_lock); 225 spin_unlock(&device->io_lock);
225 btrfs_requeue_work(&device->work); 226 btrfs_requeue_work(&device->work);
diff --git a/fs/buffer.c b/fs/buffer.c
index b6e8b8632e2f..b58208f1640a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3243,7 +3243,7 @@ void block_sync_page(struct page *page)
3243 * Use of bdflush() is deprecated and will be removed in a future kernel. 3243 * Use of bdflush() is deprecated and will be removed in a future kernel.
3244 * The `pdflush' kernel threads fully replace bdflush daemons and this call. 3244 * The `pdflush' kernel threads fully replace bdflush daemons and this call.
3245 */ 3245 */
3246asmlinkage long sys_bdflush(int func, long data) 3246SYSCALL_DEFINE2(bdflush, int, func, long, data)
3247{ 3247{
3248 static int msg_count; 3248 static int msg_count;
3249 3249
diff --git a/fs/compat.c b/fs/compat.c
index 30f2faa22f5c..65a070e705ab 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1709,7 +1709,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
1709} 1709}
1710 1710
1711#ifdef HAVE_SET_RESTORE_SIGMASK 1711#ifdef HAVE_SET_RESTORE_SIGMASK
1712asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp, 1712static long do_compat_pselect(int n, compat_ulong_t __user *inp,
1713 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1713 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
1714 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask, 1714 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask,
1715 compat_size_t sigsetsize) 1715 compat_size_t sigsetsize)
@@ -1775,8 +1775,8 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
1775 (compat_size_t __user *)(sig+sizeof(up)))) 1775 (compat_size_t __user *)(sig+sizeof(up))))
1776 return -EFAULT; 1776 return -EFAULT;
1777 } 1777 }
1778 return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up), 1778 return do_compat_pselect(n, inp, outp, exp, tsp, compat_ptr(up),
1779 sigsetsize); 1779 sigsetsize);
1780} 1780}
1781 1781
1782asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 1782asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
diff --git a/fs/dcache.c b/fs/dcache.c
index 4547f66884a0..937df0fb0da5 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2092,7 +2092,7 @@ Elong:
2092 * return NULL; 2092 * return NULL;
2093 * } 2093 * }
2094 */ 2094 */
2095asmlinkage long sys_getcwd(char __user *buf, unsigned long size) 2095SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
2096{ 2096{
2097 int error; 2097 int error;
2098 struct path pwd, root; 2098 struct path pwd, root;
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 180e9fec4ad8..a21cabdbd87b 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -145,7 +145,7 @@ out:
145/* And here is where the userspace process can look up the cookie value 145/* And here is where the userspace process can look up the cookie value
146 * to retrieve the path. 146 * to retrieve the path.
147 */ 147 */
148asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) 148SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
149{ 149{
150 unsigned long cookie = (unsigned long)cookie64; 150 unsigned long cookie = (unsigned long)cookie64;
151 int err = -EINVAL; 151 int err = -EINVAL;
@@ -198,7 +198,13 @@ out:
198 mutex_unlock(&dcookie_mutex); 198 mutex_unlock(&dcookie_mutex);
199 return err; 199 return err;
200} 200}
201 201#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
202asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len)
203{
204 return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len);
205}
206SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie);
207#endif
202 208
203static int dcookie_init(void) 209static int dcookie_init(void)
204{ 210{
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 08bf558d0408..5de2c2db3aa2 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -198,7 +198,7 @@ struct file *eventfd_fget(int fd)
198 return file; 198 return file;
199} 199}
200 200
201asmlinkage long sys_eventfd2(unsigned int count, int flags) 201SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
202{ 202{
203 int fd; 203 int fd;
204 struct eventfd_ctx *ctx; 204 struct eventfd_ctx *ctx;
@@ -228,8 +228,7 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags)
228 return fd; 228 return fd;
229} 229}
230 230
231asmlinkage long sys_eventfd(unsigned int count) 231SYSCALL_DEFINE1(eventfd, unsigned int, count)
232{ 232{
233 return sys_eventfd2(count, 0); 233 return sys_eventfd2(count, 0);
234} 234}
235
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 96355d505347..ba2f9ec71192 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1110,7 +1110,7 @@ retry:
1110/* 1110/*
1111 * Open an eventpoll file descriptor. 1111 * Open an eventpoll file descriptor.
1112 */ 1112 */
1113asmlinkage long sys_epoll_create1(int flags) 1113SYSCALL_DEFINE1(epoll_create1, int, flags)
1114{ 1114{
1115 int error, fd = -1; 1115 int error, fd = -1;
1116 struct eventpoll *ep; 1116 struct eventpoll *ep;
@@ -1150,7 +1150,7 @@ error_return:
1150 return fd; 1150 return fd;
1151} 1151}
1152 1152
1153asmlinkage long sys_epoll_create(int size) 1153SYSCALL_DEFINE1(epoll_create, int, size)
1154{ 1154{
1155 if (size < 0) 1155 if (size < 0)
1156 return -EINVAL; 1156 return -EINVAL;
@@ -1163,8 +1163,8 @@ asmlinkage long sys_epoll_create(int size)
1163 * the eventpoll file that enables the insertion/removal/change of 1163 * the eventpoll file that enables the insertion/removal/change of
1164 * file descriptors inside the interest set. 1164 * file descriptors inside the interest set.
1165 */ 1165 */
1166asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, 1166SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
1167 struct epoll_event __user *event) 1167 struct epoll_event __user *, event)
1168{ 1168{
1169 int error; 1169 int error;
1170 struct file *file, *tfile; 1170 struct file *file, *tfile;
@@ -1261,8 +1261,8 @@ error_return:
1261 * Implement the event wait interface for the eventpoll file. It is the kernel 1261 * Implement the event wait interface for the eventpoll file. It is the kernel
1262 * part of the user space epoll_wait(2). 1262 * part of the user space epoll_wait(2).
1263 */ 1263 */
1264asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, 1264SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events,
1265 int maxevents, int timeout) 1265 int, maxevents, int, timeout)
1266{ 1266{
1267 int error; 1267 int error;
1268 struct file *file; 1268 struct file *file;
@@ -1319,9 +1319,9 @@ error_return:
1319 * Implement the event wait interface for the eventpoll file. It is the kernel 1319 * Implement the event wait interface for the eventpoll file. It is the kernel
1320 * part of the user space epoll_pwait(2). 1320 * part of the user space epoll_pwait(2).
1321 */ 1321 */
1322asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events, 1322SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
1323 int maxevents, int timeout, const sigset_t __user *sigmask, 1323 int, maxevents, int, timeout, const sigset_t __user *, sigmask,
1324 size_t sigsetsize) 1324 size_t, sigsetsize)
1325{ 1325{
1326 int error; 1326 int error;
1327 sigset_t ksigmask, sigsaved; 1327 sigset_t ksigmask, sigsaved;
diff --git a/fs/exec.c b/fs/exec.c
index 605be573fe87..97f9c225dd66 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -100,7 +100,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
100 * 100 *
101 * Also note that we take the address to load from from the file itself. 101 * Also note that we take the address to load from from the file itself.
102 */ 102 */
103asmlinkage long sys_uselib(const char __user * library) 103SYSCALL_DEFINE1(uselib, const char __user *, library)
104{ 104{
105 struct file *file; 105 struct file *file;
106 struct nameidata nd; 106 struct nameidata nd;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 9a0fc400f91c..2999d72153b7 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -95,10 +95,13 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
95 mark_inode_dirty(dir); 95 mark_inode_dirty(dir);
96 } 96 }
97 97
98 if (IS_DIRSYNC(dir)) 98 if (IS_DIRSYNC(dir)) {
99 err = write_one_page(page, 1); 99 err = write_one_page(page, 1);
100 else 100 if (!err)
101 err = ext2_sync_inode(dir);
102 } else {
101 unlock_page(page); 103 unlock_page(page);
104 }
102 105
103 return err; 106 return err;
104} 107}
diff --git a/fs/fcntl.c b/fs/fcntl.c
index cdc141946724..bd215cc791da 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -50,7 +50,7 @@ static int get_close_on_exec(unsigned int fd)
50 return res; 50 return res;
51} 51}
52 52
53asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags) 53SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
54{ 54{
55 int err = -EBADF; 55 int err = -EBADF;
56 struct file * file, *tofree; 56 struct file * file, *tofree;
@@ -113,7 +113,7 @@ out_unlock:
113 return err; 113 return err;
114} 114}
115 115
116asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) 116SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
117{ 117{
118 if (unlikely(newfd == oldfd)) { /* corner case */ 118 if (unlikely(newfd == oldfd)) { /* corner case */
119 struct files_struct *files = current->files; 119 struct files_struct *files = current->files;
@@ -126,7 +126,7 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
126 return sys_dup3(oldfd, newfd, 0); 126 return sys_dup3(oldfd, newfd, 0);
127} 127}
128 128
129asmlinkage long sys_dup(unsigned int fildes) 129SYSCALL_DEFINE1(dup, unsigned int, fildes)
130{ 130{
131 int ret = -EBADF; 131 int ret = -EBADF;
132 struct file *file = fget(fildes); 132 struct file *file = fget(fildes);
@@ -335,7 +335,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
335 return err; 335 return err;
336} 336}
337 337
338asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) 338SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
339{ 339{
340 struct file *filp; 340 struct file *filp;
341 long err = -EBADF; 341 long err = -EBADF;
@@ -358,7 +358,8 @@ out:
358} 358}
359 359
360#if BITS_PER_LONG == 32 360#if BITS_PER_LONG == 32
361asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) 361SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
362 unsigned long, arg)
362{ 363{
363 struct file * filp; 364 struct file * filp;
364 long err; 365 long err;
diff --git a/fs/filesystems.c b/fs/filesystems.c
index d488dcd7f2bb..1aa70260e6d1 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -179,7 +179,7 @@ static int fs_maxindex(void)
179/* 179/*
180 * Whee.. Weird sysv syscall. 180 * Whee.. Weird sysv syscall.
181 */ 181 */
182asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2) 182SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
183{ 183{
184 int retval = -EINVAL; 184 int retval = -EINVAL;
185 185
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 20b0a8a24c6b..240ec63984cb 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -542,7 +542,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
542 return error; 542 return error;
543} 543}
544 544
545asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) 545SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
546{ 546{
547 struct file *filp; 547 struct file *filp;
548 int error = -EBADF; 548 int error = -EBADF;
diff --git a/fs/ioprio.c b/fs/ioprio.c
index 1a39ac370942..c7c0b28d7d21 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -72,7 +72,7 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
72} 72}
73EXPORT_SYMBOL_GPL(set_task_ioprio); 73EXPORT_SYMBOL_GPL(set_task_ioprio);
74 74
75asmlinkage long sys_ioprio_set(int which, int who, int ioprio) 75SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
76{ 76{
77 int class = IOPRIO_PRIO_CLASS(ioprio); 77 int class = IOPRIO_PRIO_CLASS(ioprio);
78 int data = IOPRIO_PRIO_DATA(ioprio); 78 int data = IOPRIO_PRIO_DATA(ioprio);
@@ -188,7 +188,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
188 return aprio; 188 return aprio;
189} 189}
190 190
191asmlinkage long sys_ioprio_get(int which, int who) 191SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
192{ 192{
193 struct task_struct *g, *p; 193 struct task_struct *g, *p;
194 struct user_struct *user; 194 struct user_struct *user;
@@ -252,4 +252,3 @@ asmlinkage long sys_ioprio_get(int which, int who)
252 read_unlock(&tasklist_lock); 252 read_unlock(&tasklist_lock);
253 return ret; 253 return ret;
254} 254}
255
diff --git a/fs/locks.c b/fs/locks.c
index 46a2e12f7d42..ec3deea29e37 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1564,7 +1564,7 @@ EXPORT_SYMBOL(flock_lock_file_wait);
1564 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other 1564 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other
1565 * processes read and write access respectively. 1565 * processes read and write access respectively.
1566 */ 1566 */
1567asmlinkage long sys_flock(unsigned int fd, unsigned int cmd) 1567SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
1568{ 1568{
1569 struct file *filp; 1569 struct file *filp;
1570 struct file_lock *lock; 1570 struct file_lock *lock;
diff --git a/fs/namei.c b/fs/namei.c
index f05bed242422..bbc15c237558 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1962,8 +1962,8 @@ static int may_mknod(mode_t mode)
1962 } 1962 }
1963} 1963}
1964 1964
1965asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode, 1965SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode,
1966 unsigned dev) 1966 unsigned, dev)
1967{ 1967{
1968 int error; 1968 int error;
1969 char *tmp; 1969 char *tmp;
@@ -2017,7 +2017,7 @@ out_unlock:
2017 return error; 2017 return error;
2018} 2018}
2019 2019
2020asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev) 2020SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev)
2021{ 2021{
2022 return sys_mknodat(AT_FDCWD, filename, mode, dev); 2022 return sys_mknodat(AT_FDCWD, filename, mode, dev);
2023} 2023}
@@ -2044,7 +2044,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2044 return error; 2044 return error;
2045} 2045}
2046 2046
2047asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode) 2047SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode)
2048{ 2048{
2049 int error = 0; 2049 int error = 0;
2050 char * tmp; 2050 char * tmp;
@@ -2081,7 +2081,7 @@ out_err:
2081 return error; 2081 return error;
2082} 2082}
2083 2083
2084asmlinkage long sys_mkdir(const char __user *pathname, int mode) 2084SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode)
2085{ 2085{
2086 return sys_mkdirat(AT_FDCWD, pathname, mode); 2086 return sys_mkdirat(AT_FDCWD, pathname, mode);
2087} 2087}
@@ -2195,7 +2195,7 @@ exit1:
2195 return error; 2195 return error;
2196} 2196}
2197 2197
2198asmlinkage long sys_rmdir(const char __user *pathname) 2198SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
2199{ 2199{
2200 return do_rmdir(AT_FDCWD, pathname); 2200 return do_rmdir(AT_FDCWD, pathname);
2201} 2201}
@@ -2291,7 +2291,7 @@ slashes:
2291 goto exit2; 2291 goto exit2;
2292} 2292}
2293 2293
2294asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag) 2294SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
2295{ 2295{
2296 if ((flag & ~AT_REMOVEDIR) != 0) 2296 if ((flag & ~AT_REMOVEDIR) != 0)
2297 return -EINVAL; 2297 return -EINVAL;
@@ -2302,7 +2302,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag)
2302 return do_unlinkat(dfd, pathname); 2302 return do_unlinkat(dfd, pathname);
2303} 2303}
2304 2304
2305asmlinkage long sys_unlink(const char __user *pathname) 2305SYSCALL_DEFINE1(unlink, const char __user *, pathname)
2306{ 2306{
2307 return do_unlinkat(AT_FDCWD, pathname); 2307 return do_unlinkat(AT_FDCWD, pathname);
2308} 2308}
@@ -2328,8 +2328,8 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2328 return error; 2328 return error;
2329} 2329}
2330 2330
2331asmlinkage long sys_symlinkat(const char __user *oldname, 2331SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
2332 int newdfd, const char __user *newname) 2332 int, newdfd, const char __user *, newname)
2333{ 2333{
2334 int error; 2334 int error;
2335 char *from; 2335 char *from;
@@ -2370,7 +2370,7 @@ out_putname:
2370 return error; 2370 return error;
2371} 2371}
2372 2372
2373asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname) 2373SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
2374{ 2374{
2375 return sys_symlinkat(oldname, AT_FDCWD, newname); 2375 return sys_symlinkat(oldname, AT_FDCWD, newname);
2376} 2376}
@@ -2422,9 +2422,8 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2422 * with linux 2.0, and to avoid hard-linking to directories 2422 * with linux 2.0, and to avoid hard-linking to directories
2423 * and other special files. --ADM 2423 * and other special files. --ADM
2424 */ 2424 */
2425asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 2425SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
2426 int newdfd, const char __user *newname, 2426 int, newdfd, const char __user *, newname, int, flags)
2427 int flags)
2428{ 2427{
2429 struct dentry *new_dentry; 2428 struct dentry *new_dentry;
2430 struct nameidata nd; 2429 struct nameidata nd;
@@ -2473,7 +2472,7 @@ out:
2473 return error; 2472 return error;
2474} 2473}
2475 2474
2476asmlinkage long sys_link(const char __user *oldname, const char __user *newname) 2475SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname)
2477{ 2476{
2478 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); 2477 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
2479} 2478}
@@ -2624,8 +2623,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2624 return error; 2623 return error;
2625} 2624}
2626 2625
2627asmlinkage long sys_renameat(int olddfd, const char __user *oldname, 2626SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
2628 int newdfd, const char __user *newname) 2627 int, newdfd, const char __user *, newname)
2629{ 2628{
2630 struct dentry *old_dir, *new_dir; 2629 struct dentry *old_dir, *new_dir;
2631 struct dentry *old_dentry, *new_dentry; 2630 struct dentry *old_dentry, *new_dentry;
@@ -2718,7 +2717,7 @@ exit:
2718 return error; 2717 return error;
2719} 2718}
2720 2719
2721asmlinkage long sys_rename(const char __user *oldname, const char __user *newname) 2720SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname)
2722{ 2721{
2723 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname); 2722 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname);
2724} 2723}
diff --git a/fs/namespace.c b/fs/namespace.c
index a40685d800a8..228d8c4bfd18 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1128,7 +1128,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1128 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD 1128 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
1129 */ 1129 */
1130 1130
1131asmlinkage long sys_umount(char __user * name, int flags) 1131SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1132{ 1132{
1133 struct path path; 1133 struct path path;
1134 int retval; 1134 int retval;
@@ -1160,7 +1160,7 @@ out:
1160/* 1160/*
1161 * The 2.0 compatible umount. No flags. 1161 * The 2.0 compatible umount. No flags.
1162 */ 1162 */
1163asmlinkage long sys_oldumount(char __user * name) 1163SYSCALL_DEFINE1(oldumount, char __user *, name)
1164{ 1164{
1165 return sys_umount(name, 0); 1165 return sys_umount(name, 0);
1166} 1166}
@@ -2045,9 +2045,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
2045 return new_ns; 2045 return new_ns;
2046} 2046}
2047 2047
2048asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, 2048SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
2049 char __user * type, unsigned long flags, 2049 char __user *, type, unsigned long, flags, void __user *, data)
2050 void __user * data)
2051{ 2050{
2052 int retval; 2051 int retval;
2053 unsigned long data_page; 2052 unsigned long data_page;
@@ -2172,8 +2171,8 @@ static void chroot_fs_refs(struct path *old_root, struct path *new_root)
2172 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root 2171 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
2173 * first. 2172 * first.
2174 */ 2173 */
2175asmlinkage long sys_pivot_root(const char __user * new_root, 2174SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2176 const char __user * put_old) 2175 const char __user *, put_old)
2177{ 2176{
2178 struct vfsmount *tmp; 2177 struct vfsmount *tmp;
2179 struct path new, old, parent_path, root_parent, root; 2178 struct path new, old, parent_path, root_parent, root;
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index b27451909dff..8f9a20556f79 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -86,8 +86,8 @@ static struct {
86 }, 86 },
87}; 87};
88 88
89long 89SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg,
90asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res) 90 void __user *, res)
91{ 91{
92 struct file *file; 92 struct file *file;
93 void __user *p = &arg->u; 93 void __user *p = &arg->u;
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 81b8644b0136..d53a1838d6e8 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -576,7 +576,7 @@ static const struct inotify_operations inotify_user_ops = {
576 .destroy_watch = free_inotify_user_watch, 576 .destroy_watch = free_inotify_user_watch,
577}; 577};
578 578
579asmlinkage long sys_inotify_init1(int flags) 579SYSCALL_DEFINE1(inotify_init1, int, flags)
580{ 580{
581 struct inotify_device *dev; 581 struct inotify_device *dev;
582 struct inotify_handle *ih; 582 struct inotify_handle *ih;
@@ -655,12 +655,13 @@ out_put_fd:
655 return ret; 655 return ret;
656} 656}
657 657
658asmlinkage long sys_inotify_init(void) 658SYSCALL_DEFINE0(inotify_init)
659{ 659{
660 return sys_inotify_init1(0); 660 return sys_inotify_init1(0);
661} 661}
662 662
663asmlinkage long sys_inotify_add_watch(int fd, const char __user *pathname, u32 mask) 663SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
664 u32, mask)
664{ 665{
665 struct inode *inode; 666 struct inode *inode;
666 struct inotify_device *dev; 667 struct inotify_device *dev;
@@ -704,7 +705,7 @@ fput_and_out:
704 return ret; 705 return ret;
705} 706}
706 707
707asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd) 708SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
708{ 709{
709 struct file *filp; 710 struct file *filp;
710 struct inotify_device *dev; 711 struct inotify_device *dev;
diff --git a/fs/open.c b/fs/open.c
index d882fd2351d6..a3a78ceb2a2b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -122,7 +122,7 @@ static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
122 return 0; 122 return 0;
123} 123}
124 124
125asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf) 125SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf)
126{ 126{
127 struct path path; 127 struct path path;
128 int error; 128 int error;
@@ -138,8 +138,7 @@ asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * b
138 return error; 138 return error;
139} 139}
140 140
141 141SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf)
142asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf)
143{ 142{
144 struct path path; 143 struct path path;
145 long error; 144 long error;
@@ -157,8 +156,7 @@ asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct stat
157 return error; 156 return error;
158} 157}
159 158
160 159SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf)
161asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
162{ 160{
163 struct file * file; 161 struct file * file;
164 struct statfs tmp; 162 struct statfs tmp;
@@ -176,7 +174,7 @@ out:
176 return error; 174 return error;
177} 175}
178 176
179asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf) 177SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf)
180{ 178{
181 struct file * file; 179 struct file * file;
182 struct statfs64 tmp; 180 struct statfs64 tmp;
@@ -289,7 +287,7 @@ out:
289 return error; 287 return error;
290} 288}
291 289
292asmlinkage long sys_truncate(const char __user * path, unsigned long length) 290SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length)
293{ 291{
294 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ 292 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
295 return do_sys_truncate(path, (long)length); 293 return do_sys_truncate(path, (long)length);
@@ -341,7 +339,7 @@ out:
341 return error; 339 return error;
342} 340}
343 341
344asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) 342SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
345{ 343{
346 long ret = do_sys_ftruncate(fd, length, 1); 344 long ret = do_sys_ftruncate(fd, length, 1);
347 /* avoid REGPARM breakage on x86: */ 345 /* avoid REGPARM breakage on x86: */
@@ -351,21 +349,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
351 349
352/* LFS versions of truncate are only needed on 32 bit machines */ 350/* LFS versions of truncate are only needed on 32 bit machines */
353#if BITS_PER_LONG == 32 351#if BITS_PER_LONG == 32
354asmlinkage long sys_truncate64(const char __user * path, loff_t length) 352SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
355{ 353{
356 return do_sys_truncate(path, length); 354 return do_sys_truncate(path, length);
357} 355}
356#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
357asmlinkage long SyS_truncate64(long path, loff_t length)
358{
359 return SYSC_truncate64((const char __user *) path, length);
360}
361SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
362#endif
358 363
359asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 364SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
360{ 365{
361 long ret = do_sys_ftruncate(fd, length, 0); 366 long ret = do_sys_ftruncate(fd, length, 0);
362 /* avoid REGPARM breakage on x86: */ 367 /* avoid REGPARM breakage on x86: */
363 asmlinkage_protect(2, ret, fd, length); 368 asmlinkage_protect(2, ret, fd, length);
364 return ret; 369 return ret;
365} 370}
371#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
372asmlinkage long SyS_ftruncate64(long fd, loff_t length)
373{
374 return SYSC_ftruncate64((unsigned int) fd, length);
375}
376SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
366#endif 377#endif
378#endif /* BITS_PER_LONG == 32 */
367 379
368asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len) 380SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
369{ 381{
370 struct file *file; 382 struct file *file;
371 struct inode *inode; 383 struct inode *inode;
@@ -422,13 +434,20 @@ out_fput:
422out: 434out:
423 return ret; 435 return ret;
424} 436}
437#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
438asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
439{
440 return SYSC_fallocate((int)fd, (int)mode, offset, len);
441}
442SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
443#endif
425 444
426/* 445/*
427 * access() needs to use the real uid/gid, not the effective uid/gid. 446 * access() needs to use the real uid/gid, not the effective uid/gid.
428 * We do this by temporarily clearing all FS-related capabilities and 447 * We do this by temporarily clearing all FS-related capabilities and
429 * switching the fsuid/fsgid around to the real ones. 448 * switching the fsuid/fsgid around to the real ones.
430 */ 449 */
431asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) 450SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
432{ 451{
433 const struct cred *old_cred; 452 const struct cred *old_cred;
434 struct cred *override_cred; 453 struct cred *override_cred;
@@ -498,12 +517,12 @@ out:
498 return res; 517 return res;
499} 518}
500 519
501asmlinkage long sys_access(const char __user *filename, int mode) 520SYSCALL_DEFINE2(access, const char __user *, filename, int, mode)
502{ 521{
503 return sys_faccessat(AT_FDCWD, filename, mode); 522 return sys_faccessat(AT_FDCWD, filename, mode);
504} 523}
505 524
506asmlinkage long sys_chdir(const char __user * filename) 525SYSCALL_DEFINE1(chdir, const char __user *, filename)
507{ 526{
508 struct path path; 527 struct path path;
509 int error; 528 int error;
@@ -524,7 +543,7 @@ out:
524 return error; 543 return error;
525} 544}
526 545
527asmlinkage long sys_fchdir(unsigned int fd) 546SYSCALL_DEFINE1(fchdir, unsigned int, fd)
528{ 547{
529 struct file *file; 548 struct file *file;
530 struct inode *inode; 549 struct inode *inode;
@@ -550,7 +569,7 @@ out:
550 return error; 569 return error;
551} 570}
552 571
553asmlinkage long sys_chroot(const char __user * filename) 572SYSCALL_DEFINE1(chroot, const char __user *, filename)
554{ 573{
555 struct path path; 574 struct path path;
556 int error; 575 int error;
@@ -575,7 +594,7 @@ out:
575 return error; 594 return error;
576} 595}
577 596
578asmlinkage long sys_fchmod(unsigned int fd, mode_t mode) 597SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode)
579{ 598{
580 struct inode * inode; 599 struct inode * inode;
581 struct dentry * dentry; 600 struct dentry * dentry;
@@ -609,8 +628,7 @@ out:
609 return err; 628 return err;
610} 629}
611 630
612asmlinkage long sys_fchmodat(int dfd, const char __user *filename, 631SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode)
613 mode_t mode)
614{ 632{
615 struct path path; 633 struct path path;
616 struct inode *inode; 634 struct inode *inode;
@@ -639,7 +657,7 @@ out:
639 return error; 657 return error;
640} 658}
641 659
642asmlinkage long sys_chmod(const char __user *filename, mode_t mode) 660SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode)
643{ 661{
644 return sys_fchmodat(AT_FDCWD, filename, mode); 662 return sys_fchmodat(AT_FDCWD, filename, mode);
645} 663}
@@ -669,7 +687,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
669 return error; 687 return error;
670} 688}
671 689
672asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group) 690SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
673{ 691{
674 struct path path; 692 struct path path;
675 int error; 693 int error;
@@ -688,8 +706,8 @@ out:
688 return error; 706 return error;
689} 707}
690 708
691asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 709SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
692 gid_t group, int flag) 710 gid_t, group, int, flag)
693{ 711{
694 struct path path; 712 struct path path;
695 int error = -EINVAL; 713 int error = -EINVAL;
@@ -713,7 +731,7 @@ out:
713 return error; 731 return error;
714} 732}
715 733
716asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group) 734SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
717{ 735{
718 struct path path; 736 struct path path;
719 int error; 737 int error;
@@ -732,8 +750,7 @@ out:
732 return error; 750 return error;
733} 751}
734 752
735 753SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
736asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
737{ 754{
738 struct file * file; 755 struct file * file;
739 int error = -EBADF; 756 int error = -EBADF;
@@ -1029,7 +1046,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
1029 return fd; 1046 return fd;
1030} 1047}
1031 1048
1032asmlinkage long sys_open(const char __user *filename, int flags, int mode) 1049SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
1033{ 1050{
1034 long ret; 1051 long ret;
1035 1052
@@ -1042,8 +1059,8 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1042 return ret; 1059 return ret;
1043} 1060}
1044 1061
1045asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1062SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
1046 int mode) 1063 int, mode)
1047{ 1064{
1048 long ret; 1065 long ret;
1049 1066
@@ -1062,7 +1079,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1062 * For backward compatibility? Maybe this should be moved 1079 * For backward compatibility? Maybe this should be moved
1063 * into arch/i386 instead? 1080 * into arch/i386 instead?
1064 */ 1081 */
1065asmlinkage long sys_creat(const char __user * pathname, int mode) 1082SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode)
1066{ 1083{
1067 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); 1084 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1068} 1085}
@@ -1098,7 +1115,7 @@ EXPORT_SYMBOL(filp_close);
1098 * releasing the fd. This ensures that one clone task can't release 1115 * releasing the fd. This ensures that one clone task can't release
1099 * an fd while another clone is opening it. 1116 * an fd while another clone is opening it.
1100 */ 1117 */
1101asmlinkage long sys_close(unsigned int fd) 1118SYSCALL_DEFINE1(close, unsigned int, fd)
1102{ 1119{
1103 struct file * filp; 1120 struct file * filp;
1104 struct files_struct *files = current->files; 1121 struct files_struct *files = current->files;
@@ -1131,14 +1148,13 @@ out_unlock:
1131 spin_unlock(&files->file_lock); 1148 spin_unlock(&files->file_lock);
1132 return -EBADF; 1149 return -EBADF;
1133} 1150}
1134
1135EXPORT_SYMBOL(sys_close); 1151EXPORT_SYMBOL(sys_close);
1136 1152
1137/* 1153/*
1138 * This routine simulates a hangup on the tty, to arrange that users 1154 * This routine simulates a hangup on the tty, to arrange that users
1139 * are given clean terminals at login time. 1155 * are given clean terminals at login time.
1140 */ 1156 */
1141asmlinkage long sys_vhangup(void) 1157SYSCALL_DEFINE0(vhangup)
1142{ 1158{
1143 if (capable(CAP_SYS_TTY_CONFIG)) { 1159 if (capable(CAP_SYS_TTY_CONFIG)) {
1144 tty_vhangup_self(); 1160 tty_vhangup_self();
diff --git a/fs/pipe.c b/fs/pipe.c
index 891697112f66..3a48ba5179d5 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1043,7 +1043,7 @@ int do_pipe(int *fd)
1043 * sys_pipe() is the normal C calling standard for creating 1043 * sys_pipe() is the normal C calling standard for creating
1044 * a pipe. It's not the way Unix traditionally does this, though. 1044 * a pipe. It's not the way Unix traditionally does this, though.
1045 */ 1045 */
1046asmlinkage long __weak sys_pipe2(int __user *fildes, int flags) 1046SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
1047{ 1047{
1048 int fd[2]; 1048 int fd[2];
1049 int error; 1049 int error;
@@ -1059,7 +1059,7 @@ asmlinkage long __weak sys_pipe2(int __user *fildes, int flags)
1059 return error; 1059 return error;
1060} 1060}
1061 1061
1062asmlinkage long __weak sys_pipe(int __user *fildes) 1062SYSCALL_DEFINE1(pipe, int __user *, fildes)
1063{ 1063{
1064 return sys_pipe2(fildes, 0); 1064 return sys_pipe2(fildes, 0);
1065} 1065}
diff --git a/fs/quota.c b/fs/quota.c
index 4a8c94f05f76..d76ada914f98 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -371,7 +371,8 @@ static inline struct super_block *quotactl_block(const char __user *special)
371 * calls. Maybe we need to add the process quotas etc. in the future, 371 * calls. Maybe we need to add the process quotas etc. in the future,
372 * but we probably should use rlimits for that. 372 * but we probably should use rlimits for that.
373 */ 373 */
374asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr) 374SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
375 qid_t, id, void __user *, addr)
375{ 376{
376 uint cmds, type; 377 uint cmds, type;
377 struct super_block *sb = NULL; 378 struct super_block *sb = NULL;
diff --git a/fs/read_write.c b/fs/read_write.c
index 5cc6924eb158..400fe81c973e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -147,7 +147,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
147} 147}
148EXPORT_SYMBOL(vfs_llseek); 148EXPORT_SYMBOL(vfs_llseek);
149 149
150asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin) 150SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
151{ 151{
152 off_t retval; 152 off_t retval;
153 struct file * file; 153 struct file * file;
@@ -171,9 +171,9 @@ bad:
171} 171}
172 172
173#ifdef __ARCH_WANT_SYS_LLSEEK 173#ifdef __ARCH_WANT_SYS_LLSEEK
174asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 174SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
175 unsigned long offset_low, loff_t __user * result, 175 unsigned long, offset_low, loff_t __user *, result,
176 unsigned int origin) 176 unsigned int, origin)
177{ 177{
178 int retval; 178 int retval;
179 struct file * file; 179 struct file * file;
@@ -369,7 +369,7 @@ static inline void file_pos_write(struct file *file, loff_t pos)
369 file->f_pos = pos; 369 file->f_pos = pos;
370} 370}
371 371
372asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) 372SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
373{ 373{
374 struct file *file; 374 struct file *file;
375 ssize_t ret = -EBADF; 375 ssize_t ret = -EBADF;
@@ -386,7 +386,8 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
386 return ret; 386 return ret;
387} 387}
388 388
389asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) 389SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
390 size_t, count)
390{ 391{
391 struct file *file; 392 struct file *file;
392 ssize_t ret = -EBADF; 393 ssize_t ret = -EBADF;
@@ -403,8 +404,8 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co
403 return ret; 404 return ret;
404} 405}
405 406
406asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, 407SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
407 size_t count, loff_t pos) 408 size_t count, loff_t pos)
408{ 409{
409 struct file *file; 410 struct file *file;
410 ssize_t ret = -EBADF; 411 ssize_t ret = -EBADF;
@@ -423,9 +424,17 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
423 424
424 return ret; 425 return ret;
425} 426}
427#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
428asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
429{
430 return SYSC_pread64((unsigned int) fd, (char __user *) buf,
431 (size_t) count, pos);
432}
433SYSCALL_ALIAS(sys_pread64, SyS_pread64);
434#endif
426 435
427asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, 436SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
428 size_t count, loff_t pos) 437 size_t count, loff_t pos)
429{ 438{
430 struct file *file; 439 struct file *file;
431 ssize_t ret = -EBADF; 440 ssize_t ret = -EBADF;
@@ -444,6 +453,14 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
444 453
445 return ret; 454 return ret;
446} 455}
456#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
457asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
458{
459 return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
460 (size_t) count, pos);
461}
462SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
463#endif
447 464
448/* 465/*
449 * Reduce an iovec's length in-place. Return the resulting number of segments 466 * Reduce an iovec's length in-place. Return the resulting number of segments
@@ -672,8 +689,8 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
672 689
673EXPORT_SYMBOL(vfs_writev); 690EXPORT_SYMBOL(vfs_writev);
674 691
675asmlinkage ssize_t 692SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec,
676sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) 693 unsigned long, vlen)
677{ 694{
678 struct file *file; 695 struct file *file;
679 ssize_t ret = -EBADF; 696 ssize_t ret = -EBADF;
@@ -693,8 +710,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
693 return ret; 710 return ret;
694} 711}
695 712
696asmlinkage ssize_t 713SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
697sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) 714 unsigned long, vlen)
698{ 715{
699 struct file *file; 716 struct file *file;
700 ssize_t ret = -EBADF; 717 ssize_t ret = -EBADF;
@@ -812,7 +829,7 @@ out:
812 return retval; 829 return retval;
813} 830}
814 831
815asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count) 832SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count)
816{ 833{
817 loff_t pos; 834 loff_t pos;
818 off_t off; 835 off_t off;
@@ -831,7 +848,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz
831 return do_sendfile(out_fd, in_fd, NULL, count, 0); 848 return do_sendfile(out_fd, in_fd, NULL, count, 0);
832} 849}
833 850
834asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count) 851SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count)
835{ 852{
836 loff_t pos; 853 loff_t pos;
837 ssize_t ret; 854 ssize_t ret;
diff --git a/fs/readdir.c b/fs/readdir.c
index b318d9b5af2e..7723401f8d8b 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -102,7 +102,8 @@ efault:
102 return -EFAULT; 102 return -EFAULT;
103} 103}
104 104
105asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * dirent, unsigned int count) 105SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
106 struct old_linux_dirent __user *, dirent, unsigned int, count)
106{ 107{
107 int error; 108 int error;
108 struct file * file; 109 struct file * file;
@@ -187,7 +188,8 @@ efault:
187 return -EFAULT; 188 return -EFAULT;
188} 189}
189 190
190asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) 191SYSCALL_DEFINE3(getdents, unsigned int, fd,
192 struct linux_dirent __user *, dirent, unsigned int, count)
191{ 193{
192 struct file * file; 194 struct file * file;
193 struct linux_dirent __user * lastdirent; 195 struct linux_dirent __user * lastdirent;
@@ -268,7 +270,8 @@ efault:
268 return -EFAULT; 270 return -EFAULT;
269} 271}
270 272
271asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) 273SYSCALL_DEFINE3(getdents64, unsigned int, fd,
274 struct linux_dirent64 __user *, dirent, unsigned int, count)
272{ 275{
273 struct file * file; 276 struct file * file;
274 struct linux_dirent64 __user * lastdirent; 277 struct linux_dirent64 __user * lastdirent;
diff --git a/fs/select.c b/fs/select.c
index b0cf1f0896d9..0fe0e1469df3 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -557,8 +557,8 @@ out_nofds:
557 return ret; 557 return ret;
558} 558}
559 559
560asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 560SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
561 fd_set __user *exp, struct timeval __user *tvp) 561 fd_set __user *, exp, struct timeval __user *, tvp)
562{ 562{
563 struct timespec end_time, *to = NULL; 563 struct timespec end_time, *to = NULL;
564 struct timeval tv; 564 struct timeval tv;
@@ -582,9 +582,9 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
582} 582}
583 583
584#ifdef HAVE_SET_RESTORE_SIGMASK 584#ifdef HAVE_SET_RESTORE_SIGMASK
585asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, 585static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp,
586 fd_set __user *exp, struct timespec __user *tsp, 586 fd_set __user *exp, struct timespec __user *tsp,
587 const sigset_t __user *sigmask, size_t sigsetsize) 587 const sigset_t __user *sigmask, size_t sigsetsize)
588{ 588{
589 sigset_t ksigmask, sigsaved; 589 sigset_t ksigmask, sigsaved;
590 struct timespec ts, end_time, *to = NULL; 590 struct timespec ts, end_time, *to = NULL;
@@ -636,8 +636,9 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
636 * which has a pointer to the sigset_t itself followed by a size_t containing 636 * which has a pointer to the sigset_t itself followed by a size_t containing
637 * the sigset size. 637 * the sigset size.
638 */ 638 */
639asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, 639SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
640 fd_set __user *exp, struct timespec __user *tsp, void __user *sig) 640 fd_set __user *, exp, struct timespec __user *, tsp,
641 void __user *, sig)
641{ 642{
642 size_t sigsetsize = 0; 643 size_t sigsetsize = 0;
643 sigset_t __user *up = NULL; 644 sigset_t __user *up = NULL;
@@ -650,7 +651,7 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
650 return -EFAULT; 651 return -EFAULT;
651 } 652 }
652 653
653 return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize); 654 return do_pselect(n, inp, outp, exp, tsp, up, sigsetsize);
654} 655}
655#endif /* HAVE_SET_RESTORE_SIGMASK */ 656#endif /* HAVE_SET_RESTORE_SIGMASK */
656 657
@@ -854,8 +855,8 @@ static long do_restart_poll(struct restart_block *restart_block)
854 return ret; 855 return ret;
855} 856}
856 857
857asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 858SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
858 long timeout_msecs) 859 long, timeout_msecs)
859{ 860{
860 struct timespec end_time, *to = NULL; 861 struct timespec end_time, *to = NULL;
861 int ret; 862 int ret;
@@ -889,9 +890,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
889} 890}
890 891
891#ifdef HAVE_SET_RESTORE_SIGMASK 892#ifdef HAVE_SET_RESTORE_SIGMASK
892asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, 893SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds,
893 struct timespec __user *tsp, const sigset_t __user *sigmask, 894 struct timespec __user *, tsp, const sigset_t __user *, sigmask,
894 size_t sigsetsize) 895 size_t, sigsetsize)
895{ 896{
896 sigset_t ksigmask, sigsaved; 897 sigset_t ksigmask, sigsaved;
897 struct timespec ts, end_time, *to = NULL; 898 struct timespec ts, end_time, *to = NULL;
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 9c39bc7f8431..b07565c94386 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -205,8 +205,8 @@ static const struct file_operations signalfd_fops = {
205 .read = signalfd_read, 205 .read = signalfd_read,
206}; 206};
207 207
208asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, 208SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
209 size_t sizemask, int flags) 209 size_t, sizemask, int, flags)
210{ 210{
211 sigset_t sigmask; 211 sigset_t sigmask;
212 struct signalfd_ctx *ctx; 212 struct signalfd_ctx *ctx;
@@ -259,8 +259,8 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
259 return ufd; 259 return ufd;
260} 260}
261 261
262asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, 262SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
263 size_t sizemask) 263 size_t, sizemask)
264{ 264{
265 return sys_signalfd4(ufd, user_mask, sizemask, 0); 265 return sys_signalfd4(ufd, user_mask, sizemask, 0);
266} 266}
diff --git a/fs/splice.c b/fs/splice.c
index a54b3e3f10a7..4ed0ba44a966 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1435,8 +1435,8 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
1435 * Currently we punt and implement it as a normal copy, see pipe_to_user(). 1435 * Currently we punt and implement it as a normal copy, see pipe_to_user().
1436 * 1436 *
1437 */ 1437 */
1438asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, 1438SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
1439 unsigned long nr_segs, unsigned int flags) 1439 unsigned long, nr_segs, unsigned int, flags)
1440{ 1440{
1441 struct file *file; 1441 struct file *file;
1442 long error; 1442 long error;
@@ -1461,9 +1461,9 @@ asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
1461 return error; 1461 return error;
1462} 1462}
1463 1463
1464asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, 1464SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
1465 int fd_out, loff_t __user *off_out, 1465 int, fd_out, loff_t __user *, off_out,
1466 size_t len, unsigned int flags) 1466 size_t, len, unsigned int, flags)
1467{ 1467{
1468 long error; 1468 long error;
1469 struct file *in, *out; 1469 struct file *in, *out;
@@ -1685,7 +1685,7 @@ static long do_tee(struct file *in, struct file *out, size_t len,
1685 return ret; 1685 return ret;
1686} 1686}
1687 1687
1688asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags) 1688SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
1689{ 1689{
1690 struct file *in; 1690 struct file *in;
1691 int error, fput_in; 1691 int error, fput_in;
diff --git a/fs/squashfs/squashfs_fs.h b/fs/squashfs/squashfs_fs.h
index 6840da1bf21e..283daafc568e 100644
--- a/fs/squashfs/squashfs_fs.h
+++ b/fs/squashfs/squashfs_fs.h
@@ -26,7 +26,6 @@
26#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE 26#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE
27#define SQUASHFS_MAJOR 4 27#define SQUASHFS_MAJOR 4
28#define SQUASHFS_MINOR 0 28#define SQUASHFS_MINOR 0
29#define SQUASHFS_MAGIC 0x73717368
30#define SQUASHFS_START 0 29#define SQUASHFS_START 0
31 30
32/* size of metadata (inode and directory) blocks */ 31/* size of metadata (inode and directory) blocks */
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index a0466d7467b2..071df5b5b491 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/zlib.h> 37#include <linux/zlib.h>
38#include <linux/magic.h>
38 39
39#include "squashfs_fs.h" 40#include "squashfs_fs.h"
40#include "squashfs_fs_sb.h" 41#include "squashfs_fs_sb.h"
diff --git a/fs/stat.c b/fs/stat.c
index 7e12a6f82795..2db740a0cfb5 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -152,7 +152,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
152 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 152 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
153} 153}
154 154
155asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf) 155SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
156{ 156{
157 struct kstat stat; 157 struct kstat stat;
158 int error = vfs_stat_fd(AT_FDCWD, filename, &stat); 158 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
@@ -162,7 +162,8 @@ asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user
162 162
163 return error; 163 return error;
164} 164}
165asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf) 165
166SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
166{ 167{
167 struct kstat stat; 168 struct kstat stat;
168 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); 169 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
@@ -172,7 +173,8 @@ asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __use
172 173
173 return error; 174 return error;
174} 175}
175asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf) 176
177SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf)
176{ 178{
177 struct kstat stat; 179 struct kstat stat;
178 int error = vfs_fstat(fd, &stat); 180 int error = vfs_fstat(fd, &stat);
@@ -235,7 +237,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
235 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 237 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
236} 238}
237 239
238asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) 240SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
239{ 241{
240 struct kstat stat; 242 struct kstat stat;
241 int error = vfs_stat_fd(AT_FDCWD, filename, &stat); 243 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
@@ -246,7 +248,7 @@ asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf)
246 return error; 248 return error;
247} 249}
248 250
249asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) 251SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf)
250{ 252{
251 struct kstat stat; 253 struct kstat stat;
252 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); 254 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
@@ -258,8 +260,8 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf)
258} 260}
259 261
260#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) 262#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
261asmlinkage long sys_newfstatat(int dfd, char __user *filename, 263SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
262 struct stat __user *statbuf, int flag) 264 struct stat __user *, statbuf, int, flag)
263{ 265{
264 struct kstat stat; 266 struct kstat stat;
265 int error = -EINVAL; 267 int error = -EINVAL;
@@ -280,7 +282,7 @@ out:
280} 282}
281#endif 283#endif
282 284
283asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) 285SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
284{ 286{
285 struct kstat stat; 287 struct kstat stat;
286 int error = vfs_fstat(fd, &stat); 288 int error = vfs_fstat(fd, &stat);
@@ -291,8 +293,8 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf)
291 return error; 293 return error;
292} 294}
293 295
294asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, 296SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
295 char __user *buf, int bufsiz) 297 char __user *, buf, int, bufsiz)
296{ 298{
297 struct path path; 299 struct path path;
298 int error; 300 int error;
@@ -318,8 +320,8 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname,
318 return error; 320 return error;
319} 321}
320 322
321asmlinkage long sys_readlink(const char __user *path, char __user *buf, 323SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
322 int bufsiz) 324 int, bufsiz)
323{ 325{
324 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); 326 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz);
325} 327}
@@ -365,7 +367,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
365 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 367 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
366} 368}
367 369
368asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf) 370SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf)
369{ 371{
370 struct kstat stat; 372 struct kstat stat;
371 int error = vfs_stat(filename, &stat); 373 int error = vfs_stat(filename, &stat);
@@ -375,7 +377,8 @@ asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbu
375 377
376 return error; 378 return error;
377} 379}
378asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf) 380
381SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf)
379{ 382{
380 struct kstat stat; 383 struct kstat stat;
381 int error = vfs_lstat(filename, &stat); 384 int error = vfs_lstat(filename, &stat);
@@ -385,7 +388,8 @@ asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statb
385 388
386 return error; 389 return error;
387} 390}
388asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) 391
392SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf)
389{ 393{
390 struct kstat stat; 394 struct kstat stat;
391 int error = vfs_fstat(fd, &stat); 395 int error = vfs_fstat(fd, &stat);
@@ -396,8 +400,8 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf)
396 return error; 400 return error;
397} 401}
398 402
399asmlinkage long sys_fstatat64(int dfd, char __user *filename, 403SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
400 struct stat64 __user *statbuf, int flag) 404 struct stat64 __user *, statbuf, int, flag)
401{ 405{
402 struct kstat stat; 406 struct kstat stat;
403 int error = -EINVAL; 407 int error = -EINVAL;
diff --git a/fs/super.c b/fs/super.c
index ed080c417167..645e5403f2a0 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -544,7 +544,7 @@ rescan:
544 return NULL; 544 return NULL;
545} 545}
546 546
547asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) 547SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
548{ 548{
549 struct super_block *s; 549 struct super_block *s;
550 struct ustat tmp; 550 struct ustat tmp;
diff --git a/fs/sync.c b/fs/sync.c
index ac02b56548bc..a16d53e5fe9d 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -36,7 +36,7 @@ static void do_sync(unsigned long wait)
36 laptop_sync_completion(); 36 laptop_sync_completion();
37} 37}
38 38
39asmlinkage long sys_sync(void) 39SYSCALL_DEFINE0(sync)
40{ 40{
41 do_sync(1); 41 do_sync(1);
42 return 0; 42 return 0;
@@ -144,12 +144,12 @@ static int do_fsync(unsigned int fd, int datasync)
144 return ret; 144 return ret;
145} 145}
146 146
147asmlinkage long sys_fsync(unsigned int fd) 147SYSCALL_DEFINE1(fsync, unsigned int, fd)
148{ 148{
149 return do_fsync(fd, 0); 149 return do_fsync(fd, 0);
150} 150}
151 151
152asmlinkage long sys_fdatasync(unsigned int fd) 152SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
153{ 153{
154 return do_fsync(fd, 1); 154 return do_fsync(fd, 1);
155} 155}
@@ -201,8 +201,8 @@ asmlinkage long sys_fdatasync(unsigned int fd)
201 * already-instantiated disk blocks, there are no guarantees here that the data 201 * already-instantiated disk blocks, there are no guarantees here that the data
202 * will be available after a crash. 202 * will be available after a crash.
203 */ 203 */
204asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, 204SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
205 unsigned int flags) 205 unsigned int flags)
206{ 206{
207 int ret; 207 int ret;
208 struct file *file; 208 struct file *file;
@@ -262,14 +262,32 @@ out_put:
262out: 262out:
263 return ret; 263 return ret;
264} 264}
265#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
266asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes,
267 long flags)
268{
269 return SYSC_sync_file_range((int) fd, offset, nbytes,
270 (unsigned int) flags);
271}
272SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range);
273#endif
265 274
266/* It would be nice if people remember that not all the world's an i386 275/* It would be nice if people remember that not all the world's an i386
267 when they introduce new system calls */ 276 when they introduce new system calls */
268asmlinkage long sys_sync_file_range2(int fd, unsigned int flags, 277SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags,
269 loff_t offset, loff_t nbytes) 278 loff_t offset, loff_t nbytes)
270{ 279{
271 return sys_sync_file_range(fd, offset, nbytes, flags); 280 return sys_sync_file_range(fd, offset, nbytes, flags);
272} 281}
282#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
283asmlinkage long SyS_sync_file_range2(long fd, long flags,
284 loff_t offset, loff_t nbytes)
285{
286 return SYSC_sync_file_range2((int) fd, (unsigned int) flags,
287 offset, nbytes);
288}
289SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2);
290#endif
273 291
274/* 292/*
275 * `endbyte' is inclusive 293 * `endbyte' is inclusive
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 0862f0e49d0c..6a123b8ff3f5 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -177,7 +177,7 @@ static struct file *timerfd_fget(int fd)
177 return file; 177 return file;
178} 178}
179 179
180asmlinkage long sys_timerfd_create(int clockid, int flags) 180SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
181{ 181{
182 int ufd; 182 int ufd;
183 struct timerfd_ctx *ctx; 183 struct timerfd_ctx *ctx;
@@ -208,9 +208,9 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
208 return ufd; 208 return ufd;
209} 209}
210 210
211asmlinkage long sys_timerfd_settime(int ufd, int flags, 211SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
212 const struct itimerspec __user *utmr, 212 const struct itimerspec __user *, utmr,
213 struct itimerspec __user *otmr) 213 struct itimerspec __user *, otmr)
214{ 214{
215 struct file *file; 215 struct file *file;
216 struct timerfd_ctx *ctx; 216 struct timerfd_ctx *ctx;
@@ -265,7 +265,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
265 return 0; 265 return 0;
266} 266}
267 267
268asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr) 268SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
269{ 269{
270 struct file *file; 270 struct file *file;
271 struct timerfd_ctx *ctx; 271 struct timerfd_ctx *ctx;
diff --git a/fs/utimes.c b/fs/utimes.c
index 6929e3e91d05..e4c75db5d373 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -24,7 +24,7 @@
24 * must be owner or have write permission. 24 * must be owner or have write permission.
25 * Else, update from *times, must be owner or super user. 25 * Else, update from *times, must be owner or super user.
26 */ 26 */
27asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times) 27SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times)
28{ 28{
29 struct timespec tv[2]; 29 struct timespec tv[2];
30 30
@@ -170,7 +170,8 @@ out:
170 return error; 170 return error;
171} 171}
172 172
173asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __user *utimes, int flags) 173SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename,
174 struct timespec __user *, utimes, int, flags)
174{ 175{
175 struct timespec tstimes[2]; 176 struct timespec tstimes[2];
176 177
@@ -187,7 +188,8 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __
187 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 188 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags);
188} 189}
189 190
190asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __user *utimes) 191SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename,
192 struct timeval __user *, utimes)
191{ 193{
192 struct timeval times[2]; 194 struct timeval times[2];
193 struct timespec tstimes[2]; 195 struct timespec tstimes[2];
@@ -214,7 +216,8 @@ asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __u
214 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0); 216 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0);
215} 217}
216 218
217asmlinkage long sys_utimes(char __user *filename, struct timeval __user *utimes) 219SYSCALL_DEFINE2(utimes, char __user *, filename,
220 struct timeval __user *, utimes)
218{ 221{
219 return sys_futimesat(AT_FDCWD, filename, utimes); 222 return sys_futimesat(AT_FDCWD, filename, utimes);
220} 223}
diff --git a/fs/xattr.c b/fs/xattr.c
index 237804cd6b56..197c4fcac032 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -251,9 +251,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
251 return error; 251 return error;
252} 252}
253 253
254asmlinkage long 254SYSCALL_DEFINE5(setxattr, const char __user *, pathname,
255sys_setxattr(const char __user *pathname, const char __user *name, 255 const char __user *, name, const void __user *, value,
256 const void __user *value, size_t size, int flags) 256 size_t, size, int, flags)
257{ 257{
258 struct path path; 258 struct path path;
259 int error; 259 int error;
@@ -270,9 +270,9 @@ sys_setxattr(const char __user *pathname, const char __user *name,
270 return error; 270 return error;
271} 271}
272 272
273asmlinkage long 273SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname,
274sys_lsetxattr(const char __user *pathname, const char __user *name, 274 const char __user *, name, const void __user *, value,
275 const void __user *value, size_t size, int flags) 275 size_t, size, int, flags)
276{ 276{
277 struct path path; 277 struct path path;
278 int error; 278 int error;
@@ -289,9 +289,8 @@ sys_lsetxattr(const char __user *pathname, const char __user *name,
289 return error; 289 return error;
290} 290}
291 291
292asmlinkage long 292SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
293sys_fsetxattr(int fd, const char __user *name, const void __user *value, 293 const void __user *,value, size_t, size, int, flags)
294 size_t size, int flags)
295{ 294{
296 struct file *f; 295 struct file *f;
297 struct dentry *dentry; 296 struct dentry *dentry;
@@ -349,9 +348,8 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
349 return error; 348 return error;
350} 349}
351 350
352asmlinkage ssize_t 351SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
353sys_getxattr(const char __user *pathname, const char __user *name, 352 const char __user *, name, void __user *, value, size_t, size)
354 void __user *value, size_t size)
355{ 353{
356 struct path path; 354 struct path path;
357 ssize_t error; 355 ssize_t error;
@@ -364,9 +362,8 @@ sys_getxattr(const char __user *pathname, const char __user *name,
364 return error; 362 return error;
365} 363}
366 364
367asmlinkage ssize_t 365SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname,
368sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value, 366 const char __user *, name, void __user *, value, size_t, size)
369 size_t size)
370{ 367{
371 struct path path; 368 struct path path;
372 ssize_t error; 369 ssize_t error;
@@ -379,8 +376,8 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user
379 return error; 376 return error;
380} 377}
381 378
382asmlinkage ssize_t 379SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
383sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) 380 void __user *, value, size_t, size)
384{ 381{
385 struct file *f; 382 struct file *f;
386 ssize_t error = -EBADF; 383 ssize_t error = -EBADF;
@@ -424,8 +421,8 @@ listxattr(struct dentry *d, char __user *list, size_t size)
424 return error; 421 return error;
425} 422}
426 423
427asmlinkage ssize_t 424SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list,
428sys_listxattr(const char __user *pathname, char __user *list, size_t size) 425 size_t, size)
429{ 426{
430 struct path path; 427 struct path path;
431 ssize_t error; 428 ssize_t error;
@@ -438,8 +435,8 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size)
438 return error; 435 return error;
439} 436}
440 437
441asmlinkage ssize_t 438SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list,
442sys_llistxattr(const char __user *pathname, char __user *list, size_t size) 439 size_t, size)
443{ 440{
444 struct path path; 441 struct path path;
445 ssize_t error; 442 ssize_t error;
@@ -452,8 +449,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
452 return error; 449 return error;
453} 450}
454 451
455asmlinkage ssize_t 452SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
456sys_flistxattr(int fd, char __user *list, size_t size)
457{ 453{
458 struct file *f; 454 struct file *f;
459 ssize_t error = -EBADF; 455 ssize_t error = -EBADF;
@@ -485,8 +481,8 @@ removexattr(struct dentry *d, const char __user *name)
485 return vfs_removexattr(d, kname); 481 return vfs_removexattr(d, kname);
486} 482}
487 483
488asmlinkage long 484SYSCALL_DEFINE2(removexattr, const char __user *, pathname,
489sys_removexattr(const char __user *pathname, const char __user *name) 485 const char __user *, name)
490{ 486{
491 struct path path; 487 struct path path;
492 int error; 488 int error;
@@ -503,8 +499,8 @@ sys_removexattr(const char __user *pathname, const char __user *name)
503 return error; 499 return error;
504} 500}
505 501
506asmlinkage long 502SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
507sys_lremovexattr(const char __user *pathname, const char __user *name) 503 const char __user *, name)
508{ 504{
509 struct path path; 505 struct path path;
510 int error; 506 int error;
@@ -521,8 +517,7 @@ sys_lremovexattr(const char __user *pathname, const char __user *name)
521 return error; 517 return error;
522} 518}
523 519
524asmlinkage long 520SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
525sys_fremovexattr(int fd, const char __user *name)
526{ 521{
527 struct file *f; 522 struct file *f;
528 struct dentry *dentry; 523 struct dentry *dentry;
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
index 7b26f5ff9692..1dd528849755 100644
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -21,8 +21,6 @@
21extern struct workqueue_struct *xfsdatad_workqueue; 21extern struct workqueue_struct *xfsdatad_workqueue;
22extern mempool_t *xfs_ioend_pool; 22extern mempool_t *xfs_ioend_pool;
23 23
24typedef void (*xfs_ioend_func_t)(void *);
25
26/* 24/*
27 * xfs_ioend struct manages large extent writes for XFS. 25 * xfs_ioend struct manages large extent writes for XFS.
28 * It can manage several multi-page bio's at once. 26 * It can manage several multi-page bio's at once.
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index cb329edc925b..d71dc44e21ed 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -166,75 +166,6 @@ test_page_region(
166} 166}
167 167
168/* 168/*
169 * Mapping of multi-page buffers into contiguous virtual space
170 */
171
172typedef struct a_list {
173 void *vm_addr;
174 struct a_list *next;
175} a_list_t;
176
177static a_list_t *as_free_head;
178static int as_list_len;
179static DEFINE_SPINLOCK(as_lock);
180
181/*
182 * Try to batch vunmaps because they are costly.
183 */
184STATIC void
185free_address(
186 void *addr)
187{
188 a_list_t *aentry;
189
190#ifdef CONFIG_XEN
191 /*
192 * Xen needs to be able to make sure it can get an exclusive
193 * RO mapping of pages it wants to turn into a pagetable. If
194 * a newly allocated page is also still being vmap()ed by xfs,
195 * it will cause pagetable construction to fail. This is a
196 * quick workaround to always eagerly unmap pages so that Xen
197 * is happy.
198 */
199 vunmap(addr);
200 return;
201#endif
202
203 aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
204 if (likely(aentry)) {
205 spin_lock(&as_lock);
206 aentry->next = as_free_head;
207 aentry->vm_addr = addr;
208 as_free_head = aentry;
209 as_list_len++;
210 spin_unlock(&as_lock);
211 } else {
212 vunmap(addr);
213 }
214}
215
216STATIC void
217purge_addresses(void)
218{
219 a_list_t *aentry, *old;
220
221 if (as_free_head == NULL)
222 return;
223
224 spin_lock(&as_lock);
225 aentry = as_free_head;
226 as_free_head = NULL;
227 as_list_len = 0;
228 spin_unlock(&as_lock);
229
230 while ((old = aentry) != NULL) {
231 vunmap(aentry->vm_addr);
232 aentry = aentry->next;
233 kfree(old);
234 }
235}
236
237/*
238 * Internal xfs_buf_t object manipulation 169 * Internal xfs_buf_t object manipulation
239 */ 170 */
240 171
@@ -333,7 +264,7 @@ xfs_buf_free(
333 uint i; 264 uint i;
334 265
335 if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) 266 if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1))
336 free_address(bp->b_addr - bp->b_offset); 267 vm_unmap_ram(bp->b_addr - bp->b_offset, bp->b_page_count);
337 268
338 for (i = 0; i < bp->b_page_count; i++) { 269 for (i = 0; i < bp->b_page_count; i++) {
339 struct page *page = bp->b_pages[i]; 270 struct page *page = bp->b_pages[i];
@@ -455,10 +386,8 @@ _xfs_buf_map_pages(
455 bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset; 386 bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset;
456 bp->b_flags |= XBF_MAPPED; 387 bp->b_flags |= XBF_MAPPED;
457 } else if (flags & XBF_MAPPED) { 388 } else if (flags & XBF_MAPPED) {
458 if (as_list_len > 64) 389 bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count,
459 purge_addresses(); 390 -1, PAGE_KERNEL);
460 bp->b_addr = vmap(bp->b_pages, bp->b_page_count,
461 VM_MAP, PAGE_KERNEL);
462 if (unlikely(bp->b_addr == NULL)) 391 if (unlikely(bp->b_addr == NULL))
463 return -ENOMEM; 392 return -ENOMEM;
464 bp->b_addr += bp->b_offset; 393 bp->b_addr += bp->b_offset;
@@ -1743,8 +1672,6 @@ xfsbufd(
1743 count++; 1672 count++;
1744 } 1673 }
1745 1674
1746 if (as_list_len > 0)
1747 purge_addresses();
1748 if (count) 1675 if (count)
1749 blk_run_address_space(target->bt_mapping); 1676 blk_run_address_space(target->bt_mapping);
1750 1677
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 595751f78350..87b8cbd23d4b 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -126,11 +126,26 @@ xfs_nfs_get_inode(
126 if (ino == 0) 126 if (ino == 0)
127 return ERR_PTR(-ESTALE); 127 return ERR_PTR(-ESTALE);
128 128
129 error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, 0); 129 /*
130 if (error) 130 * The XFS_IGET_BULKSTAT means that an invalid inode number is just
131 * fine and not an indication of a corrupted filesystem. Because
132 * clients can send any kind of invalid file handle, e.g. after
133 * a restore on the server we have to deal with this case gracefully.
134 */
135 error = xfs_iget(mp, NULL, ino, XFS_IGET_BULKSTAT,
136 XFS_ILOCK_SHARED, &ip, 0);
137 if (error) {
138 /*
139 * EINVAL means the inode cluster doesn't exist anymore.
140 * This implies the filehandle is stale, so we should
141 * translate it here.
142 * We don't use ESTALE directly down the chain to not
143 * confuse applications using bulkstat that expect EINVAL.
144 */
145 if (error == EINVAL)
146 error = ESTALE;
131 return ERR_PTR(-error); 147 return ERR_PTR(-error);
132 if (!ip) 148 }
133 return ERR_PTR(-EIO);
134 149
135 if (ip->i_d.di_gen != generation) { 150 if (ip->i_d.di_gen != generation) {
136 xfs_iput_new(ip, XFS_ILOCK_SHARED); 151 xfs_iput_new(ip, XFS_ILOCK_SHARED);
diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h
index a4e293b93efa..642f1db4def4 100644
--- a/fs/xfs/xfs_acl.h
+++ b/fs/xfs/xfs_acl.h
@@ -22,7 +22,6 @@
22 * Access Control Lists 22 * Access Control Lists
23 */ 23 */
24typedef __uint16_t xfs_acl_perm_t; 24typedef __uint16_t xfs_acl_perm_t;
25typedef __int32_t xfs_acl_type_t;
26typedef __int32_t xfs_acl_tag_t; 25typedef __int32_t xfs_acl_tag_t;
27typedef __int32_t xfs_acl_id_t; 26typedef __int32_t xfs_acl_id_t;
28 27
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index f2e21817a226..d3b3cf742999 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -231,7 +231,7 @@ typedef struct xfs_perag
231#define XFS_FSB_TO_AGNO(mp,fsbno) \ 231#define XFS_FSB_TO_AGNO(mp,fsbno) \
232 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog)) 232 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
233#define XFS_FSB_TO_AGBNO(mp,fsbno) \ 233#define XFS_FSB_TO_AGBNO(mp,fsbno) \
234 ((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog))) 234 ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
235#define XFS_AGB_TO_DADDR(mp,agno,agbno) \ 235#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
236 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \ 236 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
237 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno))) 237 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 79da6b2ea99e..6c323f8a4cd1 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -736,7 +736,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp)
736 continue; /* don't copy partial entries */ 736 continue; /* don't copy partial entries */
737 if (!(entry->flags & XFS_ATTR_LOCAL)) 737 if (!(entry->flags & XFS_ATTR_LOCAL))
738 return(0); 738 return(0);
739 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); 739 name_loc = xfs_attr_leaf_name_local(leaf, i);
740 if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX) 740 if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX)
741 return(0); 741 return(0);
742 if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX) 742 if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX)
@@ -823,7 +823,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
823 if (!entry->nameidx) 823 if (!entry->nameidx)
824 continue; 824 continue;
825 ASSERT(entry->flags & XFS_ATTR_LOCAL); 825 ASSERT(entry->flags & XFS_ATTR_LOCAL);
826 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); 826 name_loc = xfs_attr_leaf_name_local(leaf, i);
827 nargs.name = (char *)name_loc->nameval; 827 nargs.name = (char *)name_loc->nameval;
828 nargs.namelen = name_loc->namelen; 828 nargs.namelen = name_loc->namelen;
829 nargs.value = (char *)&name_loc->nameval[nargs.namelen]; 829 nargs.value = (char *)&name_loc->nameval[nargs.namelen];
@@ -1141,14 +1141,14 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1141 * as part of this transaction (a split operation for example). 1141 * as part of this transaction (a split operation for example).
1142 */ 1142 */
1143 if (entry->flags & XFS_ATTR_LOCAL) { 1143 if (entry->flags & XFS_ATTR_LOCAL) {
1144 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); 1144 name_loc = xfs_attr_leaf_name_local(leaf, args->index);
1145 name_loc->namelen = args->namelen; 1145 name_loc->namelen = args->namelen;
1146 name_loc->valuelen = cpu_to_be16(args->valuelen); 1146 name_loc->valuelen = cpu_to_be16(args->valuelen);
1147 memcpy((char *)name_loc->nameval, args->name, args->namelen); 1147 memcpy((char *)name_loc->nameval, args->name, args->namelen);
1148 memcpy((char *)&name_loc->nameval[args->namelen], args->value, 1148 memcpy((char *)&name_loc->nameval[args->namelen], args->value,
1149 be16_to_cpu(name_loc->valuelen)); 1149 be16_to_cpu(name_loc->valuelen));
1150 } else { 1150 } else {
1151 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 1151 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
1152 name_rmt->namelen = args->namelen; 1152 name_rmt->namelen = args->namelen;
1153 memcpy((char *)name_rmt->name, args->name, args->namelen); 1153 memcpy((char *)name_rmt->name, args->name, args->namelen);
1154 entry->flags |= XFS_ATTR_INCOMPLETE; 1154 entry->flags |= XFS_ATTR_INCOMPLETE;
@@ -1159,7 +1159,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1159 args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen); 1159 args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen);
1160 } 1160 }
1161 xfs_da_log_buf(args->trans, bp, 1161 xfs_da_log_buf(args->trans, bp,
1162 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), 1162 XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index),
1163 xfs_attr_leaf_entsize(leaf, args->index))); 1163 xfs_attr_leaf_entsize(leaf, args->index)));
1164 1164
1165 /* 1165 /*
@@ -1749,10 +1749,10 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1749 /* 1749 /*
1750 * Compress the remaining entries and zero out the removed stuff. 1750 * Compress the remaining entries and zero out the removed stuff.
1751 */ 1751 */
1752 memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize); 1752 memset(xfs_attr_leaf_name(leaf, args->index), 0, entsize);
1753 be16_add_cpu(&hdr->usedbytes, -entsize); 1753 be16_add_cpu(&hdr->usedbytes, -entsize);
1754 xfs_da_log_buf(args->trans, bp, 1754 xfs_da_log_buf(args->trans, bp,
1755 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), 1755 XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index),
1756 entsize)); 1756 entsize));
1757 1757
1758 tmp = (be16_to_cpu(hdr->count) - args->index) 1758 tmp = (be16_to_cpu(hdr->count) - args->index)
@@ -1985,7 +1985,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args)
1985 continue; 1985 continue;
1986 } 1986 }
1987 if (entry->flags & XFS_ATTR_LOCAL) { 1987 if (entry->flags & XFS_ATTR_LOCAL) {
1988 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, probe); 1988 name_loc = xfs_attr_leaf_name_local(leaf, probe);
1989 if (name_loc->namelen != args->namelen) 1989 if (name_loc->namelen != args->namelen)
1990 continue; 1990 continue;
1991 if (memcmp(args->name, (char *)name_loc->nameval, args->namelen) != 0) 1991 if (memcmp(args->name, (char *)name_loc->nameval, args->namelen) != 0)
@@ -1995,7 +1995,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args)
1995 args->index = probe; 1995 args->index = probe;
1996 return(XFS_ERROR(EEXIST)); 1996 return(XFS_ERROR(EEXIST));
1997 } else { 1997 } else {
1998 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, probe); 1998 name_rmt = xfs_attr_leaf_name_remote(leaf, probe);
1999 if (name_rmt->namelen != args->namelen) 1999 if (name_rmt->namelen != args->namelen)
2000 continue; 2000 continue;
2001 if (memcmp(args->name, (char *)name_rmt->name, 2001 if (memcmp(args->name, (char *)name_rmt->name,
@@ -2035,7 +2035,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args)
2035 2035
2036 entry = &leaf->entries[args->index]; 2036 entry = &leaf->entries[args->index];
2037 if (entry->flags & XFS_ATTR_LOCAL) { 2037 if (entry->flags & XFS_ATTR_LOCAL) {
2038 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); 2038 name_loc = xfs_attr_leaf_name_local(leaf, args->index);
2039 ASSERT(name_loc->namelen == args->namelen); 2039 ASSERT(name_loc->namelen == args->namelen);
2040 ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); 2040 ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);
2041 valuelen = be16_to_cpu(name_loc->valuelen); 2041 valuelen = be16_to_cpu(name_loc->valuelen);
@@ -2050,7 +2050,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args)
2050 args->valuelen = valuelen; 2050 args->valuelen = valuelen;
2051 memcpy(args->value, &name_loc->nameval[args->namelen], valuelen); 2051 memcpy(args->value, &name_loc->nameval[args->namelen], valuelen);
2052 } else { 2052 } else {
2053 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2053 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2054 ASSERT(name_rmt->namelen == args->namelen); 2054 ASSERT(name_rmt->namelen == args->namelen);
2055 ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0); 2055 ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);
2056 valuelen = be32_to_cpu(name_rmt->valuelen); 2056 valuelen = be32_to_cpu(name_rmt->valuelen);
@@ -2143,7 +2143,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2143 * off for 6.2, should be revisited later. 2143 * off for 6.2, should be revisited later.
2144 */ 2144 */
2145 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ 2145 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */
2146 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2146 memset(xfs_attr_leaf_name(leaf_s, start_s + i), 0, tmp);
2147 be16_add_cpu(&hdr_s->usedbytes, -tmp); 2147 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2148 be16_add_cpu(&hdr_s->count, -1); 2148 be16_add_cpu(&hdr_s->count, -1);
2149 entry_d--; /* to compensate for ++ in loop hdr */ 2149 entry_d--; /* to compensate for ++ in loop hdr */
@@ -2160,11 +2160,11 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2160 entry_d->flags = entry_s->flags; 2160 entry_d->flags = entry_s->flags;
2161 ASSERT(be16_to_cpu(entry_d->nameidx) + tmp 2161 ASSERT(be16_to_cpu(entry_d->nameidx) + tmp
2162 <= XFS_LBSIZE(mp)); 2162 <= XFS_LBSIZE(mp));
2163 memmove(XFS_ATTR_LEAF_NAME(leaf_d, desti), 2163 memmove(xfs_attr_leaf_name(leaf_d, desti),
2164 XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), tmp); 2164 xfs_attr_leaf_name(leaf_s, start_s + i), tmp);
2165 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp 2165 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp
2166 <= XFS_LBSIZE(mp)); 2166 <= XFS_LBSIZE(mp));
2167 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2167 memset(xfs_attr_leaf_name(leaf_s, start_s + i), 0, tmp);
2168 be16_add_cpu(&hdr_s->usedbytes, -tmp); 2168 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2169 be16_add_cpu(&hdr_d->usedbytes, tmp); 2169 be16_add_cpu(&hdr_d->usedbytes, tmp);
2170 be16_add_cpu(&hdr_s->count, -1); 2170 be16_add_cpu(&hdr_s->count, -1);
@@ -2276,12 +2276,12 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)
2276 2276
2277 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); 2277 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC);
2278 if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { 2278 if (leaf->entries[index].flags & XFS_ATTR_LOCAL) {
2279 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); 2279 name_loc = xfs_attr_leaf_name_local(leaf, index);
2280 size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, 2280 size = xfs_attr_leaf_entsize_local(name_loc->namelen,
2281 be16_to_cpu(name_loc->valuelen)); 2281 be16_to_cpu(name_loc->valuelen));
2282 } else { 2282 } else {
2283 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, index); 2283 name_rmt = xfs_attr_leaf_name_remote(leaf, index);
2284 size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(name_rmt->namelen); 2284 size = xfs_attr_leaf_entsize_remote(name_rmt->namelen);
2285 } 2285 }
2286 return(size); 2286 return(size);
2287} 2287}
@@ -2297,13 +2297,13 @@ xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local)
2297{ 2297{
2298 int size; 2298 int size;
2299 2299
2300 size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(namelen, valuelen); 2300 size = xfs_attr_leaf_entsize_local(namelen, valuelen);
2301 if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) { 2301 if (size < xfs_attr_leaf_entsize_local_max(blocksize)) {
2302 if (local) { 2302 if (local) {
2303 *local = 1; 2303 *local = 1;
2304 } 2304 }
2305 } else { 2305 } else {
2306 size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(namelen); 2306 size = xfs_attr_leaf_entsize_remote(namelen);
2307 if (local) { 2307 if (local) {
2308 *local = 0; 2308 *local = 0;
2309 } 2309 }
@@ -2372,7 +2372,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
2372 2372
2373 if (entry->flags & XFS_ATTR_LOCAL) { 2373 if (entry->flags & XFS_ATTR_LOCAL) {
2374 xfs_attr_leaf_name_local_t *name_loc = 2374 xfs_attr_leaf_name_local_t *name_loc =
2375 XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); 2375 xfs_attr_leaf_name_local(leaf, i);
2376 2376
2377 retval = context->put_listent(context, 2377 retval = context->put_listent(context,
2378 entry->flags, 2378 entry->flags,
@@ -2384,7 +2384,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
2384 return retval; 2384 return retval;
2385 } else { 2385 } else {
2386 xfs_attr_leaf_name_remote_t *name_rmt = 2386 xfs_attr_leaf_name_remote_t *name_rmt =
2387 XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); 2387 xfs_attr_leaf_name_remote(leaf, i);
2388 2388
2389 int valuelen = be32_to_cpu(name_rmt->valuelen); 2389 int valuelen = be32_to_cpu(name_rmt->valuelen);
2390 2390
@@ -2468,11 +2468,11 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
2468 2468
2469#ifdef DEBUG 2469#ifdef DEBUG
2470 if (entry->flags & XFS_ATTR_LOCAL) { 2470 if (entry->flags & XFS_ATTR_LOCAL) {
2471 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); 2471 name_loc = xfs_attr_leaf_name_local(leaf, args->index);
2472 namelen = name_loc->namelen; 2472 namelen = name_loc->namelen;
2473 name = (char *)name_loc->nameval; 2473 name = (char *)name_loc->nameval;
2474 } else { 2474 } else {
2475 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2475 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2476 namelen = name_rmt->namelen; 2476 namelen = name_rmt->namelen;
2477 name = (char *)name_rmt->name; 2477 name = (char *)name_rmt->name;
2478 } 2478 }
@@ -2487,7 +2487,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
2487 2487
2488 if (args->rmtblkno) { 2488 if (args->rmtblkno) {
2489 ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0); 2489 ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0);
2490 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2490 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2491 name_rmt->valueblk = cpu_to_be32(args->rmtblkno); 2491 name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2492 name_rmt->valuelen = cpu_to_be32(args->valuelen); 2492 name_rmt->valuelen = cpu_to_be32(args->valuelen);
2493 xfs_da_log_buf(args->trans, bp, 2493 xfs_da_log_buf(args->trans, bp,
@@ -2534,7 +2534,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args)
2534 xfs_da_log_buf(args->trans, bp, 2534 xfs_da_log_buf(args->trans, bp,
2535 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry))); 2535 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
2536 if ((entry->flags & XFS_ATTR_LOCAL) == 0) { 2536 if ((entry->flags & XFS_ATTR_LOCAL) == 0) {
2537 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2537 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2538 name_rmt->valueblk = 0; 2538 name_rmt->valueblk = 0;
2539 name_rmt->valuelen = 0; 2539 name_rmt->valuelen = 0;
2540 xfs_da_log_buf(args->trans, bp, 2540 xfs_da_log_buf(args->trans, bp,
@@ -2607,20 +2607,20 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2607 2607
2608#ifdef DEBUG 2608#ifdef DEBUG
2609 if (entry1->flags & XFS_ATTR_LOCAL) { 2609 if (entry1->flags & XFS_ATTR_LOCAL) {
2610 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf1, args->index); 2610 name_loc = xfs_attr_leaf_name_local(leaf1, args->index);
2611 namelen1 = name_loc->namelen; 2611 namelen1 = name_loc->namelen;
2612 name1 = (char *)name_loc->nameval; 2612 name1 = (char *)name_loc->nameval;
2613 } else { 2613 } else {
2614 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf1, args->index); 2614 name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index);
2615 namelen1 = name_rmt->namelen; 2615 namelen1 = name_rmt->namelen;
2616 name1 = (char *)name_rmt->name; 2616 name1 = (char *)name_rmt->name;
2617 } 2617 }
2618 if (entry2->flags & XFS_ATTR_LOCAL) { 2618 if (entry2->flags & XFS_ATTR_LOCAL) {
2619 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf2, args->index2); 2619 name_loc = xfs_attr_leaf_name_local(leaf2, args->index2);
2620 namelen2 = name_loc->namelen; 2620 namelen2 = name_loc->namelen;
2621 name2 = (char *)name_loc->nameval; 2621 name2 = (char *)name_loc->nameval;
2622 } else { 2622 } else {
2623 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); 2623 name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2);
2624 namelen2 = name_rmt->namelen; 2624 namelen2 = name_rmt->namelen;
2625 name2 = (char *)name_rmt->name; 2625 name2 = (char *)name_rmt->name;
2626 } 2626 }
@@ -2637,7 +2637,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2637 XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1))); 2637 XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1)));
2638 if (args->rmtblkno) { 2638 if (args->rmtblkno) {
2639 ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0); 2639 ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0);
2640 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf1, args->index); 2640 name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index);
2641 name_rmt->valueblk = cpu_to_be32(args->rmtblkno); 2641 name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2642 name_rmt->valuelen = cpu_to_be32(args->valuelen); 2642 name_rmt->valuelen = cpu_to_be32(args->valuelen);
2643 xfs_da_log_buf(args->trans, bp1, 2643 xfs_da_log_buf(args->trans, bp1,
@@ -2648,7 +2648,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2648 xfs_da_log_buf(args->trans, bp2, 2648 xfs_da_log_buf(args->trans, bp2,
2649 XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2))); 2649 XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2)));
2650 if ((entry2->flags & XFS_ATTR_LOCAL) == 0) { 2650 if ((entry2->flags & XFS_ATTR_LOCAL) == 0) {
2651 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); 2651 name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2);
2652 name_rmt->valueblk = 0; 2652 name_rmt->valueblk = 0;
2653 name_rmt->valuelen = 0; 2653 name_rmt->valuelen = 0;
2654 xfs_da_log_buf(args->trans, bp2, 2654 xfs_da_log_buf(args->trans, bp2,
@@ -2855,7 +2855,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
2855 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { 2855 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
2856 if (be16_to_cpu(entry->nameidx) && 2856 if (be16_to_cpu(entry->nameidx) &&
2857 ((entry->flags & XFS_ATTR_LOCAL) == 0)) { 2857 ((entry->flags & XFS_ATTR_LOCAL) == 0)) {
2858 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); 2858 name_rmt = xfs_attr_leaf_name_remote(leaf, i);
2859 if (name_rmt->valueblk) 2859 if (name_rmt->valueblk)
2860 count++; 2860 count++;
2861 } 2861 }
@@ -2883,7 +2883,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
2883 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { 2883 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
2884 if (be16_to_cpu(entry->nameidx) && 2884 if (be16_to_cpu(entry->nameidx) &&
2885 ((entry->flags & XFS_ATTR_LOCAL) == 0)) { 2885 ((entry->flags & XFS_ATTR_LOCAL) == 0)) {
2886 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); 2886 name_rmt = xfs_attr_leaf_name_remote(leaf, i);
2887 if (name_rmt->valueblk) { 2887 if (name_rmt->valueblk) {
2888 lp->valueblk = be32_to_cpu(name_rmt->valueblk); 2888 lp->valueblk = be32_to_cpu(name_rmt->valueblk);
2889 lp->valuelen = XFS_B_TO_FSB(dp->i_mount, 2889 lp->valuelen = XFS_B_TO_FSB(dp->i_mount,
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h
index 83e9af417ca2..9c7d22fdcf4d 100644
--- a/fs/xfs/xfs_attr_leaf.h
+++ b/fs/xfs/xfs_attr_leaf.h
@@ -151,8 +151,6 @@ typedef struct xfs_attr_leafblock {
151/* 151/*
152 * Cast typed pointers for "local" and "remote" name/value structs. 152 * Cast typed pointers for "local" and "remote" name/value structs.
153 */ 153 */
154#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \
155 xfs_attr_leaf_name_remote(leafp,idx)
156static inline xfs_attr_leaf_name_remote_t * 154static inline xfs_attr_leaf_name_remote_t *
157xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) 155xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
158{ 156{
@@ -160,8 +158,6 @@ xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
160 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; 158 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
161} 159}
162 160
163#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \
164 xfs_attr_leaf_name_local(leafp,idx)
165static inline xfs_attr_leaf_name_local_t * 161static inline xfs_attr_leaf_name_local_t *
166xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) 162xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
167{ 163{
@@ -169,8 +165,6 @@ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
169 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; 165 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
170} 166}
171 167
172#define XFS_ATTR_LEAF_NAME(leafp,idx) \
173 xfs_attr_leaf_name(leafp,idx)
174static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) 168static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
175{ 169{
176 return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; 170 return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
@@ -181,24 +175,18 @@ static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
181 * a "local" name/value structure, a "remote" name/value structure, and 175 * a "local" name/value structure, a "remote" name/value structure, and
182 * a pointer which might be either. 176 * a pointer which might be either.
183 */ 177 */
184#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \
185 xfs_attr_leaf_entsize_remote(nlen)
186static inline int xfs_attr_leaf_entsize_remote(int nlen) 178static inline int xfs_attr_leaf_entsize_remote(int nlen)
187{ 179{
188 return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ 180 return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
189 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); 181 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
190} 182}
191 183
192#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \
193 xfs_attr_leaf_entsize_local(nlen,vlen)
194static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) 184static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
195{ 185{
196 return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + 186 return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) +
197 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); 187 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
198} 188}
199 189
200#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \
201 xfs_attr_leaf_entsize_local_max(bsize)
202static inline int xfs_attr_leaf_entsize_local_max(int bsize) 190static inline int xfs_attr_leaf_entsize_local_max(int bsize)
203{ 191{
204 return (((bsize) >> 1) + ((bsize) >> 2)); 192 return (((bsize) >> 1) + ((bsize) >> 2));
diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
index bca7b243c319..f1e3c907044d 100644
--- a/fs/xfs/xfs_bit.h
+++ b/fs/xfs/xfs_bit.h
@@ -23,24 +23,16 @@
23 */ 23 */
24 24
25/* 25/*
26 * masks with n high/low bits set, 32-bit values & 64-bit values 26 * masks with n high/low bits set, 64-bit values
27 */ 27 */
28#define XFS_MASK32HI(n) xfs_mask32hi(n)
29static inline __uint32_t xfs_mask32hi(int n)
30{
31 return (__uint32_t)-1 << (32 - (n));
32}
33#define XFS_MASK64HI(n) xfs_mask64hi(n)
34static inline __uint64_t xfs_mask64hi(int n) 28static inline __uint64_t xfs_mask64hi(int n)
35{ 29{
36 return (__uint64_t)-1 << (64 - (n)); 30 return (__uint64_t)-1 << (64 - (n));
37} 31}
38#define XFS_MASK32LO(n) xfs_mask32lo(n)
39static inline __uint32_t xfs_mask32lo(int n) 32static inline __uint32_t xfs_mask32lo(int n)
40{ 33{
41 return ((__uint32_t)1 << (n)) - 1; 34 return ((__uint32_t)1 << (n)) - 1;
42} 35}
43#define XFS_MASK64LO(n) xfs_mask64lo(n)
44static inline __uint64_t xfs_mask64lo(int n) 36static inline __uint64_t xfs_mask64lo(int n)
45{ 37{
46 return ((__uint64_t)1 << (n)) - 1; 38 return ((__uint64_t)1 << (n)) - 1;
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 8f1ec73725d3..ba6b08c2fb02 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -110,16 +110,16 @@ __xfs_bmbt_get_all(
110 110
111 ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN)); 111 ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN));
112 s->br_startoff = ((xfs_fileoff_t)l0 & 112 s->br_startoff = ((xfs_fileoff_t)l0 &
113 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 113 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
114#if XFS_BIG_BLKNOS 114#if XFS_BIG_BLKNOS
115 s->br_startblock = (((xfs_fsblock_t)l0 & XFS_MASK64LO(9)) << 43) | 115 s->br_startblock = (((xfs_fsblock_t)l0 & xfs_mask64lo(9)) << 43) |
116 (((xfs_fsblock_t)l1) >> 21); 116 (((xfs_fsblock_t)l1) >> 21);
117#else 117#else
118#ifdef DEBUG 118#ifdef DEBUG
119 { 119 {
120 xfs_dfsbno_t b; 120 xfs_dfsbno_t b;
121 121
122 b = (((xfs_dfsbno_t)l0 & XFS_MASK64LO(9)) << 43) | 122 b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
123 (((xfs_dfsbno_t)l1) >> 21); 123 (((xfs_dfsbno_t)l1) >> 21);
124 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); 124 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
125 s->br_startblock = (xfs_fsblock_t)b; 125 s->br_startblock = (xfs_fsblock_t)b;
@@ -128,7 +128,7 @@ __xfs_bmbt_get_all(
128 s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21); 128 s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21);
129#endif /* DEBUG */ 129#endif /* DEBUG */
130#endif /* XFS_BIG_BLKNOS */ 130#endif /* XFS_BIG_BLKNOS */
131 s->br_blockcount = (xfs_filblks_t)(l1 & XFS_MASK64LO(21)); 131 s->br_blockcount = (xfs_filblks_t)(l1 & xfs_mask64lo(21));
132 /* This is xfs_extent_state() in-line */ 132 /* This is xfs_extent_state() in-line */
133 if (ext_flag) { 133 if (ext_flag) {
134 ASSERT(s->br_blockcount != 0); /* saved for DMIG */ 134 ASSERT(s->br_blockcount != 0); /* saved for DMIG */
@@ -153,7 +153,7 @@ xfs_filblks_t
153xfs_bmbt_get_blockcount( 153xfs_bmbt_get_blockcount(
154 xfs_bmbt_rec_host_t *r) 154 xfs_bmbt_rec_host_t *r)
155{ 155{
156 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21)); 156 return (xfs_filblks_t)(r->l1 & xfs_mask64lo(21));
157} 157}
158 158
159/* 159/*
@@ -164,13 +164,13 @@ xfs_bmbt_get_startblock(
164 xfs_bmbt_rec_host_t *r) 164 xfs_bmbt_rec_host_t *r)
165{ 165{
166#if XFS_BIG_BLKNOS 166#if XFS_BIG_BLKNOS
167 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) | 167 return (((xfs_fsblock_t)r->l0 & xfs_mask64lo(9)) << 43) |
168 (((xfs_fsblock_t)r->l1) >> 21); 168 (((xfs_fsblock_t)r->l1) >> 21);
169#else 169#else
170#ifdef DEBUG 170#ifdef DEBUG
171 xfs_dfsbno_t b; 171 xfs_dfsbno_t b;
172 172
173 b = (((xfs_dfsbno_t)r->l0 & XFS_MASK64LO(9)) << 43) | 173 b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
174 (((xfs_dfsbno_t)r->l1) >> 21); 174 (((xfs_dfsbno_t)r->l1) >> 21);
175 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); 175 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
176 return (xfs_fsblock_t)b; 176 return (xfs_fsblock_t)b;
@@ -188,7 +188,7 @@ xfs_bmbt_get_startoff(
188 xfs_bmbt_rec_host_t *r) 188 xfs_bmbt_rec_host_t *r)
189{ 189{
190 return ((xfs_fileoff_t)r->l0 & 190 return ((xfs_fileoff_t)r->l0 &
191 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 191 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
192} 192}
193 193
194xfs_exntst_t 194xfs_exntst_t
@@ -219,7 +219,7 @@ xfs_filblks_t
219xfs_bmbt_disk_get_blockcount( 219xfs_bmbt_disk_get_blockcount(
220 xfs_bmbt_rec_t *r) 220 xfs_bmbt_rec_t *r)
221{ 221{
222 return (xfs_filblks_t)(be64_to_cpu(r->l1) & XFS_MASK64LO(21)); 222 return (xfs_filblks_t)(be64_to_cpu(r->l1) & xfs_mask64lo(21));
223} 223}
224 224
225/* 225/*
@@ -230,7 +230,7 @@ xfs_bmbt_disk_get_startoff(
230 xfs_bmbt_rec_t *r) 230 xfs_bmbt_rec_t *r)
231{ 231{
232 return ((xfs_fileoff_t)be64_to_cpu(r->l0) & 232 return ((xfs_fileoff_t)be64_to_cpu(r->l0) &
233 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 233 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
234} 234}
235 235
236 236
@@ -248,33 +248,33 @@ xfs_bmbt_set_allf(
248 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1; 248 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
249 249
250 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN); 250 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
251 ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0); 251 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
252 ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0); 252 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
253 253
254#if XFS_BIG_BLKNOS 254#if XFS_BIG_BLKNOS
255 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 255 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
256 256
257 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 257 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
258 ((xfs_bmbt_rec_base_t)startoff << 9) | 258 ((xfs_bmbt_rec_base_t)startoff << 9) |
259 ((xfs_bmbt_rec_base_t)startblock >> 43); 259 ((xfs_bmbt_rec_base_t)startblock >> 43);
260 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) | 260 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
261 ((xfs_bmbt_rec_base_t)blockcount & 261 ((xfs_bmbt_rec_base_t)blockcount &
262 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 262 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
263#else /* !XFS_BIG_BLKNOS */ 263#else /* !XFS_BIG_BLKNOS */
264 if (ISNULLSTARTBLOCK(startblock)) { 264 if (ISNULLSTARTBLOCK(startblock)) {
265 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 265 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
266 ((xfs_bmbt_rec_base_t)startoff << 9) | 266 ((xfs_bmbt_rec_base_t)startoff << 9) |
267 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 267 (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
268 r->l1 = XFS_MASK64HI(11) | 268 r->l1 = xfs_mask64hi(11) |
269 ((xfs_bmbt_rec_base_t)startblock << 21) | 269 ((xfs_bmbt_rec_base_t)startblock << 21) |
270 ((xfs_bmbt_rec_base_t)blockcount & 270 ((xfs_bmbt_rec_base_t)blockcount &
271 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 271 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
272 } else { 272 } else {
273 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 273 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
274 ((xfs_bmbt_rec_base_t)startoff << 9); 274 ((xfs_bmbt_rec_base_t)startoff << 9);
275 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) | 275 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
276 ((xfs_bmbt_rec_base_t)blockcount & 276 ((xfs_bmbt_rec_base_t)blockcount &
277 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 277 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
278 } 278 }
279#endif /* XFS_BIG_BLKNOS */ 279#endif /* XFS_BIG_BLKNOS */
280} 280}
@@ -306,11 +306,11 @@ xfs_bmbt_disk_set_allf(
306 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1; 306 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
307 307
308 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN); 308 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
309 ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0); 309 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
310 ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0); 310 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
311 311
312#if XFS_BIG_BLKNOS 312#if XFS_BIG_BLKNOS
313 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 313 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
314 314
315 r->l0 = cpu_to_be64( 315 r->l0 = cpu_to_be64(
316 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 316 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -319,17 +319,17 @@ xfs_bmbt_disk_set_allf(
319 r->l1 = cpu_to_be64( 319 r->l1 = cpu_to_be64(
320 ((xfs_bmbt_rec_base_t)startblock << 21) | 320 ((xfs_bmbt_rec_base_t)startblock << 21) |
321 ((xfs_bmbt_rec_base_t)blockcount & 321 ((xfs_bmbt_rec_base_t)blockcount &
322 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 322 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
323#else /* !XFS_BIG_BLKNOS */ 323#else /* !XFS_BIG_BLKNOS */
324 if (ISNULLSTARTBLOCK(startblock)) { 324 if (ISNULLSTARTBLOCK(startblock)) {
325 r->l0 = cpu_to_be64( 325 r->l0 = cpu_to_be64(
326 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 326 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
327 ((xfs_bmbt_rec_base_t)startoff << 9) | 327 ((xfs_bmbt_rec_base_t)startoff << 9) |
328 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); 328 (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
329 r->l1 = cpu_to_be64(XFS_MASK64HI(11) | 329 r->l1 = cpu_to_be64(xfs_mask64hi(11) |
330 ((xfs_bmbt_rec_base_t)startblock << 21) | 330 ((xfs_bmbt_rec_base_t)startblock << 21) |
331 ((xfs_bmbt_rec_base_t)blockcount & 331 ((xfs_bmbt_rec_base_t)blockcount &
332 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 332 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
333 } else { 333 } else {
334 r->l0 = cpu_to_be64( 334 r->l0 = cpu_to_be64(
335 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 335 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -337,7 +337,7 @@ xfs_bmbt_disk_set_allf(
337 r->l1 = cpu_to_be64( 337 r->l1 = cpu_to_be64(
338 ((xfs_bmbt_rec_base_t)startblock << 21) | 338 ((xfs_bmbt_rec_base_t)startblock << 21) |
339 ((xfs_bmbt_rec_base_t)blockcount & 339 ((xfs_bmbt_rec_base_t)blockcount &
340 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 340 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
341 } 341 }
342#endif /* XFS_BIG_BLKNOS */ 342#endif /* XFS_BIG_BLKNOS */
343} 343}
@@ -362,9 +362,9 @@ xfs_bmbt_set_blockcount(
362 xfs_bmbt_rec_host_t *r, 362 xfs_bmbt_rec_host_t *r,
363 xfs_filblks_t v) 363 xfs_filblks_t v)
364{ 364{
365 ASSERT((v & XFS_MASK64HI(43)) == 0); 365 ASSERT((v & xfs_mask64hi(43)) == 0);
366 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64HI(43)) | 366 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64hi(43)) |
367 (xfs_bmbt_rec_base_t)(v & XFS_MASK64LO(21)); 367 (xfs_bmbt_rec_base_t)(v & xfs_mask64lo(21));
368} 368}
369 369
370/* 370/*
@@ -376,21 +376,21 @@ xfs_bmbt_set_startblock(
376 xfs_fsblock_t v) 376 xfs_fsblock_t v)
377{ 377{
378#if XFS_BIG_BLKNOS 378#if XFS_BIG_BLKNOS
379 ASSERT((v & XFS_MASK64HI(12)) == 0); 379 ASSERT((v & xfs_mask64hi(12)) == 0);
380 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)XFS_MASK64HI(55)) | 380 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64hi(55)) |
381 (xfs_bmbt_rec_base_t)(v >> 43); 381 (xfs_bmbt_rec_base_t)(v >> 43);
382 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)) | 382 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
383 (xfs_bmbt_rec_base_t)(v << 21); 383 (xfs_bmbt_rec_base_t)(v << 21);
384#else /* !XFS_BIG_BLKNOS */ 384#else /* !XFS_BIG_BLKNOS */
385 if (ISNULLSTARTBLOCK(v)) { 385 if (ISNULLSTARTBLOCK(v)) {
386 r->l0 |= (xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 386 r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
387 r->l1 = (xfs_bmbt_rec_base_t)XFS_MASK64HI(11) | 387 r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
388 ((xfs_bmbt_rec_base_t)v << 21) | 388 ((xfs_bmbt_rec_base_t)v << 21) |
389 (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 389 (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
390 } else { 390 } else {
391 r->l0 &= ~(xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 391 r->l0 &= ~(xfs_bmbt_rec_base_t)xfs_mask64lo(9);
392 r->l1 = ((xfs_bmbt_rec_base_t)v << 21) | 392 r->l1 = ((xfs_bmbt_rec_base_t)v << 21) |
393 (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 393 (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
394 } 394 }
395#endif /* XFS_BIG_BLKNOS */ 395#endif /* XFS_BIG_BLKNOS */
396} 396}
@@ -403,10 +403,10 @@ xfs_bmbt_set_startoff(
403 xfs_bmbt_rec_host_t *r, 403 xfs_bmbt_rec_host_t *r,
404 xfs_fileoff_t v) 404 xfs_fileoff_t v)
405{ 405{
406 ASSERT((v & XFS_MASK64HI(9)) == 0); 406 ASSERT((v & xfs_mask64hi(9)) == 0);
407 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t) XFS_MASK64HI(1)) | 407 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t) xfs_mask64hi(1)) |
408 ((xfs_bmbt_rec_base_t)v << 9) | 408 ((xfs_bmbt_rec_base_t)v << 9) |
409 (r->l0 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); 409 (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
410} 410}
411 411
412/* 412/*
@@ -419,9 +419,9 @@ xfs_bmbt_set_state(
419{ 419{
420 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN); 420 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN);
421 if (v == XFS_EXT_NORM) 421 if (v == XFS_EXT_NORM)
422 r->l0 &= XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN); 422 r->l0 &= xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN);
423 else 423 else
424 r->l0 |= XFS_MASK64HI(BMBT_EXNTFLAG_BITLEN); 424 r->l0 |= xfs_mask64hi(BMBT_EXNTFLAG_BITLEN);
425} 425}
426 426
427/* 427/*
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 7ed59267420d..2c3ef20f8842 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -730,8 +730,8 @@ xfs_btree_readahead_lblock(
730 struct xfs_btree_block *block) 730 struct xfs_btree_block *block)
731{ 731{
732 int rval = 0; 732 int rval = 0;
733 xfs_fsblock_t left = be64_to_cpu(block->bb_u.l.bb_leftsib); 733 xfs_dfsbno_t left = be64_to_cpu(block->bb_u.l.bb_leftsib);
734 xfs_fsblock_t right = be64_to_cpu(block->bb_u.l.bb_rightsib); 734 xfs_dfsbno_t right = be64_to_cpu(block->bb_u.l.bb_rightsib);
735 735
736 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) { 736 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) {
737 xfs_btree_reada_bufl(cur->bc_mp, left, 1); 737 xfs_btree_reada_bufl(cur->bc_mp, left, 1);
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index e2fa0a1d8e96..e1f0a06aaf04 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -517,9 +517,9 @@ xfs_dir2_block_getdents(
517 /* 517 /*
518 * If it didn't fit, set the final offset to here & return. 518 * If it didn't fit, set the final offset to here & return.
519 */ 519 */
520 if (filldir(dirent, dep->name, dep->namelen, cook, 520 if (filldir(dirent, dep->name, dep->namelen, cook & 0x7fffffff,
521 ino, DT_UNKNOWN)) { 521 ino, DT_UNKNOWN)) {
522 *offset = cook; 522 *offset = cook & 0x7fffffff;
523 xfs_da_brelse(NULL, bp); 523 xfs_da_brelse(NULL, bp);
524 return 0; 524 return 0;
525 } 525 }
@@ -529,7 +529,8 @@ xfs_dir2_block_getdents(
529 * Reached the end of the block. 529 * Reached the end of the block.
530 * Set the offset to a non-existent block 1 and return. 530 * Set the offset to a non-existent block 1 and return.
531 */ 531 */
532 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0); 532 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
533 0x7fffffff;
533 xfs_da_brelse(NULL, bp); 534 xfs_da_brelse(NULL, bp);
534 return 0; 535 return 0;
535} 536}
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 93535992cb60..ef805a374eec 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -1092,7 +1092,7 @@ xfs_dir2_leaf_getdents(
1092 * Won't fit. Return to caller. 1092 * Won't fit. Return to caller.
1093 */ 1093 */
1094 if (filldir(dirent, dep->name, dep->namelen, 1094 if (filldir(dirent, dep->name, dep->namelen,
1095 xfs_dir2_byte_to_dataptr(mp, curoff), 1095 xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff,
1096 ino, DT_UNKNOWN)) 1096 ino, DT_UNKNOWN))
1097 break; 1097 break;
1098 1098
@@ -1108,9 +1108,9 @@ xfs_dir2_leaf_getdents(
1108 * All done. Set output offset value to current offset. 1108 * All done. Set output offset value to current offset.
1109 */ 1109 */
1110 if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR)) 1110 if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR))
1111 *offset = XFS_DIR2_MAX_DATAPTR; 1111 *offset = XFS_DIR2_MAX_DATAPTR & 0x7fffffff;
1112 else 1112 else
1113 *offset = xfs_dir2_byte_to_dataptr(mp, curoff); 1113 *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff;
1114 kmem_free(map); 1114 kmem_free(map);
1115 if (bp) 1115 if (bp)
1116 xfs_da_brelse(NULL, bp); 1116 xfs_da_brelse(NULL, bp);
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index b46af0013ec9..a8a8a6efad5b 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -752,8 +752,8 @@ xfs_dir2_sf_getdents(
752#if XFS_BIG_INUMS 752#if XFS_BIG_INUMS
753 ino += mp->m_inoadd; 753 ino += mp->m_inoadd;
754#endif 754#endif
755 if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) { 755 if (filldir(dirent, ".", 1, dot_offset & 0x7fffffff, ino, DT_DIR)) {
756 *offset = dot_offset; 756 *offset = dot_offset & 0x7fffffff;
757 return 0; 757 return 0;
758 } 758 }
759 } 759 }
@@ -766,8 +766,8 @@ xfs_dir2_sf_getdents(
766#if XFS_BIG_INUMS 766#if XFS_BIG_INUMS
767 ino += mp->m_inoadd; 767 ino += mp->m_inoadd;
768#endif 768#endif
769 if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) { 769 if (filldir(dirent, "..", 2, dotdot_offset & 0x7fffffff, ino, DT_DIR)) {
770 *offset = dotdot_offset; 770 *offset = dotdot_offset & 0x7fffffff;
771 return 0; 771 return 0;
772 } 772 }
773 } 773 }
@@ -791,14 +791,15 @@ xfs_dir2_sf_getdents(
791#endif 791#endif
792 792
793 if (filldir(dirent, sfep->name, sfep->namelen, 793 if (filldir(dirent, sfep->name, sfep->namelen,
794 off, ino, DT_UNKNOWN)) { 794 off & 0x7fffffff, ino, DT_UNKNOWN)) {
795 *offset = off; 795 *offset = off & 0x7fffffff;
796 return 0; 796 return 0;
797 } 797 }
798 sfep = xfs_dir2_sf_nextentry(sfp, sfep); 798 sfep = xfs_dir2_sf_nextentry(sfp, sfep);
799 } 799 }
800 800
801 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0); 801 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
802 0x7fffffff;
802 return 0; 803 return 0;
803} 804}
804 805
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index 0f5191644ab2..b2f724502f1b 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -45,7 +45,7 @@ typedef __uint32_t prid_t; /* project ID */
45typedef __uint32_t inst_t; /* an instruction */ 45typedef __uint32_t inst_t; /* an instruction */
46 46
47typedef __s64 xfs_off_t; /* <file offset> type */ 47typedef __s64 xfs_off_t; /* <file offset> type */
48typedef __u64 xfs_ino_t; /* <inode> type */ 48typedef unsigned long long xfs_ino_t; /* <inode> type */
49typedef __s64 xfs_daddr_t; /* <disk address> type */ 49typedef __s64 xfs_daddr_t; /* <disk address> type */
50typedef char * xfs_caddr_t; /* <core address> type */ 50typedef char * xfs_caddr_t; /* <core address> type */
51typedef __u32 xfs_dev_t; 51typedef __u32 xfs_dev_t;
@@ -111,8 +111,6 @@ typedef __uint64_t xfs_fileoff_t; /* block number in a file */
111typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ 111typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
112typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ 112typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
113 113
114typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */
115
116/* 114/*
117 * Null values for the types. 115 * Null values for the types.
118 */ 116 */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 813e4b6c2c0d..bf8d4cfd8cf5 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -245,7 +245,7 @@ struct acpi_table_fadt {
245#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */ 245#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */
246#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */ 246#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */
247#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */ 247#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */
248#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup stat not possible from S4 */ 248#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup possible from S4 */
249#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */ 249#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */
250#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */ 250#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */
251#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */ 251#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index 1f44e7c76995..0f8956def738 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -3,4 +3,3 @@ include include/asm-generic/Kbuild.asm
3header-y += registers.h 3header-y += registers.h
4 4
5unifdef-y += termios.h 5unifdef-y += termios.h
6unifdef-y += swab.h
diff --git a/include/asm-frv/byteorder.h b/include/asm-frv/byteorder.h
index 1187e51ecd13..f29b7593e088 100644
--- a/include/asm-frv/byteorder.h
+++ b/include/asm-frv/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_BYTEORDER_H 1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H 2#define _ASM_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _ASM_BYTEORDER_H */ 6#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 1870d5e05f1c..70d185534b9d 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -31,6 +31,7 @@ unifdef-y += socket.h
31unifdef-y += sockios.h 31unifdef-y += sockios.h
32unifdef-y += stat.h 32unifdef-y += stat.h
33unifdef-y += statfs.h 33unifdef-y += statfs.h
34unifdef-y += swab.h
34unifdef-y += termbits.h 35unifdef-y += termbits.h
35unifdef-y += termios.h 36unifdef-y += termios.h
36unifdef-y += types.h 37unifdef-y += types.h
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index 89061c1a67d4..763e3b060f43 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -42,7 +42,7 @@ static inline unsigned char rtc_is_updating(void)
42 return uip; 42 return uip;
43} 43}
44 44
45static inline unsigned int get_rtc_time(struct rtc_time *time) 45static inline unsigned int __get_rtc_time(struct rtc_time *time)
46{ 46{
47 unsigned char ctrl; 47 unsigned char ctrl;
48 unsigned long flags; 48 unsigned long flags;
@@ -108,8 +108,12 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
108 return RTC_24H; 108 return RTC_24H;
109} 109}
110 110
111#ifndef get_rtc_time
112#define get_rtc_time __get_rtc_time
113#endif
114
111/* Set the current date and time in the real time clock. */ 115/* Set the current date and time in the real time clock. */
112static inline int set_rtc_time(struct rtc_time *time) 116static inline int __set_rtc_time(struct rtc_time *time)
113{ 117{
114 unsigned long flags; 118 unsigned long flags;
115 unsigned char mon, day, hrs, min, sec; 119 unsigned char mon, day, hrs, min, sec;
@@ -190,11 +194,15 @@ static inline int set_rtc_time(struct rtc_time *time)
190 return 0; 194 return 0;
191} 195}
192 196
197#ifndef set_rtc_time
198#define set_rtc_time __set_rtc_time
199#endif
200
193static inline unsigned int get_rtc_ss(void) 201static inline unsigned int get_rtc_ss(void)
194{ 202{
195 struct rtc_time h; 203 struct rtc_time h;
196 204
197 get_rtc_time(&h); 205 __get_rtc_time(&h);
198 return h.tm_sec; 206 return h.tm_sec;
199} 207}
200 208
diff --git a/include/asm-m32r/Kbuild b/include/asm-m32r/Kbuild
index 27b108a86b39..c68e1680da01 100644
--- a/include/asm-m32r/Kbuild
+++ b/include/asm-m32r/Kbuild
@@ -1,2 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h
index 61ff9cfd8451..21855d8b028b 100644
--- a/include/asm-m32r/byteorder.h
+++ b/include/asm-m32r/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_BYTEORDER_H 1#ifndef _ASM_M32R_BYTEORDER_H
2#define _ASM_M32R_BYTEORDER_H 2#define _ASM_M32R_BYTEORDER_H
3 3
4#include <asm/swab.h>
5
6#if defined(__LITTLE_ENDIAN__) 4#if defined(__LITTLE_ENDIAN__)
7# include <linux/byteorder/little_endian.h> 5# include <linux/byteorder/little_endian.h>
8#else 6#else
diff --git a/include/asm-m68k/Kbuild b/include/asm-m68k/Kbuild
index 52fd96b4142a..1a922fad76f7 100644
--- a/include/asm-m68k/Kbuild
+++ b/include/asm-m68k/Kbuild
@@ -1,3 +1,2 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2header-y += cachectl.h 2header-y += cachectl.h
3unifdef-y += swab.h
diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h
index 300866523b86..31b260a88803 100644
--- a/include/asm-m68k/byteorder.h
+++ b/include/asm-m68k/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _M68K_BYTEORDER_H 1#ifndef _M68K_BYTEORDER_H
2#define _M68K_BYTEORDER_H 2#define _M68K_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _M68K_BYTEORDER_H */ 6#endif /* _M68K_BYTEORDER_H */
diff --git a/include/asm-mn10300/Kbuild b/include/asm-mn10300/Kbuild
index 27b108a86b39..c68e1680da01 100644
--- a/include/asm-mn10300/Kbuild
+++ b/include/asm-mn10300/Kbuild
@@ -1,2 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/include/asm-mn10300/byteorder.h b/include/asm-mn10300/byteorder.h
index 45b18ded19e6..5dd0bdd9feee 100644
--- a/include/asm-mn10300/byteorder.h
+++ b/include/asm-mn10300/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_BYTEORDER_H 1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H 2#define _ASM_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ASM_BYTEORDER_H */ 6#endif /* _ASM_BYTEORDER_H */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 0acb07f31fa4..47809ac94bc3 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -395,7 +395,7 @@ struct drm_connector_funcs {
395 void (*save)(struct drm_connector *connector); 395 void (*save)(struct drm_connector *connector);
396 void (*restore)(struct drm_connector *connector); 396 void (*restore)(struct drm_connector *connector);
397 enum drm_connector_status (*detect)(struct drm_connector *connector); 397 enum drm_connector_status (*detect)(struct drm_connector *connector);
398 void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); 398 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
399 int (*set_property)(struct drm_connector *connector, struct drm_property *property, 399 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
400 uint64_t val); 400 uint64_t val);
401 void (*destroy)(struct drm_connector *connector); 401 void (*destroy)(struct drm_connector *connector);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 4bc04cf460a7..0c6f0e11b41b 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -88,7 +88,7 @@ struct drm_connector_helper_funcs {
88 struct drm_encoder *(*best_encoder)(struct drm_connector *connector); 88 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
89}; 89};
90 90
91extern void drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 91extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
92extern void drm_helper_disable_unused_functions(struct drm_device *dev); 92extern void drm_helper_disable_unused_functions(struct drm_device *dev);
93extern int drm_helper_hotplug_stage_two(struct drm_device *dev); 93extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
94extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); 94extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow);
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index c8fdb6e658e1..110c600c885f 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -52,7 +52,6 @@
52 52
53#ifndef __KERNEL__ 53#ifndef __KERNEL__
54#include <linux/types.h> 54#include <linux/types.h>
55#include <asm/types.h>
56 55
57struct agp_version { 56struct agp_version {
58 __u16 major; 57 __u16 major;
diff --git a/include/linux/atm_idt77105.h b/include/linux/atm_idt77105.h
index 05621cf20709..8b724000aa50 100644
--- a/include/linux/atm_idt77105.h
+++ b/include/linux/atm_idt77105.h
@@ -7,7 +7,7 @@
7#ifndef LINUX_ATM_IDT77105_H 7#ifndef LINUX_ATM_IDT77105_H
8#define LINUX_ATM_IDT77105_H 8#define LINUX_ATM_IDT77105_H
9 9
10#include <asm/types.h> 10#include <linux/types.h>
11#include <linux/atmioc.h> 11#include <linux/atmioc.h>
12#include <linux/atmdev.h> 12#include <linux/atmdev.h>
13 13
diff --git a/include/linux/capi.h b/include/linux/capi.h
index fdebaaa9f66e..65100d6cb89b 100644
--- a/include/linux/capi.h
+++ b/include/linux/capi.h
@@ -12,7 +12,7 @@
12#ifndef __LINUX_CAPI_H__ 12#ifndef __LINUX_CAPI_H__
13#define __LINUX_CAPI_H__ 13#define __LINUX_CAPI_H__
14 14
15#include <asm/types.h> 15#include <linux/types.h>
16#include <linux/ioctl.h> 16#include <linux/ioctl.h>
17#ifndef __KERNEL__ 17#ifndef __KERNEL__
18#include <linux/kernelcapi.h> 18#include <linux/kernelcapi.h>
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e88f3ecf38b4..3fd2194ff573 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -280,5 +280,18 @@ asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
280asmlinkage long compat_sys_timerfd_gettime(int ufd, 280asmlinkage long compat_sys_timerfd_gettime(int ufd,
281 struct compat_itimerspec __user *otmr); 281 struct compat_itimerspec __user *otmr);
282 282
283asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
284 __u32 __user *pages,
285 const int __user *nodes,
286 int __user *status,
287 int flags);
288asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
289 struct compat_timeval __user *t);
290asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
291 struct compat_stat __user *statbuf,
292 int flag);
293asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
294 int flags, int mode);
295
283#endif /* CONFIG_COMPAT */ 296#endif /* CONFIG_COMPAT */
284#endif /* _LINUX_COMPAT_H */ 297#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 5c7f9468f753..34f2789d9b9b 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -22,7 +22,7 @@
22#ifndef __CONNECTOR_H 22#ifndef __CONNECTOR_H
23#define __CONNECTOR_H 23#define __CONNECTOR_H
24 24
25#include <asm/types.h> 25#include <linux/types.h>
26 26
27#define CN_IDX_CONNECTOR 0xffffffff 27#define CN_IDX_CONNECTOR 0xffffffff
28#define CN_VAL_CONNECTOR 0xffffffff 28#define CN_VAL_CONNECTOR 0xffffffff
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 2d3d1e04ba92..d06fbf286346 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -150,8 +150,6 @@ struct CYZ_BOOT_CTRL {
150 * architectures and compilers. 150 * architectures and compilers.
151 */ 151 */
152 152
153#include <asm/types.h>
154
155typedef __u64 ucdouble; /* 64 bits, unsigned */ 153typedef __u64 ucdouble; /* 64 bits, unsigned */
156typedef __u32 uclong; /* 32 bits, unsigned */ 154typedef __u32 uclong; /* 32 bits, unsigned */
157typedef __u16 ucshort; /* 16 bits, unsigned */ 155typedef __u16 ucshort; /* 16 bits, unsigned */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1ee63df5be92..818fe21257e8 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_FB_H 1#ifndef _LINUX_FB_H
2#define _LINUX_FB_H 2#define _LINUX_FB_H
3 3
4#include <asm/types.h> 4#include <linux/types.h>
5#include <linux/i2c.h> 5#include <linux/i2c.h>
6 6
7struct dentry; 7struct dentry;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3644f6323384..194da5a4b0d6 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -871,7 +871,7 @@ struct ide_host {
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 871 ide_hwif_t *cur_port; /* for hosts requiring serialization */
872 872
873 /* used for hosts requiring serialization */ 873 /* used for hosts requiring serialization */
874 volatile long host_busy; 874 volatile unsigned long host_busy;
875}; 875};
876 876
877#define IDE_HOST_BUSY 0 877#define IDE_HOST_BUSY 0
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index a7d6a2234b31..c7a66882b6d0 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -15,7 +15,7 @@
15#ifndef __LINUX_IF_PPPOL2TP_H 15#ifndef __LINUX_IF_PPPOL2TP_H
16#define __LINUX_IF_PPPOL2TP_H 16#define __LINUX_IF_PPPOL2TP_H
17 17
18#include <asm/types.h> 18#include <linux/types.h>
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/in.h> 21#include <linux/in.h>
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 6fb7f1788570..30c88b2245ff 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -17,7 +17,7 @@
17#define __LINUX_IF_PPPOX_H 17#define __LINUX_IF_PPPOX_H
18 18
19 19
20#include <asm/types.h> 20#include <linux/types.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22 22
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
diff --git a/include/linux/input.h b/include/linux/input.h
index 9a6355f74db2..1249a0c20a38 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -16,7 +16,7 @@
16#include <sys/time.h> 16#include <sys/time.h>
17#include <sys/ioctl.h> 17#include <sys/ioctl.h>
18#include <sys/types.h> 18#include <sys/types.h>
19#include <asm/types.h> 19#include <linux/types.h>
20#endif 20#endif
21 21
22/* 22/*
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index f6bb2ca8e3ba..32e4b2f72294 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -143,7 +143,8 @@ static inline unsigned long resource_type(struct resource *res)
143 143
144extern struct resource * __request_region(struct resource *, 144extern struct resource * __request_region(struct resource *,
145 resource_size_t start, 145 resource_size_t start,
146 resource_size_t n, const char *name, int relaxed); 146 resource_size_t n,
147 const char *name, int flags);
147 148
148/* Compatibility cruft */ 149/* Compatibility cruft */
149#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 150#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 6384b19efe64..64246dce5663 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -614,6 +614,8 @@ struct transaction_s
614 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 614 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
615 * number that will fit in j_blocksize 615 * number that will fit in j_blocksize
616 * @j_last_sync_writer: most recent pid which did a synchronous write 616 * @j_last_sync_writer: most recent pid which did a synchronous write
617 * @j_average_commit_time: the average amount of time in nanoseconds it
618 * takes to commit a transaction to the disk.
617 * @j_private: An opaque pointer to fs-private information. 619 * @j_private: An opaque pointer to fs-private information.
618 */ 620 */
619 621
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index b5e051295a67..9e20c29c1e14 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -27,7 +27,7 @@
27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic 27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
28 */ 28 */
29 29
30#include <asm/types.h> 30#include <linux/types.h>
31#include <linux/input.h> 31#include <linux/input.h>
32 32
33/* 33/*
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 35525ac63337..5715f1907601 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -7,7 +7,7 @@
7 * Note: you must update KVM_API_VERSION if you change this interface. 7 * Note: you must update KVM_API_VERSION if you change this interface.
8 */ 8 */
9 9
10#include <asm/types.h> 10#include <linux/types.h>
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/ioctl.h> 12#include <linux/ioctl.h>
13#include <asm/kvm.h> 13#include <asm/kvm.h>
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b6b8a7f3ec66..2c6bd66209ff 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -401,12 +401,14 @@ enum {
401 ATA_TIMING_CYC8B, 401 ATA_TIMING_CYC8B,
402 ATA_TIMING_ACTIVE = (1 << 4), 402 ATA_TIMING_ACTIVE = (1 << 4),
403 ATA_TIMING_RECOVER = (1 << 5), 403 ATA_TIMING_RECOVER = (1 << 5),
404 ATA_TIMING_CYCLE = (1 << 6), 404 ATA_TIMING_DMACK_HOLD = (1 << 6),
405 ATA_TIMING_UDMA = (1 << 7), 405 ATA_TIMING_CYCLE = (1 << 7),
406 ATA_TIMING_UDMA = (1 << 8),
406 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | 407 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
407 ATA_TIMING_REC8B | ATA_TIMING_CYC8B | 408 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
408 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | 409 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
409 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 410 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE |
411 ATA_TIMING_UDMA,
410}; 412};
411 413
412enum ata_xfer_mask { 414enum ata_xfer_mask {
@@ -866,6 +868,7 @@ struct ata_timing {
866 unsigned short cyc8b; /* t0 for 8-bit I/O */ 868 unsigned short cyc8b; /* t0 for 8-bit I/O */
867 unsigned short active; /* t2 or tD */ 869 unsigned short active; /* t2 or tD */
868 unsigned short recover; /* t2i or tK */ 870 unsigned short recover; /* t2i or tK */
871 unsigned short dmack_hold; /* tj */
869 unsigned short cycle; /* t0 */ 872 unsigned short cycle; /* t0 */
870 unsigned short udma; /* t2CYCTYP/2 */ 873 unsigned short udma; /* t2CYCTYP/2 */
871}; 874};
@@ -927,6 +930,8 @@ extern void ata_host_init(struct ata_host *, struct device *,
927extern int ata_scsi_detect(struct scsi_host_template *sht); 930extern int ata_scsi_detect(struct scsi_host_template *sht);
928extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 931extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
929extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 932extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
933extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
934 int cmd, void __user *arg);
930extern void ata_sas_port_destroy(struct ata_port *); 935extern void ata_sas_port_destroy(struct ata_port *);
931extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 936extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
932 struct ata_port_info *, struct Scsi_Host *); 937 struct ata_port_info *, struct Scsi_Host *);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 46169a7b559b..6ffd6db5bb0d 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -80,7 +80,7 @@ enum {
80}; 80};
81 81
82#include <asm/posix_types.h> /* for __kernel_old_dev_t */ 82#include <asm/posix_types.h> /* for __kernel_old_dev_t */
83#include <asm/types.h> /* for __u64 */ 83#include <linux/types.h> /* for __u64 */
84 84
85/* Backwards compatibility version */ 85/* Backwards compatibility version */
86struct loop_info { 86struct loop_info {
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 439f6f3cb0c4..0b4df7eba852 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -10,11 +10,13 @@
10#define SYSFS_MAGIC 0x62656572 10#define SYSFS_MAGIC 0x62656572
11#define SECURITYFS_MAGIC 0x73636673 11#define SECURITYFS_MAGIC 0x73636673
12#define TMPFS_MAGIC 0x01021994 12#define TMPFS_MAGIC 0x01021994
13#define SQUASHFS_MAGIC 0x73717368
13#define EFS_SUPER_MAGIC 0x414A53 14#define EFS_SUPER_MAGIC 0x414A53
14#define EXT2_SUPER_MAGIC 0xEF53 15#define EXT2_SUPER_MAGIC 0xEF53
15#define EXT3_SUPER_MAGIC 0xEF53 16#define EXT3_SUPER_MAGIC 0xEF53
16#define XENFS_SUPER_MAGIC 0xabba1974 17#define XENFS_SUPER_MAGIC 0xabba1974
17#define EXT4_SUPER_MAGIC 0xEF53 18#define EXT4_SUPER_MAGIC 0xEF53
19#define BTRFS_SUPER_MAGIC 0x9123683E
18#define HPFS_SUPER_MAGIC 0xf995e849 20#define HPFS_SUPER_MAGIC 0xf995e849
19#define ISOFS_SUPER_MAGIC 0x9660 21#define ISOFS_SUPER_MAGIC 0x9660
20#define JFFS2_SUPER_MAGIC 0x72b6 22#define JFFS2_SUPER_MAGIC 0x72b6
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index ae5b09493062..404f678e734b 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -2,7 +2,7 @@
2#define __LINUX_MATROXFB_H__ 2#define __LINUX_MATROXFB_H__
3 3
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5#include <asm/types.h> 5#include <linux/types.h>
6#include <linux/videodev2.h> 6#include <linux/videodev2.h>
7 7
8struct matroxioc_output_mode { 8struct matroxioc_output_mode {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b91a73fd1bcc..e8ddc98b8405 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -260,7 +260,6 @@ static inline int put_page_testzero(struct page *page)
260 */ 260 */
261static inline int get_page_unless_zero(struct page *page) 261static inline int get_page_unless_zero(struct page *page)
262{ 262{
263 VM_BUG_ON(PageTail(page));
264 return atomic_inc_not_zero(&page->_count); 263 return atomic_inc_not_zero(&page->_count);
265} 264}
266 265
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f24556813375..ec54785d34f9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -467,7 +467,7 @@ struct netdev_queue {
467 * This function is called when network device transistions to the down 467 * This function is called when network device transistions to the down
468 * state. 468 * state.
469 * 469 *
470 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); 470 * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev);
471 * Called when a packet needs to be transmitted. 471 * Called when a packet needs to be transmitted.
472 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, 472 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
473 * Required can not be NULL. 473 * Required can not be NULL.
@@ -795,6 +795,7 @@ struct net_device
795 NETREG_UNREGISTERING, /* called unregister_netdevice */ 795 NETREG_UNREGISTERING, /* called unregister_netdevice */
796 NETREG_UNREGISTERED, /* completed unregister todo */ 796 NETREG_UNREGISTERED, /* completed unregister todo */
797 NETREG_RELEASED, /* called free_netdev */ 797 NETREG_RELEASED, /* called free_netdev */
798 NETREG_DUMMY, /* dummy device for NAPI poll */
798 } reg_state; 799 } reg_state;
799 800
800 /* Called from unregister, can be used to call free_netdev */ 801 /* Called from unregister, can be used to call free_netdev */
@@ -1077,6 +1078,8 @@ extern void free_netdev(struct net_device *dev);
1077extern void synchronize_net(void); 1078extern void synchronize_net(void);
1078extern int register_netdevice_notifier(struct notifier_block *nb); 1079extern int register_netdevice_notifier(struct notifier_block *nb);
1079extern int unregister_netdevice_notifier(struct notifier_block *nb); 1080extern int unregister_netdevice_notifier(struct notifier_block *nb);
1081extern int init_dummy_netdev(struct net_device *dev);
1082
1080extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1083extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1081extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1084extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
1082extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1085extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index e52ce475d19f..c7ee8744d26b 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -270,6 +270,7 @@ struct xt_match
270 struct list_head list; 270 struct list_head list;
271 271
272 const char name[XT_FUNCTION_MAXNAMELEN-1]; 272 const char name[XT_FUNCTION_MAXNAMELEN-1];
273 u_int8_t revision;
273 274
274 /* Return true or false: return FALSE and set *hotdrop = 1 to 275 /* Return true or false: return FALSE and set *hotdrop = 1 to
275 force immediate packet drop. */ 276 force immediate packet drop. */
@@ -302,7 +303,6 @@ struct xt_match
302 unsigned short proto; 303 unsigned short proto;
303 304
304 unsigned short family; 305 unsigned short family;
305 u_int8_t revision;
306}; 306};
307 307
308/* Registration hooks for targets. */ 308/* Registration hooks for targets. */
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index bd2a870ec296..34974b5a76f7 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -17,4 +17,7 @@
17void of_register_i2c_devices(struct i2c_adapter *adap, 17void of_register_i2c_devices(struct i2c_adapter *adap,
18 struct device_node *adap_node); 18 struct device_node *adap_node);
19 19
20/* must call put_device() when done with returned i2c_client device */
21struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22
20#endif /* __LINUX_OF_I2C_H */ 23#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d543365518ab..d56ad9c21c09 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2174,6 +2174,7 @@
2174#define PCI_DEVICE_ID_RDC_R6040 0x6040 2174#define PCI_DEVICE_ID_RDC_R6040 0x6040
2175#define PCI_DEVICE_ID_RDC_R6060 0x6060 2175#define PCI_DEVICE_ID_RDC_R6060 0x6060
2176#define PCI_DEVICE_ID_RDC_R6061 0x6061 2176#define PCI_DEVICE_ID_RDC_R6061 0x6061
2177#define PCI_DEVICE_ID_RDC_D1010 0x1010
2177 2178
2178#define PCI_VENDOR_ID_LENOVO 0x17aa 2179#define PCI_VENDOR_ID_LENOVO 0x17aa
2179 2180
diff --git a/include/linux/phantom.h b/include/linux/phantom.h
index 02268c54c250..94dd6645c60a 100644
--- a/include/linux/phantom.h
+++ b/include/linux/phantom.h
@@ -10,7 +10,7 @@
10#ifndef __PHANTOM_H 10#ifndef __PHANTOM_H
11#define __PHANTOM_H 11#define __PHANTOM_H
12 12
13#include <asm/types.h> 13#include <linux/types.h>
14 14
15/* PHN_(G/S)ET_REG param */ 15/* PHN_(G/S)ET_REG param */
16struct phm_reg { 16struct phm_reg {
diff --git a/include/linux/radeonfb.h b/include/linux/radeonfb.h
index 5bd8975ed78e..8c4bbdecc44f 100644
--- a/include/linux/radeonfb.h
+++ b/include/linux/radeonfb.h
@@ -2,7 +2,7 @@
2#define __LINUX_RADEONFB_H__ 2#define __LINUX_RADEONFB_H__
3 3
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5#include <asm/types.h> 5#include <linux/types.h>
6 6
7#define ATY_RADEON_LCD_ON 0x00000001 7#define ATY_RADEON_LCD_ON 0x00000001
8#define ATY_RADEON_CRT_ON 0x00000002 8#define ATY_RADEON_CRT_ON 0x00000002
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index dede0a2cfc45..4c5bcf6ca7e8 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Pavel Emelianov <xemul@openvz.org> 10 * Author: Pavel Emelianov <xemul@openvz.org>
11 * 11 *
12 * See Documentation/controllers/resource_counter.txt for more 12 * See Documentation/cgroups/resource_counter.txt for more
13 * info about what this counter is. 13 * info about what this counter is.
14 */ 14 */
15 15
diff --git a/include/linux/swab.h b/include/linux/swab.h
index be5284d4a053..ea0c02fd5163 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <asm/byteorder.h> 6#include <asm/swab.h>
7 7
8/* 8/*
9 * casts are necessary for constants, because we never know how for sure 9 * casts are necessary for constants, because we never know how for sure
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a1d177ce0a08..fc81937009f5 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -54,6 +54,7 @@ struct compat_stat;
54struct compat_timeval; 54struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache; 56struct getcpu_cache;
57struct old_linux_dirent;
57struct perf_counter_hw_event; 58struct perf_counter_hw_event;
58 59
59#include <linux/types.h> 60#include <linux/types.h>
@@ -66,6 +67,74 @@ struct perf_counter_hw_event;
66#include <linux/quota.h> 67#include <linux/quota.h>
67#include <linux/key.h> 68#include <linux/key.h>
68 69
70#define __SC_DECL1(t1, a1) t1 a1
71#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__)
72#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__)
73#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__)
74#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__)
75#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__)
76
77#define __SC_LONG1(t1, a1) long a1
78#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__)
79#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__)
80#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__)
81#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__)
82#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__)
83
84#define __SC_CAST1(t1, a1) (t1) a1
85#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__)
86#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__)
87#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__)
88#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__)
89#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__)
90
91#define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long))
92#define __SC_TEST1(t1, a1) __SC_TEST(t1)
93#define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__)
94#define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__)
95#define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__)
96#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
97#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
98
99#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
100#define SYSCALL_DEFINE1(...) SYSCALL_DEFINEx(1, __VA_ARGS__)
101#define SYSCALL_DEFINE2(...) SYSCALL_DEFINEx(2, __VA_ARGS__)
102#define SYSCALL_DEFINE3(...) SYSCALL_DEFINEx(3, __VA_ARGS__)
103#define SYSCALL_DEFINE4(...) SYSCALL_DEFINEx(4, __VA_ARGS__)
104#define SYSCALL_DEFINE5(...) SYSCALL_DEFINEx(5, __VA_ARGS__)
105#define SYSCALL_DEFINE6(...) SYSCALL_DEFINEx(6, __VA_ARGS__)
106
107#ifdef CONFIG_PPC64
108#define SYSCALL_ALIAS(alias, name) \
109 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
110 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
111#else
112#define SYSCALL_ALIAS(alias, name) \
113 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
114#endif
115
116#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
117
118#define SYSCALL_DEFINE(name) static inline long SYSC_##name
119#define SYSCALL_DEFINEx(x, name, ...) \
120 asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__)); \
121 static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__)); \
122 asmlinkage long SyS_##name(__SC_LONG##x(__VA_ARGS__)) \
123 { \
124 __SC_TEST##x(__VA_ARGS__); \
125 return (long) SYSC_##name(__SC_CAST##x(__VA_ARGS__)); \
126 } \
127 SYSCALL_ALIAS(sys_##name, SyS_##name); \
128 static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__))
129
130#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
131
132#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
133#define SYSCALL_DEFINEx(x, name, ...) \
134 asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__))
135
136#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
137
69asmlinkage long sys_time(time_t __user *tloc); 138asmlinkage long sys_time(time_t __user *tloc);
70asmlinkage long sys_stime(time_t __user *tptr); 139asmlinkage long sys_stime(time_t __user *tptr);
71asmlinkage long sys_gettimeofday(struct timeval __user *tv, 140asmlinkage long sys_gettimeofday(struct timeval __user *tv,
@@ -78,7 +147,7 @@ asmlinkage long sys_times(struct tms __user *tbuf);
78 147
79asmlinkage long sys_gettid(void); 148asmlinkage long sys_gettid(void);
80asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); 149asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp);
81asmlinkage unsigned long sys_alarm(unsigned int seconds); 150asmlinkage long sys_alarm(unsigned int seconds);
82asmlinkage long sys_getpid(void); 151asmlinkage long sys_getpid(void);
83asmlinkage long sys_getppid(void); 152asmlinkage long sys_getppid(void);
84asmlinkage long sys_getuid(void); 153asmlinkage long sys_getuid(void);
@@ -167,7 +236,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
167 unsigned long flags); 236 unsigned long flags);
168 237
169asmlinkage long sys_exit(int error_code); 238asmlinkage long sys_exit(int error_code);
170asmlinkage void sys_exit_group(int error_code); 239asmlinkage long sys_exit_group(int error_code);
171asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, 240asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
172 int options, struct rusage __user *ru); 241 int options, struct rusage __user *ru);
173asmlinkage long sys_waitid(int which, pid_t pid, 242asmlinkage long sys_waitid(int which, pid_t pid,
@@ -197,7 +266,7 @@ asmlinkage long sys_tkill(int pid, int sig);
197asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo); 266asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo);
198asmlinkage long sys_sgetmask(void); 267asmlinkage long sys_sgetmask(void);
199asmlinkage long sys_ssetmask(int newmask); 268asmlinkage long sys_ssetmask(int newmask);
200asmlinkage unsigned long sys_signal(int sig, __sighandler_t handler); 269asmlinkage long sys_signal(int sig, __sighandler_t handler);
201asmlinkage long sys_pause(void); 270asmlinkage long sys_pause(void);
202 271
203asmlinkage long sys_sync(void); 272asmlinkage long sys_sync(void);
@@ -247,29 +316,29 @@ asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
247 const void __user *value, size_t size, int flags); 316 const void __user *value, size_t size, int flags);
248asmlinkage long sys_fsetxattr(int fd, const char __user *name, 317asmlinkage long sys_fsetxattr(int fd, const char __user *name,
249 const void __user *value, size_t size, int flags); 318 const void __user *value, size_t size, int flags);
250asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name, 319asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
251 void __user *value, size_t size); 320 void __user *value, size_t size);
252asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name, 321asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
253 void __user *value, size_t size); 322 void __user *value, size_t size);
254asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name, 323asmlinkage long sys_fgetxattr(int fd, const char __user *name,
255 void __user *value, size_t size); 324 void __user *value, size_t size);
256asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list, 325asmlinkage long sys_listxattr(const char __user *path, char __user *list,
257 size_t size); 326 size_t size);
258asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list, 327asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
259 size_t size); 328 size_t size);
260asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); 329asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
261asmlinkage long sys_removexattr(const char __user *path, 330asmlinkage long sys_removexattr(const char __user *path,
262 const char __user *name); 331 const char __user *name);
263asmlinkage long sys_lremovexattr(const char __user *path, 332asmlinkage long sys_lremovexattr(const char __user *path,
264 const char __user *name); 333 const char __user *name);
265asmlinkage long sys_fremovexattr(int fd, const char __user *name); 334asmlinkage long sys_fremovexattr(int fd, const char __user *name);
266 335
267asmlinkage unsigned long sys_brk(unsigned long brk); 336asmlinkage long sys_brk(unsigned long brk);
268asmlinkage long sys_mprotect(unsigned long start, size_t len, 337asmlinkage long sys_mprotect(unsigned long start, size_t len,
269 unsigned long prot); 338 unsigned long prot);
270asmlinkage unsigned long sys_mremap(unsigned long addr, 339asmlinkage long sys_mremap(unsigned long addr,
271 unsigned long old_len, unsigned long new_len, 340 unsigned long old_len, unsigned long new_len,
272 unsigned long flags, unsigned long new_addr); 341 unsigned long flags, unsigned long new_addr);
273asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, 342asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
274 unsigned long prot, unsigned long pgoff, 343 unsigned long prot, unsigned long pgoff,
275 unsigned long flags); 344 unsigned long flags);
@@ -322,10 +391,10 @@ asmlinkage long sys_io_submit(aio_context_t, long,
322 struct iocb __user * __user *); 391 struct iocb __user * __user *);
323asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, 392asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
324 struct io_event __user *result); 393 struct io_event __user *result);
325asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, 394asmlinkage long sys_sendfile(int out_fd, int in_fd,
326 off_t __user *offset, size_t count); 395 off_t __user *offset, size_t count);
327asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, 396asmlinkage long sys_sendfile64(int out_fd, int in_fd,
328 loff_t __user *offset, size_t count); 397 loff_t __user *offset, size_t count);
329asmlinkage long sys_readlink(const char __user *path, 398asmlinkage long sys_readlink(const char __user *path,
330 char __user *buf, int bufsiz); 399 char __user *buf, int bufsiz);
331asmlinkage long sys_creat(const char __user *pathname, int mode); 400asmlinkage long sys_creat(const char __user *pathname, int mode);
@@ -369,26 +438,25 @@ asmlinkage long sys_utime(char __user *filename,
369 struct utimbuf __user *times); 438 struct utimbuf __user *times);
370asmlinkage long sys_utimes(char __user *filename, 439asmlinkage long sys_utimes(char __user *filename,
371 struct timeval __user *utimes); 440 struct timeval __user *utimes);
372asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, 441asmlinkage long sys_lseek(unsigned int fd, off_t offset,
373 unsigned int origin); 442 unsigned int origin);
374asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 443asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
375 unsigned long offset_low, loff_t __user *result, 444 unsigned long offset_low, loff_t __user *result,
376 unsigned int origin); 445 unsigned int origin);
377asmlinkage ssize_t sys_read(unsigned int fd, char __user *buf, 446asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
378 size_t count); 447asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
379asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); 448asmlinkage long sys_readv(unsigned long fd,
380asmlinkage ssize_t sys_readv(unsigned long fd, 449 const struct iovec __user *vec,
381 const struct iovec __user *vec, 450 unsigned long vlen);
382 unsigned long vlen); 451asmlinkage long sys_write(unsigned int fd, const char __user *buf,
383asmlinkage ssize_t sys_write(unsigned int fd, const char __user *buf, 452 size_t count);
384 size_t count); 453asmlinkage long sys_writev(unsigned long fd,
385asmlinkage ssize_t sys_writev(unsigned long fd, 454 const struct iovec __user *vec,
386 const struct iovec __user *vec, 455 unsigned long vlen);
387 unsigned long vlen); 456asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
388asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, 457 size_t count, loff_t pos);
389 size_t count, loff_t pos); 458asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
390asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, 459 size_t count, loff_t pos);
391 size_t count, loff_t pos);
392asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 460asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
393asmlinkage long sys_mkdir(const char __user *pathname, int mode); 461asmlinkage long sys_mkdir(const char __user *pathname, int mode);
394asmlinkage long sys_chdir(const char __user *filename); 462asmlinkage long sys_chdir(const char __user *filename);
@@ -477,7 +545,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
477asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 545asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
478asmlinkage long sys_mq_unlink(const char __user *name); 546asmlinkage long sys_mq_unlink(const char __user *name);
479asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 547asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
480asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 548asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
481asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); 549asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
482asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); 550asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
483 551
@@ -531,11 +599,6 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
531 const int __user *nodes, 599 const int __user *nodes,
532 int __user *status, 600 int __user *status,
533 int flags); 601 int flags);
534asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
535 __u32 __user *pages,
536 const int __user *nodes,
537 int __user *status,
538 int flags);
539asmlinkage long sys_mbind(unsigned long start, unsigned long len, 602asmlinkage long sys_mbind(unsigned long start, unsigned long len,
540 unsigned long mode, 603 unsigned long mode,
541 unsigned long __user *nmask, 604 unsigned long __user *nmask,
@@ -584,13 +647,6 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *bu
584 int bufsiz); 647 int bufsiz);
585asmlinkage long sys_utimensat(int dfd, char __user *filename, 648asmlinkage long sys_utimensat(int dfd, char __user *filename,
586 struct timespec __user *utimes, int flags); 649 struct timespec __user *utimes, int flags);
587asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
588 struct compat_timeval __user *t);
589asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
590 struct compat_stat __user *statbuf,
591 int flag);
592asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
593 int flags, int mode);
594asmlinkage long sys_unshare(unsigned long unshare_flags); 650asmlinkage long sys_unshare(unsigned long unshare_flags);
595 651
596asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, 652asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
@@ -622,6 +678,15 @@ asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
622asmlinkage long sys_eventfd(unsigned int count); 678asmlinkage long sys_eventfd(unsigned int count);
623asmlinkage long sys_eventfd2(unsigned int count, int flags); 679asmlinkage long sys_eventfd2(unsigned int count, int flags);
624asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 680asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
681asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
682asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
683 fd_set __user *, struct timespec __user *,
684 void __user *);
685asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
686 struct timespec __user *, const sigset_t __user *,
687 size_t);
688asmlinkage long sys_pipe2(int __user *, int);
689asmlinkage long sys_pipe(int __user *);
625 690
626int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 691int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
627 692
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 83e32f6d7859..9e3182e659db 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -39,6 +39,7 @@ struct iscsi_segment {
39 unsigned int total_copied; 39 unsigned int total_copied;
40 40
41 struct hash_desc *hash; 41 struct hash_desc *hash;
42 unsigned char padbuf[ISCSI_PAD_LEN];
42 unsigned char recv_digest[ISCSI_DIGEST_SIZE]; 43 unsigned char recv_digest[ISCSI_DIGEST_SIZE];
43 unsigned char digest[ISCSI_DIGEST_SIZE]; 44 unsigned char digest[ISCSI_DIGEST_SIZE];
44 unsigned int digest_len; 45 unsigned int digest_len;
diff --git a/init/Kconfig b/init/Kconfig
index a588cdc274bc..6af96b7e2238 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -323,26 +323,26 @@ config CGROUP_SCHED
323 This option allows you to create arbitrary task groups 323 This option allows you to create arbitrary task groups
324 using the "cgroup" pseudo filesystem and control 324 using the "cgroup" pseudo filesystem and control
325 the cpu bandwidth allocated to each such task group. 325 the cpu bandwidth allocated to each such task group.
326 Refer to Documentation/cgroups.txt for more information 326 Refer to Documentation/cgroups/cgroups.txt for more
327 on "cgroup" pseudo filesystem. 327 information on "cgroup" pseudo filesystem.
328 328
329endchoice 329endchoice
330 330
331menu "Control Group support" 331menuconfig CGROUPS
332config CGROUPS 332 boolean "Control Group support"
333 bool "Control Group support"
334 help 333 help
335 This option add support for grouping sets of processes together, for 334 This option adds support for grouping sets of processes together, for
336 use with process control subsystems such as Cpusets, CFS, memory 335 use with process control subsystems such as Cpusets, CFS, memory
337 controls or device isolation. 336 controls or device isolation.
338 See 337 See
339 - Documentation/cpusets.txt (Cpusets)
340 - Documentation/scheduler/sched-design-CFS.txt (CFS) 338 - Documentation/scheduler/sched-design-CFS.txt (CFS)
341 - Documentation/cgroups/ (features for grouping, isolation) 339 - Documentation/cgroups/ (features for grouping, isolation
342 - Documentation/controllers/ (features for resource control) 340 and resource control)
343 341
344 Say N if unsure. 342 Say N if unsure.
345 343
344if CGROUPS
345
346config CGROUP_DEBUG 346config CGROUP_DEBUG
347 bool "Example debug cgroup subsystem" 347 bool "Example debug cgroup subsystem"
348 depends on CGROUPS 348 depends on CGROUPS
@@ -350,24 +350,24 @@ config CGROUP_DEBUG
350 help 350 help
351 This option enables a simple cgroup subsystem that 351 This option enables a simple cgroup subsystem that
352 exports useful debugging information about the cgroups 352 exports useful debugging information about the cgroups
353 framework 353 framework.
354 354
355 Say N if unsure 355 Say N if unsure.
356 356
357config CGROUP_NS 357config CGROUP_NS
358 bool "Namespace cgroup subsystem" 358 bool "Namespace cgroup subsystem"
359 depends on CGROUPS 359 depends on CGROUPS
360 help 360 help
361 Provides a simple namespace cgroup subsystem to 361 Provides a simple namespace cgroup subsystem to
362 provide hierarchical naming of sets of namespaces, 362 provide hierarchical naming of sets of namespaces,
363 for instance virtual servers and checkpoint/restart 363 for instance virtual servers and checkpoint/restart
364 jobs. 364 jobs.
365 365
366config CGROUP_FREEZER 366config CGROUP_FREEZER
367 bool "control group freezer subsystem" 367 bool "Freezer cgroup subsystem"
368 depends on CGROUPS 368 depends on CGROUPS
369 help 369 help
370 Provides a way to freeze and unfreeze all tasks in a 370 Provides a way to freeze and unfreeze all tasks in a
371 cgroup. 371 cgroup.
372 372
373config CGROUP_DEVICE 373config CGROUP_DEVICE
@@ -388,18 +388,23 @@ config CPUSETS
388 388
389 Say N if unsure. 389 Say N if unsure.
390 390
391config PROC_PID_CPUSET
392 bool "Include legacy /proc/<pid>/cpuset file"
393 depends on CPUSETS
394 default y
395
391config CGROUP_CPUACCT 396config CGROUP_CPUACCT
392 bool "Simple CPU accounting cgroup subsystem" 397 bool "Simple CPU accounting cgroup subsystem"
393 depends on CGROUPS 398 depends on CGROUPS
394 help 399 help
395 Provides a simple Resource Controller for monitoring the 400 Provides a simple Resource Controller for monitoring the
396 total CPU consumed by the tasks in a cgroup 401 total CPU consumed by the tasks in a cgroup.
397 402
398config RESOURCE_COUNTERS 403config RESOURCE_COUNTERS
399 bool "Resource counters" 404 bool "Resource counters"
400 help 405 help
401 This option enables controller independent resource accounting 406 This option enables controller independent resource accounting
402 infrastructure that works with cgroups 407 infrastructure that works with cgroups.
403 depends on CGROUPS 408 depends on CGROUPS
404 409
405config CGROUP_MEM_RES_CTLR 410config CGROUP_MEM_RES_CTLR
@@ -425,9 +430,6 @@ config CGROUP_MEM_RES_CTLR
425 This config option also selects MM_OWNER config option, which 430 This config option also selects MM_OWNER config option, which
426 could in turn add some fork/exit overhead. 431 could in turn add some fork/exit overhead.
427 432
428config MM_OWNER
429 bool
430
431config CGROUP_MEM_RES_CTLR_SWAP 433config CGROUP_MEM_RES_CTLR_SWAP
432 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)" 434 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)"
433 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL 435 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL
@@ -444,8 +446,10 @@ config CGROUP_MEM_RES_CTLR_SWAP
444 there will be no overhead from this. Even when you set this config=y, 446 there will be no overhead from this. Even when you set this config=y,
445 if boot option "noswapaccount" is set, swap will not be accounted. 447 if boot option "noswapaccount" is set, swap will not be accounted.
446 448
449endif # CGROUPS
447 450
448endmenu 451config MM_OWNER
452 bool
449 453
450config SYSFS_DEPRECATED 454config SYSFS_DEPRECATED
451 bool 455 bool
@@ -483,11 +487,6 @@ config SYSFS_DEPRECATED_V2
483 if the original kernel, that came with your distribution, has 487 if the original kernel, that came with your distribution, has
484 this option set to N. 488 this option set to N.
485 489
486config PROC_PID_CPUSET
487 bool "Include legacy /proc/<pid>/cpuset file"
488 depends on CPUSETS
489 default y
490
491config RELAY 490config RELAY
492 bool "Kernel->user space relay support (formerly relayfs)" 491 bool "Kernel->user space relay support (formerly relayfs)"
493 help 492 help
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 23fdb8492b8e..54b4077fed79 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -650,8 +650,8 @@ static struct file *do_open(struct dentry *dentry, int oflag)
650 return dentry_open(dentry, mqueue_mnt, oflag, cred); 650 return dentry_open(dentry, mqueue_mnt, oflag, cred);
651} 651}
652 652
653asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, 653SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode,
654 struct mq_attr __user *u_attr) 654 struct mq_attr __user *, u_attr)
655{ 655{
656 struct dentry *dentry; 656 struct dentry *dentry;
657 struct file *filp; 657 struct file *filp;
@@ -721,7 +721,7 @@ out_putname:
721 return fd; 721 return fd;
722} 722}
723 723
724asmlinkage long sys_mq_unlink(const char __user *u_name) 724SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
725{ 725{
726 int err; 726 int err;
727 char *name; 727 char *name;
@@ -814,9 +814,9 @@ static inline void pipelined_receive(struct mqueue_inode_info *info)
814 sender->state = STATE_READY; 814 sender->state = STATE_READY;
815} 815}
816 816
817asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, 817SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
818 size_t msg_len, unsigned int msg_prio, 818 size_t, msg_len, unsigned int, msg_prio,
819 const struct timespec __user *u_abs_timeout) 819 const struct timespec __user *, u_abs_timeout)
820{ 820{
821 struct file *filp; 821 struct file *filp;
822 struct inode *inode; 822 struct inode *inode;
@@ -907,9 +907,9 @@ out:
907 return ret; 907 return ret;
908} 908}
909 909
910asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, 910SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
911 size_t msg_len, unsigned int __user *u_msg_prio, 911 size_t, msg_len, unsigned int __user *, u_msg_prio,
912 const struct timespec __user *u_abs_timeout) 912 const struct timespec __user *, u_abs_timeout)
913{ 913{
914 long timeout; 914 long timeout;
915 ssize_t ret; 915 ssize_t ret;
@@ -997,8 +997,8 @@ out:
997 * and he isn't currently owner of notification, will be silently discarded. 997 * and he isn't currently owner of notification, will be silently discarded.
998 * It isn't explicitly defined in the POSIX. 998 * It isn't explicitly defined in the POSIX.
999 */ 999 */
1000asmlinkage long sys_mq_notify(mqd_t mqdes, 1000SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1001 const struct sigevent __user *u_notification) 1001 const struct sigevent __user *, u_notification)
1002{ 1002{
1003 int ret; 1003 int ret;
1004 struct file *filp; 1004 struct file *filp;
@@ -1123,9 +1123,9 @@ out:
1123 return ret; 1123 return ret;
1124} 1124}
1125 1125
1126asmlinkage long sys_mq_getsetattr(mqd_t mqdes, 1126SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1127 const struct mq_attr __user *u_mqstat, 1127 const struct mq_attr __user *, u_mqstat,
1128 struct mq_attr __user *u_omqstat) 1128 struct mq_attr __user *, u_omqstat)
1129{ 1129{
1130 int ret; 1130 int ret;
1131 struct mq_attr mqstat, omqstat; 1131 struct mq_attr mqstat, omqstat;
diff --git a/ipc/msg.c b/ipc/msg.c
index b4eee1c6101d..2ceab7f12fcb 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -309,7 +309,7 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
309 return security_msg_queue_associate(msq, msgflg); 309 return security_msg_queue_associate(msq, msgflg);
310} 310}
311 311
312asmlinkage long sys_msgget(key_t key, int msgflg) 312SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
313{ 313{
314 struct ipc_namespace *ns; 314 struct ipc_namespace *ns;
315 struct ipc_ops msg_ops; 315 struct ipc_ops msg_ops;
@@ -466,7 +466,7 @@ out_up:
466 return err; 466 return err;
467} 467}
468 468
469asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf) 469SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
470{ 470{
471 struct msg_queue *msq; 471 struct msg_queue *msq;
472 int err, version; 472 int err, version;
@@ -723,8 +723,8 @@ out_free:
723 return err; 723 return err;
724} 724}
725 725
726asmlinkage long 726SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
727sys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg) 727 int, msgflg)
728{ 728{
729 long mtype; 729 long mtype;
730 730
@@ -904,8 +904,8 @@ out_unlock:
904 return msgsz; 904 return msgsz;
905} 905}
906 906
907asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz, 907SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
908 long msgtyp, int msgflg) 908 long, msgtyp, int, msgflg)
909{ 909{
910 long err, mtype; 910 long err, mtype;
911 911
diff --git a/ipc/sem.c b/ipc/sem.c
index c68cd3f8f0c9..16a2189e96f9 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -308,7 +308,7 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
308 return 0; 308 return 0;
309} 309}
310 310
311asmlinkage long sys_semget(key_t key, int nsems, int semflg) 311SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
312{ 312{
313 struct ipc_namespace *ns; 313 struct ipc_namespace *ns;
314 struct ipc_ops sem_ops; 314 struct ipc_ops sem_ops;
@@ -887,7 +887,7 @@ out_up:
887 return err; 887 return err;
888} 888}
889 889
890asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg) 890SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
891{ 891{
892 int err = -EINVAL; 892 int err = -EINVAL;
893 int version; 893 int version;
@@ -923,6 +923,13 @@ asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg)
923 return -EINVAL; 923 return -EINVAL;
924 } 924 }
925} 925}
926#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
927asmlinkage long SyS_semctl(int semid, int semnum, int cmd, union semun arg)
928{
929 return SYSC_semctl((int) semid, (int) semnum, (int) cmd, arg);
930}
931SYSCALL_ALIAS(sys_semctl, SyS_semctl);
932#endif
926 933
927/* If the task doesn't already have a undo_list, then allocate one 934/* If the task doesn't already have a undo_list, then allocate one
928 * here. We guarantee there is only one thread using this undo list, 935 * here. We guarantee there is only one thread using this undo list,
@@ -1048,8 +1055,8 @@ out:
1048 return un; 1055 return un;
1049} 1056}
1050 1057
1051asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, 1058SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1052 unsigned nsops, const struct timespec __user *timeout) 1059 unsigned, nsops, const struct timespec __user *, timeout)
1053{ 1060{
1054 int error = -EINVAL; 1061 int error = -EINVAL;
1055 struct sem_array *sma; 1062 struct sem_array *sma;
@@ -1225,7 +1232,8 @@ out_free:
1225 return error; 1232 return error;
1226} 1233}
1227 1234
1228asmlinkage long sys_semop (int semid, struct sembuf __user *tsops, unsigned nsops) 1235SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops,
1236 unsigned, nsops)
1229{ 1237{
1230 return sys_semtimedop(semid, tsops, nsops, NULL); 1238 return sys_semtimedop(semid, tsops, nsops, NULL);
1231} 1239}
diff --git a/ipc/shm.c b/ipc/shm.c
index d0ab5527bf45..a9e09ad2263e 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -440,7 +440,7 @@ static inline int shm_more_checks(struct kern_ipc_perm *ipcp,
440 return 0; 440 return 0;
441} 441}
442 442
443asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) 443SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
444{ 444{
445 struct ipc_namespace *ns; 445 struct ipc_namespace *ns;
446 struct ipc_ops shm_ops; 446 struct ipc_ops shm_ops;
@@ -621,7 +621,7 @@ out_up:
621 return err; 621 return err;
622} 622}
623 623
624asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) 624SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
625{ 625{
626 struct shmid_kernel *shp; 626 struct shmid_kernel *shp;
627 int err, version; 627 int err, version;
@@ -939,7 +939,7 @@ out_put_dentry:
939 goto out_nattch; 939 goto out_nattch;
940} 940}
941 941
942asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg) 942SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
943{ 943{
944 unsigned long ret; 944 unsigned long ret;
945 long err; 945 long err;
@@ -955,7 +955,7 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
955 * detach and kill segment if marked destroyed. 955 * detach and kill segment if marked destroyed.
956 * The work is done in shm_close. 956 * The work is done in shm_close.
957 */ 957 */
958asmlinkage long sys_shmdt(char __user *shmaddr) 958SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
959{ 959{
960 struct mm_struct *mm = current->mm; 960 struct mm_struct *mm = current->mm;
961 struct vm_area_struct *vma, *next; 961 struct vm_area_struct *vma, *next;
diff --git a/kernel/Makefile b/kernel/Makefile
index e4115926c536..5537554ed808 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -40,9 +40,8 @@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
40obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o 40obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
41obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o 41obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
42obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o 42obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
43ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y) 43obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
44obj-y += smp.o 44ifneq ($(CONFIG_SMP),y)
45else
46obj-y += up.o 45obj-y += up.o
47endif 46endif
48obj-$(CONFIG_SMP) += spinlock.o 47obj-$(CONFIG_SMP) += spinlock.o
diff --git a/kernel/acct.c b/kernel/acct.c
index d57b7cbb98b6..7afa31564162 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -277,7 +277,7 @@ static int acct_on(char *name)
277 * should be written. If the filename is NULL, accounting will be 277 * should be written. If the filename is NULL, accounting will be
278 * shutdown. 278 * shutdown.
279 */ 279 */
280asmlinkage long sys_acct(const char __user *name) 280SYSCALL_DEFINE1(acct, const char __user *, name)
281{ 281{
282 int error; 282 int error;
283 283
diff --git a/kernel/capability.c b/kernel/capability.c
index 688926e496be..4e17041963f5 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -161,7 +161,7 @@ static inline int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp,
161 * 161 *
162 * Returns 0 on success and < 0 on error. 162 * Returns 0 on success and < 0 on error.
163 */ 163 */
164asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) 164SYSCALL_DEFINE2(capget, cap_user_header_t, header, cap_user_data_t, dataptr)
165{ 165{
166 int ret = 0; 166 int ret = 0;
167 pid_t pid; 167 pid_t pid;
@@ -235,7 +235,7 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
235 * 235 *
236 * Returns 0 on success and < 0 on error. 236 * Returns 0 on success and < 0 on error.
237 */ 237 */
238asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) 238SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
239{ 239{
240 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S]; 240 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
241 unsigned i, tocopy; 241 unsigned i, tocopy;
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 647c77a88fcb..a85678865c5e 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -568,7 +568,7 @@ update_domain_attr_tree(struct sched_domain_attr *dattr, struct cpuset *c)
568 * load balancing domains (sched domains) as specified by that partial 568 * load balancing domains (sched domains) as specified by that partial
569 * partition. 569 * partition.
570 * 570 *
571 * See "What is sched_load_balance" in Documentation/cpusets.txt 571 * See "What is sched_load_balance" in Documentation/cgroups/cpusets.txt
572 * for a background explanation of this. 572 * for a background explanation of this.
573 * 573 *
574 * Does not return errors, on the theory that the callers of this 574 * Does not return errors, on the theory that the callers of this
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 0511716e9424..667c841c2952 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -209,8 +209,7 @@ static int __init proc_execdomains_init(void)
209module_init(proc_execdomains_init); 209module_init(proc_execdomains_init);
210#endif 210#endif
211 211
212asmlinkage long 212SYSCALL_DEFINE1(personality, u_long, personality)
213sys_personality(u_long personality)
214{ 213{
215 u_long old = current->personality; 214 u_long old = current->personality;
216 215
diff --git a/kernel/exit.c b/kernel/exit.c
index cbdb39a498eb..29f4b790751c 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1140,7 +1140,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code)
1140 1140
1141EXPORT_SYMBOL(complete_and_exit); 1141EXPORT_SYMBOL(complete_and_exit);
1142 1142
1143asmlinkage long sys_exit(int error_code) 1143SYSCALL_DEFINE1(exit, int, error_code)
1144{ 1144{
1145 do_exit((error_code&0xff)<<8); 1145 do_exit((error_code&0xff)<<8);
1146} 1146}
@@ -1181,9 +1181,11 @@ do_group_exit(int exit_code)
1181 * wait4()-ing process will get the correct exit code - even if this 1181 * wait4()-ing process will get the correct exit code - even if this
1182 * thread is not the thread group leader. 1182 * thread is not the thread group leader.
1183 */ 1183 */
1184asmlinkage void sys_exit_group(int error_code) 1184SYSCALL_DEFINE1(exit_group, int, error_code)
1185{ 1185{
1186 do_group_exit((error_code & 0xff) << 8); 1186 do_group_exit((error_code & 0xff) << 8);
1187 /* NOTREACHED */
1188 return 0;
1187} 1189}
1188 1190
1189static struct pid *task_pid_type(struct task_struct *task, enum pid_type type) 1191static struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
@@ -1757,9 +1759,8 @@ end:
1757 return retval; 1759 return retval;
1758} 1760}
1759 1761
1760asmlinkage long sys_waitid(int which, pid_t upid, 1762SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
1761 struct siginfo __user *infop, int options, 1763 infop, int, options, struct rusage __user *, ru)
1762 struct rusage __user *ru)
1763{ 1764{
1764 struct pid *pid = NULL; 1765 struct pid *pid = NULL;
1765 enum pid_type type; 1766 enum pid_type type;
@@ -1798,8 +1799,8 @@ asmlinkage long sys_waitid(int which, pid_t upid,
1798 return ret; 1799 return ret;
1799} 1800}
1800 1801
1801asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr, 1802SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr,
1802 int options, struct rusage __user *ru) 1803 int, options, struct rusage __user *, ru)
1803{ 1804{
1804 struct pid *pid = NULL; 1805 struct pid *pid = NULL;
1805 enum pid_type type; 1806 enum pid_type type;
@@ -1836,7 +1837,7 @@ asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr,
1836 * sys_waitpid() remains for compatibility. waitpid() should be 1837 * sys_waitpid() remains for compatibility. waitpid() should be
1837 * implemented by calling sys_wait4() from libc.a. 1838 * implemented by calling sys_wait4() from libc.a.
1838 */ 1839 */
1839asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options) 1840SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options)
1840{ 1841{
1841 return sys_wait4(pid, stat_addr, options, NULL); 1842 return sys_wait4(pid, stat_addr, options, NULL);
1842} 1843}
diff --git a/kernel/fork.c b/kernel/fork.c
index b1f8609287eb..70ca1852a0e5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -901,7 +901,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p)
901 clear_freeze_flag(p); 901 clear_freeze_flag(p);
902} 902}
903 903
904asmlinkage long sys_set_tid_address(int __user *tidptr) 904SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
905{ 905{
906 current->clear_child_tid = tidptr; 906 current->clear_child_tid = tidptr;
907 907
@@ -1604,7 +1604,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp
1604 * constructed. Here we are modifying the current, active, 1604 * constructed. Here we are modifying the current, active,
1605 * task_struct. 1605 * task_struct.
1606 */ 1606 */
1607asmlinkage long sys_unshare(unsigned long unshare_flags) 1607SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1608{ 1608{
1609 int err = 0; 1609 int err = 0;
1610 struct fs_struct *fs, *new_fs = NULL; 1610 struct fs_struct *fs, *new_fs = NULL;
diff --git a/kernel/futex.c b/kernel/futex.c
index 002aa189eb09..f89d373a9c6d 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1733,9 +1733,8 @@ pi_faulted:
1733 * @head: pointer to the list-head 1733 * @head: pointer to the list-head
1734 * @len: length of the list-head, as userspace expects 1734 * @len: length of the list-head, as userspace expects
1735 */ 1735 */
1736asmlinkage long 1736SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
1737sys_set_robust_list(struct robust_list_head __user *head, 1737 size_t, len)
1738 size_t len)
1739{ 1738{
1740 if (!futex_cmpxchg_enabled) 1739 if (!futex_cmpxchg_enabled)
1741 return -ENOSYS; 1740 return -ENOSYS;
@@ -1756,9 +1755,9 @@ sys_set_robust_list(struct robust_list_head __user *head,
1756 * @head_ptr: pointer to a list-head pointer, the kernel fills it in 1755 * @head_ptr: pointer to a list-head pointer, the kernel fills it in
1757 * @len_ptr: pointer to a length field, the kernel fills in the header size 1756 * @len_ptr: pointer to a length field, the kernel fills in the header size
1758 */ 1757 */
1759asmlinkage long 1758SYSCALL_DEFINE3(get_robust_list, int, pid,
1760sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, 1759 struct robust_list_head __user * __user *, head_ptr,
1761 size_t __user *len_ptr) 1760 size_t __user *, len_ptr)
1762{ 1761{
1763 struct robust_list_head __user *head; 1762 struct robust_list_head __user *head;
1764 unsigned long ret; 1763 unsigned long ret;
@@ -1978,9 +1977,9 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
1978} 1977}
1979 1978
1980 1979
1981asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, 1980SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
1982 struct timespec __user *utime, u32 __user *uaddr2, 1981 struct timespec __user *, utime, u32 __user *, uaddr2,
1983 u32 val3) 1982 u32, val3)
1984{ 1983{
1985 struct timespec ts; 1984 struct timespec ts;
1986 ktime_t t, *tp = NULL; 1985 ktime_t t, *tp = NULL;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 1455b7651b6b..2dc30c59c5fd 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1467,8 +1467,8 @@ out:
1467 return ret; 1467 return ret;
1468} 1468}
1469 1469
1470asmlinkage long 1470SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
1471sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) 1471 struct timespec __user *, rmtp)
1472{ 1472{
1473 struct timespec tu; 1473 struct timespec tu;
1474 1474
diff --git a/kernel/itimer.c b/kernel/itimer.c
index db7c358b9a02..6a5fe93dd8bd 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -100,7 +100,7 @@ int do_getitimer(int which, struct itimerval *value)
100 return 0; 100 return 0;
101} 101}
102 102
103asmlinkage long sys_getitimer(int which, struct itimerval __user *value) 103SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value)
104{ 104{
105 int error = -EFAULT; 105 int error = -EFAULT;
106 struct itimerval get_buffer; 106 struct itimerval get_buffer;
@@ -260,9 +260,8 @@ unsigned int alarm_setitimer(unsigned int seconds)
260 return it_old.it_value.tv_sec; 260 return it_old.it_value.tv_sec;
261} 261}
262 262
263asmlinkage long sys_setitimer(int which, 263SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
264 struct itimerval __user *value, 264 struct itimerval __user *, ovalue)
265 struct itimerval __user *ovalue)
266{ 265{
267 struct itimerval set_buffer, get_buffer; 266 struct itimerval set_buffer, get_buffer;
268 int error; 267 int error;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 3fb855ad6aa0..8a6d7b08864e 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -934,9 +934,8 @@ struct kimage *kexec_crash_image;
934 934
935static DEFINE_MUTEX(kexec_mutex); 935static DEFINE_MUTEX(kexec_mutex);
936 936
937asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 937SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
938 struct kexec_segment __user *segments, 938 struct kexec_segment __user *, segments, unsigned long, flags)
939 unsigned long flags)
940{ 939{
941 struct kimage **dest_image, *image; 940 struct kimage **dest_image, *image;
942 int result; 941 int result;
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1b9cbdc0127a..7ba8cd9845cb 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -123,7 +123,7 @@ static int collect_garbage_slots(void);
123static int __kprobes check_safety(void) 123static int __kprobes check_safety(void)
124{ 124{
125 int ret = 0; 125 int ret = 0;
126#if defined(CONFIG_PREEMPT) && defined(CONFIG_PM) 126#if defined(CONFIG_PREEMPT) && defined(CONFIG_FREEZER)
127 ret = freeze_processes(); 127 ret = freeze_processes();
128 if (ret == 0) { 128 if (ret == 0) {
129 struct task_struct *p, *q; 129 struct task_struct *p, *q;
diff --git a/kernel/module.c b/kernel/module.c
index c9332c90d5a0..e8b51d41dd72 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -743,8 +743,8 @@ static void wait_for_zero_refcount(struct module *mod)
743 mutex_lock(&module_mutex); 743 mutex_lock(&module_mutex);
744} 744}
745 745
746asmlinkage long 746SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
747sys_delete_module(const char __user *name_user, unsigned int flags) 747 unsigned int, flags)
748{ 748{
749 struct module *mod; 749 struct module *mod;
750 char name[MODULE_NAME_LEN]; 750 char name[MODULE_NAME_LEN];
@@ -2296,10 +2296,8 @@ static noinline struct module *load_module(void __user *umod,
2296} 2296}
2297 2297
2298/* This is where the real work happens */ 2298/* This is where the real work happens */
2299asmlinkage long 2299SYSCALL_DEFINE3(init_module, void __user *, umod,
2300sys_init_module(void __user *umod, 2300 unsigned long, len, const char __user *, uargs)
2301 unsigned long len,
2302 const char __user *uargs)
2303{ 2301{
2304 struct module *mod; 2302 struct module *mod;
2305 int ret = 0; 2303 int ret = 0;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 887c63787de6..052ec4d195c7 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -477,10 +477,9 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set)
477 477
478/* Create a POSIX.1b interval timer. */ 478/* Create a POSIX.1b interval timer. */
479 479
480asmlinkage long 480SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
481sys_timer_create(const clockid_t which_clock, 481 struct sigevent __user *, timer_event_spec,
482 struct sigevent __user *timer_event_spec, 482 timer_t __user *, created_timer_id)
483 timer_t __user * created_timer_id)
484{ 483{
485 struct k_itimer *new_timer; 484 struct k_itimer *new_timer;
486 int error, new_timer_id; 485 int error, new_timer_id;
@@ -661,8 +660,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
661} 660}
662 661
663/* Get the time remaining on a POSIX.1b interval timer. */ 662/* Get the time remaining on a POSIX.1b interval timer. */
664asmlinkage long 663SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
665sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting) 664 struct itimerspec __user *, setting)
666{ 665{
667 struct k_itimer *timr; 666 struct k_itimer *timr;
668 struct itimerspec cur_setting; 667 struct itimerspec cur_setting;
@@ -691,8 +690,7 @@ sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting)
691 * the call back to do_schedule_next_timer(). So all we need to do is 690 * the call back to do_schedule_next_timer(). So all we need to do is
692 * to pick up the frozen overrun. 691 * to pick up the frozen overrun.
693 */ 692 */
694asmlinkage long 693SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id)
695sys_timer_getoverrun(timer_t timer_id)
696{ 694{
697 struct k_itimer *timr; 695 struct k_itimer *timr;
698 int overrun; 696 int overrun;
@@ -760,10 +758,9 @@ common_timer_set(struct k_itimer *timr, int flags,
760} 758}
761 759
762/* Set a POSIX.1b interval timer */ 760/* Set a POSIX.1b interval timer */
763asmlinkage long 761SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
764sys_timer_settime(timer_t timer_id, int flags, 762 const struct itimerspec __user *, new_setting,
765 const struct itimerspec __user *new_setting, 763 struct itimerspec __user *, old_setting)
766 struct itimerspec __user *old_setting)
767{ 764{
768 struct k_itimer *timr; 765 struct k_itimer *timr;
769 struct itimerspec new_spec, old_spec; 766 struct itimerspec new_spec, old_spec;
@@ -816,8 +813,7 @@ static inline int timer_delete_hook(struct k_itimer *timer)
816} 813}
817 814
818/* Delete a POSIX.1b interval timer. */ 815/* Delete a POSIX.1b interval timer. */
819asmlinkage long 816SYSCALL_DEFINE1(timer_delete, timer_t, timer_id)
820sys_timer_delete(timer_t timer_id)
821{ 817{
822 struct k_itimer *timer; 818 struct k_itimer *timer;
823 unsigned long flags; 819 unsigned long flags;
@@ -903,8 +899,8 @@ int do_posix_clock_nonanosleep(const clockid_t clock, int flags,
903} 899}
904EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep); 900EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep);
905 901
906asmlinkage long sys_clock_settime(const clockid_t which_clock, 902SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
907 const struct timespec __user *tp) 903 const struct timespec __user *, tp)
908{ 904{
909 struct timespec new_tp; 905 struct timespec new_tp;
910 906
@@ -916,8 +912,8 @@ asmlinkage long sys_clock_settime(const clockid_t which_clock,
916 return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp)); 912 return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp));
917} 913}
918 914
919asmlinkage long 915SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
920sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp) 916 struct timespec __user *,tp)
921{ 917{
922 struct timespec kernel_tp; 918 struct timespec kernel_tp;
923 int error; 919 int error;
@@ -933,8 +929,8 @@ sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp)
933 929
934} 930}
935 931
936asmlinkage long 932SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
937sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp) 933 struct timespec __user *, tp)
938{ 934{
939 struct timespec rtn_tp; 935 struct timespec rtn_tp;
940 int error; 936 int error;
@@ -963,10 +959,9 @@ static int common_nsleep(const clockid_t which_clock, int flags,
963 which_clock); 959 which_clock);
964} 960}
965 961
966asmlinkage long 962SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
967sys_clock_nanosleep(const clockid_t which_clock, int flags, 963 const struct timespec __user *, rqtp,
968 const struct timespec __user *rqtp, 964 struct timespec __user *, rmtp)
969 struct timespec __user *rmtp)
970{ 965{
971 struct timespec t; 966 struct timespec t;
972 967
diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index 597823b5b700..d7a10167a25b 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -4,7 +4,8 @@ EXTRA_CFLAGS += -DDEBUG
4endif 4endif
5 5
6obj-y := main.o 6obj-y := main.o
7obj-$(CONFIG_PM_SLEEP) += process.o console.o 7obj-$(CONFIG_PM_SLEEP) += console.o
8obj-$(CONFIG_FREEZER) += process.o
8obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o 9obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o
9 10
10obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o 11obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o
diff --git a/kernel/printk.c b/kernel/printk.c
index 7015733793e8..69188f226a93 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -382,7 +382,7 @@ out:
382 return error; 382 return error;
383} 383}
384 384
385asmlinkage long sys_syslog(int type, char __user *buf, int len) 385SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
386{ 386{
387 return do_syslog(type, buf, len); 387 return do_syslog(type, buf, len);
388} 388}
@@ -742,11 +742,6 @@ EXPORT_SYMBOL(vprintk);
742 742
743#else 743#else
744 744
745asmlinkage long sys_syslog(int type, char __user *buf, int len)
746{
747 return -ENOSYS;
748}
749
750static void call_console_drivers(unsigned start, unsigned end) 745static void call_console_drivers(unsigned start, unsigned end)
751{ 746{
752} 747}
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 29dc700e198c..c9cf48b21f05 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -574,7 +574,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
574#define arch_ptrace_attach(child) do { } while (0) 574#define arch_ptrace_attach(child) do { } while (0)
575#endif 575#endif
576 576
577asmlinkage long sys_ptrace(long request, long pid, long addr, long data) 577SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data)
578{ 578{
579 struct task_struct *child; 579 struct task_struct *child;
580 long ret; 580 long ret;
diff --git a/kernel/resource.c b/kernel/resource.c
index ca6a1536b205..fd5d7d574bb9 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -620,6 +620,7 @@ resource_size_t resource_alignment(struct resource *res)
620 * @start: resource start address 620 * @start: resource start address
621 * @n: resource region size 621 * @n: resource region size
622 * @name: reserving caller's ID string 622 * @name: reserving caller's ID string
623 * @flags: IO resource flags
623 */ 624 */
624struct resource * __request_region(struct resource *parent, 625struct resource * __request_region(struct resource *parent,
625 resource_size_t start, resource_size_t n, 626 resource_size_t start, resource_size_t n,
diff --git a/kernel/sched.c b/kernel/sched.c
index ce9fecab5f02..40d70d9c0af3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1343,8 +1343,8 @@ static inline void update_load_sub(struct load_weight *lw, unsigned long dec)
1343 * slice expiry etc. 1343 * slice expiry etc.
1344 */ 1344 */
1345 1345
1346#define WEIGHT_IDLEPRIO 2 1346#define WEIGHT_IDLEPRIO 3
1347#define WMULT_IDLEPRIO (1 << 31) 1347#define WMULT_IDLEPRIO 1431655765
1348 1348
1349/* 1349/*
1350 * Nice levels are multiplicative, with a gentle 10% change for every 1350 * Nice levels are multiplicative, with a gentle 10% change for every
@@ -4509,7 +4509,7 @@ void __kprobes sub_preempt_count(int val)
4509 /* 4509 /*
4510 * Underflow? 4510 * Underflow?
4511 */ 4511 */
4512 if (DEBUG_LOCKS_WARN_ON(val > preempt_count() - (!!kernel_locked()))) 4512 if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
4513 return; 4513 return;
4514 /* 4514 /*
4515 * Is the spinlock portion underflowing? 4515 * Is the spinlock portion underflowing?
@@ -5196,7 +5196,7 @@ int can_nice(const struct task_struct *p, const int nice)
5196 * sys_setpriority is a more generic, but much slower function that 5196 * sys_setpriority is a more generic, but much slower function that
5197 * does similar things. 5197 * does similar things.
5198 */ 5198 */
5199asmlinkage long sys_nice(int increment) 5199SYSCALL_DEFINE1(nice, int, increment)
5200{ 5200{
5201 long nice, retval; 5201 long nice, retval;
5202 5202
@@ -5503,8 +5503,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5503 * @policy: new policy. 5503 * @policy: new policy.
5504 * @param: structure containing the new RT priority. 5504 * @param: structure containing the new RT priority.
5505 */ 5505 */
5506asmlinkage long 5506SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
5507sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) 5507 struct sched_param __user *, param)
5508{ 5508{
5509 /* negative values for policy are not valid */ 5509 /* negative values for policy are not valid */
5510 if (policy < 0) 5510 if (policy < 0)
@@ -5518,7 +5518,7 @@ sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5518 * @pid: the pid in question. 5518 * @pid: the pid in question.
5519 * @param: structure containing the new RT priority. 5519 * @param: structure containing the new RT priority.
5520 */ 5520 */
5521asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param) 5521SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
5522{ 5522{
5523 return do_sched_setscheduler(pid, -1, param); 5523 return do_sched_setscheduler(pid, -1, param);
5524} 5524}
@@ -5527,7 +5527,7 @@ asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)
5527 * sys_sched_getscheduler - get the policy (scheduling class) of a thread 5527 * sys_sched_getscheduler - get the policy (scheduling class) of a thread
5528 * @pid: the pid in question. 5528 * @pid: the pid in question.
5529 */ 5529 */
5530asmlinkage long sys_sched_getscheduler(pid_t pid) 5530SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
5531{ 5531{
5532 struct task_struct *p; 5532 struct task_struct *p;
5533 int retval; 5533 int retval;
@@ -5552,7 +5552,7 @@ asmlinkage long sys_sched_getscheduler(pid_t pid)
5552 * @pid: the pid in question. 5552 * @pid: the pid in question.
5553 * @param: structure containing the RT priority. 5553 * @param: structure containing the RT priority.
5554 */ 5554 */
5555asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param) 5555SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
5556{ 5556{
5557 struct sched_param lp; 5557 struct sched_param lp;
5558 struct task_struct *p; 5558 struct task_struct *p;
@@ -5670,8 +5670,8 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
5670 * @len: length in bytes of the bitmask pointed to by user_mask_ptr 5670 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
5671 * @user_mask_ptr: user-space pointer to the new cpu mask 5671 * @user_mask_ptr: user-space pointer to the new cpu mask
5672 */ 5672 */
5673asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, 5673SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
5674 unsigned long __user *user_mask_ptr) 5674 unsigned long __user *, user_mask_ptr)
5675{ 5675{
5676 cpumask_var_t new_mask; 5676 cpumask_var_t new_mask;
5677 int retval; 5677 int retval;
@@ -5718,8 +5718,8 @@ out_unlock:
5718 * @len: length in bytes of the bitmask pointed to by user_mask_ptr 5718 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
5719 * @user_mask_ptr: user-space pointer to hold the current cpu mask 5719 * @user_mask_ptr: user-space pointer to hold the current cpu mask
5720 */ 5720 */
5721asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, 5721SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
5722 unsigned long __user *user_mask_ptr) 5722 unsigned long __user *, user_mask_ptr)
5723{ 5723{
5724 int ret; 5724 int ret;
5725 cpumask_var_t mask; 5725 cpumask_var_t mask;
@@ -5748,7 +5748,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
5748 * This function yields the current CPU to other tasks. If there are no 5748 * This function yields the current CPU to other tasks. If there are no
5749 * other threads running on this CPU then this function will return. 5749 * other threads running on this CPU then this function will return.
5750 */ 5750 */
5751asmlinkage long sys_sched_yield(void) 5751SYSCALL_DEFINE0(sched_yield)
5752{ 5752{
5753 struct rq *rq = this_rq_lock(); 5753 struct rq *rq = this_rq_lock();
5754 5754
@@ -5889,7 +5889,7 @@ long __sched io_schedule_timeout(long timeout)
5889 * this syscall returns the maximum rt_priority that can be used 5889 * this syscall returns the maximum rt_priority that can be used
5890 * by a given scheduling class. 5890 * by a given scheduling class.
5891 */ 5891 */
5892asmlinkage long sys_sched_get_priority_max(int policy) 5892SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
5893{ 5893{
5894 int ret = -EINVAL; 5894 int ret = -EINVAL;
5895 5895
@@ -5914,7 +5914,7 @@ asmlinkage long sys_sched_get_priority_max(int policy)
5914 * this syscall returns the minimum rt_priority that can be used 5914 * this syscall returns the minimum rt_priority that can be used
5915 * by a given scheduling class. 5915 * by a given scheduling class.
5916 */ 5916 */
5917asmlinkage long sys_sched_get_priority_min(int policy) 5917SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
5918{ 5918{
5919 int ret = -EINVAL; 5919 int ret = -EINVAL;
5920 5920
@@ -5939,8 +5939,8 @@ asmlinkage long sys_sched_get_priority_min(int policy)
5939 * this syscall writes the default timeslice value of a given process 5939 * this syscall writes the default timeslice value of a given process
5940 * into the user-space timespec buffer. A value of '0' means infinity. 5940 * into the user-space timespec buffer. A value of '0' means infinity.
5941 */ 5941 */
5942asmlinkage 5942SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
5943long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval) 5943 struct timespec __user *, interval)
5944{ 5944{
5945 struct task_struct *p; 5945 struct task_struct *p;
5946 unsigned int time_slice; 5946 unsigned int time_slice;
@@ -9120,6 +9120,13 @@ static int tg_schedulable(struct task_group *tg, void *data)
9120 runtime = d->rt_runtime; 9120 runtime = d->rt_runtime;
9121 } 9121 }
9122 9122
9123#ifdef CONFIG_USER_SCHED
9124 if (tg == &root_task_group) {
9125 period = global_rt_period();
9126 runtime = global_rt_runtime();
9127 }
9128#endif
9129
9123 /* 9130 /*
9124 * Cannot have more runtime than the period. 9131 * Cannot have more runtime than the period.
9125 */ 9132 */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 8e1352c75557..5cc1c162044f 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -283,7 +283,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
283 struct sched_entity, 283 struct sched_entity,
284 run_node); 284 run_node);
285 285
286 if (vruntime == cfs_rq->min_vruntime) 286 if (!cfs_rq->curr)
287 vruntime = se->vruntime; 287 vruntime = se->vruntime;
288 else 288 else
289 vruntime = min_vruntime(vruntime, se->vruntime); 289 vruntime = min_vruntime(vruntime, se->vruntime);
@@ -429,7 +429,10 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
429 u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq); 429 u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq);
430 430
431 for_each_sched_entity(se) { 431 for_each_sched_entity(se) {
432 struct load_weight *load = &cfs_rq->load; 432 struct load_weight *load;
433
434 cfs_rq = cfs_rq_of(se);
435 load = &cfs_rq->load;
433 436
434 if (unlikely(!se->on_rq)) { 437 if (unlikely(!se->on_rq)) {
435 struct load_weight lw = cfs_rq->load; 438 struct load_weight lw = cfs_rq->load;
@@ -677,9 +680,13 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
677 unsigned long thresh = sysctl_sched_latency; 680 unsigned long thresh = sysctl_sched_latency;
678 681
679 /* 682 /*
680 * convert the sleeper threshold into virtual time 683 * Convert the sleeper threshold into virtual time.
684 * SCHED_IDLE is a special sub-class. We care about
685 * fairness only relative to other SCHED_IDLE tasks,
686 * all of which have the same weight.
681 */ 687 */
682 if (sched_feat(NORMALIZED_SLEEPER)) 688 if (sched_feat(NORMALIZED_SLEEPER) &&
689 task_of(se)->policy != SCHED_IDLE)
683 thresh = calc_delta_fair(thresh, se); 690 thresh = calc_delta_fair(thresh, se);
684 691
685 vruntime -= thresh; 692 vruntime -= thresh;
@@ -1340,14 +1347,18 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
1340 1347
1341static void set_last_buddy(struct sched_entity *se) 1348static void set_last_buddy(struct sched_entity *se)
1342{ 1349{
1343 for_each_sched_entity(se) 1350 if (likely(task_of(se)->policy != SCHED_IDLE)) {
1344 cfs_rq_of(se)->last = se; 1351 for_each_sched_entity(se)
1352 cfs_rq_of(se)->last = se;
1353 }
1345} 1354}
1346 1355
1347static void set_next_buddy(struct sched_entity *se) 1356static void set_next_buddy(struct sched_entity *se)
1348{ 1357{
1349 for_each_sched_entity(se) 1358 if (likely(task_of(se)->policy != SCHED_IDLE)) {
1350 cfs_rq_of(se)->next = se; 1359 for_each_sched_entity(se)
1360 cfs_rq_of(se)->next = se;
1361 }
1351} 1362}
1352 1363
1353/* 1364/*
@@ -1393,12 +1404,18 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
1393 return; 1404 return;
1394 1405
1395 /* 1406 /*
1396 * Batch tasks do not preempt (their preemption is driven by 1407 * Batch and idle tasks do not preempt (their preemption is driven by
1397 * the tick): 1408 * the tick):
1398 */ 1409 */
1399 if (unlikely(p->policy == SCHED_BATCH)) 1410 if (unlikely(p->policy != SCHED_NORMAL))
1400 return; 1411 return;
1401 1412
1413 /* Idle tasks are by definition preempted by everybody. */
1414 if (unlikely(curr->policy == SCHED_IDLE)) {
1415 resched_task(curr);
1416 return;
1417 }
1418
1402 if (!sched_feat(WAKEUP_PREEMPT)) 1419 if (!sched_feat(WAKEUP_PREEMPT))
1403 return; 1420 return;
1404 1421
diff --git a/kernel/signal.c b/kernel/signal.c
index 3152ac3b62e2..e73759783dc8 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1961,7 +1961,7 @@ EXPORT_SYMBOL(unblock_all_signals);
1961 * System call entry points. 1961 * System call entry points.
1962 */ 1962 */
1963 1963
1964asmlinkage long sys_restart_syscall(void) 1964SYSCALL_DEFINE0(restart_syscall)
1965{ 1965{
1966 struct restart_block *restart = &current_thread_info()->restart_block; 1966 struct restart_block *restart = &current_thread_info()->restart_block;
1967 return restart->fn(restart); 1967 return restart->fn(restart);
@@ -2014,8 +2014,8 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
2014 return error; 2014 return error;
2015} 2015}
2016 2016
2017asmlinkage long 2017SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, set,
2018sys_rt_sigprocmask(int how, sigset_t __user *set, sigset_t __user *oset, size_t sigsetsize) 2018 sigset_t __user *, oset, size_t, sigsetsize)
2019{ 2019{
2020 int error = -EINVAL; 2020 int error = -EINVAL;
2021 sigset_t old_set, new_set; 2021 sigset_t old_set, new_set;
@@ -2074,8 +2074,7 @@ out:
2074 return error; 2074 return error;
2075} 2075}
2076 2076
2077asmlinkage long 2077SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
2078sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize)
2079{ 2078{
2080 return do_sigpending(set, sigsetsize); 2079 return do_sigpending(set, sigsetsize);
2081} 2080}
@@ -2146,11 +2145,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
2146 2145
2147#endif 2146#endif
2148 2147
2149asmlinkage long 2148SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2150sys_rt_sigtimedwait(const sigset_t __user *uthese, 2149 siginfo_t __user *, uinfo, const struct timespec __user *, uts,
2151 siginfo_t __user *uinfo, 2150 size_t, sigsetsize)
2152 const struct timespec __user *uts,
2153 size_t sigsetsize)
2154{ 2151{
2155 int ret, sig; 2152 int ret, sig;
2156 sigset_t these; 2153 sigset_t these;
@@ -2223,8 +2220,7 @@ sys_rt_sigtimedwait(const sigset_t __user *uthese,
2223 return ret; 2220 return ret;
2224} 2221}
2225 2222
2226asmlinkage long 2223SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
2227sys_kill(pid_t pid, int sig)
2228{ 2224{
2229 struct siginfo info; 2225 struct siginfo info;
2230 2226
@@ -2283,7 +2279,7 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig)
2283 * exists but it's not belonging to the target process anymore. This 2279 * exists but it's not belonging to the target process anymore. This
2284 * method solves the problem of threads exiting and PIDs getting reused. 2280 * method solves the problem of threads exiting and PIDs getting reused.
2285 */ 2281 */
2286asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig) 2282SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
2287{ 2283{
2288 /* This is only valid for single tasks */ 2284 /* This is only valid for single tasks */
2289 if (pid <= 0 || tgid <= 0) 2285 if (pid <= 0 || tgid <= 0)
@@ -2295,8 +2291,7 @@ asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig)
2295/* 2291/*
2296 * Send a signal to only one task, even if it's a CLONE_THREAD task. 2292 * Send a signal to only one task, even if it's a CLONE_THREAD task.
2297 */ 2293 */
2298asmlinkage long 2294SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
2299sys_tkill(pid_t pid, int sig)
2300{ 2295{
2301 /* This is only valid for single tasks */ 2296 /* This is only valid for single tasks */
2302 if (pid <= 0) 2297 if (pid <= 0)
@@ -2305,8 +2300,8 @@ sys_tkill(pid_t pid, int sig)
2305 return do_tkill(0, pid, sig); 2300 return do_tkill(0, pid, sig);
2306} 2301}
2307 2302
2308asmlinkage long 2303SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
2309sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo) 2304 siginfo_t __user *, uinfo)
2310{ 2305{
2311 siginfo_t info; 2306 siginfo_t info;
2312 2307
@@ -2434,8 +2429,7 @@ out:
2434 2429
2435#ifdef __ARCH_WANT_SYS_SIGPENDING 2430#ifdef __ARCH_WANT_SYS_SIGPENDING
2436 2431
2437asmlinkage long 2432SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
2438sys_sigpending(old_sigset_t __user *set)
2439{ 2433{
2440 return do_sigpending(set, sizeof(*set)); 2434 return do_sigpending(set, sizeof(*set));
2441} 2435}
@@ -2446,8 +2440,8 @@ sys_sigpending(old_sigset_t __user *set)
2446/* Some platforms have their own version with special arguments others 2440/* Some platforms have their own version with special arguments others
2447 support only sys_rt_sigprocmask. */ 2441 support only sys_rt_sigprocmask. */
2448 2442
2449asmlinkage long 2443SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
2450sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset) 2444 old_sigset_t __user *, oset)
2451{ 2445{
2452 int error; 2446 int error;
2453 old_sigset_t old_set, new_set; 2447 old_sigset_t old_set, new_set;
@@ -2497,11 +2491,10 @@ out:
2497#endif /* __ARCH_WANT_SYS_SIGPROCMASK */ 2491#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
2498 2492
2499#ifdef __ARCH_WANT_SYS_RT_SIGACTION 2493#ifdef __ARCH_WANT_SYS_RT_SIGACTION
2500asmlinkage long 2494SYSCALL_DEFINE4(rt_sigaction, int, sig,
2501sys_rt_sigaction(int sig, 2495 const struct sigaction __user *, act,
2502 const struct sigaction __user *act, 2496 struct sigaction __user *, oact,
2503 struct sigaction __user *oact, 2497 size_t, sigsetsize)
2504 size_t sigsetsize)
2505{ 2498{
2506 struct k_sigaction new_sa, old_sa; 2499 struct k_sigaction new_sa, old_sa;
2507 int ret = -EINVAL; 2500 int ret = -EINVAL;
@@ -2531,15 +2524,13 @@ out:
2531/* 2524/*
2532 * For backwards compatibility. Functionality superseded by sigprocmask. 2525 * For backwards compatibility. Functionality superseded by sigprocmask.
2533 */ 2526 */
2534asmlinkage long 2527SYSCALL_DEFINE0(sgetmask)
2535sys_sgetmask(void)
2536{ 2528{
2537 /* SMP safe */ 2529 /* SMP safe */
2538 return current->blocked.sig[0]; 2530 return current->blocked.sig[0];
2539} 2531}
2540 2532
2541asmlinkage long 2533SYSCALL_DEFINE1(ssetmask, int, newmask)
2542sys_ssetmask(int newmask)
2543{ 2534{
2544 int old; 2535 int old;
2545 2536
@@ -2559,8 +2550,7 @@ sys_ssetmask(int newmask)
2559/* 2550/*
2560 * For backwards compatibility. Functionality superseded by sigaction. 2551 * For backwards compatibility. Functionality superseded by sigaction.
2561 */ 2552 */
2562asmlinkage unsigned long 2553SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
2563sys_signal(int sig, __sighandler_t handler)
2564{ 2554{
2565 struct k_sigaction new_sa, old_sa; 2555 struct k_sigaction new_sa, old_sa;
2566 int ret; 2556 int ret;
@@ -2577,8 +2567,7 @@ sys_signal(int sig, __sighandler_t handler)
2577 2567
2578#ifdef __ARCH_WANT_SYS_PAUSE 2568#ifdef __ARCH_WANT_SYS_PAUSE
2579 2569
2580asmlinkage long 2570SYSCALL_DEFINE0(pause)
2581sys_pause(void)
2582{ 2571{
2583 current->state = TASK_INTERRUPTIBLE; 2572 current->state = TASK_INTERRUPTIBLE;
2584 schedule(); 2573 schedule();
@@ -2588,7 +2577,7 @@ sys_pause(void)
2588#endif 2577#endif
2589 2578
2590#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND 2579#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND
2591asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) 2580SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
2592{ 2581{
2593 sigset_t newset; 2582 sigset_t newset;
2594 2583
diff --git a/kernel/sys.c b/kernel/sys.c
index c2a951ae4223..87ca037dc03a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -144,7 +144,7 @@ out:
144 return error; 144 return error;
145} 145}
146 146
147asmlinkage long sys_setpriority(int which, int who, int niceval) 147SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
148{ 148{
149 struct task_struct *g, *p; 149 struct task_struct *g, *p;
150 struct user_struct *user; 150 struct user_struct *user;
@@ -209,7 +209,7 @@ out:
209 * has been offset by 20 (ie it returns 40..1 instead of -20..19) 209 * has been offset by 20 (ie it returns 40..1 instead of -20..19)
210 * to stay compatible. 210 * to stay compatible.
211 */ 211 */
212asmlinkage long sys_getpriority(int which, int who) 212SYSCALL_DEFINE2(getpriority, int, which, int, who)
213{ 213{
214 struct task_struct *g, *p; 214 struct task_struct *g, *p;
215 struct user_struct *user; 215 struct user_struct *user;
@@ -356,7 +356,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
356 * 356 *
357 * reboot doesn't sync: do that yourself before calling this. 357 * reboot doesn't sync: do that yourself before calling this.
358 */ 358 */
359asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg) 359SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
360 void __user *, arg)
360{ 361{
361 char buffer[256]; 362 char buffer[256];
362 363
@@ -479,7 +480,7 @@ void ctrl_alt_del(void)
479 * SMP: There are not races, the GIDs are checked only by filesystem 480 * SMP: There are not races, the GIDs are checked only by filesystem
480 * operations (as far as semantic preservation is concerned). 481 * operations (as far as semantic preservation is concerned).
481 */ 482 */
482asmlinkage long sys_setregid(gid_t rgid, gid_t egid) 483SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
483{ 484{
484 const struct cred *old; 485 const struct cred *old;
485 struct cred *new; 486 struct cred *new;
@@ -530,7 +531,7 @@ error:
530 * 531 *
531 * SMP: Same implicit races as above. 532 * SMP: Same implicit races as above.
532 */ 533 */
533asmlinkage long sys_setgid(gid_t gid) 534SYSCALL_DEFINE1(setgid, gid_t, gid)
534{ 535{
535 const struct cred *old; 536 const struct cred *old;
536 struct cred *new; 537 struct cred *new;
@@ -598,7 +599,7 @@ static int set_user(struct cred *new)
598 * 100% compatible with BSD. A program which uses just setuid() will be 599 * 100% compatible with BSD. A program which uses just setuid() will be
599 * 100% compatible with POSIX with saved IDs. 600 * 100% compatible with POSIX with saved IDs.
600 */ 601 */
601asmlinkage long sys_setreuid(uid_t ruid, uid_t euid) 602SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
602{ 603{
603 const struct cred *old; 604 const struct cred *old;
604 struct cred *new; 605 struct cred *new;
@@ -662,7 +663,7 @@ error:
662 * will allow a root program to temporarily drop privileges and be able to 663 * will allow a root program to temporarily drop privileges and be able to
663 * regain them by swapping the real and effective uid. 664 * regain them by swapping the real and effective uid.
664 */ 665 */
665asmlinkage long sys_setuid(uid_t uid) 666SYSCALL_DEFINE1(setuid, uid_t, uid)
666{ 667{
667 const struct cred *old; 668 const struct cred *old;
668 struct cred *new; 669 struct cred *new;
@@ -706,7 +707,7 @@ error:
706 * This function implements a generic ability to update ruid, euid, 707 * This function implements a generic ability to update ruid, euid,
707 * and suid. This allows you to implement the 4.4 compatible seteuid(). 708 * and suid. This allows you to implement the 4.4 compatible seteuid().
708 */ 709 */
709asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) 710SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
710{ 711{
711 const struct cred *old; 712 const struct cred *old;
712 struct cred *new; 713 struct cred *new;
@@ -757,7 +758,7 @@ error:
757 return retval; 758 return retval;
758} 759}
759 760
760asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid) 761SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid)
761{ 762{
762 const struct cred *cred = current_cred(); 763 const struct cred *cred = current_cred();
763 int retval; 764 int retval;
@@ -772,7 +773,7 @@ asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __us
772/* 773/*
773 * Same as above, but for rgid, egid, sgid. 774 * Same as above, but for rgid, egid, sgid.
774 */ 775 */
775asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) 776SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
776{ 777{
777 const struct cred *old; 778 const struct cred *old;
778 struct cred *new; 779 struct cred *new;
@@ -815,7 +816,7 @@ error:
815 return retval; 816 return retval;
816} 817}
817 818
818asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid) 819SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid)
819{ 820{
820 const struct cred *cred = current_cred(); 821 const struct cred *cred = current_cred();
821 int retval; 822 int retval;
@@ -834,7 +835,7 @@ asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __us
834 * whatever uid it wants to). It normally shadows "euid", except when 835 * whatever uid it wants to). It normally shadows "euid", except when
835 * explicitly set by setfsuid() or for access.. 836 * explicitly set by setfsuid() or for access..
836 */ 837 */
837asmlinkage long sys_setfsuid(uid_t uid) 838SYSCALL_DEFINE1(setfsuid, uid_t, uid)
838{ 839{
839 const struct cred *old; 840 const struct cred *old;
840 struct cred *new; 841 struct cred *new;
@@ -871,7 +872,7 @@ change_okay:
871/* 872/*
872 * Samma på svenska.. 873 * Samma på svenska..
873 */ 874 */
874asmlinkage long sys_setfsgid(gid_t gid) 875SYSCALL_DEFINE1(setfsgid, gid_t, gid)
875{ 876{
876 const struct cred *old; 877 const struct cred *old;
877 struct cred *new; 878 struct cred *new;
@@ -920,7 +921,7 @@ void do_sys_times(struct tms *tms)
920 tms->tms_cstime = cputime_to_clock_t(cstime); 921 tms->tms_cstime = cputime_to_clock_t(cstime);
921} 922}
922 923
923asmlinkage long sys_times(struct tms __user * tbuf) 924SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
924{ 925{
925 if (tbuf) { 926 if (tbuf) {
926 struct tms tmp; 927 struct tms tmp;
@@ -945,7 +946,7 @@ asmlinkage long sys_times(struct tms __user * tbuf)
945 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. 946 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
946 * LBT 04.03.94 947 * LBT 04.03.94
947 */ 948 */
948asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) 949SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
949{ 950{
950 struct task_struct *p; 951 struct task_struct *p;
951 struct task_struct *group_leader = current->group_leader; 952 struct task_struct *group_leader = current->group_leader;
@@ -1016,7 +1017,7 @@ out:
1016 return err; 1017 return err;
1017} 1018}
1018 1019
1019asmlinkage long sys_getpgid(pid_t pid) 1020SYSCALL_DEFINE1(getpgid, pid_t, pid)
1020{ 1021{
1021 struct task_struct *p; 1022 struct task_struct *p;
1022 struct pid *grp; 1023 struct pid *grp;
@@ -1046,14 +1047,14 @@ out:
1046 1047
1047#ifdef __ARCH_WANT_SYS_GETPGRP 1048#ifdef __ARCH_WANT_SYS_GETPGRP
1048 1049
1049asmlinkage long sys_getpgrp(void) 1050SYSCALL_DEFINE0(getpgrp)
1050{ 1051{
1051 return sys_getpgid(0); 1052 return sys_getpgid(0);
1052} 1053}
1053 1054
1054#endif 1055#endif
1055 1056
1056asmlinkage long sys_getsid(pid_t pid) 1057SYSCALL_DEFINE1(getsid, pid_t, pid)
1057{ 1058{
1058 struct task_struct *p; 1059 struct task_struct *p;
1059 struct pid *sid; 1060 struct pid *sid;
@@ -1081,7 +1082,7 @@ out:
1081 return retval; 1082 return retval;
1082} 1083}
1083 1084
1084asmlinkage long sys_setsid(void) 1085SYSCALL_DEFINE0(setsid)
1085{ 1086{
1086 struct task_struct *group_leader = current->group_leader; 1087 struct task_struct *group_leader = current->group_leader;
1087 struct pid *sid = task_pid(group_leader); 1088 struct pid *sid = task_pid(group_leader);
@@ -1312,7 +1313,7 @@ int set_current_groups(struct group_info *group_info)
1312 1313
1313EXPORT_SYMBOL(set_current_groups); 1314EXPORT_SYMBOL(set_current_groups);
1314 1315
1315asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) 1316SYSCALL_DEFINE2(getgroups, int, gidsetsize, gid_t __user *, grouplist)
1316{ 1317{
1317 const struct cred *cred = current_cred(); 1318 const struct cred *cred = current_cred();
1318 int i; 1319 int i;
@@ -1341,7 +1342,7 @@ out:
1341 * without another task interfering. 1342 * without another task interfering.
1342 */ 1343 */
1343 1344
1344asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist) 1345SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
1345{ 1346{
1346 struct group_info *group_info; 1347 struct group_info *group_info;
1347 int retval; 1348 int retval;
@@ -1395,7 +1396,7 @@ EXPORT_SYMBOL(in_egroup_p);
1395 1396
1396DECLARE_RWSEM(uts_sem); 1397DECLARE_RWSEM(uts_sem);
1397 1398
1398asmlinkage long sys_newuname(struct new_utsname __user * name) 1399SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
1399{ 1400{
1400 int errno = 0; 1401 int errno = 0;
1401 1402
@@ -1406,7 +1407,7 @@ asmlinkage long sys_newuname(struct new_utsname __user * name)
1406 return errno; 1407 return errno;
1407} 1408}
1408 1409
1409asmlinkage long sys_sethostname(char __user *name, int len) 1410SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
1410{ 1411{
1411 int errno; 1412 int errno;
1412 char tmp[__NEW_UTS_LEN]; 1413 char tmp[__NEW_UTS_LEN];
@@ -1430,7 +1431,7 @@ asmlinkage long sys_sethostname(char __user *name, int len)
1430 1431
1431#ifdef __ARCH_WANT_SYS_GETHOSTNAME 1432#ifdef __ARCH_WANT_SYS_GETHOSTNAME
1432 1433
1433asmlinkage long sys_gethostname(char __user *name, int len) 1434SYSCALL_DEFINE2(gethostname, char __user *, name, int, len)
1434{ 1435{
1435 int i, errno; 1436 int i, errno;
1436 struct new_utsname *u; 1437 struct new_utsname *u;
@@ -1455,7 +1456,7 @@ asmlinkage long sys_gethostname(char __user *name, int len)
1455 * Only setdomainname; getdomainname can be implemented by calling 1456 * Only setdomainname; getdomainname can be implemented by calling
1456 * uname() 1457 * uname()
1457 */ 1458 */
1458asmlinkage long sys_setdomainname(char __user *name, int len) 1459SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
1459{ 1460{
1460 int errno; 1461 int errno;
1461 char tmp[__NEW_UTS_LEN]; 1462 char tmp[__NEW_UTS_LEN];
@@ -1478,7 +1479,7 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
1478 return errno; 1479 return errno;
1479} 1480}
1480 1481
1481asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim) 1482SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
1482{ 1483{
1483 if (resource >= RLIM_NLIMITS) 1484 if (resource >= RLIM_NLIMITS)
1484 return -EINVAL; 1485 return -EINVAL;
@@ -1497,7 +1498,8 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
1497 * Back compatibility for getrlimit. Needed for some apps. 1498 * Back compatibility for getrlimit. Needed for some apps.
1498 */ 1499 */
1499 1500
1500asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim) 1501SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
1502 struct rlimit __user *, rlim)
1501{ 1503{
1502 struct rlimit x; 1504 struct rlimit x;
1503 if (resource >= RLIM_NLIMITS) 1505 if (resource >= RLIM_NLIMITS)
@@ -1515,7 +1517,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
1515 1517
1516#endif 1518#endif
1517 1519
1518asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim) 1520SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
1519{ 1521{
1520 struct rlimit new_rlim, *old_rlim; 1522 struct rlimit new_rlim, *old_rlim;
1521 int retval; 1523 int retval;
@@ -1688,7 +1690,7 @@ int getrusage(struct task_struct *p, int who, struct rusage __user *ru)
1688 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; 1690 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
1689} 1691}
1690 1692
1691asmlinkage long sys_getrusage(int who, struct rusage __user *ru) 1693SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
1692{ 1694{
1693 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN && 1695 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
1694 who != RUSAGE_THREAD) 1696 who != RUSAGE_THREAD)
@@ -1696,14 +1698,14 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
1696 return getrusage(current, who, ru); 1698 return getrusage(current, who, ru);
1697} 1699}
1698 1700
1699asmlinkage long sys_umask(int mask) 1701SYSCALL_DEFINE1(umask, int, mask)
1700{ 1702{
1701 mask = xchg(&current->fs->umask, mask & S_IRWXUGO); 1703 mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
1702 return mask; 1704 return mask;
1703} 1705}
1704 1706
1705asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, 1707SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
1706 unsigned long arg4, unsigned long arg5) 1708 unsigned long, arg4, unsigned long, arg5)
1707{ 1709{
1708 struct task_struct *me = current; 1710 struct task_struct *me = current;
1709 unsigned char comm[sizeof(me->comm)]; 1711 unsigned char comm[sizeof(me->comm)];
@@ -1822,8 +1824,8 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
1822 return error; 1824 return error;
1823} 1825}
1824 1826
1825asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, 1827SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep,
1826 struct getcpu_cache __user *unused) 1828 struct getcpu_cache __user *, unused)
1827{ 1829{
1828 int err = 0; 1830 int err = 0;
1829 int cpu = raw_smp_processor_id(); 1831 int cpu = raw_smp_processor_id();
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 4be8bbc7577c..68320f6b07b5 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -131,6 +131,7 @@ cond_syscall(sys_io_destroy);
131cond_syscall(sys_io_submit); 131cond_syscall(sys_io_submit);
132cond_syscall(sys_io_cancel); 132cond_syscall(sys_io_cancel);
133cond_syscall(sys_io_getevents); 133cond_syscall(sys_io_getevents);
134cond_syscall(sys_syslog);
134 135
135/* arch-specific weak syscall entries */ 136/* arch-specific weak syscall entries */
136cond_syscall(sys_pciconfig_read); 137cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 89d74436318c..368d1638ee78 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -144,6 +144,7 @@ extern int acct_parm[];
144 144
145#ifdef CONFIG_IA64 145#ifdef CONFIG_IA64
146extern int no_unaligned_warning; 146extern int no_unaligned_warning;
147extern int unaligned_dump_stack;
147#endif 148#endif
148 149
149#ifdef CONFIG_RT_MUTEXES 150#ifdef CONFIG_RT_MUTEXES
@@ -781,6 +782,14 @@ static struct ctl_table kern_table[] = {
781 .mode = 0644, 782 .mode = 0644,
782 .proc_handler = &proc_dointvec, 783 .proc_handler = &proc_dointvec,
783 }, 784 },
785 {
786 .ctl_name = CTL_UNNUMBERED,
787 .procname = "unaligned-dump-stack",
788 .data = &unaligned_dump_stack,
789 .maxlen = sizeof (int),
790 .mode = 0644,
791 .proc_handler = &proc_dointvec,
792 },
784#endif 793#endif
785#ifdef CONFIG_DETECT_SOFTLOCKUP 794#ifdef CONFIG_DETECT_SOFTLOCKUP
786 { 795 {
@@ -1688,7 +1697,7 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol
1688 return error; 1697 return error;
1689} 1698}
1690 1699
1691asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 1700SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1692{ 1701{
1693 struct __sysctl_args tmp; 1702 struct __sysctl_args tmp;
1694 int error; 1703 int error;
@@ -2989,7 +2998,7 @@ int sysctl_ms_jiffies(struct ctl_table *table,
2989#else /* CONFIG_SYSCTL_SYSCALL */ 2998#else /* CONFIG_SYSCTL_SYSCALL */
2990 2999
2991 3000
2992asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 3001SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
2993{ 3002{
2994 struct __sysctl_args tmp; 3003 struct __sysctl_args tmp;
2995 int error; 3004 int error;
diff --git a/kernel/time.c b/kernel/time.c
index 4886e3ce83a4..29511943871a 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(sys_tz);
60 * why not move it into the appropriate arch directory (for those 60 * why not move it into the appropriate arch directory (for those
61 * architectures that need it). 61 * architectures that need it).
62 */ 62 */
63asmlinkage long sys_time(time_t __user * tloc) 63SYSCALL_DEFINE1(time, time_t __user *, tloc)
64{ 64{
65 time_t i = get_seconds(); 65 time_t i = get_seconds();
66 66
@@ -79,7 +79,7 @@ asmlinkage long sys_time(time_t __user * tloc)
79 * architectures that need it). 79 * architectures that need it).
80 */ 80 */
81 81
82asmlinkage long sys_stime(time_t __user *tptr) 82SYSCALL_DEFINE1(stime, time_t __user *, tptr)
83{ 83{
84 struct timespec tv; 84 struct timespec tv;
85 int err; 85 int err;
@@ -99,8 +99,8 @@ asmlinkage long sys_stime(time_t __user *tptr)
99 99
100#endif /* __ARCH_WANT_SYS_TIME */ 100#endif /* __ARCH_WANT_SYS_TIME */
101 101
102asmlinkage long sys_gettimeofday(struct timeval __user *tv, 102SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
103 struct timezone __user *tz) 103 struct timezone __user *, tz)
104{ 104{
105 if (likely(tv != NULL)) { 105 if (likely(tv != NULL)) {
106 struct timeval ktv; 106 struct timeval ktv;
@@ -184,8 +184,8 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
184 return 0; 184 return 0;
185} 185}
186 186
187asmlinkage long sys_settimeofday(struct timeval __user *tv, 187SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
188 struct timezone __user *tz) 188 struct timezone __user *, tz)
189{ 189{
190 struct timeval user_tv; 190 struct timeval user_tv;
191 struct timespec new_ts; 191 struct timespec new_ts;
@@ -205,7 +205,7 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv,
205 return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); 205 return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
206} 206}
207 207
208asmlinkage long sys_adjtimex(struct timex __user *txc_p) 208SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
209{ 209{
210 struct timex txc; /* Local copy of parameter */ 210 struct timex txc; /* Local copy of parameter */
211 int ret; 211 int ret;
diff --git a/kernel/timer.c b/kernel/timer.c
index dee3f641a7a7..13dd64fe143d 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1129,7 +1129,7 @@ void do_timer(unsigned long ticks)
1129 * For backwards compatibility? This can be done in libc so Alpha 1129 * For backwards compatibility? This can be done in libc so Alpha
1130 * and all newer ports shouldn't need it. 1130 * and all newer ports shouldn't need it.
1131 */ 1131 */
1132asmlinkage unsigned long sys_alarm(unsigned int seconds) 1132SYSCALL_DEFINE1(alarm, unsigned int, seconds)
1133{ 1133{
1134 return alarm_setitimer(seconds); 1134 return alarm_setitimer(seconds);
1135} 1135}
@@ -1152,7 +1152,7 @@ asmlinkage unsigned long sys_alarm(unsigned int seconds)
1152 * 1152 *
1153 * This is SMP safe as current->tgid does not change. 1153 * This is SMP safe as current->tgid does not change.
1154 */ 1154 */
1155asmlinkage long sys_getpid(void) 1155SYSCALL_DEFINE0(getpid)
1156{ 1156{
1157 return task_tgid_vnr(current); 1157 return task_tgid_vnr(current);
1158} 1158}
@@ -1163,7 +1163,7 @@ asmlinkage long sys_getpid(void)
1163 * value of ->real_parent under rcu_read_lock(), see 1163 * value of ->real_parent under rcu_read_lock(), see
1164 * release_task()->call_rcu(delayed_put_task_struct). 1164 * release_task()->call_rcu(delayed_put_task_struct).
1165 */ 1165 */
1166asmlinkage long sys_getppid(void) 1166SYSCALL_DEFINE0(getppid)
1167{ 1167{
1168 int pid; 1168 int pid;
1169 1169
@@ -1174,25 +1174,25 @@ asmlinkage long sys_getppid(void)
1174 return pid; 1174 return pid;
1175} 1175}
1176 1176
1177asmlinkage long sys_getuid(void) 1177SYSCALL_DEFINE0(getuid)
1178{ 1178{
1179 /* Only we change this so SMP safe */ 1179 /* Only we change this so SMP safe */
1180 return current_uid(); 1180 return current_uid();
1181} 1181}
1182 1182
1183asmlinkage long sys_geteuid(void) 1183SYSCALL_DEFINE0(geteuid)
1184{ 1184{
1185 /* Only we change this so SMP safe */ 1185 /* Only we change this so SMP safe */
1186 return current_euid(); 1186 return current_euid();
1187} 1187}
1188 1188
1189asmlinkage long sys_getgid(void) 1189SYSCALL_DEFINE0(getgid)
1190{ 1190{
1191 /* Only we change this so SMP safe */ 1191 /* Only we change this so SMP safe */
1192 return current_gid(); 1192 return current_gid();
1193} 1193}
1194 1194
1195asmlinkage long sys_getegid(void) 1195SYSCALL_DEFINE0(getegid)
1196{ 1196{
1197 /* Only we change this so SMP safe */ 1197 /* Only we change this so SMP safe */
1198 return current_egid(); 1198 return current_egid();
@@ -1308,7 +1308,7 @@ signed long __sched schedule_timeout_uninterruptible(signed long timeout)
1308EXPORT_SYMBOL(schedule_timeout_uninterruptible); 1308EXPORT_SYMBOL(schedule_timeout_uninterruptible);
1309 1309
1310/* Thread ID - the internal kernel "pid" */ 1310/* Thread ID - the internal kernel "pid" */
1311asmlinkage long sys_gettid(void) 1311SYSCALL_DEFINE0(gettid)
1312{ 1312{
1313 return task_pid_vnr(current); 1313 return task_pid_vnr(current);
1314} 1314}
@@ -1400,7 +1400,7 @@ out:
1400 return 0; 1400 return 0;
1401} 1401}
1402 1402
1403asmlinkage long sys_sysinfo(struct sysinfo __user *info) 1403SYSCALL_DEFINE1(sysinfo, struct sysinfo __user *, info)
1404{ 1404{
1405 struct sysinfo val; 1405 struct sysinfo val;
1406 1406
diff --git a/kernel/uid16.c b/kernel/uid16.c
index 2460c3199b5a..0314501688b9 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -17,7 +17,7 @@
17 17
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19 19
20asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) 20SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
21{ 21{
22 long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); 22 long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
23 /* avoid REGPARM breakage on x86: */ 23 /* avoid REGPARM breakage on x86: */
@@ -25,7 +25,7 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gi
25 return ret; 25 return ret;
26} 26}
27 27
28asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group) 28SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
29{ 29{
30 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); 30 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
31 /* avoid REGPARM breakage on x86: */ 31 /* avoid REGPARM breakage on x86: */
@@ -33,7 +33,7 @@ asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_g
33 return ret; 33 return ret;
34} 34}
35 35
36asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) 36SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group)
37{ 37{
38 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); 38 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
39 /* avoid REGPARM breakage on x86: */ 39 /* avoid REGPARM breakage on x86: */
@@ -41,7 +41,7 @@ asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
41 return ret; 41 return ret;
42} 42}
43 43
44asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) 44SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid)
45{ 45{
46 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); 46 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
47 /* avoid REGPARM breakage on x86: */ 47 /* avoid REGPARM breakage on x86: */
@@ -49,7 +49,7 @@ asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
49 return ret; 49 return ret;
50} 50}
51 51
52asmlinkage long sys_setgid16(old_gid_t gid) 52SYSCALL_DEFINE1(setgid16, old_gid_t, gid)
53{ 53{
54 long ret = sys_setgid(low2highgid(gid)); 54 long ret = sys_setgid(low2highgid(gid));
55 /* avoid REGPARM breakage on x86: */ 55 /* avoid REGPARM breakage on x86: */
@@ -57,7 +57,7 @@ asmlinkage long sys_setgid16(old_gid_t gid)
57 return ret; 57 return ret;
58} 58}
59 59
60asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) 60SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid)
61{ 61{
62 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); 62 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
63 /* avoid REGPARM breakage on x86: */ 63 /* avoid REGPARM breakage on x86: */
@@ -65,7 +65,7 @@ asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
65 return ret; 65 return ret;
66} 66}
67 67
68asmlinkage long sys_setuid16(old_uid_t uid) 68SYSCALL_DEFINE1(setuid16, old_uid_t, uid)
69{ 69{
70 long ret = sys_setuid(low2highuid(uid)); 70 long ret = sys_setuid(low2highuid(uid));
71 /* avoid REGPARM breakage on x86: */ 71 /* avoid REGPARM breakage on x86: */
@@ -73,7 +73,7 @@ asmlinkage long sys_setuid16(old_uid_t uid)
73 return ret; 73 return ret;
74} 74}
75 75
76asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) 76SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid)
77{ 77{
78 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), 78 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
79 low2highuid(suid)); 79 low2highuid(suid));
@@ -82,7 +82,7 @@ asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
82 return ret; 82 return ret;
83} 83}
84 84
85asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid) 85SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruid, old_uid_t __user *, euid, old_uid_t __user *, suid)
86{ 86{
87 const struct cred *cred = current_cred(); 87 const struct cred *cred = current_cred();
88 int retval; 88 int retval;
@@ -94,7 +94,7 @@ asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid,
94 return retval; 94 return retval;
95} 95}
96 96
97asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) 97SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid)
98{ 98{
99 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), 99 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
100 low2highgid(sgid)); 100 low2highgid(sgid));
@@ -103,7 +103,8 @@ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
103 return ret; 103 return ret;
104} 104}
105 105
106asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid) 106
107SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgid, old_gid_t __user *, egid, old_gid_t __user *, sgid)
107{ 108{
108 const struct cred *cred = current_cred(); 109 const struct cred *cred = current_cred();
109 int retval; 110 int retval;
@@ -115,7 +116,7 @@ asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid,
115 return retval; 116 return retval;
116} 117}
117 118
118asmlinkage long sys_setfsuid16(old_uid_t uid) 119SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid)
119{ 120{
120 long ret = sys_setfsuid(low2highuid(uid)); 121 long ret = sys_setfsuid(low2highuid(uid));
121 /* avoid REGPARM breakage on x86: */ 122 /* avoid REGPARM breakage on x86: */
@@ -123,7 +124,7 @@ asmlinkage long sys_setfsuid16(old_uid_t uid)
123 return ret; 124 return ret;
124} 125}
125 126
126asmlinkage long sys_setfsgid16(old_gid_t gid) 127SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid)
127{ 128{
128 long ret = sys_setfsgid(low2highgid(gid)); 129 long ret = sys_setfsgid(low2highgid(gid));
129 /* avoid REGPARM breakage on x86: */ 130 /* avoid REGPARM breakage on x86: */
@@ -161,7 +162,7 @@ static int groups16_from_user(struct group_info *group_info,
161 return 0; 162 return 0;
162} 163}
163 164
164asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist) 165SYSCALL_DEFINE2(getgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
165{ 166{
166 const struct cred *cred = current_cred(); 167 const struct cred *cred = current_cred();
167 int i; 168 int i;
@@ -184,7 +185,7 @@ out:
184 return i; 185 return i;
185} 186}
186 187
187asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist) 188SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
188{ 189{
189 struct group_info *group_info; 190 struct group_info *group_info;
190 int retval; 191 int retval;
@@ -209,22 +210,22 @@ asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist)
209 return retval; 210 return retval;
210} 211}
211 212
212asmlinkage long sys_getuid16(void) 213SYSCALL_DEFINE0(getuid16)
213{ 214{
214 return high2lowuid(current_uid()); 215 return high2lowuid(current_uid());
215} 216}
216 217
217asmlinkage long sys_geteuid16(void) 218SYSCALL_DEFINE0(geteuid16)
218{ 219{
219 return high2lowuid(current_euid()); 220 return high2lowuid(current_euid());
220} 221}
221 222
222asmlinkage long sys_getgid16(void) 223SYSCALL_DEFINE0(getgid16)
223{ 224{
224 return high2lowgid(current_gid()); 225 return high2lowgid(current_gid());
225} 226}
226 227
227asmlinkage long sys_getegid16(void) 228SYSCALL_DEFINE0(getegid16)
228{ 229{
229 return high2lowgid(current_egid()); 230 return high2lowgid(current_egid());
230} 231}
diff --git a/lib/idr.c b/lib/idr.c
index 1c4f9281f412..c11c5765cdef 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -121,7 +121,7 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
121{ 121{
122 while (idp->id_free_cnt < IDR_FREE_MAX) { 122 while (idp->id_free_cnt < IDR_FREE_MAX) {
123 struct idr_layer *new; 123 struct idr_layer *new;
124 new = kmem_cache_alloc(idr_layer_cache, gfp_mask); 124 new = kmem_cache_zalloc(idr_layer_cache, gfp_mask);
125 if (new == NULL) 125 if (new == NULL)
126 return (0); 126 return (0);
127 move_to_free_list(idp, new); 127 move_to_free_list(idp, new);
@@ -292,7 +292,7 @@ static int idr_get_new_above_int(struct idr *idp, void *ptr, int starting_id)
292 * and go back to the idr_pre_get() call. If the idr is full, it will 292 * and go back to the idr_pre_get() call. If the idr is full, it will
293 * return -ENOSPC. 293 * return -ENOSPC.
294 * 294 *
295 * @id returns a value in the range 0 ... 0x7fffffff 295 * @id returns a value in the range @starting_id ... 0x7fffffff
296 */ 296 */
297int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) 297int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
298{ 298{
@@ -623,16 +623,10 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
623} 623}
624EXPORT_SYMBOL(idr_replace); 624EXPORT_SYMBOL(idr_replace);
625 625
626static void idr_cache_ctor(void *idr_layer)
627{
628 memset(idr_layer, 0, sizeof(struct idr_layer));
629}
630
631void __init idr_init_cache(void) 626void __init idr_init_cache(void)
632{ 627{
633 idr_layer_cache = kmem_cache_create("idr_layer_cache", 628 idr_layer_cache = kmem_cache_create("idr_layer_cache",
634 sizeof(struct idr_layer), 0, SLAB_PANIC, 629 sizeof(struct idr_layer), 0, SLAB_PANIC, NULL);
635 idr_cache_ctor);
636} 630}
637 631
638/** 632/**
@@ -723,7 +717,7 @@ EXPORT_SYMBOL(ida_pre_get);
723 * and go back to the ida_pre_get() call. If the ida is full, it will 717 * and go back to the ida_pre_get() call. If the ida is full, it will
724 * return -ENOSPC. 718 * return -ENOSPC.
725 * 719 *
726 * @p_id returns a value in the range 0 ... 0x7fffffff. 720 * @p_id returns a value in the range @starting_id ... 0x7fffffff.
727 */ 721 */
728int ida_get_new_above(struct ida *ida, int starting_id, int *p_id) 722int ida_get_new_above(struct ida *ida, int starting_id, int *p_id)
729{ 723{
diff --git a/mm/fadvise.c b/mm/fadvise.c
index a1da969bd980..54a0f8040afa 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -24,7 +24,7 @@
24 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could 24 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
25 * deactivate the pages and clear PG_Referenced. 25 * deactivate the pages and clear PG_Referenced.
26 */ 26 */
27asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) 27SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
28{ 28{
29 struct file *file = fget(fd); 29 struct file *file = fget(fd);
30 struct address_space *mapping; 30 struct address_space *mapping;
@@ -126,12 +126,26 @@ out:
126 fput(file); 126 fput(file);
127 return ret; 127 return ret;
128} 128}
129#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
130asmlinkage long SyS_fadvise64_64(long fd, loff_t offset, loff_t len, long advice)
131{
132 return SYSC_fadvise64_64((int) fd, offset, len, (int) advice);
133}
134SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64);
135#endif
129 136
130#ifdef __ARCH_WANT_SYS_FADVISE64 137#ifdef __ARCH_WANT_SYS_FADVISE64
131 138
132asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice) 139SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice)
133{ 140{
134 return sys_fadvise64_64(fd, offset, len, advice); 141 return sys_fadvise64_64(fd, offset, len, advice);
135} 142}
143#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
144asmlinkage long SyS_fadvise64(long fd, loff_t offset, long len, long advice)
145{
146 return SYSC_fadvise64((int) fd, offset, (size_t)len, (int)advice);
147}
148SYSCALL_ALIAS(sys_fadvise64, SyS_fadvise64);
149#endif
136 150
137#endif 151#endif
diff --git a/mm/filemap.c b/mm/filemap.c
index ceba0bd03662..23acefe51808 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1374,7 +1374,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
1374 return 0; 1374 return 0;
1375} 1375}
1376 1376
1377asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) 1377SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count)
1378{ 1378{
1379 ssize_t ret; 1379 ssize_t ret;
1380 struct file *file; 1380 struct file *file;
@@ -1393,6 +1393,13 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
1393 } 1393 }
1394 return ret; 1394 return ret;
1395} 1395}
1396#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
1397asmlinkage long SyS_readahead(long fd, loff_t offset, long count)
1398{
1399 return SYSC_readahead((int) fd, offset, (size_t) count);
1400}
1401SYSCALL_ALIAS(sys_readahead, SyS_readahead);
1402#endif
1396 1403
1397#ifdef CONFIG_MMU 1404#ifdef CONFIG_MMU
1398/** 1405/**
diff --git a/mm/fremap.c b/mm/fremap.c
index 62d5bbda921a..736ba7f3306a 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -120,8 +120,8 @@ static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma,
120 * and the vma's default protection is used. Arbitrary protections 120 * and the vma's default protection is used. Arbitrary protections
121 * might be implemented in the future. 121 * might be implemented in the future.
122 */ 122 */
123asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, 123SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
124 unsigned long prot, unsigned long pgoff, unsigned long flags) 124 unsigned long, prot, unsigned long, pgoff, unsigned long, flags)
125{ 125{
126 struct mm_struct *mm = current->mm; 126 struct mm_struct *mm = current->mm;
127 struct address_space *mapping; 127 struct address_space *mapping;
diff --git a/mm/madvise.c b/mm/madvise.c
index f9349c18a1b5..b9ce574827c8 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -281,7 +281,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
281 * -EBADF - map exists, but area maps something that isn't a file. 281 * -EBADF - map exists, but area maps something that isn't a file.
282 * -EAGAIN - a kernel resource was temporarily unavailable. 282 * -EAGAIN - a kernel resource was temporarily unavailable.
283 */ 283 */
284asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior) 284SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
285{ 285{
286 unsigned long end, tmp; 286 unsigned long end, tmp;
287 struct vm_area_struct * vma, *prev; 287 struct vm_area_struct * vma, *prev;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e2996b80601f..4d0ea3ceba6d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -358,6 +358,10 @@ void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru)
358 return; 358 return;
359 359
360 pc = lookup_page_cgroup(page); 360 pc = lookup_page_cgroup(page);
361 /*
362 * Used bit is set without atomic ops but after smp_wmb().
363 * For making pc->mem_cgroup visible, insert smp_rmb() here.
364 */
361 smp_rmb(); 365 smp_rmb();
362 /* unused page is not rotated. */ 366 /* unused page is not rotated. */
363 if (!PageCgroupUsed(pc)) 367 if (!PageCgroupUsed(pc))
@@ -374,7 +378,10 @@ void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru)
374 if (mem_cgroup_disabled()) 378 if (mem_cgroup_disabled())
375 return; 379 return;
376 pc = lookup_page_cgroup(page); 380 pc = lookup_page_cgroup(page);
377 /* barrier to sync with "charge" */ 381 /*
382 * Used bit is set without atomic ops but after smp_wmb().
383 * For making pc->mem_cgroup visible, insert smp_rmb() here.
384 */
378 smp_rmb(); 385 smp_rmb();
379 if (!PageCgroupUsed(pc)) 386 if (!PageCgroupUsed(pc))
380 return; 387 return;
@@ -559,6 +566,14 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
559 return NULL; 566 return NULL;
560 567
561 pc = lookup_page_cgroup(page); 568 pc = lookup_page_cgroup(page);
569 /*
570 * Used bit is set without atomic ops but after smp_wmb().
571 * For making pc->mem_cgroup visible, insert smp_rmb() here.
572 */
573 smp_rmb();
574 if (!PageCgroupUsed(pc))
575 return NULL;
576
562 mz = page_cgroup_zoneinfo(pc); 577 mz = page_cgroup_zoneinfo(pc);
563 if (!mz) 578 if (!mz)
564 return NULL; 579 return NULL;
@@ -618,7 +633,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
618 * called with hierarchy_mutex held 633 * called with hierarchy_mutex held
619 */ 634 */
620static struct mem_cgroup * 635static struct mem_cgroup *
621mem_cgroup_get_next_node(struct mem_cgroup *curr, struct mem_cgroup *root_mem) 636__mem_cgroup_get_next_node(struct mem_cgroup *curr, struct mem_cgroup *root_mem)
622{ 637{
623 struct cgroup *cgroup, *curr_cgroup, *root_cgroup; 638 struct cgroup *cgroup, *curr_cgroup, *root_cgroup;
624 639
@@ -629,19 +644,16 @@ mem_cgroup_get_next_node(struct mem_cgroup *curr, struct mem_cgroup *root_mem)
629 /* 644 /*
630 * Walk down to children 645 * Walk down to children
631 */ 646 */
632 mem_cgroup_put(curr);
633 cgroup = list_entry(curr_cgroup->children.next, 647 cgroup = list_entry(curr_cgroup->children.next,
634 struct cgroup, sibling); 648 struct cgroup, sibling);
635 curr = mem_cgroup_from_cont(cgroup); 649 curr = mem_cgroup_from_cont(cgroup);
636 mem_cgroup_get(curr);
637 goto done; 650 goto done;
638 } 651 }
639 652
640visit_parent: 653visit_parent:
641 if (curr_cgroup == root_cgroup) { 654 if (curr_cgroup == root_cgroup) {
642 mem_cgroup_put(curr); 655 /* caller handles NULL case */
643 curr = root_mem; 656 curr = NULL;
644 mem_cgroup_get(curr);
645 goto done; 657 goto done;
646 } 658 }
647 659
@@ -649,11 +661,9 @@ visit_parent:
649 * Goto next sibling 661 * Goto next sibling
650 */ 662 */
651 if (curr_cgroup->sibling.next != &curr_cgroup->parent->children) { 663 if (curr_cgroup->sibling.next != &curr_cgroup->parent->children) {
652 mem_cgroup_put(curr);
653 cgroup = list_entry(curr_cgroup->sibling.next, struct cgroup, 664 cgroup = list_entry(curr_cgroup->sibling.next, struct cgroup,
654 sibling); 665 sibling);
655 curr = mem_cgroup_from_cont(cgroup); 666 curr = mem_cgroup_from_cont(cgroup);
656 mem_cgroup_get(curr);
657 goto done; 667 goto done;
658 } 668 }
659 669
@@ -664,7 +674,6 @@ visit_parent:
664 goto visit_parent; 674 goto visit_parent;
665 675
666done: 676done:
667 root_mem->last_scanned_child = curr;
668 return curr; 677 return curr;
669} 678}
670 679
@@ -674,40 +683,46 @@ done:
674 * that to reclaim free pages from. 683 * that to reclaim free pages from.
675 */ 684 */
676static struct mem_cgroup * 685static struct mem_cgroup *
677mem_cgroup_get_first_node(struct mem_cgroup *root_mem) 686mem_cgroup_get_next_node(struct mem_cgroup *root_mem)
678{ 687{
679 struct cgroup *cgroup; 688 struct cgroup *cgroup;
680 struct mem_cgroup *ret; 689 struct mem_cgroup *orig, *next;
681 bool obsolete; 690 bool obsolete;
682 691
683 obsolete = mem_cgroup_is_obsolete(root_mem->last_scanned_child);
684
685 /* 692 /*
686 * Scan all children under the mem_cgroup mem 693 * Scan all children under the mem_cgroup mem
687 */ 694 */
688 mutex_lock(&mem_cgroup_subsys.hierarchy_mutex); 695 mutex_lock(&mem_cgroup_subsys.hierarchy_mutex);
696
697 orig = root_mem->last_scanned_child;
698 obsolete = mem_cgroup_is_obsolete(orig);
699
689 if (list_empty(&root_mem->css.cgroup->children)) { 700 if (list_empty(&root_mem->css.cgroup->children)) {
690 ret = root_mem; 701 /*
702 * root_mem might have children before and last_scanned_child
703 * may point to one of them. We put it later.
704 */
705 if (orig)
706 VM_BUG_ON(!obsolete);
707 next = NULL;
691 goto done; 708 goto done;
692 } 709 }
693 710
694 if (!root_mem->last_scanned_child || obsolete) { 711 if (!orig || obsolete) {
695
696 if (obsolete && root_mem->last_scanned_child)
697 mem_cgroup_put(root_mem->last_scanned_child);
698
699 cgroup = list_first_entry(&root_mem->css.cgroup->children, 712 cgroup = list_first_entry(&root_mem->css.cgroup->children,
700 struct cgroup, sibling); 713 struct cgroup, sibling);
701 ret = mem_cgroup_from_cont(cgroup); 714 next = mem_cgroup_from_cont(cgroup);
702 mem_cgroup_get(ret);
703 } else 715 } else
704 ret = mem_cgroup_get_next_node(root_mem->last_scanned_child, 716 next = __mem_cgroup_get_next_node(orig, root_mem);
705 root_mem);
706 717
707done: 718done:
708 root_mem->last_scanned_child = ret; 719 if (next)
720 mem_cgroup_get(next);
721 root_mem->last_scanned_child = next;
722 if (orig)
723 mem_cgroup_put(orig);
709 mutex_unlock(&mem_cgroup_subsys.hierarchy_mutex); 724 mutex_unlock(&mem_cgroup_subsys.hierarchy_mutex);
710 return ret; 725 return (next) ? next : root_mem;
711} 726}
712 727
713static bool mem_cgroup_check_under_limit(struct mem_cgroup *mem) 728static bool mem_cgroup_check_under_limit(struct mem_cgroup *mem)
@@ -758,28 +773,25 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
758 * but there might be left over accounting, even after children 773 * but there might be left over accounting, even after children
759 * have left. 774 * have left.
760 */ 775 */
761 ret = try_to_free_mem_cgroup_pages(root_mem, gfp_mask, noswap, 776 ret += try_to_free_mem_cgroup_pages(root_mem, gfp_mask, noswap,
762 get_swappiness(root_mem)); 777 get_swappiness(root_mem));
763 if (mem_cgroup_check_under_limit(root_mem)) 778 if (mem_cgroup_check_under_limit(root_mem))
764 return 0; 779 return 1; /* indicate reclaim has succeeded */
765 if (!root_mem->use_hierarchy) 780 if (!root_mem->use_hierarchy)
766 return ret; 781 return ret;
767 782
768 next_mem = mem_cgroup_get_first_node(root_mem); 783 next_mem = mem_cgroup_get_next_node(root_mem);
769 784
770 while (next_mem != root_mem) { 785 while (next_mem != root_mem) {
771 if (mem_cgroup_is_obsolete(next_mem)) { 786 if (mem_cgroup_is_obsolete(next_mem)) {
772 mem_cgroup_put(next_mem); 787 next_mem = mem_cgroup_get_next_node(root_mem);
773 next_mem = mem_cgroup_get_first_node(root_mem);
774 continue; 788 continue;
775 } 789 }
776 ret = try_to_free_mem_cgroup_pages(next_mem, gfp_mask, noswap, 790 ret += try_to_free_mem_cgroup_pages(next_mem, gfp_mask, noswap,
777 get_swappiness(next_mem)); 791 get_swappiness(next_mem));
778 if (mem_cgroup_check_under_limit(root_mem)) 792 if (mem_cgroup_check_under_limit(root_mem))
779 return 0; 793 return 1; /* indicate reclaim has succeeded */
780 mutex_lock(&mem_cgroup_subsys.hierarchy_mutex); 794 next_mem = mem_cgroup_get_next_node(root_mem);
781 next_mem = mem_cgroup_get_next_node(next_mem, root_mem);
782 mutex_unlock(&mem_cgroup_subsys.hierarchy_mutex);
783 } 795 }
784 return ret; 796 return ret;
785} 797}
@@ -863,6 +875,8 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
863 875
864 ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, gfp_mask, 876 ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, gfp_mask,
865 noswap); 877 noswap);
878 if (ret)
879 continue;
866 880
867 /* 881 /*
868 * try_to_free_mem_cgroup_pages() might not give us a full 882 * try_to_free_mem_cgroup_pages() might not give us a full
@@ -979,14 +993,15 @@ static int mem_cgroup_move_account(struct page_cgroup *pc,
979 if (pc->mem_cgroup != from) 993 if (pc->mem_cgroup != from)
980 goto out; 994 goto out;
981 995
982 css_put(&from->css);
983 res_counter_uncharge(&from->res, PAGE_SIZE); 996 res_counter_uncharge(&from->res, PAGE_SIZE);
984 mem_cgroup_charge_statistics(from, pc, false); 997 mem_cgroup_charge_statistics(from, pc, false);
985 if (do_swap_account) 998 if (do_swap_account)
986 res_counter_uncharge(&from->memsw, PAGE_SIZE); 999 res_counter_uncharge(&from->memsw, PAGE_SIZE);
1000 css_put(&from->css);
1001
1002 css_get(&to->css);
987 pc->mem_cgroup = to; 1003 pc->mem_cgroup = to;
988 mem_cgroup_charge_statistics(to, pc, true); 1004 mem_cgroup_charge_statistics(to, pc, true);
989 css_get(&to->css);
990 ret = 0; 1005 ret = 0;
991out: 1006out:
992 unlock_page_cgroup(pc); 1007 unlock_page_cgroup(pc);
@@ -1019,8 +1034,10 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
1019 if (ret || !parent) 1034 if (ret || !parent)
1020 return ret; 1035 return ret;
1021 1036
1022 if (!get_page_unless_zero(page)) 1037 if (!get_page_unless_zero(page)) {
1023 return -EBUSY; 1038 ret = -EBUSY;
1039 goto uncharge;
1040 }
1024 1041
1025 ret = isolate_lru_page(page); 1042 ret = isolate_lru_page(page);
1026 1043
@@ -1029,19 +1046,23 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
1029 1046
1030 ret = mem_cgroup_move_account(pc, child, parent); 1047 ret = mem_cgroup_move_account(pc, child, parent);
1031 1048
1032 /* drop extra refcnt by try_charge() (move_account increment one) */
1033 css_put(&parent->css);
1034 putback_lru_page(page); 1049 putback_lru_page(page);
1035 if (!ret) { 1050 if (!ret) {
1036 put_page(page); 1051 put_page(page);
1052 /* drop extra refcnt by try_charge() */
1053 css_put(&parent->css);
1037 return 0; 1054 return 0;
1038 } 1055 }
1039 /* uncharge if move fails */ 1056
1040cancel: 1057cancel:
1058 put_page(page);
1059uncharge:
1060 /* drop extra refcnt by try_charge() */
1061 css_put(&parent->css);
1062 /* uncharge if move fails */
1041 res_counter_uncharge(&parent->res, PAGE_SIZE); 1063 res_counter_uncharge(&parent->res, PAGE_SIZE);
1042 if (do_swap_account) 1064 if (do_swap_account)
1043 res_counter_uncharge(&parent->memsw, PAGE_SIZE); 1065 res_counter_uncharge(&parent->memsw, PAGE_SIZE);
1044 put_page(page);
1045 return ret; 1066 return ret;
1046} 1067}
1047 1068
@@ -1971,6 +1992,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
1971{ 1992{
1972 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); 1993 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
1973 struct mem_cgroup *parent; 1994 struct mem_cgroup *parent;
1995
1974 if (val > 100) 1996 if (val > 100)
1975 return -EINVAL; 1997 return -EINVAL;
1976 1998
@@ -1978,15 +2000,22 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
1978 return -EINVAL; 2000 return -EINVAL;
1979 2001
1980 parent = mem_cgroup_from_cont(cgrp->parent); 2002 parent = mem_cgroup_from_cont(cgrp->parent);
2003
2004 cgroup_lock();
2005
1981 /* If under hierarchy, only empty-root can set this value */ 2006 /* If under hierarchy, only empty-root can set this value */
1982 if ((parent->use_hierarchy) || 2007 if ((parent->use_hierarchy) ||
1983 (memcg->use_hierarchy && !list_empty(&cgrp->children))) 2008 (memcg->use_hierarchy && !list_empty(&cgrp->children))) {
2009 cgroup_unlock();
1984 return -EINVAL; 2010 return -EINVAL;
2011 }
1985 2012
1986 spin_lock(&memcg->reclaim_param_lock); 2013 spin_lock(&memcg->reclaim_param_lock);
1987 memcg->swappiness = val; 2014 memcg->swappiness = val;
1988 spin_unlock(&memcg->reclaim_param_lock); 2015 spin_unlock(&memcg->reclaim_param_lock);
1989 2016
2017 cgroup_unlock();
2018
1990 return 0; 2019 return 0;
1991} 2020}
1992 2021
@@ -2181,7 +2210,7 @@ static void __init enable_swap_cgroup(void)
2181} 2210}
2182#endif 2211#endif
2183 2212
2184static struct cgroup_subsys_state * 2213static struct cgroup_subsys_state * __ref
2185mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) 2214mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
2186{ 2215{
2187 struct mem_cgroup *mem, *parent; 2216 struct mem_cgroup *mem, *parent;
@@ -2232,7 +2261,14 @@ static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss,
2232static void mem_cgroup_destroy(struct cgroup_subsys *ss, 2261static void mem_cgroup_destroy(struct cgroup_subsys *ss,
2233 struct cgroup *cont) 2262 struct cgroup *cont)
2234{ 2263{
2235 mem_cgroup_put(mem_cgroup_from_cont(cont)); 2264 struct mem_cgroup *mem = mem_cgroup_from_cont(cont);
2265 struct mem_cgroup *last_scanned_child = mem->last_scanned_child;
2266
2267 if (last_scanned_child) {
2268 VM_BUG_ON(!mem_cgroup_is_obsolete(last_scanned_child));
2269 mem_cgroup_put(last_scanned_child);
2270 }
2271 mem_cgroup_put(mem);
2236} 2272}
2237 2273
2238static int mem_cgroup_populate(struct cgroup_subsys *ss, 2274static int mem_cgroup_populate(struct cgroup_subsys *ss,
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index e412ffa8e52e..3eb4a6fdc043 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1068,10 +1068,9 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
1068 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0; 1068 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0;
1069} 1069}
1070 1070
1071asmlinkage long sys_mbind(unsigned long start, unsigned long len, 1071SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
1072 unsigned long mode, 1072 unsigned long, mode, unsigned long __user *, nmask,
1073 unsigned long __user *nmask, unsigned long maxnode, 1073 unsigned long, maxnode, unsigned, flags)
1074 unsigned flags)
1075{ 1074{
1076 nodemask_t nodes; 1075 nodemask_t nodes;
1077 int err; 1076 int err;
@@ -1091,8 +1090,8 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
1091} 1090}
1092 1091
1093/* Set the process memory policy */ 1092/* Set the process memory policy */
1094asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 1093SYSCALL_DEFINE3(set_mempolicy, int, mode, unsigned long __user *, nmask,
1095 unsigned long maxnode) 1094 unsigned long, maxnode)
1096{ 1095{
1097 int err; 1096 int err;
1098 nodemask_t nodes; 1097 nodemask_t nodes;
@@ -1110,9 +1109,9 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
1110 return do_set_mempolicy(mode, flags, &nodes); 1109 return do_set_mempolicy(mode, flags, &nodes);
1111} 1110}
1112 1111
1113asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, 1112SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
1114 const unsigned long __user *old_nodes, 1113 const unsigned long __user *, old_nodes,
1115 const unsigned long __user *new_nodes) 1114 const unsigned long __user *, new_nodes)
1116{ 1115{
1117 const struct cred *cred = current_cred(), *tcred; 1116 const struct cred *cred = current_cred(), *tcred;
1118 struct mm_struct *mm; 1117 struct mm_struct *mm;
@@ -1185,10 +1184,9 @@ out:
1185 1184
1186 1185
1187/* Retrieve NUMA policy */ 1186/* Retrieve NUMA policy */
1188asmlinkage long sys_get_mempolicy(int __user *policy, 1187SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1189 unsigned long __user *nmask, 1188 unsigned long __user *, nmask, unsigned long, maxnode,
1190 unsigned long maxnode, 1189 unsigned long, addr, unsigned long, flags)
1191 unsigned long addr, unsigned long flags)
1192{ 1190{
1193 int err; 1191 int err;
1194 int uninitialized_var(pval); 1192 int uninitialized_var(pval);
diff --git a/mm/migrate.c b/mm/migrate.c
index a30ea5fcf9f1..2bb4e1d63520 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1055,10 +1055,10 @@ out:
1055 * Move a list of pages in the address space of the currently executing 1055 * Move a list of pages in the address space of the currently executing
1056 * process. 1056 * process.
1057 */ 1057 */
1058asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, 1058SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
1059 const void __user * __user *pages, 1059 const void __user * __user *, pages,
1060 const int __user *nodes, 1060 const int __user *, nodes,
1061 int __user *status, int flags) 1061 int __user *, status, int, flags)
1062{ 1062{
1063 const struct cred *cred = current_cred(), *tcred; 1063 const struct cred *cred = current_cred(), *tcred;
1064 struct task_struct *task; 1064 struct task_struct *task;
diff --git a/mm/mincore.c b/mm/mincore.c
index 5178800bc129..8cb508f84ea4 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -177,8 +177,8 @@ none_mapped:
177 * mapped 177 * mapped
178 * -EAGAIN - A kernel resource was temporarily unavailable. 178 * -EAGAIN - A kernel resource was temporarily unavailable.
179 */ 179 */
180asmlinkage long sys_mincore(unsigned long start, size_t len, 180SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
181 unsigned char __user * vec) 181 unsigned char __user *, vec)
182{ 182{
183 long retval; 183 long retval;
184 unsigned long pages; 184 unsigned long pages;
diff --git a/mm/mlock.c b/mm/mlock.c
index e125156c664e..2904a347e476 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -530,7 +530,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
530 return error; 530 return error;
531} 531}
532 532
533asmlinkage long sys_mlock(unsigned long start, size_t len) 533SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
534{ 534{
535 unsigned long locked; 535 unsigned long locked;
536 unsigned long lock_limit; 536 unsigned long lock_limit;
@@ -558,7 +558,7 @@ asmlinkage long sys_mlock(unsigned long start, size_t len)
558 return error; 558 return error;
559} 559}
560 560
561asmlinkage long sys_munlock(unsigned long start, size_t len) 561SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
562{ 562{
563 int ret; 563 int ret;
564 564
@@ -595,7 +595,7 @@ out:
595 return 0; 595 return 0;
596} 596}
597 597
598asmlinkage long sys_mlockall(int flags) 598SYSCALL_DEFINE1(mlockall, int, flags)
599{ 599{
600 unsigned long lock_limit; 600 unsigned long lock_limit;
601 int ret = -EINVAL; 601 int ret = -EINVAL;
@@ -623,7 +623,7 @@ out:
623 return ret; 623 return ret;
624} 624}
625 625
626asmlinkage long sys_munlockall(void) 626SYSCALL_DEFINE0(munlockall)
627{ 627{
628 int ret; 628 int ret;
629 629
diff --git a/mm/mmap.c b/mm/mmap.c
index 749623196cb9..8d95902e9a38 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -245,7 +245,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
245 return next; 245 return next;
246} 246}
247 247
248asmlinkage unsigned long sys_brk(unsigned long brk) 248SYSCALL_DEFINE1(brk, unsigned long, brk)
249{ 249{
250 unsigned long rlim, retval; 250 unsigned long rlim, retval;
251 unsigned long newbrk, oldbrk; 251 unsigned long newbrk, oldbrk;
@@ -1948,7 +1948,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
1948 1948
1949EXPORT_SYMBOL(do_munmap); 1949EXPORT_SYMBOL(do_munmap);
1950 1950
1951asmlinkage long sys_munmap(unsigned long addr, size_t len) 1951SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1952{ 1952{
1953 int ret; 1953 int ret;
1954 struct mm_struct *mm = current->mm; 1954 struct mm_struct *mm = current->mm;
diff --git a/mm/mprotect.c b/mm/mprotect.c
index d0f6e7ce09f1..abe2694e13f4 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -217,8 +217,8 @@ fail:
217 return error; 217 return error;
218} 218}
219 219
220asmlinkage long 220SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
221sys_mprotect(unsigned long start, size_t len, unsigned long prot) 221 unsigned long, prot)
222{ 222{
223 unsigned long vm_flags, nstart, end, tmp, reqprot; 223 unsigned long vm_flags, nstart, end, tmp, reqprot;
224 struct vm_area_struct *vma, *prev; 224 struct vm_area_struct *vma, *prev;
diff --git a/mm/mremap.c b/mm/mremap.c
index 646de959aa58..a39b7b91be46 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -420,9 +420,9 @@ out_nc:
420 return ret; 420 return ret;
421} 421}
422 422
423asmlinkage unsigned long sys_mremap(unsigned long addr, 423SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
424 unsigned long old_len, unsigned long new_len, 424 unsigned long, new_len, unsigned long, flags,
425 unsigned long flags, unsigned long new_addr) 425 unsigned long, new_addr)
426{ 426{
427 unsigned long ret; 427 unsigned long ret;
428 428
diff --git a/mm/msync.c b/mm/msync.c
index 07dae08cf31c..4083209b7f02 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -28,7 +28,7 @@
28 * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to 28 * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to
29 * applications. 29 * applications.
30 */ 30 */
31asmlinkage long sys_msync(unsigned long start, size_t len, int flags) 31SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
32{ 32{
33 unsigned long end; 33 unsigned long end;
34 struct mm_struct *mm = current->mm; 34 struct mm_struct *mm = current->mm;
diff --git a/mm/nommu.c b/mm/nommu.c
index 60ed8375c986..8cee8c8ff0f2 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -416,7 +416,7 @@ EXPORT_SYMBOL(vm_insert_page);
416 * to a regular file. in this case, the unmapping will need 416 * to a regular file. in this case, the unmapping will need
417 * to invoke file system routines that need the global lock. 417 * to invoke file system routines that need the global lock.
418 */ 418 */
419asmlinkage unsigned long sys_brk(unsigned long brk) 419SYSCALL_DEFINE1(brk, unsigned long, brk)
420{ 420{
421 struct mm_struct *mm = current->mm; 421 struct mm_struct *mm = current->mm;
422 422
@@ -1573,7 +1573,7 @@ erase_whole_vma:
1573} 1573}
1574EXPORT_SYMBOL(do_munmap); 1574EXPORT_SYMBOL(do_munmap);
1575 1575
1576asmlinkage long sys_munmap(unsigned long addr, size_t len) 1576SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1577{ 1577{
1578 int ret; 1578 int ret;
1579 struct mm_struct *mm = current->mm; 1579 struct mm_struct *mm = current->mm;
@@ -1657,10 +1657,9 @@ unsigned long do_mremap(unsigned long addr,
1657} 1657}
1658EXPORT_SYMBOL(do_mremap); 1658EXPORT_SYMBOL(do_mremap);
1659 1659
1660asmlinkage 1660SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
1661unsigned long sys_mremap(unsigned long addr, 1661 unsigned long, new_len, unsigned long, flags,
1662 unsigned long old_len, unsigned long new_len, 1662 unsigned long, new_addr)
1663 unsigned long flags, unsigned long new_addr)
1664{ 1663{
1665 unsigned long ret; 1664 unsigned long ret;
1666 1665
diff --git a/mm/swapfile.c b/mm/swapfile.c
index da422c47e2ee..f48b831e5e5c 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1377,7 +1377,7 @@ out:
1377 return ret; 1377 return ret;
1378} 1378}
1379 1379
1380asmlinkage long sys_swapoff(const char __user * specialfile) 1380SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
1381{ 1381{
1382 struct swap_info_struct * p = NULL; 1382 struct swap_info_struct * p = NULL;
1383 unsigned short *swap_map; 1383 unsigned short *swap_map;
@@ -1633,7 +1633,7 @@ late_initcall(max_swapfiles_check);
1633 * 1633 *
1634 * The swapon system call 1634 * The swapon system call
1635 */ 1635 */
1636asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) 1636SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
1637{ 1637{
1638 struct swap_info_struct * p; 1638 struct swap_info_struct * p;
1639 char *name = NULL; 1639 char *name = NULL;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index c5db9a7264d9..75f49d312e8c 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -14,7 +14,6 @@
14#include <linux/highmem.h> 14#include <linux/highmem.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/mutex.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
@@ -24,6 +23,7 @@
24#include <linux/rbtree.h> 23#include <linux/rbtree.h>
25#include <linux/radix-tree.h> 24#include <linux/radix-tree.h>
26#include <linux/rcupdate.h> 25#include <linux/rcupdate.h>
26#include <linux/bootmem.h>
27 27
28#include <asm/atomic.h> 28#include <asm/atomic.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -495,7 +495,7 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
495static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, 495static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
496 int sync, int force_flush) 496 int sync, int force_flush)
497{ 497{
498 static DEFINE_MUTEX(purge_lock); 498 static DEFINE_SPINLOCK(purge_lock);
499 LIST_HEAD(valist); 499 LIST_HEAD(valist);
500 struct vmap_area *va; 500 struct vmap_area *va;
501 int nr = 0; 501 int nr = 0;
@@ -506,10 +506,10 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
506 * the case that isn't actually used at the moment anyway. 506 * the case that isn't actually used at the moment anyway.
507 */ 507 */
508 if (!sync && !force_flush) { 508 if (!sync && !force_flush) {
509 if (!mutex_trylock(&purge_lock)) 509 if (!spin_trylock(&purge_lock))
510 return; 510 return;
511 } else 511 } else
512 mutex_lock(&purge_lock); 512 spin_lock(&purge_lock);
513 513
514 rcu_read_lock(); 514 rcu_read_lock();
515 list_for_each_entry_rcu(va, &vmap_area_list, list) { 515 list_for_each_entry_rcu(va, &vmap_area_list, list) {
@@ -541,7 +541,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
541 __free_vmap_area(va); 541 __free_vmap_area(va);
542 spin_unlock(&vmap_area_lock); 542 spin_unlock(&vmap_area_lock);
543 } 543 }
544 mutex_unlock(&purge_lock); 544 spin_unlock(&purge_lock);
545} 545}
546 546
547/* 547/*
@@ -984,6 +984,8 @@ EXPORT_SYMBOL(vm_map_ram);
984 984
985void __init vmalloc_init(void) 985void __init vmalloc_init(void)
986{ 986{
987 struct vmap_area *va;
988 struct vm_struct *tmp;
987 int i; 989 int i;
988 990
989 for_each_possible_cpu(i) { 991 for_each_possible_cpu(i) {
@@ -996,6 +998,14 @@ void __init vmalloc_init(void)
996 vbq->nr_dirty = 0; 998 vbq->nr_dirty = 0;
997 } 999 }
998 1000
1001 /* Import existing vmlist entries. */
1002 for (tmp = vmlist; tmp; tmp = tmp->next) {
1003 va = alloc_bootmem(sizeof(struct vmap_area));
1004 va->flags = tmp->flags | VM_VM_AREA;
1005 va->va_start = (unsigned long)tmp->addr;
1006 va->va_end = va->va_start + tmp->size;
1007 __insert_vmap_area(va);
1008 }
999 vmap_initialized = true; 1009 vmap_initialized = true;
1000} 1010}
1001 1011
diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index 0663f99e977a..7ed75c7bd5d1 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -23,7 +23,7 @@ config NET_9P_VIRTIO
23 guest partitions and a host partition. 23 guest partitions and a host partition.
24 24
25config NET_9P_RDMA 25config NET_9P_RDMA
26 depends on INET && INFINIBAND && EXPERIMENTAL 26 depends on INET && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL
27 tristate "9P RDMA Transport (Experimental)" 27 tristate "9P RDMA Transport (Experimental)"
28 help 28 help
29 This builds support for an RDMA transport. 29 This builds support for an RDMA transport.
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index a65e43a17fbb..cf754ace0b75 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -58,11 +58,11 @@ static struct ctl_table_header *brnf_sysctl_header;
58static int brnf_call_iptables __read_mostly = 1; 58static int brnf_call_iptables __read_mostly = 1;
59static int brnf_call_ip6tables __read_mostly = 1; 59static int brnf_call_ip6tables __read_mostly = 1;
60static int brnf_call_arptables __read_mostly = 1; 60static int brnf_call_arptables __read_mostly = 1;
61static int brnf_filter_vlan_tagged __read_mostly = 1; 61static int brnf_filter_vlan_tagged __read_mostly = 0;
62static int brnf_filter_pppoe_tagged __read_mostly = 1; 62static int brnf_filter_pppoe_tagged __read_mostly = 0;
63#else 63#else
64#define brnf_filter_vlan_tagged 1 64#define brnf_filter_vlan_tagged 0
65#define brnf_filter_pppoe_tagged 1 65#define brnf_filter_pppoe_tagged 0
66#endif 66#endif
67 67
68static inline __be16 vlan_proto(const struct sk_buff *skb) 68static inline __be16 vlan_proto(const struct sk_buff *skb)
@@ -686,8 +686,11 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
686 if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) || 686 if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) ||
687 IS_PPPOE_IP(skb)) 687 IS_PPPOE_IP(skb))
688 pf = PF_INET; 688 pf = PF_INET;
689 else 689 else if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) ||
690 IS_PPPOE_IPV6(skb))
690 pf = PF_INET6; 691 pf = PF_INET6;
692 else
693 return NF_ACCEPT;
691 694
692 nf_bridge_pull_encap_header(skb); 695 nf_bridge_pull_encap_header(skb);
693 696
@@ -828,8 +831,11 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb,
828 if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) || 831 if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) ||
829 IS_PPPOE_IP(skb)) 832 IS_PPPOE_IP(skb))
830 pf = PF_INET; 833 pf = PF_INET;
831 else 834 else if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) ||
835 IS_PPPOE_IPV6(skb))
832 pf = PF_INET6; 836 pf = PF_INET6;
837 else
838 return NF_ACCEPT;
833 839
834#ifdef CONFIG_NETFILTER_DEBUG 840#ifdef CONFIG_NETFILTER_DEBUG
835 if (skb->dst == NULL) { 841 if (skb->dst == NULL) {
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 8a8743d7d6e7..820252aee81f 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -79,7 +79,7 @@ static inline int ebt_do_match (struct ebt_entry_match *m,
79{ 79{
80 par->match = m->u.match; 80 par->match = m->u.match;
81 par->matchinfo = m->data; 81 par->matchinfo = m->data;
82 return m->u.match->match(skb, par); 82 return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH;
83} 83}
84 84
85static inline int ebt_dev_check(char *entry, const struct net_device *device) 85static inline int ebt_dev_check(char *entry, const struct net_device *device)
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 1649c8ab2c2f..b7c7d4651136 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -347,51 +347,54 @@ static void bcm_tx_timeout_tsklet(unsigned long data)
347 struct bcm_op *op = (struct bcm_op *)data; 347 struct bcm_op *op = (struct bcm_op *)data;
348 struct bcm_msg_head msg_head; 348 struct bcm_msg_head msg_head;
349 349
350 /* create notification to user */
351 msg_head.opcode = TX_EXPIRED;
352 msg_head.flags = op->flags;
353 msg_head.count = op->count;
354 msg_head.ival1 = op->ival1;
355 msg_head.ival2 = op->ival2;
356 msg_head.can_id = op->can_id;
357 msg_head.nframes = 0;
358
359 bcm_send_to_user(op, &msg_head, NULL, 0);
360}
361
362/*
363 * bcm_tx_timeout_handler - performes cyclic CAN frame transmissions
364 */
365static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer)
366{
367 struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer);
368 enum hrtimer_restart ret = HRTIMER_NORESTART;
369
370 if (op->kt_ival1.tv64 && (op->count > 0)) { 350 if (op->kt_ival1.tv64 && (op->count > 0)) {
371 351
372 op->count--; 352 op->count--;
373 if (!op->count && (op->flags & TX_COUNTEVT)) 353 if (!op->count && (op->flags & TX_COUNTEVT)) {
374 tasklet_schedule(&op->tsklet); 354
355 /* create notification to user */
356 msg_head.opcode = TX_EXPIRED;
357 msg_head.flags = op->flags;
358 msg_head.count = op->count;
359 msg_head.ival1 = op->ival1;
360 msg_head.ival2 = op->ival2;
361 msg_head.can_id = op->can_id;
362 msg_head.nframes = 0;
363
364 bcm_send_to_user(op, &msg_head, NULL, 0);
365 }
375 } 366 }
376 367
377 if (op->kt_ival1.tv64 && (op->count > 0)) { 368 if (op->kt_ival1.tv64 && (op->count > 0)) {
378 369
379 /* send (next) frame */ 370 /* send (next) frame */
380 bcm_can_tx(op); 371 bcm_can_tx(op);
381 hrtimer_forward(hrtimer, ktime_get(), op->kt_ival1); 372 hrtimer_start(&op->timer,
382 ret = HRTIMER_RESTART; 373 ktime_add(ktime_get(), op->kt_ival1),
374 HRTIMER_MODE_ABS);
383 375
384 } else { 376 } else {
385 if (op->kt_ival2.tv64) { 377 if (op->kt_ival2.tv64) {
386 378
387 /* send (next) frame */ 379 /* send (next) frame */
388 bcm_can_tx(op); 380 bcm_can_tx(op);
389 hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2); 381 hrtimer_start(&op->timer,
390 ret = HRTIMER_RESTART; 382 ktime_add(ktime_get(), op->kt_ival2),
383 HRTIMER_MODE_ABS);
391 } 384 }
392 } 385 }
386}
393 387
394 return ret; 388/*
389 * bcm_tx_timeout_handler - performes cyclic CAN frame transmissions
390 */
391static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer)
392{
393 struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer);
394
395 tasklet_schedule(&op->tsklet);
396
397 return HRTIMER_NORESTART;
395} 398}
396 399
397/* 400/*
diff --git a/net/core/dev.c b/net/core/dev.c
index b715a55cccc4..8d675975d85b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2392,6 +2392,9 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2392 if (!(skb->dev->features & NETIF_F_GRO)) 2392 if (!(skb->dev->features & NETIF_F_GRO))
2393 goto normal; 2393 goto normal;
2394 2394
2395 if (skb_is_gso(skb) || skb_shinfo(skb)->frag_list)
2396 goto normal;
2397
2395 rcu_read_lock(); 2398 rcu_read_lock();
2396 list_for_each_entry_rcu(ptype, head, list) { 2399 list_for_each_entry_rcu(ptype, head, list) {
2397 struct sk_buff *p; 2400 struct sk_buff *p;
@@ -2488,12 +2491,6 @@ EXPORT_SYMBOL(napi_gro_receive);
2488 2491
2489void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) 2492void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
2490{ 2493{
2491 skb_shinfo(skb)->nr_frags = 0;
2492
2493 skb->len -= skb->data_len;
2494 skb->truesize -= skb->data_len;
2495 skb->data_len = 0;
2496
2497 __skb_pull(skb, skb_headlen(skb)); 2494 __skb_pull(skb, skb_headlen(skb));
2498 skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); 2495 skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb));
2499 2496
@@ -4434,6 +4431,45 @@ err_uninit:
4434} 4431}
4435 4432
4436/** 4433/**
4434 * init_dummy_netdev - init a dummy network device for NAPI
4435 * @dev: device to init
4436 *
4437 * This takes a network device structure and initialize the minimum
4438 * amount of fields so it can be used to schedule NAPI polls without
4439 * registering a full blown interface. This is to be used by drivers
4440 * that need to tie several hardware interfaces to a single NAPI
4441 * poll scheduler due to HW limitations.
4442 */
4443int init_dummy_netdev(struct net_device *dev)
4444{
4445 /* Clear everything. Note we don't initialize spinlocks
4446 * are they aren't supposed to be taken by any of the
4447 * NAPI code and this dummy netdev is supposed to be
4448 * only ever used for NAPI polls
4449 */
4450 memset(dev, 0, sizeof(struct net_device));
4451
4452 /* make sure we BUG if trying to hit standard
4453 * register/unregister code path
4454 */
4455 dev->reg_state = NETREG_DUMMY;
4456
4457 /* initialize the ref count */
4458 atomic_set(&dev->refcnt, 1);
4459
4460 /* NAPI wants this */
4461 INIT_LIST_HEAD(&dev->napi_list);
4462
4463 /* a dummy interface is started by default */
4464 set_bit(__LINK_STATE_PRESENT, &dev->state);
4465 set_bit(__LINK_STATE_START, &dev->state);
4466
4467 return 0;
4468}
4469EXPORT_SYMBOL_GPL(init_dummy_netdev);
4470
4471
4472/**
4437 * register_netdev - register a network device 4473 * register_netdev - register a network device
4438 * @dev: device to register 4474 * @dev: device to register
4439 * 4475 *
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5110b359c758..65eac7739033 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2602,6 +2602,12 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2602 skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); 2602 skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
2603 2603
2604 skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags; 2604 skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags;
2605 skb_shinfo(skb)->nr_frags = 0;
2606
2607 skb->truesize -= skb->data_len;
2608 skb->len -= skb->data_len;
2609 skb->data_len = 0;
2610
2605 NAPI_GRO_CB(skb)->free = 1; 2611 NAPI_GRO_CB(skb)->free = 1;
2606 goto done; 2612 goto done;
2607 } 2613 }
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
index c9224310ebae..52cb6939d093 100644
--- a/net/ipv4/netfilter/iptable_filter.c
+++ b/net/ipv4/netfilter/iptable_filter.c
@@ -93,13 +93,8 @@ ipt_local_out_hook(unsigned int hook,
93{ 93{
94 /* root is playing with raw sockets. */ 94 /* root is playing with raw sockets. */
95 if (skb->len < sizeof(struct iphdr) || 95 if (skb->len < sizeof(struct iphdr) ||
96 ip_hdrlen(skb) < sizeof(struct iphdr)) { 96 ip_hdrlen(skb) < sizeof(struct iphdr))
97 if (net_ratelimit())
98 printk("iptable_filter: ignoring short SOCK_RAW "
99 "packet.\n");
100 return NF_ACCEPT; 97 return NF_ACCEPT;
101 }
102
103 return ipt_do_table(skb, hook, in, out, 98 return ipt_do_table(skb, hook, in, out,
104 dev_net(out)->ipv4.iptable_filter); 99 dev_net(out)->ipv4.iptable_filter);
105} 100}
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index 69f2c4287146..3929d20b9e45 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -132,12 +132,8 @@ ipt_local_hook(unsigned int hook,
132 132
133 /* root is playing with raw sockets. */ 133 /* root is playing with raw sockets. */
134 if (skb->len < sizeof(struct iphdr) 134 if (skb->len < sizeof(struct iphdr)
135 || ip_hdrlen(skb) < sizeof(struct iphdr)) { 135 || ip_hdrlen(skb) < sizeof(struct iphdr))
136 if (net_ratelimit())
137 printk("iptable_mangle: ignoring short SOCK_RAW "
138 "packet.\n");
139 return NF_ACCEPT; 136 return NF_ACCEPT;
140 }
141 137
142 /* Save things which could affect route */ 138 /* Save things which could affect route */
143 mark = skb->mark; 139 mark = skb->mark;
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index 8faebfe638f1..7f65d18333e3 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -65,12 +65,8 @@ ipt_local_hook(unsigned int hook,
65{ 65{
66 /* root is playing with raw sockets. */ 66 /* root is playing with raw sockets. */
67 if (skb->len < sizeof(struct iphdr) || 67 if (skb->len < sizeof(struct iphdr) ||
68 ip_hdrlen(skb) < sizeof(struct iphdr)) { 68 ip_hdrlen(skb) < sizeof(struct iphdr))
69 if (net_ratelimit())
70 printk("iptable_raw: ignoring short SOCK_RAW "
71 "packet.\n");
72 return NF_ACCEPT; 69 return NF_ACCEPT;
73 }
74 return ipt_do_table(skb, hook, in, out, 70 return ipt_do_table(skb, hook, in, out,
75 dev_net(out)->ipv4.iptable_raw); 71 dev_net(out)->ipv4.iptable_raw);
76} 72}
diff --git a/net/ipv4/netfilter/iptable_security.c b/net/ipv4/netfilter/iptable_security.c
index 36f3be3cc428..a52a35f4a584 100644
--- a/net/ipv4/netfilter/iptable_security.c
+++ b/net/ipv4/netfilter/iptable_security.c
@@ -96,12 +96,8 @@ ipt_local_out_hook(unsigned int hook,
96{ 96{
97 /* Somebody is playing with raw sockets. */ 97 /* Somebody is playing with raw sockets. */
98 if (skb->len < sizeof(struct iphdr) 98 if (skb->len < sizeof(struct iphdr)
99 || ip_hdrlen(skb) < sizeof(struct iphdr)) { 99 || ip_hdrlen(skb) < sizeof(struct iphdr))
100 if (net_ratelimit())
101 printk(KERN_INFO "iptable_security: ignoring short "
102 "SOCK_RAW packet.\n");
103 return NF_ACCEPT; 100 return NF_ACCEPT;
104 }
105 return ipt_do_table(skb, hook, in, out, 101 return ipt_do_table(skb, hook, in, out,
106 dev_net(out)->ipv4.iptable_security); 102 dev_net(out)->ipv4.iptable_security);
107} 103}
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index b2141e11575e..4beb04fac588 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -145,11 +145,8 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum,
145{ 145{
146 /* root is playing with raw sockets. */ 146 /* root is playing with raw sockets. */
147 if (skb->len < sizeof(struct iphdr) || 147 if (skb->len < sizeof(struct iphdr) ||
148 ip_hdrlen(skb) < sizeof(struct iphdr)) { 148 ip_hdrlen(skb) < sizeof(struct iphdr))
149 if (net_ratelimit())
150 printk("ipt_hook: happy cracking.\n");
151 return NF_ACCEPT; 149 return NF_ACCEPT;
152 }
153 return nf_conntrack_in(dev_net(out), PF_INET, hooknum, skb); 150 return nf_conntrack_in(dev_net(out), PF_INET, hooknum, skb);
154} 151}
155 152
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 1fd3ef7718b6..2a8bee26f43d 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -20,7 +20,7 @@
20#include <net/netfilter/nf_conntrack_core.h> 20#include <net/netfilter/nf_conntrack_core.h>
21#include <net/netfilter/nf_log.h> 21#include <net/netfilter/nf_log.h>
22 22
23static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; 23static unsigned int nf_ct_icmp_timeout __read_mostly = 30*HZ;
24 24
25static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, 25static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
26 struct nf_conntrack_tuple *tuple) 26 struct nf_conntrack_tuple *tuple)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index ce572f9dff02..0cd71b84e483 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -522,8 +522,12 @@ static int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
522 unsigned int offset, size_t len) 522 unsigned int offset, size_t len)
523{ 523{
524 struct tcp_splice_state *tss = rd_desc->arg.data; 524 struct tcp_splice_state *tss = rd_desc->arg.data;
525 int ret;
525 526
526 return skb_splice_bits(skb, offset, tss->pipe, tss->len, tss->flags); 527 ret = skb_splice_bits(skb, offset, tss->pipe, rd_desc->count, tss->flags);
528 if (ret > 0)
529 rd_desc->count -= ret;
530 return ret;
527} 531}
528 532
529static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss) 533static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss)
@@ -531,6 +535,7 @@ static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss)
531 /* Store TCP splice context information in read_descriptor_t. */ 535 /* Store TCP splice context information in read_descriptor_t. */
532 read_descriptor_t rd_desc = { 536 read_descriptor_t rd_desc = {
533 .arg.data = tss, 537 .arg.data = tss,
538 .count = tss->len,
534 }; 539 };
535 540
536 return tcp_read_sock(sk, &rd_desc, tcp_splice_data_recv); 541 return tcp_read_sock(sk, &rd_desc, tcp_splice_data_recv);
@@ -611,11 +616,13 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
611 tss.len -= ret; 616 tss.len -= ret;
612 spliced += ret; 617 spliced += ret;
613 618
619 if (!timeo)
620 break;
614 release_sock(sk); 621 release_sock(sk);
615 lock_sock(sk); 622 lock_sock(sk);
616 623
617 if (sk->sk_err || sk->sk_state == TCP_CLOSE || 624 if (sk->sk_err || sk->sk_state == TCP_CLOSE ||
618 (sk->sk_shutdown & RCV_SHUTDOWN) || !timeo || 625 (sk->sk_shutdown & RCV_SHUTDOWN) ||
619 signal_pending(current)) 626 signal_pending(current))
620 break; 627 break;
621 } 628 }
@@ -2382,7 +2389,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2382 unsigned int seq; 2389 unsigned int seq;
2383 __be32 delta; 2390 __be32 delta;
2384 unsigned int oldlen; 2391 unsigned int oldlen;
2385 unsigned int len; 2392 unsigned int mss;
2386 2393
2387 if (!pskb_may_pull(skb, sizeof(*th))) 2394 if (!pskb_may_pull(skb, sizeof(*th)))
2388 goto out; 2395 goto out;
@@ -2398,10 +2405,13 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2398 oldlen = (u16)~skb->len; 2405 oldlen = (u16)~skb->len;
2399 __skb_pull(skb, thlen); 2406 __skb_pull(skb, thlen);
2400 2407
2408 mss = skb_shinfo(skb)->gso_size;
2409 if (unlikely(skb->len <= mss))
2410 goto out;
2411
2401 if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) { 2412 if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
2402 /* Packet is from an untrusted source, reset gso_segs. */ 2413 /* Packet is from an untrusted source, reset gso_segs. */
2403 int type = skb_shinfo(skb)->gso_type; 2414 int type = skb_shinfo(skb)->gso_type;
2404 int mss;
2405 2415
2406 if (unlikely(type & 2416 if (unlikely(type &
2407 ~(SKB_GSO_TCPV4 | 2417 ~(SKB_GSO_TCPV4 |
@@ -2412,7 +2422,6 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2412 !(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))) 2422 !(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))))
2413 goto out; 2423 goto out;
2414 2424
2415 mss = skb_shinfo(skb)->gso_size;
2416 skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss); 2425 skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
2417 2426
2418 segs = NULL; 2427 segs = NULL;
@@ -2423,8 +2432,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2423 if (IS_ERR(segs)) 2432 if (IS_ERR(segs))
2424 goto out; 2433 goto out;
2425 2434
2426 len = skb_shinfo(skb)->gso_size; 2435 delta = htonl(oldlen + (thlen + mss));
2427 delta = htonl(oldlen + (thlen + len));
2428 2436
2429 skb = segs; 2437 skb = segs;
2430 th = tcp_hdr(skb); 2438 th = tcp_hdr(skb);
@@ -2440,7 +2448,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2440 csum_fold(csum_partial(skb_transport_header(skb), 2448 csum_fold(csum_partial(skb_transport_header(skb),
2441 thlen, skb->csum)); 2449 thlen, skb->csum));
2442 2450
2443 seq += len; 2451 seq += mss;
2444 skb = skb->next; 2452 skb = skb->next;
2445 th = tcp_hdr(skb); 2453 th = tcp_hdr(skb);
2446 2454
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 29c7c99e69f7..52ee1dced2ff 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -298,6 +298,10 @@ static void fib6_dump_end(struct netlink_callback *cb)
298 struct fib6_walker_t *w = (void*)cb->args[2]; 298 struct fib6_walker_t *w = (void*)cb->args[2];
299 299
300 if (w) { 300 if (w) {
301 if (cb->args[4]) {
302 cb->args[4] = 0;
303 fib6_walker_unlink(w);
304 }
301 cb->args[2] = 0; 305 cb->args[2] = 0;
302 kfree(w); 306 kfree(w);
303 } 307 }
@@ -330,15 +334,12 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb,
330 read_lock_bh(&table->tb6_lock); 334 read_lock_bh(&table->tb6_lock);
331 res = fib6_walk_continue(w); 335 res = fib6_walk_continue(w);
332 read_unlock_bh(&table->tb6_lock); 336 read_unlock_bh(&table->tb6_lock);
333 if (res != 0) { 337 if (res <= 0) {
334 if (res < 0) 338 fib6_walker_unlink(w);
335 fib6_walker_unlink(w); 339 cb->args[4] = 0;
336 goto end;
337 } 340 }
338 fib6_walker_unlink(w);
339 cb->args[4] = 0;
340 } 341 }
341end: 342
342 return res; 343 return res;
343} 344}
344 345
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index bd52151d31e9..c455cf4ee756 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -26,7 +26,7 @@
26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> 26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
27#include <net/netfilter/nf_log.h> 27#include <net/netfilter/nf_log.h>
28 28
29static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; 29static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ;
30 30
31static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, 31static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
32 unsigned int dataoff, 32 unsigned int dataoff,
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 5f510a13b9f0..c5c0c5271096 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -469,7 +469,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
469 struct ieee80211_sub_if_data *sdata; 469 struct ieee80211_sub_if_data *sdata;
470 u16 start_seq_num; 470 u16 start_seq_num;
471 u8 *state; 471 u8 *state;
472 int ret; 472 int ret = 0;
473 473
474 if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) 474 if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION))
475 return -EINVAL; 475 return -EINVAL;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 5abbc3f07dd6..b9074824862a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -699,7 +699,8 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
699 return 0; 699 return 0;
700 700
701 /* Setting ad-hoc mode on non-IBSS channel is not supported. */ 701 /* Setting ad-hoc mode on non-IBSS channel is not supported. */
702 if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS) 702 if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS &&
703 type == NL80211_IFTYPE_ADHOC)
703 return -EOPNOTSUPP; 704 return -EOPNOTSUPP;
704 705
705 /* 706 /*
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 929ba542fd72..1159bdb4119c 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -107,6 +107,7 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
107 107
108 sta->flags = WLAN_STA_AUTHORIZED; 108 sta->flags = WLAN_STA_AUTHORIZED;
109 sta->sta.supp_rates[local->hw.conf.channel->band] = rates; 109 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
110 rate_control_rate_init(sta);
110 111
111 return sta; 112 return sta;
112} 113}
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 2b3b490a6073..3824990d340b 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -395,13 +395,15 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
395{ 395{
396 struct minstrel_sta_info *mi = priv_sta; 396 struct minstrel_sta_info *mi = priv_sta;
397 struct minstrel_priv *mp = priv; 397 struct minstrel_priv *mp = priv;
398 struct minstrel_rate *mr_ctl; 398 struct ieee80211_local *local = hw_to_local(mp->hw);
399 struct ieee80211_rate *ctl_rate;
399 unsigned int i, n = 0; 400 unsigned int i, n = 0;
400 unsigned int t_slot = 9; /* FIXME: get real slot time */ 401 unsigned int t_slot = 9; /* FIXME: get real slot time */
401 402
402 mi->lowest_rix = rate_lowest_index(sband, sta); 403 mi->lowest_rix = rate_lowest_index(sband, sta);
403 mr_ctl = &mi->r[rix_to_ndx(mi, mi->lowest_rix)]; 404 ctl_rate = &sband->bitrates[mi->lowest_rix];
404 mi->sp_ack_dur = mr_ctl->ack_time; 405 mi->sp_ack_dur = ieee80211_frame_duration(local, 10, ctl_rate->bitrate,
406 !!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1);
405 407
406 for (i = 0; i < sband->n_bitrates; i++) { 408 for (i = 0; i < sband->n_bitrates; i++) {
407 struct minstrel_rate *mr = &mi->r[n]; 409 struct minstrel_rate *mr = &mi->r[n];
@@ -416,7 +418,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
416 418
417 mr->rix = i; 419 mr->rix = i;
418 mr->bitrate = sband->bitrates[i].bitrate / 5; 420 mr->bitrate = sband->bitrates[i].bitrate / 5;
419 calc_rate_durations(mi, hw_to_local(mp->hw), mr, 421 calc_rate_durations(mi, local, mr,
420 &sband->bitrates[i]); 422 &sband->bitrates[i]);
421 423
422 /* calculate maximum number of retransmissions before 424 /* calculate maximum number of retransmissions before
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 7e83f74cd5de..90ce9ddb9451 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -469,7 +469,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
469 const struct nf_conntrack_tuple *repl, 469 const struct nf_conntrack_tuple *repl,
470 gfp_t gfp) 470 gfp_t gfp)
471{ 471{
472 struct nf_conn *ct = NULL; 472 struct nf_conn *ct;
473 473
474 if (unlikely(!nf_conntrack_hash_rnd_initted)) { 474 if (unlikely(!nf_conntrack_hash_rnd_initted)) {
475 get_random_bytes(&nf_conntrack_hash_rnd, 4); 475 get_random_bytes(&nf_conntrack_hash_rnd, 4);
@@ -551,7 +551,7 @@ init_conntrack(struct net *net,
551 } 551 }
552 552
553 ct = nf_conntrack_alloc(net, tuple, &repl_tuple, GFP_ATOMIC); 553 ct = nf_conntrack_alloc(net, tuple, &repl_tuple, GFP_ATOMIC);
554 if (ct == NULL || IS_ERR(ct)) { 554 if (IS_ERR(ct)) {
555 pr_debug("Can't allocate conntrack.\n"); 555 pr_debug("Can't allocate conntrack.\n");
556 return (struct nf_conntrack_tuple_hash *)ct; 556 return (struct nf_conntrack_tuple_hash *)ct;
557 } 557 }
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 00e8c27130ff..3dddec6d2f7e 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1134,7 +1134,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1134 struct nf_conntrack_helper *helper; 1134 struct nf_conntrack_helper *helper;
1135 1135
1136 ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_ATOMIC); 1136 ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_ATOMIC);
1137 if (ct == NULL || IS_ERR(ct)) 1137 if (IS_ERR(ct))
1138 return -ENOMEM; 1138 return -ENOMEM;
1139 1139
1140 if (!cda[CTA_TIMEOUT]) 1140 if (!cda[CTA_TIMEOUT])
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 89837a4eef76..bfbf521f6ea5 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -273,6 +273,10 @@ static int match_revfn(u8 af, const char *name, u8 revision, int *bestp)
273 have_rev = 1; 273 have_rev = 1;
274 } 274 }
275 } 275 }
276
277 if (af != NFPROTO_UNSPEC && !have_rev)
278 return match_revfn(NFPROTO_UNSPEC, name, revision, bestp);
279
276 return have_rev; 280 return have_rev;
277} 281}
278 282
@@ -289,6 +293,10 @@ static int target_revfn(u8 af, const char *name, u8 revision, int *bestp)
289 have_rev = 1; 293 have_rev = 1;
290 } 294 }
291 } 295 }
296
297 if (af != NFPROTO_UNSPEC && !have_rev)
298 return target_revfn(NFPROTO_UNSPEC, name, revision, bestp);
299
292 return have_rev; 300 return have_rev;
293} 301}
294 302
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index 29375ba8db73..93acaa59d108 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -243,6 +243,17 @@ static struct xt_match xt_time_mt_reg __read_mostly = {
243 243
244static int __init time_mt_init(void) 244static int __init time_mt_init(void)
245{ 245{
246 int minutes = sys_tz.tz_minuteswest;
247
248 if (minutes < 0) /* east of Greenwich */
249 printk(KERN_INFO KBUILD_MODNAME
250 ": kernel timezone is +%02d%02d\n",
251 -minutes / 60, -minutes % 60);
252 else /* west of Greenwich */
253 printk(KERN_INFO KBUILD_MODNAME
254 ": kernel timezone is -%02d%02d\n",
255 minutes / 60, minutes % 60);
256
246 return xt_register_match(&xt_time_mt_reg); 257 return xt_register_match(&xt_time_mt_reg);
247} 258}
248 259
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 5070643ce534..2f0f0b04d3fb 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -661,12 +661,13 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
661 * next pending event (0 for no event in pq). 661 * next pending event (0 for no event in pq).
662 * Note: Applied are events whose have cl->pq_key <= q->now. 662 * Note: Applied are events whose have cl->pq_key <= q->now.
663 */ 663 */
664static psched_time_t htb_do_events(struct htb_sched *q, int level) 664static psched_time_t htb_do_events(struct htb_sched *q, int level,
665 unsigned long start)
665{ 666{
666 /* don't run for longer than 2 jiffies; 2 is used instead of 667 /* don't run for longer than 2 jiffies; 2 is used instead of
667 1 to simplify things when jiffy is going to be incremented 668 1 to simplify things when jiffy is going to be incremented
668 too soon */ 669 too soon */
669 unsigned long stop_at = jiffies + 2; 670 unsigned long stop_at = start + 2;
670 while (time_before(jiffies, stop_at)) { 671 while (time_before(jiffies, stop_at)) {
671 struct htb_class *cl; 672 struct htb_class *cl;
672 long diff; 673 long diff;
@@ -685,8 +686,8 @@ static psched_time_t htb_do_events(struct htb_sched *q, int level)
685 if (cl->cmode != HTB_CAN_SEND) 686 if (cl->cmode != HTB_CAN_SEND)
686 htb_add_to_wait_tree(q, cl, diff); 687 htb_add_to_wait_tree(q, cl, diff);
687 } 688 }
688 /* too much load - let's continue on next jiffie */ 689 /* too much load - let's continue on next jiffie (including above) */
689 return q->now + PSCHED_TICKS_PER_SEC / HZ; 690 return q->now + 2 * PSCHED_TICKS_PER_SEC / HZ;
690} 691}
691 692
692/* Returns class->node+prio from id-tree where classe's id is >= id. NULL 693/* Returns class->node+prio from id-tree where classe's id is >= id. NULL
@@ -845,6 +846,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
845 struct htb_sched *q = qdisc_priv(sch); 846 struct htb_sched *q = qdisc_priv(sch);
846 int level; 847 int level;
847 psched_time_t next_event; 848 psched_time_t next_event;
849 unsigned long start_at;
848 850
849 /* try to dequeue direct packets as high prio (!) to minimize cpu work */ 851 /* try to dequeue direct packets as high prio (!) to minimize cpu work */
850 skb = __skb_dequeue(&q->direct_queue); 852 skb = __skb_dequeue(&q->direct_queue);
@@ -857,6 +859,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
857 if (!sch->q.qlen) 859 if (!sch->q.qlen)
858 goto fin; 860 goto fin;
859 q->now = psched_get_time(); 861 q->now = psched_get_time();
862 start_at = jiffies;
860 863
861 next_event = q->now + 5 * PSCHED_TICKS_PER_SEC; 864 next_event = q->now + 5 * PSCHED_TICKS_PER_SEC;
862 865
@@ -866,14 +869,14 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
866 psched_time_t event; 869 psched_time_t event;
867 870
868 if (q->now >= q->near_ev_cache[level]) { 871 if (q->now >= q->near_ev_cache[level]) {
869 event = htb_do_events(q, level); 872 event = htb_do_events(q, level, start_at);
870 if (!event) 873 if (!event)
871 event = q->now + PSCHED_TICKS_PER_SEC; 874 event = q->now + PSCHED_TICKS_PER_SEC;
872 q->near_ev_cache[level] = event; 875 q->near_ev_cache[level] = event;
873 } else 876 } else
874 event = q->near_ev_cache[level]; 877 event = q->near_ev_cache[level];
875 878
876 if (event && next_event > event) 879 if (next_event > event)
877 next_event = event; 880 next_event = event;
878 881
879 m = ~q->row_mask[level]; 882 m = ~q->row_mask[level];
diff --git a/net/socket.c b/net/socket.c
index 06603d73c411..35dd7371752a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1214,7 +1214,7 @@ int sock_create_kern(int family, int type, int protocol, struct socket **res)
1214 return __sock_create(&init_net, family, type, protocol, res, 1); 1214 return __sock_create(&init_net, family, type, protocol, res, 1);
1215} 1215}
1216 1216
1217asmlinkage long sys_socket(int family, int type, int protocol) 1217SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
1218{ 1218{
1219 int retval; 1219 int retval;
1220 struct socket *sock; 1220 struct socket *sock;
@@ -1255,8 +1255,8 @@ out_release:
1255 * Create a pair of connected sockets. 1255 * Create a pair of connected sockets.
1256 */ 1256 */
1257 1257
1258asmlinkage long sys_socketpair(int family, int type, int protocol, 1258SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
1259 int __user *usockvec) 1259 int __user *, usockvec)
1260{ 1260{
1261 struct socket *sock1, *sock2; 1261 struct socket *sock1, *sock2;
1262 int fd1, fd2, err; 1262 int fd1, fd2, err;
@@ -1356,7 +1356,7 @@ out_fd1:
1356 * the protocol layer (having also checked the address is ok). 1356 * the protocol layer (having also checked the address is ok).
1357 */ 1357 */
1358 1358
1359asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen) 1359SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
1360{ 1360{
1361 struct socket *sock; 1361 struct socket *sock;
1362 struct sockaddr_storage address; 1362 struct sockaddr_storage address;
@@ -1385,7 +1385,7 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
1385 * ready for listening. 1385 * ready for listening.
1386 */ 1386 */
1387 1387
1388asmlinkage long sys_listen(int fd, int backlog) 1388SYSCALL_DEFINE2(listen, int, fd, int, backlog)
1389{ 1389{
1390 struct socket *sock; 1390 struct socket *sock;
1391 int err, fput_needed; 1391 int err, fput_needed;
@@ -1418,8 +1418,8 @@ asmlinkage long sys_listen(int fd, int backlog)
1418 * clean when we restucture accept also. 1418 * clean when we restucture accept also.
1419 */ 1419 */
1420 1420
1421asmlinkage long sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, 1421SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
1422 int __user *upeer_addrlen, int flags) 1422 int __user *, upeer_addrlen, int, flags)
1423{ 1423{
1424 struct socket *sock, *newsock; 1424 struct socket *sock, *newsock;
1425 struct file *newfile; 1425 struct file *newfile;
@@ -1502,8 +1502,8 @@ out_fd:
1502 goto out_put; 1502 goto out_put;
1503} 1503}
1504 1504
1505asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, 1505SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr,
1506 int __user *upeer_addrlen) 1506 int __user *, upeer_addrlen)
1507{ 1507{
1508 return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0); 1508 return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0);
1509} 1509}
@@ -1520,8 +1520,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
1520 * include the -EINPROGRESS status for such sockets. 1520 * include the -EINPROGRESS status for such sockets.
1521 */ 1521 */
1522 1522
1523asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, 1523SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr,
1524 int addrlen) 1524 int, addrlen)
1525{ 1525{
1526 struct socket *sock; 1526 struct socket *sock;
1527 struct sockaddr_storage address; 1527 struct sockaddr_storage address;
@@ -1552,8 +1552,8 @@ out:
1552 * name to user space. 1552 * name to user space.
1553 */ 1553 */
1554 1554
1555asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, 1555SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr,
1556 int __user *usockaddr_len) 1556 int __user *, usockaddr_len)
1557{ 1557{
1558 struct socket *sock; 1558 struct socket *sock;
1559 struct sockaddr_storage address; 1559 struct sockaddr_storage address;
@@ -1583,8 +1583,8 @@ out:
1583 * name to user space. 1583 * name to user space.
1584 */ 1584 */
1585 1585
1586asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, 1586SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
1587 int __user *usockaddr_len) 1587 int __user *, usockaddr_len)
1588{ 1588{
1589 struct socket *sock; 1589 struct socket *sock;
1590 struct sockaddr_storage address; 1590 struct sockaddr_storage address;
@@ -1615,9 +1615,9 @@ asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr,
1615 * the protocol. 1615 * the protocol.
1616 */ 1616 */
1617 1617
1618asmlinkage long sys_sendto(int fd, void __user *buff, size_t len, 1618SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
1619 unsigned flags, struct sockaddr __user *addr, 1619 unsigned, flags, struct sockaddr __user *, addr,
1620 int addr_len) 1620 int, addr_len)
1621{ 1621{
1622 struct socket *sock; 1622 struct socket *sock;
1623 struct sockaddr_storage address; 1623 struct sockaddr_storage address;
@@ -1660,7 +1660,8 @@ out:
1660 * Send a datagram down a socket. 1660 * Send a datagram down a socket.
1661 */ 1661 */
1662 1662
1663asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags) 1663SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
1664 unsigned, flags)
1664{ 1665{
1665 return sys_sendto(fd, buff, len, flags, NULL, 0); 1666 return sys_sendto(fd, buff, len, flags, NULL, 0);
1666} 1667}
@@ -1671,9 +1672,9 @@ asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags)
1671 * sender address from kernel to user space. 1672 * sender address from kernel to user space.
1672 */ 1673 */
1673 1674
1674asmlinkage long sys_recvfrom(int fd, void __user *ubuf, size_t size, 1675SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
1675 unsigned flags, struct sockaddr __user *addr, 1676 unsigned, flags, struct sockaddr __user *, addr,
1676 int __user *addr_len) 1677 int __user *, addr_len)
1677{ 1678{
1678 struct socket *sock; 1679 struct socket *sock;
1679 struct iovec iov; 1680 struct iovec iov;
@@ -1725,8 +1726,8 @@ asmlinkage long sys_recv(int fd, void __user *ubuf, size_t size,
1725 * to pass the user mode parameter for the protocols to sort out. 1726 * to pass the user mode parameter for the protocols to sort out.
1726 */ 1727 */
1727 1728
1728asmlinkage long sys_setsockopt(int fd, int level, int optname, 1729SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
1729 char __user *optval, int optlen) 1730 char __user *, optval, int, optlen)
1730{ 1731{
1731 int err, fput_needed; 1732 int err, fput_needed;
1732 struct socket *sock; 1733 struct socket *sock;
@@ -1759,8 +1760,8 @@ out_put:
1759 * to pass a user mode parameter for the protocols to sort out. 1760 * to pass a user mode parameter for the protocols to sort out.
1760 */ 1761 */
1761 1762
1762asmlinkage long sys_getsockopt(int fd, int level, int optname, 1763SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
1763 char __user *optval, int __user *optlen) 1764 char __user *, optval, int __user *, optlen)
1764{ 1765{
1765 int err, fput_needed; 1766 int err, fput_needed;
1766 struct socket *sock; 1767 struct socket *sock;
@@ -1789,7 +1790,7 @@ out_put:
1789 * Shutdown a socket. 1790 * Shutdown a socket.
1790 */ 1791 */
1791 1792
1792asmlinkage long sys_shutdown(int fd, int how) 1793SYSCALL_DEFINE2(shutdown, int, fd, int, how)
1793{ 1794{
1794 int err, fput_needed; 1795 int err, fput_needed;
1795 struct socket *sock; 1796 struct socket *sock;
@@ -1815,7 +1816,7 @@ asmlinkage long sys_shutdown(int fd, int how)
1815 * BSD sendmsg interface 1816 * BSD sendmsg interface
1816 */ 1817 */
1817 1818
1818asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags) 1819SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags)
1819{ 1820{
1820 struct compat_msghdr __user *msg_compat = 1821 struct compat_msghdr __user *msg_compat =
1821 (struct compat_msghdr __user *)msg; 1822 (struct compat_msghdr __user *)msg;
@@ -1921,8 +1922,8 @@ out:
1921 * BSD recvmsg interface 1922 * BSD recvmsg interface
1922 */ 1923 */
1923 1924
1924asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, 1925SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg,
1925 unsigned int flags) 1926 unsigned int, flags)
1926{ 1927{
1927 struct compat_msghdr __user *msg_compat = 1928 struct compat_msghdr __user *msg_compat =
1928 (struct compat_msghdr __user *)msg; 1929 (struct compat_msghdr __user *)msg;
@@ -2045,7 +2046,7 @@ static const unsigned char nargs[19]={
2045 * it is set by the callees. 2046 * it is set by the callees.
2046 */ 2047 */
2047 2048
2048asmlinkage long sys_socketcall(int call, unsigned long __user *args) 2049SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2049{ 2050{
2050 unsigned long a[6]; 2051 unsigned long a[6];
2051 unsigned long a0, a1; 2052 unsigned long a0, a1;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b95a2d64eb59..7877e7975dae 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1914,10 +1914,17 @@ static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1914} 1914}
1915#endif 1915#endif
1916 1916
1917/* For the xfrm_usersa_info cases we have to work around some 32-bit vs.
1918 * 64-bit compatability issues. On 32-bit the structure is 220 bytes, but
1919 * for 64-bit it gets padded out to 224 bytes. Those bytes are just
1920 * padding and don't have any content we care about. Therefore as long
1921 * as we have enough bytes for the content we can make both cases work.
1922 */
1923
1917#define XMSGSIZE(type) sizeof(struct type) 1924#define XMSGSIZE(type) sizeof(struct type)
1918 1925
1919static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { 1926static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = {
1920 [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), 1927 [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = 220, /* see above */
1921 [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), 1928 [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id),
1922 [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), 1929 [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id),
1923 [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), 1930 [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info),
@@ -1927,7 +1934,7 @@ static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = {
1927 [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire), 1934 [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire),
1928 [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire), 1935 [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire),
1929 [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), 1936 [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info),
1930 [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), 1937 [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = 220, /* see above */
1931 [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire), 1938 [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire),
1932 [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush), 1939 [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush),
1933 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0, 1940 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0,
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7bed4ed2c519..45eb0ae98eba 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -10,7 +10,7 @@ use strict;
10my $P = $0; 10my $P = $0;
11$P =~ s@.*/@@g; 11$P =~ s@.*/@@g;
12 12
13my $V = '0.26'; 13my $V = '0.27';
14 14
15use Getopt::Long qw(:config no_auto_abbrev); 15use Getopt::Long qw(:config no_auto_abbrev);
16 16
@@ -411,13 +411,15 @@ sub ctx_statement_block {
411 411
412 my $type = ''; 412 my $type = '';
413 my $level = 0; 413 my $level = 0;
414 my @stack = ([$type, $level]); 414 my @stack = ();
415 my $p; 415 my $p;
416 my $c; 416 my $c;
417 my $len = 0; 417 my $len = 0;
418 418
419 my $remainder; 419 my $remainder;
420 while (1) { 420 while (1) {
421 @stack = (['', 0]) if ($#stack == -1);
422
421 #warn "CSB: blk<$blk> remain<$remain>\n"; 423 #warn "CSB: blk<$blk> remain<$remain>\n";
422 # If we are about to drop off the end, pull in more 424 # If we are about to drop off the end, pull in more
423 # context. 425 # context.
@@ -1663,7 +1665,7 @@ sub process {
1663 # Should not end with a space. 1665 # Should not end with a space.
1664 $to =~ s/\s+$//; 1666 $to =~ s/\s+$//;
1665 # '*'s should not have spaces between. 1667 # '*'s should not have spaces between.
1666 while ($to =~ s/(.)\s\*/$1\*/) { 1668 while ($to =~ s/\*\s+\*/\*\*/) {
1667 } 1669 }
1668 1670
1669 #print "from<$from> to<$to>\n"; 1671 #print "from<$from> to<$to>\n";
@@ -1678,7 +1680,7 @@ sub process {
1678 # Should not end with a space. 1680 # Should not end with a space.
1679 $to =~ s/\s+$//; 1681 $to =~ s/\s+$//;
1680 # '*'s should not have spaces between. 1682 # '*'s should not have spaces between.
1681 while ($to =~ s/(.)\s\*/$1\*/) { 1683 while ($to =~ s/\*\s+\*/\*\*/) {
1682 } 1684 }
1683 # Modifiers should have spaces. 1685 # Modifiers should have spaces.
1684 $to =~ s/(\b$Modifier$)/$1 /; 1686 $to =~ s/(\b$Modifier$)/$1 /;
@@ -2014,7 +2016,11 @@ sub process {
2014 2016
2015 # Flatten any parentheses 2017 # Flatten any parentheses
2016 $value =~ s/\)\(/\) \(/g; 2018 $value =~ s/\)\(/\) \(/g;
2017 while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) { 2019 while ($value =~ s/\[[^\{\}]*\]/1/ ||
2020 $value !~ /(?:$Ident|-?$Constant)\s*
2021 $Compare\s*
2022 (?:$Ident|-?$Constant)/x &&
2023 $value =~ s/\([^\(\)]*\)/1/) {
2018 } 2024 }
2019 2025
2020 if ($value =~ /^(?:$Ident|-?$Constant)$/) { 2026 if ($value =~ /^(?:$Ident|-?$Constant)$/) {
@@ -2102,6 +2108,11 @@ sub process {
2102 ERROR("trailing statements should be on next line\n" . $herecurr); 2108 ERROR("trailing statements should be on next line\n" . $herecurr);
2103 } 2109 }
2104 } 2110 }
2111# if should not continue a brace
2112 if ($line =~ /}\s*if\b/) {
2113 ERROR("trailing statements should be on next line\n" .
2114 $herecurr);
2115 }
2105# case and default should not have general statements after them 2116# case and default should not have general statements after them
2106 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && 2117 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
2107 $line !~ /\G(?: 2118 $line !~ /\G(?:
@@ -2516,9 +2527,10 @@ sub process {
2516 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); 2527 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
2517 } 2528 }
2518# check for struct file_operations, ensure they are const. 2529# check for struct file_operations, ensure they are const.
2519 if ($line =~ /\bstruct\s+file_operations\b/ && 2530 if ($line !~ /\bconst\b/ &&
2520 $line !~ /\bconst\b/) { 2531 $line =~ /\bstruct\s+(file_operations|seq_operations)\b/) {
2521 WARN("struct file_operations should normally be const\n" . $herecurr); 2532 WARN("struct $1 should normally be const\n" .
2533 $herecurr);
2522 } 2534 }
2523 2535
2524# use of NR_CPUS is usually wrong 2536# use of NR_CPUS is usually wrong
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 09796797d122..e9335e1c6cf5 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -54,11 +54,11 @@ static int key_get_type_from_user(char *type,
54 * - returns the new key's serial number 54 * - returns the new key's serial number
55 * - implements add_key() 55 * - implements add_key()
56 */ 56 */
57asmlinkage long sys_add_key(const char __user *_type, 57SYSCALL_DEFINE5(add_key, const char __user *, _type,
58 const char __user *_description, 58 const char __user *, _description,
59 const void __user *_payload, 59 const void __user *, _payload,
60 size_t plen, 60 size_t, plen,
61 key_serial_t ringid) 61 key_serial_t, ringid)
62{ 62{
63 key_ref_t keyring_ref, key_ref; 63 key_ref_t keyring_ref, key_ref;
64 char type[32], *description; 64 char type[32], *description;
@@ -146,10 +146,10 @@ asmlinkage long sys_add_key(const char __user *_type,
146 * - if the _callout_info string is empty, it will be rendered as "-" 146 * - if the _callout_info string is empty, it will be rendered as "-"
147 * - implements request_key() 147 * - implements request_key()
148 */ 148 */
149asmlinkage long sys_request_key(const char __user *_type, 149SYSCALL_DEFINE4(request_key, const char __user *, _type,
150 const char __user *_description, 150 const char __user *, _description,
151 const char __user *_callout_info, 151 const char __user *, _callout_info,
152 key_serial_t destringid) 152 key_serial_t, destringid)
153{ 153{
154 struct key_type *ktype; 154 struct key_type *ktype;
155 struct key *key; 155 struct key *key;
@@ -1216,8 +1216,8 @@ long keyctl_get_security(key_serial_t keyid,
1216/* 1216/*
1217 * the key control system call 1217 * the key control system call
1218 */ 1218 */
1219asmlinkage long sys_keyctl(int option, unsigned long arg2, unsigned long arg3, 1219SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
1220 unsigned long arg4, unsigned long arg5) 1220 unsigned long, arg4, unsigned long, arg5)
1221{ 1221{
1222 switch (option) { 1222 switch (option) {
1223 case KEYCTL_GET_KEYRING_ID: 1223 case KEYCTL_GET_KEYRING_ID:
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 3c596da2b9b5..b7bba7dc7cf1 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2724,6 +2724,67 @@ int snd_hda_check_board_config(struct hda_codec *codec,
2724EXPORT_SYMBOL_HDA(snd_hda_check_board_config); 2724EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
2725 2725
2726/** 2726/**
2727 * snd_hda_check_board_codec_sid_config - compare the current codec
2728 subsystem ID with the
2729 config table
2730
2731 This is important for Gateway notebooks with SB450 HDA Audio
2732 where the vendor ID of the PCI device is:
2733 ATI Technologies Inc SB450 HDA Audio [1002:437b]
2734 and the vendor/subvendor are found only at the codec.
2735
2736 * @codec: the HDA codec
2737 * @num_configs: number of config enums
2738 * @models: array of model name strings
2739 * @tbl: configuration table, terminated by null entries
2740 *
2741 * Compares the modelname or PCI subsystem id of the current codec with the
2742 * given configuration table. If a matching entry is found, returns its
2743 * config value (supposed to be 0 or positive).
2744 *
2745 * If no entries are matching, the function returns a negative value.
2746 */
2747int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
2748 int num_configs, const char **models,
2749 const struct snd_pci_quirk *tbl)
2750{
2751 const struct snd_pci_quirk *q;
2752
2753 /* Search for codec ID */
2754 for (q = tbl; q->subvendor; q++) {
2755 unsigned long vendorid = (q->subdevice) | (q->subvendor << 16);
2756
2757 if (vendorid == codec->subsystem_id)
2758 break;
2759 }
2760
2761 if (!q->subvendor)
2762 return -1;
2763
2764 tbl = q;
2765
2766 if (tbl->value >= 0 && tbl->value < num_configs) {
2767#ifdef CONFIG_SND_DEBUG_DETECT
2768 char tmp[10];
2769 const char *model = NULL;
2770 if (models)
2771 model = models[tbl->value];
2772 if (!model) {
2773 sprintf(tmp, "#%d", tbl->value);
2774 model = tmp;
2775 }
2776 snd_printdd(KERN_INFO "hda_codec: model '%s' is selected "
2777 "for config %x:%x (%s)\n",
2778 model, tbl->subvendor, tbl->subdevice,
2779 (tbl->name ? tbl->name : "Unknown device"));
2780#endif
2781 return tbl->value;
2782 }
2783 return -1;
2784}
2785EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config);
2786
2787/**
2727 * snd_hda_add_new_ctls - create controls from the array 2788 * snd_hda_add_new_ctls - create controls from the array
2728 * @codec: the HDA codec 2789 * @codec: the HDA codec
2729 * @knew: the array of struct snd_kcontrol_new 2790 * @knew: the array of struct snd_kcontrol_new
@@ -2815,7 +2876,7 @@ void snd_hda_power_down(struct hda_codec *codec)
2815 return; 2876 return;
2816 if (power_save(codec)) { 2877 if (power_save(codec)) {
2817 codec->power_transition = 1; /* avoid reentrance */ 2878 codec->power_transition = 1; /* avoid reentrance */
2818 schedule_delayed_work(&codec->power_work, 2879 queue_delayed_work(codec->bus->workq, &codec->power_work,
2819 msecs_to_jiffies(power_save(codec) * 1000)); 2880 msecs_to_jiffies(power_save(codec) * 1000));
2820 } 2881 }
2821} 2882}
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 6f2fe0f9fdd8..1dd8716c387f 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -296,6 +296,9 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen);
296int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, 296int snd_hda_check_board_config(struct hda_codec *codec, int num_configs,
297 const char **modelnames, 297 const char **modelnames,
298 const struct snd_pci_quirk *pci_list); 298 const struct snd_pci_quirk *pci_list);
299int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
300 int num_configs, const char **models,
301 const struct snd_pci_quirk *tbl);
299int snd_hda_add_new_ctls(struct hda_codec *codec, 302int snd_hda_add_new_ctls(struct hda_codec *codec,
300 struct snd_kcontrol_new *knew); 303 struct snd_kcontrol_new *knew);
301 304
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index 96952a37d884..d57d8132a06e 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -160,6 +160,7 @@ static int patch_nvhdmi(struct hda_codec *codec)
160 */ 160 */
161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { 161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = {
162 { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, 162 { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi },
163 { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi },
163 { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi }, 164 { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi },
164 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi }, 165 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi },
165 { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi }, 166 { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi },
@@ -167,6 +168,7 @@ static struct hda_codec_preset snd_hda_preset_nvhdmi[] = {
167}; 168};
168 169
169MODULE_ALIAS("snd-hda-codec-id:10de0002"); 170MODULE_ALIAS("snd-hda-codec-id:10de0002");
171MODULE_ALIAS("snd-hda-codec-id:10de0006");
170MODULE_ALIAS("snd-hda-codec-id:10de0007"); 172MODULE_ALIAS("snd-hda-codec-id:10de0007");
171MODULE_ALIAS("snd-hda-codec-id:10de0067"); 173MODULE_ALIAS("snd-hda-codec-id:10de0067");
172MODULE_ALIAS("snd-hda-codec-id:10de8001"); 174MODULE_ALIAS("snd-hda-codec-id:10de8001");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ea4c88fe05c4..82dd08431970 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10573,6 +10573,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
10573 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10573 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10574 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10574 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10575 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 10575 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10576 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10576 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 10577 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10577 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 10578 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10578 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), 10579 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 35b83dc6e19e..c39deebb588f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -55,7 +55,8 @@ enum {
55 STAC_9200_DELL_M25, 55 STAC_9200_DELL_M25,
56 STAC_9200_DELL_M26, 56 STAC_9200_DELL_M26,
57 STAC_9200_DELL_M27, 57 STAC_9200_DELL_M27,
58 STAC_9200_GATEWAY, 58 STAC_9200_M4,
59 STAC_9200_M4_2,
59 STAC_9200_PANASONIC, 60 STAC_9200_PANASONIC,
60 STAC_9200_MODELS 61 STAC_9200_MODELS
61}; 62};
@@ -89,14 +90,19 @@ enum {
89 STAC_DELL_M4_2, 90 STAC_DELL_M4_2,
90 STAC_DELL_M4_3, 91 STAC_DELL_M4_3,
91 STAC_HP_M4, 92 STAC_HP_M4,
93 STAC_HP_DV5,
92 STAC_92HD71BXX_MODELS 94 STAC_92HD71BXX_MODELS
93}; 95};
94 96
95enum { 97enum {
96 STAC_925x_REF, 98 STAC_925x_REF,
99 STAC_M1,
100 STAC_M1_2,
101 STAC_M2,
97 STAC_M2_2, 102 STAC_M2_2,
98 STAC_MA6, 103 STAC_M3,
99 STAC_PA6, 104 STAC_M5,
105 STAC_M6,
100 STAC_925x_MODELS 106 STAC_925x_MODELS
101}; 107};
102 108
@@ -331,6 +337,10 @@ static unsigned int stac92hd83xxx_pwr_mapping[4] = {
331 0x03, 0x0c, 0x10, 0x40, 337 0x03, 0x0c, 0x10, 0x40,
332}; 338};
333 339
340static hda_nid_t stac92hd83xxx_amp_nids[1] = {
341 0xc,
342};
343
334static hda_nid_t stac92hd71bxx_pwr_nids[3] = { 344static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
335 0x0a, 0x0d, 0x0f 345 0x0a, 0x0d, 0x0f
336}; 346};
@@ -875,6 +885,8 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = {
875static struct hda_verb stac925x_core_init[] = { 885static struct hda_verb stac925x_core_init[] = {
876 /* set dac0mux for dac converter */ 886 /* set dac0mux for dac converter */
877 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, 887 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
888 /* unmute and set max the selector */
889 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f },
878 {} 890 {}
879}; 891};
880 892
@@ -1334,7 +1346,16 @@ static unsigned int ref9200_pin_configs[8] = {
1334 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, 1346 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1335}; 1347};
1336 1348
1337/* 1349static unsigned int gateway9200_m4_pin_configs[8] = {
1350 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1351 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1352};
1353static unsigned int gateway9200_m4_2_pin_configs[8] = {
1354 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1355 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1356};
1357
1358/*
1338 STAC 9200 pin configs for 1359 STAC 9200 pin configs for
1339 102801A8 1360 102801A8
1340 102801DE 1361 102801DE
@@ -1464,6 +1485,8 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1464 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, 1485 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1465 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, 1486 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1466 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, 1487 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1488 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1489 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1467 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1490 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1468}; 1491};
1469 1492
@@ -1480,7 +1503,8 @@ static const char *stac9200_models[STAC_9200_MODELS] = {
1480 [STAC_9200_DELL_M25] = "dell-m25", 1503 [STAC_9200_DELL_M25] = "dell-m25",
1481 [STAC_9200_DELL_M26] = "dell-m26", 1504 [STAC_9200_DELL_M26] = "dell-m26",
1482 [STAC_9200_DELL_M27] = "dell-m27", 1505 [STAC_9200_DELL_M27] = "dell-m27",
1483 [STAC_9200_GATEWAY] = "gateway", 1506 [STAC_9200_M4] = "gateway-m4",
1507 [STAC_9200_M4_2] = "gateway-m4-2",
1484 [STAC_9200_PANASONIC] = "panasonic", 1508 [STAC_9200_PANASONIC] = "panasonic",
1485}; 1509};
1486 1510
@@ -1550,11 +1574,9 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1550 /* Panasonic */ 1574 /* Panasonic */
1551 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1575 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1552 /* Gateway machines needs EAPD to be set on resume */ 1576 /* Gateway machines needs EAPD to be set on resume */
1553 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), 1577 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1554 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", 1578 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1555 STAC_9200_GATEWAY), 1579 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1556 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1557 STAC_9200_GATEWAY),
1558 /* OQO Mobile */ 1580 /* OQO Mobile */
1559 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), 1581 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1560 {} /* terminator */ 1582 {} /* terminator */
@@ -1565,44 +1587,85 @@ static unsigned int ref925x_pin_configs[8] = {
1565 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, 1587 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1566}; 1588};
1567 1589
1568static unsigned int stac925x_MA6_pin_configs[8] = { 1590static unsigned int stac925xM1_pin_configs[8] = {
1569 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1591 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1570 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, 1592 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1571}; 1593};
1572 1594
1573static unsigned int stac925x_PA6_pin_configs[8] = { 1595static unsigned int stac925xM1_2_pin_configs[8] = {
1574 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1596 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1575 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, 1597 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1598};
1599
1600static unsigned int stac925xM2_pin_configs[8] = {
1601 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1602 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1576}; 1603};
1577 1604
1578static unsigned int stac925xM2_2_pin_configs[8] = { 1605static unsigned int stac925xM2_2_pin_configs[8] = {
1579 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, 1606 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1580 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, 1607 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1608};
1609
1610static unsigned int stac925xM3_pin_configs[8] = {
1611 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1612 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1613};
1614
1615static unsigned int stac925xM5_pin_configs[8] = {
1616 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1617 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1618};
1619
1620static unsigned int stac925xM6_pin_configs[8] = {
1621 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1622 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1581}; 1623};
1582 1624
1583static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 1625static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1584 [STAC_REF] = ref925x_pin_configs, 1626 [STAC_REF] = ref925x_pin_configs,
1627 [STAC_M1] = stac925xM1_pin_configs,
1628 [STAC_M1_2] = stac925xM1_2_pin_configs,
1629 [STAC_M2] = stac925xM2_pin_configs,
1585 [STAC_M2_2] = stac925xM2_2_pin_configs, 1630 [STAC_M2_2] = stac925xM2_2_pin_configs,
1586 [STAC_MA6] = stac925x_MA6_pin_configs, 1631 [STAC_M3] = stac925xM3_pin_configs,
1587 [STAC_PA6] = stac925x_PA6_pin_configs, 1632 [STAC_M5] = stac925xM5_pin_configs,
1633 [STAC_M6] = stac925xM6_pin_configs,
1588}; 1634};
1589 1635
1590static const char *stac925x_models[STAC_925x_MODELS] = { 1636static const char *stac925x_models[STAC_925x_MODELS] = {
1591 [STAC_REF] = "ref", 1637 [STAC_REF] = "ref",
1638 [STAC_M1] = "m1",
1639 [STAC_M1_2] = "m1-2",
1640 [STAC_M2] = "m2",
1592 [STAC_M2_2] = "m2-2", 1641 [STAC_M2_2] = "m2-2",
1593 [STAC_MA6] = "m6", 1642 [STAC_M3] = "m3",
1594 [STAC_PA6] = "pa6", 1643 [STAC_M5] = "m5",
1644 [STAC_M6] = "m6",
1645};
1646
1647static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1648 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1649 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1650 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1651 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1652 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1653 /* Not sure about the brand name for those */
1654 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1655 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1656 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1657 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1658 {} /* terminator */
1595}; 1659};
1596 1660
1597static struct snd_pci_quirk stac925x_cfg_tbl[] = { 1661static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1598 /* SigmaTel reference board */ 1662 /* SigmaTel reference board */
1599 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), 1663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1600 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), 1664 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1601 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), 1665
1602 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), 1666 /* Default table for unknown ID */
1603 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), 1667 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1604 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), 1668
1605 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1606 {} /* terminator */ 1669 {} /* terminator */
1607}; 1670};
1608 1671
@@ -1682,7 +1745,7 @@ static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1682static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { 1745static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1683 /* SigmaTel reference board */ 1746 /* SigmaTel reference board */
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1747 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1685 "DFI LanParty", STAC_92HD71BXX_REF), 1748 "DFI LanParty", STAC_92HD83XXX_REF),
1686 {} /* terminator */ 1749 {} /* terminator */
1687}; 1750};
1688 1751
@@ -1716,6 +1779,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1716 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1779 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1717 [STAC_DELL_M4_3] = dell_m4_3_pin_configs, 1780 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1718 [STAC_HP_M4] = NULL, 1781 [STAC_HP_M4] = NULL,
1782 [STAC_HP_DV5] = NULL,
1719}; 1783};
1720 1784
1721static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1785static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
@@ -1724,6 +1788,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1724 [STAC_DELL_M4_2] = "dell-m4-2", 1788 [STAC_DELL_M4_2] = "dell-m4-2",
1725 [STAC_DELL_M4_3] = "dell-m4-3", 1789 [STAC_DELL_M4_3] = "dell-m4-3",
1726 [STAC_HP_M4] = "hp-m4", 1790 [STAC_HP_M4] = "hp-m4",
1791 [STAC_HP_DV5] = "hp-dv5",
1727}; 1792};
1728 1793
1729static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { 1794static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
@@ -1736,6 +1801,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1736 "HP dv7", STAC_HP_M4), 1801 "HP dv7", STAC_HP_M4),
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, 1802 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
1738 "HP dv7", STAC_HP_M4), 1803 "HP dv7", STAC_HP_M4),
1804 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,
1805 "HP dv5", STAC_HP_DV5),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, 1806 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1740 "unknown HP", STAC_HP_M4), 1807 "unknown HP", STAC_HP_M4),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 1808 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
@@ -4163,8 +4230,19 @@ static void stac92xx_hp_detect(struct hda_codec *codec)
4163 continue; 4230 continue;
4164 if (presence) 4231 if (presence)
4165 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4232 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4233#if 0 /* FIXME */
4234/* Resetting the pinctl like below may lead to (a sort of) regressions
4235 * on some devices since they use the HP pin actually for line/speaker
4236 * outs although the default pin config shows a different pin (that is
4237 * wrong and useless).
4238 *
4239 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4240 * But, disabling the code below just works around it, and I'm too tired of
4241 * bug reports with such devices...
4242 */
4166 else 4243 else
4167 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); 4244 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4245#endif /* FIXME */
4168 } 4246 }
4169} 4247}
4170 4248
@@ -4390,7 +4468,8 @@ static int patch_stac9200(struct hda_codec *codec)
4390 spec->num_adcs = 1; 4468 spec->num_adcs = 1;
4391 spec->num_pwrs = 0; 4469 spec->num_pwrs = 0;
4392 4470
4393 if (spec->board_config == STAC_9200_GATEWAY || 4471 if (spec->board_config == STAC_9200_M4 ||
4472 spec->board_config == STAC_9200_M4_2 ||
4394 spec->board_config == STAC_9200_OQO) 4473 spec->board_config == STAC_9200_OQO)
4395 spec->init = stac9200_eapd_init; 4474 spec->init = stac9200_eapd_init;
4396 else 4475 else
@@ -4408,6 +4487,12 @@ static int patch_stac9200(struct hda_codec *codec)
4408 return err; 4487 return err;
4409 } 4488 }
4410 4489
4490 /* CF-74 has no headphone detection, and the driver should *NOT*
4491 * do detection and HP/speaker toggle because the hardware does it.
4492 */
4493 if (spec->board_config == STAC_9200_PANASONIC)
4494 spec->hp_detect = 0;
4495
4411 codec->patch_ops = stac92xx_patch_ops; 4496 codec->patch_ops = stac92xx_patch_ops;
4412 4497
4413 return 0; 4498 return 0;
@@ -4425,12 +4510,22 @@ static int patch_stac925x(struct hda_codec *codec)
4425 codec->spec = spec; 4510 codec->spec = spec;
4426 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 4511 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4427 spec->pin_nids = stac925x_pin_nids; 4512 spec->pin_nids = stac925x_pin_nids;
4428 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 4513
4514 /* Check first for codec ID */
4515 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
4516 STAC_925x_MODELS,
4517 stac925x_models,
4518 stac925x_codec_id_cfg_tbl);
4519
4520 /* Now checks for PCI ID, if codec ID is not found */
4521 if (spec->board_config < 0)
4522 spec->board_config = snd_hda_check_board_config(codec,
4523 STAC_925x_MODELS,
4429 stac925x_models, 4524 stac925x_models,
4430 stac925x_cfg_tbl); 4525 stac925x_cfg_tbl);
4431 again: 4526 again:
4432 if (spec->board_config < 0) { 4527 if (spec->board_config < 0) {
4433 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4528 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4434 "using BIOS defaults\n"); 4529 "using BIOS defaults\n");
4435 err = stac92xx_save_bios_config_regs(codec); 4530 err = stac92xx_save_bios_config_regs(codec);
4436 } else 4531 } else
@@ -4672,6 +4767,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
4672 spec->dmux_nids = stac92hd83xxx_dmux_nids; 4767 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4673 spec->adc_nids = stac92hd83xxx_adc_nids; 4768 spec->adc_nids = stac92hd83xxx_adc_nids;
4674 spec->pwr_nids = stac92hd83xxx_pwr_nids; 4769 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4770 spec->amp_nids = stac92hd83xxx_amp_nids;
4675 spec->pwr_mapping = stac92hd83xxx_pwr_mapping; 4771 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4676 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); 4772 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4677 spec->multiout.dac_nids = spec->dac_nids; 4773 spec->multiout.dac_nids = spec->dac_nids;
@@ -4689,6 +4785,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
4689 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); 4785 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4690 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); 4786 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4691 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); 4787 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4788 spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids);
4692 spec->num_dmics = STAC92HD83XXX_NUM_DMICS; 4789 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4693 spec->dinput_mux = &stac92hd83xxx_dmux; 4790 spec->dinput_mux = &stac92hd83xxx_dmux;
4694 spec->pin_nids = stac92hd83xxx_pin_nids; 4791 spec->pin_nids = stac92hd83xxx_pin_nids;
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 98c6a8c65d81..e9e829e83d7a 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -26,7 +26,7 @@
26 * SPI 0 -> 1st PCM1796 (front) 26 * SPI 0 -> 1st PCM1796 (front)
27 * SPI 1 -> 2nd PCM1796 (surround) 27 * SPI 1 -> 2nd PCM1796 (surround)
28 * SPI 2 -> 3rd PCM1796 (center/LFE) 28 * SPI 2 -> 3rd PCM1796 (center/LFE)
29 * SPI 4 -> 4th PCM1796 (back) 29 * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
30 * 30 *
31 * GPIO 2 -> M0 of CS5381 31 * GPIO 2 -> M0 of CS5381
32 * GPIO 3 -> M1 of CS5381 32 * GPIO 3 -> M1 of CS5381
@@ -207,6 +207,12 @@ static void xonar_gpio_changed(struct oxygen *chip);
207static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, 207static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
208 u8 reg, u8 value) 208 u8 reg, u8 value)
209{ 209{
210 /*
211 * We don't want to do writes on SPI 4 because the EEPROM, which shares
212 * the same pin, might get confused and broken. We'd better take care
213 * that the driver works with the default register values ...
214 */
215#if 0
210 /* maps ALSA channel pair number to SPI output */ 216 /* maps ALSA channel pair number to SPI output */
211 static const u8 codec_map[4] = { 217 static const u8 codec_map[4] = {
212 0, 1, 2, 4 218 0, 1, 2, 4
@@ -217,6 +223,7 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
217 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | 223 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
218 OXYGEN_SPI_CEN_LATCH_CLOCK_HI, 224 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
219 (reg << 8) | value); 225 (reg << 8) | value);
226#endif
220} 227}
221 228
222static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, 229static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
@@ -750,6 +757,9 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
750 757
751static int xonar_d2_control_filter(struct snd_kcontrol_new *template) 758static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
752{ 759{
760 if (!strncmp(template->name, "Master Playback ", 16))
761 /* disable volume/mute because they would require SPI writes */
762 return 1;
753 if (!strncmp(template->name, "CD Capture ", 11)) 763 if (!strncmp(template->name, "CD Capture ", 11))
754 /* CD in is actually connected to the video in pin */ 764 /* CD in is actually connected to the video in pin */
755 template->private_value ^= AC97_CD ^ AC97_VIDEO; 765 template->private_value ^= AC97_CD ^ AC97_VIDEO;
@@ -840,9 +850,8 @@ static const struct oxygen_model model_xonar_d2 = {
840 .dac_volume_min = 0x0f, 850 .dac_volume_min = 0x0f,
841 .dac_volume_max = 0xff, 851 .dac_volume_max = 0xff,
842 .misc_flags = OXYGEN_MISC_MIDI, 852 .misc_flags = OXYGEN_MISC_MIDI,
843 .function_flags = OXYGEN_FUNCTION_SPI | 853 .function_flags = OXYGEN_FUNCTION_SPI,
844 OXYGEN_FUNCTION_ENABLE_SPI_4_5, 854 .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
845 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
846 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 855 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
847}; 856};
848 857
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index 8f9e3859c37c..ff321110ec02 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -477,7 +477,7 @@ static int snd_ps3_pcm_prepare(struct snd_pcm_substream *substream)
477 card->dma_start_bus_addr[SND_PS3_CH_R] = 477 card->dma_start_bus_addr[SND_PS3_CH_R] =
478 runtime->dma_addr + (runtime->dma_bytes / 2); 478 runtime->dma_addr + (runtime->dma_bytes / 2);
479 479
480 pr_debug("%s: vaddr=%p bus=%#lx\n", __func__, 480 pr_debug("%s: vaddr=%p bus=%#llx\n", __func__,
481 card->dma_start_vaddr[SND_PS3_CH_L], 481 card->dma_start_vaddr[SND_PS3_CH_L],
482 card->dma_start_bus_addr[SND_PS3_CH_L]); 482 card->dma_start_bus_addr[SND_PS3_CH_L]);
483 483
@@ -1030,7 +1030,7 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
1030 pr_info("%s: nullbuffer alloc failed\n", __func__); 1030 pr_info("%s: nullbuffer alloc failed\n", __func__);
1031 goto clean_preallocate; 1031 goto clean_preallocate;
1032 } 1032 }
1033 pr_debug("%s: null vaddr=%p dma=%#lx\n", __func__, 1033 pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__,
1034 the_card.null_buffer_start_vaddr, 1034 the_card.null_buffer_start_vaddr,
1035 the_card.null_buffer_start_dma_addr); 1035 the_card.null_buffer_start_dma_addr);
1036 /* set default sample rate/word width */ 1036 /* set default sample rate/word width */
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 493a4e8aa273..a2f1da8b4646 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -720,7 +720,8 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
720 struct snd_soc_dapm_path *path; 720 struct snd_soc_dapm_path *path;
721 int found = 0; 721 int found = 0;
722 722
723 if (widget->id != snd_soc_dapm_mux) 723 if (widget->id != snd_soc_dapm_mux &&
724 widget->id != snd_soc_dapm_value_mux)
724 return -ENODEV; 725 return -ENODEV;
725 726
726 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val)) 727 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val))
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 92115755d98e..5d8ef09b9dcc 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -128,6 +128,14 @@
128 .bInterfaceClass = USB_CLASS_AUDIO, 128 .bInterfaceClass = USB_CLASS_AUDIO,
129 .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL 129 .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
130}, 130},
131{
132 USB_DEVICE(0x046d, 0x0990),
133 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
134 .vendor_name = "Logitech, Inc.",
135 .product_name = "QuickCam Pro 9000",
136 .ifnum = QUIRK_NO_INTERFACE
137 }
138},
131 139
132/* 140/*
133 * Yamaha devices 141 * Yamaha devices