aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS1
-rw-r--r--Documentation/ABI/testing/sysfs-bus-pci43
-rw-r--r--Documentation/ABI/testing/sysfs-firmware-memmap2
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/device-drivers.tmpl418
-rw-r--r--Documentation/DocBook/genericirq.tmpl1
-rw-r--r--Documentation/DocBook/kernel-api.tmpl377
-rw-r--r--Documentation/PCI/PCIEBUS-HOWTO.txt2
-rw-r--r--Documentation/RCU/checklist.txt12
-rw-r--r--Documentation/cgroups/cgroups.txt6
-rw-r--r--Documentation/cgroups/cpusets.txt65
-rw-r--r--Documentation/driver-model/device.txt8
-rw-r--r--Documentation/dvb/README.flexcop205
-rw-r--r--Documentation/dvb/technisat.txt34
-rw-r--r--Documentation/feature-removal-schedule.txt26
-rw-r--r--Documentation/filesystems/ext2.txt10
-rw-r--r--Documentation/filesystems/ext3.txt4
-rw-r--r--Documentation/filesystems/squashfs.txt2
-rw-r--r--Documentation/filesystems/sysfs.txt50
-rw-r--r--Documentation/hwmon/hpfall.c101
-rw-r--r--Documentation/hwmon/lis3lv02d8
-rw-r--r--Documentation/hwmon/lm9010
-rw-r--r--Documentation/kernel-parameters.txt12
-rw-r--r--Documentation/networking/ipv6.txt35
-rw-r--r--Documentation/scsi/cxgb3i.txt11
-rw-r--r--Documentation/tracers/mmiotrace.txt6
-rw-r--r--MAINTAINERS41
-rw-r--r--Makefile22
-rw-r--r--README2
-rw-r--r--arch/alpha/kernel/process.c8
-rw-r--r--arch/alpha/kernel/smp.c12
-rw-r--r--arch/arm/configs/at91sam9260ek_defconfig2
-rw-r--r--arch/arm/configs/at91sam9261ek_defconfig2
-rw-r--r--arch/arm/configs/at91sam9263ek_defconfig2
-rw-r--r--arch/arm/configs/at91sam9rlek_defconfig2
-rw-r--r--arch/arm/configs/qil-a9260_defconfig2
-rw-r--r--arch/arm/kernel/elf.c4
-rw-r--r--arch/arm/kernel/entry-common.S4
-rw-r--r--arch/arm/kernel/fiq.c4
-rw-r--r--arch/arm/kernel/setup.c13
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c107
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c2
-rw-r--r--arch/arm/mach-at91/gpio.c15
-rw-r--r--arch/arm/mach-at91/include/mach/board.h4
-rw-r--r--arch/arm/mach-at91/pm.c1
-rw-r--r--arch/arm/mach-davinci/board-evm.c6
-rw-r--r--arch/arm/mach-davinci/clock.c5
-rw-r--r--arch/arm/mach-davinci/usb.c1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gesbc9312.h3
-rw-r--r--arch/arm/mach-ep93xx/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h2
-rw-r--r--arch/arm/mach-kirkwood/irq.c2
-rw-r--r--arch/arm/mach-mv78xx0/irq.c2
-rw-r--r--arch/arm/mach-mx1/devices.c2
-rw-r--r--arch/arm/mach-mx1/mx1ads.c1
-rw-r--r--arch/arm/mach-omap2/board-ldp.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c4
-rw-r--r--arch/arm/mach-omap2/clock.c16
-rw-r--r--arch/arm/mach-orion5x/common.c7
-rw-r--r--arch/arm/mach-orion5x/irq.c2
-rw-r--r--arch/arm/mach-rpc/riscpc.c6
-rw-r--r--arch/arm/mach-s3c6410/mach-smdk6410.c4
-rw-r--r--arch/arm/mm/abort-ev6.S3
-rw-r--r--arch/arm/mm/copypage-feroceon.c2
-rw-r--r--arch/arm/mm/copypage-v3.c2
-rw-r--r--arch/arm/mm/copypage-v4mc.c2
-rw-r--r--arch/arm/mm/copypage-v4wb.c2
-rw-r--r--arch/arm/mm/copypage-v4wt.c2
-rw-r--r--arch/arm/mm/copypage-xsc3.c2
-rw-r--r--arch/arm/mm/copypage-xscale.c2
-rw-r--r--arch/arm/mm/dma-mapping.c20
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/mmap.c2
-rw-r--r--arch/arm/mm/mmu.c3
-rw-r--r--arch/arm/plat-omap/Makefile3
-rw-r--r--arch/arm/plat-omap/common.c14
-rw-r--r--arch/arm/plat-omap/include/mach/common.h2
-rw-r--r--arch/arm/plat-omap/include/mach/pm.h2
-rw-r--r--arch/arm/plat-orion/gpio.c73
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h3
-rw-r--r--arch/arm/plat-s3c64xx/clock.c2
-rw-r--r--arch/arm/plat-s3c64xx/gpiolib.c2
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/irqs.h2
-rw-r--r--arch/arm/plat-s3c64xx/irq-eint.c17
-rw-r--r--arch/arm/plat-s3c64xx/irq.c2
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c24
-rw-r--r--arch/arm/tools/mach-types136
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h1
-rw-r--r--arch/blackfin/Kconfig7
-rw-r--r--arch/blackfin/Kconfig.debug6
-rw-r--r--arch/blackfin/configs/BF518F-EZBRD_defconfig63
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig4
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig4
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig4
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig14
-rw-r--r--arch/blackfin/configs/BF538-EZKIT_defconfig4
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig6
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig4
-rw-r--r--arch/blackfin/configs/BlackStamp_defconfig4
-rw-r--r--arch/blackfin/configs/CM-BF527_defconfig4
-rw-r--r--arch/blackfin/configs/CM-BF548_defconfig6
-rw-r--r--arch/blackfin/configs/IP0X_defconfig2
-rw-r--r--arch/blackfin/configs/SRV1_defconfig4
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/bfin_sport.h45
-rw-r--r--arch/blackfin/include/asm/ipipe.h100
-rw-r--r--arch/blackfin/include/asm/ipipe_base.h12
-rw-r--r--arch/blackfin/include/asm/irq.h36
-rw-r--r--arch/blackfin/include/asm/thread_info.h2
-rw-r--r--arch/blackfin/kernel/Makefile8
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c4
-rw-r--r--arch/blackfin/kernel/ipipe.c176
-rw-r--r--arch/blackfin/kernel/irqchip.c14
-rw-r--r--arch/blackfin/kernel/kgdb_test.c9
-rw-r--r--arch/blackfin/kernel/ptrace.c5
-rw-r--r--arch/blackfin/kernel/setup.c10
-rw-r--r--arch/blackfin/kernel/time.c5
-rw-r--r--arch/blackfin/mach-bf518/boards/ezbrd.c33
-rw-r--r--arch/blackfin/mach-bf518/include/mach/anomaly.h17
-rw-r--r--arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h4
-rw-r--r--arch/blackfin/mach-bf527/boards/cm_bf527.c26
-rw-r--r--arch/blackfin/mach-bf527/boards/ezbrd.c24
-rw-r--r--arch/blackfin/mach-bf527/include/mach/anomaly.h6
-rw-r--r--arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h4
-rw-r--r--arch/blackfin/mach-bf533/boards/Kconfig5
-rw-r--r--arch/blackfin/mach-bf533/boards/Makefile1
-rw-r--r--arch/blackfin/mach-bf533/boards/blackstamp.c24
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c24
-rw-r--r--arch/blackfin/mach-bf533/boards/generic_board.c126
-rw-r--r--arch/blackfin/mach-bf533/boards/ip0x.c13
-rw-r--r--arch/blackfin/mach-bf533/include/mach/anomaly.h7
-rw-r--r--arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h2
-rw-r--r--arch/blackfin/mach-bf537/boards/Kconfig5
-rw-r--r--arch/blackfin/mach-bf537/boards/Makefile1
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c26
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c745
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c24
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c24
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c24
-rw-r--r--arch/blackfin/mach-bf537/include/mach/anomaly.h7
-rw-r--r--arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h4
-rw-r--r--arch/blackfin/mach-bf538/include/mach/anomaly.h6
-rw-r--r--arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h4
-rw-r--r--arch/blackfin/mach-bf548/include/mach/anomaly.h22
-rw-r--r--arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h22
-rw-r--r--arch/blackfin/mach-bf548/include/mach/irq.h8
-rw-r--r--arch/blackfin/mach-bf561/boards/Kconfig5
-rw-r--r--arch/blackfin/mach-bf561/boards/Makefile1
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c15
-rw-r--r--arch/blackfin/mach-bf561/boards/generic_board.c113
-rw-r--r--arch/blackfin/mach-bf561/include/mach/anomaly.h7
-rw-r--r--arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h2
-rw-r--r--arch/blackfin/mach-common/arch_checks.c9
-rw-r--r--arch/blackfin/mach-common/cache.S22
-rw-r--r--arch/blackfin/mach-common/clocks-init.c2
-rw-r--r--arch/blackfin/mach-common/dpmc_modes.S24
-rw-r--r--arch/blackfin/mach-common/entry.S61
-rw-r--r--arch/blackfin/mach-common/interrupt.S12
-rw-r--r--arch/blackfin/mach-common/ints-priority.c126
-rw-r--r--arch/blackfin/mach-common/smp.c6
-rw-r--r--arch/blackfin/mm/init.c2
-rw-r--r--arch/ia64/Kconfig18
-rw-r--r--arch/ia64/configs/xen_domu_defconfig1601
-rw-r--r--arch/ia64/include/asm/kvm.h4
-rw-r--r--arch/ia64/include/asm/mmzone.h4
-rw-r--r--arch/ia64/include/asm/sn/bte.h2
-rw-r--r--arch/ia64/kernel/iosapic.c2
-rw-r--r--arch/ia64/kernel/smpboot.c5
-rw-r--r--arch/ia64/kernel/unwind.c2
-rw-r--r--arch/ia64/kvm/kvm-ia64.c4
-rw-r--r--arch/ia64/kvm/process.c17
-rw-r--r--arch/ia64/mm/numa.c4
-rw-r--r--arch/ia64/sn/kernel/bte.c7
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c7
-rw-r--r--arch/ia64/xen/Kconfig3
-rw-r--r--arch/ia64/xen/xen_pv_ops.c4
-rw-r--r--arch/m68k/atari/ataints.c16
-rw-r--r--arch/m68k/atari/atakeyb.c4
-rw-r--r--arch/m68k/atari/config.c2
-rw-r--r--arch/m68k/atari/debug.c22
-rw-r--r--arch/m68k/atari/time.c8
-rw-r--r--arch/m68k/include/asm/atarihw.h4
-rw-r--r--arch/m68k/include/asm/atariints.h6
-rw-r--r--arch/m68knommu/platform/5206e/config.c1
-rw-r--r--arch/m68knommu/platform/528x/config.c228
-rw-r--r--arch/mips/Kconfig35
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/alchemy/common/time.c6
-rw-r--r--arch/mips/configs/ip27_defconfig2
-rw-r--r--arch/mips/configs/jmr3927_defconfig265
-rw-r--r--arch/mips/configs/markeins_defconfig (renamed from arch/mips/configs/emma2rh_defconfig)10
-rw-r--r--arch/mips/configs/rbtx49xx_defconfig319
-rw-r--r--arch/mips/emma/Kconfig29
-rw-r--r--arch/mips/emma/markeins/platform.c39
-rw-r--r--arch/mips/include/asm/compat.h7
-rw-r--r--arch/mips/include/asm/hazards.h3
-rw-r--r--arch/mips/include/asm/prefetch.h2
-rw-r--r--arch/mips/include/asm/seccomp.h5
-rw-r--r--arch/mips/include/asm/thread_info.h6
-rw-r--r--arch/mips/kernel/cpu-probe.c1
-rw-r--r--arch/mips/kernel/irq.c1
-rw-r--r--arch/mips/kernel/linux32.c69
-rw-r--r--arch/mips/kernel/scall32-o32.S4
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S28
-rw-r--r--arch/mips/kernel/scall64-o32.S40
-rw-r--r--arch/mips/kernel/signal.c5
-rw-r--r--arch/mips/kernel/signal32.c28
-rw-r--r--arch/mips/kernel/syscall.c26
-rw-r--r--arch/mips/mm/cache.c5
-rw-r--r--arch/mips/mm/page.c3
-rw-r--r--arch/mips/mm/tlbex.c1
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/unit-asb2305/pci.c2
-rw-r--r--arch/parisc/configs/712_defconfig429
-rw-r--r--arch/parisc/configs/a500_defconfig490
-rw-r--r--arch/parisc/configs/b180_defconfig433
-rw-r--r--arch/parisc/configs/c3000_defconfig575
-rw-r--r--arch/parisc/configs/default_defconfig585
-rw-r--r--arch/parisc/hpux/fs.c1
-rw-r--r--arch/parisc/include/asm/assembly.h11
-rw-r--r--arch/parisc/include/asm/io.h51
-rw-r--r--arch/parisc/include/asm/irq.h2
-rw-r--r--arch/parisc/include/asm/uaccess.h1
-rw-r--r--arch/parisc/kernel/cache.c5
-rw-r--r--arch/parisc/kernel/entry.S6
-rw-r--r--arch/parisc/kernel/firmware.c12
-rw-r--r--arch/parisc/kernel/irq.c18
-rw-r--r--arch/parisc/kernel/pci-dma.c22
-rw-r--r--arch/parisc/mm/init.c6
-rw-r--r--arch/powerpc/configs/40x/virtex_defconfig2
-rw-r--r--arch/powerpc/configs/44x/virtex5_defconfig2
-rw-r--r--arch/powerpc/configs/linkstation_defconfig36
-rw-r--r--arch/powerpc/configs/storcenter_defconfig35
-rw-r--r--arch/powerpc/include/asm/compat.h5
-rw-r--r--arch/powerpc/include/asm/pgtable-4k.h2
-rw-r--r--arch/powerpc/include/asm/pgtable-64k.h2
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h3
-rw-r--r--arch/powerpc/include/asm/seccomp.h4
-rw-r--r--arch/powerpc/kernel/align.c36
-rw-r--r--arch/powerpc/kvm/powerpc.c4
-rw-r--r--arch/powerpc/lib/copyuser_64.S38
-rw-r--r--arch/powerpc/lib/memcpy_64.S26
-rw-r--r--arch/powerpc/mm/numa.c5
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c38
-rw-r--r--arch/powerpc/platforms/embedded6xx/storcenter.c32
-rw-r--r--arch/powerpc/platforms/ps3/mm.c2
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c17
-rw-r--r--arch/s390/crypto/aes_s390.c2
-rw-r--r--arch/s390/include/asm/cputime.h2
-rw-r--r--arch/s390/include/asm/setup.h2
-rw-r--r--arch/s390/kernel/setup.c9
-rw-r--r--arch/s390/kvm/kvm-s390.c4
-rw-r--r--arch/sh/boards/board-ap325rxa.c54
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7201.c4
-rw-r--r--arch/sparc/include/asm/compat.h5
-rw-r--r--arch/sparc/include/asm/seccomp.h6
-rw-r--r--arch/sparc/kernel/chmc.c1
-rw-r--r--arch/sparc/kernel/irq_64.c29
-rw-r--r--arch/um/drivers/vde_user.c6
-rw-r--r--arch/um/kernel/ptrace.c5
-rw-r--r--arch/um/os-Linux/user_syms.c5
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/Kconfig.debug24
-rw-r--r--arch/x86/include/asm/efi.h2
-rw-r--r--arch/x86/include/asm/fixmap_64.h4
-rw-r--r--arch/x86/include/asm/i387.h8
-rw-r--r--arch/x86/include/asm/iomap.h3
-rw-r--r--arch/x86/include/asm/kvm.h7
-rw-r--r--arch/x86/include/asm/mmzone_32.h2
-rw-r--r--arch/x86/include/asm/mmzone_64.h2
-rw-r--r--arch/x86/include/asm/page.h1
-rw-r--r--arch/x86/include/asm/paravirt.h17
-rw-r--r--arch/x86/include/asm/seccomp_32.h6
-rw-r--r--arch/x86/include/asm/seccomp_64.h8
-rw-r--r--arch/x86/kernel/acpi/wakeup_64.S30
-rw-r--r--arch/x86/kernel/apic.c2
-rw-r--r--arch/x86/kernel/apm_32.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c1
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c12
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c7
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel_64.c4
-rw-r--r--arch/x86/kernel/ds.c3
-rw-r--r--arch/x86/kernel/efi.c7
-rw-r--r--arch/x86/kernel/efi_64.c21
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/i387.c2
-rw-r--r--arch/x86/kernel/olpc.c2
-rw-r--r--arch/x86/kernel/paravirt.c26
-rw-r--r--arch/x86/kernel/process_32.c3
-rw-r--r--arch/x86/kernel/ptrace.c18
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kernel/setup.c5
-rw-r--r--arch/x86/kernel/time_64.c2
-rw-r--r--arch/x86/kernel/traps.c10
-rw-r--r--arch/x86/kernel/vmiclock_32.c7
-rw-r--r--arch/x86/kvm/i8254.c2
-rw-r--r--arch/x86/kvm/irq.c7
-rw-r--r--arch/x86/kvm/irq.h1
-rw-r--r--arch/x86/kvm/lapic.c66
-rw-r--r--arch/x86/kvm/lapic.h2
-rw-r--r--arch/x86/kvm/mmu.c9
-rw-r--r--arch/x86/kvm/svm.c1
-rw-r--r--arch/x86/kvm/vmx.c5
-rw-r--r--arch/x86/kvm/x86.c10
-rw-r--r--arch/x86/lguest/boot.c21
-rw-r--r--arch/x86/mach-default/setup.c2
-rw-r--r--arch/x86/mach-voyager/setup.c2
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c24
-rw-r--r--arch/x86/math-emu/fpu_aux.c31
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/iomap_32.c11
-rw-r--r--arch/x86/mm/ioremap.c19
-rw-r--r--arch/x86/mm/kmmio.c164
-rw-r--r--arch/x86/mm/numa_64.c2
-rw-r--r--arch/x86/mm/pageattr.c39
-rw-r--r--arch/x86/mm/pat.c85
-rw-r--r--arch/x86/mm/testmmiotrace.c70
-rw-r--r--arch/x86/oprofile/op_model_ppro.c14
-rw-r--r--arch/x86/xen/enlighten.c3
-rw-r--r--arch/xtensa/Kconfig3
-rw-r--r--arch/xtensa/kernel/setup.c2
-rw-r--r--arch/xtensa/kernel/traps.c1
-rw-r--r--arch/xtensa/mm/fault.c1
-rw-r--r--arch/xtensa/platforms/iss/console.c6
-rw-r--r--block/blk-merge.c93
-rw-r--r--block/blk-timeout.c9
-rw-r--r--block/blktrace.c2
-rw-r--r--block/bsg.c17
-rw-r--r--block/genhd.c24
-rw-r--r--crypto/ahash.c2
-rw-r--r--crypto/api.c15
-rw-r--r--crypto/lrw.c8
-rw-r--r--drivers/acpi/Kconfig7
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/battery.c25
-rw-r--r--drivers/acpi/ec.c9
-rw-r--r--drivers/ata/ahci.c24
-rw-r--r--drivers/ata/ata_piix.c37
-rw-r--r--drivers/ata/libata-core.c14
-rw-r--r--drivers/ata/libata-eh.c7
-rw-r--r--drivers/ata/libata-sff.c34
-rw-r--r--drivers/ata/pata_amd.c76
-rw-r--r--drivers/ata/pata_it821x.c3
-rw-r--r--drivers/ata/pata_legacy.c7
-rw-r--r--drivers/ata/pata_via.c4
-rw-r--r--drivers/ata/sata_mv.c23
-rw-r--r--drivers/ata/sata_nv.c16
-rw-r--r--drivers/atm/lanai.c2
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/dd.c17
-rw-r--r--drivers/base/node.c2
-rw-r--r--drivers/base/power/main.c3
-rw-r--r--drivers/base/sys.c7
-rw-r--r--drivers/block/aoe/aoe.h1
-rw-r--r--drivers/block/aoe/aoedev.c2
-rw-r--r--drivers/block/aoe/aoenet.c2
-rw-r--r--drivers/block/ataflop.c4
-rw-r--r--drivers/block/cciss.c217
-rw-r--r--drivers/block/floppy.c79
-rw-r--r--drivers/block/loop.c3
-rw-r--r--drivers/block/paride/pg.c2
-rw-r--r--drivers/block/xen-blkfront.c32
-rw-r--r--drivers/block/xsysace.c22
-rw-r--r--drivers/char/agp/amd64-agp.c13
-rw-r--r--drivers/char/agp/intel-agp.c8
-rw-r--r--drivers/char/agp/parisc-agp.c23
-rw-r--r--drivers/char/hvcs.c9
-rw-r--r--drivers/char/hvsi.c1
-rw-r--r--drivers/char/scc.h2
-rw-r--r--drivers/char/sx.c5
-rw-r--r--drivers/cpufreq/cpufreq.c51
-rw-r--r--drivers/crypto/ixp4xx_crypto.c6
-rw-r--r--drivers/crypto/padlock-aes.c2
-rw-r--r--drivers/crypto/padlock-sha.c4
-rw-r--r--drivers/dca/dca-core.c2
-rw-r--r--drivers/dma/dmaengine.c2
-rw-r--r--drivers/dma/dmatest.c6
-rw-r--r--drivers/dma/dw_dmac.c5
-rw-r--r--drivers/dma/dw_dmac_regs.h2
-rw-r--r--drivers/dma/fsldma.c8
-rw-r--r--drivers/dma/ioat.c2
-rw-r--r--drivers/dma/ioat_dca.c26
-rw-r--r--drivers/dma/ioat_dma.c39
-rw-r--r--drivers/dma/ioatdma.h8
-rw-r--r--drivers/dma/ioatdma_hw.h2
-rw-r--r--drivers/dma/ioatdma_registers.h2
-rw-r--r--drivers/dma/iop-adma.c18
-rw-r--r--drivers/dma/ipu/ipu_idmac.c2
-rw-r--r--drivers/dma/mv_xor.c18
-rw-r--r--drivers/firmware/memmap.c2
-rw-r--r--drivers/gpu/drm/Kconfig13
-rw-r--r--drivers/gpu/drm/drm_bufs.c2
-rw-r--r--drivers/gpu/drm/drm_crtc.c3
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c97
-rw-r--r--drivers/gpu/drm/drm_edid.c6
-rw-r--r--drivers/gpu/drm/drm_fops.c17
-rw-r--r--drivers/gpu/drm/drm_gem.c79
-rw-r--r--drivers/gpu/drm/drm_irq.c14
-rw-r--r--drivers/gpu/drm/drm_lock.c3
-rw-r--r--drivers/gpu/drm/drm_stub.c10
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c15
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c29
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h10
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c302
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c6
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c5
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h1
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c11
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c14
-rw-r--r--drivers/gpu/drm/i915/intel_display.c161
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c8
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c2
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c2
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c21
-rw-r--r--drivers/hid/hid-core.c13
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/hidraw.c14
-rw-r--r--drivers/hwmon/Kconfig4
-rw-r--r--drivers/hwmon/abituguru3.c7
-rw-r--r--drivers/hwmon/f71882fg.c4
-rw-r--r--drivers/hwmon/f75375s.c2
-rw-r--r--drivers/hwmon/hp_accel.c85
-rw-r--r--drivers/hwmon/it87.c8
-rw-r--r--drivers/hwmon/lis3lv02d.c195
-rw-r--r--drivers/hwmon/lis3lv02d.h21
-rw-r--r--drivers/hwmon/lm85.c8
-rw-r--r--drivers/hwmon/lm90.c8
-rw-r--r--drivers/hwmon/vt1211.c2
-rw-r--r--drivers/hwmon/w83627ehf.c2
-rw-r--r--drivers/i2c/busses/i2c-acorn.c5
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c4
-rw-r--r--drivers/i2c/busses/i2c-ixp2000.c2
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c4
-rw-r--r--drivers/i2c/busses/i2c-pxa.c2
-rw-r--r--drivers/i2c/busses/scx200_i2c.c2
-rw-r--r--drivers/i2c/i2c-core.c3
-rw-r--r--drivers/i2c/i2c-dev.c6
-rw-r--r--drivers/ide/Kconfig7
-rw-r--r--drivers/ide/Makefile1
-rw-r--r--drivers/ide/amd74xx.c2
-rw-r--r--drivers/ide/at91_ide.c467
-rw-r--r--drivers/ide/atiixp.c4
-rw-r--r--drivers/ide/ide-atapi.c12
-rw-r--r--drivers/ide/ide-cd.c35
-rw-r--r--drivers/ide/ide-cd.h2
-rw-r--r--drivers/ide/ide-disk_proc.c2
-rw-r--r--drivers/ide/ide-dma.c12
-rw-r--r--drivers/ide/ide-floppy.c6
-rw-r--r--drivers/ide/ide-floppy_proc.c2
-rw-r--r--drivers/ide/ide-gd.c26
-rw-r--r--drivers/ide/ide-gd.h2
-rw-r--r--drivers/ide/ide-io.c3
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/ide/ide-probe.c7
-rw-r--r--drivers/ide/ide-proc.c2
-rw-r--r--drivers/ide/ide-tape.c31
-rw-r--r--drivers/ide/ide.c11
-rw-r--r--drivers/ide/it821x.c5
-rw-r--r--drivers/ieee1394/dma.h1
-rw-r--r--drivers/ieee1394/ieee1394_core.c3
-rw-r--r--drivers/ieee1394/ieee1394_transactions.c31
-rw-r--r--drivers/ieee1394/ieee1394_transactions.h2
-rw-r--r--drivers/ieee1394/iso.h1
-rw-r--r--drivers/ieee1394/nodemgr.c10
-rw-r--r--drivers/ieee1394/nodemgr.h18
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c39
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c2
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.h1
-rw-r--r--drivers/input/keyboard/atkbd.c4
-rw-r--r--drivers/input/keyboard/bf54x-keys.c4
-rw-r--r--drivers/input/keyboard/corgikbd.c8
-rw-r--r--drivers/input/keyboard/omap-keypad.c8
-rw-r--r--drivers/input/keyboard/spitzkbd.c8
-rw-r--r--drivers/input/mouse/Kconfig2
-rw-r--r--drivers/input/mouse/elantech.c32
-rw-r--r--drivers/input/mouse/pxa930_trkball.c2
-rw-r--r--drivers/input/mouse/synaptics.c9
-rw-r--r--drivers/input/serio/ambakmi.c6
-rw-r--r--drivers/input/serio/gscps2.c2
-rw-r--r--drivers/input/serio/sa1111ps2.c4
-rw-r--r--drivers/input/touchscreen/atmel_tsadcc.c2
-rw-r--r--drivers/input/touchscreen/corgi_ts.c9
-rw-r--r--drivers/input/touchscreen/tsc2007.c3
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c20
-rw-r--r--drivers/isdn/sc/shmem.c2
-rw-r--r--drivers/lguest/lguest_device.c6
-rw-r--r--drivers/md/dm-io.c2
-rw-r--r--drivers/md/dm-kcopyd.c2
-rw-r--r--drivers/md/md.c34
-rw-r--r--drivers/md/raid1.c3
-rw-r--r--drivers/md/raid10.c19
-rw-r--r--drivers/media/common/tuners/tuner-simple.c10
-rw-r--r--drivers/media/dvb/Kconfig4
-rw-r--r--drivers/media/dvb/Makefile2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-hw-filter.c1
-rw-r--r--drivers/media/dvb/b2c2/flexcop-pci.c65
-rw-r--r--drivers/media/dvb/b2c2/flexcop.c3
-rw-r--r--drivers/media/dvb/bt8xx/dst.c2
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c16
-rw-r--r--drivers/media/dvb/dvb-core/dvb_demux.c16
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c7
-rw-r--r--drivers/media/dvb/firewire/Kconfig22
-rw-r--r--drivers/media/dvb/firewire/Makefile8
-rw-r--r--drivers/media/dvb/firewire/firedtv-1394.c285
-rw-r--r--drivers/media/dvb/firewire/firedtv-avc.c1315
-rw-r--r--drivers/media/dvb/firewire/firedtv-ci.c260
-rw-r--r--drivers/media/dvb/firewire/firedtv-dvb.c364
-rw-r--r--drivers/media/dvb/firewire/firedtv-fe.c247
-rw-r--r--drivers/media/dvb/firewire/firedtv-rc.c190
-rw-r--r--drivers/media/dvb/firewire/firedtv.h182
-rw-r--r--drivers/media/dvb/frontends/stb0899_algo.c14
-rw-r--r--drivers/media/dvb/frontends/stb0899_drv.c2
-rw-r--r--drivers/media/dvb/frontends/stb0899_priv.h12
-rw-r--r--drivers/media/dvb/frontends/stb6100.c4
-rw-r--r--drivers/media/dvb/frontends/zl10353.c2
-rw-r--r--drivers/media/dvb/frontends/zl10353.h3
-rw-r--r--drivers/media/radio/radio-si470x.c55
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c2
-rw-r--r--drivers/media/video/gspca/gspca.c5
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.c6
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c26
-rw-r--r--drivers/media/video/pxa_camera.c26
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c1
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c13
-rw-r--r--drivers/media/video/tvaudio.c2
-rw-r--r--drivers/media/video/uvc/uvc_status.c10
-rw-r--r--drivers/media/video/zoran/Kconfig1
-rw-r--r--drivers/message/fusion/mptbase.c4
-rw-r--r--drivers/mfd/htc-egpio.c4
-rw-r--r--drivers/mfd/pcf50633-core.c1
-rw-r--r--drivers/mfd/sm501.c26
-rw-r--r--drivers/mfd/twl4030-core.c2
-rw-r--r--drivers/mfd/wm8350-core.c53
-rw-r--r--drivers/mfd/wm8350-regmap.c2
-rw-r--r--drivers/misc/hpilo.c3
-rw-r--r--drivers/mmc/card/block.c2
-rw-r--r--drivers/mmc/card/mmc_test.c2
-rw-r--r--drivers/mmc/core/mmc_ops.c15
-rw-r--r--drivers/mmc/host/atmel-mci.c5
-rw-r--r--drivers/mmc/host/omap_hsmmc.c98
-rw-r--r--drivers/mmc/host/s3cmci.c5
-rw-r--r--drivers/mmc/host/sdhci-pci.c4
-rw-r--r--drivers/mmc/host/sdhci.c12
-rw-r--r--drivers/mmc/host/sdhci.h5
-rw-r--r--drivers/mtd/chips/map_rom.c8
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c3
-rw-r--r--drivers/mtd/devices/slram.c14
-rw-r--r--drivers/mtd/lpddr/Kconfig1
-rw-r--r--drivers/mtd/maps/Kconfig2
-rw-r--r--drivers/mtd/maps/bfin-async-flash.c6
-rw-r--r--drivers/mtd/maps/ck804xrom.c2
-rw-r--r--drivers/mtd/maps/physmap.c41
-rw-r--r--drivers/mtd/nand/atmel_nand.c3
-rw-r--r--drivers/mtd/nand/orion_nand.c2
-rw-r--r--drivers/net/Kconfig11
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/arm/Makefile2
-rw-r--r--drivers/net/arm/etherh.c10
-rw-r--r--drivers/net/arm/ks8695net.c2
-rw-r--r--drivers/net/atl1c/Makefile2
-rw-r--r--drivers/net/atl1c/atl1c.h606
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c317
-rw-r--r--drivers/net/atl1c/atl1c_hw.c527
-rw-r--r--drivers/net/atl1c/atl1c_hw.h859
-rw-r--r--drivers/net/atl1c/atl1c_main.c2797
-rw-r--r--drivers/net/b44.c13
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c1
-rw-r--r--drivers/net/cxgb3/t3_hw.c7
-rw-r--r--drivers/net/forcedeth.c13
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/hp-plus.c2
-rw-r--r--drivers/net/jme.c3
-rw-r--r--drivers/net/mv643xx_eth.c9
-rw-r--r--drivers/net/netxen/netxen_nic_main.c16
-rw-r--r--drivers/net/pcmcia/3c574_cs.c3
-rw-r--r--drivers/net/pcmcia/3c589_cs.c3
-rw-r--r--drivers/net/r8169.c114
-rw-r--r--drivers/net/smc911x.h12
-rw-r--r--drivers/net/smsc911x.c2
-rw-r--r--drivers/net/smsc9420.c6
-rw-r--r--drivers/net/smsc9420.h1
-rw-r--r--drivers/net/sundance.c2
-rw-r--r--drivers/net/sungem.c4
-rw-r--r--drivers/net/sunhme.c2
-rw-r--r--drivers/net/sunlance.c4
-rw-r--r--drivers/net/tg3.c7
-rw-r--r--drivers/net/tokenring/tmspci.c18
-rw-r--r--drivers/net/ucc_geth_mii.c4
-rw-r--r--drivers/net/usb/asix.c8
-rw-r--r--drivers/net/usb/cdc_ether.c5
-rw-r--r--drivers/net/usb/dm9601.c4
-rw-r--r--drivers/net/usb/usbnet.c4
-rw-r--r--drivers/net/usb/zaurus.c5
-rw-r--r--drivers/net/veth.c60
-rw-r--r--drivers/net/wimax/i2400m/i2400m.h2
-rw-r--r--drivers/net/wireless/ath9k/main.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c17
-rw-r--r--drivers/net/wireless/libertas/ethtool.c12
-rw-r--r--drivers/net/wireless/libertas/if_usb.c4
-rw-r--r--drivers/net/wireless/libertas/main.c31
-rw-r--r--drivers/net/wireless/libertas/persistcfg.c16
-rw-r--r--drivers/net/wireless/libertas/scan.c4
-rw-r--r--drivers/net/wireless/libertas/tx.c2
-rw-r--r--drivers/net/wireless/libertas/wext.c72
-rw-r--r--drivers/net/wireless/orinoco/orinoco.c19
-rw-r--r--drivers/net/wireless/p54/p54common.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c32
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c12
-rw-r--r--drivers/parisc/dino.c13
-rw-r--r--drivers/parisc/gsc.c39
-rw-r--r--drivers/parisc/iosapic.c16
-rw-r--r--drivers/parisc/lba_pci.c4
-rw-r--r--drivers/parisc/sba_iommu.c63
-rw-r--r--drivers/parport/parport_atari.c6
-rw-r--r--drivers/pci/dmar.c73
-rw-r--r--drivers/pci/hotplug/Kconfig2
-rw-r--r--drivers/pci/hotplug/pciehp.h2
-rw-r--r--drivers/pci/hotplug/pciehp_core.c7
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c15
-rw-r--r--drivers/pci/intel-iommu.c16
-rw-r--r--drivers/pci/intr_remapping.c21
-rw-r--r--drivers/pci/msi.c10
-rw-r--r--drivers/pci/pci.c13
-rw-r--r--drivers/pci/pci.h20
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c51
-rw-r--r--drivers/pci/pcie/portdrv_pci.c3
-rw-r--r--drivers/pci/quirks.c151
-rw-r--r--drivers/pci/rom.c1
-rw-r--r--drivers/platform/x86/Kconfig2
-rw-r--r--drivers/platform/x86/acer-wmi.c2
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c25
-rw-r--r--drivers/power/ds2760_battery.c11
-rw-r--r--drivers/s390/char/sclp.c5
-rw-r--r--drivers/s390/char/sclp_cmd.c5
-rw-r--r--drivers/sbus/char/bbc_i2c.c2
-rw-r--r--drivers/sbus/char/jsflash.c3
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i.h21
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_ddp.c19
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_ddp.h5
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_init.c4
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_iscsi.c22
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_offload.c146
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_offload.h29
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_pdu.c275
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_pdu.h2
-rw-r--r--drivers/scsi/fcoe/fc_transport_fcoe.c91
-rw-r--r--drivers/scsi/fcoe/fcoe_sw.c56
-rw-r--r--drivers/scsi/fcoe/libfcoe.c318
-rw-r--r--drivers/scsi/hptiop.c1
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c15
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c1
-rw-r--r--drivers/scsi/lasi700.c2
-rw-r--r--drivers/scsi/libfc/fc_disc.c63
-rw-r--r--drivers/scsi/libfc/fc_exch.c32
-rw-r--r--drivers/scsi/libfc/fc_fcp.c56
-rw-r--r--drivers/scsi/libfc/fc_lport.c173
-rw-r--r--drivers/scsi/libfc/fc_rport.c197
-rw-r--r--drivers/scsi/libiscsi.c3
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c22
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h5
-rw-r--r--drivers/scsi/qla2xxx/qla_devtbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_fw.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h9
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c26
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c58
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c43
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c22
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c22
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/scsi/scsi_scan.c1
-rw-r--r--drivers/scsi/sd.c33
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/zalon.c2
-rw-r--r--drivers/serial/8250.c15
-rw-r--r--drivers/serial/8250_pci.c36
-rw-r--r--drivers/serial/atmel_serial.c4
-rw-r--r--drivers/serial/jsm/jsm_driver.c3
-rw-r--r--drivers/serial/sh-sci.h2
-rw-r--r--drivers/spi/spi_gpio.c2
-rw-r--r--drivers/staging/panel/panel.c23
-rw-r--r--drivers/staging/rtl8187se/Kconfig1
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c19
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c2
-rw-r--r--drivers/staging/winbond/wbusb.c20
-rw-r--r--drivers/usb/class/cdc-acm.c9
-rw-r--r--drivers/usb/core/hcd-pci.c15
-rw-r--r--drivers/usb/core/hcd.h1
-rw-r--r--drivers/usb/core/message.c11
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/f_obex.c4
-rw-r--r--drivers/usb/gadget/file_storage.c6
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c3
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c4
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-mem.c1
-rw-r--r--drivers/usb/host/ehci-pci.c1
-rw-r--r--drivers/usb/host/ehci-sched.c56
-rw-r--r--drivers/usb/host/ehci.h6
-rw-r--r--drivers/usb/host/ohci-pci.c1
-rw-r--r--drivers/usb/host/uhci-hcd.c1
-rw-r--r--drivers/usb/host/whci/asl.c4
-rw-r--r--drivers/usb/host/whci/pzl.c4
-rw-r--r--drivers/usb/musb/davinci.c15
-rw-r--r--drivers/usb/musb/musb_core.c13
-rw-r--r--drivers/usb/musb/musb_gadget.c4
-rw-r--r--drivers/usb/musb/musb_host.c93
-rw-r--r--drivers/usb/serial/option.c11
-rw-r--r--drivers/usb/storage/unusual_devs.h4
-rw-r--r--drivers/video/Kconfig10
-rw-r--r--drivers/video/atafb.c22
-rw-r--r--drivers/video/aty/aty128fb.c11
-rw-r--r--drivers/video/aty/radeon_pm.c10
-rw-r--r--drivers/video/i810/i810_main.c5
-rw-r--r--drivers/video/pxafb.c2
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c6
-rw-r--r--drivers/w1/masters/w1-gpio.c2
-rw-r--r--drivers/w1/slaves/Kconfig6
-rw-r--r--drivers/w1/slaves/Makefile1
-rw-r--r--drivers/w1/slaves/w1_ds2433.c7
-rw-r--r--drivers/watchdog/Kconfig2
-rw-r--r--drivers/watchdog/at91rm9200_wdt.c4
-rw-r--r--drivers/watchdog/at91sam9_wdt.c1
-rw-r--r--drivers/watchdog/gef_wdt.c2
-rw-r--r--drivers/watchdog/iTCO_vendor_support.c32
-rw-r--r--drivers/watchdog/iTCO_wdt.c35
-rw-r--r--drivers/watchdog/ks8695_wdt.c1
-rw-r--r--drivers/watchdog/orion5x_wdt.c1
-rw-r--r--drivers/watchdog/rc32434_wdt.c168
-rw-r--r--drivers/xen/manage.c8
-rw-r--r--fs/Makefile6
-rw-r--r--fs/bio-integrity.c5
-rw-r--r--fs/bio.c11
-rw-r--r--fs/btrfs/btrfs_inode.h8
-rw-r--r--fs/btrfs/ctree.c68
-rw-r--r--fs/btrfs/ctree.h51
-rw-r--r--fs/btrfs/disk-io.c50
-rw-r--r--fs/btrfs/disk-io.h10
-rw-r--r--fs/btrfs/extent-tree.c339
-rw-r--r--fs/btrfs/extent_io.c2
-rw-r--r--fs/btrfs/file.c24
-rw-r--r--fs/btrfs/inode-map.c1
-rw-r--r--fs/btrfs/inode.c66
-rw-r--r--fs/btrfs/ioctl.c6
-rw-r--r--fs/btrfs/locking.c17
-rw-r--r--fs/btrfs/locking.h2
-rw-r--r--fs/btrfs/super.c5
-rw-r--r--fs/btrfs/transaction.c2
-rw-r--r--fs/btrfs/tree-log.c2
-rw-r--r--fs/btrfs/volumes.c6
-rw-r--r--fs/buffer.c3
-rw-r--r--fs/cifs/CHANGES15
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/cifsglob.h6
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/cifssmb.c7
-rw-r--r--fs/cifs/connect.c51
-rw-r--r--fs/cifs/dir.c307
-rw-r--r--fs/cifs/inode.c104
-rw-r--r--fs/cifs/readdir.c58
-rw-r--r--fs/cifs/sess.c91
-rw-r--r--fs/compat_ioctl.c5
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/devpts/inode.c5
-rw-r--r--fs/ecryptfs/crypto.c2
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h3
-rw-r--r--fs/ecryptfs/keystore.c3
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/ext4/balloc.c4
-rw-r--r--fs/ext4/ext4.h2
-rw-r--r--fs/ext4/ialloc.c15
-rw-r--r--fs/ext4/inode.c38
-rw-r--r--fs/ext4/mballoc.c32
-rw-r--r--fs/ext4/migrate.c8
-rw-r--r--fs/ext4/super.c12
-rw-r--r--fs/fat/inode.c4
-rw-r--r--fs/fs-writeback.c9
-rw-r--r--fs/inode.c7
-rw-r--r--fs/jbd2/journal.c17
-rw-r--r--fs/jbd2/transaction.c42
-rw-r--r--fs/jffs2/background.c18
-rw-r--r--fs/jffs2/readinode.c42
-rw-r--r--fs/lockd/clntlock.c51
-rw-r--r--fs/namespace.c6
-rw-r--r--fs/nfs/client.c73
-rw-r--r--fs/nfs/dir.c8
-rw-r--r--fs/nfs/nfs3acl.c27
-rw-r--r--fs/nfs/nfs3xdr.c34
-rw-r--r--fs/nfs/nfs4namespace.c15
-rw-r--r--fs/notify/inotify/inotify.c2
-rw-r--r--fs/ocfs2/alloc.c30
-rw-r--r--fs/ocfs2/aops.c7
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c12
-rw-r--r--fs/ocfs2/dlm/dlmthread.c3
-rw-r--r--fs/ocfs2/dlm/dlmunlock.c4
-rw-r--r--fs/ocfs2/dlmglue.c11
-rw-r--r--fs/ocfs2/journal.h6
-rw-r--r--fs/ocfs2/namei.c3
-rw-r--r--fs/ocfs2/ocfs2.h3
-rw-r--r--fs/ocfs2/ocfs2_fs.h6
-rw-r--r--fs/ocfs2/super.c8
-rw-r--r--fs/ocfs2/xattr.c57
-rw-r--r--fs/pipe.c8
-rw-r--r--fs/proc/inode.c4
-rw-r--r--fs/proc/page.c4
-rw-r--r--fs/ramfs/file-nommu.c4
-rw-r--r--fs/seq_file.c36
-rw-r--r--fs/squashfs/block.c18
-rw-r--r--fs/squashfs/cache.c4
-rw-r--r--fs/squashfs/inode.c6
-rw-r--r--fs/squashfs/squashfs.h2
-rw-r--r--fs/squashfs/super.c2
-rw-r--r--fs/super.c22
-rw-r--r--fs/timerfd.c12
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c91
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c10
-rw-r--r--fs/xfs/xfs_iget.c15
-rw-r--r--fs/xfs/xfs_log_recover.c17
-rw-r--r--include/asm-frv/pgtable.h2
-rw-r--r--include/drm/drmP.h2
-rw-r--r--include/drm/drm_crtc.h2
-rw-r--r--include/drm/drm_crtc_helper.h11
-rw-r--r--include/drm/drm_edid.h6
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/bio.h6
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/blktrace_api.h1
-rw-r--r--include/linux/compiler-gcc.h10
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/dcbnl.h4
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/dmaengine.h9
-rw-r--r--include/linux/firmware-map.h2
-rw-r--r--include/linux/fs.h24
-rw-r--r--include/linux/hdreg.h1
-rw-r--r--include/linux/i2c-dev.h2
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/if_vlan.h1
-rw-r--r--include/linux/intel-iommu.h3
-rw-r--r--include/linux/interrupt.h11
-rw-r--r--include/linux/io-mapping.h49
-rw-r--r--include/linux/irq.h6
-rw-r--r--include/linux/irqreturn.h28
-rw-r--r--include/linux/jbd2.h3
-rw-r--r--include/linux/kvm.h10
-rw-r--r--include/linux/kvm_host.h1
-rw-r--r--include/linux/libata.h6
-rw-r--r--include/linux/lockd/lockd.h8
-rw-r--r--include/linux/mm.h21
-rw-r--r--include/linux/mm_types.h3
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/netfilter/xt_NFLOG.h2
-rw-r--r--include/linux/nfs_xdr.h2
-rw-r--r--include/linux/nfsacl.h3
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/rcuclassic.h6
-rw-r--r--include/linux/rcupdate.h4
-rw-r--r--include/linux/rcupreempt.h15
-rw-r--r--include/linux/rcutree.h6
-rw-r--r--include/linux/sched.h7
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/serio.h2
-rw-r--r--include/linux/skbuff.h9
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/soundcard.h74
-rw-r--r--include/linux/spi/spi_bitbang.h7
-rw-r--r--include/linux/timerfd.h16
-rw-r--r--include/linux/user_namespace.h1
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/net/net_namespace.h27
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/sock.h1
-rw-r--r--include/scsi/fc/fc_fcoe.h4
-rw-r--r--include/scsi/fc/fc_fs.h5
-rw-r--r--include/scsi/libfc.h138
-rw-r--r--include/scsi/libfcoe.h9
-rw-r--r--init/Kconfig30
-rw-r--r--init/do_mounts.c13
-rw-r--r--init/do_mounts_md.c5
-rw-r--r--init/main.c3
-rw-r--r--kernel/Makefile1
-rw-r--r--kernel/cgroup.c2
-rw-r--r--kernel/fork.c11
-rw-r--r--kernel/futex.c53
-rw-r--r--kernel/irq/handle.c7
-rw-r--r--kernel/irq/manage.c182
-rw-r--r--kernel/kexec.c7
-rw-r--r--kernel/posix-cpu-timers.c60
-rw-r--r--kernel/power/Makefile2
-rw-r--r--kernel/power/console.c6
-rw-r--r--kernel/power/disk.c22
-rw-r--r--kernel/power/main.c8
-rw-r--r--kernel/power/swap.c5
-rw-r--r--kernel/power/user.c8
-rw-r--r--kernel/printk.c15
-rw-r--r--kernel/rcuclassic.c4
-rw-r--r--kernel/rcupdate.c12
-rw-r--r--kernel/rcupreempt.c3
-rw-r--r--kernel/rcutree.c4
-rw-r--r--kernel/sched.c30
-rw-r--r--kernel/seccomp.c7
-rw-r--r--kernel/softirq.c1
-rw-r--r--kernel/sys.c31
-rw-r--r--kernel/trace/Kconfig25
-rw-r--r--kernel/trace/ftrace.c6
-rw-r--r--kernel/trace/trace_mmiotrace.c14
-rw-r--r--kernel/trace/trace_selftest.c19
-rw-r--r--kernel/tsacct.c6
-rw-r--r--kernel/user.c35
-rw-r--r--kernel/user_namespace.c21
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--lib/bitmap.c16
-rw-r--r--lib/idr.c2
-rw-r--r--mm/mlock.c7
-rw-r--r--mm/page-writeback.c13
-rw-r--r--mm/page_alloc.c27
-rw-r--r--mm/page_io.c2
-rw-r--r--mm/shmem.c43
-rw-r--r--mm/swapfile.c4
-rw-r--r--mm/util.c20
-rw-r--r--mm/vmalloc.c20
-rw-r--r--mm/vmscan.c32
-rw-r--r--net/802/tr.c2
-rw-r--r--net/8021q/vlan_core.c10
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/core/dev.c67
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/core/net_namespace.c89
-rw-r--r--net/core/skbuff.c8
-rw-r--r--net/core/sock.c3
-rw-r--r--net/ipv4/cipso_ipv4.c9
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/tcp_input.c9
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/tcp_output.c1
-rw-r--r--net/ipv4/tcp_scalable.c2
-rw-r--r--net/ipv6/addrconf.c53
-rw-r--r--net/ipv6/af_inet6.c21
-rw-r--r--net/ipv6/inet6_hashtables.c4
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c5
-rw-r--r--net/netfilter/nfnetlink_log.c8
-rw-r--r--net/netfilter/x_tables.c199
-rw-r--r--net/netfilter/xt_recent.c2
-rw-r--r--net/netlink/af_netlink.c10
-rw-r--r--net/sched/act_police.c13
-rw-r--r--net/sched/sch_drr.c6
-rw-r--r--net/sctp/protocol.c16
-rw-r--r--net/sctp/sm_sideeffect.c54
-rw-r--r--net/sctp/sm_statefuns.c16
-rw-r--r--net/sunrpc/sched.c33
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/sunrpc/xprtsock.c23
-rw-r--r--net/wireless/reg.c3
-rw-r--r--scripts/bootgraph.pl4
-rwxr-xr-xscripts/checkpatch.pl26
-rw-r--r--scripts/markup_oops.pl161
-rw-r--r--scripts/mod/file2alias.c1
-rw-r--r--scripts/package/Makefile3
-rwxr-xr-xscripts/package/mkspec10
-rwxr-xr-xscripts/setlocalversion9
-rwxr-xr-xscripts/tags.sh12
-rw-r--r--scripts/unifdef.c6
-rw-r--r--security/selinux/netlabel.c9
-rw-r--r--security/smack/smack_lsm.c43
-rw-r--r--security/smack/smackfs.c64
-rw-r--r--sound/core/jack.c2
-rw-r--r--sound/core/oss/rate.c2
-rw-r--r--sound/drivers/mtpav.c3
-rw-r--r--sound/oss/dmasound/dmasound_atari.c16
-rw-r--r--sound/pci/aw2/aw2-alsa.c2
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c1
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_hwdep.c17
-rw-r--r--sound/pci/hda/hda_intel.c10
-rw-r--r--sound/pci/hda/hda_local.h2
-rw-r--r--sound/pci/hda/patch_analog.c15
-rw-r--r--sound/pci/hda/patch_intelhdmi.c61
-rw-r--r--sound/pci/hda/patch_realtek.c5
-rw-r--r--sound/pci/hda/patch_sigmatel.c21
-rw-r--r--sound/pci/oxygen/virtuoso.c17
-rw-r--r--sound/pci/pcxhr/pcxhr.h12
-rw-r--r--sound/soc/codecs/tlv320aic3x.c11
-rw-r--r--sound/soc/codecs/wm8990.c4
-rw-r--r--sound/soc/omap/sdp3430.c4
-rw-r--r--sound/soc/soc-core.c5
-rw-r--r--sound/usb/usbaudio.c20
-rw-r--r--sound/usb/usbmidi.c1
-rw-r--r--virt/kvm/iommu.c6
-rw-r--r--virt/kvm/kvm_main.c43
1009 files changed, 23227 insertions, 8599 deletions
diff --git a/CREDITS b/CREDITS
index 2b39168c06aa..5e0736722afd 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2166,7 +2166,6 @@ D: Initial implementation of VC's, pty's and select()
2166 2166
2167N: Pavel Machek 2167N: Pavel Machek
2168E: pavel@ucw.cz 2168E: pavel@ucw.cz
2169E: pavel@suse.cz
2170D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd 2169D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd
2171D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB, 2170D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB,
2172D: work on suspend-to-ram/disk, killing duplicates from ioctl32 2171D: work on suspend-to-ram/disk, killing duplicates from ioctl32
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index ceddcff4082a..e638e15a8895 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -1,3 +1,46 @@
1What: /sys/bus/pci/drivers/.../bind
2Date: December 2003
3Contact: linux-pci@vger.kernel.org
4Description:
5 Writing a device location to this file will cause
6 the driver to attempt to bind to the device found at
7 this location. This is useful for overriding default
8 bindings. The format for the location is: DDDD:BB:DD.F.
9 That is Domain:Bus:Device.Function and is the same as
10 found in /sys/bus/pci/devices/. For example:
11 # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/bind
12 (Note: kernels before 2.6.28 may require echo -n).
13
14What: /sys/bus/pci/drivers/.../unbind
15Date: December 2003
16Contact: linux-pci@vger.kernel.org
17Description:
18 Writing a device location to this file will cause the
19 driver to attempt to unbind from the device found at
20 this location. This may be useful when overriding default
21 bindings. The format for the location is: DDDD:BB:DD.F.
22 That is Domain:Bus:Device.Function and is the same as
23 found in /sys/bus/pci/devices/. For example:
24 # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/unbind
25 (Note: kernels before 2.6.28 may require echo -n).
26
27What: /sys/bus/pci/drivers/.../new_id
28Date: December 2003
29Contact: linux-pci@vger.kernel.org
30Description:
31 Writing a device ID to this file will attempt to
32 dynamically add a new device ID to a PCI device driver.
33 This may allow the driver to support more hardware than
34 was included in the driver's static device ID support
35 table at compile time. The format for the device ID is:
36 VVVV DDDD SVVV SDDD CCCC MMMM PPPP. That is Vendor ID,
37 Device ID, Subsystem Vendor ID, Subsystem Device ID,
38 Class, Class Mask, and Private Driver Data. The Vendor ID
39 and Device ID fields are required, the rest are optional.
40 Upon successfully adding an ID, the driver will probe
41 for the device and attempt to bind to it. For example:
42 # echo "8086 10f5" > /sys/bus/pci/drivers/foo/new_id
43
1What: /sys/bus/pci/devices/.../vpd 44What: /sys/bus/pci/devices/.../vpd
2Date: February 2008 45Date: February 2008
3Contact: Ben Hutchings <bhutchings@solarflare.com> 46Contact: Ben Hutchings <bhutchings@solarflare.com>
diff --git a/Documentation/ABI/testing/sysfs-firmware-memmap b/Documentation/ABI/testing/sysfs-firmware-memmap
index 0d99ee6ae02e..eca0d65087dc 100644
--- a/Documentation/ABI/testing/sysfs-firmware-memmap
+++ b/Documentation/ABI/testing/sysfs-firmware-memmap
@@ -1,6 +1,6 @@
1What: /sys/firmware/memmap/ 1What: /sys/firmware/memmap/
2Date: June 2008 2Date: June 2008
3Contact: Bernhard Walle <bwalle@suse.de> 3Contact: Bernhard Walle <bernhard.walle@gmx.de>
4Description: 4Description:
5 On all platforms, the firmware provides a memory map which the 5 On all platforms, the firmware provides a memory map which the
6 kernel reads. The resources from that memory map are registered 6 kernel reads. The resources from that memory map are registered
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index dc3154e49279..1462ed86d40a 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -6,7 +6,7 @@
6# To add a new book the only step required is to add the book to the 6# To add a new book the only step required is to add the book to the
7# list of DOCBOOKS. 7# list of DOCBOOKS.
8 8
9DOCBOOKS := z8530book.xml mcabook.xml \ 9DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \
10 kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ 10 kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
11 procfs-guide.xml writing_usb_driver.xml networking.xml \ 11 procfs-guide.xml writing_usb_driver.xml networking.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl
new file mode 100644
index 000000000000..94a20fe8fedf
--- /dev/null
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -0,0 +1,418 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="LinuxDriversAPI">
6 <bookinfo>
7 <title>Linux Device Drivers</title>
8
9 <legalnotice>
10 <para>
11 This documentation is free software; you can redistribute
12 it and/or modify it under the terms of the GNU General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later
15 version.
16 </para>
17
18 <para>
19 This program is distributed in the hope that it will be
20 useful, but WITHOUT ANY WARRANTY; without even the implied
21 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 See the GNU General Public License for more details.
23 </para>
24
25 <para>
26 You should have received a copy of the GNU General Public
27 License along with this program; if not, write to the Free
28 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 MA 02111-1307 USA
30 </para>
31
32 <para>
33 For more details see the file COPYING in the source
34 distribution of Linux.
35 </para>
36 </legalnotice>
37 </bookinfo>
38
39<toc></toc>
40
41 <chapter id="Basics">
42 <title>Driver Basics</title>
43 <sect1><title>Driver Entry and Exit points</title>
44!Iinclude/linux/init.h
45 </sect1>
46
47 <sect1><title>Atomic and pointer manipulation</title>
48!Iarch/x86/include/asm/atomic_32.h
49!Iarch/x86/include/asm/unaligned.h
50 </sect1>
51
52 <sect1><title>Delaying, scheduling, and timer routines</title>
53!Iinclude/linux/sched.h
54!Ekernel/sched.c
55!Ekernel/timer.c
56 </sect1>
57 <sect1><title>High-resolution timers</title>
58!Iinclude/linux/ktime.h
59!Iinclude/linux/hrtimer.h
60!Ekernel/hrtimer.c
61 </sect1>
62 <sect1><title>Workqueues and Kevents</title>
63!Ekernel/workqueue.c
64 </sect1>
65 <sect1><title>Internal Functions</title>
66!Ikernel/exit.c
67!Ikernel/signal.c
68!Iinclude/linux/kthread.h
69!Ekernel/kthread.c
70 </sect1>
71
72 <sect1><title>Kernel objects manipulation</title>
73<!--
74X!Iinclude/linux/kobject.h
75-->
76!Elib/kobject.c
77 </sect1>
78
79 <sect1><title>Kernel utility functions</title>
80!Iinclude/linux/kernel.h
81!Ekernel/printk.c
82!Ekernel/panic.c
83!Ekernel/sys.c
84!Ekernel/rcupdate.c
85 </sect1>
86
87 <sect1><title>Device Resource Management</title>
88!Edrivers/base/devres.c
89 </sect1>
90
91 </chapter>
92
93 <chapter id="devdrivers">
94 <title>Device drivers infrastructure</title>
95 <sect1><title>Device Drivers Base</title>
96<!--
97X!Iinclude/linux/device.h
98-->
99!Edrivers/base/driver.c
100!Edrivers/base/core.c
101!Edrivers/base/class.c
102!Edrivers/base/firmware_class.c
103!Edrivers/base/transport_class.c
104<!-- Cannot be included, because
105 attribute_container_add_class_device_adapter
106 and attribute_container_classdev_to_container
107 exceed allowed 44 characters maximum
108X!Edrivers/base/attribute_container.c
109-->
110!Edrivers/base/sys.c
111<!--
112X!Edrivers/base/interface.c
113-->
114!Edrivers/base/platform.c
115!Edrivers/base/bus.c
116 </sect1>
117 <sect1><title>Device Drivers Power Management</title>
118!Edrivers/base/power/main.c
119 </sect1>
120 <sect1><title>Device Drivers ACPI Support</title>
121<!-- Internal functions only
122X!Edrivers/acpi/sleep/main.c
123X!Edrivers/acpi/sleep/wakeup.c
124X!Edrivers/acpi/motherboard.c
125X!Edrivers/acpi/bus.c
126-->
127!Edrivers/acpi/scan.c
128!Idrivers/acpi/scan.c
129<!-- No correct structured comments
130X!Edrivers/acpi/pci_bind.c
131-->
132 </sect1>
133 <sect1><title>Device drivers PnP support</title>
134!Idrivers/pnp/core.c
135<!-- No correct structured comments
136X!Edrivers/pnp/system.c
137 -->
138!Edrivers/pnp/card.c
139!Idrivers/pnp/driver.c
140!Edrivers/pnp/manager.c
141!Edrivers/pnp/support.c
142 </sect1>
143 <sect1><title>Userspace IO devices</title>
144!Edrivers/uio/uio.c
145!Iinclude/linux/uio_driver.h
146 </sect1>
147 </chapter>
148
149 <chapter id="parportdev">
150 <title>Parallel Port Devices</title>
151!Iinclude/linux/parport.h
152!Edrivers/parport/ieee1284.c
153!Edrivers/parport/share.c
154!Idrivers/parport/daisy.c
155 </chapter>
156
157 <chapter id="message_devices">
158 <title>Message-based devices</title>
159 <sect1><title>Fusion message devices</title>
160!Edrivers/message/fusion/mptbase.c
161!Idrivers/message/fusion/mptbase.c
162!Edrivers/message/fusion/mptscsih.c
163!Idrivers/message/fusion/mptscsih.c
164!Idrivers/message/fusion/mptctl.c
165!Idrivers/message/fusion/mptspi.c
166!Idrivers/message/fusion/mptfc.c
167!Idrivers/message/fusion/mptlan.c
168 </sect1>
169 <sect1><title>I2O message devices</title>
170!Iinclude/linux/i2o.h
171!Idrivers/message/i2o/core.h
172!Edrivers/message/i2o/iop.c
173!Idrivers/message/i2o/iop.c
174!Idrivers/message/i2o/config-osm.c
175!Edrivers/message/i2o/exec-osm.c
176!Idrivers/message/i2o/exec-osm.c
177!Idrivers/message/i2o/bus-osm.c
178!Edrivers/message/i2o/device.c
179!Idrivers/message/i2o/device.c
180!Idrivers/message/i2o/driver.c
181!Idrivers/message/i2o/pci.c
182!Idrivers/message/i2o/i2o_block.c
183!Idrivers/message/i2o/i2o_scsi.c
184!Idrivers/message/i2o/i2o_proc.c
185 </sect1>
186 </chapter>
187
188 <chapter id="snddev">
189 <title>Sound Devices</title>
190!Iinclude/sound/core.h
191!Esound/sound_core.c
192!Iinclude/sound/pcm.h
193!Esound/core/pcm.c
194!Esound/core/device.c
195!Esound/core/info.c
196!Esound/core/rawmidi.c
197!Esound/core/sound.c
198!Esound/core/memory.c
199!Esound/core/pcm_memory.c
200!Esound/core/init.c
201!Esound/core/isadma.c
202!Esound/core/control.c
203!Esound/core/pcm_lib.c
204!Esound/core/hwdep.c
205!Esound/core/pcm_native.c
206!Esound/core/memalloc.c
207<!-- FIXME: Removed for now since no structured comments in source
208X!Isound/sound_firmware.c
209-->
210 </chapter>
211
212 <chapter id="uart16x50">
213 <title>16x50 UART Driver</title>
214!Iinclude/linux/serial_core.h
215!Edrivers/serial/serial_core.c
216!Edrivers/serial/8250.c
217 </chapter>
218
219 <chapter id="fbdev">
220 <title>Frame Buffer Library</title>
221
222 <para>
223 The frame buffer drivers depend heavily on four data structures.
224 These structures are declared in include/linux/fb.h. They are
225 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
226 The last three can be made available to and from userland.
227 </para>
228
229 <para>
230 fb_info defines the current state of a particular video card.
231 Inside fb_info, there exists a fb_ops structure which is a
232 collection of needed functions to make fbdev and fbcon work.
233 fb_info is only visible to the kernel.
234 </para>
235
236 <para>
237 fb_var_screeninfo is used to describe the features of a video card
238 that are user defined. With fb_var_screeninfo, things such as
239 depth and the resolution may be defined.
240 </para>
241
242 <para>
243 The next structure is fb_fix_screeninfo. This defines the
244 properties of a card that are created when a mode is set and can't
245 be changed otherwise. A good example of this is the start of the
246 frame buffer memory. This "locks" the address of the frame buffer
247 memory, so that it cannot be changed or moved.
248 </para>
249
250 <para>
251 The last structure is fb_monospecs. In the old API, there was
252 little importance for fb_monospecs. This allowed for forbidden things
253 such as setting a mode of 800x600 on a fix frequency monitor. With
254 the new API, fb_monospecs prevents such things, and if used
255 correctly, can prevent a monitor from being cooked. fb_monospecs
256 will not be useful until kernels 2.5.x.
257 </para>
258
259 <sect1><title>Frame Buffer Memory</title>
260!Edrivers/video/fbmem.c
261 </sect1>
262<!--
263 <sect1><title>Frame Buffer Console</title>
264X!Edrivers/video/console/fbcon.c
265 </sect1>
266-->
267 <sect1><title>Frame Buffer Colormap</title>
268!Edrivers/video/fbcmap.c
269 </sect1>
270<!-- FIXME:
271 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
272 out until somebody adds docs. KAO
273 <sect1><title>Frame Buffer Generic Functions</title>
274X!Idrivers/video/fbgen.c
275 </sect1>
276KAO -->
277 <sect1><title>Frame Buffer Video Mode Database</title>
278!Idrivers/video/modedb.c
279!Edrivers/video/modedb.c
280 </sect1>
281 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
282!Edrivers/video/macmodes.c
283 </sect1>
284 <sect1><title>Frame Buffer Fonts</title>
285 <para>
286 Refer to the file drivers/video/console/fonts.c for more information.
287 </para>
288<!-- FIXME: Removed for now since no structured comments in source
289X!Idrivers/video/console/fonts.c
290-->
291 </sect1>
292 </chapter>
293
294 <chapter id="input_subsystem">
295 <title>Input Subsystem</title>
296!Iinclude/linux/input.h
297!Edrivers/input/input.c
298!Edrivers/input/ff-core.c
299!Edrivers/input/ff-memless.c
300 </chapter>
301
302 <chapter id="spi">
303 <title>Serial Peripheral Interface (SPI)</title>
304 <para>
305 SPI is the "Serial Peripheral Interface", widely used with
306 embedded systems because it is a simple and efficient
307 interface: basically a multiplexed shift register.
308 Its three signal wires hold a clock (SCK, often in the range
309 of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
310 a "Master In, Slave Out" (MISO) data line.
311 SPI is a full duplex protocol; for each bit shifted out the
312 MOSI line (one per clock) another is shifted in on the MISO line.
313 Those bits are assembled into words of various sizes on the
314 way to and from system memory.
315 An additional chipselect line is usually active-low (nCS);
316 four signals are normally used for each peripheral, plus
317 sometimes an interrupt.
318 </para>
319 <para>
320 The SPI bus facilities listed here provide a generalized
321 interface to declare SPI busses and devices, manage them
322 according to the standard Linux driver model, and perform
323 input/output operations.
324 At this time, only "master" side interfaces are supported,
325 where Linux talks to SPI peripherals and does not implement
326 such a peripheral itself.
327 (Interfaces to support implementing SPI slaves would
328 necessarily look different.)
329 </para>
330 <para>
331 The programming interface is structured around two kinds of driver,
332 and two kinds of device.
333 A "Controller Driver" abstracts the controller hardware, which may
334 be as simple as a set of GPIO pins or as complex as a pair of FIFOs
335 connected to dual DMA engines on the other side of the SPI shift
336 register (maximizing throughput). Such drivers bridge between
337 whatever bus they sit on (often the platform bus) and SPI, and
338 expose the SPI side of their device as a
339 <structname>struct spi_master</structname>.
340 SPI devices are children of that master, represented as a
341 <structname>struct spi_device</structname> and manufactured from
342 <structname>struct spi_board_info</structname> descriptors which
343 are usually provided by board-specific initialization code.
344 A <structname>struct spi_driver</structname> is called a
345 "Protocol Driver", and is bound to a spi_device using normal
346 driver model calls.
347 </para>
348 <para>
349 The I/O model is a set of queued messages. Protocol drivers
350 submit one or more <structname>struct spi_message</structname>
351 objects, which are processed and completed asynchronously.
352 (There are synchronous wrappers, however.) Messages are
353 built from one or more <structname>struct spi_transfer</structname>
354 objects, each of which wraps a full duplex SPI transfer.
355 A variety of protocol tweaking options are needed, because
356 different chips adopt very different policies for how they
357 use the bits transferred with SPI.
358 </para>
359!Iinclude/linux/spi/spi.h
360!Fdrivers/spi/spi.c spi_register_board_info
361!Edrivers/spi/spi.c
362 </chapter>
363
364 <chapter id="i2c">
365 <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
366
367 <para>
368 I<superscript>2</superscript>C (or without fancy typography, "I2C")
369 is an acronym for the "Inter-IC" bus, a simple bus protocol which is
370 widely used where low data rate communications suffice.
371 Since it's also a licensed trademark, some vendors use another
372 name (such as "Two-Wire Interface", TWI) for the same bus.
373 I2C only needs two signals (SCL for clock, SDA for data), conserving
374 board real estate and minimizing signal quality issues.
375 Most I2C devices use seven bit addresses, and bus speeds of up
376 to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
377 found wide use.
378 I2C is a multi-master bus; open drain signaling is used to
379 arbitrate between masters, as well as to handshake and to
380 synchronize clocks from slower clients.
381 </para>
382
383 <para>
384 The Linux I2C programming interfaces support only the master
385 side of bus interactions, not the slave side.
386 The programming interface is structured around two kinds of driver,
387 and two kinds of device.
388 An I2C "Adapter Driver" abstracts the controller hardware; it binds
389 to a physical device (perhaps a PCI device or platform_device) and
390 exposes a <structname>struct i2c_adapter</structname> representing
391 each I2C bus segment it manages.
392 On each I2C bus segment will be I2C devices represented by a
393 <structname>struct i2c_client</structname>. Those devices will
394 be bound to a <structname>struct i2c_driver</structname>,
395 which should follow the standard Linux driver model.
396 (At this writing, a legacy model is more widely used.)
397 There are functions to perform various I2C protocol operations; at
398 this writing all such functions are usable only from task context.
399 </para>
400
401 <para>
402 The System Management Bus (SMBus) is a sibling protocol. Most SMBus
403 systems are also I2C conformant. The electrical constraints are
404 tighter for SMBus, and it standardizes particular protocol messages
405 and idioms. Controllers that support I2C can also support most
406 SMBus operations, but SMBus controllers don't support all the protocol
407 options that an I2C controller will.
408 There are functions to perform various SMBus protocol operations,
409 either using I2C primitives or by issuing SMBus commands to
410 i2c_adapter devices which don't support those I2C operations.
411 </para>
412
413!Iinclude/linux/i2c.h
414!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
415!Edrivers/i2c/i2c-core.c
416 </chapter>
417
418</book>
diff --git a/Documentation/DocBook/genericirq.tmpl b/Documentation/DocBook/genericirq.tmpl
index 3a882d9a90a9..c671a0168096 100644
--- a/Documentation/DocBook/genericirq.tmpl
+++ b/Documentation/DocBook/genericirq.tmpl
@@ -440,6 +440,7 @@ desc->chip->end();
440 used in the generic IRQ layer. 440 used in the generic IRQ layer.
441 </para> 441 </para>
442!Iinclude/linux/irq.h 442!Iinclude/linux/irq.h
443!Iinclude/linux/interrupt.h
443 </chapter> 444 </chapter>
444 445
445 <chapter id="pubfunctions"> 446 <chapter id="pubfunctions">
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 5818ff75786a..bc962cda6504 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -38,58 +38,6 @@
38 38
39<toc></toc> 39<toc></toc>
40 40
41 <chapter id="Basics">
42 <title>Driver Basics</title>
43 <sect1><title>Driver Entry and Exit points</title>
44!Iinclude/linux/init.h
45 </sect1>
46
47 <sect1><title>Atomic and pointer manipulation</title>
48!Iarch/x86/include/asm/atomic_32.h
49!Iarch/x86/include/asm/unaligned.h
50 </sect1>
51
52 <sect1><title>Delaying, scheduling, and timer routines</title>
53!Iinclude/linux/sched.h
54!Ekernel/sched.c
55!Ekernel/timer.c
56 </sect1>
57 <sect1><title>High-resolution timers</title>
58!Iinclude/linux/ktime.h
59!Iinclude/linux/hrtimer.h
60!Ekernel/hrtimer.c
61 </sect1>
62 <sect1><title>Workqueues and Kevents</title>
63!Ekernel/workqueue.c
64 </sect1>
65 <sect1><title>Internal Functions</title>
66!Ikernel/exit.c
67!Ikernel/signal.c
68!Iinclude/linux/kthread.h
69!Ekernel/kthread.c
70 </sect1>
71
72 <sect1><title>Kernel objects manipulation</title>
73<!--
74X!Iinclude/linux/kobject.h
75-->
76!Elib/kobject.c
77 </sect1>
78
79 <sect1><title>Kernel utility functions</title>
80!Iinclude/linux/kernel.h
81!Ekernel/printk.c
82!Ekernel/panic.c
83!Ekernel/sys.c
84!Ekernel/rcupdate.c
85 </sect1>
86
87 <sect1><title>Device Resource Management</title>
88!Edrivers/base/devres.c
89 </sect1>
90
91 </chapter>
92
93 <chapter id="adt"> 41 <chapter id="adt">
94 <title>Data Types</title> 42 <title>Data Types</title>
95 <sect1><title>Doubly Linked Lists</title> 43 <sect1><title>Doubly Linked Lists</title>
@@ -298,62 +246,6 @@ X!Earch/x86/kernel/mca_32.c
298!Ikernel/acct.c 246!Ikernel/acct.c
299 </chapter> 247 </chapter>
300 248
301 <chapter id="devdrivers">
302 <title>Device drivers infrastructure</title>
303 <sect1><title>Device Drivers Base</title>
304<!--
305X!Iinclude/linux/device.h
306-->
307!Edrivers/base/driver.c
308!Edrivers/base/core.c
309!Edrivers/base/class.c
310!Edrivers/base/firmware_class.c
311!Edrivers/base/transport_class.c
312<!-- Cannot be included, because
313 attribute_container_add_class_device_adapter
314 and attribute_container_classdev_to_container
315 exceed allowed 44 characters maximum
316X!Edrivers/base/attribute_container.c
317-->
318!Edrivers/base/sys.c
319<!--
320X!Edrivers/base/interface.c
321-->
322!Edrivers/base/platform.c
323!Edrivers/base/bus.c
324 </sect1>
325 <sect1><title>Device Drivers Power Management</title>
326!Edrivers/base/power/main.c
327 </sect1>
328 <sect1><title>Device Drivers ACPI Support</title>
329<!-- Internal functions only
330X!Edrivers/acpi/sleep/main.c
331X!Edrivers/acpi/sleep/wakeup.c
332X!Edrivers/acpi/motherboard.c
333X!Edrivers/acpi/bus.c
334-->
335!Edrivers/acpi/scan.c
336!Idrivers/acpi/scan.c
337<!-- No correct structured comments
338X!Edrivers/acpi/pci_bind.c
339-->
340 </sect1>
341 <sect1><title>Device drivers PnP support</title>
342!Idrivers/pnp/core.c
343<!-- No correct structured comments
344X!Edrivers/pnp/system.c
345 -->
346!Edrivers/pnp/card.c
347!Idrivers/pnp/driver.c
348!Edrivers/pnp/manager.c
349!Edrivers/pnp/support.c
350 </sect1>
351 <sect1><title>Userspace IO devices</title>
352!Edrivers/uio/uio.c
353!Iinclude/linux/uio_driver.h
354 </sect1>
355 </chapter>
356
357 <chapter id="blkdev"> 249 <chapter id="blkdev">
358 <title>Block Devices</title> 250 <title>Block Devices</title>
359!Eblock/blk-core.c 251!Eblock/blk-core.c
@@ -381,275 +273,6 @@ X!Edrivers/pnp/system.c
381!Edrivers/char/misc.c 273!Edrivers/char/misc.c
382 </chapter> 274 </chapter>
383 275
384 <chapter id="parportdev">
385 <title>Parallel Port Devices</title>
386!Iinclude/linux/parport.h
387!Edrivers/parport/ieee1284.c
388!Edrivers/parport/share.c
389!Idrivers/parport/daisy.c
390 </chapter>
391
392 <chapter id="message_devices">
393 <title>Message-based devices</title>
394 <sect1><title>Fusion message devices</title>
395!Edrivers/message/fusion/mptbase.c
396!Idrivers/message/fusion/mptbase.c
397!Edrivers/message/fusion/mptscsih.c
398!Idrivers/message/fusion/mptscsih.c
399!Idrivers/message/fusion/mptctl.c
400!Idrivers/message/fusion/mptspi.c
401!Idrivers/message/fusion/mptfc.c
402!Idrivers/message/fusion/mptlan.c
403 </sect1>
404 <sect1><title>I2O message devices</title>
405!Iinclude/linux/i2o.h
406!Idrivers/message/i2o/core.h
407!Edrivers/message/i2o/iop.c
408!Idrivers/message/i2o/iop.c
409!Idrivers/message/i2o/config-osm.c
410!Edrivers/message/i2o/exec-osm.c
411!Idrivers/message/i2o/exec-osm.c
412!Idrivers/message/i2o/bus-osm.c
413!Edrivers/message/i2o/device.c
414!Idrivers/message/i2o/device.c
415!Idrivers/message/i2o/driver.c
416!Idrivers/message/i2o/pci.c
417!Idrivers/message/i2o/i2o_block.c
418!Idrivers/message/i2o/i2o_scsi.c
419!Idrivers/message/i2o/i2o_proc.c
420 </sect1>
421 </chapter>
422
423 <chapter id="snddev">
424 <title>Sound Devices</title>
425!Iinclude/sound/core.h
426!Esound/sound_core.c
427!Iinclude/sound/pcm.h
428!Esound/core/pcm.c
429!Esound/core/device.c
430!Esound/core/info.c
431!Esound/core/rawmidi.c
432!Esound/core/sound.c
433!Esound/core/memory.c
434!Esound/core/pcm_memory.c
435!Esound/core/init.c
436!Esound/core/isadma.c
437!Esound/core/control.c
438!Esound/core/pcm_lib.c
439!Esound/core/hwdep.c
440!Esound/core/pcm_native.c
441!Esound/core/memalloc.c
442<!-- FIXME: Removed for now since no structured comments in source
443X!Isound/sound_firmware.c
444-->
445 </chapter>
446
447 <chapter id="uart16x50">
448 <title>16x50 UART Driver</title>
449!Iinclude/linux/serial_core.h
450!Edrivers/serial/serial_core.c
451!Edrivers/serial/8250.c
452 </chapter>
453
454 <chapter id="fbdev">
455 <title>Frame Buffer Library</title>
456
457 <para>
458 The frame buffer drivers depend heavily on four data structures.
459 These structures are declared in include/linux/fb.h. They are
460 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
461 The last three can be made available to and from userland.
462 </para>
463
464 <para>
465 fb_info defines the current state of a particular video card.
466 Inside fb_info, there exists a fb_ops structure which is a
467 collection of needed functions to make fbdev and fbcon work.
468 fb_info is only visible to the kernel.
469 </para>
470
471 <para>
472 fb_var_screeninfo is used to describe the features of a video card
473 that are user defined. With fb_var_screeninfo, things such as
474 depth and the resolution may be defined.
475 </para>
476
477 <para>
478 The next structure is fb_fix_screeninfo. This defines the
479 properties of a card that are created when a mode is set and can't
480 be changed otherwise. A good example of this is the start of the
481 frame buffer memory. This "locks" the address of the frame buffer
482 memory, so that it cannot be changed or moved.
483 </para>
484
485 <para>
486 The last structure is fb_monospecs. In the old API, there was
487 little importance for fb_monospecs. This allowed for forbidden things
488 such as setting a mode of 800x600 on a fix frequency monitor. With
489 the new API, fb_monospecs prevents such things, and if used
490 correctly, can prevent a monitor from being cooked. fb_monospecs
491 will not be useful until kernels 2.5.x.
492 </para>
493
494 <sect1><title>Frame Buffer Memory</title>
495!Edrivers/video/fbmem.c
496 </sect1>
497<!--
498 <sect1><title>Frame Buffer Console</title>
499X!Edrivers/video/console/fbcon.c
500 </sect1>
501-->
502 <sect1><title>Frame Buffer Colormap</title>
503!Edrivers/video/fbcmap.c
504 </sect1>
505<!-- FIXME:
506 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
507 out until somebody adds docs. KAO
508 <sect1><title>Frame Buffer Generic Functions</title>
509X!Idrivers/video/fbgen.c
510 </sect1>
511KAO -->
512 <sect1><title>Frame Buffer Video Mode Database</title>
513!Idrivers/video/modedb.c
514!Edrivers/video/modedb.c
515 </sect1>
516 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
517!Edrivers/video/macmodes.c
518 </sect1>
519 <sect1><title>Frame Buffer Fonts</title>
520 <para>
521 Refer to the file drivers/video/console/fonts.c for more information.
522 </para>
523<!-- FIXME: Removed for now since no structured comments in source
524X!Idrivers/video/console/fonts.c
525-->
526 </sect1>
527 </chapter>
528
529 <chapter id="input_subsystem">
530 <title>Input Subsystem</title>
531!Iinclude/linux/input.h
532!Edrivers/input/input.c
533!Edrivers/input/ff-core.c
534!Edrivers/input/ff-memless.c
535 </chapter>
536
537 <chapter id="spi">
538 <title>Serial Peripheral Interface (SPI)</title>
539 <para>
540 SPI is the "Serial Peripheral Interface", widely used with
541 embedded systems because it is a simple and efficient
542 interface: basically a multiplexed shift register.
543 Its three signal wires hold a clock (SCK, often in the range
544 of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
545 a "Master In, Slave Out" (MISO) data line.
546 SPI is a full duplex protocol; for each bit shifted out the
547 MOSI line (one per clock) another is shifted in on the MISO line.
548 Those bits are assembled into words of various sizes on the
549 way to and from system memory.
550 An additional chipselect line is usually active-low (nCS);
551 four signals are normally used for each peripheral, plus
552 sometimes an interrupt.
553 </para>
554 <para>
555 The SPI bus facilities listed here provide a generalized
556 interface to declare SPI busses and devices, manage them
557 according to the standard Linux driver model, and perform
558 input/output operations.
559 At this time, only "master" side interfaces are supported,
560 where Linux talks to SPI peripherals and does not implement
561 such a peripheral itself.
562 (Interfaces to support implementing SPI slaves would
563 necessarily look different.)
564 </para>
565 <para>
566 The programming interface is structured around two kinds of driver,
567 and two kinds of device.
568 A "Controller Driver" abstracts the controller hardware, which may
569 be as simple as a set of GPIO pins or as complex as a pair of FIFOs
570 connected to dual DMA engines on the other side of the SPI shift
571 register (maximizing throughput). Such drivers bridge between
572 whatever bus they sit on (often the platform bus) and SPI, and
573 expose the SPI side of their device as a
574 <structname>struct spi_master</structname>.
575 SPI devices are children of that master, represented as a
576 <structname>struct spi_device</structname> and manufactured from
577 <structname>struct spi_board_info</structname> descriptors which
578 are usually provided by board-specific initialization code.
579 A <structname>struct spi_driver</structname> is called a
580 "Protocol Driver", and is bound to a spi_device using normal
581 driver model calls.
582 </para>
583 <para>
584 The I/O model is a set of queued messages. Protocol drivers
585 submit one or more <structname>struct spi_message</structname>
586 objects, which are processed and completed asynchronously.
587 (There are synchronous wrappers, however.) Messages are
588 built from one or more <structname>struct spi_transfer</structname>
589 objects, each of which wraps a full duplex SPI transfer.
590 A variety of protocol tweaking options are needed, because
591 different chips adopt very different policies for how they
592 use the bits transferred with SPI.
593 </para>
594!Iinclude/linux/spi/spi.h
595!Fdrivers/spi/spi.c spi_register_board_info
596!Edrivers/spi/spi.c
597 </chapter>
598
599 <chapter id="i2c">
600 <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
601
602 <para>
603 I<superscript>2</superscript>C (or without fancy typography, "I2C")
604 is an acronym for the "Inter-IC" bus, a simple bus protocol which is
605 widely used where low data rate communications suffice.
606 Since it's also a licensed trademark, some vendors use another
607 name (such as "Two-Wire Interface", TWI) for the same bus.
608 I2C only needs two signals (SCL for clock, SDA for data), conserving
609 board real estate and minimizing signal quality issues.
610 Most I2C devices use seven bit addresses, and bus speeds of up
611 to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
612 found wide use.
613 I2C is a multi-master bus; open drain signaling is used to
614 arbitrate between masters, as well as to handshake and to
615 synchronize clocks from slower clients.
616 </para>
617
618 <para>
619 The Linux I2C programming interfaces support only the master
620 side of bus interactions, not the slave side.
621 The programming interface is structured around two kinds of driver,
622 and two kinds of device.
623 An I2C "Adapter Driver" abstracts the controller hardware; it binds
624 to a physical device (perhaps a PCI device or platform_device) and
625 exposes a <structname>struct i2c_adapter</structname> representing
626 each I2C bus segment it manages.
627 On each I2C bus segment will be I2C devices represented by a
628 <structname>struct i2c_client</structname>. Those devices will
629 be bound to a <structname>struct i2c_driver</structname>,
630 which should follow the standard Linux driver model.
631 (At this writing, a legacy model is more widely used.)
632 There are functions to perform various I2C protocol operations; at
633 this writing all such functions are usable only from task context.
634 </para>
635
636 <para>
637 The System Management Bus (SMBus) is a sibling protocol. Most SMBus
638 systems are also I2C conformant. The electrical constraints are
639 tighter for SMBus, and it standardizes particular protocol messages
640 and idioms. Controllers that support I2C can also support most
641 SMBus operations, but SMBus controllers don't support all the protocol
642 options that an I2C controller will.
643 There are functions to perform various SMBus protocol operations,
644 either using I2C primitives or by issuing SMBus commands to
645 i2c_adapter devices which don't support those I2C operations.
646 </para>
647
648!Iinclude/linux/i2c.h
649!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
650!Edrivers/i2c/i2c-core.c
651 </chapter>
652
653 <chapter id="clk"> 276 <chapter id="clk">
654 <title>Clock Framework</title> 277 <title>Clock Framework</title>
655 278
diff --git a/Documentation/PCI/PCIEBUS-HOWTO.txt b/Documentation/PCI/PCIEBUS-HOWTO.txt
index 9a07e38631b0..6bd5f372adec 100644
--- a/Documentation/PCI/PCIEBUS-HOWTO.txt
+++ b/Documentation/PCI/PCIEBUS-HOWTO.txt
@@ -93,7 +93,7 @@ the PCI Express Port Bus driver from loading a service driver.
93 93
94int pcie_port_service_register(struct pcie_port_service_driver *new) 94int pcie_port_service_register(struct pcie_port_service_driver *new)
95 95
96This API replaces the Linux Driver Model's pci_module_init API. A 96This API replaces the Linux Driver Model's pci_register_driver API. A
97service driver should always calls pcie_port_service_register at 97service driver should always calls pcie_port_service_register at
98module init. Note that after service driver being loaded, calls 98module init. Note that after service driver being loaded, calls
99such as pci_enable_device(dev) and pci_set_master(dev) are no longer 99such as pci_enable_device(dev) and pci_set_master(dev) are no longer
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt
index 6e253407b3dc..accfe2f5247d 100644
--- a/Documentation/RCU/checklist.txt
+++ b/Documentation/RCU/checklist.txt
@@ -298,3 +298,15 @@ over a rather long period of time, but improvements are always welcome!
298 298
299 Note that, rcu_assign_pointer() and rcu_dereference() relate to 299 Note that, rcu_assign_pointer() and rcu_dereference() relate to
300 SRCU just as they do to other forms of RCU. 300 SRCU just as they do to other forms of RCU.
301
30215. The whole point of call_rcu(), synchronize_rcu(), and friends
303 is to wait until all pre-existing readers have finished before
304 carrying out some otherwise-destructive operation. It is
305 therefore critically important to -first- remove any path
306 that readers can follow that could be affected by the
307 destructive operation, and -only- -then- invoke call_rcu(),
308 synchronize_rcu(), or friends.
309
310 Because these primitives only wait for pre-existing readers,
311 it is the caller's responsibility to guarantee safety to
312 any subsequent readers.
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index d9e5d6f41b92..93feb8444489 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -252,10 +252,8 @@ cgroup file system directories.
252When a task is moved from one cgroup to another, it gets a new 252When a task is moved from one cgroup to another, it gets a new
253css_set pointer - if there's an already existing css_set with the 253css_set pointer - if there's an already existing css_set with the
254desired collection of cgroups then that group is reused, else a new 254desired collection of cgroups then that group is reused, else a new
255css_set is allocated. Note that the current implementation uses a 255css_set is allocated. The appropriate existing css_set is located by
256linear search to locate an appropriate existing css_set, so isn't 256looking into a hash table.
257very efficient. A future version will use a hash table for better
258performance.
259 257
260To allow access from a cgroup to the css_sets (and hence tasks) 258To allow access from a cgroup to the css_sets (and hence tasks)
261that comprise it, a set of cg_cgroup_link objects form a lattice; 259that comprise it, a set of cg_cgroup_link objects form a lattice;
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt
index 5c86c258c791..0611e9528c7c 100644
--- a/Documentation/cgroups/cpusets.txt
+++ b/Documentation/cgroups/cpusets.txt
@@ -142,7 +142,7 @@ into the rest of the kernel, none in performance critical paths:
142 - in fork and exit, to attach and detach a task from its cpuset. 142 - in fork and exit, to attach and detach a task from its cpuset.
143 - in sched_setaffinity, to mask the requested CPUs by what's 143 - in sched_setaffinity, to mask the requested CPUs by what's
144 allowed in that tasks cpuset. 144 allowed in that tasks cpuset.
145 - in sched.c migrate_all_tasks(), to keep migrating tasks within 145 - in sched.c migrate_live_tasks(), to keep migrating tasks within
146 the CPUs allowed by their cpuset, if possible. 146 the CPUs allowed by their cpuset, if possible.
147 - in the mbind and set_mempolicy system calls, to mask the requested 147 - in the mbind and set_mempolicy system calls, to mask the requested
148 Memory Nodes by what's allowed in that tasks cpuset. 148 Memory Nodes by what's allowed in that tasks cpuset.
@@ -175,6 +175,10 @@ files describing that cpuset:
175 - mem_exclusive flag: is memory placement exclusive? 175 - mem_exclusive flag: is memory placement exclusive?
176 - mem_hardwall flag: is memory allocation hardwalled 176 - mem_hardwall flag: is memory allocation hardwalled
177 - memory_pressure: measure of how much paging pressure in cpuset 177 - memory_pressure: measure of how much paging pressure in cpuset
178 - memory_spread_page flag: if set, spread page cache evenly on allowed nodes
179 - memory_spread_slab flag: if set, spread slab cache evenly on allowed nodes
180 - sched_load_balance flag: if set, load balance within CPUs on that cpuset
181 - sched_relax_domain_level: the searching range when migrating tasks
178 182
179In addition, the root cpuset only has the following file: 183In addition, the root cpuset only has the following file:
180 - memory_pressure_enabled flag: compute memory_pressure? 184 - memory_pressure_enabled flag: compute memory_pressure?
@@ -252,7 +256,7 @@ is causing.
252 256
253This is useful both on tightly managed systems running a wide mix of 257This is useful both on tightly managed systems running a wide mix of
254submitted jobs, which may choose to terminate or re-prioritize jobs that 258submitted jobs, which may choose to terminate or re-prioritize jobs that
255are trying to use more memory than allowed on the nodes assigned them, 259are trying to use more memory than allowed on the nodes assigned to them,
256and with tightly coupled, long running, massively parallel scientific 260and with tightly coupled, long running, massively parallel scientific
257computing jobs that will dramatically fail to meet required performance 261computing jobs that will dramatically fail to meet required performance
258goals if they start to use more memory than allowed to them. 262goals if they start to use more memory than allowed to them.
@@ -378,7 +382,7 @@ as cpusets and sched_setaffinity.
378The algorithmic cost of load balancing and its impact on key shared 382The algorithmic cost of load balancing and its impact on key shared
379kernel data structures such as the task list increases more than 383kernel data structures such as the task list increases more than
380linearly with the number of CPUs being balanced. So the scheduler 384linearly with the number of CPUs being balanced. So the scheduler
381has support to partition the systems CPUs into a number of sched 385has support to partition the systems CPUs into a number of sched
382domains such that it only load balances within each sched domain. 386domains such that it only load balances within each sched domain.
383Each sched domain covers some subset of the CPUs in the system; 387Each sched domain covers some subset of the CPUs in the system;
384no two sched domains overlap; some CPUs might not be in any sched 388no two sched domains overlap; some CPUs might not be in any sched
@@ -485,17 +489,22 @@ of CPUs allowed to a cpuset having 'sched_load_balance' enabled.
485The internal kernel cpuset to scheduler interface passes from the 489The internal kernel cpuset to scheduler interface passes from the
486cpuset code to the scheduler code a partition of the load balanced 490cpuset code to the scheduler code a partition of the load balanced
487CPUs in the system. This partition is a set of subsets (represented 491CPUs in the system. This partition is a set of subsets (represented
488as an array of cpumask_t) of CPUs, pairwise disjoint, that cover all 492as an array of struct cpumask) of CPUs, pairwise disjoint, that cover
489the CPUs that must be load balanced. 493all the CPUs that must be load balanced.
490 494
491Whenever the 'sched_load_balance' flag changes, or CPUs come or go 495The cpuset code builds a new such partition and passes it to the
492from a cpuset with this flag enabled, or a cpuset with this flag 496scheduler sched domain setup code, to have the sched domains rebuilt
493enabled is removed, the cpuset code builds a new such partition and 497as necessary, whenever:
494passes it to the scheduler sched domain setup code, to have the sched 498 - the 'sched_load_balance' flag of a cpuset with non-empty CPUs changes,
495domains rebuilt as necessary. 499 - or CPUs come or go from a cpuset with this flag enabled,
500 - or 'sched_relax_domain_level' value of a cpuset with non-empty CPUs
501 and with this flag enabled changes,
502 - or a cpuset with non-empty CPUs and with this flag enabled is removed,
503 - or a cpu is offlined/onlined.
496 504
497This partition exactly defines what sched domains the scheduler should 505This partition exactly defines what sched domains the scheduler should
498setup - one sched domain for each element (cpumask_t) in the partition. 506setup - one sched domain for each element (struct cpumask) in the
507partition.
499 508
500The scheduler remembers the currently active sched domain partitions. 509The scheduler remembers the currently active sched domain partitions.
501When the scheduler routine partition_sched_domains() is invoked from 510When the scheduler routine partition_sched_domains() is invoked from
@@ -559,7 +568,7 @@ domain, the largest value among those is used. Be careful, if one
559requests 0 and others are -1 then 0 is used. 568requests 0 and others are -1 then 0 is used.
560 569
561Note that modifying this file will have both good and bad effects, 570Note that modifying this file will have both good and bad effects,
562and whether it is acceptable or not will be depend on your situation. 571and whether it is acceptable or not depends on your situation.
563Don't modify this file if you are not sure. 572Don't modify this file if you are not sure.
564 573
565If your situation is: 574If your situation is:
@@ -600,19 +609,15 @@ to allocate a page of memory for that task.
600 609
601If a cpuset has its 'cpus' modified, then each task in that cpuset 610If a cpuset has its 'cpus' modified, then each task in that cpuset
602will have its allowed CPU placement changed immediately. Similarly, 611will have its allowed CPU placement changed immediately. Similarly,
603if a tasks pid is written to a cpusets 'tasks' file, in either its 612if a tasks pid is written to another cpusets 'tasks' file, then its
604current cpuset or another cpuset, then its allowed CPU placement is 613allowed CPU placement is changed immediately. If such a task had been
605changed immediately. If such a task had been bound to some subset 614bound to some subset of its cpuset using the sched_setaffinity() call,
606of its cpuset using the sched_setaffinity() call, the task will be 615the task will be allowed to run on any CPU allowed in its new cpuset,
607allowed to run on any CPU allowed in its new cpuset, negating the 616negating the effect of the prior sched_setaffinity() call.
608affect of the prior sched_setaffinity() call.
609 617
610In summary, the memory placement of a task whose cpuset is changed is 618In summary, the memory placement of a task whose cpuset is changed is
611updated by the kernel, on the next allocation of a page for that task, 619updated by the kernel, on the next allocation of a page for that task,
612but the processor placement is not updated, until that tasks pid is 620and the processor placement is updated immediately.
613rewritten to the 'tasks' file of its cpuset. This is done to avoid
614impacting the scheduler code in the kernel with a check for changes
615in a tasks processor placement.
616 621
617Normally, once a page is allocated (given a physical page 622Normally, once a page is allocated (given a physical page
618of main memory) then that page stays on whatever node it 623of main memory) then that page stays on whatever node it
@@ -681,10 +686,14 @@ and then start a subshell 'sh' in that cpuset:
681 # The next line should display '/Charlie' 686 # The next line should display '/Charlie'
682 cat /proc/self/cpuset 687 cat /proc/self/cpuset
683 688
684In the future, a C library interface to cpusets will likely be 689There are ways to query or modify cpusets:
685available. For now, the only way to query or modify cpusets is 690 - via the cpuset file system directly, using the various cd, mkdir, echo,
686via the cpuset file system, using the various cd, mkdir, echo, cat, 691 cat, rmdir commands from the shell, or their equivalent from C.
687rmdir commands from the shell, or their equivalent from C. 692 - via the C library libcpuset.
693 - via the C library libcgroup.
694 (http://sourceforge.net/proects/libcg/)
695 - via the python application cset.
696 (http://developer.novell.com/wiki/index.php/Cpuset)
688 697
689The sched_setaffinity calls can also be done at the shell prompt using 698The sched_setaffinity calls can also be done at the shell prompt using
690SGI's runon or Robert Love's taskset. The mbind and set_mempolicy 699SGI's runon or Robert Love's taskset. The mbind and set_mempolicy
@@ -756,7 +765,7 @@ mount -t cpuset X /dev/cpuset
756 765
757is equivalent to 766is equivalent to
758 767
759mount -t cgroup -ocpuset X /dev/cpuset 768mount -t cgroup -ocpuset,noprefix X /dev/cpuset
760echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent 769echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent
761 770
7622.2 Adding/removing cpus 7712.2 Adding/removing cpus
diff --git a/Documentation/driver-model/device.txt b/Documentation/driver-model/device.txt
index a05ec50f8004..a7cbfff40d07 100644
--- a/Documentation/driver-model/device.txt
+++ b/Documentation/driver-model/device.txt
@@ -127,9 +127,11 @@ void unlock_device(struct device * dev);
127Attributes 127Attributes
128~~~~~~~~~~ 128~~~~~~~~~~
129struct device_attribute { 129struct device_attribute {
130 struct attribute attr; 130 struct attribute attr;
131 ssize_t (*show)(struct device * dev, char * buf, size_t count, loff_t off); 131 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
132 ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off); 132 char *buf);
133 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
134 const char *buf, size_t count);
133}; 135};
134 136
135Attributes of devices can be exported via drivers using a simple 137Attributes of devices can be exported via drivers using a simple
diff --git a/Documentation/dvb/README.flexcop b/Documentation/dvb/README.flexcop
deleted file mode 100644
index 5515469de7cf..000000000000
--- a/Documentation/dvb/README.flexcop
+++ /dev/null
@@ -1,205 +0,0 @@
1This README escorted the skystar2-driver rewriting procedure. It describes the
2state of the new flexcop-driver set and some internals are written down here
3too.
4
5This document hopefully describes things about the flexcop and its
6device-offsprings. Goal was to write an easy-to-write and easy-to-read set of
7drivers based on the skystar2.c and other information.
8
9Remark: flexcop-pci.c was a copy of skystar2.c, but every line has been
10touched and rewritten.
11
12History & News
13==============
14 2005-04-01 - correct USB ISOC transfers (thanks to Vadim Catana)
15
16
17
18
19General coding processing
20=========================
21
22We should proceed as follows (as long as no one complains):
23
240) Think before start writing code!
25
261) rewriting the skystar2.c with the help of the flexcop register descriptions
27and splitting up the files to a pci-bus-part and a flexcop-part.
28The new driver will be called b2c2-flexcop-pci.ko/b2c2-flexcop-usb.ko for the
29device-specific part and b2c2-flexcop.ko for the common flexcop-functions.
30
312) Search for errors in the leftover of flexcop-pci.c (compare with pluto2.c
32and other pci drivers)
33
343) make some beautification (see 'Improvements when rewriting (refactoring) is
35done')
36
374) Testing the new driver and maybe substitute the skystar2.c with it, to reach
38a wider tester audience.
39
405) creating an usb-bus-part using the already written flexcop code for the pci
41card.
42
43Idea: create a kernel-object for the flexcop and export all important
44functions. This option saves kernel-memory, but maybe a lot of functions have
45to be exported to kernel namespace.
46
47
48Current situation
49=================
50
510) Done :)
521) Done (some minor issues left)
532) Done
543) Not ready yet, more information is necessary
554) next to be done (see the table below)
565) USB driver is working (yes, there are some minor issues)
57
58What seems to be ready?
59-----------------------
60
611) Rewriting
621a) i2c is cut off from the flexcop-pci.c and seems to work
631b) moved tuner and demod stuff from flexcop-pci.c to flexcop-tuner-fe.c
641c) moved lnb and diseqc stuff from flexcop-pci.c to flexcop-tuner-fe.c
651e) eeprom (reading MAC address)
661d) sram (no dynamic sll size detection (commented out) (using default as JJ told me))
671f) misc. register accesses for reading parameters (e.g. resetting, revision)
681g) pid/mac filter (flexcop-hw-filter.c)
691i) dvb-stuff initialization in flexcop.c (done)
701h) dma stuff (now just using the size-irq, instead of all-together, to be done)
711j) remove flexcop initialization from flexcop-pci.c completely (done)
721l) use a well working dma IRQ method (done, see 'Known bugs and problems and TODO')
731k) cleanup flexcop-files (remove unused EXPORT_SYMBOLs, make static from
74non-static where possible, moved code to proper places)
75
762) Search for errors in the leftover of flexcop-pci.c (partially done)
775a) add MAC address reading
785c) feeding of ISOC data to the software demux (format of the isochronous data
79and speed optimization, no real error) (thanks to Vadim Catana)
80
81What to do in the near future?
82--------------------------------------
83(no special order here)
84
855) USB driver
865b) optimize isoc-transfer (submitting/killing isoc URBs when transfer is starting)
87
88Testing changes
89---------------
90
91O = item is working
92P = item is partially working
93X = item is not working
94N = item does not apply here
95<empty field> = item need to be examined
96
97 | PCI | USB
98item | mt352 | nxt2002 | stv0299 | mt312 | mt352 | nxt2002 | stv0299 | mt312
99-------+-------+---------+---------+-------+-------+---------+---------+-------
1001a) | O | | | | N | N | N | N
1011b) | O | | | | | | O |
1021c) | N | N | | | N | N | O |
1031d) | O | O
1041e) | O | O
1051f) | P
1061g) | O
1071h) | P |
1081i) | O | N
1091j) | O | N
1101l) | O | N
1112) | O | N
1125a) | N | O
1135b)* | N |
1145c) | N | O
115
116* - not done yet
117
118Known bugs and problems and TODO
119--------------------------------
120
1211g/h/l) when pid filtering is enabled on the pci card
122
123DMA usage currently:
124 The DMA is splitted in 2 equal-sized subbuffers. The Flexcop writes to first
125 address and triggers an IRQ when it's full and starts writing to the second
126 address. When the second address is full, the IRQ is triggered again, and
127 the flexcop writes to first address again, and so on.
128 The buffersize of each address is currently 640*188 bytes.
129
130 Problem is, when using hw-pid-filtering and doing some low-bandwidth
131 operation (like scanning) the buffers won't be filled enough to trigger
132 the IRQ. That's why:
133
134 When PID filtering is activated, the timer IRQ is used. Every 1.97 ms the IRQ
135 is triggered. Is the current write address of DMA1 different to the one
136 during the last IRQ, then the data is passed to the demuxer.
137
138 There is an additional DMA-IRQ-method: packet count IRQ. This isn't
139 implemented correctly yet.
140
141 The solution is to disable HW PID filtering, but I don't know how the DVB
142 API software demux behaves on slow systems with 45MBit/s TS.
143
144Solved bugs :)
145--------------
1461g) pid-filtering (somehow pid index 4 and 5 (EMM_PID and ECM_PID) aren't
147working)
148SOLUTION: also index 0 was affected, because net_translation is done for
149these indexes by default
150
1515b) isochronous transfer does only work in the first attempt (for the Sky2PC
152USB, Air2PC is working) SOLUTION: the flexcop was going asleep and never really
153woke up again (don't know if this need fixes, see
154flexcop-fe-tuner.c:flexcop_sleep)
155
156NEWS: when the driver is loaded and unloaded and loaded again (w/o doing
157anything in the while the driver is loaded the first time), no transfers take
158place anymore.
159
160Improvements when rewriting (refactoring) is done
161=================================================
162
163- split sleeping of the flexcop (misc_204.ACPI3_sig = 1;) from lnb_control
164 (enable sleeping for other demods than dvb-s)
165- add support for CableStar (stv0297 Microtune 203x/ALPS) (almost done, incompatibilities with the Nexus-CA)
166
167Debugging
168---------
169- add verbose debugging to skystar2.c (dump the reg_dw_data) and compare it
170 with this flexcop, this is important, because i2c is now using the
171 flexcop_ibi_value union from flexcop-reg.h (do you have a better idea for
172 that, please tell us so).
173
174Everything which is identical in the following table, can be put into a common
175flexcop-module.
176
177 PCI USB
178-------------------------------------------------------------------------------
179Different:
180Register access: accessing IO memory USB control message
181I2C bus: I2C bus of the FC USB control message
182Data transfer: DMA isochronous transfer
183EEPROM transfer: through i2c bus not clear yet
184
185Identical:
186Streaming: accessing registers
187PID Filtering: accessing registers
188Sram destinations: accessing registers
189Tuner/Demod: I2C bus
190DVB-stuff: can be written for common use
191
192Acknowledgements (just for the rewriting part)
193================
194
195Bjarne Steinsbo thought a lot in the first place of the pci part for this code
196sharing idea.
197
198Andreas Oberritter for providing a recent PCI initialization template
199(pluto2.c).
200
201Boleslaw Ciesielski for pointing out a problem with firmware loader.
202
203Vadim Catana for correcting the USB transfer.
204
205comments, critics and ideas to linux-dvb@linuxtv.org.
diff --git a/Documentation/dvb/technisat.txt b/Documentation/dvb/technisat.txt
index cdf6ee4b2da1..3f435ffb289c 100644
--- a/Documentation/dvb/technisat.txt
+++ b/Documentation/dvb/technisat.txt
@@ -1,5 +1,5 @@
1How to set up the Technisat devices 1How to set up the Technisat/B2C2 Flexcop devices
2=================================== 2================================================
3 3
41) Find out what device you have 41) Find out what device you have
5================================ 5================================
@@ -16,54 +16,60 @@ DVB: registering frontend 0 (Conexant CX24123/CX24109)...
16 16
17If the Technisat is the only TV device in your box get rid of unnecessary modules and check this one: 17If the Technisat is the only TV device in your box get rid of unnecessary modules and check this one:
18"Multimedia devices" => "Customise analog and hybrid tuner modules to build" 18"Multimedia devices" => "Customise analog and hybrid tuner modules to build"
19In this directory uncheck every driver which is activated there. 19In this directory uncheck every driver which is activated there (except "Simple tuner support" for case 9 only).
20 20
21Then please activate: 21Then please activate:
222a) Main module part: 222a) Main module part:
23 23
24a.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" 24a.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters"
25b.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC PCI" in case of a PCI card OR 25b.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC PCI" in case of a PCI card
26OR
26c.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC USB" in case of an USB 1.1 adapter 27c.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC USB" in case of an USB 1.1 adapter
27d.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Enable debug for the B2C2 FlexCop drivers" 28d.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Enable debug for the B2C2 FlexCop drivers"
28Notice: d.) is helpful for troubleshooting 29Notice: d.) is helpful for troubleshooting
29 30
302b) Frontend module part: 312b) Frontend module part:
31 32
321.) Revision 2.3: 331.) SkyStar DVB-S Revision 2.3:
33a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 34a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
34b.)"Multimedia devices" => "Customise DVB frontends" => "Zarlink VP310/MT312/ZL10313 based" 35b.)"Multimedia devices" => "Customise DVB frontends" => "Zarlink VP310/MT312/ZL10313 based"
35 36
362.) Revision 2.6: 372.) SkyStar DVB-S Revision 2.6:
37a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 38a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
38b.)"Multimedia devices" => "Customise DVB frontends" => "ST STV0299 based" 39b.)"Multimedia devices" => "Customise DVB frontends" => "ST STV0299 based"
39 40
403.) Revision 2.7: 413.) SkyStar DVB-S Revision 2.7:
41a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 42a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
42b.)"Multimedia devices" => "Customise DVB frontends" => "Samsung S5H1420 based" 43b.)"Multimedia devices" => "Customise DVB frontends" => "Samsung S5H1420 based"
43c.)"Multimedia devices" => "Customise DVB frontends" => "Integrant ITD1000 Zero IF tuner for DVB-S/DSS" 44c.)"Multimedia devices" => "Customise DVB frontends" => "Integrant ITD1000 Zero IF tuner for DVB-S/DSS"
44d.)"Multimedia devices" => "Customise DVB frontends" => "ISL6421 SEC controller" 45d.)"Multimedia devices" => "Customise DVB frontends" => "ISL6421 SEC controller"
45 46
464.) Revision 2.8: 474.) SkyStar DVB-S Revision 2.8:
47a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 48a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
48b.)"Multimedia devices" => "Customise DVB frontends" => "Conexant CX24113/CX24128 tuner for DVB-S/DSS" 49b.)"Multimedia devices" => "Customise DVB frontends" => "Conexant CX24113/CX24128 tuner for DVB-S/DSS"
49c.)"Multimedia devices" => "Customise DVB frontends" => "Conexant CX24123 based" 50c.)"Multimedia devices" => "Customise DVB frontends" => "Conexant CX24123 based"
50d.)"Multimedia devices" => "Customise DVB frontends" => "ISL6421 SEC controller" 51d.)"Multimedia devices" => "Customise DVB frontends" => "ISL6421 SEC controller"
51 52
525.) DVB-T card: 535.) AirStar DVB-T card:
53a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 54a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
54b.)"Multimedia devices" => "Customise DVB frontends" => "Zarlink MT352 based" 55b.)"Multimedia devices" => "Customise DVB frontends" => "Zarlink MT352 based"
55 56
566.) DVB-C card: 576.) CableStar DVB-C card:
57a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 58a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
58b.)"Multimedia devices" => "Customise DVB frontends" => "ST STV0297 based" 59b.)"Multimedia devices" => "Customise DVB frontends" => "ST STV0297 based"
59 60
607.) ATSC card 1st generation: 617.) AirStar ATSC card 1st generation:
61a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 62a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
62b.)"Multimedia devices" => "Customise DVB frontends" => "Broadcom BCM3510" 63b.)"Multimedia devices" => "Customise DVB frontends" => "Broadcom BCM3510"
63 64
648.) ATSC card 2nd generation: 658.) AirStar ATSC card 2nd generation:
65a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" 66a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
66b.)"Multimedia devices" => "Customise DVB frontends" => "NxtWave Communications NXT2002/NXT2004 based" 67b.)"Multimedia devices" => "Customise DVB frontends" => "NxtWave Communications NXT2002/NXT2004 based"
67c.)"Multimedia devices" => "Customise DVB frontends" => "LG Electronics LGDT3302/LGDT3303 based" 68c.)"Multimedia devices" => "Customise DVB frontends" => "Generic I2C PLL based tuners"
68 69
69Author: Uwe Bugla <uwe.bugla@gmx.de> December 2008 709.) AirStar ATSC card 3rd generation:
71a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build"
72b.)"Multimedia devices" => "Customise DVB frontends" => "LG Electronics LGDT3302/LGDT3303 based"
73c.)"Multimedia devices" => "Customise analog and hybrid tuner modules to build" => "Simple tuner support"
74
75Author: Uwe Bugla <uwe.bugla@gmx.de> February 2009
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 5ddbe350487a..9aa1dda5d38c 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -335,3 +335,29 @@ Why: In 2.6.18 the Secmark concept was introduced to replace the "compat_net"
335 Secmark, it is time to deprecate the older mechanism and start the 335 Secmark, it is time to deprecate the older mechanism and start the
336 process of removing the old code. 336 process of removing the old code.
337Who: Paul Moore <paul.moore@hp.com> 337Who: Paul Moore <paul.moore@hp.com>
338---------------------------
339
340What: sysfs ui for changing p4-clockmod parameters
341When: September 2009
342Why: See commits 129f8ae9b1b5be94517da76009ea956e89104ce8 and
343 e088e4c9cdb618675874becb91b2fd581ee707e6.
344 Removal is subject to fixing any remaining bugs in ACPI which may
345 cause the thermal throttling not to happen at the right time.
346Who: Dave Jones <davej@redhat.com>, Matthew Garrett <mjg@redhat.com>
347
348-----------------------------
349
350What: __do_IRQ all in one fits nothing interrupt handler
351When: 2.6.32
352Why: __do_IRQ was kept for easy migration to the type flow handlers.
353 More than two years of migration time is enough.
354Who: Thomas Gleixner <tglx@linutronix.de>
355
356-----------------------------
357
358What: obsolete generic irq defines and typedefs
359When: 2.6.30
360Why: The defines and typedefs (hw_interrupt_type, no_irq_type, irq_desc_t)
361 have been kept around for migration reasons. After more than two years
362 it's time to remove them finally
363Who: Thomas Gleixner <tglx@linutronix.de>
diff --git a/Documentation/filesystems/ext2.txt b/Documentation/filesystems/ext2.txt
index 4333e836c495..23448551cabe 100644
--- a/Documentation/filesystems/ext2.txt
+++ b/Documentation/filesystems/ext2.txt
@@ -373,10 +373,10 @@ Filesystem Resizing http://ext2resize.sourceforge.net/
373Compression (*) http://e2compr.sourceforge.net/ 373Compression (*) http://e2compr.sourceforge.net/
374 374
375Implementations for: 375Implementations for:
376Windows 95/98/NT/2000 http://uranus.it.swin.edu.au/~jn/linux/Explore2fs.htm 376Windows 95/98/NT/2000 http://www.chrysocome.net/explore2fs
377Windows 95 (*) http://www.yipton.demon.co.uk/content.html#FSDEXT2 377Windows 95 (*) http://www.yipton.net/content.html#FSDEXT2
378DOS client (*) ftp://metalab.unc.edu/pub/Linux/system/filesystems/ext2/ 378DOS client (*) ftp://metalab.unc.edu/pub/Linux/system/filesystems/ext2/
379OS/2 http://perso.wanadoo.fr/matthieu.willm/ext2-os2/ 379OS/2 (*) ftp://metalab.unc.edu/pub/Linux/system/filesystems/ext2/
380RISC OS client ftp://ftp.barnet.ac.uk/pub/acorn/armlinux/iscafs/ 380RISC OS client http://www.esw-heim.tu-clausthal.de/~marco/smorbrod/IscaFS/
381 381
382(*) no longer actively developed/supported (as of Apr 2001) 382(*) no longer actively developed/supported (as of Mar 2009)
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt
index 9dd2a3bb2acc..e5f3833a6ef8 100644
--- a/Documentation/filesystems/ext3.txt
+++ b/Documentation/filesystems/ext3.txt
@@ -198,5 +198,5 @@ kernel source: <file:fs/ext3/>
198programs: http://e2fsprogs.sourceforge.net/ 198programs: http://e2fsprogs.sourceforge.net/
199 http://ext2resize.sourceforge.net 199 http://ext2resize.sourceforge.net
200 200
201useful links: http://www-106.ibm.com/developerworks/linux/library/l-fs7/ 201useful links: http://www.ibm.com/developerworks/library/l-fs7.html
202 http://www-106.ibm.com/developerworks/linux/library/l-fs8/ 202 http://www.ibm.com/developerworks/library/l-fs8.html
diff --git a/Documentation/filesystems/squashfs.txt b/Documentation/filesystems/squashfs.txt
index 3e79e4a7a392..b324c033035a 100644
--- a/Documentation/filesystems/squashfs.txt
+++ b/Documentation/filesystems/squashfs.txt
@@ -22,7 +22,7 @@ Squashfs filesystem features versus Cramfs:
22 22
23 Squashfs Cramfs 23 Squashfs Cramfs
24 24
25Max filesystem size: 2^64 16 MiB 25Max filesystem size: 2^64 256 MiB
26Max file size: ~ 2 TiB 16 MiB 26Max file size: ~ 2 TiB 16 MiB
27Max files: unlimited unlimited 27Max files: unlimited unlimited
28Max directories: unlimited unlimited 28Max directories: unlimited unlimited
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 9e9c348275a9..7e81e37c0b1e 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -2,8 +2,10 @@
2sysfs - _The_ filesystem for exporting kernel objects. 2sysfs - _The_ filesystem for exporting kernel objects.
3 3
4Patrick Mochel <mochel@osdl.org> 4Patrick Mochel <mochel@osdl.org>
5Mike Murphy <mamurph@cs.clemson.edu>
5 6
610 January 2003 7Revised: 22 February 2009
8Original: 10 January 2003
7 9
8 10
9What it is: 11What it is:
@@ -64,12 +66,13 @@ An attribute definition is simply:
64 66
65struct attribute { 67struct attribute {
66 char * name; 68 char * name;
69 struct module *owner;
67 mode_t mode; 70 mode_t mode;
68}; 71};
69 72
70 73
71int sysfs_create_file(struct kobject * kobj, struct attribute * attr); 74int sysfs_create_file(struct kobject * kobj, const struct attribute * attr);
72void sysfs_remove_file(struct kobject * kobj, struct attribute * attr); 75void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr);
73 76
74 77
75A bare attribute contains no means to read or write the value of the 78A bare attribute contains no means to read or write the value of the
@@ -80,9 +83,11 @@ a specific object type.
80For example, the driver model defines struct device_attribute like: 83For example, the driver model defines struct device_attribute like:
81 84
82struct device_attribute { 85struct device_attribute {
83 struct attribute attr; 86 struct attribute attr;
84 ssize_t (*show)(struct device * dev, char * buf); 87 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
85 ssize_t (*store)(struct device * dev, const char * buf); 88 char *buf);
89 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
90 const char *buf, size_t count);
86}; 91};
87 92
88int device_create_file(struct device *, struct device_attribute *); 93int device_create_file(struct device *, struct device_attribute *);
@@ -90,12 +95,8 @@ void device_remove_file(struct device *, struct device_attribute *);
90 95
91It also defines this helper for defining device attributes: 96It also defines this helper for defining device attributes:
92 97
93#define DEVICE_ATTR(_name, _mode, _show, _store) \ 98#define DEVICE_ATTR(_name, _mode, _show, _store) \
94struct device_attribute dev_attr_##_name = { \ 99struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
95 .attr = {.name = __stringify(_name) , .mode = _mode }, \
96 .show = _show, \
97 .store = _store, \
98};
99 100
100For example, declaring 101For example, declaring
101 102
@@ -107,9 +108,9 @@ static struct device_attribute dev_attr_foo = {
107 .attr = { 108 .attr = {
108 .name = "foo", 109 .name = "foo",
109 .mode = S_IWUSR | S_IRUGO, 110 .mode = S_IWUSR | S_IRUGO,
111 .show = show_foo,
112 .store = store_foo,
110 }, 113 },
111 .show = show_foo,
112 .store = store_foo,
113}; 114};
114 115
115 116
@@ -161,10 +162,12 @@ To read or write attributes, show() or store() methods must be
161specified when declaring the attribute. The method types should be as 162specified when declaring the attribute. The method types should be as
162simple as those defined for device attributes: 163simple as those defined for device attributes:
163 164
164 ssize_t (*show)(struct device * dev, char * buf); 165ssize_t (*show)(struct device * dev, struct device_attribute * attr,
165 ssize_t (*store)(struct device * dev, const char * buf); 166 char * buf);
167ssize_t (*store)(struct device * dev, struct device_attribute * attr,
168 const char * buf);
166 169
167IOW, they should take only an object and a buffer as parameters. 170IOW, they should take only an object, an attribute, and a buffer as parameters.
168 171
169 172
170sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the 173sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the
@@ -299,14 +302,16 @@ The following interface layers currently exist in sysfs:
299Structure: 302Structure:
300 303
301struct device_attribute { 304struct device_attribute {
302 struct attribute attr; 305 struct attribute attr;
303 ssize_t (*show)(struct device * dev, char * buf); 306 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
304 ssize_t (*store)(struct device * dev, const char * buf); 307 char *buf);
308 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
309 const char *buf, size_t count);
305}; 310};
306 311
307Declaring: 312Declaring:
308 313
309DEVICE_ATTR(_name, _str, _mode, _show, _store); 314DEVICE_ATTR(_name, _mode, _show, _store);
310 315
311Creation/Removal: 316Creation/Removal:
312 317
@@ -342,7 +347,8 @@ Structure:
342struct driver_attribute { 347struct driver_attribute {
343 struct attribute attr; 348 struct attribute attr;
344 ssize_t (*show)(struct device_driver *, char * buf); 349 ssize_t (*show)(struct device_driver *, char * buf);
345 ssize_t (*store)(struct device_driver *, const char * buf); 350 ssize_t (*store)(struct device_driver *, const char * buf,
351 size_t count);
346}; 352};
347 353
348Declaring: 354Declaring:
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c
new file mode 100644
index 000000000000..bbea1ccfd46a
--- /dev/null
+++ b/Documentation/hwmon/hpfall.c
@@ -0,0 +1,101 @@
1/* Disk protection for HP machines.
2 *
3 * Copyright 2008 Eric Piel
4 * Copyright 2009 Pavel Machek <pavel@suse.cz>
5 *
6 * GPLv2.
7 */
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <unistd.h>
12#include <fcntl.h>
13#include <sys/stat.h>
14#include <sys/types.h>
15#include <string.h>
16#include <stdint.h>
17#include <errno.h>
18#include <signal.h>
19
20void write_int(char *path, int i)
21{
22 char buf[1024];
23 int fd = open(path, O_RDWR);
24 if (fd < 0) {
25 perror("open");
26 exit(1);
27 }
28 sprintf(buf, "%d", i);
29 if (write(fd, buf, strlen(buf)) != strlen(buf)) {
30 perror("write");
31 exit(1);
32 }
33 close(fd);
34}
35
36void set_led(int on)
37{
38 write_int("/sys/class/leds/hp::hddprotect/brightness", on);
39}
40
41void protect(int seconds)
42{
43 write_int("/sys/block/sda/device/unload_heads", seconds*1000);
44}
45
46int on_ac(void)
47{
48// /sys/class/power_supply/AC0/online
49}
50
51int lid_open(void)
52{
53// /proc/acpi/button/lid/LID/state
54}
55
56void ignore_me(void)
57{
58 protect(0);
59 set_led(0);
60
61}
62
63int main(int argc, char* argv[])
64{
65 int fd, ret;
66
67 fd = open("/dev/freefall", O_RDONLY);
68 if (fd < 0) {
69 perror("open");
70 return EXIT_FAILURE;
71 }
72
73 signal(SIGALRM, ignore_me);
74
75 for (;;) {
76 unsigned char count;
77
78 ret = read(fd, &count, sizeof(count));
79 alarm(0);
80 if ((ret == -1) && (errno == EINTR)) {
81 /* Alarm expired, time to unpark the heads */
82 continue;
83 }
84
85 if (ret != sizeof(count)) {
86 perror("read");
87 break;
88 }
89
90 protect(21);
91 set_led(1);
92 if (1 || on_ac() || lid_open()) {
93 alarm(2);
94 } else {
95 alarm(20);
96 }
97 }
98
99 close(fd);
100 return EXIT_SUCCESS;
101}
diff --git a/Documentation/hwmon/lis3lv02d b/Documentation/hwmon/lis3lv02d
index 0fcfc4a7ccdc..287f8c902656 100644
--- a/Documentation/hwmon/lis3lv02d
+++ b/Documentation/hwmon/lis3lv02d
@@ -33,6 +33,14 @@ rate - reports the sampling rate of the accelerometer device in HZ
33This driver also provides an absolute input class device, allowing 33This driver also provides an absolute input class device, allowing
34the laptop to act as a pinball machine-esque joystick. 34the laptop to act as a pinball machine-esque joystick.
35 35
36Another feature of the driver is misc device called "freefall" that
37acts similar to /dev/rtc and reacts on free-fall interrupts received
38from the device. It supports blocking operations, poll/select and
39fasync operation modes. You must read 1 bytes from the device. The
40result is number of free-fall interrupts since the last successful
41read (or 255 if number of interrupts would not fit).
42
43
36Axes orientation 44Axes orientation
37---------------- 45----------------
38 46
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90
index 0e8411710238..93d8e3d55150 100644
--- a/Documentation/hwmon/lm90
+++ b/Documentation/hwmon/lm90
@@ -42,6 +42,11 @@ Supported chips:
42 Addresses scanned: I2C 0x4e 42 Addresses scanned: I2C 0x4e
43 Datasheet: Publicly available at the Maxim website 43 Datasheet: Publicly available at the Maxim website
44 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 44 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497
45 * Maxim MAX6648
46 Prefix: 'max6646'
47 Addresses scanned: I2C 0x4c
48 Datasheet: Publicly available at the Maxim website
49 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3500
45 * Maxim MAX6649 50 * Maxim MAX6649
46 Prefix: 'max6646' 51 Prefix: 'max6646'
47 Addresses scanned: I2C 0x4c 52 Addresses scanned: I2C 0x4c
@@ -74,6 +79,11 @@ Supported chips:
74 0x4c, 0x4d and 0x4e 79 0x4c, 0x4d and 0x4e
75 Datasheet: Publicly available at the Maxim website 80 Datasheet: Publicly available at the Maxim website
76 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370 81 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370
82 * Maxim MAX6692
83 Prefix: 'max6646'
84 Addresses scanned: I2C 0x4c
85 Datasheet: Publicly available at the Maxim website
86 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3500
77 87
78 88
79Author: Jean Delvare <khali@linux-fr.org> 89Author: Jean Delvare <khali@linux-fr.org>
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index b182626739ea..54f21a5c262b 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -114,7 +114,7 @@ In addition, the following text indicates that the option:
114Parameters denoted with BOOT are actually interpreted by the boot 114Parameters denoted with BOOT are actually interpreted by the boot
115loader, and have no meaning to the kernel directly. 115loader, and have no meaning to the kernel directly.
116Do not modify the syntax of boot loader parameters without extreme 116Do not modify the syntax of boot loader parameters without extreme
117need or coordination with <Documentation/x86/i386/boot.txt>. 117need or coordination with <Documentation/x86/boot.txt>.
118 118
119There are also arch-specific kernel-parameters not documented here. 119There are also arch-specific kernel-parameters not documented here.
120See for example <Documentation/x86/x86_64/boot-options.txt>. 120See for example <Documentation/x86/x86_64/boot-options.txt>.
@@ -134,7 +134,7 @@ and is between 256 and 4096 characters. It is defined in the file
134 134
135 acpi= [HW,ACPI,X86-64,i386] 135 acpi= [HW,ACPI,X86-64,i386]
136 Advanced Configuration and Power Interface 136 Advanced Configuration and Power Interface
137 Format: { force | off | ht | strict | noirq } 137 Format: { force | off | ht | strict | noirq | rsdt }
138 force -- enable ACPI if default was off 138 force -- enable ACPI if default was off
139 off -- disable ACPI if default was on 139 off -- disable ACPI if default was on
140 noirq -- do not use ACPI for IRQ routing 140 noirq -- do not use ACPI for IRQ routing
@@ -868,8 +868,10 @@ and is between 256 and 4096 characters. It is defined in the file
868 icn= [HW,ISDN] 868 icn= [HW,ISDN]
869 Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] 869 Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]]
870 870
871 ide= [HW] (E)IDE subsystem 871 ide-core.nodma= [HW] (E)IDE subsystem
872 Format: ide=nodma or ide=doubler 872 Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc
873 .vlb_clock .pci_clock .noflush .noprobe .nowerr .cdrom
874 .chs .ignore_cable are additional options
873 See Documentation/ide/ide.txt. 875 See Documentation/ide/ide.txt.
874 876
875 idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed 877 idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed
@@ -2449,7 +2451,7 @@ and is between 256 and 4096 characters. It is defined in the file
2449 See Documentation/fb/modedb.txt. 2451 See Documentation/fb/modedb.txt.
2450 2452
2451 vga= [BOOT,X86-32] Select a particular video mode 2453 vga= [BOOT,X86-32] Select a particular video mode
2452 See Documentation/x86/i386/boot.txt and 2454 See Documentation/x86/boot.txt and
2453 Documentation/svga.txt. 2455 Documentation/svga.txt.
2454 Use vga=ask for menu. 2456 Use vga=ask for menu.
2455 This is actually a boot loader parameter; the value is 2457 This is actually a boot loader parameter; the value is
diff --git a/Documentation/networking/ipv6.txt b/Documentation/networking/ipv6.txt
new file mode 100644
index 000000000000..268e5c103dd8
--- /dev/null
+++ b/Documentation/networking/ipv6.txt
@@ -0,0 +1,35 @@
1
2Options for the ipv6 module are supplied as parameters at load time.
3
4Module options may be given as command line arguments to the insmod
5or modprobe command, but are usually specified in either the
6/etc/modules.conf or /etc/modprobe.conf configuration file, or in a
7distro-specific configuration file.
8
9The available ipv6 module parameters are listed below. If a parameter
10is not specified the default value is used.
11
12The parameters are as follows:
13
14disable
15
16 Specifies whether to load the IPv6 module, but disable all
17 its functionality. This might be used when another module
18 has a dependency on the IPv6 module being loaded, but no
19 IPv6 addresses or operations are desired.
20
21 The possible values and their effects are:
22
23 0
24 IPv6 is enabled.
25
26 This is the default value.
27
28 1
29 IPv6 is disabled.
30
31 No IPv6 addresses will be added to interfaces, and
32 it will not be possible to open an IPv6 socket.
33
34 A reboot is required to enable IPv6.
35
diff --git a/Documentation/scsi/cxgb3i.txt b/Documentation/scsi/cxgb3i.txt
index 8141fa01978e..7ac8032ee9b2 100644
--- a/Documentation/scsi/cxgb3i.txt
+++ b/Documentation/scsi/cxgb3i.txt
@@ -4,7 +4,7 @@ Introduction
4============ 4============
5 5
6The Chelsio T3 ASIC based Adapters (S310, S320, S302, S304, Mezz cards, etc. 6The Chelsio T3 ASIC based Adapters (S310, S320, S302, S304, Mezz cards, etc.
7series of products) supports iSCSI acceleration and iSCSI Direct Data Placement 7series of products) support iSCSI acceleration and iSCSI Direct Data Placement
8(DDP) where the hardware handles the expensive byte touching operations, such 8(DDP) where the hardware handles the expensive byte touching operations, such
9as CRC computation and verification, and direct DMA to the final host memory 9as CRC computation and verification, and direct DMA to the final host memory
10destination: 10destination:
@@ -31,9 +31,9 @@ destination:
31 the TCP segments onto the wire. It handles TCP retransmission if 31 the TCP segments onto the wire. It handles TCP retransmission if
32 needed. 32 needed.
33 33
34 On receving, S3 h/w recovers the iSCSI PDU by reassembling TCP 34 On receiving, S3 h/w recovers the iSCSI PDU by reassembling TCP
35 segments, separating the header and data, calculating and verifying 35 segments, separating the header and data, calculating and verifying
36 the digests, then forwards the header to the host. The payload data, 36 the digests, then forwarding the header to the host. The payload data,
37 if possible, will be directly placed into the pre-posted host DDP 37 if possible, will be directly placed into the pre-posted host DDP
38 buffer. Otherwise, the payload data will be sent to the host too. 38 buffer. Otherwise, the payload data will be sent to the host too.
39 39
@@ -68,9 +68,8 @@ The following steps need to be taken to accelerates the open-iscsi initiator:
68 sure the ip address is unique in the network. 68 sure the ip address is unique in the network.
69 69
703. edit /etc/iscsi/iscsid.conf 703. edit /etc/iscsi/iscsid.conf
71 The default setting for MaxRecvDataSegmentLength (131072) is too big, 71 The default setting for MaxRecvDataSegmentLength (131072) is too big;
72 replace "node.conn[0].iscsi.MaxRecvDataSegmentLength" to be a value no 72 replace with a value no bigger than 15360 (for example 8192):
73 bigger than 15360 (for example 8192):
74 73
75 node.conn[0].iscsi.MaxRecvDataSegmentLength = 8192 74 node.conn[0].iscsi.MaxRecvDataSegmentLength = 8192
76 75
diff --git a/Documentation/tracers/mmiotrace.txt b/Documentation/tracers/mmiotrace.txt
index cde23b4a12a1..5731c67abc55 100644
--- a/Documentation/tracers/mmiotrace.txt
+++ b/Documentation/tracers/mmiotrace.txt
@@ -78,12 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If
78events were lost, the trace is incomplete. You should enlarge the buffers and 78events were lost, the trace is incomplete. You should enlarge the buffers and
79try again. Buffers are enlarged by first seeing how large the current buffers 79try again. Buffers are enlarged by first seeing how large the current buffers
80are: 80are:
81$ cat /debug/tracing/trace_entries 81$ cat /debug/tracing/buffer_size_kb
82gives you a number. Approximately double this number and write it back, for 82gives you a number. Approximately double this number and write it back, for
83instance: 83instance:
84$ echo 0 > /debug/tracing/tracing_enabled 84$ echo 128000 > /debug/tracing/buffer_size_kb
85$ echo 128000 > /debug/tracing/trace_entries
86$ echo 1 > /debug/tracing/tracing_enabled
87Then start again from the top. 85Then start again from the top.
88 86
89If you are doing a trace for a driver project, e.g. Nouveau, you should also 87If you are doing a trace for a driver project, e.g. Nouveau, you should also
diff --git a/MAINTAINERS b/MAINTAINERS
index db65b4e6d132..4a1cfca49685 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -692,6 +692,13 @@ M: kernel@wantstofly.org
692L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 692L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
693S: Maintained 693S: Maintained
694 694
695ARM/NUVOTON W90X900 ARM ARCHITECTURE
696P: Wan ZongShun
697M: mcuos.com@gmail.com
698L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
699W: http://www.mcuos.com
700S: Maintained
701
695ARPD SUPPORT 702ARPD SUPPORT
696P: Jonathan Layes 703P: Jonathan Layes
697L: netdev@vger.kernel.org 704L: netdev@vger.kernel.org
@@ -1462,8 +1469,6 @@ L: linux-acpi@vger.kernel.org
1462S: Supported 1469S: Supported
1463 1470
1464DOCUMENTATION (/Documentation directory) 1471DOCUMENTATION (/Documentation directory)
1465P: Michael Kerrisk
1466M: mtk.manpages@gmail.com
1467P: Randy Dunlap 1472P: Randy Dunlap
1468M: rdunlap@xenotime.net 1473M: rdunlap@xenotime.net
1469L: linux-doc@vger.kernel.org 1474L: linux-doc@vger.kernel.org
@@ -1905,10 +1910,10 @@ W: http://gigaset307x.sourceforge.net/
1905S: Maintained 1910S: Maintained
1906 1911
1907HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER 1912HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
1908P: Robert Love 1913P: Frank Seidel
1909M: rlove@rlove.org 1914M: frank@f-seidel.de
1910M: linux-kernel@vger.kernel.org 1915L: lm-sensors@lm-sensors.org
1911W: http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/ 1916W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
1912S: Maintained 1917S: Maintained
1913 1918
1914GSPCA FINEPIX SUBDRIVER 1919GSPCA FINEPIX SUBDRIVER
@@ -2001,7 +2006,7 @@ S: Maintained
2001 2006
2002HIBERNATION (aka Software Suspend, aka swsusp) 2007HIBERNATION (aka Software Suspend, aka swsusp)
2003P: Pavel Machek 2008P: Pavel Machek
2004M: pavel@suse.cz 2009M: pavel@ucw.cz
2005P: Rafael J. Wysocki 2010P: Rafael J. Wysocki
2006M: rjw@sisk.pl 2011M: rjw@sisk.pl
2007L: linux-pm@lists.linux-foundation.org 2012L: linux-pm@lists.linux-foundation.org
@@ -2457,7 +2462,7 @@ S: Maintained
2457 2462
2458ISDN SUBSYSTEM 2463ISDN SUBSYSTEM
2459P: Karsten Keil 2464P: Karsten Keil
2460M: kkeil@suse.de 2465M: isdn@linux-pingi.de
2461L: isdn4linux@listserv.isdn4linux.de (subscribers-only) 2466L: isdn4linux@listserv.isdn4linux.de (subscribers-only)
2462W: http://www.isdn4linux.de 2467W: http://www.isdn4linux.de
2463T: git kernel.org:/pub/scm/linux/kernel/kkeil/isdn-2.6.git 2468T: git kernel.org:/pub/scm/linux/kernel/kkeil/isdn-2.6.git
@@ -2872,7 +2877,7 @@ P: Michael Kerrisk
2872M: mtk.manpages@gmail.com 2877M: mtk.manpages@gmail.com
2873W: http://www.kernel.org/doc/man-pages 2878W: http://www.kernel.org/doc/man-pages
2874L: linux-man@vger.kernel.org 2879L: linux-man@vger.kernel.org
2875S: Supported 2880S: Maintained
2876 2881
2877MARVELL LIBERTAS WIRELESS DRIVER 2882MARVELL LIBERTAS WIRELESS DRIVER
2878P: Dan Williams 2883P: Dan Williams
@@ -3327,8 +3332,8 @@ P: Jeremy Fitzhardinge
3327M: jeremy@xensource.com 3332M: jeremy@xensource.com
3328P: Chris Wright 3333P: Chris Wright
3329M: chrisw@sous-sol.org 3334M: chrisw@sous-sol.org
3330P: Zachary Amsden 3335P: Alok Kataria
3331M: zach@vmware.com 3336M: akataria@vmware.com
3332P: Rusty Russell 3337P: Rusty Russell
3333M: rusty@rustcorp.com.au 3338M: rusty@rustcorp.com.au
3334L: virtualization@lists.osdl.org 3339L: virtualization@lists.osdl.org
@@ -3345,10 +3350,8 @@ S: Maintained
3345PARISC ARCHITECTURE 3350PARISC ARCHITECTURE
3346P: Kyle McMartin 3351P: Kyle McMartin
3347M: kyle@mcmartin.ca 3352M: kyle@mcmartin.ca
3348P: Matthew Wilcox 3353P: Helge Deller
3349M: matthew@wil.cx 3354M: deller@gmx.de
3350P: Grant Grundler
3351M: grundler@parisc-linux.org
3352L: linux-parisc@vger.kernel.org 3355L: linux-parisc@vger.kernel.org
3353W: http://www.parisc-linux.org/ 3356W: http://www.parisc-linux.org/
3354T: git kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6.git 3357T: git kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6.git
@@ -4172,7 +4175,7 @@ SUSPEND TO RAM
4172P: Len Brown 4175P: Len Brown
4173M: len.brown@intel.com 4176M: len.brown@intel.com
4174P: Pavel Machek 4177P: Pavel Machek
4175M: pavel@suse.cz 4178M: pavel@ucw.cz
4176P: Rafael J. Wysocki 4179P: Rafael J. Wysocki
4177M: rjw@sisk.pl 4180M: rjw@sisk.pl
4178L: linux-pm@lists.linux-foundation.org 4181L: linux-pm@lists.linux-foundation.org
@@ -4924,11 +4927,11 @@ L: zd1211-devs@lists.sourceforge.net (subscribers-only)
4924S: Maintained 4927S: Maintained
4925 4928
4926ZR36067 VIDEO FOR LINUX DRIVER 4929ZR36067 VIDEO FOR LINUX DRIVER
4927P: Ronald Bultje
4928M: rbultje@ronald.bitfreak.net
4929L: mjpeg-users@lists.sourceforge.net 4930L: mjpeg-users@lists.sourceforge.net
4931L: linux-media@vger.kernel.org
4930W: http://mjpeg.sourceforge.net/driver-zoran/ 4932W: http://mjpeg.sourceforge.net/driver-zoran/
4931S: Maintained 4933T: Mercurial http://linuxtv.org/hg/v4l-dvb
4934S: Odd Fixes
4932 4935
4933ZS DECSTATION Z85C30 SERIAL DRIVER 4936ZS DECSTATION Z85C30 SERIAL DRIVER
4934P: Maciej W. Rozycki 4937P: Maciej W. Rozycki
diff --git a/Makefile b/Makefile
index 681c1d23b4d4..2e2f4a4324af 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 29 3SUBLEVEL = 29
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc8
5NAME = Erotic Pickled Herring 5NAME = Erotic Pickled Herring
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -389,6 +389,7 @@ PHONY += outputmakefile
389# output directory. 389# output directory.
390outputmakefile: 390outputmakefile:
391ifneq ($(KBUILD_SRC),) 391ifneq ($(KBUILD_SRC),)
392 $(Q)ln -fsn $(srctree) source
392 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ 393 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
393 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) 394 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
394endif 395endif
@@ -903,12 +904,18 @@ localver = $(subst $(space),, $(string) \
903# and if the SCM is know a tag from the SCM is appended. 904# and if the SCM is know a tag from the SCM is appended.
904# The appended tag is determined by the SCM used. 905# The appended tag is determined by the SCM used.
905# 906#
906# Currently, only git is supported. 907# .scmversion is used when generating rpm packages so we do not loose
907# Other SCMs can edit scripts/setlocalversion and add the appropriate 908# the version information from the SCM when we do the build of the kernel
908# checks as needed. 909# from the copied source
909ifdef CONFIG_LOCALVERSION_AUTO 910ifdef CONFIG_LOCALVERSION_AUTO
910 _localver-auto = $(shell $(CONFIG_SHELL) \ 911
911 $(srctree)/scripts/setlocalversion $(srctree)) 912ifeq ($(wildcard .scmversion),)
913 _localver-auto = $(shell $(CONFIG_SHELL) \
914 $(srctree)/scripts/setlocalversion $(srctree))
915else
916 _localver-auto = $(shell cat .scmversion 2> /dev/null)
917endif
918
912 localver-auto = $(LOCALVERSION)$(_localver-auto) 919 localver-auto = $(LOCALVERSION)$(_localver-auto)
913endif 920endif
914 921
@@ -946,7 +953,6 @@ ifneq ($(KBUILD_SRC),)
946 mkdir -p include2; \ 953 mkdir -p include2; \
947 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ 954 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
948 fi 955 fi
949 ln -fsn $(srctree) source
950endif 956endif
951 957
952# prepare2 creates a makefile if using a separate output directory 958# prepare2 creates a makefile if using a separate output directory
@@ -1537,7 +1543,7 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1537 cmd_depmod = \ 1543 cmd_depmod = \
1538 if [ -r System.map -a -x $(DEPMOD) ]; then \ 1544 if [ -r System.map -a -x $(DEPMOD) ]; then \
1539 $(DEPMOD) -ae -F System.map \ 1545 $(DEPMOD) -ae -F System.map \
1540 $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \ 1546 $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) ) \
1541 $(KERNELRELEASE); \ 1547 $(KERNELRELEASE); \
1542 fi 1548 fi
1543 1549
diff --git a/README b/README
index 90a07658ede1..d6c6c742c1d7 100644
--- a/README
+++ b/README
@@ -188,7 +188,7 @@ CONFIGURING the kernel:
188 values to random values. 188 values to random values.
189 189
190 You can find more information on using the Linux kernel config tools 190 You can find more information on using the Linux kernel config tools
191 in Documentation/kbuild/make-configs.txt. 191 in Documentation/kbuild/kconfig.txt.
192 192
193 NOTES on "make config": 193 NOTES on "make config":
194 - having unnecessary drivers will make the kernel bigger, and can 194 - having unnecessary drivers will make the kernel bigger, and can
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index f238370c907d..8d0097f10208 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -93,8 +93,8 @@ common_shutdown_1(void *generic_ptr)
93 if (cpuid != boot_cpuid) { 93 if (cpuid != boot_cpuid) {
94 flags |= 0x00040000UL; /* "remain halted" */ 94 flags |= 0x00040000UL; /* "remain halted" */
95 *pflags = flags; 95 *pflags = flags;
96 cpu_clear(cpuid, cpu_present_map); 96 set_cpu_present(cpuid, false);
97 cpu_clear(cpuid, cpu_possible_map); 97 set_cpu_possible(cpuid, false);
98 halt(); 98 halt();
99 } 99 }
100#endif 100#endif
@@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr)
120 120
121#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
122 /* Wait for the secondaries to halt. */ 122 /* Wait for the secondaries to halt. */
123 cpu_clear(boot_cpuid, cpu_present_map); 123 set_cpu_present(boot_cpuid, false);
124 cpu_clear(boot_cpuid, cpu_possible_map); 124 set_cpu_possible(boot_cpuid, false);
125 while (cpus_weight(cpu_present_map)) 125 while (cpus_weight(cpu_present_map))
126 barrier(); 126 barrier();
127#endif 127#endif
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 00f1dc3dfd5f..b1fe5674c3a1 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -120,12 +120,12 @@ void __cpuinit
120smp_callin(void) 120smp_callin(void)
121{ 121{
122 int cpuid = hard_smp_processor_id(); 122 int cpuid = hard_smp_processor_id();
123 cpumask_t mask = cpu_online_map;
124 123
125 if (cpu_test_and_set(cpuid, mask)) { 124 if (cpu_online(cpuid)) {
126 printk("??, cpu 0x%x already present??\n", cpuid); 125 printk("??, cpu 0x%x already present??\n", cpuid);
127 BUG(); 126 BUG();
128 } 127 }
128 set_cpu_online(cpuid, true);
129 129
130 /* Turn on machine checks. */ 130 /* Turn on machine checks. */
131 wrmces(7); 131 wrmces(7);
@@ -436,8 +436,8 @@ setup_smp(void)
436 ((char *)cpubase + i*hwrpb->processor_size); 436 ((char *)cpubase + i*hwrpb->processor_size);
437 if ((cpu->flags & 0x1cc) == 0x1cc) { 437 if ((cpu->flags & 0x1cc) == 0x1cc) {
438 smp_num_probed++; 438 smp_num_probed++;
439 cpu_set(i, cpu_possible_map); 439 set_cpu_possible(i, true);
440 cpu_set(i, cpu_present_map); 440 set_cpu_present(i, true);
441 cpu->pal_revision = boot_cpu_palrev; 441 cpu->pal_revision = boot_cpu_palrev;
442 } 442 }
443 443
@@ -470,8 +470,8 @@ smp_prepare_cpus(unsigned int max_cpus)
470 470
471 /* Nothing to do on a UP box, or when told not to. */ 471 /* Nothing to do on a UP box, or when told not to. */
472 if (smp_num_probed == 1 || max_cpus == 0) { 472 if (smp_num_probed == 1 || max_cpus == 0) {
473 cpu_possible_map = cpumask_of_cpu(boot_cpuid); 473 init_cpu_possible(cpumask_of(boot_cpuid));
474 cpu_present_map = cpumask_of_cpu(boot_cpuid); 474 init_cpu_present(cpumask_of(boot_cpuid));
475 printk(KERN_INFO "SMP mode deactivated.\n"); 475 printk(KERN_INFO "SMP mode deactivated.\n");
476 return; 476 return;
477 } 477 }
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index e0ee7060f9aa..98e2f3de4bc5 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -608,7 +608,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
608# Watchdog Device Drivers 608# Watchdog Device Drivers
609# 609#
610# CONFIG_SOFT_WATCHDOG is not set 610# CONFIG_SOFT_WATCHDOG is not set
611CONFIG_AT91SAM9_WATCHDOG=y 611CONFIG_AT91SAM9X_WATCHDOG=y
612 612
613# 613#
614# USB-based Watchdog Cards 614# USB-based Watchdog Cards
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 01d1ef97d8be..149456142392 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -700,7 +700,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
700# Watchdog Device Drivers 700# Watchdog Device Drivers
701# 701#
702# CONFIG_SOFT_WATCHDOG is not set 702# CONFIG_SOFT_WATCHDOG is not set
703CONFIG_AT91SAM9_WATCHDOG=y 703CONFIG_AT91SAM9X_WATCHDOG=y
704 704
705# 705#
706# USB-based Watchdog Cards 706# USB-based Watchdog Cards
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index 036a126725c1..21599f3c6275 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -710,7 +710,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
710# Watchdog Device Drivers 710# Watchdog Device Drivers
711# 711#
712# CONFIG_SOFT_WATCHDOG is not set 712# CONFIG_SOFT_WATCHDOG is not set
713CONFIG_AT91SAM9_WATCHDOG=y 713CONFIG_AT91SAM9X_WATCHDOG=y
714 714
715# 715#
716# USB-based Watchdog Cards 716# USB-based Watchdog Cards
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rlek_defconfig
index 237a2a6a8517..e2df81a3e804 100644
--- a/arch/arm/configs/at91sam9rlek_defconfig
+++ b/arch/arm/configs/at91sam9rlek_defconfig
@@ -606,7 +606,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
606# Watchdog Device Drivers 606# Watchdog Device Drivers
607# 607#
608# CONFIG_SOFT_WATCHDOG is not set 608# CONFIG_SOFT_WATCHDOG is not set
609CONFIG_AT91SAM9_WATCHDOG=y 609CONFIG_AT91SAM9X_WATCHDOG=y
610 610
611# 611#
612# Sonics Silicon Backplane 612# Sonics Silicon Backplane
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
index cd1d717903ac..9b32d0eb89ba 100644
--- a/arch/arm/configs/qil-a9260_defconfig
+++ b/arch/arm/configs/qil-a9260_defconfig
@@ -727,7 +727,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
727# Watchdog Device Drivers 727# Watchdog Device Drivers
728# 728#
729# CONFIG_SOFT_WATCHDOG is not set 729# CONFIG_SOFT_WATCHDOG is not set
730# CONFIG_AT91SAM9_WATCHDOG is not set 730# CONFIG_AT91SAM9X_WATCHDOG is not set
731 731
732# 732#
733# USB-based Watchdog Cards 733# USB-based Watchdog Cards
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c
index 84849098c8e8..d4a0da1e48f4 100644
--- a/arch/arm/kernel/elf.c
+++ b/arch/arm/kernel/elf.c
@@ -74,9 +74,9 @@ EXPORT_SYMBOL(elf_set_personality);
74 */ 74 */
75int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack) 75int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack)
76{ 76{
77 if (executable_stack != EXSTACK_ENABLE_X) 77 if (executable_stack != EXSTACK_DISABLE_X)
78 return 1; 78 return 1;
79 if (cpu_architecture() <= CPU_ARCH_ARMv6) 79 if (cpu_architecture() < CPU_ARCH_ARMv6)
80 return 1; 80 return 1;
81 return 0; 81 return 0;
82} 82}
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 49a6ba926c2b..159d0416f270 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -111,6 +111,7 @@ ENTRY(mcount)
111 .globl mcount_call 111 .globl mcount_call
112mcount_call: 112mcount_call:
113 bl ftrace_stub 113 bl ftrace_stub
114 ldr lr, [fp, #-4] @ restore lr
114 ldmia sp!, {r0-r3, pc} 115 ldmia sp!, {r0-r3, pc}
115 116
116ENTRY(ftrace_caller) 117ENTRY(ftrace_caller)
@@ -122,6 +123,7 @@ ENTRY(ftrace_caller)
122 .globl ftrace_call 123 .globl ftrace_call
123ftrace_call: 124ftrace_call:
124 bl ftrace_stub 125 bl ftrace_stub
126 ldr lr, [fp, #-4] @ restore lr
125 ldmia sp!, {r0-r3, pc} 127 ldmia sp!, {r0-r3, pc}
126 128
127#else 129#else
@@ -133,6 +135,7 @@ ENTRY(mcount)
133 adr r0, ftrace_stub 135 adr r0, ftrace_stub
134 cmp r0, r2 136 cmp r0, r2
135 bne trace 137 bne trace
138 ldr lr, [fp, #-4] @ restore lr
136 ldmia sp!, {r0-r3, pc} 139 ldmia sp!, {r0-r3, pc}
137 140
138trace: 141trace:
@@ -141,6 +144,7 @@ trace:
141 sub r0, r0, #MCOUNT_INSN_SIZE 144 sub r0, r0, #MCOUNT_INSN_SIZE
142 mov lr, pc 145 mov lr, pc
143 mov pc, r2 146 mov pc, r2
147 mov lr, r1 @ restore lr
144 ldmia sp!, {r0-r3, pc} 148 ldmia sp!, {r0-r3, pc}
145 149
146#endif /* CONFIG_DYNAMIC_FTRACE */ 150#endif /* CONFIG_DYNAMIC_FTRACE */
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 36f81d967979..6ff7919613d7 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -88,7 +88,7 @@ void set_fiq_handler(void *start, unsigned int length)
88 * disable irqs for the duration. Note - these functions are almost 88 * disable irqs for the duration. Note - these functions are almost
89 * entirely coded in assembly. 89 * entirely coded in assembly.
90 */ 90 */
91void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs) 91void __naked set_fiq_regs(struct pt_regs *regs)
92{ 92{
93 register unsigned long tmp; 93 register unsigned long tmp;
94 asm volatile ( 94 asm volatile (
@@ -106,7 +106,7 @@ void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs)
106 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); 106 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
107} 107}
108 108
109void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs) 109void __naked get_fiq_regs(struct pt_regs *regs)
110{ 110{
111 register unsigned long tmp; 111 register unsigned long tmp;
112 asm volatile ( 112 asm volatile (
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 7049815d66d5..68d6494c0389 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -233,12 +233,13 @@ static void __init cacheid_init(void)
233 unsigned int cachetype = read_cpuid_cachetype(); 233 unsigned int cachetype = read_cpuid_cachetype();
234 unsigned int arch = cpu_architecture(); 234 unsigned int arch = cpu_architecture();
235 235
236 if (arch >= CPU_ARCH_ARMv7) { 236 if (arch >= CPU_ARCH_ARMv6) {
237 cacheid = CACHEID_VIPT_NONALIASING; 237 if ((cachetype & (7 << 29)) == 4 << 29) {
238 if ((cachetype & (3 << 14)) == 1 << 14) 238 /* ARMv7 register format */
239 cacheid |= CACHEID_ASID_TAGGED; 239 cacheid = CACHEID_VIPT_NONALIASING;
240 } else if (arch >= CPU_ARCH_ARMv6) { 240 if ((cachetype & (3 << 14)) == 1 << 14)
241 if (cachetype & (1 << 23)) 241 cacheid |= CACHEID_ASID_TAGGED;
242 } else if (cachetype & (1 << 23))
242 cacheid = CACHEID_VIPT_ALIASING; 243 cacheid = CACHEID_VIPT_ALIASING;
243 else 244 else
244 cacheid = CACHEID_VIPT_NONALIASING; 245 cacheid = CACHEID_VIPT_NONALIASING;
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index 9eca2209cde6..412aa49ad2fb 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -697,7 +697,7 @@ static void __init at91_add_device_rtt(void)
697 * Watchdog 697 * Watchdog
698 * -------------------------------------------------------------------- */ 698 * -------------------------------------------------------------------- */
699 699
700#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) 700#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
701static struct platform_device at91cap9_wdt_device = { 701static struct platform_device at91cap9_wdt_device = {
702 .name = "at91_wdt", 702 .name = "at91_wdt",
703 .id = -1, 703 .id = -1,
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index fdde1ea21b07..d74c9ac007e7 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -643,7 +643,7 @@ static void __init at91_add_device_rtt(void)
643 * Watchdog 643 * Watchdog
644 * -------------------------------------------------------------------- */ 644 * -------------------------------------------------------------------- */
645 645
646#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) 646#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
647static struct platform_device at91sam9260_wdt_device = { 647static struct platform_device at91sam9260_wdt_device = {
648 .name = "at91_wdt", 648 .name = "at91_wdt",
649 .id = -1, 649 .id = -1,
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 17289756f80f..59fc48311fb0 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -621,7 +621,7 @@ static void __init at91_add_device_rtt(void)
621 * Watchdog 621 * Watchdog
622 * -------------------------------------------------------------------- */ 622 * -------------------------------------------------------------------- */
623 623
624#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) 624#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
625static struct platform_device at91sam9261_wdt_device = { 625static struct platform_device at91sam9261_wdt_device = {
626 .name = "at91_wdt", 626 .name = "at91_wdt",
627 .id = -1, 627 .id = -1,
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index b753cb879d8e..b7f233242315 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -347,6 +347,111 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
347void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 347void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
348#endif 348#endif
349 349
350/* --------------------------------------------------------------------
351 * Compact Flash (PCMCIA or IDE)
352 * -------------------------------------------------------------------- */
353
354#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \
355 defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE)
356
357static struct at91_cf_data cf0_data;
358
359static struct resource cf0_resources[] = {
360 [0] = {
361 .start = AT91_CHIPSELECT_4,
362 .end = AT91_CHIPSELECT_4 + SZ_256M - 1,
363 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
364 }
365};
366
367static struct platform_device cf0_device = {
368 .id = 0,
369 .dev = {
370 .platform_data = &cf0_data,
371 },
372 .resource = cf0_resources,
373 .num_resources = ARRAY_SIZE(cf0_resources),
374};
375
376static struct at91_cf_data cf1_data;
377
378static struct resource cf1_resources[] = {
379 [0] = {
380 .start = AT91_CHIPSELECT_5,
381 .end = AT91_CHIPSELECT_5 + SZ_256M - 1,
382 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
383 }
384};
385
386static struct platform_device cf1_device = {
387 .id = 1,
388 .dev = {
389 .platform_data = &cf1_data,
390 },
391 .resource = cf1_resources,
392 .num_resources = ARRAY_SIZE(cf1_resources),
393};
394
395void __init at91_add_device_cf(struct at91_cf_data *data)
396{
397 unsigned long ebi0_csa;
398 struct platform_device *pdev;
399
400 if (!data)
401 return;
402
403 /*
404 * assign CS4 or CS5 to SMC with Compact Flash logic support,
405 * we assume SMC timings are configured by board code,
406 * except True IDE where timings are controlled by driver
407 */
408 ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
409 switch (data->chipselect) {
410 case 4:
411 at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */
412 ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
413 cf0_data = *data;
414 pdev = &cf0_device;
415 break;
416 case 5:
417 at91_set_A_periph(AT91_PIN_PD7, 0); /* EBI0_NCS5/CFCS1 */
418 ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
419 cf1_data = *data;
420 pdev = &cf1_device;
421 break;
422 default:
423 printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
424 data->chipselect);
425 return;
426 }
427 at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
428
429 if (data->det_pin) {
430 at91_set_gpio_input(data->det_pin, 1);
431 at91_set_deglitch(data->det_pin, 1);
432 }
433
434 if (data->irq_pin) {
435 at91_set_gpio_input(data->irq_pin, 1);
436 at91_set_deglitch(data->irq_pin, 1);
437 }
438
439 if (data->vcc_pin)
440 /* initially off */
441 at91_set_gpio_output(data->vcc_pin, 0);
442
443 /* enable EBI controlled pins */
444 at91_set_A_periph(AT91_PIN_PD5, 1); /* NWAIT */
445 at91_set_A_periph(AT91_PIN_PD8, 0); /* CFCE1 */
446 at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */
447 at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */
448
449 pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf";
450 platform_device_register(pdev);
451}
452#else
453void __init at91_add_device_cf(struct at91_cf_data *data) {}
454#endif
350 455
351/* -------------------------------------------------------------------- 456/* --------------------------------------------------------------------
352 * NAND / SmartMedia 457 * NAND / SmartMedia
@@ -854,7 +959,7 @@ static void __init at91_add_device_rtt(void)
854 * Watchdog 959 * Watchdog
855 * -------------------------------------------------------------------- */ 960 * -------------------------------------------------------------------- */
856 961
857#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) 962#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
858static struct platform_device at91sam9263_wdt_device = { 963static struct platform_device at91sam9263_wdt_device = {
859 .name = "at91_wdt", 964 .name = "at91_wdt",
860 .id = -1, 965 .id = -1,
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 145324f4ec56..728186515cdf 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -609,7 +609,7 @@ static void __init at91_add_device_rtt(void)
609 * Watchdog 609 * Watchdog
610 * -------------------------------------------------------------------- */ 610 * -------------------------------------------------------------------- */
611 611
612#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) 612#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
613static struct platform_device at91sam9rl_wdt_device = { 613static struct platform_device at91sam9rl_wdt_device = {
614 .name = "at91_wdt", 614 .name = "at91_wdt",
615 .id = -1, 615 .id = -1,
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 9b0447c3d59b..2f7d4977dce9 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -490,7 +490,8 @@ postcore_initcall(at91_gpio_debugfs_init);
490 490
491/*--------------------------------------------------------------------------*/ 491/*--------------------------------------------------------------------------*/
492 492
493/* This lock class tells lockdep that GPIO irqs are in a different 493/*
494 * This lock class tells lockdep that GPIO irqs are in a different
494 * category than their parents, so it won't report false recursion. 495 * category than their parents, so it won't report false recursion.
495 */ 496 */
496static struct lock_class_key gpio_lock_class; 497static struct lock_class_key gpio_lock_class;
@@ -509,9 +510,6 @@ void __init at91_gpio_irq_setup(void)
509 unsigned id = this->id; 510 unsigned id = this->id;
510 unsigned i; 511 unsigned i;
511 512
512 /* enable PIO controller's clock */
513 clk_enable(this->clock);
514
515 __raw_writel(~0, this->regbase + PIO_IDR); 513 __raw_writel(~0, this->regbase + PIO_IDR);
516 514
517 for (i = 0, pin = this->chipbase; i < 32; i++, pin++) { 515 for (i = 0, pin = this->chipbase; i < 32; i++, pin++) {
@@ -556,7 +554,14 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
556 data->chipbase = PIN_BASE + i * 32; 554 data->chipbase = PIN_BASE + i * 32;
557 data->regbase = data->offset + (void __iomem *)AT91_VA_BASE_SYS; 555 data->regbase = data->offset + (void __iomem *)AT91_VA_BASE_SYS;
558 556
559 /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */ 557 /* enable PIO controller's clock */
558 clk_enable(data->clock);
559
560 /*
561 * Some processors share peripheral ID between multiple GPIO banks.
562 * SAM9263 (PIOC, PIOD, PIOE)
563 * CAP9 (PIOA, PIOB, PIOC, PIOD)
564 */
560 if (last && last->id == data->id) 565 if (last && last->id == data->id)
561 last->next = data; 566 last->next = data;
562 } 567 }
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index fb51f0e0a83f..793fe7b25f36 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -56,6 +56,9 @@ struct at91_cf_data {
56 u8 vcc_pin; /* power switching */ 56 u8 vcc_pin; /* power switching */
57 u8 rst_pin; /* card reset */ 57 u8 rst_pin; /* card reset */
58 u8 chipselect; /* EBI Chip Select number */ 58 u8 chipselect; /* EBI Chip Select number */
59 u8 flags;
60#define AT91_CF_TRUE_IDE 0x01
61#define AT91_IDE_SWAP_A0_A2 0x02
59}; 62};
60extern void __init at91_add_device_cf(struct at91_cf_data *data); 63extern void __init at91_add_device_cf(struct at91_cf_data *data);
61 64
@@ -93,6 +96,7 @@ struct atmel_nand_data {
93 u8 enable_pin; /* chip enable */ 96 u8 enable_pin; /* chip enable */
94 u8 det_pin; /* card detect */ 97 u8 det_pin; /* card detect */
95 u8 rdy_pin; /* ready/busy */ 98 u8 rdy_pin; /* ready/busy */
99 u8 rdy_pin_active_low; /* rdy_pin value is inverted */
96 u8 ale; /* address line number connected to ALE */ 100 u8 ale; /* address line number connected to ALE */
97 u8 cle; /* address line number connected to CLE */ 101 u8 cle; /* address line number connected to CLE */
98 u8 bus_width_16; /* buswidth is 16 bit */ 102 u8 bus_width_16; /* buswidth is 16 bit */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 9bb4f043aa22..7ac812dc055a 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -332,7 +332,6 @@ static int at91_pm_enter(suspend_state_t state)
332 at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR)); 332 at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR));
333 333
334error: 334error:
335 sdram_selfrefresh_disable();
336 target_state = PM_SUSPEND_ON; 335 target_state = PM_SUSPEND_ON;
337 at91_irq_resume(); 336 at91_irq_resume();
338 at91_gpio_resume(); 337 at91_gpio_resume();
diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-evm.c
index a957d239a683..38b6a9ce2a93 100644
--- a/arch/arm/mach-davinci/board-evm.c
+++ b/arch/arm/mach-davinci/board-evm.c
@@ -311,6 +311,9 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
311 gpio_request(gpio + 7, "nCF_SEL"); 311 gpio_request(gpio + 7, "nCF_SEL");
312 gpio_direction_output(gpio + 7, 1); 312 gpio_direction_output(gpio + 7, 1);
313 313
314 /* irlml6401 sustains over 3A, switches 5V in under 8 msec */
315 setup_usb(500, 8);
316
314 return 0; 317 return 0;
315} 318}
316 319
@@ -417,9 +420,6 @@ static __init void davinci_evm_init(void)
417 platform_add_devices(davinci_evm_devices, 420 platform_add_devices(davinci_evm_devices,
418 ARRAY_SIZE(davinci_evm_devices)); 421 ARRAY_SIZE(davinci_evm_devices));
419 evm_init_i2c(); 422 evm_init_i2c();
420
421 /* irlml6401 sustains over 3A, switches 5V in under 8 msec */
422 setup_usb(500, 8);
423} 423}
424 424
425static __init void davinci_evm_irq_init(void) 425static __init void davinci_evm_irq_init(void)
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 28f6dbc95bd7..abb92b7eca0c 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -231,6 +231,11 @@ static struct clk davinci_clks[] = {
231 .lpsc = DAVINCI_LPSC_GPIO, 231 .lpsc = DAVINCI_LPSC_GPIO,
232 }, 232 },
233 { 233 {
234 .name = "usb",
235 .rate = &commonrate,
236 .lpsc = DAVINCI_LPSC_USB,
237 },
238 {
234 .name = "AEMIFCLK", 239 .name = "AEMIFCLK",
235 .rate = &commonrate, 240 .rate = &commonrate,
236 .lpsc = DAVINCI_LPSC_AEMIF, 241 .lpsc = DAVINCI_LPSC_AEMIF,
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 867ead2559ad..69680784448a 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -47,6 +47,7 @@ static struct musb_hdrc_platform_data usb_data = {
47#elif defined(CONFIG_USB_MUSB_HOST) 47#elif defined(CONFIG_USB_MUSB_HOST)
48 .mode = MUSB_HOST, 48 .mode = MUSB_HOST,
49#endif 49#endif
50 .clock = "usb",
50 .config = &musb_config, 51 .config = &musb_config,
51}; 52};
52 53
diff --git a/arch/arm/mach-ep93xx/include/mach/gesbc9312.h b/arch/arm/mach-ep93xx/include/mach/gesbc9312.h
deleted file mode 100644
index 21fe2b922aa5..000000000000
--- a/arch/arm/mach-ep93xx/include/mach/gesbc9312.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/gesbc9312.h
3 */
diff --git a/arch/arm/mach-ep93xx/include/mach/hardware.h b/arch/arm/mach-ep93xx/include/mach/hardware.h
index 529807d182bf..2866297310b7 100644
--- a/arch/arm/mach-ep93xx/include/mach/hardware.h
+++ b/arch/arm/mach-ep93xx/include/mach/hardware.h
@@ -10,7 +10,6 @@
10 10
11#include "platform.h" 11#include "platform.h"
12 12
13#include "gesbc9312.h"
14#include "ts72xx.h" 13#include "ts72xx.h"
15 14
16#endif 15#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index 88f7e88f152f..05f0f4f2f3ce 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -4,6 +4,8 @@
4 4
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6 6
7struct i2c_board_info;
8
7struct ep93xx_eth_data 9struct ep93xx_eth_data
8{ 10{
9 unsigned char dev_addr[6]; 11 unsigned char dev_addr[6];
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index efb86b700276..06083b23bb44 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -42,7 +42,7 @@ void __init kirkwood_init_irq(void)
42 writel(0, GPIO_EDGE_CAUSE(32)); 42 writel(0, GPIO_EDGE_CAUSE(32));
43 43
44 for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) { 44 for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) {
45 set_irq_chip(i, &orion_gpio_irq_level_chip); 45 set_irq_chip(i, &orion_gpio_irq_chip);
46 set_irq_handler(i, handle_level_irq); 46 set_irq_handler(i, handle_level_irq);
47 irq_desc[i].status |= IRQ_LEVEL; 47 irq_desc[i].status |= IRQ_LEVEL;
48 set_irq_flags(i, IRQF_VALID); 48 set_irq_flags(i, IRQF_VALID);
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index e273418797b4..30b7e4bcdbc7 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -40,7 +40,7 @@ void __init mv78xx0_init_irq(void)
40 writel(0, GPIO_EDGE_CAUSE(0)); 40 writel(0, GPIO_EDGE_CAUSE(0));
41 41
42 for (i = IRQ_MV78XX0_GPIO_START; i < NR_IRQS; i++) { 42 for (i = IRQ_MV78XX0_GPIO_START; i < NR_IRQS; i++) {
43 set_irq_chip(i, &orion_gpio_irq_level_chip); 43 set_irq_chip(i, &orion_gpio_irq_chip);
44 set_irq_handler(i, handle_level_irq); 44 set_irq_handler(i, handle_level_irq);
45 irq_desc[i].status |= IRQ_LEVEL; 45 irq_desc[i].status |= IRQ_LEVEL;
46 set_irq_flags(i, IRQF_VALID); 46 set_irq_flags(i, IRQF_VALID);
diff --git a/arch/arm/mach-mx1/devices.c b/arch/arm/mach-mx1/devices.c
index 686d8d2dbb24..a95644193f3f 100644
--- a/arch/arm/mach-mx1/devices.c
+++ b/arch/arm/mach-mx1/devices.c
@@ -23,6 +23,8 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26
27#include <mach/irqs.h>
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27 29
28static struct resource imx_csi_resources[] = { 30static struct resource imx_csi_resources[] = {
diff --git a/arch/arm/mach-mx1/mx1ads.c b/arch/arm/mach-mx1/mx1ads.c
index 2e4b185fe4a9..3200cf60e384 100644
--- a/arch/arm/mach-mx1/mx1ads.c
+++ b/arch/arm/mach-mx1/mx1ads.c
@@ -21,6 +21,7 @@
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23 23
24#include <mach/irqs.h>
24#include <mach/hardware.h> 25#include <mach/hardware.h>
25#include <mach/common.h> 26#include <mach/common.h>
26#include <mach/imx-uart.h> 27#include <mach/imx-uart.h>
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index f6a13451d1fd..6031e179926b 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -81,7 +81,7 @@ static inline void __init ldp_init_smc911x(void)
81 } 81 }
82 82
83 ldp_smc911x_resources[0].start = cs_mem_base + 0x0; 83 ldp_smc911x_resources[0].start = cs_mem_base + 0x0;
84 ldp_smc911x_resources[0].end = cs_mem_base + 0xf; 84 ldp_smc911x_resources[0].end = cs_mem_base + 0xff;
85 udelay(100); 85 udelay(100);
86 86
87 eth_gpio = LDP_SMC911X_GPIO; 87 eth_gpio = LDP_SMC911X_GPIO;
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 38c88fbe658d..e39cd2c46cfa 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -178,7 +178,9 @@ static int __init omap3_beagle_i2c_init(void)
178#ifdef CONFIG_I2C2_OMAP_BEAGLE 178#ifdef CONFIG_I2C2_OMAP_BEAGLE
179 omap_register_i2c_bus(2, 400, NULL, 0); 179 omap_register_i2c_bus(2, 400, NULL, 0);
180#endif 180#endif
181 omap_register_i2c_bus(3, 400, NULL, 0); 181 /* Bus 3 is attached to the DVI port where devices like the pico DLP
182 * projector don't work reliably with 400kHz */
183 omap_register_i2c_bus(3, 100, NULL, 0);
182 return 0; 184 return 0;
183} 185}
184 186
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ad721e0cbf7a..ce4d46a4a838 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -565,7 +565,7 @@ u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val)
565 * 565 *
566 * Given a struct clk of a rate-selectable clksel clock, and a clock divisor, 566 * Given a struct clk of a rate-selectable clksel clock, and a clock divisor,
567 * find the corresponding register field value. The return register value is 567 * find the corresponding register field value. The return register value is
568 * the value before left-shifting. Returns 0xffffffff on error 568 * the value before left-shifting. Returns ~0 on error
569 */ 569 */
570u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) 570u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
571{ 571{
@@ -577,7 +577,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
577 577
578 clks = omap2_get_clksel_by_parent(clk, clk->parent); 578 clks = omap2_get_clksel_by_parent(clk, clk->parent);
579 if (clks == NULL) 579 if (clks == NULL)
580 return 0; 580 return ~0;
581 581
582 for (clkr = clks->rates; clkr->div; clkr++) { 582 for (clkr = clks->rates; clkr->div; clkr++) {
583 if ((clkr->flags & cpu_mask) && (clkr->div == div)) 583 if ((clkr->flags & cpu_mask) && (clkr->div == div))
@@ -588,7 +588,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
588 printk(KERN_ERR "clock: Could not find divisor %d for " 588 printk(KERN_ERR "clock: Could not find divisor %d for "
589 "clock %s parent %s\n", div, clk->name, 589 "clock %s parent %s\n", div, clk->name,
590 clk->parent->name); 590 clk->parent->name);
591 return 0; 591 return ~0;
592 } 592 }
593 593
594 return clkr->val; 594 return clkr->val;
@@ -708,7 +708,7 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr,
708 return 0; 708 return 0;
709 709
710 for (clkr = clks->rates; clkr->div; clkr++) { 710 for (clkr = clks->rates; clkr->div; clkr++) {
711 if (clkr->flags & (cpu_mask | DEFAULT_RATE)) 711 if (clkr->flags & cpu_mask && clkr->flags & DEFAULT_RATE)
712 break; /* Found the default rate for this platform */ 712 break; /* Found the default rate for this platform */
713 } 713 }
714 714
@@ -746,7 +746,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
746 return -EINVAL; 746 return -EINVAL;
747 747
748 if (clk->usecount > 0) 748 if (clk->usecount > 0)
749 _omap2_clk_disable(clk); 749 omap2_clk_disable(clk);
750 750
751 /* Set new source value (previous dividers if any in effect) */ 751 /* Set new source value (previous dividers if any in effect) */
752 reg_val = __raw_readl(src_addr) & ~field_mask; 752 reg_val = __raw_readl(src_addr) & ~field_mask;
@@ -759,11 +759,11 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
759 wmb(); 759 wmb();
760 } 760 }
761 761
762 if (clk->usecount > 0)
763 _omap2_clk_enable(clk);
764
765 clk->parent = new_parent; 762 clk->parent = new_parent;
766 763
764 if (clk->usecount > 0)
765 omap2_clk_enable(clk);
766
767 /* CLKSEL clocks follow their parents' rates, divided by a divisor */ 767 /* CLKSEL clocks follow their parents' rates, divided by a divisor */
768 clk->rate = new_parent->rate; 768 clk->rate = new_parent->rate;
769 769
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 0a623379789f..8a0e49d84256 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -431,6 +431,10 @@ void __init orion5x_uart1_init(void)
431/***************************************************************************** 431/*****************************************************************************
432 * XOR engine 432 * XOR engine
433 ****************************************************************************/ 433 ****************************************************************************/
434struct mv_xor_platform_shared_data orion5x_xor_shared_data = {
435 .dram = &orion5x_mbus_dram_info,
436};
437
434static struct resource orion5x_xor_shared_resources[] = { 438static struct resource orion5x_xor_shared_resources[] = {
435 { 439 {
436 .name = "xor low", 440 .name = "xor low",
@@ -448,6 +452,9 @@ static struct resource orion5x_xor_shared_resources[] = {
448static struct platform_device orion5x_xor_shared = { 452static struct platform_device orion5x_xor_shared = {
449 .name = MV_XOR_SHARED_NAME, 453 .name = MV_XOR_SHARED_NAME,
450 .id = 0, 454 .id = 0,
455 .dev = {
456 .platform_data = &orion5x_xor_shared_data,
457 },
451 .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources), 458 .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources),
452 .resource = orion5x_xor_shared_resources, 459 .resource = orion5x_xor_shared_resources,
453}; 460};
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 0caae43301e5..e03f7b45cb0d 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -44,7 +44,7 @@ void __init orion5x_init_irq(void)
44 * User can use set_type() if he wants to use edge types handlers. 44 * User can use set_type() if he wants to use edge types handlers.
45 */ 45 */
46 for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) { 46 for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) {
47 set_irq_chip(i, &orion_gpio_irq_level_chip); 47 set_irq_chip(i, &orion_gpio_irq_chip);
48 set_irq_handler(i, handle_level_irq); 48 set_irq_handler(i, handle_level_irq);
49 irq_desc[i].status |= IRQ_LEVEL; 49 irq_desc[i].status |= IRQ_LEVEL;
50 set_irq_flags(i, IRQF_VALID); 50 set_irq_flags(i, IRQF_VALID);
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index e88d417736af..c7fc01e9d1f6 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -19,6 +19,7 @@
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h>
22 23
23#include <asm/elf.h> 24#include <asm/elf.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -201,8 +202,13 @@ static struct platform_device *devs[] __initdata = {
201 &pata_device, 202 &pata_device,
202}; 203};
203 204
205static struct i2c_board_info i2c_rtc = {
206 I2C_BOARD_INFO("pcf8583", 0x50)
207};
208
204static int __init rpc_init(void) 209static int __init rpc_init(void)
205{ 210{
211 i2c_register_board_info(0, &i2c_rtc, 1);
206 return platform_add_devices(devs, ARRAY_SIZE(devs)); 212 return platform_add_devices(devs, ARRAY_SIZE(devs));
207} 213}
208 214
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c
index 3c4d47145c83..25f7935576f8 100644
--- a/arch/arm/mach-s3c6410/mach-smdk6410.c
+++ b/arch/arm/mach-s3c6410/mach-smdk6410.c
@@ -129,7 +129,7 @@ static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
129 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, 129 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
130}; 130};
131 131
132struct map_desc smdk6410_iodesc[] = {}; 132static struct map_desc smdk6410_iodesc[] = {};
133 133
134static struct platform_device *smdk6410_devices[] __initdata = { 134static struct platform_device *smdk6410_devices[] __initdata = {
135#ifdef CONFIG_SMDK6410_SD_CH0 135#ifdef CONFIG_SMDK6410_SD_CH0
@@ -146,7 +146,7 @@ static struct platform_device *smdk6410_devices[] __initdata = {
146 146
147static struct i2c_board_info i2c_devs0[] __initdata = { 147static struct i2c_board_info i2c_devs0[] __initdata = {
148 { I2C_BOARD_INFO("24c08", 0x50), }, 148 { I2C_BOARD_INFO("24c08", 0x50), },
149 { I2C_BOARD_INFO("WM8580", 0X1b), }, 149 { I2C_BOARD_INFO("wm8580", 0x1b), },
150}; 150};
151 151
152static struct i2c_board_info i2c_devs1[] __initdata = { 152static struct i2c_board_info i2c_devs1[] __initdata = {
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index 8a7f65ba14b7..94077fbd96b7 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -23,7 +23,8 @@ ENTRY(v6_early_abort)
23#ifdef CONFIG_CPU_32v6K 23#ifdef CONFIG_CPU_32v6K
24 clrex 24 clrex
25#else 25#else
26 strex r0, r1, [sp] @ Clear the exclusive monitor 26 sub r1, sp, #4 @ Get unused stack location
27 strex r0, r1, [r1] @ Clear the exclusive monitor
27#endif 28#endif
28 mrc p15, 0, r1, c5, c0, 0 @ get FSR 29 mrc p15, 0, r1, c5, c0, 0 @ get FSR
29 mrc p15, 0, r0, c6, c0, 0 @ get FAR 30 mrc p15, 0, r0, c6, c0, 0 @ get FAR
diff --git a/arch/arm/mm/copypage-feroceon.c b/arch/arm/mm/copypage-feroceon.c
index c3ba6a94da0c..70997d5bee2d 100644
--- a/arch/arm/mm/copypage-feroceon.c
+++ b/arch/arm/mm/copypage-feroceon.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/highmem.h> 14#include <linux/highmem.h>
15 15
16static void __attribute__((naked)) 16static void __naked
17feroceon_copy_user_page(void *kto, const void *kfrom) 17feroceon_copy_user_page(void *kto, const void *kfrom)
18{ 18{
19 asm("\ 19 asm("\
diff --git a/arch/arm/mm/copypage-v3.c b/arch/arm/mm/copypage-v3.c
index 70ed96c8af8e..de9c06854ad7 100644
--- a/arch/arm/mm/copypage-v3.c
+++ b/arch/arm/mm/copypage-v3.c
@@ -15,7 +15,7 @@
15 * 15 *
16 * FIXME: do we need to handle cache stuff... 16 * FIXME: do we need to handle cache stuff...
17 */ 17 */
18static void __attribute__((naked)) 18static void __naked
19v3_copy_user_page(void *kto, const void *kfrom) 19v3_copy_user_page(void *kto, const void *kfrom)
20{ 20{
21 asm("\n\ 21 asm("\n\
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c
index 1601698b9800..7370a7142b04 100644
--- a/arch/arm/mm/copypage-v4mc.c
+++ b/arch/arm/mm/copypage-v4mc.c
@@ -44,7 +44,7 @@ static DEFINE_SPINLOCK(minicache_lock);
44 * instruction. If your processor does not supply this, you have to write your 44 * instruction. If your processor does not supply this, you have to write your
45 * own copy_user_highpage that does the right thing. 45 * own copy_user_highpage that does the right thing.
46 */ 46 */
47static void __attribute__((naked)) 47static void __naked
48mc_copy_user_page(void *from, void *to) 48mc_copy_user_page(void *from, void *to)
49{ 49{
50 asm volatile( 50 asm volatile(
diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c
index 3ec93dab7656..9ab098414227 100644
--- a/arch/arm/mm/copypage-v4wb.c
+++ b/arch/arm/mm/copypage-v4wb.c
@@ -22,7 +22,7 @@
22 * instruction. If your processor does not supply this, you have to write your 22 * instruction. If your processor does not supply this, you have to write your
23 * own copy_user_highpage that does the right thing. 23 * own copy_user_highpage that does the right thing.
24 */ 24 */
25static void __attribute__((naked)) 25static void __naked
26v4wb_copy_user_page(void *kto, const void *kfrom) 26v4wb_copy_user_page(void *kto, const void *kfrom)
27{ 27{
28 asm("\ 28 asm("\
diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c
index 0f1188efae45..300efafd6643 100644
--- a/arch/arm/mm/copypage-v4wt.c
+++ b/arch/arm/mm/copypage-v4wt.c
@@ -20,7 +20,7 @@
20 * dirty data in the cache. However, we do have to ensure that 20 * dirty data in the cache. However, we do have to ensure that
21 * subsequent reads are up to date. 21 * subsequent reads are up to date.
22 */ 22 */
23static void __attribute__((naked)) 23static void __naked
24v4wt_copy_user_page(void *kto, const void *kfrom) 24v4wt_copy_user_page(void *kto, const void *kfrom)
25{ 25{
26 asm("\ 26 asm("\
diff --git a/arch/arm/mm/copypage-xsc3.c b/arch/arm/mm/copypage-xsc3.c
index 39a994542cad..bc4525f5ab23 100644
--- a/arch/arm/mm/copypage-xsc3.c
+++ b/arch/arm/mm/copypage-xsc3.c
@@ -29,7 +29,7 @@
29 * if we eventually end up using our copied page. 29 * if we eventually end up using our copied page.
30 * 30 *
31 */ 31 */
32static void __attribute__((naked)) 32static void __naked
33xsc3_mc_copy_user_page(void *kto, const void *kfrom) 33xsc3_mc_copy_user_page(void *kto, const void *kfrom)
34{ 34{
35 asm("\ 35 asm("\
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c
index d18f2397ee2d..76824d3e966a 100644
--- a/arch/arm/mm/copypage-xscale.c
+++ b/arch/arm/mm/copypage-xscale.c
@@ -42,7 +42,7 @@ static DEFINE_SPINLOCK(minicache_lock);
42 * Dcache aliasing issue. The writes will be forwarded to the write buffer, 42 * Dcache aliasing issue. The writes will be forwarded to the write buffer,
43 * and merged as appropriate. 43 * and merged as appropriate.
44 */ 44 */
45static void __attribute__((naked)) 45static void __naked
46mc_copy_user_page(void *from, void *to) 46mc_copy_user_page(void *from, void *to)
47{ 47{
48 /* 48 /*
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 310e479309ef..f1ef5613ccd4 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -490,26 +490,30 @@ core_initcall(consistent_init);
490 */ 490 */
491void dma_cache_maint(const void *start, size_t size, int direction) 491void dma_cache_maint(const void *start, size_t size, int direction)
492{ 492{
493 const void *end = start + size; 493 void (*inner_op)(const void *, const void *);
494 void (*outer_op)(unsigned long, unsigned long);
494 495
495 BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(end - 1)); 496 BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(start + size - 1));
496 497
497 switch (direction) { 498 switch (direction) {
498 case DMA_FROM_DEVICE: /* invalidate only */ 499 case DMA_FROM_DEVICE: /* invalidate only */
499 dmac_inv_range(start, end); 500 inner_op = dmac_inv_range;
500 outer_inv_range(__pa(start), __pa(end)); 501 outer_op = outer_inv_range;
501 break; 502 break;
502 case DMA_TO_DEVICE: /* writeback only */ 503 case DMA_TO_DEVICE: /* writeback only */
503 dmac_clean_range(start, end); 504 inner_op = dmac_clean_range;
504 outer_clean_range(__pa(start), __pa(end)); 505 outer_op = outer_clean_range;
505 break; 506 break;
506 case DMA_BIDIRECTIONAL: /* writeback and invalidate */ 507 case DMA_BIDIRECTIONAL: /* writeback and invalidate */
507 dmac_flush_range(start, end); 508 inner_op = dmac_flush_range;
508 outer_flush_range(__pa(start), __pa(end)); 509 outer_op = outer_flush_range;
509 break; 510 break;
510 default: 511 default:
511 BUG(); 512 BUG();
512 } 513 }
514
515 inner_op(start, start + size);
516 outer_op(__pa(start), __pa(start) + size);
513} 517}
514EXPORT_SYMBOL(dma_cache_maint); 518EXPORT_SYMBOL(dma_cache_maint);
515 519
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 34df4d9d03a6..80fd3b69ae1f 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -382,7 +382,7 @@ void __init bootmem_init(void)
382 for_each_node(node) 382 for_each_node(node)
383 bootmem_free_node(node, mi); 383 bootmem_free_node(node, mi);
384 384
385 high_memory = __va(memend_pfn << PAGE_SHIFT); 385 high_memory = __va((memend_pfn << PAGE_SHIFT) - 1) + 1;
386 386
387 /* 387 /*
388 * This doesn't seem to be used by the Linux memory manager any 388 * This doesn't seem to be used by the Linux memory manager any
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 5358fcc7f61e..f7457fea6de8 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -124,7 +124,7 @@ int valid_phys_addr_range(unsigned long addr, size_t size)
124{ 124{
125 if (addr < PHYS_OFFSET) 125 if (addr < PHYS_OFFSET)
126 return 0; 126 return 0;
127 if (addr + size > __pa(high_memory)) 127 if (addr + size >= __pa(high_memory - 1))
128 return 0; 128 return 0;
129 129
130 return 1; 130 return 1;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 9b36c5cb5e9f..d4d082c5c2d4 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -693,7 +693,8 @@ static void __init sanity_check_meminfo(void)
693 * Check whether this memory bank would entirely overlap 693 * Check whether this memory bank would entirely overlap
694 * the vmalloc area. 694 * the vmalloc area.
695 */ 695 */
696 if (__va(bank->start) >= VMALLOC_MIN) { 696 if (__va(bank->start) >= VMALLOC_MIN ||
697 __va(bank->start) < PAGE_OFFSET) {
697 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " 698 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
698 "(vmalloc region overlap).\n", 699 "(vmalloc region overlap).\n",
699 bank->start, bank->start + bank->size - 1); 700 bank->start, bank->start + bank->size - 1);
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index deaff58878a2..04a100cfb8e5 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -18,7 +18,8 @@ obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
18obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o 18obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
19obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o 19obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
20obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o 20obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
21obj-$(CONFIG_I2C_OMAP) += i2c.o 21i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
22obj-y += $(i2c-omap-m) $(i2c-omap-y)
22 23
23# OMAP mailbox framework 24# OMAP mailbox framework
24obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o 25obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 0843b8882f93..6825fbb5a056 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -200,20 +200,16 @@ static struct clocksource clocksource_32k = {
200}; 200};
201 201
202/* 202/*
203 * Rounds down to nearest nsec.
204 */
205unsigned long long omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
206{
207 return cyc2ns(&clocksource_32k, ticks_32k);
208}
209
210/*
211 * Returns current time from boot in nsecs. It's OK for this to wrap 203 * Returns current time from boot in nsecs. It's OK for this to wrap
212 * around for now, as it's just a relative time stamp. 204 * around for now, as it's just a relative time stamp.
213 */ 205 */
214unsigned long long sched_clock(void) 206unsigned long long sched_clock(void)
215{ 207{
216 return omap_32k_ticks_to_nsecs(omap_32k_read()); 208 unsigned long long ret;
209
210 ret = (unsigned long long)omap_32k_read();
211 ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift;
212 return ret;
217} 213}
218 214
219static int __init omap_init_clocksource_32k(void) 215static int __init omap_init_clocksource_32k(void)
diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h
index ef70e2b0f054..e746ec7e785e 100644
--- a/arch/arm/plat-omap/include/mach/common.h
+++ b/arch/arm/plat-omap/include/mach/common.h
@@ -35,7 +35,7 @@ extern void omap_map_common_io(void);
35extern struct sys_timer omap_timer; 35extern struct sys_timer omap_timer;
36extern void omap_serial_init(void); 36extern void omap_serial_init(void);
37extern void omap_serial_enable_clocks(int enable); 37extern void omap_serial_enable_clocks(int enable);
38#ifdef CONFIG_I2C_OMAP 38#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
39extern int omap_register_i2c_bus(int bus_id, u32 clkrate, 39extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
40 struct i2c_board_info const *info, 40 struct i2c_board_info const *info,
41 unsigned len); 41 unsigned len);
diff --git a/arch/arm/plat-omap/include/mach/pm.h b/arch/arm/plat-omap/include/mach/pm.h
index 2a9c27ad4c37..37e2f0f38b46 100644
--- a/arch/arm/plat-omap/include/mach/pm.h
+++ b/arch/arm/plat-omap/include/mach/pm.h
@@ -108,7 +108,7 @@
108 !defined(CONFIG_ARCH_OMAP15XX) && \ 108 !defined(CONFIG_ARCH_OMAP15XX) && \
109 !defined(CONFIG_ARCH_OMAP16XX) && \ 109 !defined(CONFIG_ARCH_OMAP16XX) && \
110 !defined(CONFIG_ARCH_OMAP24XX) 110 !defined(CONFIG_ARCH_OMAP24XX)
111#error "Power management for this processor not implemented yet" 111#warning "Power management for this processor not implemented yet"
112#endif 112#endif
113 113
114#ifndef __ASSEMBLER__ 114#ifndef __ASSEMBLER__
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index 967186425ca1..0d12c2164766 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -265,51 +265,36 @@ EXPORT_SYMBOL(orion_gpio_set_blink);
265 * polarity LEVEL mask 265 * polarity LEVEL mask
266 * 266 *
267 ****************************************************************************/ 267 ****************************************************************************/
268static void gpio_irq_edge_ack(u32 irq)
269{
270 int pin = irq_to_gpio(irq);
271
272 writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin));
273}
274
275static void gpio_irq_edge_mask(u32 irq)
276{
277 int pin = irq_to_gpio(irq);
278 u32 u;
279
280 u = readl(GPIO_EDGE_MASK(pin));
281 u &= ~(1 << (pin & 31));
282 writel(u, GPIO_EDGE_MASK(pin));
283}
284 268
285static void gpio_irq_edge_unmask(u32 irq) 269static void gpio_irq_ack(u32 irq)
286{ 270{
287 int pin = irq_to_gpio(irq); 271 int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK;
288 u32 u; 272 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
289 273 int pin = irq_to_gpio(irq);
290 u = readl(GPIO_EDGE_MASK(pin)); 274 writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin));
291 u |= 1 << (pin & 31); 275 }
292 writel(u, GPIO_EDGE_MASK(pin));
293} 276}
294 277
295static void gpio_irq_level_mask(u32 irq) 278static void gpio_irq_mask(u32 irq)
296{ 279{
297 int pin = irq_to_gpio(irq); 280 int pin = irq_to_gpio(irq);
298 u32 u; 281 int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK;
299 282 u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ?
300 u = readl(GPIO_LEVEL_MASK(pin)); 283 GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin);
284 u32 u = readl(reg);
301 u &= ~(1 << (pin & 31)); 285 u &= ~(1 << (pin & 31));
302 writel(u, GPIO_LEVEL_MASK(pin)); 286 writel(u, reg);
303} 287}
304 288
305static void gpio_irq_level_unmask(u32 irq) 289static void gpio_irq_unmask(u32 irq)
306{ 290{
307 int pin = irq_to_gpio(irq); 291 int pin = irq_to_gpio(irq);
308 u32 u; 292 int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK;
309 293 u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ?
310 u = readl(GPIO_LEVEL_MASK(pin)); 294 GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin);
295 u32 u = readl(reg);
311 u |= 1 << (pin & 31); 296 u |= 1 << (pin & 31);
312 writel(u, GPIO_LEVEL_MASK(pin)); 297 writel(u, reg);
313} 298}
314 299
315static int gpio_irq_set_type(u32 irq, u32 type) 300static int gpio_irq_set_type(u32 irq, u32 type)
@@ -331,9 +316,9 @@ static int gpio_irq_set_type(u32 irq, u32 type)
331 * Set edge/level type. 316 * Set edge/level type.
332 */ 317 */
333 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { 318 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
334 desc->chip = &orion_gpio_irq_edge_chip; 319 desc->handle_irq = handle_edge_irq;
335 } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 320 } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
336 desc->chip = &orion_gpio_irq_level_chip; 321 desc->handle_irq = handle_level_irq;
337 } else { 322 } else {
338 printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type); 323 printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type);
339 return -EINVAL; 324 return -EINVAL;
@@ -371,19 +356,11 @@ static int gpio_irq_set_type(u32 irq, u32 type)
371 return 0; 356 return 0;
372} 357}
373 358
374struct irq_chip orion_gpio_irq_edge_chip = { 359struct irq_chip orion_gpio_irq_chip = {
375 .name = "orion_gpio_irq_edge", 360 .name = "orion_gpio",
376 .ack = gpio_irq_edge_ack, 361 .ack = gpio_irq_ack,
377 .mask = gpio_irq_edge_mask, 362 .mask = gpio_irq_mask,
378 .unmask = gpio_irq_edge_unmask, 363 .unmask = gpio_irq_unmask,
379 .set_type = gpio_irq_set_type,
380};
381
382struct irq_chip orion_gpio_irq_level_chip = {
383 .name = "orion_gpio_irq_level",
384 .mask = gpio_irq_level_mask,
385 .mask_ack = gpio_irq_level_mask,
386 .unmask = gpio_irq_level_unmask,
387 .set_type = gpio_irq_set_type, 364 .set_type = gpio_irq_set_type,
388}; 365};
389 366
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 54deaf274b52..ec743e82c876 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -31,8 +31,7 @@ void orion_gpio_set_blink(unsigned pin, int blink);
31/* 31/*
32 * GPIO interrupt handling. 32 * GPIO interrupt handling.
33 */ 33 */
34extern struct irq_chip orion_gpio_irq_edge_chip; 34extern struct irq_chip orion_gpio_irq_chip;
35extern struct irq_chip orion_gpio_irq_level_chip;
36void orion_gpio_irq_handler(int irqoff); 35void orion_gpio_irq_handler(int irqoff);
37 36
38 37
diff --git a/arch/arm/plat-s3c64xx/clock.c b/arch/arm/plat-s3c64xx/clock.c
index 136c982c68e1..ad1b9682c9c3 100644
--- a/arch/arm/plat-s3c64xx/clock.c
+++ b/arch/arm/plat-s3c64xx/clock.c
@@ -248,7 +248,7 @@ static struct clk *clks[] __initdata = {
248 &clk_48m, 248 &clk_48m,
249}; 249};
250 250
251void s3c64xx_register_clocks(void) 251void __init s3c64xx_register_clocks(void)
252{ 252{
253 struct clk *clkp; 253 struct clk *clkp;
254 int ret; 254 int ret;
diff --git a/arch/arm/plat-s3c64xx/gpiolib.c b/arch/arm/plat-s3c64xx/gpiolib.c
index cc62941d7b5c..ee9188add8fb 100644
--- a/arch/arm/plat-s3c64xx/gpiolib.c
+++ b/arch/arm/plat-s3c64xx/gpiolib.c
@@ -417,4 +417,4 @@ static __init int s3c64xx_gpiolib_init(void)
417 return 0; 417 return 0;
418} 418}
419 419
420arch_initcall(s3c64xx_gpiolib_init); 420core_initcall(s3c64xx_gpiolib_init);
diff --git a/arch/arm/plat-s3c64xx/include/plat/irqs.h b/arch/arm/plat-s3c64xx/include/plat/irqs.h
index 2846f550b727..f865bf4d709e 100644
--- a/arch/arm/plat-s3c64xx/include/plat/irqs.h
+++ b/arch/arm/plat-s3c64xx/include/plat/irqs.h
@@ -117,7 +117,7 @@
117#define IRQ_ONENAND1 S3C64XX_IRQ_VIC1(12) 117#define IRQ_ONENAND1 S3C64XX_IRQ_VIC1(12)
118#define IRQ_NFC S3C64XX_IRQ_VIC1(13) 118#define IRQ_NFC S3C64XX_IRQ_VIC1(13)
119#define IRQ_CFCON S3C64XX_IRQ_VIC1(14) 119#define IRQ_CFCON S3C64XX_IRQ_VIC1(14)
120#define IRQ_UHOST S3C64XX_IRQ_VIC1(15) 120#define IRQ_USBH S3C64XX_IRQ_VIC1(15)
121#define IRQ_SPI0 S3C64XX_IRQ_VIC1(16) 121#define IRQ_SPI0 S3C64XX_IRQ_VIC1(16)
122#define IRQ_SPI1 S3C64XX_IRQ_VIC1(17) 122#define IRQ_SPI1 S3C64XX_IRQ_VIC1(17)
123#define IRQ_IIC S3C64XX_IRQ_VIC1(18) 123#define IRQ_IIC S3C64XX_IRQ_VIC1(18)
diff --git a/arch/arm/plat-s3c64xx/irq-eint.c b/arch/arm/plat-s3c64xx/irq-eint.c
index 1f7cc0067f5c..cf524826c93a 100644
--- a/arch/arm/plat-s3c64xx/irq-eint.c
+++ b/arch/arm/plat-s3c64xx/irq-eint.c
@@ -14,12 +14,15 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/gpio.h>
17#include <linux/irq.h> 18#include <linux/irq.h>
18#include <linux/io.h> 19#include <linux/io.h>
19 20
20#include <asm/hardware/vic.h> 21#include <asm/hardware/vic.h>
21 22
22#include <plat/regs-irqtype.h> 23#include <plat/regs-irqtype.h>
24#include <plat/regs-gpio.h>
25#include <plat/gpio-cfg.h>
23 26
24#include <mach/map.h> 27#include <mach/map.h>
25#include <plat/cpu.h> 28#include <plat/cpu.h>
@@ -55,7 +58,7 @@ static void s3c_irq_eint_unmask(unsigned int irq)
55 u32 mask; 58 u32 mask;
56 59
57 mask = __raw_readl(S3C64XX_EINT0MASK); 60 mask = __raw_readl(S3C64XX_EINT0MASK);
58 mask |= eint_irq_to_bit(irq); 61 mask &= ~eint_irq_to_bit(irq);
59 __raw_writel(mask, S3C64XX_EINT0MASK); 62 __raw_writel(mask, S3C64XX_EINT0MASK);
60} 63}
61 64
@@ -74,6 +77,7 @@ static void s3c_irq_eint_maskack(unsigned int irq)
74static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type) 77static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
75{ 78{
76 int offs = eint_offset(irq); 79 int offs = eint_offset(irq);
80 int pin;
77 int shift; 81 int shift;
78 u32 ctrl, mask; 82 u32 ctrl, mask;
79 u32 newvalue = 0; 83 u32 newvalue = 0;
@@ -125,6 +129,15 @@ static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
125 ctrl |= newvalue << shift; 129 ctrl |= newvalue << shift;
126 __raw_writel(ctrl, reg); 130 __raw_writel(ctrl, reg);
127 131
132 /* set the GPIO pin appropriately */
133
134 if (offs < 23)
135 pin = S3C64XX_GPN(offs);
136 else
137 pin = S3C64XX_GPM(offs - 23);
138
139 s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(2));
140
128 return 0; 141 return 0;
129} 142}
130 143
@@ -181,7 +194,7 @@ static void s3c_irq_demux_eint20_27(unsigned int irq, struct irq_desc *desc)
181 s3c_irq_demux_eint(20, 27); 194 s3c_irq_demux_eint(20, 27);
182} 195}
183 196
184int __init s3c64xx_init_irq_eint(void) 197static int __init s3c64xx_init_irq_eint(void)
185{ 198{
186 int irq; 199 int irq;
187 200
diff --git a/arch/arm/plat-s3c64xx/irq.c b/arch/arm/plat-s3c64xx/irq.c
index a94f1d5e819d..f22edf7c2d2d 100644
--- a/arch/arm/plat-s3c64xx/irq.c
+++ b/arch/arm/plat-s3c64xx/irq.c
@@ -207,7 +207,7 @@ static struct irq_chip s3c_irq_uart = {
207 207
208static void __init s3c64xx_uart_irq(struct uart_irq *uirq) 208static void __init s3c64xx_uart_irq(struct uart_irq *uirq)
209{ 209{
210 void *reg_base = uirq->regs; 210 void __iomem *reg_base = uirq->regs;
211 unsigned int irq; 211 unsigned int irq;
212 int offs; 212 int offs;
213 213
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c
index 8d9a0cada668..05b17528041e 100644
--- a/arch/arm/plat-s3c64xx/s3c6400-clock.c
+++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c
@@ -36,7 +36,7 @@
36 * ext_xtal_mux for want of an actual name from the manual. 36 * ext_xtal_mux for want of an actual name from the manual.
37*/ 37*/
38 38
39struct clk clk_ext_xtal_mux = { 39static struct clk clk_ext_xtal_mux = {
40 .name = "ext_xtal", 40 .name = "ext_xtal",
41 .id = -1, 41 .id = -1,
42}; 42};
@@ -63,7 +63,7 @@ struct clksrc_clk {
63 void __iomem *reg_divider; 63 void __iomem *reg_divider;
64}; 64};
65 65
66struct clk clk_fout_apll = { 66static struct clk clk_fout_apll = {
67 .name = "fout_apll", 67 .name = "fout_apll",
68 .id = -1, 68 .id = -1,
69}; 69};
@@ -78,7 +78,7 @@ static struct clk_sources clk_src_apll = {
78 .nr_sources = ARRAY_SIZE(clk_src_apll_list), 78 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
79}; 79};
80 80
81struct clksrc_clk clk_mout_apll = { 81static struct clksrc_clk clk_mout_apll = {
82 .clk = { 82 .clk = {
83 .name = "mout_apll", 83 .name = "mout_apll",
84 .id = -1, 84 .id = -1,
@@ -88,7 +88,7 @@ struct clksrc_clk clk_mout_apll = {
88 .sources = &clk_src_apll, 88 .sources = &clk_src_apll,
89}; 89};
90 90
91struct clk clk_fout_epll = { 91static struct clk clk_fout_epll = {
92 .name = "fout_epll", 92 .name = "fout_epll",
93 .id = -1, 93 .id = -1,
94}; 94};
@@ -103,7 +103,7 @@ static struct clk_sources clk_src_epll = {
103 .nr_sources = ARRAY_SIZE(clk_src_epll_list), 103 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
104}; 104};
105 105
106struct clksrc_clk clk_mout_epll = { 106static struct clksrc_clk clk_mout_epll = {
107 .clk = { 107 .clk = {
108 .name = "mout_epll", 108 .name = "mout_epll",
109 .id = -1, 109 .id = -1,
@@ -123,7 +123,7 @@ static struct clk_sources clk_src_mpll = {
123 .nr_sources = ARRAY_SIZE(clk_src_mpll_list), 123 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
124}; 124};
125 125
126struct clksrc_clk clk_mout_mpll = { 126static struct clksrc_clk clk_mout_mpll = {
127 .clk = { 127 .clk = {
128 .name = "mout_mpll", 128 .name = "mout_mpll",
129 .id = -1, 129 .id = -1,
@@ -145,7 +145,7 @@ static unsigned long s3c64xx_clk_doutmpll_get_rate(struct clk *clk)
145 return rate; 145 return rate;
146} 146}
147 147
148struct clk clk_dout_mpll = { 148static struct clk clk_dout_mpll = {
149 .name = "dout_mpll", 149 .name = "dout_mpll",
150 .id = -1, 150 .id = -1,
151 .parent = &clk_mout_mpll.clk, 151 .parent = &clk_mout_mpll.clk,
@@ -189,10 +189,10 @@ static struct clk_sources clkset_uart = {
189}; 189};
190 190
191static struct clk *clkset_uhost_list[] = { 191static struct clk *clkset_uhost_list[] = {
192 &clk_48m,
192 &clk_mout_epll.clk, 193 &clk_mout_epll.clk,
193 &clk_dout_mpll, 194 &clk_dout_mpll,
194 &clk_fin_epll, 195 &clk_fin_epll,
195 &clk_48m,
196}; 196};
197 197
198static struct clk_sources clkset_uhost = { 198static struct clk_sources clkset_uhost = {
@@ -239,10 +239,12 @@ static int s3c64xx_setrate_clksrc(struct clk *clk, unsigned long rate)
239 239
240 rate = clk_round_rate(clk, rate); 240 rate = clk_round_rate(clk, rate);
241 div = clk_get_rate(clk->parent) / rate; 241 div = clk_get_rate(clk->parent) / rate;
242 if (div > 16)
243 return -EINVAL;
242 244
243 val = __raw_readl(reg); 245 val = __raw_readl(reg);
244 val &= ~sclk->mask; 246 val &= ~(0xf << sclk->shift);
245 val |= (rate - 1) << sclk->shift; 247 val |= (div - 1) << sclk->shift;
246 __raw_writel(val, reg); 248 __raw_writel(val, reg);
247 249
248 return 0; 250 return 0;
@@ -351,7 +353,7 @@ static struct clksrc_clk clk_mmc2 = {
351 353
352static struct clksrc_clk clk_usbhost = { 354static struct clksrc_clk clk_usbhost = {
353 .clk = { 355 .clk = {
354 .name = "usb-host-bus", 356 .name = "usb-bus-host",
355 .id = -1, 357 .id = -1,
356 .ctrlbit = S3C_CLKCON_SCLK_UHOST, 358 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
357 .enable = s3c64xx_sclk_ctrl, 359 .enable = s3c64xx_sclk_ctrl,
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index fd23c0e9e698..b4211d8b2ac7 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Sun Nov 30 16:39:36 2008 15# Last update: Thu Mar 12 18:01:45 2009
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -1811,7 +1811,7 @@ pilz_pmi5 MACH_PILZ_PMI5 PILZ_PMI5 1820
1811jade MACH_JADE JADE 1821 1811jade MACH_JADE JADE 1821
1812ks8695_softplc MACH_KS8695_SOFTPLC KS8695_SOFTPLC 1822 1812ks8695_softplc MACH_KS8695_SOFTPLC KS8695_SOFTPLC 1822
1813gprisc3 MACH_GPRISC3 GPRISC3 1823 1813gprisc3 MACH_GPRISC3 GPRISC3 1823
1814stamp9260 MACH_STAMP9260 STAMP9260 1824 1814stamp9g20 MACH_STAMP9G20 STAMP9G20 1824
1815smdk6430 MACH_SMDK6430 SMDK6430 1825 1815smdk6430 MACH_SMDK6430 SMDK6430 1825
1816smdkc100 MACH_SMDKC100 SMDKC100 1826 1816smdkc100 MACH_SMDKC100 SMDKC100 1826
1817tavorevb MACH_TAVOREVB TAVOREVB 1827 1817tavorevb MACH_TAVOREVB TAVOREVB 1827
@@ -1993,4 +1993,134 @@ spark MACH_SPARK SPARK 2002
1993benzina MACH_BENZINA BENZINA 2003 1993benzina MACH_BENZINA BENZINA 2003
1994blaze MACH_BLAZE BLAZE 2004 1994blaze MACH_BLAZE BLAZE 2004
1995linkstation_ls_hgl MACH_LINKSTATION_LS_HGL LINKSTATION_LS_HGL 2005 1995linkstation_ls_hgl MACH_LINKSTATION_LS_HGL LINKSTATION_LS_HGL 2005
1996htcvenus MACH_HTCVENUS HTCVENUS 2006 1996htckovsky MACH_HTCVENUS HTCVENUS 2006
1997sony_prs505 MACH_SONY_PRS505 SONY_PRS505 2007
1998hanlin_v3 MACH_HANLIN_V3 HANLIN_V3 2008
1999sapphira MACH_SAPPHIRA SAPPHIRA 2009
2000dack_sda_01 MACH_DACK_SDA_01 DACK_SDA_01 2010
2001armbox MACH_ARMBOX ARMBOX 2011
2002harris_rvp MACH_HARRIS_RVP HARRIS_RVP 2012
2003ribaldo MACH_RIBALDO RIBALDO 2013
2004agora MACH_AGORA AGORA 2014
2005omap3_mini MACH_OMAP3_MINI OMAP3_MINI 2015
2006a9sam6432_b MACH_A9SAM6432_B A9SAM6432_B 2016
2007usg2410 MACH_USG2410 USG2410 2017
2008pc72052_i10_revb MACH_PC72052_I10_REVB PC72052_I10_REVB 2018
2009mx35_exm32 MACH_MX35_EXM32 MX35_EXM32 2019
2010topas910 MACH_TOPAS910 TOPAS910 2020
2011hyena MACH_HYENA HYENA 2021
2012pospax MACH_POSPAX POSPAX 2022
2013hdl_gx MACH_HDL_GX HDL_GX 2023
2014ctera_4bay MACH_CTERA_4BAY CTERA_4BAY 2024
2015ctera_plug_c MACH_CTERA_PLUG_C CTERA_PLUG_C 2025
2016crwea_plug_i MACH_CRWEA_PLUG_I CRWEA_PLUG_I 2026
2017egauge2 MACH_EGAUGE2 EGAUGE2 2027
2018didj MACH_DIDJ DIDJ 2028
2019m_s3c2443 MACH_MEISTER MEISTER 2029
2020htcblackstone MACH_HTCBLACKSTONE HTCBLACKSTONE 2030
2021cpuat9g20 MACH_CPUAT9G20 CPUAT9G20 2031
2022smdk6440 MACH_SMDK6440 SMDK6440 2032
2023omap_35xx_mvp MACH_OMAP_35XX_MVP OMAP_35XX_MVP 2033
2024ctera_plug_i MACH_CTERA_PLUG_I CTERA_PLUG_I 2034
2025pvg610_100 MACH_PVG610 PVG610 2035
2026hprw6815 MACH_HPRW6815 HPRW6815 2036
2027omap3_oswald MACH_OMAP3_OSWALD OMAP3_OSWALD 2037
2028nas4220b MACH_NAS4220B NAS4220B 2038
2029htcraphael_cdma MACH_HTCRAPHAEL_CDMA HTCRAPHAEL_CDMA 2039
2030htcdiamond_cdma MACH_HTCDIAMOND_CDMA HTCDIAMOND_CDMA 2040
2031scaler MACH_SCALER SCALER 2041
2032zylonite2 MACH_ZYLONITE2 ZYLONITE2 2042
2033aspenite MACH_ASPENITE ASPENITE 2043
2034teton MACH_TETON TETON 2044
2035ttc_dkb MACH_TTC_DKB TTC_DKB 2045
2036bishop2 MACH_BISHOP2 BISHOP2 2046
2037ippv5 MACH_IPPV5 IPPV5 2047
2038farm926 MACH_FARM926 FARM926 2048
2039mmccpu MACH_MMCCPU MMCCPU 2049
2040sgmsfl MACH_SGMSFL SGMSFL 2050
2041tt8000 MACH_TT8000 TT8000 2051
2042zrn4300lp MACH_ZRN4300LP ZRN4300LP 2052
2043mptc MACH_MPTC MPTC 2053
2044h6051 MACH_H6051 H6051 2054
2045pvg610_101 MACH_PVG610_101 PVG610_101 2055
2046stamp9261_pc_evb MACH_STAMP9261_PC_EVB STAMP9261_PC_EVB 2056
2047pelco_odysseus MACH_PELCO_ODYSSEUS PELCO_ODYSSEUS 2057
2048tny_a9260 MACH_TNY_A9260 TNY_A9260 2058
2049tny_a9g20 MACH_TNY_A9G20 TNY_A9G20 2059
2050aesop_mp2530f MACH_AESOP_MP2530F AESOP_MP2530F 2060
2051dx900 MACH_DX900 DX900 2061
2052cpodc2 MACH_CPODC2 CPODC2 2062
2053tilt_8925 MACH_TILT_8925 TILT_8925 2063
2054davinci_dm357_evm MACH_DAVINCI_DM357_EVM DAVINCI_DM357_EVM 2064
2055swordfish MACH_SWORDFISH SWORDFISH 2065
2056corvus MACH_CORVUS CORVUS 2066
2057taurus MACH_TAURUS TAURUS 2067
2058axm MACH_AXM AXM 2068
2059axc MACH_AXC AXC 2069
2060baby MACH_BABY BABY 2070
2061mp200 MACH_MP200 MP200 2071
2062pcm043 MACH_PCM043 PCM043 2072
2063hanlin_v3c MACH_HANLIN_V3C HANLIN_V3C 2073
2064kbk9g20 MACH_KBK9G20 KBK9G20 2074
2065adsturbog5 MACH_ADSTURBOG5 ADSTURBOG5 2075
2066avenger_lite1 MACH_AVENGER_LITE1 AVENGER_LITE1 2076
2067suc82x MACH_SUC SUC 2077
2068at91sam7s256 MACH_AT91SAM7S256 AT91SAM7S256 2078
2069mendoza MACH_MENDOZA MENDOZA 2079
2070kira MACH_KIRA KIRA 2080
2071mx1hbm MACH_MX1HBM MX1HBM 2081
2072quatro43xx MACH_QUATRO43XX QUATRO43XX 2082
2073quatro4230 MACH_QUATRO4230 QUATRO4230 2083
2074nsb400 MACH_NSB400 NSB400 2084
2075drp255 MACH_DRP255 DRP255 2085
2076thoth MACH_THOTH THOTH 2086
2077firestone MACH_FIRESTONE FIRESTONE 2087
2078asusp750 MACH_ASUSP750 ASUSP750 2088
2079ctera_dl MACH_CTERA_DL CTERA_DL 2089
2080socr MACH_SOCR SOCR 2090
2081htcoxygen MACH_HTCOXYGEN HTCOXYGEN 2091
2082heroc MACH_HEROC HEROC 2092
2083zeno6800 MACH_ZENO6800 ZENO6800 2093
2084sc2mcs MACH_SC2MCS SC2MCS 2094
2085gene100 MACH_GENE100 GENE100 2095
2086as353x MACH_AS353X AS353X 2096
2087sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097
2088at91sam9g20 MACH_AT91SAM9G20 AT91SAM9G20 2098
2089mv88f6192gtw_fe MACH_MV88F6192GTW_FE MV88F6192GTW_FE 2099
2090cc9200 MACH_CC9200 CC9200 2100
2091sm9200 MACH_SM9200 SM9200 2101
2092tp9200 MACH_TP9200 TP9200 2102
2093snapperdv MACH_SNAPPERDV SNAPPERDV 2103
2094avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104
2095avengers_lite1 MACH_AVENGERS_LITE1 AVENGERS_LITE1 2105
2096omap3axon MACH_OMAP3AXON OMAP3AXON 2106
2097ma8xx MACH_MA8XX MA8XX 2107
2098mp201ek MACH_MP201EK MP201EK 2108
2099davinci_tux MACH_DAVINCI_TUX DAVINCI_TUX 2109
2100mpa1600 MACH_MPA1600 MPA1600 2110
2101pelco_troy MACH_PELCO_TROY PELCO_TROY 2111
2102nsb667 MACH_NSB667 NSB667 2112
2103rovers5_4mpix MACH_ROVERS5_4MPIX ROVERS5_4MPIX 2113
2104twocom MACH_TWOCOM TWOCOM 2114
2105ubisys_p9_rcu3r2 MACH_UBISYS_P9_RCU3R2 UBISYS_P9_RCU3R2 2115
2106hero_espresso MACH_HERO_ESPRESSO HERO_ESPRESSO 2116
2107afeusb MACH_AFEUSB AFEUSB 2117
2108t830 MACH_T830 T830 2118
2109spd8020_cc MACH_SPD8020_CC SPD8020_CC 2119
2110om_3d7k MACH_OM_3D7K OM_3D7K 2120
2111picocom2 MACH_PICOCOM2 PICOCOM2 2121
2112uwg4mx27 MACH_UWG4MX27 UWG4MX27 2122
2113uwg4mx31 MACH_UWG4MX31 UWG4MX31 2123
2114cherry MACH_CHERRY CHERRY 2124
2115mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125
2116s3c2440turkiye MACH_S3C2440TURKIYE S3C2440TURKIYE 2126
2117tx37 MACH_TX37 TX37 2127
2118sbc2800_9g20 MACH_SBC2800_9G20 SBC2800_9G20 2128
2119benzglb MACH_BENZGLB BENZGLB 2129
2120benztd MACH_BENZTD BENZTD 2130
2121cartesio_plus MACH_CARTESIO_PLUS CARTESIO_PLUS 2131
2122solrad_g20 MACH_SOLRAD_G20 SOLRAD_G20 2132
2123mx27wallace MACH_MX27WALLACE MX27WALLACE 2133
2124fmzwebmodul MACH_FMZWEBMODUL FMZWEBMODUL 2134
2125rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135
2126smallogger MACH_SMALLOGGER SMALLOGGER 2136
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index aafaf7a78886..cff8e84f78f2 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -116,6 +116,7 @@ struct atmel_nand_data {
116 int enable_pin; /* chip enable */ 116 int enable_pin; /* chip enable */
117 int det_pin; /* card detect */ 117 int det_pin; /* card detect */
118 int rdy_pin; /* ready/busy */ 118 int rdy_pin; /* ready/busy */
119 u8 rdy_pin_active_low; /* rdy_pin value is inverted */
119 u8 ale; /* address line number connected to ALE */ 120 u8 ale; /* address line number connected to ALE */
120 u8 cle; /* address line number connected to CLE */ 121 u8 cle; /* address line number connected to CLE */
121 u8 bus_width_16; /* buswidth is 16 bit */ 122 u8 bus_width_16; /* buswidth is 16 bit */
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 8f1f97d56e1e..0c1f86e3e44a 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -1129,6 +1129,7 @@ endchoice
1129 1129
1130config PM_WAKEUP_BY_GPIO 1130config PM_WAKEUP_BY_GPIO
1131 bool "Allow Wakeup from Standby by GPIO" 1131 bool "Allow Wakeup from Standby by GPIO"
1132 depends on PM && !BF54x
1132 1133
1133config PM_WAKEUP_GPIO_NUMBER 1134config PM_WAKEUP_GPIO_NUMBER
1134 int "GPIO number" 1135 int "GPIO number"
@@ -1168,6 +1169,12 @@ config PM_BFIN_WAKE_GP
1168 default n 1169 default n
1169 help 1170 help
1170 Enable General-Purpose Wake-Up (Voltage Regulator Power-Up) 1171 Enable General-Purpose Wake-Up (Voltage Regulator Power-Up)
1172 (all processors, except ADSP-BF549). This option sets
1173 the general-purpose wake-up enable (GPWE) control bit to enable
1174 wake-up upon detection of an active low signal on the /GPW (PH7) pin.
1175 On ADSP-BF549 this option enables the the same functionality on the
1176 /MRXON pin also PH7.
1177
1171endmenu 1178endmenu
1172 1179
1173menu "CPU Frequency scaling" 1180menu "CPU Frequency scaling"
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
index 5f981d9ca625..79e7e63ab709 100644
--- a/arch/blackfin/Kconfig.debug
+++ b/arch/blackfin/Kconfig.debug
@@ -21,12 +21,6 @@ config DEBUG_STACK_USAGE
21config HAVE_ARCH_KGDB 21config HAVE_ARCH_KGDB
22 def_bool y 22 def_bool y
23 23
24config KGDB_TESTCASE
25 tristate "KGDB: for test case in expect"
26 default n
27 help
28 This is a kgdb test case for automated testing.
29
30config DEBUG_VERBOSE 24config DEBUG_VERBOSE
31 bool "Verbose fault messages" 25 bool "Verbose fault messages"
32 default y 26 default y
diff --git a/arch/blackfin/configs/BF518F-EZBRD_defconfig b/arch/blackfin/configs/BF518F-EZBRD_defconfig
index 4fdb9e04759f..281f4b60e603 100644
--- a/arch/blackfin/configs/BF518F-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF518F-EZBRD_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc2 3# Linux kernel version: 2.6.28
4# Fri Jan 9 17:58:41 2009 4# Fri Feb 20 10:01:44 2009
5# 5#
6# CONFIG_MMU is not set 6# CONFIG_MMU is not set
7# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -133,10 +133,15 @@ CONFIG_BF518=y
133# CONFIG_BF538 is not set 133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set 134# CONFIG_BF539 is not set
135# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
136# CONFIG_BF542M is not set
136# CONFIG_BF544 is not set 137# CONFIG_BF544 is not set
138# CONFIG_BF544M is not set
137# CONFIG_BF547 is not set 139# CONFIG_BF547 is not set
140# CONFIG_BF547M is not set
138# CONFIG_BF548 is not set 141# CONFIG_BF548 is not set
142# CONFIG_BF548M is not set
139# CONFIG_BF549 is not set 143# CONFIG_BF549 is not set
144# CONFIG_BF549M is not set
140# CONFIG_BF561 is not set 145# CONFIG_BF561 is not set
141CONFIG_BF_REV_MIN=0 146CONFIG_BF_REV_MIN=0
142CONFIG_BF_REV_MAX=2 147CONFIG_BF_REV_MAX=2
@@ -426,7 +431,17 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
426# CONFIG_TIPC is not set 431# CONFIG_TIPC is not set
427# CONFIG_ATM is not set 432# CONFIG_ATM is not set
428# CONFIG_BRIDGE is not set 433# CONFIG_BRIDGE is not set
429# CONFIG_NET_DSA is not set 434CONFIG_NET_DSA=y
435# CONFIG_NET_DSA_TAG_DSA is not set
436# CONFIG_NET_DSA_TAG_EDSA is not set
437# CONFIG_NET_DSA_TAG_TRAILER is not set
438CONFIG_NET_DSA_TAG_STPID=y
439# CONFIG_NET_DSA_MV88E6XXX is not set
440# CONFIG_NET_DSA_MV88E6060 is not set
441# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set
442# CONFIG_NET_DSA_MV88E6131 is not set
443# CONFIG_NET_DSA_MV88E6123_61_65 is not set
444CONFIG_NET_DSA_KSZ8893M=y
430# CONFIG_VLAN_8021Q is not set 445# CONFIG_VLAN_8021Q is not set
431# CONFIG_DECNET is not set 446# CONFIG_DECNET is not set
432# CONFIG_LLC2 is not set 447# CONFIG_LLC2 is not set
@@ -529,6 +544,8 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
529# 544#
530# Self-contained MTD device drivers 545# Self-contained MTD device drivers
531# 546#
547# CONFIG_MTD_DATAFLASH is not set
548# CONFIG_MTD_M25P80 is not set
532# CONFIG_MTD_SLRAM is not set 549# CONFIG_MTD_SLRAM is not set
533# CONFIG_MTD_PHRAM is not set 550# CONFIG_MTD_PHRAM is not set
534# CONFIG_MTD_MTDRAM is not set 551# CONFIG_MTD_MTDRAM is not set
@@ -561,7 +578,9 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
561# CONFIG_BLK_DEV_HD is not set 578# CONFIG_BLK_DEV_HD is not set
562CONFIG_MISC_DEVICES=y 579CONFIG_MISC_DEVICES=y
563# CONFIG_EEPROM_93CX6 is not set 580# CONFIG_EEPROM_93CX6 is not set
581# CONFIG_ICS932S401 is not set
564# CONFIG_ENCLOSURE_SERVICES is not set 582# CONFIG_ENCLOSURE_SERVICES is not set
583# CONFIG_C2PORT is not set
565CONFIG_HAVE_IDE=y 584CONFIG_HAVE_IDE=y
566# CONFIG_IDE is not set 585# CONFIG_IDE is not set
567 586
@@ -607,6 +626,7 @@ CONFIG_BFIN_RX_DESC_NUM=20
607# CONFIG_SMC91X is not set 626# CONFIG_SMC91X is not set
608# CONFIG_SMSC911X is not set 627# CONFIG_SMSC911X is not set
609# CONFIG_DM9000 is not set 628# CONFIG_DM9000 is not set
629# CONFIG_ENC28J60 is not set
610# CONFIG_IBM_NEW_EMAC_ZMII is not set 630# CONFIG_IBM_NEW_EMAC_ZMII is not set
611# CONFIG_IBM_NEW_EMAC_RGMII is not set 631# CONFIG_IBM_NEW_EMAC_RGMII is not set
612# CONFIG_IBM_NEW_EMAC_TAH is not set 632# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -764,7 +784,23 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
764# CONFIG_I2C_DEBUG_ALGO is not set 784# CONFIG_I2C_DEBUG_ALGO is not set
765# CONFIG_I2C_DEBUG_BUS is not set 785# CONFIG_I2C_DEBUG_BUS is not set
766# CONFIG_I2C_DEBUG_CHIP is not set 786# CONFIG_I2C_DEBUG_CHIP is not set
767# CONFIG_SPI is not set 787CONFIG_SPI=y
788# CONFIG_SPI_DEBUG is not set
789CONFIG_SPI_MASTER=y
790
791#
792# SPI Master Controller Drivers
793#
794CONFIG_SPI_BFIN=y
795# CONFIG_SPI_BFIN_LOCK is not set
796# CONFIG_SPI_BITBANG is not set
797
798#
799# SPI Protocol Masters
800#
801# CONFIG_SPI_AT25 is not set
802# CONFIG_SPI_SPIDEV is not set
803# CONFIG_SPI_TLE62X0 is not set
768CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 804CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
769# CONFIG_GPIOLIB is not set 805# CONFIG_GPIOLIB is not set
770# CONFIG_W1 is not set 806# CONFIG_W1 is not set
@@ -788,8 +824,10 @@ CONFIG_BFIN_WDT=y
788# CONFIG_MFD_SM501 is not set 824# CONFIG_MFD_SM501 is not set
789# CONFIG_HTC_PASIC3 is not set 825# CONFIG_HTC_PASIC3 is not set
790# CONFIG_MFD_TMIO is not set 826# CONFIG_MFD_TMIO is not set
827# CONFIG_PMIC_DA903X is not set
791# CONFIG_MFD_WM8400 is not set 828# CONFIG_MFD_WM8400 is not set
792# CONFIG_MFD_WM8350_I2C is not set 829# CONFIG_MFD_WM8350_I2C is not set
830# CONFIG_REGULATOR is not set
793 831
794# 832#
795# Multimedia devices 833# Multimedia devices
@@ -861,10 +899,18 @@ CONFIG_RTC_INTF_DEV=y
861# CONFIG_RTC_DRV_M41T80 is not set 899# CONFIG_RTC_DRV_M41T80 is not set
862# CONFIG_RTC_DRV_S35390A is not set 900# CONFIG_RTC_DRV_S35390A is not set
863# CONFIG_RTC_DRV_FM3130 is not set 901# CONFIG_RTC_DRV_FM3130 is not set
902# CONFIG_RTC_DRV_RX8581 is not set
864 903
865# 904#
866# SPI RTC drivers 905# SPI RTC drivers
867# 906#
907# CONFIG_RTC_DRV_M41T94 is not set
908# CONFIG_RTC_DRV_DS1305 is not set
909# CONFIG_RTC_DRV_DS1390 is not set
910# CONFIG_RTC_DRV_MAX6902 is not set
911# CONFIG_RTC_DRV_R9701 is not set
912# CONFIG_RTC_DRV_RS5C348 is not set
913# CONFIG_RTC_DRV_DS3234 is not set
868 914
869# 915#
870# Platform RTC drivers 916# Platform RTC drivers
@@ -1062,12 +1108,20 @@ CONFIG_DEBUG_INFO=y
1062# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1108# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1063# CONFIG_FAULT_INJECTION is not set 1109# CONFIG_FAULT_INJECTION is not set
1064CONFIG_SYSCTL_SYSCALL_CHECK=y 1110CONFIG_SYSCTL_SYSCALL_CHECK=y
1111
1112#
1113# Tracers
1114#
1115# CONFIG_SCHED_TRACER is not set
1116# CONFIG_CONTEXT_SWITCH_TRACER is not set
1117# CONFIG_BOOT_TRACER is not set
1065# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 1118# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1066# CONFIG_SAMPLES is not set 1119# CONFIG_SAMPLES is not set
1067CONFIG_HAVE_ARCH_KGDB=y 1120CONFIG_HAVE_ARCH_KGDB=y
1068# CONFIG_KGDB is not set 1121# CONFIG_KGDB is not set
1069# CONFIG_DEBUG_STACKOVERFLOW is not set 1122# CONFIG_DEBUG_STACKOVERFLOW is not set
1070# CONFIG_DEBUG_STACK_USAGE is not set 1123# CONFIG_DEBUG_STACK_USAGE is not set
1124# CONFIG_KGDB_TESTCASE is not set
1071CONFIG_DEBUG_VERBOSE=y 1125CONFIG_DEBUG_VERBOSE=y
1072CONFIG_DEBUG_MMRS=y 1126CONFIG_DEBUG_MMRS=y
1073# CONFIG_DEBUG_HWERR is not set 1127# CONFIG_DEBUG_HWERR is not set
@@ -1100,6 +1154,7 @@ CONFIG_CRYPTO=y
1100# 1154#
1101# CONFIG_CRYPTO_FIPS is not set 1155# CONFIG_CRYPTO_FIPS is not set
1102# CONFIG_CRYPTO_MANAGER is not set 1156# CONFIG_CRYPTO_MANAGER is not set
1157# CONFIG_CRYPTO_MANAGER2 is not set
1103# CONFIG_CRYPTO_GF128MUL is not set 1158# CONFIG_CRYPTO_GF128MUL is not set
1104# CONFIG_CRYPTO_NULL is not set 1159# CONFIG_CRYPTO_NULL is not set
1105# CONFIG_CRYPTO_CRYPTD is not set 1160# CONFIG_CRYPTO_CRYPTD is not set
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 833128b39724..a50050f17706 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -327,8 +327,8 @@ CONFIG_BFIN_ICACHE=y
327CONFIG_BFIN_DCACHE=y 327CONFIG_BFIN_DCACHE=y
328# CONFIG_BFIN_DCACHE_BANKA is not set 328# CONFIG_BFIN_DCACHE_BANKA is not set
329# CONFIG_BFIN_ICACHE_LOCK is not set 329# CONFIG_BFIN_ICACHE_LOCK is not set
330# CONFIG_BFIN_WB is not set 330CONFIG_BFIN_WB=y
331CONFIG_BFIN_WT=y 331# CONFIG_BFIN_WT is not set
332# CONFIG_MPU is not set 332# CONFIG_MPU is not set
333 333
334# 334#
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 334c94b51c40..0a2a00d63887 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -290,8 +290,8 @@ CONFIG_BFIN_ICACHE=y
290CONFIG_BFIN_DCACHE=y 290CONFIG_BFIN_DCACHE=y
291# CONFIG_BFIN_DCACHE_BANKA is not set 291# CONFIG_BFIN_DCACHE_BANKA is not set
292# CONFIG_BFIN_ICACHE_LOCK is not set 292# CONFIG_BFIN_ICACHE_LOCK is not set
293# CONFIG_BFIN_WB is not set 293CONFIG_BFIN_WB=y
294CONFIG_BFIN_WT=y 294# CONFIG_BFIN_WT is not set
295# CONFIG_MPU is not set 295# CONFIG_MPU is not set
296 296
297# 297#
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 9d733436e300..eb027587a355 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -290,8 +290,8 @@ CONFIG_BFIN_ICACHE=y
290CONFIG_BFIN_DCACHE=y 290CONFIG_BFIN_DCACHE=y
291# CONFIG_BFIN_DCACHE_BANKA is not set 291# CONFIG_BFIN_DCACHE_BANKA is not set
292# CONFIG_BFIN_ICACHE_LOCK is not set 292# CONFIG_BFIN_ICACHE_LOCK is not set
293# CONFIG_BFIN_WB is not set 293CONFIG_BFIN_WB=y
294CONFIG_BFIN_WT=y 294# CONFIG_BFIN_WT is not set
295# CONFIG_MPU is not set 295# CONFIG_MPU is not set
296 296
297# 297#
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 4fb4108d3103..9e62b9f40eb1 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -298,8 +298,8 @@ CONFIG_BFIN_ICACHE=y
298CONFIG_BFIN_DCACHE=y 298CONFIG_BFIN_DCACHE=y
299# CONFIG_BFIN_DCACHE_BANKA is not set 299# CONFIG_BFIN_DCACHE_BANKA is not set
300# CONFIG_BFIN_ICACHE_LOCK is not set 300# CONFIG_BFIN_ICACHE_LOCK is not set
301# CONFIG_BFIN_WB is not set 301CONFIG_BFIN_WB=y
302CONFIG_BFIN_WT=y 302# CONFIG_BFIN_WT is not set
303# CONFIG_MPU is not set 303# CONFIG_MPU is not set
304 304
305# 305#
@@ -568,15 +568,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
568# CONFIG_MTD_DOC2000 is not set 568# CONFIG_MTD_DOC2000 is not set
569# CONFIG_MTD_DOC2001 is not set 569# CONFIG_MTD_DOC2001 is not set
570# CONFIG_MTD_DOC2001PLUS is not set 570# CONFIG_MTD_DOC2001PLUS is not set
571CONFIG_MTD_NAND=m 571# CONFIG_MTD_NAND is not set
572# CONFIG_MTD_NAND_VERIFY_WRITE is not set
573# CONFIG_MTD_NAND_ECC_SMC is not set
574# CONFIG_MTD_NAND_MUSEUM_IDS is not set
575# CONFIG_MTD_NAND_BFIN is not set
576CONFIG_MTD_NAND_IDS=m
577# CONFIG_MTD_NAND_DISKONCHIP is not set
578# CONFIG_MTD_NAND_NANDSIM is not set
579CONFIG_MTD_NAND_PLATFORM=m
580# CONFIG_MTD_ONENAND is not set 572# CONFIG_MTD_ONENAND is not set
581 573
582# 574#
diff --git a/arch/blackfin/configs/BF538-EZKIT_defconfig b/arch/blackfin/configs/BF538-EZKIT_defconfig
index cb32f5624a1b..dd6ad6be1c87 100644
--- a/arch/blackfin/configs/BF538-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF538-EZKIT_defconfig
@@ -306,8 +306,8 @@ CONFIG_BFIN_ICACHE=y
306CONFIG_BFIN_DCACHE=y 306CONFIG_BFIN_DCACHE=y
307# CONFIG_BFIN_DCACHE_BANKA is not set 307# CONFIG_BFIN_DCACHE_BANKA is not set
308# CONFIG_BFIN_ICACHE_LOCK is not set 308# CONFIG_BFIN_ICACHE_LOCK is not set
309# CONFIG_BFIN_WB is not set 309CONFIG_BFIN_WB=y
310CONFIG_BFIN_WT=y 310# CONFIG_BFIN_WT is not set
311# CONFIG_MPU is not set 311# CONFIG_MPU is not set
312 312
313# 313#
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 0f8697618aa5..6bc2fb1b2a70 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -361,8 +361,8 @@ CONFIG_BFIN_ICACHE=y
361CONFIG_BFIN_DCACHE=y 361CONFIG_BFIN_DCACHE=y
362# CONFIG_BFIN_DCACHE_BANKA is not set 362# CONFIG_BFIN_DCACHE_BANKA is not set
363# CONFIG_BFIN_ICACHE_LOCK is not set 363# CONFIG_BFIN_ICACHE_LOCK is not set
364# CONFIG_BFIN_WB is not set 364CONFIG_BFIN_WB=y
365CONFIG_BFIN_WT=y 365# CONFIG_BFIN_WT is not set
366# CONFIG_BFIN_L2_CACHEABLE is not set 366# CONFIG_BFIN_L2_CACHEABLE is not set
367# CONFIG_MPU is not set 367# CONFIG_MPU is not set
368 368
@@ -680,7 +680,7 @@ CONFIG_SCSI=y
680CONFIG_SCSI_DMA=y 680CONFIG_SCSI_DMA=y
681# CONFIG_SCSI_TGT is not set 681# CONFIG_SCSI_TGT is not set
682# CONFIG_SCSI_NETLINK is not set 682# CONFIG_SCSI_NETLINK is not set
683CONFIG_SCSI_PROC_FS=y 683# CONFIG_SCSI_PROC_FS is not set
684 684
685# 685#
686# SCSI support type (disk, tape, CD-ROM) 686# SCSI support type (disk, tape, CD-ROM)
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 042c7adfccfa..69714fb3e608 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -329,8 +329,8 @@ CONFIG_BFIN_ICACHE=y
329CONFIG_BFIN_DCACHE=y 329CONFIG_BFIN_DCACHE=y
330# CONFIG_BFIN_DCACHE_BANKA is not set 330# CONFIG_BFIN_DCACHE_BANKA is not set
331# CONFIG_BFIN_ICACHE_LOCK is not set 331# CONFIG_BFIN_ICACHE_LOCK is not set
332# CONFIG_BFIN_WB is not set 332CONFIG_BFIN_WB=y
333CONFIG_BFIN_WT=y 333# CONFIG_BFIN_WT is not set
334# CONFIG_BFIN_L2_CACHEABLE is not set 334# CONFIG_BFIN_L2_CACHEABLE is not set
335# CONFIG_MPU is not set 335# CONFIG_MPU is not set
336 336
diff --git a/arch/blackfin/configs/BlackStamp_defconfig b/arch/blackfin/configs/BlackStamp_defconfig
index 3a20e281d23c..017c6ea071b5 100644
--- a/arch/blackfin/configs/BlackStamp_defconfig
+++ b/arch/blackfin/configs/BlackStamp_defconfig
@@ -288,8 +288,8 @@ CONFIG_BFIN_ICACHE=y
288CONFIG_BFIN_DCACHE=y 288CONFIG_BFIN_DCACHE=y
289# CONFIG_BFIN_DCACHE_BANKA is not set 289# CONFIG_BFIN_DCACHE_BANKA is not set
290# CONFIG_BFIN_ICACHE_LOCK is not set 290# CONFIG_BFIN_ICACHE_LOCK is not set
291# CONFIG_BFIN_WB is not set 291CONFIG_BFIN_WB=y
292CONFIG_BFIN_WT=y 292# CONFIG_BFIN_WT is not set
293# CONFIG_MPU is not set 293# CONFIG_MPU is not set
294 294
295# 295#
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig
index 865ed85a5760..d880ef786770 100644
--- a/arch/blackfin/configs/CM-BF527_defconfig
+++ b/arch/blackfin/configs/CM-BF527_defconfig
@@ -332,8 +332,8 @@ CONFIG_BFIN_ICACHE=y
332CONFIG_BFIN_DCACHE=y 332CONFIG_BFIN_DCACHE=y
333# CONFIG_BFIN_DCACHE_BANKA is not set 333# CONFIG_BFIN_DCACHE_BANKA is not set
334# CONFIG_BFIN_ICACHE_LOCK is not set 334# CONFIG_BFIN_ICACHE_LOCK is not set
335# CONFIG_BFIN_WB is not set 335CONFIG_BFIN_WB=y
336CONFIG_BFIN_WT=y 336# CONFIG_BFIN_WT is not set
337# CONFIG_MPU is not set 337# CONFIG_MPU is not set
338 338
339# 339#
diff --git a/arch/blackfin/configs/CM-BF548_defconfig b/arch/blackfin/configs/CM-BF548_defconfig
index efe9741b1f14..f410430b4e3d 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -336,8 +336,8 @@ CONFIG_BFIN_ICACHE=y
336CONFIG_BFIN_DCACHE=y 336CONFIG_BFIN_DCACHE=y
337# CONFIG_BFIN_DCACHE_BANKA is not set 337# CONFIG_BFIN_DCACHE_BANKA is not set
338# CONFIG_BFIN_ICACHE_LOCK is not set 338# CONFIG_BFIN_ICACHE_LOCK is not set
339# CONFIG_BFIN_WB is not set 339CONFIG_BFIN_WB=y
340CONFIG_BFIN_WT=y 340# CONFIG_BFIN_WT is not set
341CONFIG_L1_MAX_PIECE=16 341CONFIG_L1_MAX_PIECE=16
342# CONFIG_MPU is not set 342# CONFIG_MPU is not set
343 343
@@ -595,7 +595,7 @@ CONFIG_SCSI=y
595CONFIG_SCSI_DMA=y 595CONFIG_SCSI_DMA=y
596# CONFIG_SCSI_TGT is not set 596# CONFIG_SCSI_TGT is not set
597# CONFIG_SCSI_NETLINK is not set 597# CONFIG_SCSI_NETLINK is not set
598CONFIG_SCSI_PROC_FS=y 598# CONFIG_SCSI_PROC_FS is not set
599 599
600# 600#
601# SCSI support type (disk, tape, CD-ROM) 601# SCSI support type (disk, tape, CD-ROM)
diff --git a/arch/blackfin/configs/IP0X_defconfig b/arch/blackfin/configs/IP0X_defconfig
index eae83b5de92f..7db93874c987 100644
--- a/arch/blackfin/configs/IP0X_defconfig
+++ b/arch/blackfin/configs/IP0X_defconfig
@@ -612,7 +612,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
612CONFIG_SCSI=y 612CONFIG_SCSI=y
613# CONFIG_SCSI_TGT is not set 613# CONFIG_SCSI_TGT is not set
614# CONFIG_SCSI_NETLINK is not set 614# CONFIG_SCSI_NETLINK is not set
615CONFIG_SCSI_PROC_FS=y 615# CONFIG_SCSI_PROC_FS is not set
616 616
617# 617#
618# SCSI support type (disk, tape, CD-ROM) 618# SCSI support type (disk, tape, CD-ROM)
diff --git a/arch/blackfin/configs/SRV1_defconfig b/arch/blackfin/configs/SRV1_defconfig
index fa580affc9d6..a46529c6ade3 100644
--- a/arch/blackfin/configs/SRV1_defconfig
+++ b/arch/blackfin/configs/SRV1_defconfig
@@ -282,8 +282,8 @@ CONFIG_BFIN_ICACHE=y
282CONFIG_BFIN_DCACHE=y 282CONFIG_BFIN_DCACHE=y
283# CONFIG_BFIN_DCACHE_BANKA is not set 283# CONFIG_BFIN_DCACHE_BANKA is not set
284# CONFIG_BFIN_ICACHE_LOCK is not set 284# CONFIG_BFIN_ICACHE_LOCK is not set
285# CONFIG_BFIN_WB is not set 285CONFIG_BFIN_WB=y
286CONFIG_BFIN_WT=y 286# CONFIG_BFIN_WT is not set
287CONFIG_L1_MAX_PIECE=16 287CONFIG_L1_MAX_PIECE=16
288 288
289# 289#
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 606ecfdcc962..09c31418cc08 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -1,3 +1,4 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += bfin_sport.h
3unifdef-y += fixed_code.h 4unifdef-y += fixed_code.h
diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h
index fe88a2c19213..65a651db5b07 100644
--- a/arch/blackfin/include/asm/bfin_sport.h
+++ b/arch/blackfin/include/asm/bfin_sport.h
@@ -1,30 +1,9 @@
1/* 1/*
2 * File: include/asm-blackfin/bfin_sport.h 2 * bfin_sport.h - userspace header for bfin sport driver
3 * Based on:
4 * Author: Roy Huang (roy.huang@analog.com)
5 * 3 *
6 * Created: Thu Aug. 24 2006 4 * Copyright 2004-2008 Analog Devices Inc.
7 * Description:
8 * 5 *
9 * Modified: 6 * Licensed under the GPL-2 or later.
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 7 */
29 8
30#ifndef __BFIN_SPORT_H__ 9#ifndef __BFIN_SPORT_H__
@@ -42,11 +21,10 @@
42#define NORM_FORMAT 0x0 21#define NORM_FORMAT 0x0
43#define ALAW_FORMAT 0x2 22#define ALAW_FORMAT 0x2
44#define ULAW_FORMAT 0x3 23#define ULAW_FORMAT 0x3
45struct sport_register;
46 24
47/* Function driver which use sport must initialize the structure */ 25/* Function driver which use sport must initialize the structure */
48struct sport_config { 26struct sport_config {
49 /*TDM (multichannels), I2S or other mode */ 27 /* TDM (multichannels), I2S or other mode */
50 unsigned int mode:3; 28 unsigned int mode:3;
51 29
52 /* if TDM mode is selected, channels must be set */ 30 /* if TDM mode is selected, channels must be set */
@@ -72,12 +50,18 @@ struct sport_config {
72 int serial_clk; 50 int serial_clk;
73 int fsync_clk; 51 int fsync_clk;
74 52
75 unsigned int data_format:2; /*Normal, u-law or a-law */ 53 unsigned int data_format:2; /* Normal, u-law or a-law */
76 54
77 int word_len; /* How length of the word in bits, 3-32 bits */ 55 int word_len; /* How length of the word in bits, 3-32 bits */
78 int dma_enabled; 56 int dma_enabled;
79}; 57};
80 58
59/* Userspace interface */
60#define SPORT_IOC_MAGIC 'P'
61#define SPORT_IOC_CONFIG _IOWR('P', 0x01, struct sport_config)
62
63#ifdef __KERNEL__
64
81struct sport_register { 65struct sport_register {
82 unsigned short tcr1; 66 unsigned short tcr1;
83 unsigned short reserved0; 67 unsigned short reserved0;
@@ -117,9 +101,6 @@ struct sport_register {
117 unsigned long mrcs3; 101 unsigned long mrcs3;
118}; 102};
119 103
120#define SPORT_IOC_MAGIC 'P'
121#define SPORT_IOC_CONFIG _IOWR('P', 0x01, struct sport_config)
122
123struct sport_dev { 104struct sport_dev {
124 struct cdev cdev; /* Char device structure */ 105 struct cdev cdev; /* Char device structure */
125 106
@@ -149,6 +130,8 @@ struct sport_dev {
149 struct sport_config config; 130 struct sport_config config;
150}; 131};
151 132
133#endif
134
152#define SPORT_TCR1 0 135#define SPORT_TCR1 0
153#define SPORT_TCR2 1 136#define SPORT_TCR2 1
154#define SPORT_TCLKDIV 2 137#define SPORT_TCLKDIV 2
@@ -169,4 +152,4 @@ struct sport_dev {
169#define SPORT_MRCS2 22 152#define SPORT_MRCS2 22
170#define SPORT_MRCS3 23 153#define SPORT_MRCS3 23
171 154
172#endif /*__BFIN_SPORT_H__*/ 155#endif
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index 76f53d8b9a0d..343b56361ec9 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -35,9 +35,9 @@
35#include <asm/atomic.h> 35#include <asm/atomic.h>
36#include <asm/traps.h> 36#include <asm/traps.h>
37 37
38#define IPIPE_ARCH_STRING "1.8-00" 38#define IPIPE_ARCH_STRING "1.9-00"
39#define IPIPE_MAJOR_NUMBER 1 39#define IPIPE_MAJOR_NUMBER 1
40#define IPIPE_MINOR_NUMBER 8 40#define IPIPE_MINOR_NUMBER 9
41#define IPIPE_PATCH_NUMBER 0 41#define IPIPE_PATCH_NUMBER 0
42 42
43#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
@@ -83,9 +83,9 @@ struct ipipe_sysinfo {
83 "%2 = CYCLES2\n" \ 83 "%2 = CYCLES2\n" \
84 "CC = %2 == %0\n" \ 84 "CC = %2 == %0\n" \
85 "if ! CC jump 1b\n" \ 85 "if ! CC jump 1b\n" \
86 : "=r" (((unsigned long *)&t)[1]), \ 86 : "=d,a" (((unsigned long *)&t)[1]), \
87 "=r" (((unsigned long *)&t)[0]), \ 87 "=d,a" (((unsigned long *)&t)[0]), \
88 "=r" (__cy2) \ 88 "=d,a" (__cy2) \
89 : /*no input*/ : "CC"); \ 89 : /*no input*/ : "CC"); \
90 t; \ 90 t; \
91 }) 91 })
@@ -118,35 +118,40 @@ void __ipipe_disable_irqdesc(struct ipipe_domain *ipd,
118 118
119#define __ipipe_disable_irq(irq) (irq_desc[irq].chip->mask(irq)) 119#define __ipipe_disable_irq(irq) (irq_desc[irq].chip->mask(irq))
120 120
121#define __ipipe_lock_root() \ 121static inline int __ipipe_check_tickdev(const char *devname)
122 set_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags) 122{
123 return 1;
124}
123 125
124#define __ipipe_unlock_root() \ 126static inline void __ipipe_lock_root(void)
125 clear_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags) 127{
128 set_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
129}
130
131static inline void __ipipe_unlock_root(void)
132{
133 clear_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
134}
126 135
127void __ipipe_enable_pipeline(void); 136void __ipipe_enable_pipeline(void);
128 137
129#define __ipipe_hook_critical_ipi(ipd) do { } while (0) 138#define __ipipe_hook_critical_ipi(ipd) do { } while (0)
130 139
131#define __ipipe_sync_pipeline(syncmask) \ 140#define __ipipe_sync_pipeline ___ipipe_sync_pipeline
132 do { \ 141void ___ipipe_sync_pipeline(unsigned long syncmask);
133 struct ipipe_domain *ipd = ipipe_current_domain; \
134 if (likely(ipd != ipipe_root_domain || !test_bit(IPIPE_ROOTLOCK_FLAG, &ipd->flags))) \
135 __ipipe_sync_stage(syncmask); \
136 } while (0)
137 142
138void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs); 143void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs);
139 144
140int __ipipe_get_irq_priority(unsigned irq); 145int __ipipe_get_irq_priority(unsigned irq);
141 146
142int __ipipe_get_irqthread_priority(unsigned irq);
143
144void __ipipe_stall_root_raw(void); 147void __ipipe_stall_root_raw(void);
145 148
146void __ipipe_unstall_root_raw(void); 149void __ipipe_unstall_root_raw(void);
147 150
148void __ipipe_serial_debug(const char *fmt, ...); 151void __ipipe_serial_debug(const char *fmt, ...);
149 152
153asmlinkage void __ipipe_call_irqtail(unsigned long addr);
154
150DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs); 155DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
151 156
152extern unsigned long __ipipe_core_clock; 157extern unsigned long __ipipe_core_clock;
@@ -162,42 +167,25 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
162 167
163#define __ipipe_run_irqtail() /* Must be a macro */ \ 168#define __ipipe_run_irqtail() /* Must be a macro */ \
164 do { \ 169 do { \
165 asmlinkage void __ipipe_call_irqtail(void); \
166 unsigned long __pending; \ 170 unsigned long __pending; \
167 CSYNC(); \ 171 CSYNC(); \
168 __pending = bfin_read_IPEND(); \ 172 __pending = bfin_read_IPEND(); \
169 if (__pending & 0x8000) { \ 173 if (__pending & 0x8000) { \
170 __pending &= ~0x8010; \ 174 __pending &= ~0x8010; \
171 if (__pending && (__pending & (__pending - 1)) == 0) \ 175 if (__pending && (__pending & (__pending - 1)) == 0) \
172 __ipipe_call_irqtail(); \ 176 __ipipe_call_irqtail(__ipipe_irq_tail_hook); \
173 } \ 177 } \
174 } while (0) 178 } while (0)
175 179
176#define __ipipe_run_isr(ipd, irq) \ 180#define __ipipe_run_isr(ipd, irq) \
177 do { \ 181 do { \
178 if (ipd == ipipe_root_domain) { \ 182 if (ipd == ipipe_root_domain) { \
179 /* \ 183 local_irq_enable_hw(); \
180 * Note: the I-pipe implements a threaded interrupt model on \ 184 if (ipipe_virtual_irq_p(irq)) \
181 * this arch for Linux external IRQs. The interrupt handler we \
182 * call here only wakes up the associated IRQ thread. \
183 */ \
184 if (ipipe_virtual_irq_p(irq)) { \
185 /* No irqtail here; virtual interrupts have no effect \
186 on IPEND so there is no need for processing \
187 deferral. */ \
188 local_irq_enable_nohead(ipd); \
189 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \ 185 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \
190 local_irq_disable_nohead(ipd); \ 186 else \
191 } else \
192 /* \
193 * No need to run the irqtail here either; \
194 * we can't be preempted by hw IRQs, so \
195 * non-Linux IRQs cannot stack over the short \
196 * thread wakeup code. Which in turn means \
197 * that no irqtail condition could be pending \
198 * for domains above Linux in the pipeline. \
199 */ \
200 ipd->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs)); \ 187 ipd->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs)); \
188 local_irq_disable_hw(); \
201 } else { \ 189 } else { \
202 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \ 190 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
203 local_irq_enable_nohead(ipd); \ 191 local_irq_enable_nohead(ipd); \
@@ -217,42 +205,24 @@ void ipipe_init_irq_threads(void);
217 205
218int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc); 206int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc);
219 207
220#define IS_SYSIRQ(irq) ((irq) > IRQ_CORETMR && (irq) <= SYS_IRQS) 208#ifdef CONFIG_GENERIC_CLOCKEVENTS
221#define IS_GPIOIRQ(irq) ((irq) >= GPIO_IRQ_BASE && (irq) < NR_IRQS) 209#define IRQ_SYSTMR IRQ_CORETMR
222 210#define IRQ_PRIOTMR IRQ_CORETMR
211#else
223#define IRQ_SYSTMR IRQ_TIMER0 212#define IRQ_SYSTMR IRQ_TIMER0
224#define IRQ_PRIOTMR CONFIG_IRQ_TIMER0 213#define IRQ_PRIOTMR CONFIG_IRQ_TIMER0
214#endif
225 215
226#if defined(CONFIG_BF531) || defined(CONFIG_BF532) || defined(CONFIG_BF533) 216#ifdef CONFIG_BF561
227#define PRIO_GPIODEMUX(irq) CONFIG_PFA
228#elif defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537)
229#define PRIO_GPIODEMUX(irq) CONFIG_IRQ_PROG_INTA
230#elif defined(CONFIG_BF52x)
231#define PRIO_GPIODEMUX(irq) ((irq) == IRQ_PORTF_INTA ? CONFIG_IRQ_PORTF_INTA : \
232 (irq) == IRQ_PORTG_INTA ? CONFIG_IRQ_PORTG_INTA : \
233 (irq) == IRQ_PORTH_INTA ? CONFIG_IRQ_PORTH_INTA : \
234 -1)
235#elif defined(CONFIG_BF561)
236#define PRIO_GPIODEMUX(irq) ((irq) == IRQ_PROG0_INTA ? CONFIG_IRQ_PROG0_INTA : \
237 (irq) == IRQ_PROG1_INTA ? CONFIG_IRQ_PROG1_INTA : \
238 (irq) == IRQ_PROG2_INTA ? CONFIG_IRQ_PROG2_INTA : \
239 -1)
240#define bfin_write_TIMER_DISABLE(val) bfin_write_TMRS8_DISABLE(val) 217#define bfin_write_TIMER_DISABLE(val) bfin_write_TMRS8_DISABLE(val)
241#define bfin_write_TIMER_ENABLE(val) bfin_write_TMRS8_ENABLE(val) 218#define bfin_write_TIMER_ENABLE(val) bfin_write_TMRS8_ENABLE(val)
242#define bfin_write_TIMER_STATUS(val) bfin_write_TMRS8_STATUS(val) 219#define bfin_write_TIMER_STATUS(val) bfin_write_TMRS8_STATUS(val)
243#define bfin_read_TIMER_STATUS() bfin_read_TMRS8_STATUS() 220#define bfin_read_TIMER_STATUS() bfin_read_TMRS8_STATUS()
244#elif defined(CONFIG_BF54x) 221#elif defined(CONFIG_BF54x)
245#define PRIO_GPIODEMUX(irq) ((irq) == IRQ_PINT0 ? CONFIG_IRQ_PINT0 : \
246 (irq) == IRQ_PINT1 ? CONFIG_IRQ_PINT1 : \
247 (irq) == IRQ_PINT2 ? CONFIG_IRQ_PINT2 : \
248 (irq) == IRQ_PINT3 ? CONFIG_IRQ_PINT3 : \
249 -1)
250#define bfin_write_TIMER_DISABLE(val) bfin_write_TIMER_DISABLE0(val) 222#define bfin_write_TIMER_DISABLE(val) bfin_write_TIMER_DISABLE0(val)
251#define bfin_write_TIMER_ENABLE(val) bfin_write_TIMER_ENABLE0(val) 223#define bfin_write_TIMER_ENABLE(val) bfin_write_TIMER_ENABLE0(val)
252#define bfin_write_TIMER_STATUS(val) bfin_write_TIMER_STATUS0(val) 224#define bfin_write_TIMER_STATUS(val) bfin_write_TIMER_STATUS0(val)
253#define bfin_read_TIMER_STATUS(val) bfin_read_TIMER_STATUS0(val) 225#define bfin_read_TIMER_STATUS(val) bfin_read_TIMER_STATUS0(val)
254#else
255# error "no PRIO_GPIODEMUX() for this part"
256#endif 226#endif
257 227
258#define __ipipe_root_tick_p(regs) ((regs->ipend & 0x10) != 0) 228#define __ipipe_root_tick_p(regs) ((regs->ipend & 0x10) != 0)
@@ -275,4 +245,6 @@ int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc);
275 245
276#endif /* !CONFIG_IPIPE */ 246#endif /* !CONFIG_IPIPE */
277 247
248#define ipipe_update_tick_evtdev(evtdev) do { } while (0)
249
278#endif /* !__ASM_BLACKFIN_IPIPE_H */ 250#endif /* !__ASM_BLACKFIN_IPIPE_H */
diff --git a/arch/blackfin/include/asm/ipipe_base.h b/arch/blackfin/include/asm/ipipe_base.h
index cb1025aeabcf..3e8acbd1a3be 100644
--- a/arch/blackfin/include/asm/ipipe_base.h
+++ b/arch/blackfin/include/asm/ipipe_base.h
@@ -1,5 +1,5 @@
1/* -*- linux-c -*- 1/* -*- linux-c -*-
2 * include/asm-blackfin/_baseipipe.h 2 * include/asm-blackfin/ipipe_base.h
3 * 3 *
4 * Copyright (C) 2007 Philippe Gerum. 4 * Copyright (C) 2007 Philippe Gerum.
5 * 5 *
@@ -27,8 +27,9 @@
27#define IPIPE_NR_XIRQS NR_IRQS 27#define IPIPE_NR_XIRQS NR_IRQS
28#define IPIPE_IRQ_ISHIFT 5 /* 2^5 for 32bits arch. */ 28#define IPIPE_IRQ_ISHIFT 5 /* 2^5 for 32bits arch. */
29 29
30/* Blackfin-specific, global domain flags */ 30/* Blackfin-specific, per-cpu pipeline status */
31#define IPIPE_ROOTLOCK_FLAG 1 /* Lock pipeline for root */ 31#define IPIPE_SYNCDEFER_FLAG 15
32#define IPIPE_SYNCDEFER_MASK (1L << IPIPE_SYNCDEFER_MASK)
32 33
33 /* Blackfin traps -- i.e. exception vector numbers */ 34 /* Blackfin traps -- i.e. exception vector numbers */
34#define IPIPE_NR_FAULTS 52 /* We leave a gap after VEC_ILL_RES. */ 35#define IPIPE_NR_FAULTS 52 /* We leave a gap after VEC_ILL_RES. */
@@ -48,11 +49,6 @@
48 49
49#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
50 51
51#include <linux/bitops.h>
52
53extern int test_bit(int nr, const void *addr);
54
55
56extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */ 52extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */
57 53
58static inline void __ipipe_stall_root(void) 54static inline void __ipipe_stall_root(void)
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h
index 3d977909ce7d..7645e85a5f6f 100644
--- a/arch/blackfin/include/asm/irq.h
+++ b/arch/blackfin/include/asm/irq.h
@@ -61,20 +61,38 @@ void __ipipe_restore_root(unsigned long flags);
61#define raw_irqs_disabled_flags(flags) (!irqs_enabled_from_flags_hw(flags)) 61#define raw_irqs_disabled_flags(flags) (!irqs_enabled_from_flags_hw(flags))
62#define local_test_iflag_hw(x) irqs_enabled_from_flags_hw(x) 62#define local_test_iflag_hw(x) irqs_enabled_from_flags_hw(x)
63 63
64#define local_save_flags(x) \ 64#define local_save_flags(x) \
65 do { \ 65 do { \
66 (x) = __ipipe_test_root() ? \ 66 (x) = __ipipe_test_root() ? \
67 __all_masked_irq_flags : bfin_irq_flags; \ 67 __all_masked_irq_flags : bfin_irq_flags; \
68 barrier(); \
68 } while (0) 69 } while (0)
69 70
70#define local_irq_save(x) \ 71#define local_irq_save(x) \
71 do { \ 72 do { \
72 (x) = __ipipe_test_and_stall_root(); \ 73 (x) = __ipipe_test_and_stall_root() ? \
74 __all_masked_irq_flags : bfin_irq_flags; \
75 barrier(); \
76 } while (0)
77
78static inline void local_irq_restore(unsigned long x)
79{
80 barrier();
81 __ipipe_restore_root(x == __all_masked_irq_flags);
82}
83
84#define local_irq_disable() \
85 do { \
86 __ipipe_stall_root(); \
87 barrier(); \
73 } while (0) 88 } while (0)
74 89
75#define local_irq_restore(x) __ipipe_restore_root(x) 90static inline void local_irq_enable(void)
76#define local_irq_disable() __ipipe_stall_root() 91{
77#define local_irq_enable() __ipipe_unstall_root() 92 barrier();
93 __ipipe_unstall_root();
94}
95
78#define irqs_disabled() __ipipe_test_root() 96#define irqs_disabled() __ipipe_test_root()
79 97
80#define local_save_flags_hw(x) \ 98#define local_save_flags_hw(x) \
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h
index e721ce55956c..2920087516f2 100644
--- a/arch/blackfin/include/asm/thread_info.h
+++ b/arch/blackfin/include/asm/thread_info.h
@@ -122,6 +122,7 @@ static inline struct thread_info *current_thread_info(void)
122#define TIF_MEMDIE 4 122#define TIF_MEMDIE 4
123#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ 123#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
124#define TIF_FREEZE 6 /* is freezing for suspend */ 124#define TIF_FREEZE 6 /* is freezing for suspend */
125#define TIF_IRQ_SYNC 7 /* sync pipeline stage */
125 126
126/* as above, but as bit values */ 127/* as above, but as bit values */
127#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 128#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -130,6 +131,7 @@ static inline struct thread_info *current_thread_info(void)
130#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
131#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 132#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
132#define _TIF_FREEZE (1<<TIF_FREEZE) 133#define _TIF_FREEZE (1<<TIF_FREEZE)
134#define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC)
133 135
134#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 136#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
135 137
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 4a92a86824b7..fd4d4328a0f2 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -15,13 +15,15 @@ else
15 obj-y += time.o 15 obj-y += time.o
16endif 16endif
17 17
18CFLAGS_kgdb_test.o := -mlong-calls -O0
19
20obj-$(CONFIG_IPIPE) += ipipe.o 18obj-$(CONFIG_IPIPE) += ipipe.o
21obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o 19obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o
22obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o 20obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o
23obj-$(CONFIG_CPLB_INFO) += cplbinfo.o 21obj-$(CONFIG_CPLB_INFO) += cplbinfo.o
24obj-$(CONFIG_MODULES) += module.o 22obj-$(CONFIG_MODULES) += module.o
25obj-$(CONFIG_KGDB) += kgdb.o 23obj-$(CONFIG_KGDB) += kgdb.o
26obj-$(CONFIG_KGDB_TESTCASE) += kgdb_test.o 24obj-$(CONFIG_KGDB_TESTS) += kgdb_test.o
27obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 25obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
26
27# the kgdb test puts code into L2 and without linker
28# relaxation, we need to force long calls to/from it
29CFLAGS_kgdb_test.o := -mlong-calls -O0
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 0e28f7595733..d6c067782e63 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -53,9 +53,13 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
53 53
54 i_d = i_i = 0; 54 i_d = i_i = 0;
55 55
56#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
56 /* Set up the zero page. */ 57 /* Set up the zero page. */
57 d_tbl[i_d].addr = 0; 58 d_tbl[i_d].addr = 0;
58 d_tbl[i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; 59 d_tbl[i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
60 i_tbl[i_i].addr = 0;
61 i_tbl[i_i++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
62#endif
59 63
60 /* Cover kernel memory with 4M pages. */ 64 /* Cover kernel memory with 4M pages. */
61 addr = 0; 65 addr = 0;
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
index 339be5a3ae6a..a5de8d45424c 100644
--- a/arch/blackfin/kernel/ipipe.c
+++ b/arch/blackfin/kernel/ipipe.c
@@ -35,14 +35,8 @@
35#include <asm/atomic.h> 35#include <asm/atomic.h>
36#include <asm/io.h> 36#include <asm/io.h>
37 37
38static int create_irq_threads;
39
40DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs); 38DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
41 39
42static DEFINE_PER_CPU(unsigned long, pending_irqthread_mask);
43
44static DEFINE_PER_CPU(int [IVG13 + 1], pending_irq_count);
45
46asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs); 40asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs);
47 41
48static void __ipipe_no_irqtail(void); 42static void __ipipe_no_irqtail(void);
@@ -93,6 +87,7 @@ void __ipipe_enable_pipeline(void)
93 */ 87 */
94void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs) 88void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs)
95{ 89{
90 struct ipipe_percpu_domain_data *p = ipipe_root_cpudom_ptr();
96 struct ipipe_domain *this_domain, *next_domain; 91 struct ipipe_domain *this_domain, *next_domain;
97 struct list_head *head, *pos; 92 struct list_head *head, *pos;
98 int m_ack, s = -1; 93 int m_ack, s = -1;
@@ -104,7 +99,6 @@ void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs)
104 * interrupt. 99 * interrupt.
105 */ 100 */
106 m_ack = (regs == NULL || irq == IRQ_SYSTMR || irq == IRQ_CORETMR); 101 m_ack = (regs == NULL || irq == IRQ_SYSTMR || irq == IRQ_CORETMR);
107
108 this_domain = ipipe_current_domain; 102 this_domain = ipipe_current_domain;
109 103
110 if (unlikely(test_bit(IPIPE_STICKY_FLAG, &this_domain->irqs[irq].control))) 104 if (unlikely(test_bit(IPIPE_STICKY_FLAG, &this_domain->irqs[irq].control)))
@@ -114,49 +108,28 @@ void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs)
114 next_domain = list_entry(head, struct ipipe_domain, p_link); 108 next_domain = list_entry(head, struct ipipe_domain, p_link);
115 if (likely(test_bit(IPIPE_WIRED_FLAG, &next_domain->irqs[irq].control))) { 109 if (likely(test_bit(IPIPE_WIRED_FLAG, &next_domain->irqs[irq].control))) {
116 if (!m_ack && next_domain->irqs[irq].acknowledge != NULL) 110 if (!m_ack && next_domain->irqs[irq].acknowledge != NULL)
117 next_domain->irqs[irq].acknowledge(irq, irq_desc + irq); 111 next_domain->irqs[irq].acknowledge(irq, irq_to_desc(irq));
118 if (test_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags)) 112 if (test_bit(IPIPE_SYNCDEFER_FLAG, &p->status))
119 s = __test_and_set_bit(IPIPE_STALL_FLAG, 113 s = __test_and_set_bit(IPIPE_STALL_FLAG, &p->status);
120 &ipipe_root_cpudom_var(status));
121 __ipipe_dispatch_wired(next_domain, irq); 114 __ipipe_dispatch_wired(next_domain, irq);
122 goto finalize; 115 goto out;
123 return;
124 } 116 }
125 } 117 }
126 118
127 /* Ack the interrupt. */ 119 /* Ack the interrupt. */
128 120
129 pos = head; 121 pos = head;
130
131 while (pos != &__ipipe_pipeline) { 122 while (pos != &__ipipe_pipeline) {
132 next_domain = list_entry(pos, struct ipipe_domain, p_link); 123 next_domain = list_entry(pos, struct ipipe_domain, p_link);
133 /*
134 * For each domain handling the incoming IRQ, mark it
135 * as pending in its log.
136 */
137 if (test_bit(IPIPE_HANDLE_FLAG, &next_domain->irqs[irq].control)) { 124 if (test_bit(IPIPE_HANDLE_FLAG, &next_domain->irqs[irq].control)) {
138 /*
139 * Domains that handle this IRQ are polled for
140 * acknowledging it by decreasing priority
141 * order. The interrupt must be made pending
142 * _first_ in the domain's status flags before
143 * the PIC is unlocked.
144 */
145 __ipipe_set_irq_pending(next_domain, irq); 125 __ipipe_set_irq_pending(next_domain, irq);
146
147 if (!m_ack && next_domain->irqs[irq].acknowledge != NULL) { 126 if (!m_ack && next_domain->irqs[irq].acknowledge != NULL) {
148 next_domain->irqs[irq].acknowledge(irq, irq_desc + irq); 127 next_domain->irqs[irq].acknowledge(irq, irq_to_desc(irq));
149 m_ack = 1; 128 m_ack = 1;
150 } 129 }
151 } 130 }
152
153 /*
154 * If the domain does not want the IRQ to be passed
155 * down the interrupt pipe, exit the loop now.
156 */
157 if (!test_bit(IPIPE_PASS_FLAG, &next_domain->irqs[irq].control)) 131 if (!test_bit(IPIPE_PASS_FLAG, &next_domain->irqs[irq].control))
158 break; 132 break;
159
160 pos = next_domain->p_link.next; 133 pos = next_domain->p_link.next;
161 } 134 }
162 135
@@ -166,18 +139,24 @@ void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs)
166 * immediately to the current domain if the interrupt has been 139 * immediately to the current domain if the interrupt has been
167 * marked as 'sticky'. This search does not go beyond the 140 * marked as 'sticky'. This search does not go beyond the
168 * current domain in the pipeline. We also enforce the 141 * current domain in the pipeline. We also enforce the
169 * additional root stage lock (blackfin-specific). */ 142 * additional root stage lock (blackfin-specific).
143 */
144 if (test_bit(IPIPE_SYNCDEFER_FLAG, &p->status))
145 s = __test_and_set_bit(IPIPE_STALL_FLAG, &p->status);
170 146
171 if (test_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags)) 147 /*
172 s = __test_and_set_bit(IPIPE_STALL_FLAG, 148 * If the interrupt preempted the head domain, then do not
173 &ipipe_root_cpudom_var(status)); 149 * even try to walk the pipeline, unless an interrupt is
174finalize: 150 * pending for it.
151 */
152 if (test_bit(IPIPE_AHEAD_FLAG, &this_domain->flags) &&
153 ipipe_head_cpudom_var(irqpend_himask) == 0)
154 goto out;
175 155
176 __ipipe_walk_pipeline(head); 156 __ipipe_walk_pipeline(head);
177 157out:
178 if (!s) 158 if (!s)
179 __clear_bit(IPIPE_STALL_FLAG, 159 __clear_bit(IPIPE_STALL_FLAG, &p->status);
180 &ipipe_root_cpudom_var(status));
181} 160}
182 161
183int __ipipe_check_root(void) 162int __ipipe_check_root(void)
@@ -187,7 +166,7 @@ int __ipipe_check_root(void)
187 166
188void __ipipe_enable_irqdesc(struct ipipe_domain *ipd, unsigned irq) 167void __ipipe_enable_irqdesc(struct ipipe_domain *ipd, unsigned irq)
189{ 168{
190 struct irq_desc *desc = irq_desc + irq; 169 struct irq_desc *desc = irq_to_desc(irq);
191 int prio = desc->ic_prio; 170 int prio = desc->ic_prio;
192 171
193 desc->depth = 0; 172 desc->depth = 0;
@@ -199,7 +178,7 @@ EXPORT_SYMBOL(__ipipe_enable_irqdesc);
199 178
200void __ipipe_disable_irqdesc(struct ipipe_domain *ipd, unsigned irq) 179void __ipipe_disable_irqdesc(struct ipipe_domain *ipd, unsigned irq)
201{ 180{
202 struct irq_desc *desc = irq_desc + irq; 181 struct irq_desc *desc = irq_to_desc(irq);
203 int prio = desc->ic_prio; 182 int prio = desc->ic_prio;
204 183
205 if (ipd != &ipipe_root && 184 if (ipd != &ipipe_root &&
@@ -236,15 +215,18 @@ int __ipipe_syscall_root(struct pt_regs *regs)
236{ 215{
237 unsigned long flags; 216 unsigned long flags;
238 217
239 /* We need to run the IRQ tail hook whenever we don't 218 /*
219 * We need to run the IRQ tail hook whenever we don't
240 * propagate a syscall to higher domains, because we know that 220 * propagate a syscall to higher domains, because we know that
241 * important operations might be pending there (e.g. Xenomai 221 * important operations might be pending there (e.g. Xenomai
242 * deferred rescheduling). */ 222 * deferred rescheduling).
223 */
243 224
244 if (!__ipipe_syscall_watched_p(current, regs->orig_p0)) { 225 if (regs->orig_p0 < NR_syscalls) {
245 void (*hook)(void) = (void (*)(void))__ipipe_irq_tail_hook; 226 void (*hook)(void) = (void (*)(void))__ipipe_irq_tail_hook;
246 hook(); 227 hook();
247 return 0; 228 if ((current->flags & PF_EVNOTIFY) == 0)
229 return 0;
248 } 230 }
249 231
250 /* 232 /*
@@ -312,112 +294,46 @@ int ipipe_trigger_irq(unsigned irq)
312{ 294{
313 unsigned long flags; 295 unsigned long flags;
314 296
297#ifdef CONFIG_IPIPE_DEBUG
315 if (irq >= IPIPE_NR_IRQS || 298 if (irq >= IPIPE_NR_IRQS ||
316 (ipipe_virtual_irq_p(irq) 299 (ipipe_virtual_irq_p(irq)
317 && !test_bit(irq - IPIPE_VIRQ_BASE, &__ipipe_virtual_irq_map))) 300 && !test_bit(irq - IPIPE_VIRQ_BASE, &__ipipe_virtual_irq_map)))
318 return -EINVAL; 301 return -EINVAL;
302#endif
319 303
320 local_irq_save_hw(flags); 304 local_irq_save_hw(flags);
321
322 __ipipe_handle_irq(irq, NULL); 305 __ipipe_handle_irq(irq, NULL);
323
324 local_irq_restore_hw(flags); 306 local_irq_restore_hw(flags);
325 307
326 return 1; 308 return 1;
327} 309}
328 310
329/* Move Linux IRQ to threads. */ 311asmlinkage void __ipipe_sync_root(void)
330
331static int do_irqd(void *__desc)
332{ 312{
333 struct irq_desc *desc = __desc; 313 unsigned long flags;
334 unsigned irq = desc - irq_desc;
335 int thrprio = desc->thr_prio;
336 int thrmask = 1 << thrprio;
337 int cpu = smp_processor_id();
338 cpumask_t cpumask;
339
340 sigfillset(&current->blocked);
341 current->flags |= PF_NOFREEZE;
342 cpumask = cpumask_of_cpu(cpu);
343 set_cpus_allowed(current, cpumask);
344 ipipe_setscheduler_root(current, SCHED_FIFO, 50 + thrprio);
345
346 while (!kthread_should_stop()) {
347 local_irq_disable();
348 if (!(desc->status & IRQ_SCHEDULED)) {
349 set_current_state(TASK_INTERRUPTIBLE);
350resched:
351 local_irq_enable();
352 schedule();
353 local_irq_disable();
354 }
355 __set_current_state(TASK_RUNNING);
356 /*
357 * If higher priority interrupt servers are ready to
358 * run, reschedule immediately. We need this for the
359 * GPIO demux IRQ handler to unmask the interrupt line
360 * _last_, after all GPIO IRQs have run.
361 */
362 if (per_cpu(pending_irqthread_mask, cpu) & ~(thrmask|(thrmask-1)))
363 goto resched;
364 if (--per_cpu(pending_irq_count[thrprio], cpu) == 0)
365 per_cpu(pending_irqthread_mask, cpu) &= ~thrmask;
366 desc->status &= ~IRQ_SCHEDULED;
367 desc->thr_handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs));
368 local_irq_enable();
369 }
370 __set_current_state(TASK_RUNNING);
371 return 0;
372}
373 314
374static void kick_irqd(unsigned irq, void *cookie) 315 BUG_ON(irqs_disabled());
375{
376 struct irq_desc *desc = irq_desc + irq;
377 int thrprio = desc->thr_prio;
378 int thrmask = 1 << thrprio;
379 int cpu = smp_processor_id();
380
381 if (!(desc->status & IRQ_SCHEDULED)) {
382 desc->status |= IRQ_SCHEDULED;
383 per_cpu(pending_irqthread_mask, cpu) |= thrmask;
384 ++per_cpu(pending_irq_count[thrprio], cpu);
385 wake_up_process(desc->thread);
386 }
387}
388 316
389int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc) 317 local_irq_save_hw(flags);
390{
391 if (desc->thread || !create_irq_threads)
392 return 0;
393
394 desc->thread = kthread_create(do_irqd, desc, "IRQ %d", irq);
395 if (desc->thread == NULL) {
396 printk(KERN_ERR "irqd: could not create IRQ thread %d!\n", irq);
397 return -ENOMEM;
398 }
399 318
400 wake_up_process(desc->thread); 319 clear_thread_flag(TIF_IRQ_SYNC);
401 320
402 desc->thr_handler = ipipe_root_domain->irqs[irq].handler; 321 if (ipipe_root_cpudom_var(irqpend_himask) != 0)
403 ipipe_root_domain->irqs[irq].handler = &kick_irqd; 322 __ipipe_sync_pipeline(IPIPE_IRQMASK_ANY);
404 323
405 return 0; 324 local_irq_restore_hw(flags);
406} 325}
407 326
408void __init ipipe_init_irq_threads(void) 327void ___ipipe_sync_pipeline(unsigned long syncmask)
409{ 328{
410 unsigned irq; 329 struct ipipe_domain *ipd = ipipe_current_domain;
411 struct irq_desc *desc;
412
413 create_irq_threads = 1;
414 330
415 for (irq = 0; irq < NR_IRQS; irq++) { 331 if (ipd == ipipe_root_domain) {
416 desc = irq_desc + irq; 332 if (test_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status)))
417 if (desc->action != NULL || 333 return;
418 (desc->status & IRQ_NOREQUEST) != 0)
419 ipipe_start_irq_thread(irq, desc);
420 } 334 }
335
336 __ipipe_sync_stage(syncmask);
421} 337}
422 338
423EXPORT_SYMBOL(show_stack); 339EXPORT_SYMBOL(show_stack);
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index 2d395c9005c5..bd052a67032e 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -144,11 +144,15 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
144#endif 144#endif
145 generic_handle_irq(irq); 145 generic_handle_irq(irq);
146 146
147#ifndef CONFIG_IPIPE /* Useless and bugous over the I-pipe: IRQs are threaded. */ 147#ifndef CONFIG_IPIPE
148 /* If we're the only interrupt running (ignoring IRQ15 which is for 148 /*
149 syscalls), lower our priority to IRQ14 so that softirqs run at 149 * If we're the only interrupt running (ignoring IRQ15 which
150 that level. If there's another, lower-level interrupt, irq_exit 150 * is for syscalls), lower our priority to IRQ14 so that
151 will defer softirqs to that. */ 151 * softirqs run at that level. If there's another,
152 * lower-level interrupt, irq_exit will defer softirqs to
153 * that. If the interrupt pipeline is enabled, we are already
154 * running at IRQ14 priority, so we don't need this code.
155 */
152 CSYNC(); 156 CSYNC();
153 pending = bfin_read_IPEND() & ~0x8000; 157 pending = bfin_read_IPEND() & ~0x8000;
154 other_ints = pending & (pending - 1); 158 other_ints = pending & (pending - 1);
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
index 3dba9c17304a..dbcf3e45cb0b 100644
--- a/arch/blackfin/kernel/kgdb_test.c
+++ b/arch/blackfin/kernel/kgdb_test.c
@@ -20,6 +20,7 @@
20static char cmdline[256]; 20static char cmdline[256];
21static unsigned long len; 21static unsigned long len;
22 22
23#ifndef CONFIG_SMP
23static int num1 __attribute__((l1_data)); 24static int num1 __attribute__((l1_data));
24 25
25void kgdb_l1_test(void) __attribute__((l1_text)); 26void kgdb_l1_test(void) __attribute__((l1_text));
@@ -32,6 +33,8 @@ void kgdb_l1_test(void)
32 printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1); 33 printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
33 return ; 34 return ;
34} 35}
36#endif
37
35#if L2_LENGTH 38#if L2_LENGTH
36 39
37static int num2 __attribute__((l2)); 40static int num2 __attribute__((l2));
@@ -59,10 +62,12 @@ int kgdb_test(char *name, int len, int count, int z)
59static int test_proc_output(char *buf) 62static int test_proc_output(char *buf)
60{ 63{
61 kgdb_test("hello world!", 12, 0x55, 0x10); 64 kgdb_test("hello world!", 12, 0x55, 0x10);
65#ifndef CONFIG_SMP
62 kgdb_l1_test(); 66 kgdb_l1_test();
63 #if L2_LENGTH 67#endif
68#if L2_LENGTH
64 kgdb_l2_test(); 69 kgdb_l2_test();
65 #endif 70#endif
66 71
67 return 0; 72 return 0;
68} 73}
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 594e325b40e4..d76618db50df 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -45,6 +45,7 @@
45#include <asm/asm-offsets.h> 45#include <asm/asm-offsets.h>
46#include <asm/dma.h> 46#include <asm/dma.h>
47#include <asm/fixed_code.h> 47#include <asm/fixed_code.h>
48#include <asm/cacheflush.h>
48#include <asm/mem_map.h> 49#include <asm/mem_map.h>
49 50
50#define TEXT_OFFSET 0 51#define TEXT_OFFSET 0
@@ -240,7 +241,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
240 241
241 } else if (addr >= FIXED_CODE_START 242 } else if (addr >= FIXED_CODE_START
242 && addr + sizeof(tmp) <= FIXED_CODE_END) { 243 && addr + sizeof(tmp) <= FIXED_CODE_END) {
243 memcpy(&tmp, (const void *)(addr), sizeof(tmp)); 244 copy_from_user_page(0, 0, 0, &tmp, (const void *)(addr), sizeof(tmp));
244 copied = sizeof(tmp); 245 copied = sizeof(tmp);
245 246
246 } else 247 } else
@@ -320,7 +321,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
320 321
321 } else if (addr >= FIXED_CODE_START 322 } else if (addr >= FIXED_CODE_START
322 && addr + sizeof(data) <= FIXED_CODE_END) { 323 && addr + sizeof(data) <= FIXED_CODE_END) {
323 memcpy((void *)(addr), &data, sizeof(data)); 324 copy_to_user_page(0, 0, 0, (void *)(addr), &data, sizeof(data));
324 copied = sizeof(data); 325 copied = sizeof(data);
325 326
326 } else 327 } else
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index e5c116230800..a58687bdee6a 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -889,6 +889,10 @@ void __init setup_arch(char **cmdline_p)
889 CPU, bfin_revid()); 889 CPU, bfin_revid());
890 } 890 }
891 891
892 /* We can't run on BF548-0.1 due to ANOMALY 05000448 */
893 if (bfin_cpuid() == 0x27de && bfin_revid() == 1)
894 panic("You can't run on this processor due to 05000448\n");
895
892 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); 896 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
893 897
894 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", 898 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
@@ -1141,12 +1145,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1141 icache_size = 0; 1145 icache_size = 0;
1142 1146
1143 seq_printf(m, "cache size\t: %d KB(L1 icache) " 1147 seq_printf(m, "cache size\t: %d KB(L1 icache) "
1144 "%d KB(L1 dcache-%s) %d KB(L2 cache)\n", 1148 "%d KB(L1 dcache%s) %d KB(L2 cache)\n",
1145 icache_size, dcache_size, 1149 icache_size, dcache_size,
1146#if defined CONFIG_BFIN_WB 1150#if defined CONFIG_BFIN_WB
1147 "wb" 1151 "-wb"
1148#elif defined CONFIG_BFIN_WT 1152#elif defined CONFIG_BFIN_WT
1149 "wt" 1153 "-wt"
1150#endif 1154#endif
1151 "", 0); 1155 "", 0);
1152 1156
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index 172b4c588467..1bbacfbd4c5d 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -134,7 +134,10 @@ irqreturn_t timer_interrupt(int irq, void *dummy)
134 134
135 write_seqlock(&xtime_lock); 135 write_seqlock(&xtime_lock);
136#if defined(CONFIG_TICK_SOURCE_SYSTMR0) && !defined(CONFIG_IPIPE) 136#if defined(CONFIG_TICK_SOURCE_SYSTMR0) && !defined(CONFIG_IPIPE)
137/* FIXME: Here TIMIL0 is not set when IPIPE enabled, why? */ 137 /*
138 * TIMIL0 is latched in __ipipe_grab_irq() when the I-Pipe is
139 * enabled.
140 */
138 if (get_gptimer_status(0) & TIMER_STATUS_TIMIL0) { 141 if (get_gptimer_status(0) & TIMER_STATUS_TIMIL0) {
139#endif 142#endif
140 do_timer(1); 143 do_timer(1);
diff --git a/arch/blackfin/mach-bf518/boards/ezbrd.c b/arch/blackfin/mach-bf518/boards/ezbrd.c
index 0e175342112e..41f2eacfef20 100644
--- a/arch/blackfin/mach-bf518/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf518/boards/ezbrd.c
@@ -113,7 +113,6 @@ static struct platform_device bfin_mac_device = {
113 .name = "bfin_mac", 113 .name = "bfin_mac",
114 .dev.platform_data = &bfin_mii_bus, 114 .dev.platform_data = &bfin_mii_bus,
115}; 115};
116#endif
117 116
118#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) 117#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
119static struct dsa_platform_data ksz8893m_switch_data = { 118static struct dsa_platform_data ksz8893m_switch_data = {
@@ -132,6 +131,7 @@ static struct platform_device ksz8893m_switch_device = {
132 .dev.platform_data = &ksz8893m_switch_data, 131 .dev.platform_data = &ksz8893m_switch_data,
133}; 132};
134#endif 133#endif
134#endif
135 135
136#if defined(CONFIG_MTD_M25P80) \ 136#if defined(CONFIG_MTD_M25P80) \
137 || defined(CONFIG_MTD_M25P80_MODULE) 137 || defined(CONFIG_MTD_M25P80_MODULE)
@@ -171,6 +171,7 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
171}; 171};
172#endif 172#endif
173 173
174#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
174#if defined(CONFIG_NET_DSA_KSZ8893M) \ 175#if defined(CONFIG_NET_DSA_KSZ8893M) \
175 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) 176 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
176/* SPI SWITCH CHIP */ 177/* SPI SWITCH CHIP */
@@ -179,10 +180,11 @@ static struct bfin5xx_spi_chip spi_switch_info = {
179 .bits_per_word = 8, 180 .bits_per_word = 8,
180}; 181};
181#endif 182#endif
183#endif
182 184
183#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 185#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
184static struct bfin5xx_spi_chip spi_mmc_chip_info = { 186static struct bfin5xx_spi_chip mmc_spi_chip_info = {
185 .enable_dma = 1, 187 .enable_dma = 0,
186 .bits_per_word = 8, 188 .bits_per_word = 8,
187}; 189};
188#endif 190#endif
@@ -259,6 +261,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
259 }, 261 },
260#endif 262#endif
261 263
264#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
262#if defined(CONFIG_NET_DSA_KSZ8893M) \ 265#if defined(CONFIG_NET_DSA_KSZ8893M) \
263 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) 266 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
264 { 267 {
@@ -271,24 +274,15 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
271 .mode = SPI_MODE_3, 274 .mode = SPI_MODE_3,
272 }, 275 },
273#endif 276#endif
277#endif
274 278
275#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 279#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
276 { 280 {
277 .modalias = "spi_mmc_dummy", 281 .modalias = "mmc_spi",
278 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 282 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
279 .bus_num = 0, 283 .bus_num = 0,
280 .chip_select = 0, 284 .chip_select = 5,
281 .platform_data = NULL, 285 .controller_data = &mmc_spi_chip_info,
282 .controller_data = &spi_mmc_chip_info,
283 .mode = SPI_MODE_3,
284 },
285 {
286 .modalias = "spi_mmc",
287 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
288 .bus_num = 0,
289 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
290 .platform_data = NULL,
291 .controller_data = &spi_mmc_chip_info,
292 .mode = SPI_MODE_3, 286 .mode = SPI_MODE_3,
293 }, 287 },
294#endif 288#endif
@@ -630,11 +624,10 @@ static struct platform_device *stamp_devices[] __initdata = {
630#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 624#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
631 &bfin_mii_bus, 625 &bfin_mii_bus,
632 &bfin_mac_device, 626 &bfin_mac_device,
633#endif
634
635#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) 627#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
636 &ksz8893m_switch_device, 628 &ksz8893m_switch_device,
637#endif 629#endif
630#endif
638 631
639#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 632#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
640 &bfin_spi0_device, 633 &bfin_spi0_device,
diff --git a/arch/blackfin/mach-bf518/include/mach/anomaly.h b/arch/blackfin/mach-bf518/include/mach/anomaly.h
index e5b4bef0edae..c847bb101076 100644
--- a/arch/blackfin/mach-bf518/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf518/include/mach/anomaly.h
@@ -2,12 +2,12 @@
2 * File: include/asm-blackfin/mach-bf518/anomaly.h 2 * File: include/asm-blackfin/mach-bf518/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
9/* This file shoule be up to date with: 9/* This file shoule be up to date with:
10 * - ???? 10 * - Revision B, 02/03/2009; ADSP-BF512/BF514/BF516/BF518 Blackfin Processor Anomaly List
11 */ 11 */
12 12
13#ifndef _MACH_ANOMALY_H_ 13#ifndef _MACH_ANOMALY_H_
@@ -19,6 +19,8 @@
19#define ANOMALY_05000122 (1) 19#define ANOMALY_05000122 (1)
20/* False Hardware Error from an Access in the Shadow of a Conditional Branch */ 20/* False Hardware Error from an Access in the Shadow of a Conditional Branch */
21#define ANOMALY_05000245 (1) 21#define ANOMALY_05000245 (1)
22/* Incorrect Timer Pulse Width in Single-Shot PWM_OUT Mode with External Clock */
23#define ANOMALY_05000254 (1)
22/* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */ 24/* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */
23#define ANOMALY_05000265 (1) 25#define ANOMALY_05000265 (1)
24/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */ 26/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */
@@ -53,6 +55,12 @@
53#define ANOMALY_05000443 (1) 55#define ANOMALY_05000443 (1)
54/* Incorrect L1 Instruction Bank B Memory Map Location */ 56/* Incorrect L1 Instruction Bank B Memory Map Location */
55#define ANOMALY_05000444 (1) 57#define ANOMALY_05000444 (1)
58/* Incorrect Default Hysteresis Setting for RESET, NMI, and BMODE Signals */
59#define ANOMALY_05000452 (1)
60/* PWM_TRIPB Signal Not Available on PG10 */
61#define ANOMALY_05000453 (1)
62/* PPI_FS3 is Driven One Half Cycle Later Than PPI Data */
63#define ANOMALY_05000455 (1)
56 64
57/* Anomalies that don't exist on this proc */ 65/* Anomalies that don't exist on this proc */
58#define ANOMALY_05000125 (0) 66#define ANOMALY_05000125 (0)
@@ -65,15 +73,20 @@
65#define ANOMALY_05000263 (0) 73#define ANOMALY_05000263 (0)
66#define ANOMALY_05000266 (0) 74#define ANOMALY_05000266 (0)
67#define ANOMALY_05000273 (0) 75#define ANOMALY_05000273 (0)
76#define ANOMALY_05000278 (0)
68#define ANOMALY_05000285 (0) 77#define ANOMALY_05000285 (0)
78#define ANOMALY_05000305 (0)
69#define ANOMALY_05000307 (0) 79#define ANOMALY_05000307 (0)
70#define ANOMALY_05000311 (0) 80#define ANOMALY_05000311 (0)
71#define ANOMALY_05000312 (0) 81#define ANOMALY_05000312 (0)
72#define ANOMALY_05000323 (0) 82#define ANOMALY_05000323 (0)
73#define ANOMALY_05000353 (0) 83#define ANOMALY_05000353 (0)
74#define ANOMALY_05000363 (0) 84#define ANOMALY_05000363 (0)
85#define ANOMALY_05000380 (0)
75#define ANOMALY_05000386 (0) 86#define ANOMALY_05000386 (0)
76#define ANOMALY_05000412 (0) 87#define ANOMALY_05000412 (0)
77#define ANOMALY_05000432 (0) 88#define ANOMALY_05000432 (0)
89#define ANOMALY_05000447 (0)
90#define ANOMALY_05000448 (0)
78 91
79#endif 92#endif
diff --git a/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
index b50a63b975a2..e21c1c3e4ec7 100644
--- a/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
@@ -144,7 +144,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
144 CH_UART0_TX, 144 CH_UART0_TX,
145 CH_UART0_RX, 145 CH_UART0_RX,
146#endif 146#endif
147#ifdef CONFIG_BFIN_UART0_CTSRTS 147#ifdef CONFIG_SERIAL_BFIN_CTSRTS
148 CONFIG_UART0_CTS_PIN, 148 CONFIG_UART0_CTS_PIN,
149 CONFIG_UART0_RTS_PIN, 149 CONFIG_UART0_RTS_PIN,
150#endif 150#endif
@@ -158,7 +158,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
158 CH_UART1_TX, 158 CH_UART1_TX,
159 CH_UART1_RX, 159 CH_UART1_RX,
160#endif 160#endif
161#ifdef CONFIG_BFIN_UART1_CTSRTS 161#ifdef CONFIG_SERIAL_BFIN_CTSRTS
162 CONFIG_UART1_CTS_PIN, 162 CONFIG_UART1_CTS_PIN,
163 CONFIG_UART1_RTS_PIN, 163 CONFIG_UART1_RTS_PIN,
164#endif 164#endif
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index 856c097b5317..48e69eecdba4 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -487,9 +487,9 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
487}; 487};
488#endif 488#endif
489 489
490#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 490#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
491static struct bfin5xx_spi_chip spi_mmc_chip_info = { 491static struct bfin5xx_spi_chip mmc_spi_chip_info = {
492 .enable_dma = 1, 492 .enable_dma = 0,
493 .bits_per_word = 8, 493 .bits_per_word = 8,
494}; 494};
495#endif 495#endif
@@ -585,23 +585,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
585 .controller_data = &ad9960_spi_chip_info, 585 .controller_data = &ad9960_spi_chip_info,
586 }, 586 },
587#endif 587#endif
588#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 588#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
589 { 589 {
590 .modalias = "spi_mmc_dummy", 590 .modalias = "mmc_spi",
591 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 591 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
592 .bus_num = 0,
593 .chip_select = 0,
594 .platform_data = NULL,
595 .controller_data = &spi_mmc_chip_info,
596 .mode = SPI_MODE_3,
597 },
598 {
599 .modalias = "spi_mmc",
600 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
601 .bus_num = 0, 592 .bus_num = 0,
602 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 593 .chip_select = 5,
603 .platform_data = NULL, 594 .controller_data = &mmc_spi_chip_info,
604 .controller_data = &spi_mmc_chip_info,
605 .mode = SPI_MODE_3, 595 .mode = SPI_MODE_3,
606 }, 596 },
607#endif 597#endif
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c
index 83606fcdde27..7fe480e4ebe8 100644
--- a/arch/blackfin/mach-bf527/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf527/boards/ezbrd.c
@@ -256,9 +256,9 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
256}; 256};
257#endif 257#endif
258 258
259#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 259#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
260static struct bfin5xx_spi_chip spi_mmc_chip_info = { 260static struct bfin5xx_spi_chip mmc_spi_chip_info = {
261 .enable_dma = 1, 261 .enable_dma = 0,
262 .bits_per_word = 8, 262 .bits_per_word = 8,
263}; 263};
264#endif 264#endif
@@ -366,23 +366,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
366 }, 366 },
367#endif 367#endif
368 368
369#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 369#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
370 { 370 {
371 .modalias = "spi_mmc_dummy", 371 .modalias = "mmc_spi",
372 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 372 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
373 .bus_num = 0, 373 .bus_num = 0,
374 .chip_select = 0, 374 .chip_select = 5,
375 .platform_data = NULL, 375 .controller_data = &mmc_spi_chip_info,
376 .controller_data = &spi_mmc_chip_info,
377 .mode = SPI_MODE_3,
378 },
379 {
380 .modalias = "spi_mmc",
381 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
382 .bus_num = 0,
383 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
384 .platform_data = NULL,
385 .controller_data = &spi_mmc_chip_info,
386 .mode = SPI_MODE_3, 376 .mode = SPI_MODE_3,
387 }, 377 },
388#endif 378#endif
diff --git a/arch/blackfin/mach-bf527/include/mach/anomaly.h b/arch/blackfin/mach-bf527/include/mach/anomaly.h
index 035e8d835058..df6808d8a6ef 100644
--- a/arch/blackfin/mach-bf527/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf527/include/mach/anomaly.h
@@ -2,7 +2,7 @@
2 * File: include/asm-blackfin/mach-bf527/anomaly.h 2 * File: include/asm-blackfin/mach-bf527/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -167,12 +167,16 @@
167#define ANOMALY_05000263 (0) 167#define ANOMALY_05000263 (0)
168#define ANOMALY_05000266 (0) 168#define ANOMALY_05000266 (0)
169#define ANOMALY_05000273 (0) 169#define ANOMALY_05000273 (0)
170#define ANOMALY_05000278 (0)
170#define ANOMALY_05000285 (0) 171#define ANOMALY_05000285 (0)
172#define ANOMALY_05000305 (0)
171#define ANOMALY_05000307 (0) 173#define ANOMALY_05000307 (0)
172#define ANOMALY_05000311 (0) 174#define ANOMALY_05000311 (0)
173#define ANOMALY_05000312 (0) 175#define ANOMALY_05000312 (0)
174#define ANOMALY_05000323 (0) 176#define ANOMALY_05000323 (0)
175#define ANOMALY_05000363 (0) 177#define ANOMALY_05000363 (0)
176#define ANOMALY_05000412 (0) 178#define ANOMALY_05000412 (0)
179#define ANOMALY_05000447 (0)
180#define ANOMALY_05000448 (0)
177 181
178#endif 182#endif
diff --git a/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
index 75722d6008b0..e8c41fd842b5 100644
--- a/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
@@ -144,7 +144,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
144 CH_UART0_TX, 144 CH_UART0_TX,
145 CH_UART0_RX, 145 CH_UART0_RX,
146#endif 146#endif
147#ifdef CONFIG_BFIN_UART0_CTSRTS 147#ifdef CONFIG_SERIAL_BFIN_CTSRTS
148 CONFIG_UART0_CTS_PIN, 148 CONFIG_UART0_CTS_PIN,
149 CONFIG_UART0_RTS_PIN, 149 CONFIG_UART0_RTS_PIN,
150#endif 150#endif
@@ -158,7 +158,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
158 CH_UART1_TX, 158 CH_UART1_TX,
159 CH_UART1_RX, 159 CH_UART1_RX,
160#endif 160#endif
161#ifdef CONFIG_BFIN_UART1_CTSRTS 161#ifdef CONFIG_SERIAL_BFIN_CTSRTS
162 CONFIG_UART1_CTS_PIN, 162 CONFIG_UART1_CTS_PIN,
163 CONFIG_UART1_RTS_PIN, 163 CONFIG_UART1_RTS_PIN,
164#endif 164#endif
diff --git a/arch/blackfin/mach-bf533/boards/Kconfig b/arch/blackfin/mach-bf533/boards/Kconfig
index 308c98dc5aba..8d8b3e7321e6 100644
--- a/arch/blackfin/mach-bf533/boards/Kconfig
+++ b/arch/blackfin/mach-bf533/boards/Kconfig
@@ -38,9 +38,4 @@ config BFIN532_IP0X
38 help 38 help
39 Core support for IP04/IP04 open hardware IP-PBX. 39 Core support for IP04/IP04 open hardware IP-PBX.
40 40
41config GENERIC_BF533_BOARD
42 bool "Generic"
43 help
44 Generic or Custom board support.
45
46endchoice 41endchoice
diff --git a/arch/blackfin/mach-bf533/boards/Makefile b/arch/blackfin/mach-bf533/boards/Makefile
index 9afbe72b484f..ff1e832f80d2 100644
--- a/arch/blackfin/mach-bf533/boards/Makefile
+++ b/arch/blackfin/mach-bf533/boards/Makefile
@@ -2,7 +2,6 @@
2# arch/blackfin/mach-bf533/boards/Makefile 2# arch/blackfin/mach-bf533/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BF533_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN533_STAMP) += stamp.o 5obj-$(CONFIG_BFIN533_STAMP) += stamp.o
7obj-$(CONFIG_BFIN532_IP0X) += ip0x.o 6obj-$(CONFIG_BFIN532_IP0X) += ip0x.o
8obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o 7obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c
index 015c18f85e7f..0765872a8ada 100644
--- a/arch/blackfin/mach-bf533/boards/blackstamp.c
+++ b/arch/blackfin/mach-bf533/boards/blackstamp.c
@@ -101,9 +101,9 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
101}; 101};
102#endif 102#endif
103 103
104#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 104#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
105static struct bfin5xx_spi_chip spi_mmc_chip_info = { 105static struct bfin5xx_spi_chip mmc_spi_chip_info = {
106 .enable_dma = 1, 106 .enable_dma = 0,
107 .bits_per_word = 8, 107 .bits_per_word = 8,
108}; 108};
109#endif 109#endif
@@ -129,23 +129,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
129 }, 129 },
130#endif 130#endif
131 131
132#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 132#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
133 {
134 .modalias = "spi_mmc_dummy",
135 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
136 .bus_num = 0,
137 .chip_select = 0,
138 .platform_data = NULL,
139 .controller_data = &spi_mmc_chip_info,
140 .mode = SPI_MODE_3,
141 },
142 { 133 {
143 .modalias = "spi_mmc", 134 .modalias = "mmc_spi",
144 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ 135 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
145 .bus_num = 0, 136 .bus_num = 0,
146 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 137 .chip_select = 5,
147 .platform_data = NULL, 138 .controller_data = &mmc_spi_chip_info,
148 .controller_data = &spi_mmc_chip_info,
149 .mode = SPI_MODE_3, 139 .mode = SPI_MODE_3,
150 }, 140 },
151#endif 141#endif
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index e7061c7e8c42..e8974878d8c2 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -96,9 +96,9 @@ static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
96}; 96};
97#endif 97#endif
98 98
99#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 99#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
100static struct bfin5xx_spi_chip spi_mmc_chip_info = { 100static struct bfin5xx_spi_chip mmc_spi_chip_info = {
101 .enable_dma = 1, 101 .enable_dma = 0,
102 .bits_per_word = 8, 102 .bits_per_word = 8,
103}; 103};
104#endif 104#endif
@@ -138,23 +138,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
138 }, 138 },
139#endif 139#endif
140 140
141#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 141#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
142 {
143 .modalias = "spi_mmc_dummy",
144 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
145 .bus_num = 0,
146 .chip_select = 0,
147 .platform_data = NULL,
148 .controller_data = &spi_mmc_chip_info,
149 .mode = SPI_MODE_3,
150 },
151 { 142 {
152 .modalias = "spi_mmc", 143 .modalias = "mmc_spi",
153 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 144 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
154 .bus_num = 0, 145 .bus_num = 0,
155 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 146 .chip_select = 5,
156 .platform_data = NULL, 147 .controller_data = &mmc_spi_chip_info,
157 .controller_data = &spi_mmc_chip_info,
158 .mode = SPI_MODE_3, 148 .mode = SPI_MODE_3,
159 }, 149 },
160#endif 150#endif
diff --git a/arch/blackfin/mach-bf533/boards/generic_board.c b/arch/blackfin/mach-bf533/boards/generic_board.c
deleted file mode 100644
index 986eeec53b1f..000000000000
--- a/arch/blackfin/mach-bf533/boards/generic_board.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf533/generic_board.c
3 * Based on: arch/blackfin/mach-bf533/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created: 2005
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/irq.h>
34
35/*
36 * Name the Board for the /proc/cpuinfo
37 */
38const char bfin_board_name[] = "UNKNOWN BOARD";
39
40#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
41static struct platform_device rtc_device = {
42 .name = "rtc-bfin",
43 .id = -1,
44};
45#endif
46
47/*
48 * Driver needs to know address, irq and flag pin.
49 */
50#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
51static struct resource smc91x_resources[] = {
52 {
53 .start = 0x20300300,
54 .end = 0x20300300 + 16,
55 .flags = IORESOURCE_MEM,
56 }, {
57 .start = IRQ_PROG_INTB,
58 .end = IRQ_PROG_INTB,
59 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
60 }, {
61 .start = IRQ_PF7,
62 .end = IRQ_PF7,
63 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
64 },
65};
66
67static struct platform_device smc91x_device = {
68 .name = "smc91x",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(smc91x_resources),
71 .resource = smc91x_resources,
72};
73#endif
74
75#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
76#ifdef CONFIG_BFIN_SIR0
77static struct resource bfin_sir0_resources[] = {
78 {
79 .start = 0xFFC00400,
80 .end = 0xFFC004FF,
81 .flags = IORESOURCE_MEM,
82 },
83 {
84 .start = IRQ_UART0_RX,
85 .end = IRQ_UART0_RX+1,
86 .flags = IORESOURCE_IRQ,
87 },
88 {
89 .start = CH_UART0_RX,
90 .end = CH_UART0_RX+1,
91 .flags = IORESOURCE_DMA,
92 },
93};
94
95static struct platform_device bfin_sir0_device = {
96 .name = "bfin_sir",
97 .id = 0,
98 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
99 .resource = bfin_sir0_resources,
100};
101#endif
102#endif
103
104static struct platform_device *generic_board_devices[] __initdata = {
105#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
106 &rtc_device,
107#endif
108
109#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
110 &smc91x_device,
111#endif
112
113#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
114#ifdef CONFIG_BFIN_SIR0
115 &bfin_sir0_device,
116#endif
117#endif
118};
119
120static int __init generic_board_init(void)
121{
122 printk(KERN_INFO "%s(): registering device resources\n", __func__);
123 return platform_add_devices(generic_board_devices, ARRAY_SIZE(generic_board_devices));
124}
125
126arch_initcall(generic_board_init);
diff --git a/arch/blackfin/mach-bf533/boards/ip0x.c b/arch/blackfin/mach-bf533/boards/ip0x.c
index e30b1b7d1442..f19b63378b12 100644
--- a/arch/blackfin/mach-bf533/boards/ip0x.c
+++ b/arch/blackfin/mach-bf533/boards/ip0x.c
@@ -127,8 +127,8 @@ static struct platform_device dm9000_device2 = {
127#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 127#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
128/* all SPI peripherals info goes here */ 128/* all SPI peripherals info goes here */
129 129
130#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 130#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
131static struct bfin5xx_spi_chip spi_mmc_chip_info = { 131static struct bfin5xx_spi_chip mmc_spi_chip_info = {
132/* 132/*
133 * CPOL (Clock Polarity) 133 * CPOL (Clock Polarity)
134 * 0 - Active high SCK 134 * 0 - Active high SCK
@@ -152,14 +152,13 @@ static struct bfin5xx_spi_chip spi_mmc_chip_info = {
152/* Notice: for blackfin, the speed_hz is the value of register 152/* Notice: for blackfin, the speed_hz is the value of register
153 * SPI_BAUD, not the real baudrate */ 153 * SPI_BAUD, not the real baudrate */
154static struct spi_board_info bfin_spi_board_info[] __initdata = { 154static struct spi_board_info bfin_spi_board_info[] __initdata = {
155#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 155#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
156 { 156 {
157 .modalias = "spi_mmc", 157 .modalias = "mmc_spi",
158 .max_speed_hz = 2, 158 .max_speed_hz = 2,
159 .bus_num = 1, 159 .bus_num = 1,
160 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 160 .chip_select = 5,
161 .platform_data = NULL, 161 .controller_data = &mmc_spi_chip_info,
162 .controller_data = &spi_mmc_chip_info,
163 }, 162 },
164#endif 163#endif
165}; 164};
diff --git a/arch/blackfin/mach-bf533/include/mach/anomaly.h b/arch/blackfin/mach-bf533/include/mach/anomaly.h
index 0d3a03429fb9..1cf893e2e55b 100644
--- a/arch/blackfin/mach-bf533/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf533/include/mach/anomaly.h
@@ -2,7 +2,7 @@
2 * File: include/asm-blackfin/mach-bf533/anomaly.h 2 * File: include/asm-blackfin/mach-bf533/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -160,7 +160,7 @@
160#define ANOMALY_05000301 (__SILICON_REVISION__ < 6) 160#define ANOMALY_05000301 (__SILICON_REVISION__ < 6)
161/* SSYNCs After Writes To DMA MMR Registers May Not Be Handled Correctly */ 161/* SSYNCs After Writes To DMA MMR Registers May Not Be Handled Correctly */
162#define ANOMALY_05000302 (__SILICON_REVISION__ < 5) 162#define ANOMALY_05000302 (__SILICON_REVISION__ < 5)
163/* New Feature: Additional Hysteresis on SPORT Input Pins (Not Available On Older Silicon) */ 163/* SPORT_HYS Bit in PLL_CTL Register Is Not Functional */
164#define ANOMALY_05000305 (__SILICON_REVISION__ < 5) 164#define ANOMALY_05000305 (__SILICON_REVISION__ < 5)
165/* New Feature: Additional PPI Frame Sync Sampling Options (Not Available On Older Silicon) */ 165/* New Feature: Additional PPI Frame Sync Sampling Options (Not Available On Older Silicon) */
166#define ANOMALY_05000306 (__SILICON_REVISION__ < 5) 166#define ANOMALY_05000306 (__SILICON_REVISION__ < 5)
@@ -278,9 +278,12 @@
278#define ANOMALY_05000266 (0) 278#define ANOMALY_05000266 (0)
279#define ANOMALY_05000323 (0) 279#define ANOMALY_05000323 (0)
280#define ANOMALY_05000353 (1) 280#define ANOMALY_05000353 (1)
281#define ANOMALY_05000380 (0)
281#define ANOMALY_05000386 (1) 282#define ANOMALY_05000386 (1)
282#define ANOMALY_05000412 (0) 283#define ANOMALY_05000412 (0)
283#define ANOMALY_05000432 (0) 284#define ANOMALY_05000432 (0)
284#define ANOMALY_05000435 (0) 285#define ANOMALY_05000435 (0)
286#define ANOMALY_05000447 (0)
287#define ANOMALY_05000448 (0)
285 288
286#endif 289#endif
diff --git a/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
index f3d9e495230c..5f517f53b0fd 100644
--- a/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
@@ -134,7 +134,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
134 CH_UART_TX, 134 CH_UART_TX,
135 CH_UART_RX, 135 CH_UART_RX,
136#endif 136#endif
137#ifdef CONFIG_BFIN_UART0_CTSRTS 137#ifdef CONFIG_SERIAL_BFIN_CTSRTS
138 CONFIG_UART0_CTS_PIN, 138 CONFIG_UART0_CTS_PIN,
139 CONFIG_UART0_RTS_PIN, 139 CONFIG_UART0_RTS_PIN,
140#endif 140#endif
diff --git a/arch/blackfin/mach-bf537/boards/Kconfig b/arch/blackfin/mach-bf537/boards/Kconfig
index 42a57b0acb29..77c59da87e85 100644
--- a/arch/blackfin/mach-bf537/boards/Kconfig
+++ b/arch/blackfin/mach-bf537/boards/Kconfig
@@ -33,9 +33,4 @@ config CAMSIG_MINOTAUR
33 help 33 help
34 Board supply package for CSP Minotaur 34 Board supply package for CSP Minotaur
35 35
36config GENERIC_BF537_BOARD
37 bool "Generic"
38 help
39 Generic or Custom board support.
40
41endchoice 36endchoice
diff --git a/arch/blackfin/mach-bf537/boards/Makefile b/arch/blackfin/mach-bf537/boards/Makefile
index 7168cc14afd8..68b98a7af6a6 100644
--- a/arch/blackfin/mach-bf537/boards/Makefile
+++ b/arch/blackfin/mach-bf537/boards/Makefile
@@ -2,7 +2,6 @@
2# arch/blackfin/mach-bf537/boards/Makefile 2# arch/blackfin/mach-bf537/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BF537_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN537_STAMP) += stamp.o 5obj-$(CONFIG_BFIN537_STAMP) += stamp.o
7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o 6obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o
8obj-$(CONFIG_BFIN537_BLUETECHNIX_TCM) += tcm_bf537.o 7obj-$(CONFIG_BFIN537_BLUETECHNIX_TCM) += tcm_bf537.o
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 9cd8fb2a30d3..41c75b9bfac0 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -108,9 +108,9 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
108}; 108};
109#endif 109#endif
110 110
111#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 111#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
112static struct bfin5xx_spi_chip spi_mmc_chip_info = { 112static struct bfin5xx_spi_chip mmc_spi_chip_info = {
113 .enable_dma = 1, 113 .enable_dma = 0,
114 .bits_per_word = 8, 114 .bits_per_word = 8,
115}; 115};
116#endif 116#endif
@@ -160,23 +160,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
160 }, 160 },
161#endif 161#endif
162 162
163#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 163#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
164 {
165 .modalias = "spi_mmc_dummy",
166 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
167 .bus_num = 0,
168 .chip_select = 7,
169 .platform_data = NULL,
170 .controller_data = &spi_mmc_chip_info,
171 .mode = SPI_MODE_3,
172 },
173 { 164 {
174 .modalias = "spi_mmc", 165 .modalias = "mmc_spi",
175 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 166 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
176 .bus_num = 0, 167 .bus_num = 0,
177 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 168 .chip_select = 1,
178 .platform_data = NULL, 169 .controller_data = &mmc_spi_chip_info,
179 .controller_data = &spi_mmc_chip_info,
180 .mode = SPI_MODE_3, 170 .mode = SPI_MODE_3,
181 }, 171 },
182#endif 172#endif
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
deleted file mode 100644
index da710fdc4569..000000000000
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ /dev/null
@@ -1,745 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf537/boards/generic_board.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/etherdevice.h>
33#include <linux/platform_device.h>
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/partitions.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb/isp1362.h>
40#endif
41#include <linux/irq.h>
42#include <linux/interrupt.h>
43#include <linux/usb/sl811.h>
44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h>
47#include <asm/portmux.h>
48#include <linux/spi/ad7877.h>
49
50/*
51 * Name the Board for the /proc/cpuinfo
52 */
53const char bfin_board_name[] = "UNKNOWN BOARD";
54
55/*
56 * Driver needs to know address, irq and flag pin.
57 */
58
59#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
60#include <linux/usb/isp1760.h>
61static struct resource bfin_isp1760_resources[] = {
62 [0] = {
63 .start = 0x203C0000,
64 .end = 0x203C0000 + 0x000fffff,
65 .flags = IORESOURCE_MEM,
66 },
67 [1] = {
68 .start = IRQ_PF7,
69 .end = IRQ_PF7,
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct isp1760_platform_data isp1760_priv = {
75 .is_isp1761 = 0,
76 .port1_disable = 0,
77 .bus_width_16 = 1,
78 .port1_otg = 0,
79 .analog_oc = 0,
80 .dack_polarity_high = 0,
81 .dreq_polarity_high = 0,
82};
83
84static struct platform_device bfin_isp1760_device = {
85 .name = "isp1760-hcd",
86 .id = 0,
87 .dev = {
88 .platform_data = &isp1760_priv,
89 },
90 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
91 .resource = bfin_isp1760_resources,
92};
93#endif
94
95#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
96static struct resource bfin_pcmcia_cf_resources[] = {
97 {
98 .start = 0x20310000, /* IO PORT */
99 .end = 0x20312000,
100 .flags = IORESOURCE_MEM,
101 }, {
102 .start = 0x20311000, /* Attribute Memory */
103 .end = 0x20311FFF,
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_PF4,
107 .end = IRQ_PF4,
108 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
109 }, {
110 .start = 6, /* Card Detect PF6 */
111 .end = 6,
112 .flags = IORESOURCE_IRQ,
113 },
114};
115
116static struct platform_device bfin_pcmcia_cf_device = {
117 .name = "bfin_cf_pcmcia",
118 .id = -1,
119 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
120 .resource = bfin_pcmcia_cf_resources,
121};
122#endif
123
124#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
125static struct platform_device rtc_device = {
126 .name = "rtc-bfin",
127 .id = -1,
128};
129#endif
130
131#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
132static struct resource smc91x_resources[] = {
133 {
134 .name = "smc91x-regs",
135 .start = 0x20300300,
136 .end = 0x20300300 + 16,
137 .flags = IORESOURCE_MEM,
138 }, {
139
140 .start = IRQ_PF7,
141 .end = IRQ_PF7,
142 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
143 },
144};
145static struct platform_device smc91x_device = {
146 .name = "smc91x",
147 .id = 0,
148 .num_resources = ARRAY_SIZE(smc91x_resources),
149 .resource = smc91x_resources,
150};
151#endif
152
153#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
154static struct resource dm9000_resources[] = {
155 [0] = {
156 .start = 0x203FB800,
157 .end = 0x203FB800 + 1,
158 .flags = IORESOURCE_MEM,
159 },
160 [1] = {
161 .start = 0x203FB800 + 4,
162 .end = 0x203FB800 + 5,
163 .flags = IORESOURCE_MEM,
164 },
165 [2] = {
166 .start = IRQ_PF9,
167 .end = IRQ_PF9,
168 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
169 },
170};
171
172static struct platform_device dm9000_device = {
173 .name = "dm9000",
174 .id = -1,
175 .num_resources = ARRAY_SIZE(dm9000_resources),
176 .resource = dm9000_resources,
177};
178#endif
179
180#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
181static struct resource sl811_hcd_resources[] = {
182 {
183 .start = 0x20340000,
184 .end = 0x20340000,
185 .flags = IORESOURCE_MEM,
186 }, {
187 .start = 0x20340004,
188 .end = 0x20340004,
189 .flags = IORESOURCE_MEM,
190 }, {
191 .start = CONFIG_USB_SL811_BFIN_IRQ,
192 .end = CONFIG_USB_SL811_BFIN_IRQ,
193 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
194 },
195};
196
197#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
198void sl811_port_power(struct device *dev, int is_on)
199{
200 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
201 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
202
203}
204#endif
205
206static struct sl811_platform_data sl811_priv = {
207 .potpg = 10,
208 .power = 250, /* == 500mA */
209#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
210 .port_power = &sl811_port_power,
211#endif
212};
213
214static struct platform_device sl811_hcd_device = {
215 .name = "sl811-hcd",
216 .id = 0,
217 .dev = {
218 .platform_data = &sl811_priv,
219 },
220 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
221 .resource = sl811_hcd_resources,
222};
223#endif
224
225#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
226static struct resource isp1362_hcd_resources[] = {
227 {
228 .start = 0x20360000,
229 .end = 0x20360000,
230 .flags = IORESOURCE_MEM,
231 }, {
232 .start = 0x20360004,
233 .end = 0x20360004,
234 .flags = IORESOURCE_MEM,
235 }, {
236 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
237 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
238 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
239 },
240};
241
242static struct isp1362_platform_data isp1362_priv = {
243 .sel15Kres = 1,
244 .clknotstop = 0,
245 .oc_enable = 0,
246 .int_act_high = 0,
247 .int_edge_triggered = 0,
248 .remote_wakeup_connected = 0,
249 .no_power_switching = 1,
250 .power_switching_mode = 0,
251};
252
253static struct platform_device isp1362_hcd_device = {
254 .name = "isp1362-hcd",
255 .id = 0,
256 .dev = {
257 .platform_data = &isp1362_priv,
258 },
259 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
260 .resource = isp1362_hcd_resources,
261};
262#endif
263
264#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
265static struct platform_device bfin_mii_bus = {
266 .name = "bfin_mii_bus",
267};
268
269static struct platform_device bfin_mac_device = {
270 .name = "bfin_mac",
271 .dev.platform_data = &bfin_mii_bus,
272};
273#endif
274
275#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
276static struct resource net2272_bfin_resources[] = {
277 {
278 .start = 0x20300000,
279 .end = 0x20300000 + 0x100,
280 .flags = IORESOURCE_MEM,
281 }, {
282 .start = IRQ_PF7,
283 .end = IRQ_PF7,
284 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
285 },
286};
287
288static struct platform_device net2272_bfin_device = {
289 .name = "net2272",
290 .id = -1,
291 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
292 .resource = net2272_bfin_resources,
293};
294#endif
295
296#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
297/* all SPI peripherals info goes here */
298
299#if defined(CONFIG_MTD_M25P80) \
300 || defined(CONFIG_MTD_M25P80_MODULE)
301static struct mtd_partition bfin_spi_flash_partitions[] = {
302 {
303 .name = "bootloader(spi)",
304 .size = 0x00020000,
305 .offset = 0,
306 .mask_flags = MTD_CAP_ROM
307 }, {
308 .name = "linux kernel(spi)",
309 .size = 0xe0000,
310 .offset = 0x20000
311 }, {
312 .name = "file system(spi)",
313 .size = 0x700000,
314 .offset = 0x00100000,
315 }
316};
317
318static struct flash_platform_data bfin_spi_flash_data = {
319 .name = "m25p80",
320 .parts = bfin_spi_flash_partitions,
321 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
322 .type = "m25p64",
323};
324
325/* SPI flash chip (m25p64) */
326static struct bfin5xx_spi_chip spi_flash_chip_info = {
327 .enable_dma = 0, /* use dma transfer with this chip*/
328 .bits_per_word = 8,
329};
330#endif
331
332#if defined(CONFIG_SPI_ADC_BF533) \
333 || defined(CONFIG_SPI_ADC_BF533_MODULE)
334/* SPI ADC chip */
335static struct bfin5xx_spi_chip spi_adc_chip_info = {
336 .enable_dma = 1, /* use dma transfer with this chip*/
337 .bits_per_word = 16,
338};
339#endif
340
341#if defined(CONFIG_SND_BLACKFIN_AD1836) \
342 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
343static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
344 .enable_dma = 0,
345 .bits_per_word = 16,
346};
347#endif
348
349#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
350static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
351 .enable_dma = 0,
352 .bits_per_word = 16,
353};
354#endif
355
356#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
357static struct bfin5xx_spi_chip spi_mmc_chip_info = {
358 .enable_dma = 1,
359 .bits_per_word = 8,
360};
361#endif
362
363#if defined(CONFIG_PBX)
364static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
365 .ctl_reg = 0x4, /* send zero */
366 .enable_dma = 0,
367 .bits_per_word = 8,
368 .cs_change_per_word = 1,
369};
370#endif
371
372#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
373static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
374 .enable_dma = 0,
375 .bits_per_word = 16,
376};
377
378static const struct ad7877_platform_data bfin_ad7877_ts_info = {
379 .model = 7877,
380 .vref_delay_usecs = 50, /* internal, no capacitor */
381 .x_plate_ohms = 419,
382 .y_plate_ohms = 486,
383 .pressure_max = 1000,
384 .pressure_min = 0,
385 .stopacq_polarity = 1,
386 .first_conversion_delay = 3,
387 .acquisition_time = 1,
388 .averaging = 1,
389 .pen_down_acc_interval = 1,
390};
391#endif
392
393static struct spi_board_info bfin_spi_board_info[] __initdata = {
394#if defined(CONFIG_MTD_M25P80) \
395 || defined(CONFIG_MTD_M25P80_MODULE)
396 {
397 /* the modalias must be the same as spi device driver name */
398 .modalias = "m25p80", /* Name of spi_driver for this device */
399 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
400 .bus_num = 0, /* Framework bus number */
401 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
402 .platform_data = &bfin_spi_flash_data,
403 .controller_data = &spi_flash_chip_info,
404 .mode = SPI_MODE_3,
405 },
406#endif
407
408#if defined(CONFIG_SPI_ADC_BF533) \
409 || defined(CONFIG_SPI_ADC_BF533_MODULE)
410 {
411 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
412 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
413 .bus_num = 0, /* Framework bus number */
414 .chip_select = 1, /* Framework chip select. */
415 .platform_data = NULL, /* No spi_driver specific config */
416 .controller_data = &spi_adc_chip_info,
417 },
418#endif
419
420#if defined(CONFIG_SND_BLACKFIN_AD1836) \
421 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
422 {
423 .modalias = "ad1836-spi",
424 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
425 .bus_num = 0,
426 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
427 .controller_data = &ad1836_spi_chip_info,
428 },
429#endif
430#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
431 {
432 .modalias = "ad9960-spi",
433 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
434 .bus_num = 0,
435 .chip_select = 1,
436 .controller_data = &ad9960_spi_chip_info,
437 },
438#endif
439#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
440 {
441 .modalias = "spi_mmc_dummy",
442 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
443 .bus_num = 0,
444 .chip_select = 0,
445 .platform_data = NULL,
446 .controller_data = &spi_mmc_chip_info,
447 .mode = SPI_MODE_3,
448 },
449 {
450 .modalias = "spi_mmc",
451 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
452 .bus_num = 0,
453 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
454 .platform_data = NULL,
455 .controller_data = &spi_mmc_chip_info,
456 .mode = SPI_MODE_3,
457 },
458#endif
459#if defined(CONFIG_PBX)
460 {
461 .modalias = "fxs-spi",
462 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
463 .bus_num = 0,
464 .chip_select = 8 - CONFIG_J11_JUMPER,
465 .controller_data = &spi_si3xxx_chip_info,
466 .mode = SPI_MODE_3,
467 },
468 {
469 .modalias = "fxo-spi",
470 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
471 .bus_num = 0,
472 .chip_select = 8 - CONFIG_J19_JUMPER,
473 .controller_data = &spi_si3xxx_chip_info,
474 .mode = SPI_MODE_3,
475 },
476#endif
477#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
478 {
479 .modalias = "ad7877",
480 .platform_data = &bfin_ad7877_ts_info,
481 .irq = IRQ_PF6,
482 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
483 .bus_num = 0,
484 .chip_select = 1,
485 .controller_data = &spi_ad7877_chip_info,
486 },
487#endif
488};
489
490/* SPI controller data */
491static struct bfin5xx_spi_master bfin_spi0_info = {
492 .num_chipselect = 8,
493 .enable_dma = 1, /* master has the ability to do dma transfer */
494 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
495};
496
497/* SPI (0) */
498static struct resource bfin_spi0_resource[] = {
499 [0] = {
500 .start = SPI0_REGBASE,
501 .end = SPI0_REGBASE + 0xFF,
502 .flags = IORESOURCE_MEM,
503 },
504 [1] = {
505 .start = CH_SPI,
506 .end = CH_SPI,
507 .flags = IORESOURCE_IRQ,
508 },
509};
510
511static struct platform_device bfin_spi0_device = {
512 .name = "bfin-spi",
513 .id = 0, /* Bus number */
514 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
515 .resource = bfin_spi0_resource,
516 .dev = {
517 .platform_data = &bfin_spi0_info, /* Passed to driver */
518 },
519};
520#endif /* spi master and devices */
521
522#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
523static struct platform_device bfin_fb_device = {
524 .name = "bf537-lq035",
525};
526#endif
527
528#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
529static struct platform_device bfin_fb_adv7393_device = {
530 .name = "bfin-adv7393",
531};
532#endif
533
534#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
535static struct resource bfin_uart_resources[] = {
536 {
537 .start = 0xFFC00400,
538 .end = 0xFFC004FF,
539 .flags = IORESOURCE_MEM,
540 }, {
541 .start = 0xFFC02000,
542 .end = 0xFFC020FF,
543 .flags = IORESOURCE_MEM,
544 },
545};
546
547static struct platform_device bfin_uart_device = {
548 .name = "bfin-uart",
549 .id = 1,
550 .num_resources = ARRAY_SIZE(bfin_uart_resources),
551 .resource = bfin_uart_resources,
552};
553#endif
554
555#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
556#ifdef CONFIG_BFIN_SIR0
557static struct resource bfin_sir0_resources[] = {
558 {
559 .start = 0xFFC00400,
560 .end = 0xFFC004FF,
561 .flags = IORESOURCE_MEM,
562 },
563 {
564 .start = IRQ_UART0_RX,
565 .end = IRQ_UART0_RX+1,
566 .flags = IORESOURCE_IRQ,
567 },
568 {
569 .start = CH_UART0_RX,
570 .end = CH_UART0_RX+1,
571 .flags = IORESOURCE_DMA,
572 },
573};
574
575static struct platform_device bfin_sir0_device = {
576 .name = "bfin_sir",
577 .id = 0,
578 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
579 .resource = bfin_sir0_resources,
580};
581#endif
582#ifdef CONFIG_BFIN_SIR1
583static struct resource bfin_sir1_resources[] = {
584 {
585 .start = 0xFFC02000,
586 .end = 0xFFC020FF,
587 .flags = IORESOURCE_MEM,
588 },
589 {
590 .start = IRQ_UART1_RX,
591 .end = IRQ_UART1_RX+1,
592 .flags = IORESOURCE_IRQ,
593 },
594 {
595 .start = CH_UART1_RX,
596 .end = CH_UART1_RX+1,
597 .flags = IORESOURCE_DMA,
598 },
599};
600
601static struct platform_device bfin_sir1_device = {
602 .name = "bfin_sir",
603 .id = 1,
604 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
605 .resource = bfin_sir1_resources,
606};
607#endif
608#endif
609
610#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
611static struct resource bfin_twi0_resource[] = {
612 [0] = {
613 .start = TWI0_REGBASE,
614 .end = TWI0_REGBASE + 0xFF,
615 .flags = IORESOURCE_MEM,
616 },
617 [1] = {
618 .start = IRQ_TWI,
619 .end = IRQ_TWI,
620 .flags = IORESOURCE_IRQ,
621 },
622};
623
624static struct platform_device i2c_bfin_twi_device = {
625 .name = "i2c-bfin-twi",
626 .id = 0,
627 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
628 .resource = bfin_twi0_resource,
629};
630#endif
631
632#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
633static struct platform_device bfin_sport0_uart_device = {
634 .name = "bfin-sport-uart",
635 .id = 0,
636};
637
638static struct platform_device bfin_sport1_uart_device = {
639 .name = "bfin-sport-uart",
640 .id = 1,
641};
642#endif
643
644static struct platform_device *stamp_devices[] __initdata = {
645#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
646 &bfin_pcmcia_cf_device,
647#endif
648
649#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
650 &rtc_device,
651#endif
652
653#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
654 &sl811_hcd_device,
655#endif
656
657#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
658 &isp1362_hcd_device,
659#endif
660
661#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
662 &smc91x_device,
663#endif
664
665#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
666 &dm9000_device,
667#endif
668
669#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
670 &bfin_mii_bus,
671 &bfin_mac_device,
672#endif
673
674#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
675 &net2272_bfin_device,
676#endif
677
678#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
679 &bfin_isp1760_device,
680#endif
681
682#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
683 &bfin_spi0_device,
684#endif
685
686#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
687 &bfin_fb_device,
688#endif
689
690#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
691 &bfin_fb_adv7393_device,
692#endif
693
694#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
695 &bfin_uart_device,
696#endif
697
698#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
699#ifdef CONFIG_BFIN_SIR0
700 &bfin_sir0_device,
701#endif
702#ifdef CONFIG_BFIN_SIR1
703 &bfin_sir1_device,
704#endif
705#endif
706
707#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
708 &i2c_bfin_twi_device,
709#endif
710
711#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
712 &bfin_sport0_uart_device,
713 &bfin_sport1_uart_device,
714#endif
715};
716
717static int __init generic_init(void)
718{
719 printk(KERN_INFO "%s(): registering device resources\n", __func__);
720 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
721#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
722 spi_register_board_info(bfin_spi_board_info,
723 ARRAY_SIZE(bfin_spi_board_info));
724#endif
725
726 return 0;
727}
728
729arch_initcall(generic_init);
730
731void native_machine_restart(char *cmd)
732{
733 /* workaround reboot hang when booting from SPI */
734 if ((bfin_read_SYSCR() & 0x7) == 0x3)
735 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
736}
737
738#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
739void bfin_get_ether_addr(char *addr)
740{
741 random_ether_addr(addr);
742 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
743}
744EXPORT_SYMBOL(bfin_get_ether_addr);
745#endif
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
index db7d3a385e4b..3c159819e555 100644
--- a/arch/blackfin/mach-bf537/boards/minotaur.c
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -134,9 +134,9 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
134}; 134};
135#endif 135#endif
136 136
137#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 137#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
138static struct bfin5xx_spi_chip spi_mmc_chip_info = { 138static struct bfin5xx_spi_chip mmc_spi_chip_info = {
139 .enable_dma = 1, 139 .enable_dma = 0,
140 .bits_per_word = 8, 140 .bits_per_word = 8,
141}; 141};
142#endif 142#endif
@@ -156,23 +156,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
156 }, 156 },
157#endif 157#endif
158 158
159#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 159#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
160 { 160 {
161 .modalias = "spi_mmc_dummy", 161 .modalias = "mmc_spi",
162 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */ 162 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
163 .bus_num = 0, 163 .bus_num = 0,
164 .chip_select = 0, 164 .chip_select = 5,
165 .platform_data = NULL, 165 .controller_data = &mmc_spi_chip_info,
166 .controller_data = &spi_mmc_chip_info,
167 .mode = SPI_MODE_3,
168 },
169 {
170 .modalias = "spi_mmc",
171 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
172 .bus_num = 0,
173 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
174 .platform_data = NULL,
175 .controller_data = &spi_mmc_chip_info,
176 .mode = SPI_MODE_3, 166 .mode = SPI_MODE_3,
177 }, 167 },
178#endif 168#endif
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 590eb3a139b7..4e1de1e53f89 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -289,9 +289,9 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
289}; 289};
290#endif 290#endif
291 291
292#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 292#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
293static struct bfin5xx_spi_chip spi_mmc_chip_info = { 293static struct bfin5xx_spi_chip mmc_spi_chip_info = {
294 .enable_dma = 1, 294 .enable_dma = 0,
295 .bits_per_word = 8, 295 .bits_per_word = 8,
296}; 296};
297#endif 297#endif
@@ -364,23 +364,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
364 .controller_data = &ad9960_spi_chip_info, 364 .controller_data = &ad9960_spi_chip_info,
365 }, 365 },
366#endif 366#endif
367#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 367#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
368 {
369 .modalias = "spi_mmc_dummy",
370 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
371 .bus_num = 0,
372 .chip_select = 7,
373 .platform_data = NULL,
374 .controller_data = &spi_mmc_chip_info,
375 .mode = SPI_MODE_3,
376 },
377 { 368 {
378 .modalias = "spi_mmc", 369 .modalias = "mmc_spi",
379 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 370 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
380 .bus_num = 0, 371 .bus_num = 0,
381 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 372 .chip_select = 5,
382 .platform_data = NULL, 373 .controller_data = &mmc_spi_chip_info,
383 .controller_data = &spi_mmc_chip_info,
384 .mode = SPI_MODE_3, 374 .mode = SPI_MODE_3,
385 }, 375 },
386#endif 376#endif
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 3f4f203a06ec..53ad10f3cd76 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -108,9 +108,9 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
108}; 108};
109#endif 109#endif
110 110
111#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 111#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
112static struct bfin5xx_spi_chip spi_mmc_chip_info = { 112static struct bfin5xx_spi_chip mmc_spi_chip_info = {
113 .enable_dma = 1, 113 .enable_dma = 0,
114 .bits_per_word = 8, 114 .bits_per_word = 8,
115}; 115};
116#endif 116#endif
@@ -160,23 +160,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
160 }, 160 },
161#endif 161#endif
162 162
163#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 163#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
164 {
165 .modalias = "spi_mmc_dummy",
166 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
167 .bus_num = 0,
168 .chip_select = 7,
169 .platform_data = NULL,
170 .controller_data = &spi_mmc_chip_info,
171 .mode = SPI_MODE_3,
172 },
173 { 164 {
174 .modalias = "spi_mmc", 165 .modalias = "mmc_spi",
175 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 166 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
176 .bus_num = 0, 167 .bus_num = 0,
177 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 168 .chip_select = 5,
178 .platform_data = NULL, 169 .controller_data = &mmc_spi_chip_info,
179 .controller_data = &spi_mmc_chip_info,
180 .mode = SPI_MODE_3, 170 .mode = SPI_MODE_3,
181 }, 171 },
182#endif 172#endif
diff --git a/arch/blackfin/mach-bf537/include/mach/anomaly.h b/arch/blackfin/mach-bf537/include/mach/anomaly.h
index 9cb39121d1cb..1bfd80c26c90 100644
--- a/arch/blackfin/mach-bf537/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf537/include/mach/anomaly.h
@@ -2,7 +2,7 @@
2 * File: include/asm-blackfin/mach-bf537/anomaly.h 2 * File: include/asm-blackfin/mach-bf537/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -110,7 +110,7 @@
110#define ANOMALY_05000301 (1) 110#define ANOMALY_05000301 (1)
111/* SSYNCs After Writes To CAN/DMA MMR Registers Are Not Always Handled Correctly */ 111/* SSYNCs After Writes To CAN/DMA MMR Registers Are Not Always Handled Correctly */
112#define ANOMALY_05000304 (__SILICON_REVISION__ < 3) 112#define ANOMALY_05000304 (__SILICON_REVISION__ < 3)
113/* New Feature: Additional Hysteresis on SPORT Input Pins (Not Available On Older Silicon) */ 113/* SPORT_HYS Bit in PLL_CTL Register Is Not Functional */
114#define ANOMALY_05000305 (__SILICON_REVISION__ < 3) 114#define ANOMALY_05000305 (__SILICON_REVISION__ < 3)
115/* SCKELOW Bit Does Not Maintain State Through Hibernate */ 115/* SCKELOW Bit Does Not Maintain State Through Hibernate */
116#define ANOMALY_05000307 (__SILICON_REVISION__ < 3) 116#define ANOMALY_05000307 (__SILICON_REVISION__ < 3)
@@ -168,9 +168,12 @@
168#define ANOMALY_05000323 (0) 168#define ANOMALY_05000323 (0)
169#define ANOMALY_05000353 (1) 169#define ANOMALY_05000353 (1)
170#define ANOMALY_05000363 (0) 170#define ANOMALY_05000363 (0)
171#define ANOMALY_05000380 (0)
171#define ANOMALY_05000386 (1) 172#define ANOMALY_05000386 (1)
172#define ANOMALY_05000412 (0) 173#define ANOMALY_05000412 (0)
173#define ANOMALY_05000432 (0) 174#define ANOMALY_05000432 (0)
174#define ANOMALY_05000435 (0) 175#define ANOMALY_05000435 (0)
176#define ANOMALY_05000447 (0)
177#define ANOMALY_05000448 (0)
175 178
176#endif 179#endif
diff --git a/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
index b3f87e1d16a2..9e34700844a2 100644
--- a/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
@@ -144,7 +144,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
144 CH_UART0_TX, 144 CH_UART0_TX,
145 CH_UART0_RX, 145 CH_UART0_RX,
146#endif 146#endif
147#ifdef CONFIG_BFIN_UART0_CTSRTS 147#ifdef CONFIG_SERIAL_BFIN_CTSRTS
148 CONFIG_UART0_CTS_PIN, 148 CONFIG_UART0_CTS_PIN,
149 CONFIG_UART0_RTS_PIN, 149 CONFIG_UART0_RTS_PIN,
150#endif 150#endif
@@ -158,7 +158,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
158 CH_UART1_TX, 158 CH_UART1_TX,
159 CH_UART1_RX, 159 CH_UART1_RX,
160#endif 160#endif
161#ifdef CONFIG_BFIN_UART1_CTSRTS 161#ifdef CONFIG_SERIAL_BFIN_CTSRTS
162 CONFIG_UART1_CTS_PIN, 162 CONFIG_UART1_CTS_PIN,
163 CONFIG_UART1_RTS_PIN, 163 CONFIG_UART1_RTS_PIN,
164#endif 164#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/anomaly.h b/arch/blackfin/mach-bf538/include/mach/anomaly.h
index e130b4f8a05d..3a5699827363 100644
--- a/arch/blackfin/mach-bf538/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf538/include/mach/anomaly.h
@@ -2,7 +2,7 @@
2 * File: include/asm-blackfin/mach-bf538/anomaly.h 2 * File: include/asm-blackfin/mach-bf538/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -120,13 +120,17 @@
120#define ANOMALY_05000198 (0) 120#define ANOMALY_05000198 (0)
121#define ANOMALY_05000230 (0) 121#define ANOMALY_05000230 (0)
122#define ANOMALY_05000263 (0) 122#define ANOMALY_05000263 (0)
123#define ANOMALY_05000305 (0)
123#define ANOMALY_05000311 (0) 124#define ANOMALY_05000311 (0)
124#define ANOMALY_05000323 (0) 125#define ANOMALY_05000323 (0)
125#define ANOMALY_05000353 (1) 126#define ANOMALY_05000353 (1)
126#define ANOMALY_05000363 (0) 127#define ANOMALY_05000363 (0)
128#define ANOMALY_05000380 (0)
127#define ANOMALY_05000386 (1) 129#define ANOMALY_05000386 (1)
128#define ANOMALY_05000412 (0) 130#define ANOMALY_05000412 (0)
129#define ANOMALY_05000432 (0) 131#define ANOMALY_05000432 (0)
130#define ANOMALY_05000435 (0) 132#define ANOMALY_05000435 (0)
133#define ANOMALY_05000447 (0)
134#define ANOMALY_05000448 (0)
131 135
132#endif 136#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
index 40503b6b89a3..3c2811ebecdd 100644
--- a/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
@@ -144,7 +144,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
144 CH_UART0_TX, 144 CH_UART0_TX,
145 CH_UART0_RX, 145 CH_UART0_RX,
146#endif 146#endif
147#ifdef CONFIG_BFIN_UART0_CTSRTS 147#ifdef CONFIG_SERIAL_BFIN_CTSRTS
148 CONFIG_UART0_CTS_PIN, 148 CONFIG_UART0_CTS_PIN,
149 CONFIG_UART0_RTS_PIN, 149 CONFIG_UART0_RTS_PIN,
150#endif 150#endif
@@ -158,7 +158,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
158 CH_UART1_TX, 158 CH_UART1_TX,
159 CH_UART1_RX, 159 CH_UART1_RX,
160#endif 160#endif
161#ifdef CONFIG_BFIN_UART1_CTSRTS 161#ifdef CONFIG_SERIAL_BFIN_CTSRTS
162 CONFIG_UART1_CTS_PIN, 162 CONFIG_UART1_CTS_PIN,
163 CONFIG_UART1_RTS_PIN, 163 CONFIG_UART1_RTS_PIN,
164#endif 164#endif
diff --git a/arch/blackfin/mach-bf548/include/mach/anomaly.h b/arch/blackfin/mach-bf548/include/mach/anomaly.h
index 23d03c52f4b4..882e40ccf0d1 100644
--- a/arch/blackfin/mach-bf548/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf548/include/mach/anomaly.h
@@ -2,12 +2,12 @@
2 * File: include/asm-blackfin/mach-bf548/anomaly.h 2 * File: include/asm-blackfin/mach-bf548/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
9/* This file shoule be up to date with: 9/* This file shoule be up to date with:
10 * - Revision G, 08/07/2008; ADSP-BF542/BF544/BF547/BF548/BF549 Blackfin Processor Anomaly List 10 * - Revision H, 01/16/2009; ADSP-BF542/BF544/BF547/BF548/BF549 Blackfin Processor Anomaly List
11 */ 11 */
12 12
13#ifndef _MACH_ANOMALY_H_ 13#ifndef _MACH_ANOMALY_H_
@@ -91,8 +91,6 @@
91#define ANOMALY_05000371 (__SILICON_REVISION__ < 2) 91#define ANOMALY_05000371 (__SILICON_REVISION__ < 2)
92/* USB DP/DM Data Pins May Lose State When Entering Hibernate */ 92/* USB DP/DM Data Pins May Lose State When Entering Hibernate */
93#define ANOMALY_05000372 (__SILICON_REVISION__ < 1) 93#define ANOMALY_05000372 (__SILICON_REVISION__ < 1)
94/* Mobile DDR Operation Not Functional */
95#define ANOMALY_05000377 (1)
96/* Security/Authentication Speedpath Causes Authentication To Fail To Initiate */ 94/* Security/Authentication Speedpath Causes Authentication To Fail To Initiate */
97#define ANOMALY_05000378 (__SILICON_REVISION__ < 2) 95#define ANOMALY_05000378 (__SILICON_REVISION__ < 2)
98/* 16-Bit NAND FLASH Boot Mode Is Not Functional */ 96/* 16-Bit NAND FLASH Boot Mode Is Not Functional */
@@ -157,8 +155,22 @@
157#define ANOMALY_05000429 (__SILICON_REVISION__ < 2) 155#define ANOMALY_05000429 (__SILICON_REVISION__ < 2)
158/* Software System Reset Corrupts PLL_LOCKCNT Register */ 156/* Software System Reset Corrupts PLL_LOCKCNT Register */
159#define ANOMALY_05000430 (__SILICON_REVISION__ >= 2) 157#define ANOMALY_05000430 (__SILICON_REVISION__ >= 2)
158/* Incorrect Use of Stack in Lockbox Firmware During Authentication */
159#define ANOMALY_05000431 (__SILICON_REVISION__ < 3)
160/* OTP Write Accesses Not Supported */
161#define ANOMALY_05000442 (__SILICON_REVISION__ < 1)
160/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */ 162/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
161#define ANOMALY_05000443 (1) 163#define ANOMALY_05000443 (1)
164/* CDMAPRIO and L2DMAPRIO Bits in the SYSCR Register Are Not Functional */
165#define ANOMALY_05000446 (1)
166/* UART IrDA Receiver Fails on Extended Bit Pulses */
167#define ANOMALY_05000447 (1)
168/* DDR Clock Duty Cycle Spec Violation (tCH, tCL) */
169#define ANOMALY_05000448 (__SILICON_REVISION__ == 1)
170/* Reduced Timing Margins on DDR Output Setup and Hold (tDS and tDH) */
171#define ANOMALY_05000449 (__SILICON_REVISION__ == 1)
172/* USB DMA Mode 1 Short Packet Data Corruption */
173#define ANOMALY_05000450 (1
162 174
163/* Anomalies that don't exist on this proc */ 175/* Anomalies that don't exist on this proc */
164#define ANOMALY_05000125 (0) 176#define ANOMALY_05000125 (0)
@@ -171,6 +183,8 @@
171#define ANOMALY_05000263 (0) 183#define ANOMALY_05000263 (0)
172#define ANOMALY_05000266 (0) 184#define ANOMALY_05000266 (0)
173#define ANOMALY_05000273 (0) 185#define ANOMALY_05000273 (0)
186#define ANOMALY_05000278 (0)
187#define ANOMALY_05000305 (0)
174#define ANOMALY_05000307 (0) 188#define ANOMALY_05000307 (0)
175#define ANOMALY_05000311 (0) 189#define ANOMALY_05000311 (0)
176#define ANOMALY_05000323 (0) 190#define ANOMALY_05000323 (0)
diff --git a/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
index e4cf35e7ab9f..c05e79cba257 100644
--- a/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
@@ -63,7 +63,7 @@
63#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v) 63#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v)
64#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF) 64#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF)
65 65
66#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 66#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART2_CTSRTS)
67# define CONFIG_SERIAL_BFIN_CTSRTS 67# define CONFIG_SERIAL_BFIN_CTSRTS
68 68
69# ifndef CONFIG_UART0_CTS_PIN 69# ifndef CONFIG_UART0_CTS_PIN
@@ -74,12 +74,12 @@
74# define CONFIG_UART0_RTS_PIN -1 74# define CONFIG_UART0_RTS_PIN -1
75# endif 75# endif
76 76
77# ifndef CONFIG_UART1_CTS_PIN 77# ifndef CONFIG_UART2_CTS_PIN
78# define CONFIG_UART1_CTS_PIN -1 78# define CONFIG_UART2_CTS_PIN -1
79# endif 79# endif
80 80
81# ifndef CONFIG_UART1_RTS_PIN 81# ifndef CONFIG_UART2_RTS_PIN
82# define CONFIG_UART1_RTS_PIN -1 82# define CONFIG_UART2_RTS_PIN -1
83# endif 83# endif
84#endif 84#endif
85 85
@@ -130,7 +130,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
130 CH_UART0_TX, 130 CH_UART0_TX,
131 CH_UART0_RX, 131 CH_UART0_RX,
132#endif 132#endif
133#ifdef CONFIG_BFIN_UART0_CTSRTS 133#ifdef CONFIG_SERIAL_BFIN_CTSRTS
134 CONFIG_UART0_CTS_PIN, 134 CONFIG_UART0_CTS_PIN,
135 CONFIG_UART0_RTS_PIN, 135 CONFIG_UART0_RTS_PIN,
136#endif 136#endif
@@ -144,6 +144,10 @@ struct bfin_serial_res bfin_serial_resource[] = {
144 CH_UART1_TX, 144 CH_UART1_TX,
145 CH_UART1_RX, 145 CH_UART1_RX,
146#endif 146#endif
147#ifdef CONFIG_SERIAL_BFIN_CTSRTS
148 0,
149 0,
150#endif
147 }, 151 },
148#endif 152#endif
149#ifdef CONFIG_SERIAL_BFIN_UART2 153#ifdef CONFIG_SERIAL_BFIN_UART2
@@ -154,7 +158,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
154 CH_UART2_TX, 158 CH_UART2_TX,
155 CH_UART2_RX, 159 CH_UART2_RX,
156#endif 160#endif
157#ifdef CONFIG_BFIN_UART2_CTSRTS 161#ifdef CONFIG_SERIAL_BFIN_CTSRTS
158 CONFIG_UART2_CTS_PIN, 162 CONFIG_UART2_CTS_PIN,
159 CONFIG_UART2_RTS_PIN, 163 CONFIG_UART2_RTS_PIN,
160#endif 164#endif
@@ -168,6 +172,10 @@ struct bfin_serial_res bfin_serial_resource[] = {
168 CH_UART3_TX, 172 CH_UART3_TX,
169 CH_UART3_RX, 173 CH_UART3_RX,
170#endif 174#endif
175#ifdef CONFIG_SERIAL_BFIN_CTSRTS
176 0,
177 0,
178#endif
171 }, 179 },
172#endif 180#endif
173}; 181};
diff --git a/arch/blackfin/mach-bf548/include/mach/irq.h b/arch/blackfin/mach-bf548/include/mach/irq.h
index 60299a71e090..f194625f6821 100644
--- a/arch/blackfin/mach-bf548/include/mach/irq.h
+++ b/arch/blackfin/mach-bf548/include/mach/irq.h
@@ -123,8 +123,8 @@ Events (highest priority) EMU 0
123#define IRQ_MXVR_ERROR BFIN_IRQ(51) /* MXVR Status (Error) Interrupt */ 123#define IRQ_MXVR_ERROR BFIN_IRQ(51) /* MXVR Status (Error) Interrupt */
124#define IRQ_MXVR_MSG BFIN_IRQ(52) /* MXVR Message Interrupt */ 124#define IRQ_MXVR_MSG BFIN_IRQ(52) /* MXVR Message Interrupt */
125#define IRQ_MXVR_PKT BFIN_IRQ(53) /* MXVR Packet Interrupt */ 125#define IRQ_MXVR_PKT BFIN_IRQ(53) /* MXVR Packet Interrupt */
126#define IRQ_EPP1_ERROR BFIN_IRQ(54) /* EPPI1 Error Interrupt */ 126#define IRQ_EPPI1_ERROR BFIN_IRQ(54) /* EPPI1 Error Interrupt */
127#define IRQ_EPP2_ERROR BFIN_IRQ(55) /* EPPI2 Error Interrupt */ 127#define IRQ_EPPI2_ERROR BFIN_IRQ(55) /* EPPI2 Error Interrupt */
128#define IRQ_UART3_ERROR BFIN_IRQ(56) /* UART3 Status (Error) Interrupt */ 128#define IRQ_UART3_ERROR BFIN_IRQ(56) /* UART3 Status (Error) Interrupt */
129#define IRQ_HOST_ERROR BFIN_IRQ(57) /* HOST Status (Error) Interrupt */ 129#define IRQ_HOST_ERROR BFIN_IRQ(57) /* HOST Status (Error) Interrupt */
130#define IRQ_PIXC_ERROR BFIN_IRQ(59) /* PIXC Status (Error) Interrupt */ 130#define IRQ_PIXC_ERROR BFIN_IRQ(59) /* PIXC Status (Error) Interrupt */
@@ -361,8 +361,8 @@ Events (highest priority) EMU 0
361#define IRQ_UART2_ERR IRQ_UART2_ERROR 361#define IRQ_UART2_ERR IRQ_UART2_ERROR
362#define IRQ_CAN0_ERR IRQ_CAN0_ERROR 362#define IRQ_CAN0_ERR IRQ_CAN0_ERROR
363#define IRQ_MXVR_ERR IRQ_MXVR_ERROR 363#define IRQ_MXVR_ERR IRQ_MXVR_ERROR
364#define IRQ_EPP1_ERR IRQ_EPP1_ERROR 364#define IRQ_EPPI1_ERR IRQ_EPPI1_ERROR
365#define IRQ_EPP2_ERR IRQ_EPP2_ERROR 365#define IRQ_EPPI2_ERR IRQ_EPPI2_ERROR
366#define IRQ_UART3_ERR IRQ_UART3_ERROR 366#define IRQ_UART3_ERR IRQ_UART3_ERROR
367#define IRQ_HOST_ERR IRQ_HOST_ERROR 367#define IRQ_HOST_ERR IRQ_HOST_ERROR
368#define IRQ_PIXC_ERR IRQ_PIXC_ERROR 368#define IRQ_PIXC_ERR IRQ_PIXC_ERROR
diff --git a/arch/blackfin/mach-bf561/boards/Kconfig b/arch/blackfin/mach-bf561/boards/Kconfig
index e41a67b1fb53..e4bc6d7c5a6a 100644
--- a/arch/blackfin/mach-bf561/boards/Kconfig
+++ b/arch/blackfin/mach-bf561/boards/Kconfig
@@ -19,9 +19,4 @@ config BFIN561_BLUETECHNIX_CM
19 help 19 help
20 CM-BF561 support for EVAL- and DEV-Board. 20 CM-BF561 support for EVAL- and DEV-Board.
21 21
22config GENERIC_BF561_BOARD
23 bool "Generic"
24 help
25 Generic or Custom board support.
26
27endchoice 22endchoice
diff --git a/arch/blackfin/mach-bf561/boards/Makefile b/arch/blackfin/mach-bf561/boards/Makefile
index 04add010b568..3a152559e957 100644
--- a/arch/blackfin/mach-bf561/boards/Makefile
+++ b/arch/blackfin/mach-bf561/boards/Makefile
@@ -2,7 +2,6 @@
2# arch/blackfin/mach-bf561/boards/Makefile 2# arch/blackfin/mach-bf561/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BF561_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN561_BLUETECHNIX_CM) += cm_bf561.o 5obj-$(CONFIG_BFIN561_BLUETECHNIX_CM) += cm_bf561.o
7obj-$(CONFIG_BFIN561_EZKIT) += ezkit.o 6obj-$(CONFIG_BFIN561_EZKIT) += ezkit.o
8obj-$(CONFIG_BFIN561_TEPLA) += tepla.o 7obj-$(CONFIG_BFIN561_TEPLA) += tepla.o
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 6880d1ebfe60..f623c6b0719f 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -105,9 +105,9 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
105}; 105};
106#endif 106#endif
107 107
108#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 108#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
109static struct bfin5xx_spi_chip spi_mmc_chip_info = { 109static struct bfin5xx_spi_chip mmc_spi_chip_info = {
110 .enable_dma = 1, 110 .enable_dma = 0,
111 .bits_per_word = 8, 111 .bits_per_word = 8,
112}; 112};
113#endif 113#endif
@@ -155,14 +155,13 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
155 .controller_data = &ad9960_spi_chip_info, 155 .controller_data = &ad9960_spi_chip_info,
156 }, 156 },
157#endif 157#endif
158#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 158#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
159 { 159 {
160 .modalias = "spi_mmc", 160 .modalias = "mmc_spi",
161 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 161 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
162 .bus_num = 0, 162 .bus_num = 0,
163 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 163 .chip_select = 5,
164 .platform_data = NULL, 164 .controller_data = &mmc_spi_chip_info,
165 .controller_data = &spi_mmc_chip_info,
166 .mode = SPI_MODE_3, 165 .mode = SPI_MODE_3,
167 }, 166 },
168#endif 167#endif
diff --git a/arch/blackfin/mach-bf561/boards/generic_board.c b/arch/blackfin/mach-bf561/boards/generic_board.c
deleted file mode 100644
index 0ba366a0e696..000000000000
--- a/arch/blackfin/mach-bf561/boards/generic_board.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf561/generic_board.c
3 * Based on: arch/blackfin/mach-bf533/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/irq.h>
34
35const char bfin_board_name[] = "UNKNOWN BOARD";
36
37/*
38 * Driver needs to know address, irq and flag pin.
39 */
40#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
41static struct resource smc91x_resources[] = {
42 {
43 .start = 0x2C010300,
44 .end = 0x2C010300 + 16,
45 .flags = IORESOURCE_MEM,
46 }, {
47 .start = IRQ_PROG_INTB,
48 .end = IRQ_PROG_INTB,
49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
50 }, {
51 .start = IRQ_PF9,
52 .end = IRQ_PF9,
53 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
54 },
55};
56
57static struct platform_device smc91x_device = {
58 .name = "smc91x",
59 .id = 0,
60 .num_resources = ARRAY_SIZE(smc91x_resources),
61 .resource = smc91x_resources,
62};
63#endif
64
65#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
66#ifdef CONFIG_BFIN_SIR0
67static struct resource bfin_sir0_resources[] = {
68 {
69 .start = 0xFFC00400,
70 .end = 0xFFC004FF,
71 .flags = IORESOURCE_MEM,
72 },
73 {
74 .start = IRQ_UART0_RX,
75 .end = IRQ_UART0_RX+1,
76 .flags = IORESOURCE_IRQ,
77 },
78 {
79 .start = CH_UART0_RX,
80 .end = CH_UART0_RX+1,
81 .flags = IORESOURCE_DMA,
82 },
83};
84
85static struct platform_device bfin_sir0_device = {
86 .name = "bfin_sir",
87 .id = 0,
88 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
89 .resource = bfin_sir0_resources,
90};
91#endif
92#endif
93
94static struct platform_device *generic_board_devices[] __initdata = {
95#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
96 &smc91x_device,
97#endif
98
99#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
100#ifdef CONFIG_BFIN_SIR0
101 &bfin_sir0_device,
102#endif
103#endif
104};
105
106static int __init generic_board_init(void)
107{
108 printk(KERN_INFO "%s(): registering device resources\n", __func__);
109 return platform_add_devices(generic_board_devices,
110 ARRAY_SIZE(generic_board_devices));
111}
112
113arch_initcall(generic_board_init);
diff --git a/arch/blackfin/mach-bf561/include/mach/anomaly.h b/arch/blackfin/mach-bf561/include/mach/anomaly.h
index 1a9e17562821..d0b0b3506440 100644
--- a/arch/blackfin/mach-bf561/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf561/include/mach/anomaly.h
@@ -2,7 +2,7 @@
2 * File: include/asm-blackfin/mach-bf561/anomaly.h 2 * File: include/asm-blackfin/mach-bf561/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 * 4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc. 5 * Copyright (C) 2004-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -224,7 +224,7 @@
224#define ANOMALY_05000301 (1) 224#define ANOMALY_05000301 (1)
225/* SSYNCs After Writes To DMA MMR Registers May Not Be Handled Correctly */ 225/* SSYNCs After Writes To DMA MMR Registers May Not Be Handled Correctly */
226#define ANOMALY_05000302 (1) 226#define ANOMALY_05000302 (1)
227/* New Feature: Additional Hysteresis on SPORT Input Pins (Not Available On Older Silicon) */ 227/* SPORT_HYS Bit in PLL_CTL Register Is Not Functional */
228#define ANOMALY_05000305 (__SILICON_REVISION__ < 5) 228#define ANOMALY_05000305 (__SILICON_REVISION__ < 5)
229/* SCKELOW Bit Does Not Maintain State Through Hibernate */ 229/* SCKELOW Bit Does Not Maintain State Through Hibernate */
230#define ANOMALY_05000307 (__SILICON_REVISION__ < 5) 230#define ANOMALY_05000307 (__SILICON_REVISION__ < 5)
@@ -283,8 +283,11 @@
283#define ANOMALY_05000273 (0) 283#define ANOMALY_05000273 (0)
284#define ANOMALY_05000311 (0) 284#define ANOMALY_05000311 (0)
285#define ANOMALY_05000353 (1) 285#define ANOMALY_05000353 (1)
286#define ANOMALY_05000380 (0)
286#define ANOMALY_05000386 (1) 287#define ANOMALY_05000386 (1)
287#define ANOMALY_05000432 (0) 288#define ANOMALY_05000432 (0)
288#define ANOMALY_05000435 (0) 289#define ANOMALY_05000435 (0)
290#define ANOMALY_05000447 (0)
291#define ANOMALY_05000448 (0)
289 292
290#endif 293#endif
diff --git a/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
index 043bfcf26c52..ca8c5f645209 100644
--- a/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
@@ -134,7 +134,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
134 CH_UART_TX, 134 CH_UART_TX,
135 CH_UART_RX, 135 CH_UART_RX,
136#endif 136#endif
137#ifdef CONFIG_BFIN_UART0_CTSRTS 137#ifdef CONFIG_SERIAL_BFIN_CTSRTS
138 CONFIG_UART0_CTS_PIN, 138 CONFIG_UART0_CTS_PIN,
139 CONFIG_UART0_RTS_PIN, 139 CONFIG_UART0_RTS_PIN,
140#endif 140#endif
diff --git a/arch/blackfin/mach-common/arch_checks.c b/arch/blackfin/mach-common/arch_checks.c
index 98133b968f7b..80d39b2f9db2 100644
--- a/arch/blackfin/mach-common/arch_checks.c
+++ b/arch/blackfin/mach-common/arch_checks.c
@@ -62,3 +62,12 @@
62#if (CONFIG_BOOT_LOAD & 0x3) 62#if (CONFIG_BOOT_LOAD & 0x3)
63# error "The kernel load address must be 4 byte aligned" 63# error "The kernel load address must be 4 byte aligned"
64#endif 64#endif
65
66/* The entire kernel must be able to make a 24bit pcrel call to start of L1 */
67#if ((0xffffffff - L1_CODE_START + 1) + CONFIG_BOOT_LOAD) > 0x1000000
68# error "The kernel load address is too high; keep it below 10meg for safety"
69#endif
70
71#if ANOMALY_05000448
72# error You are using a part with anomaly 05000448, this issue causes random memory read/write failures - that means random crashes.
73#endif
diff --git a/arch/blackfin/mach-common/cache.S b/arch/blackfin/mach-common/cache.S
index 3c98dacbf289..aa0648c6a9fe 100644
--- a/arch/blackfin/mach-common/cache.S
+++ b/arch/blackfin/mach-common/cache.S
@@ -66,11 +66,33 @@
66 66
67/* Invalidate all instruction cache lines assocoiated with this memory area */ 67/* Invalidate all instruction cache lines assocoiated with this memory area */
68ENTRY(_blackfin_icache_flush_range) 68ENTRY(_blackfin_icache_flush_range)
69/*
70 * Walkaround to avoid loading wrong instruction after invalidating icache
71 * and following sequence is met.
72 *
73 * 1) One instruction address is cached in the instruction cache.
74 * 2) This instruction in SDRAM is changed.
75 * 3) IFLASH[P0] is executed only once in blackfin_icache_flush_range().
76 * 4) This instruction is executed again, but the old one is loaded.
77 */
78 P0 = R0;
79 IFLUSH[P0];
69 do_flush IFLUSH, , nop 80 do_flush IFLUSH, , nop
70ENDPROC(_blackfin_icache_flush_range) 81ENDPROC(_blackfin_icache_flush_range)
71 82
72/* Flush all cache lines assocoiated with this area of memory. */ 83/* Flush all cache lines assocoiated with this area of memory. */
73ENTRY(_blackfin_icache_dcache_flush_range) 84ENTRY(_blackfin_icache_dcache_flush_range)
85/*
86 * Walkaround to avoid loading wrong instruction after invalidating icache
87 * and following sequence is met.
88 *
89 * 1) One instruction address is cached in the instruction cache.
90 * 2) This instruction in SDRAM is changed.
91 * 3) IFLASH[P0] is executed only once in blackfin_icache_flush_range().
92 * 4) This instruction is executed again, but the old one is loaded.
93 */
94 P0 = R0;
95 IFLUSH[P0];
74 do_flush FLUSH, IFLUSH 96 do_flush FLUSH, IFLUSH
75ENDPROC(_blackfin_icache_dcache_flush_range) 97ENDPROC(_blackfin_icache_dcache_flush_range)
76 98
diff --git a/arch/blackfin/mach-common/clocks-init.c b/arch/blackfin/mach-common/clocks-init.c
index 9dddb6f8cc85..35393651359b 100644
--- a/arch/blackfin/mach-common/clocks-init.c
+++ b/arch/blackfin/mach-common/clocks-init.c
@@ -17,7 +17,7 @@
17#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */ 17#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */
18#define PLL_CTL_VAL \ 18#define PLL_CTL_VAL \
19 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \ 19 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \
20 (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0)) 20 (PLL_BYPASS << 8) | (ANOMALY_05000305 ? 0 : 0x8000))
21 21
22__attribute__((l1_text)) 22__attribute__((l1_text))
23static void do_sync(void) 23static void do_sync(void)
diff --git a/arch/blackfin/mach-common/dpmc_modes.S b/arch/blackfin/mach-common/dpmc_modes.S
index 4da50bcd9300..8009a512fb11 100644
--- a/arch/blackfin/mach-common/dpmc_modes.S
+++ b/arch/blackfin/mach-common/dpmc_modes.S
@@ -376,10 +376,22 @@ ENTRY(_do_hibernate)
376#endif 376#endif
377 377
378#ifdef PINT0_ASSIGN 378#ifdef PINT0_ASSIGN
379 PM_SYS_PUSH(PINT0_MASK_SET)
380 PM_SYS_PUSH(PINT1_MASK_SET)
381 PM_SYS_PUSH(PINT2_MASK_SET)
382 PM_SYS_PUSH(PINT3_MASK_SET)
379 PM_SYS_PUSH(PINT0_ASSIGN) 383 PM_SYS_PUSH(PINT0_ASSIGN)
380 PM_SYS_PUSH(PINT1_ASSIGN) 384 PM_SYS_PUSH(PINT1_ASSIGN)
381 PM_SYS_PUSH(PINT2_ASSIGN) 385 PM_SYS_PUSH(PINT2_ASSIGN)
382 PM_SYS_PUSH(PINT3_ASSIGN) 386 PM_SYS_PUSH(PINT3_ASSIGN)
387 PM_SYS_PUSH(PINT0_INVERT_SET)
388 PM_SYS_PUSH(PINT1_INVERT_SET)
389 PM_SYS_PUSH(PINT2_INVERT_SET)
390 PM_SYS_PUSH(PINT3_INVERT_SET)
391 PM_SYS_PUSH(PINT0_EDGE_SET)
392 PM_SYS_PUSH(PINT1_EDGE_SET)
393 PM_SYS_PUSH(PINT2_EDGE_SET)
394 PM_SYS_PUSH(PINT3_EDGE_SET)
383#endif 395#endif
384 396
385 PM_SYS_PUSH(EBIU_AMBCTL0) 397 PM_SYS_PUSH(EBIU_AMBCTL0)
@@ -714,10 +726,22 @@ ENTRY(_do_hibernate)
714 PM_SYS_POP(EBIU_AMBCTL0) 726 PM_SYS_POP(EBIU_AMBCTL0)
715 727
716#ifdef PINT0_ASSIGN 728#ifdef PINT0_ASSIGN
729 PM_SYS_POP(PINT3_EDGE_SET)
730 PM_SYS_POP(PINT2_EDGE_SET)
731 PM_SYS_POP(PINT1_EDGE_SET)
732 PM_SYS_POP(PINT0_EDGE_SET)
733 PM_SYS_POP(PINT3_INVERT_SET)
734 PM_SYS_POP(PINT2_INVERT_SET)
735 PM_SYS_POP(PINT1_INVERT_SET)
736 PM_SYS_POP(PINT0_INVERT_SET)
717 PM_SYS_POP(PINT3_ASSIGN) 737 PM_SYS_POP(PINT3_ASSIGN)
718 PM_SYS_POP(PINT2_ASSIGN) 738 PM_SYS_POP(PINT2_ASSIGN)
719 PM_SYS_POP(PINT1_ASSIGN) 739 PM_SYS_POP(PINT1_ASSIGN)
720 PM_SYS_POP(PINT0_ASSIGN) 740 PM_SYS_POP(PINT0_ASSIGN)
741 PM_SYS_POP(PINT3_MASK_SET)
742 PM_SYS_POP(PINT2_MASK_SET)
743 PM_SYS_POP(PINT1_MASK_SET)
744 PM_SYS_POP(PINT0_MASK_SET)
721#endif 745#endif
722 746
723#ifdef SICA_IWR1 747#ifdef SICA_IWR1
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 88de053bbe8e..21e65a339a22 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -600,6 +600,19 @@ ENTRY(_system_call)
600 p2 = [p2]; 600 p2 = [p2];
601 601
602 [p2+(TASK_THREAD+THREAD_KSP)] = sp; 602 [p2+(TASK_THREAD+THREAD_KSP)] = sp;
603#ifdef CONFIG_IPIPE
604 r0 = sp;
605 SP += -12;
606 call ___ipipe_syscall_root;
607 SP += 12;
608 cc = r0 == 1;
609 if cc jump .Lsyscall_really_exit;
610 cc = r0 == -1;
611 if cc jump .Lresume_userspace;
612 r3 = [sp + PT_R3];
613 r4 = [sp + PT_R4];
614 p0 = [sp + PT_ORIG_P0];
615#endif /* CONFIG_IPIPE */
603 616
604 /* Check the System Call */ 617 /* Check the System Call */
605 r7 = __NR_syscall; 618 r7 = __NR_syscall;
@@ -654,6 +667,17 @@ ENTRY(_system_call)
654 r7 = r7 & r4; 667 r7 = r7 & r4;
655 668
656.Lsyscall_resched: 669.Lsyscall_resched:
670#ifdef CONFIG_IPIPE
671 cc = BITTST(r7, TIF_IRQ_SYNC);
672 if !cc jump .Lsyscall_no_irqsync;
673 [--sp] = reti;
674 r0 = [sp++];
675 SP += -12;
676 call ___ipipe_sync_root;
677 SP += 12;
678 jump .Lresume_userspace_1;
679.Lsyscall_no_irqsync:
680#endif
657 cc = BITTST(r7, TIF_NEED_RESCHED); 681 cc = BITTST(r7, TIF_NEED_RESCHED);
658 if !cc jump .Lsyscall_sigpending; 682 if !cc jump .Lsyscall_sigpending;
659 683
@@ -685,6 +709,10 @@ ENTRY(_system_call)
685.Lsyscall_really_exit: 709.Lsyscall_really_exit:
686 r5 = [sp + PT_RESERVED]; 710 r5 = [sp + PT_RESERVED];
687 rets = r5; 711 rets = r5;
712#ifdef CONFIG_IPIPE
713 [--sp] = reti;
714 r5 = [sp++];
715#endif /* CONFIG_IPIPE */
688 rts; 716 rts;
689ENDPROC(_system_call) 717ENDPROC(_system_call)
690 718
@@ -771,6 +799,15 @@ _new_old_task:
771ENDPROC(_resume) 799ENDPROC(_resume)
772 800
773ENTRY(_ret_from_exception) 801ENTRY(_ret_from_exception)
802#ifdef CONFIG_IPIPE
803 [--sp] = rets;
804 SP += -12;
805 call ___ipipe_check_root
806 SP += 12
807 rets = [sp++];
808 cc = r0 == 0;
809 if cc jump 4f; /* not on behalf of Linux, get out */
810#endif /* CONFIG_IPIPE */
774 p2.l = lo(IPEND); 811 p2.l = lo(IPEND);
775 p2.h = hi(IPEND); 812 p2.h = hi(IPEND);
776 813
@@ -827,6 +864,28 @@ ENTRY(_ret_from_exception)
827 rts; 864 rts;
828ENDPROC(_ret_from_exception) 865ENDPROC(_ret_from_exception)
829 866
867#ifdef CONFIG_IPIPE
868
869_sync_root_irqs:
870 [--sp] = reti; /* Reenable interrupts */
871 r0 = [sp++];
872 jump.l ___ipipe_sync_root
873
874_resume_kernel_from_int:
875 r0.l = _sync_root_irqs
876 r0.h = _sync_root_irqs
877 [--sp] = rets;
878 [--sp] = ( r7:4, p5:3 );
879 SP += -12;
880 call ___ipipe_call_irqtail
881 SP += 12;
882 ( r7:4, p5:3 ) = [sp++];
883 rets = [sp++];
884 rts
885#else
886#define _resume_kernel_from_int 2f
887#endif
888
830ENTRY(_return_from_int) 889ENTRY(_return_from_int)
831 /* If someone else already raised IRQ 15, do nothing. */ 890 /* If someone else already raised IRQ 15, do nothing. */
832 csync; 891 csync;
@@ -848,7 +907,7 @@ ENTRY(_return_from_int)
848 r1 = r0 - r1; 907 r1 = r0 - r1;
849 r2 = r0 & r1; 908 r2 = r0 & r1;
850 cc = r2 == 0; 909 cc = r2 == 0;
851 if !cc jump 2f; 910 if !cc jump _resume_kernel_from_int;
852 911
853 /* Lower the interrupt level to 15. */ 912 /* Lower the interrupt level to 15. */
854 p0.l = lo(EVT15); 913 p0.l = lo(EVT15);
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index 43c4eb9acb65..0069c2dd4625 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -235,6 +235,7 @@ ENDPROC(_evt_system_call)
235 235
236#ifdef CONFIG_IPIPE 236#ifdef CONFIG_IPIPE
237ENTRY(___ipipe_call_irqtail) 237ENTRY(___ipipe_call_irqtail)
238 p0 = r0;
238 r0.l = 1f; 239 r0.l = 1f;
239 r0.h = 1f; 240 r0.h = 1f;
240 reti = r0; 241 reti = r0;
@@ -242,9 +243,6 @@ ENTRY(___ipipe_call_irqtail)
2421: 2431:
243 [--sp] = rets; 244 [--sp] = rets;
244 [--sp] = ( r7:4, p5:3 ); 245 [--sp] = ( r7:4, p5:3 );
245 p0.l = ___ipipe_irq_tail_hook;
246 p0.h = ___ipipe_irq_tail_hook;
247 p0 = [p0];
248 sp += -12; 246 sp += -12;
249 call (p0); 247 call (p0);
250 sp += 12; 248 sp += 12;
@@ -259,7 +257,7 @@ ENTRY(___ipipe_call_irqtail)
259 p0.h = hi(EVT14); 257 p0.h = hi(EVT14);
260 [p0] = r0; 258 [p0] = r0;
261 csync; 259 csync;
262 r0 = 0x401f; 260 r0 = 0x401f (z);
263 sti r0; 261 sti r0;
264 raise 14; 262 raise 14;
265 [--sp] = reti; /* IRQs on. */ 263 [--sp] = reti; /* IRQs on. */
@@ -277,11 +275,7 @@ ENTRY(___ipipe_call_irqtail)
277 p0.h = _bfin_irq_flags; 275 p0.h = _bfin_irq_flags;
278 r0 = [p0]; 276 r0 = [p0];
279 sti r0; 277 sti r0;
280#if 0 /* FIXME: this actually raises scheduling latencies */
281 /* Reenable interrupts */
282 [--sp] = reti;
283 r0 = [sp++];
284#endif
285 rts; 278 rts;
286ENDPROC(___ipipe_call_irqtail) 279ENDPROC(___ipipe_call_irqtail)
280
287#endif /* CONFIG_IPIPE */ 281#endif /* CONFIG_IPIPE */
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 202494568c6c..a7d7b2dd4059 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -161,11 +161,15 @@ static void bfin_core_unmask_irq(unsigned int irq)
161 161
162static void bfin_internal_mask_irq(unsigned int irq) 162static void bfin_internal_mask_irq(unsigned int irq)
163{ 163{
164 unsigned long flags;
165
164#ifdef CONFIG_BF53x 166#ifdef CONFIG_BF53x
167 local_irq_save_hw(flags);
165 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & 168 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
166 ~(1 << SIC_SYSIRQ(irq))); 169 ~(1 << SIC_SYSIRQ(irq)));
167#else 170#else
168 unsigned mask_bank, mask_bit; 171 unsigned mask_bank, mask_bit;
172 local_irq_save_hw(flags);
169 mask_bank = SIC_SYSIRQ(irq) / 32; 173 mask_bank = SIC_SYSIRQ(irq) / 32;
170 mask_bit = SIC_SYSIRQ(irq) % 32; 174 mask_bit = SIC_SYSIRQ(irq) % 32;
171 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & 175 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) &
@@ -175,15 +179,20 @@ static void bfin_internal_mask_irq(unsigned int irq)
175 ~(1 << mask_bit)); 179 ~(1 << mask_bit));
176#endif 180#endif
177#endif 181#endif
182 local_irq_restore_hw(flags);
178} 183}
179 184
180static void bfin_internal_unmask_irq(unsigned int irq) 185static void bfin_internal_unmask_irq(unsigned int irq)
181{ 186{
187 unsigned long flags;
188
182#ifdef CONFIG_BF53x 189#ifdef CONFIG_BF53x
190 local_irq_save_hw(flags);
183 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 191 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() |
184 (1 << SIC_SYSIRQ(irq))); 192 (1 << SIC_SYSIRQ(irq)));
185#else 193#else
186 unsigned mask_bank, mask_bit; 194 unsigned mask_bank, mask_bit;
195 local_irq_save_hw(flags);
187 mask_bank = SIC_SYSIRQ(irq) / 32; 196 mask_bank = SIC_SYSIRQ(irq) / 32;
188 mask_bit = SIC_SYSIRQ(irq) % 32; 197 mask_bit = SIC_SYSIRQ(irq) % 32;
189 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) | 198 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) |
@@ -193,6 +202,7 @@ static void bfin_internal_unmask_irq(unsigned int irq)
193 (1 << mask_bit)); 202 (1 << mask_bit));
194#endif 203#endif
195#endif 204#endif
205 local_irq_restore_hw(flags);
196} 206}
197 207
198#ifdef CONFIG_PM 208#ifdef CONFIG_PM
@@ -390,7 +400,7 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
390static inline void bfin_set_irq_handler(unsigned irq, irq_flow_handler_t handle) 400static inline void bfin_set_irq_handler(unsigned irq, irq_flow_handler_t handle)
391{ 401{
392#ifdef CONFIG_IPIPE 402#ifdef CONFIG_IPIPE
393 _set_irq_handler(irq, handle_edge_irq); 403 _set_irq_handler(irq, handle_level_irq);
394#else 404#else
395 struct irq_desc *desc = irq_desc + irq; 405 struct irq_desc *desc = irq_desc + irq;
396 /* May not call generic set_irq_handler() due to spinlock 406 /* May not call generic set_irq_handler() due to spinlock
@@ -1055,13 +1065,18 @@ int __init init_arch_irq(void)
1055#endif 1065#endif
1056 default: 1066 default:
1057#ifdef CONFIG_IPIPE 1067#ifdef CONFIG_IPIPE
1058 /* 1068 /*
1059 * We want internal interrupt sources to be masked, because 1069 * We want internal interrupt sources to be
1060 * ISRs may trigger interrupts recursively (e.g. DMA), but 1070 * masked, because ISRs may trigger interrupts
1061 * interrupts are _not_ masked at CPU level. So let's handle 1071 * recursively (e.g. DMA), but interrupts are
1062 * them as level interrupts. 1072 * _not_ masked at CPU level. So let's handle
1063 */ 1073 * most of them as level interrupts, except
1064 set_irq_handler(irq, handle_level_irq); 1074 * the timer interrupt which is special.
1075 */
1076 if (irq == IRQ_SYSTMR || irq == IRQ_CORETMR)
1077 set_irq_handler(irq, handle_simple_irq);
1078 else
1079 set_irq_handler(irq, handle_level_irq);
1065#else /* !CONFIG_IPIPE */ 1080#else /* !CONFIG_IPIPE */
1066 set_irq_handler(irq, handle_simple_irq); 1081 set_irq_handler(irq, handle_simple_irq);
1067#endif /* !CONFIG_IPIPE */ 1082#endif /* !CONFIG_IPIPE */
@@ -1123,9 +1138,8 @@ int __init init_arch_irq(void)
1123 1138
1124#ifdef CONFIG_IPIPE 1139#ifdef CONFIG_IPIPE
1125 for (irq = 0; irq < NR_IRQS; irq++) { 1140 for (irq = 0; irq < NR_IRQS; irq++) {
1126 struct irq_desc *desc = irq_desc + irq; 1141 struct irq_desc *desc = irq_to_desc(irq);
1127 desc->ic_prio = __ipipe_get_irq_priority(irq); 1142 desc->ic_prio = __ipipe_get_irq_priority(irq);
1128 desc->thr_prio = __ipipe_get_irqthread_priority(irq);
1129 } 1143 }
1130#endif /* CONFIG_IPIPE */ 1144#endif /* CONFIG_IPIPE */
1131 1145
@@ -1208,76 +1222,21 @@ int __ipipe_get_irq_priority(unsigned irq)
1208 return IVG15; 1222 return IVG15;
1209} 1223}
1210 1224
1211int __ipipe_get_irqthread_priority(unsigned irq)
1212{
1213 int ient, prio;
1214 int demux_irq;
1215
1216 /* The returned priority value is rescaled to [0..IVG13+1]
1217 * with 0 being the lowest effective priority level. */
1218
1219 if (irq <= IRQ_CORETMR)
1220 return IVG13 - irq + 1;
1221
1222 /* GPIO IRQs are given the priority of the demux
1223 * interrupt. */
1224 if (IS_GPIOIRQ(irq)) {
1225#if defined(CONFIG_BF54x)
1226 u32 bank = PINT_2_BANK(irq2pint_lut[irq - SYS_IRQS]);
1227 demux_irq = (bank == 0 ? IRQ_PINT0 :
1228 bank == 1 ? IRQ_PINT1 :
1229 bank == 2 ? IRQ_PINT2 :
1230 IRQ_PINT3);
1231#elif defined(CONFIG_BF561)
1232 demux_irq = (irq >= IRQ_PF32 ? IRQ_PROG2_INTA :
1233 irq >= IRQ_PF16 ? IRQ_PROG1_INTA :
1234 IRQ_PROG0_INTA);
1235#elif defined(CONFIG_BF52x)
1236 demux_irq = (irq >= IRQ_PH0 ? IRQ_PORTH_INTA :
1237 irq >= IRQ_PG0 ? IRQ_PORTG_INTA :
1238 IRQ_PORTF_INTA);
1239#else
1240 demux_irq = irq;
1241#endif
1242 return IVG13 - PRIO_GPIODEMUX(demux_irq) + 1;
1243 }
1244
1245 /* The GPIO demux interrupt is given a lower priority
1246 * than the GPIO IRQs, so that its threaded handler
1247 * unmasks the interrupt line after the decoded IRQs
1248 * have been processed. */
1249 prio = PRIO_GPIODEMUX(irq);
1250 /* demux irq? */
1251 if (prio != -1)
1252 return IVG13 - prio;
1253
1254 for (ient = 0; ient < NR_PERI_INTS; ient++) {
1255 struct ivgx *ivg = ivg_table + ient;
1256 if (ivg->irqno == irq) {
1257 for (prio = 0; prio <= IVG13-IVG7; prio++) {
1258 if (ivg7_13[prio].ifirst <= ivg &&
1259 ivg7_13[prio].istop > ivg)
1260 return IVG7 - prio;
1261 }
1262 }
1263 }
1264
1265 return 0;
1266}
1267
1268/* Hw interrupts are disabled on entry (check SAVE_CONTEXT). */ 1225/* Hw interrupts are disabled on entry (check SAVE_CONTEXT). */
1269#ifdef CONFIG_DO_IRQ_L1 1226#ifdef CONFIG_DO_IRQ_L1
1270__attribute__((l1_text)) 1227__attribute__((l1_text))
1271#endif 1228#endif
1272asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs) 1229asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs)
1273{ 1230{
1231 struct ipipe_percpu_domain_data *p = ipipe_root_cpudom_ptr();
1232 struct ipipe_domain *this_domain = ipipe_current_domain;
1274 struct ivgx *ivg_stop = ivg7_13[vec-IVG7].istop; 1233 struct ivgx *ivg_stop = ivg7_13[vec-IVG7].istop;
1275 struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst; 1234 struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst;
1276 int irq; 1235 int irq, s;
1277 1236
1278 if (likely(vec == EVT_IVTMR_P)) { 1237 if (likely(vec == EVT_IVTMR_P)) {
1279 irq = IRQ_CORETMR; 1238 irq = IRQ_CORETMR;
1280 goto handle_irq; 1239 goto core_tick;
1281 } 1240 }
1282 1241
1283 SSYNC(); 1242 SSYNC();
@@ -1319,24 +1278,39 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs)
1319 irq = ivg->irqno; 1278 irq = ivg->irqno;
1320 1279
1321 if (irq == IRQ_SYSTMR) { 1280 if (irq == IRQ_SYSTMR) {
1281#ifdef CONFIG_GENERIC_CLOCKEVENTS
1282core_tick:
1283#else
1322 bfin_write_TIMER_STATUS(1); /* Latch TIMIL0 */ 1284 bfin_write_TIMER_STATUS(1); /* Latch TIMIL0 */
1285#endif
1323 /* This is basically what we need from the register frame. */ 1286 /* This is basically what we need from the register frame. */
1324 __raw_get_cpu_var(__ipipe_tick_regs).ipend = regs->ipend; 1287 __raw_get_cpu_var(__ipipe_tick_regs).ipend = regs->ipend;
1325 __raw_get_cpu_var(__ipipe_tick_regs).pc = regs->pc; 1288 __raw_get_cpu_var(__ipipe_tick_regs).pc = regs->pc;
1326 if (!ipipe_root_domain_p) 1289 if (this_domain != ipipe_root_domain)
1327 __raw_get_cpu_var(__ipipe_tick_regs).ipend |= 0x10;
1328 else
1329 __raw_get_cpu_var(__ipipe_tick_regs).ipend &= ~0x10; 1290 __raw_get_cpu_var(__ipipe_tick_regs).ipend &= ~0x10;
1291 else
1292 __raw_get_cpu_var(__ipipe_tick_regs).ipend |= 0x10;
1330 } 1293 }
1331 1294
1332handle_irq: 1295#ifndef CONFIG_GENERIC_CLOCKEVENTS
1296core_tick:
1297#endif
1298 if (this_domain == ipipe_root_domain) {
1299 s = __test_and_set_bit(IPIPE_SYNCDEFER_FLAG, &p->status);
1300 barrier();
1301 }
1333 1302
1334 ipipe_trace_irq_entry(irq); 1303 ipipe_trace_irq_entry(irq);
1335 __ipipe_handle_irq(irq, regs); 1304 __ipipe_handle_irq(irq, regs);
1336 ipipe_trace_irq_exit(irq); 1305 ipipe_trace_irq_exit(irq);
1337 1306
1338 if (ipipe_root_domain_p) 1307 if (this_domain == ipipe_root_domain) {
1339 return !test_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status)); 1308 set_thread_flag(TIF_IRQ_SYNC);
1309 if (!s) {
1310 __clear_bit(IPIPE_SYNCDEFER_FLAG, &p->status);
1311 return !test_bit(IPIPE_STALL_FLAG, &p->status);
1312 }
1313 }
1340 1314
1341 return 0; 1315 return 0;
1342} 1316}
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 77c992847094..93eab6146079 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -158,10 +158,14 @@ static irqreturn_t ipi_handler(int irq, void *dev_instance)
158 kfree(msg); 158 kfree(msg);
159 break; 159 break;
160 case BFIN_IPI_CALL_FUNC: 160 case BFIN_IPI_CALL_FUNC:
161 spin_unlock(&msg_queue->lock);
161 ipi_call_function(cpu, msg); 162 ipi_call_function(cpu, msg);
163 spin_lock(&msg_queue->lock);
162 break; 164 break;
163 case BFIN_IPI_CPU_STOP: 165 case BFIN_IPI_CPU_STOP:
166 spin_unlock(&msg_queue->lock);
164 ipi_cpu_stop(cpu); 167 ipi_cpu_stop(cpu);
168 spin_lock(&msg_queue->lock);
165 kfree(msg); 169 kfree(msg);
166 break; 170 break;
167 default: 171 default:
@@ -457,7 +461,7 @@ void smp_icache_flush_range_others(unsigned long start, unsigned long end)
457 smp_flush_data.start = start; 461 smp_flush_data.start = start;
458 smp_flush_data.end = end; 462 smp_flush_data.end = end;
459 463
460 if (smp_call_function(&ipi_flush_icache, &smp_flush_data, 1)) 464 if (smp_call_function(&ipi_flush_icache, &smp_flush_data, 0))
461 printk(KERN_WARNING "SMP: failed to run I-cache flush request on other CPUs\n"); 465 printk(KERN_WARNING "SMP: failed to run I-cache flush request on other CPUs\n");
462} 466}
463EXPORT_SYMBOL_GPL(smp_icache_flush_range_others); 467EXPORT_SYMBOL_GPL(smp_icache_flush_range_others);
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index d0532b72bba5..9c3629b9a689 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -104,7 +104,7 @@ void __init paging_init(void)
104 } 104 }
105} 105}
106 106
107asmlinkage void init_pda(void) 107asmlinkage void __init init_pda(void)
108{ 108{
109 unsigned int cpu = raw_smp_processor_id(); 109 unsigned int cpu = raw_smp_processor_id();
110 110
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 6183aeccecf1..153e727a6e8e 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -221,7 +221,11 @@ config IA64_HP_SIM
221 221
222config IA64_XEN_GUEST 222config IA64_XEN_GUEST
223 bool "Xen guest" 223 bool "Xen guest"
224 select SWIOTLB
224 depends on XEN 225 depends on XEN
226 help
227 Build a kernel that runs on Xen guest domain. At this moment only
228 16KB page size in supported.
225 229
226endchoice 230endchoice
227 231
@@ -479,8 +483,7 @@ config HOLES_IN_ZONE
479 default y if VIRTUAL_MEM_MAP 483 default y if VIRTUAL_MEM_MAP
480 484
481config HAVE_ARCH_EARLY_PFN_TO_NID 485config HAVE_ARCH_EARLY_PFN_TO_NID
482 def_bool y 486 def_bool NUMA && SPARSEMEM
483 depends on NEED_MULTIPLE_NODES
484 487
485config HAVE_ARCH_NODEDATA_EXTENSION 488config HAVE_ARCH_NODEDATA_EXTENSION
486 def_bool y 489 def_bool y
@@ -635,6 +638,17 @@ config DMAR
635 and include PCI device scope covered by these DMA 638 and include PCI device scope covered by these DMA
636 remapping devices. 639 remapping devices.
637 640
641config DMAR_DEFAULT_ON
642 def_bool y
643 prompt "Enable DMA Remapping Devices by default"
644 depends on DMAR
645 help
646 Selecting this option will enable a DMAR device at boot time if
647 one is found. If this option is not selected, DMAR support can
648 be enabled by passing intel_iommu=on to the kernel. It is
649 recommended you say N here while the DMAR code remains
650 experimental.
651
638endmenu 652endmenu
639 653
640endif 654endif
diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig
new file mode 100644
index 000000000000..0bb0714dc19d
--- /dev/null
+++ b/arch/ia64/configs/xen_domu_defconfig
@@ -0,0 +1,1601 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.29-rc1
4# Fri Jan 16 11:49:59 2009
5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7
8#
9# General setup
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
14CONFIG_LOCALVERSION=""
15CONFIG_LOCALVERSION_AUTO=y
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18CONFIG_SYSVIPC_SYSCTL=y
19CONFIG_POSIX_MQUEUE=y
20# CONFIG_BSD_PROCESS_ACCT is not set
21# CONFIG_TASKSTATS is not set
22# CONFIG_AUDIT is not set
23CONFIG_IKCONFIG=y
24CONFIG_IKCONFIG_PROC=y
25CONFIG_LOG_BUF_SHIFT=20
26CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
27# CONFIG_GROUP_SCHED is not set
28
29#
30# Control Group support
31#
32# CONFIG_CGROUPS is not set
33CONFIG_SYSFS_DEPRECATED=y
34CONFIG_SYSFS_DEPRECATED_V2=y
35# CONFIG_RELAY is not set
36CONFIG_NAMESPACES=y
37# CONFIG_UTS_NS is not set
38# CONFIG_IPC_NS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41CONFIG_BLK_DEV_INITRD=y
42CONFIG_INITRAMFS_SOURCE=""
43CONFIG_CC_OPTIMIZE_FOR_SIZE=y
44CONFIG_SYSCTL=y
45# CONFIG_EMBEDDED is not set
46CONFIG_SYSCTL_SYSCALL=y
47CONFIG_KALLSYMS=y
48CONFIG_KALLSYMS_ALL=y
49CONFIG_KALLSYMS_STRIP_GENERATED=y
50# CONFIG_KALLSYMS_EXTRA_PASS is not set
51CONFIG_HOTPLUG=y
52CONFIG_PRINTK=y
53CONFIG_BUG=y
54CONFIG_ELF_CORE=y
55CONFIG_COMPAT_BRK=y
56CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y
61CONFIG_TIMERFD=y
62CONFIG_EVENTFD=y
63CONFIG_SHMEM=y
64CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_PCI_QUIRKS=y
67CONFIG_SLUB_DEBUG=y
68# CONFIG_SLAB is not set
69CONFIG_SLUB=y
70# CONFIG_SLOB is not set
71# CONFIG_PROFILING is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_KPROBES is not set
74CONFIG_HAVE_KPROBES=y
75CONFIG_HAVE_KRETPROBES=y
76CONFIG_HAVE_ARCH_TRACEHOOK=y
77CONFIG_HAVE_DMA_ATTRS=y
78CONFIG_USE_GENERIC_SMP_HELPERS=y
79# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
80CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y
82CONFIG_BASE_SMALL=0
83CONFIG_MODULES=y
84# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set
87CONFIG_MODVERSIONS=y
88CONFIG_MODULE_SRCVERSION_ALL=y
89CONFIG_STOP_MACHINE=y
90CONFIG_BLOCK=y
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_BLK_DEV_BSG is not set
93# CONFIG_BLK_DEV_INTEGRITY is not set
94
95#
96# IO Schedulers
97#
98CONFIG_IOSCHED_NOOP=y
99CONFIG_IOSCHED_AS=y
100CONFIG_IOSCHED_DEADLINE=y
101CONFIG_IOSCHED_CFQ=y
102CONFIG_DEFAULT_AS=y
103# CONFIG_DEFAULT_DEADLINE is not set
104# CONFIG_DEFAULT_CFQ is not set
105# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory"
107CONFIG_CLASSIC_RCU=y
108# CONFIG_TREE_RCU is not set
109# CONFIG_PREEMPT_RCU is not set
110# CONFIG_TREE_RCU_TRACE is not set
111# CONFIG_PREEMPT_RCU_TRACE is not set
112CONFIG_FREEZER=y
113
114#
115# Processor type and features
116#
117CONFIG_IA64=y
118CONFIG_64BIT=y
119CONFIG_ZONE_DMA=y
120CONFIG_QUICKLIST=y
121CONFIG_MMU=y
122CONFIG_SWIOTLB=y
123CONFIG_IOMMU_HELPER=y
124CONFIG_RWSEM_XCHGADD_ALGORITHM=y
125CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
126CONFIG_GENERIC_FIND_NEXT_BIT=y
127CONFIG_GENERIC_CALIBRATE_DELAY=y
128CONFIG_GENERIC_TIME=y
129CONFIG_GENERIC_TIME_VSYSCALL=y
130CONFIG_HAVE_SETUP_PER_CPU_AREA=y
131CONFIG_DMI=y
132CONFIG_EFI=y
133CONFIG_GENERIC_IOMAP=y
134CONFIG_SCHED_OMIT_FRAME_POINTER=y
135CONFIG_AUDIT_ARCH=y
136CONFIG_PARAVIRT_GUEST=y
137CONFIG_PARAVIRT=y
138CONFIG_XEN=y
139CONFIG_XEN_XENCOMM=y
140CONFIG_NO_IDLE_HZ=y
141# CONFIG_IA64_GENERIC is not set
142# CONFIG_IA64_DIG is not set
143# CONFIG_IA64_DIG_VTD is not set
144# CONFIG_IA64_HP_ZX1 is not set
145# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
146# CONFIG_IA64_SGI_SN2 is not set
147# CONFIG_IA64_SGI_UV is not set
148# CONFIG_IA64_HP_SIM is not set
149CONFIG_IA64_XEN_GUEST=y
150# CONFIG_ITANIUM is not set
151CONFIG_MCKINLEY=y
152# CONFIG_IA64_PAGE_SIZE_4KB is not set
153# CONFIG_IA64_PAGE_SIZE_8KB is not set
154CONFIG_IA64_PAGE_SIZE_16KB=y
155# CONFIG_IA64_PAGE_SIZE_64KB is not set
156CONFIG_PGTABLE_3=y
157# CONFIG_PGTABLE_4 is not set
158CONFIG_HZ=250
159# CONFIG_HZ_100 is not set
160CONFIG_HZ_250=y
161# CONFIG_HZ_300 is not set
162# CONFIG_HZ_1000 is not set
163# CONFIG_SCHED_HRTICK is not set
164CONFIG_IA64_L1_CACHE_SHIFT=7
165CONFIG_IA64_CYCLONE=y
166CONFIG_IOSAPIC=y
167CONFIG_FORCE_MAX_ZONEORDER=17
168# CONFIG_VIRT_CPU_ACCOUNTING is not set
169CONFIG_SMP=y
170CONFIG_NR_CPUS=16
171CONFIG_HOTPLUG_CPU=y
172CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
173CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
174# CONFIG_SCHED_SMT is not set
175CONFIG_PERMIT_BSP_REMOVE=y
176CONFIG_FORCE_CPEI_RETARGET=y
177CONFIG_PREEMPT_NONE=y
178# CONFIG_PREEMPT_VOLUNTARY is not set
179# CONFIG_PREEMPT is not set
180CONFIG_SELECT_MEMORY_MODEL=y
181CONFIG_FLATMEM_MANUAL=y
182# CONFIG_DISCONTIGMEM_MANUAL is not set
183# CONFIG_SPARSEMEM_MANUAL is not set
184CONFIG_FLATMEM=y
185CONFIG_FLAT_NODE_MEM_MAP=y
186CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
187CONFIG_PAGEFLAGS_EXTENDED=y
188CONFIG_SPLIT_PTLOCK_CPUS=4
189CONFIG_MIGRATION=y
190CONFIG_PHYS_ADDR_T_64BIT=y
191CONFIG_ZONE_DMA_FLAG=1
192CONFIG_BOUNCE=y
193CONFIG_NR_QUICK=1
194CONFIG_VIRT_TO_BUS=y
195CONFIG_UNEVICTABLE_LRU=y
196CONFIG_ARCH_SELECT_MEMORY_MODEL=y
197CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
198CONFIG_ARCH_FLATMEM_ENABLE=y
199CONFIG_ARCH_SPARSEMEM_ENABLE=y
200CONFIG_ARCH_POPULATES_NODE_MAP=y
201CONFIG_VIRTUAL_MEM_MAP=y
202CONFIG_HOLES_IN_ZONE=y
203# CONFIG_IA32_SUPPORT is not set
204# CONFIG_COMPAT_FOR_U64_ALIGNMENT is not set
205CONFIG_IA64_MCA_RECOVERY=y
206CONFIG_PERFMON=y
207CONFIG_IA64_PALINFO=y
208# CONFIG_IA64_MC_ERR_INJECT is not set
209# CONFIG_IA64_ESI is not set
210# CONFIG_IA64_HP_AML_NFW is not set
211CONFIG_KEXEC=y
212# CONFIG_CRASH_DUMP is not set
213
214#
215# Firmware Drivers
216#
217# CONFIG_FIRMWARE_MEMMAP is not set
218CONFIG_EFI_VARS=y
219CONFIG_EFI_PCDP=y
220CONFIG_DMIID=y
221CONFIG_BINFMT_ELF=y
222# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
223# CONFIG_HAVE_AOUT is not set
224CONFIG_BINFMT_MISC=m
225
226#
227# Power management and ACPI options
228#
229CONFIG_PM=y
230# CONFIG_PM_DEBUG is not set
231CONFIG_PM_SLEEP=y
232CONFIG_SUSPEND=y
233CONFIG_SUSPEND_FREEZER=y
234CONFIG_ACPI=y
235CONFIG_ACPI_SLEEP=y
236CONFIG_ACPI_PROCFS=y
237CONFIG_ACPI_PROCFS_POWER=y
238CONFIG_ACPI_SYSFS_POWER=y
239CONFIG_ACPI_PROC_EVENT=y
240CONFIG_ACPI_BUTTON=m
241CONFIG_ACPI_FAN=m
242# CONFIG_ACPI_DOCK is not set
243CONFIG_ACPI_PROCESSOR=m
244CONFIG_ACPI_HOTPLUG_CPU=y
245CONFIG_ACPI_THERMAL=m
246# CONFIG_ACPI_CUSTOM_DSDT is not set
247CONFIG_ACPI_BLACKLIST_YEAR=0
248# CONFIG_ACPI_DEBUG is not set
249# CONFIG_ACPI_PCI_SLOT is not set
250CONFIG_ACPI_SYSTEM=y
251CONFIG_ACPI_CONTAINER=m
252
253#
254# CPU Frequency scaling
255#
256# CONFIG_CPU_FREQ is not set
257
258#
259# Bus options (PCI, PCMCIA)
260#
261CONFIG_PCI=y
262CONFIG_PCI_DOMAINS=y
263CONFIG_PCI_SYSCALL=y
264# CONFIG_PCIEPORTBUS is not set
265CONFIG_ARCH_SUPPORTS_MSI=y
266# CONFIG_PCI_MSI is not set
267CONFIG_PCI_LEGACY=y
268# CONFIG_PCI_DEBUG is not set
269# CONFIG_PCI_STUB is not set
270CONFIG_HOTPLUG_PCI=m
271# CONFIG_HOTPLUG_PCI_FAKE is not set
272CONFIG_HOTPLUG_PCI_ACPI=m
273# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
274# CONFIG_HOTPLUG_PCI_CPCI is not set
275# CONFIG_HOTPLUG_PCI_SHPC is not set
276# CONFIG_PCCARD is not set
277CONFIG_NET=y
278
279#
280# Networking options
281#
282# CONFIG_NET_NS is not set
283CONFIG_COMPAT_NET_DEV_OPS=y
284CONFIG_PACKET=y
285# CONFIG_PACKET_MMAP is not set
286CONFIG_UNIX=y
287CONFIG_XFRM=y
288# CONFIG_XFRM_USER is not set
289# CONFIG_XFRM_SUB_POLICY is not set
290# CONFIG_XFRM_MIGRATE is not set
291# CONFIG_XFRM_STATISTICS is not set
292# CONFIG_NET_KEY is not set
293CONFIG_INET=y
294CONFIG_IP_MULTICAST=y
295# CONFIG_IP_ADVANCED_ROUTER is not set
296CONFIG_IP_FIB_HASH=y
297# CONFIG_IP_PNP is not set
298# CONFIG_NET_IPIP is not set
299# CONFIG_NET_IPGRE is not set
300# CONFIG_IP_MROUTE is not set
301CONFIG_ARPD=y
302CONFIG_SYN_COOKIES=y
303# CONFIG_INET_AH is not set
304# CONFIG_INET_ESP is not set
305# CONFIG_INET_IPCOMP is not set
306# CONFIG_INET_XFRM_TUNNEL is not set
307# CONFIG_INET_TUNNEL is not set
308CONFIG_INET_XFRM_MODE_TRANSPORT=y
309CONFIG_INET_XFRM_MODE_TUNNEL=y
310CONFIG_INET_XFRM_MODE_BEET=y
311# CONFIG_INET_LRO is not set
312CONFIG_INET_DIAG=y
313CONFIG_INET_TCP_DIAG=y
314# CONFIG_TCP_CONG_ADVANCED is not set
315CONFIG_TCP_CONG_CUBIC=y
316CONFIG_DEFAULT_TCP_CONG="cubic"
317# CONFIG_TCP_MD5SIG is not set
318# CONFIG_IPV6 is not set
319# CONFIG_NETWORK_SECMARK is not set
320# CONFIG_NETFILTER is not set
321# CONFIG_IP_DCCP is not set
322# CONFIG_IP_SCTP is not set
323# CONFIG_TIPC is not set
324# CONFIG_ATM is not set
325# CONFIG_BRIDGE is not set
326# CONFIG_NET_DSA is not set
327# CONFIG_VLAN_8021Q is not set
328# CONFIG_DECNET is not set
329# CONFIG_LLC2 is not set
330# CONFIG_IPX is not set
331# CONFIG_ATALK is not set
332# CONFIG_X25 is not set
333# CONFIG_LAPB is not set
334# CONFIG_ECONET is not set
335# CONFIG_WAN_ROUTER is not set
336# CONFIG_NET_SCHED is not set
337# CONFIG_DCB is not set
338
339#
340# Network testing
341#
342# CONFIG_NET_PKTGEN is not set
343# CONFIG_HAMRADIO is not set
344# CONFIG_CAN is not set
345# CONFIG_IRDA is not set
346# CONFIG_BT is not set
347# CONFIG_AF_RXRPC is not set
348# CONFIG_PHONET is not set
349# CONFIG_WIRELESS is not set
350# CONFIG_WIMAX is not set
351# CONFIG_RFKILL is not set
352# CONFIG_NET_9P is not set
353
354#
355# Device Drivers
356#
357
358#
359# Generic Driver Options
360#
361CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
362CONFIG_STANDALONE=y
363CONFIG_PREVENT_FIRMWARE_BUILD=y
364CONFIG_FW_LOADER=y
365CONFIG_FIRMWARE_IN_KERNEL=y
366CONFIG_EXTRA_FIRMWARE=""
367# CONFIG_DEBUG_DRIVER is not set
368# CONFIG_DEBUG_DEVRES is not set
369# CONFIG_SYS_HYPERVISOR is not set
370# CONFIG_CONNECTOR is not set
371# CONFIG_MTD is not set
372# CONFIG_PARPORT is not set
373CONFIG_PNP=y
374CONFIG_PNP_DEBUG_MESSAGES=y
375
376#
377# Protocols
378#
379CONFIG_PNPACPI=y
380CONFIG_BLK_DEV=y
381# CONFIG_BLK_CPQ_DA is not set
382# CONFIG_BLK_CPQ_CISS_DA is not set
383# CONFIG_BLK_DEV_DAC960 is not set
384# CONFIG_BLK_DEV_UMEM is not set
385# CONFIG_BLK_DEV_COW_COMMON is not set
386CONFIG_BLK_DEV_LOOP=m
387CONFIG_BLK_DEV_CRYPTOLOOP=m
388CONFIG_BLK_DEV_NBD=m
389# CONFIG_BLK_DEV_SX8 is not set
390# CONFIG_BLK_DEV_UB is not set
391CONFIG_BLK_DEV_RAM=y
392CONFIG_BLK_DEV_RAM_COUNT=16
393CONFIG_BLK_DEV_RAM_SIZE=4096
394# CONFIG_BLK_DEV_XIP is not set
395# CONFIG_CDROM_PKTCDVD is not set
396# CONFIG_ATA_OVER_ETH is not set
397CONFIG_XEN_BLKDEV_FRONTEND=y
398# CONFIG_BLK_DEV_HD is not set
399CONFIG_MISC_DEVICES=y
400# CONFIG_PHANTOM is not set
401# CONFIG_EEPROM_93CX6 is not set
402# CONFIG_SGI_IOC4 is not set
403# CONFIG_TIFM_CORE is not set
404# CONFIG_ICS932S401 is not set
405# CONFIG_ENCLOSURE_SERVICES is not set
406# CONFIG_HP_ILO is not set
407# CONFIG_C2PORT is not set
408CONFIG_HAVE_IDE=y
409CONFIG_IDE=y
410
411#
412# Please see Documentation/ide/ide.txt for help/info on IDE drives
413#
414CONFIG_IDE_TIMINGS=y
415CONFIG_IDE_ATAPI=y
416# CONFIG_BLK_DEV_IDE_SATA is not set
417CONFIG_IDE_GD=y
418CONFIG_IDE_GD_ATA=y
419# CONFIG_IDE_GD_ATAPI is not set
420CONFIG_BLK_DEV_IDECD=y
421CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
422# CONFIG_BLK_DEV_IDETAPE is not set
423# CONFIG_BLK_DEV_IDEACPI is not set
424# CONFIG_IDE_TASK_IOCTL is not set
425CONFIG_IDE_PROC_FS=y
426
427#
428# IDE chipset support/bugfixes
429#
430# CONFIG_IDE_GENERIC is not set
431# CONFIG_BLK_DEV_PLATFORM is not set
432# CONFIG_BLK_DEV_IDEPNP is not set
433CONFIG_BLK_DEV_IDEDMA_SFF=y
434
435#
436# PCI IDE chipsets support
437#
438CONFIG_BLK_DEV_IDEPCI=y
439CONFIG_IDEPCI_PCIBUS_ORDER=y
440# CONFIG_BLK_DEV_OFFBOARD is not set
441CONFIG_BLK_DEV_GENERIC=y
442# CONFIG_BLK_DEV_OPTI621 is not set
443CONFIG_BLK_DEV_IDEDMA_PCI=y
444# CONFIG_BLK_DEV_AEC62XX is not set
445# CONFIG_BLK_DEV_ALI15X3 is not set
446# CONFIG_BLK_DEV_AMD74XX is not set
447CONFIG_BLK_DEV_CMD64X=y
448# CONFIG_BLK_DEV_TRIFLEX is not set
449# CONFIG_BLK_DEV_CS5520 is not set
450# CONFIG_BLK_DEV_CS5530 is not set
451# CONFIG_BLK_DEV_HPT366 is not set
452# CONFIG_BLK_DEV_JMICRON is not set
453# CONFIG_BLK_DEV_SC1200 is not set
454CONFIG_BLK_DEV_PIIX=y
455# CONFIG_BLK_DEV_IT8172 is not set
456# CONFIG_BLK_DEV_IT8213 is not set
457# CONFIG_BLK_DEV_IT821X is not set
458# CONFIG_BLK_DEV_NS87415 is not set
459# CONFIG_BLK_DEV_PDC202XX_OLD is not set
460# CONFIG_BLK_DEV_PDC202XX_NEW is not set
461# CONFIG_BLK_DEV_SVWKS is not set
462# CONFIG_BLK_DEV_SIIMAGE is not set
463# CONFIG_BLK_DEV_SLC90E66 is not set
464# CONFIG_BLK_DEV_TRM290 is not set
465# CONFIG_BLK_DEV_VIA82CXXX is not set
466# CONFIG_BLK_DEV_TC86C001 is not set
467CONFIG_BLK_DEV_IDEDMA=y
468
469#
470# SCSI device support
471#
472# CONFIG_RAID_ATTRS is not set
473CONFIG_SCSI=y
474CONFIG_SCSI_DMA=y
475# CONFIG_SCSI_TGT is not set
476CONFIG_SCSI_NETLINK=y
477CONFIG_SCSI_PROC_FS=y
478
479#
480# SCSI support type (disk, tape, CD-ROM)
481#
482CONFIG_BLK_DEV_SD=y
483CONFIG_CHR_DEV_ST=m
484# CONFIG_CHR_DEV_OSST is not set
485CONFIG_BLK_DEV_SR=m
486# CONFIG_BLK_DEV_SR_VENDOR is not set
487CONFIG_CHR_DEV_SG=m
488# CONFIG_CHR_DEV_SCH is not set
489
490#
491# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
492#
493# CONFIG_SCSI_MULTI_LUN is not set
494# CONFIG_SCSI_CONSTANTS is not set
495# CONFIG_SCSI_LOGGING is not set
496# CONFIG_SCSI_SCAN_ASYNC is not set
497CONFIG_SCSI_WAIT_SCAN=m
498
499#
500# SCSI Transports
501#
502CONFIG_SCSI_SPI_ATTRS=y
503CONFIG_SCSI_FC_ATTRS=y
504# CONFIG_SCSI_ISCSI_ATTRS is not set
505# CONFIG_SCSI_SAS_LIBSAS is not set
506# CONFIG_SCSI_SRP_ATTRS is not set
507CONFIG_SCSI_LOWLEVEL=y
508# CONFIG_ISCSI_TCP is not set
509# CONFIG_SCSI_CXGB3_ISCSI is not set
510# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
511# CONFIG_SCSI_3W_9XXX is not set
512# CONFIG_SCSI_ACARD is not set
513# CONFIG_SCSI_AACRAID is not set
514# CONFIG_SCSI_AIC7XXX is not set
515# CONFIG_SCSI_AIC7XXX_OLD is not set
516# CONFIG_SCSI_AIC79XX is not set
517# CONFIG_SCSI_AIC94XX is not set
518# CONFIG_SCSI_DPT_I2O is not set
519# CONFIG_SCSI_ADVANSYS is not set
520# CONFIG_SCSI_ARCMSR is not set
521# CONFIG_MEGARAID_NEWGEN is not set
522# CONFIG_MEGARAID_LEGACY is not set
523# CONFIG_MEGARAID_SAS is not set
524# CONFIG_SCSI_HPTIOP is not set
525# CONFIG_LIBFC is not set
526# CONFIG_FCOE is not set
527# CONFIG_SCSI_DMX3191D is not set
528# CONFIG_SCSI_FUTURE_DOMAIN is not set
529# CONFIG_SCSI_IPS is not set
530# CONFIG_SCSI_INITIO is not set
531# CONFIG_SCSI_INIA100 is not set
532# CONFIG_SCSI_MVSAS is not set
533# CONFIG_SCSI_STEX is not set
534CONFIG_SCSI_SYM53C8XX_2=y
535CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
536CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
537CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
538CONFIG_SCSI_SYM53C8XX_MMIO=y
539CONFIG_SCSI_QLOGIC_1280=y
540# CONFIG_SCSI_QLA_FC is not set
541# CONFIG_SCSI_QLA_ISCSI is not set
542# CONFIG_SCSI_LPFC is not set
543# CONFIG_SCSI_DC395x is not set
544# CONFIG_SCSI_DC390T is not set
545# CONFIG_SCSI_DEBUG is not set
546# CONFIG_SCSI_SRP is not set
547# CONFIG_SCSI_DH is not set
548# CONFIG_ATA is not set
549CONFIG_MD=y
550CONFIG_BLK_DEV_MD=m
551CONFIG_MD_LINEAR=m
552CONFIG_MD_RAID0=m
553CONFIG_MD_RAID1=m
554# CONFIG_MD_RAID10 is not set
555# CONFIG_MD_RAID456 is not set
556CONFIG_MD_MULTIPATH=m
557# CONFIG_MD_FAULTY is not set
558CONFIG_BLK_DEV_DM=m
559# CONFIG_DM_DEBUG is not set
560CONFIG_DM_CRYPT=m
561CONFIG_DM_SNAPSHOT=m
562CONFIG_DM_MIRROR=m
563CONFIG_DM_ZERO=m
564# CONFIG_DM_MULTIPATH is not set
565# CONFIG_DM_DELAY is not set
566# CONFIG_DM_UEVENT is not set
567CONFIG_FUSION=y
568CONFIG_FUSION_SPI=y
569CONFIG_FUSION_FC=y
570# CONFIG_FUSION_SAS is not set
571CONFIG_FUSION_MAX_SGE=128
572CONFIG_FUSION_CTL=y
573# CONFIG_FUSION_LOGGING is not set
574
575#
576# IEEE 1394 (FireWire) support
577#
578
579#
580# Enable only one of the two stacks, unless you know what you are doing
581#
582# CONFIG_FIREWIRE is not set
583# CONFIG_IEEE1394 is not set
584# CONFIG_I2O is not set
585CONFIG_NETDEVICES=y
586CONFIG_DUMMY=m
587# CONFIG_BONDING is not set
588# CONFIG_MACVLAN is not set
589# CONFIG_EQUALIZER is not set
590# CONFIG_TUN is not set
591# CONFIG_VETH is not set
592# CONFIG_NET_SB1000 is not set
593# CONFIG_ARCNET is not set
594CONFIG_PHYLIB=y
595
596#
597# MII PHY device drivers
598#
599# CONFIG_MARVELL_PHY is not set
600# CONFIG_DAVICOM_PHY is not set
601# CONFIG_QSEMI_PHY is not set
602# CONFIG_LXT_PHY is not set
603# CONFIG_CICADA_PHY is not set
604# CONFIG_VITESSE_PHY is not set
605# CONFIG_SMSC_PHY is not set
606# CONFIG_BROADCOM_PHY is not set
607# CONFIG_ICPLUS_PHY is not set
608# CONFIG_REALTEK_PHY is not set
609# CONFIG_NATIONAL_PHY is not set
610# CONFIG_STE10XP is not set
611# CONFIG_LSI_ET1011C_PHY is not set
612# CONFIG_FIXED_PHY is not set
613# CONFIG_MDIO_BITBANG is not set
614CONFIG_NET_ETHERNET=y
615CONFIG_MII=m
616# CONFIG_HAPPYMEAL is not set
617# CONFIG_SUNGEM is not set
618# CONFIG_CASSINI is not set
619# CONFIG_NET_VENDOR_3COM is not set
620CONFIG_NET_TULIP=y
621# CONFIG_DE2104X is not set
622CONFIG_TULIP=m
623# CONFIG_TULIP_MWI is not set
624# CONFIG_TULIP_MMIO is not set
625# CONFIG_TULIP_NAPI is not set
626# CONFIG_DE4X5 is not set
627# CONFIG_WINBOND_840 is not set
628# CONFIG_DM9102 is not set
629# CONFIG_ULI526X is not set
630# CONFIG_HP100 is not set
631# CONFIG_IBM_NEW_EMAC_ZMII is not set
632# CONFIG_IBM_NEW_EMAC_RGMII is not set
633# CONFIG_IBM_NEW_EMAC_TAH is not set
634# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
635# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
636# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
637# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
638CONFIG_NET_PCI=y
639# CONFIG_PCNET32 is not set
640# CONFIG_AMD8111_ETH is not set
641# CONFIG_ADAPTEC_STARFIRE is not set
642# CONFIG_B44 is not set
643# CONFIG_FORCEDETH is not set
644CONFIG_E100=m
645# CONFIG_FEALNX is not set
646# CONFIG_NATSEMI is not set
647# CONFIG_NE2K_PCI is not set
648# CONFIG_8139CP is not set
649# CONFIG_8139TOO is not set
650# CONFIG_R6040 is not set
651# CONFIG_SIS900 is not set
652# CONFIG_EPIC100 is not set
653# CONFIG_SMSC9420 is not set
654# CONFIG_SUNDANCE is not set
655# CONFIG_TLAN is not set
656# CONFIG_VIA_RHINE is not set
657# CONFIG_SC92031 is not set
658# CONFIG_ATL2 is not set
659CONFIG_NETDEV_1000=y
660# CONFIG_ACENIC is not set
661# CONFIG_DL2K is not set
662CONFIG_E1000=y
663# CONFIG_E1000E is not set
664# CONFIG_IP1000 is not set
665# CONFIG_IGB is not set
666# CONFIG_NS83820 is not set
667# CONFIG_HAMACHI is not set
668# CONFIG_YELLOWFIN is not set
669# CONFIG_R8169 is not set
670# CONFIG_SIS190 is not set
671# CONFIG_SKGE is not set
672# CONFIG_SKY2 is not set
673# CONFIG_VIA_VELOCITY is not set
674CONFIG_TIGON3=y
675# CONFIG_BNX2 is not set
676# CONFIG_QLA3XXX is not set
677# CONFIG_ATL1 is not set
678# CONFIG_ATL1E is not set
679# CONFIG_JME is not set
680CONFIG_NETDEV_10000=y
681# CONFIG_CHELSIO_T1 is not set
682CONFIG_CHELSIO_T3_DEPENDS=y
683# CONFIG_CHELSIO_T3 is not set
684# CONFIG_ENIC is not set
685# CONFIG_IXGBE is not set
686# CONFIG_IXGB is not set
687# CONFIG_S2IO is not set
688# CONFIG_MYRI10GE is not set
689# CONFIG_NETXEN_NIC is not set
690# CONFIG_NIU is not set
691# CONFIG_MLX4_EN is not set
692# CONFIG_MLX4_CORE is not set
693# CONFIG_TEHUTI is not set
694# CONFIG_BNX2X is not set
695# CONFIG_QLGE is not set
696# CONFIG_SFC is not set
697# CONFIG_TR is not set
698
699#
700# Wireless LAN
701#
702# CONFIG_WLAN_PRE80211 is not set
703# CONFIG_WLAN_80211 is not set
704# CONFIG_IWLWIFI_LEDS is not set
705
706#
707# Enable WiMAX (Networking options) to see the WiMAX drivers
708#
709
710#
711# USB Network Adapters
712#
713# CONFIG_USB_CATC is not set
714# CONFIG_USB_KAWETH is not set
715# CONFIG_USB_PEGASUS is not set
716# CONFIG_USB_RTL8150 is not set
717# CONFIG_USB_USBNET is not set
718# CONFIG_WAN is not set
719CONFIG_XEN_NETDEV_FRONTEND=y
720# CONFIG_FDDI is not set
721# CONFIG_HIPPI is not set
722# CONFIG_PPP is not set
723# CONFIG_SLIP is not set
724# CONFIG_NET_FC is not set
725CONFIG_NETCONSOLE=y
726# CONFIG_NETCONSOLE_DYNAMIC is not set
727CONFIG_NETPOLL=y
728# CONFIG_NETPOLL_TRAP is not set
729CONFIG_NET_POLL_CONTROLLER=y
730# CONFIG_ISDN is not set
731# CONFIG_PHONE is not set
732
733#
734# Input device support
735#
736CONFIG_INPUT=y
737# CONFIG_INPUT_FF_MEMLESS is not set
738# CONFIG_INPUT_POLLDEV is not set
739
740#
741# Userland interfaces
742#
743CONFIG_INPUT_MOUSEDEV=y
744CONFIG_INPUT_MOUSEDEV_PSAUX=y
745CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
746CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
747# CONFIG_INPUT_JOYDEV is not set
748# CONFIG_INPUT_EVDEV is not set
749# CONFIG_INPUT_EVBUG is not set
750
751#
752# Input Device Drivers
753#
754CONFIG_INPUT_KEYBOARD=y
755CONFIG_KEYBOARD_ATKBD=y
756# CONFIG_KEYBOARD_SUNKBD is not set
757# CONFIG_KEYBOARD_LKKBD is not set
758# CONFIG_KEYBOARD_XTKBD is not set
759# CONFIG_KEYBOARD_NEWTON is not set
760# CONFIG_KEYBOARD_STOWAWAY is not set
761CONFIG_INPUT_MOUSE=y
762CONFIG_MOUSE_PS2=y
763CONFIG_MOUSE_PS2_ALPS=y
764CONFIG_MOUSE_PS2_LOGIPS2PP=y
765CONFIG_MOUSE_PS2_SYNAPTICS=y
766CONFIG_MOUSE_PS2_LIFEBOOK=y
767CONFIG_MOUSE_PS2_TRACKPOINT=y
768# CONFIG_MOUSE_PS2_ELANTECH is not set
769# CONFIG_MOUSE_PS2_TOUCHKIT is not set
770# CONFIG_MOUSE_SERIAL is not set
771# CONFIG_MOUSE_APPLETOUCH is not set
772# CONFIG_MOUSE_BCM5974 is not set
773# CONFIG_MOUSE_VSXXXAA is not set
774# CONFIG_INPUT_JOYSTICK is not set
775# CONFIG_INPUT_TABLET is not set
776# CONFIG_INPUT_TOUCHSCREEN is not set
777# CONFIG_INPUT_MISC is not set
778
779#
780# Hardware I/O ports
781#
782CONFIG_SERIO=y
783CONFIG_SERIO_I8042=y
784# CONFIG_SERIO_SERPORT is not set
785# CONFIG_SERIO_PCIPS2 is not set
786CONFIG_SERIO_LIBPS2=y
787# CONFIG_SERIO_RAW is not set
788CONFIG_GAMEPORT=m
789# CONFIG_GAMEPORT_NS558 is not set
790# CONFIG_GAMEPORT_L4 is not set
791# CONFIG_GAMEPORT_EMU10K1 is not set
792# CONFIG_GAMEPORT_FM801 is not set
793
794#
795# Character devices
796#
797CONFIG_VT=y
798CONFIG_CONSOLE_TRANSLATIONS=y
799CONFIG_VT_CONSOLE=y
800CONFIG_HW_CONSOLE=y
801# CONFIG_VT_HW_CONSOLE_BINDING is not set
802CONFIG_DEVKMEM=y
803CONFIG_SERIAL_NONSTANDARD=y
804# CONFIG_COMPUTONE is not set
805# CONFIG_ROCKETPORT is not set
806# CONFIG_CYCLADES is not set
807# CONFIG_DIGIEPCA is not set
808# CONFIG_MOXA_INTELLIO is not set
809# CONFIG_MOXA_SMARTIO is not set
810# CONFIG_ISI is not set
811# CONFIG_SYNCLINKMP is not set
812# CONFIG_SYNCLINK_GT is not set
813# CONFIG_N_HDLC is not set
814# CONFIG_RISCOM8 is not set
815# CONFIG_SPECIALIX is not set
816# CONFIG_SX is not set
817# CONFIG_RIO is not set
818# CONFIG_STALDRV is not set
819# CONFIG_NOZOMI is not set
820
821#
822# Serial drivers
823#
824CONFIG_SERIAL_8250=y
825CONFIG_SERIAL_8250_CONSOLE=y
826CONFIG_SERIAL_8250_PCI=y
827CONFIG_SERIAL_8250_PNP=y
828CONFIG_SERIAL_8250_NR_UARTS=6
829CONFIG_SERIAL_8250_RUNTIME_UARTS=4
830CONFIG_SERIAL_8250_EXTENDED=y
831CONFIG_SERIAL_8250_SHARE_IRQ=y
832# CONFIG_SERIAL_8250_DETECT_IRQ is not set
833# CONFIG_SERIAL_8250_RSA is not set
834
835#
836# Non-8250 serial port support
837#
838CONFIG_SERIAL_CORE=y
839CONFIG_SERIAL_CORE_CONSOLE=y
840# CONFIG_SERIAL_JSM is not set
841CONFIG_UNIX98_PTYS=y
842# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
843CONFIG_LEGACY_PTYS=y
844CONFIG_LEGACY_PTY_COUNT=256
845CONFIG_HVC_DRIVER=y
846CONFIG_HVC_IRQ=y
847CONFIG_HVC_XEN=y
848# CONFIG_IPMI_HANDLER is not set
849# CONFIG_HW_RANDOM is not set
850CONFIG_EFI_RTC=y
851# CONFIG_R3964 is not set
852# CONFIG_APPLICOM is not set
853CONFIG_RAW_DRIVER=m
854CONFIG_MAX_RAW_DEVS=256
855CONFIG_HPET=y
856CONFIG_HPET_MMAP=y
857# CONFIG_HANGCHECK_TIMER is not set
858# CONFIG_TCG_TPM is not set
859CONFIG_DEVPORT=y
860CONFIG_I2C=m
861CONFIG_I2C_BOARDINFO=y
862# CONFIG_I2C_CHARDEV is not set
863CONFIG_I2C_HELPER_AUTO=y
864CONFIG_I2C_ALGOBIT=m
865
866#
867# I2C Hardware Bus support
868#
869
870#
871# PC SMBus host controller drivers
872#
873# CONFIG_I2C_ALI1535 is not set
874# CONFIG_I2C_ALI1563 is not set
875# CONFIG_I2C_ALI15X3 is not set
876# CONFIG_I2C_AMD756 is not set
877# CONFIG_I2C_AMD8111 is not set
878# CONFIG_I2C_I801 is not set
879# CONFIG_I2C_ISCH is not set
880# CONFIG_I2C_PIIX4 is not set
881# CONFIG_I2C_NFORCE2 is not set
882# CONFIG_I2C_SIS5595 is not set
883# CONFIG_I2C_SIS630 is not set
884# CONFIG_I2C_SIS96X is not set
885# CONFIG_I2C_VIA is not set
886# CONFIG_I2C_VIAPRO is not set
887
888#
889# I2C system bus drivers (mostly embedded / system-on-chip)
890#
891# CONFIG_I2C_OCORES is not set
892# CONFIG_I2C_SIMTEC is not set
893
894#
895# External I2C/SMBus adapter drivers
896#
897# CONFIG_I2C_PARPORT_LIGHT is not set
898# CONFIG_I2C_TAOS_EVM is not set
899# CONFIG_I2C_TINY_USB is not set
900
901#
902# Graphics adapter I2C/DDC channel drivers
903#
904# CONFIG_I2C_VOODOO3 is not set
905
906#
907# Other I2C/SMBus bus drivers
908#
909# CONFIG_I2C_PCA_PLATFORM is not set
910# CONFIG_I2C_STUB is not set
911
912#
913# Miscellaneous I2C Chip support
914#
915# CONFIG_DS1682 is not set
916# CONFIG_AT24 is not set
917# CONFIG_SENSORS_EEPROM is not set
918# CONFIG_SENSORS_PCF8574 is not set
919# CONFIG_PCF8575 is not set
920# CONFIG_SENSORS_PCA9539 is not set
921# CONFIG_SENSORS_PCF8591 is not set
922# CONFIG_SENSORS_MAX6875 is not set
923# CONFIG_SENSORS_TSL2550 is not set
924# CONFIG_I2C_DEBUG_CORE is not set
925# CONFIG_I2C_DEBUG_ALGO is not set
926# CONFIG_I2C_DEBUG_BUS is not set
927# CONFIG_I2C_DEBUG_CHIP is not set
928# CONFIG_SPI is not set
929# CONFIG_W1 is not set
930CONFIG_POWER_SUPPLY=y
931# CONFIG_POWER_SUPPLY_DEBUG is not set
932# CONFIG_PDA_POWER is not set
933# CONFIG_BATTERY_DS2760 is not set
934# CONFIG_BATTERY_BQ27x00 is not set
935CONFIG_HWMON=y
936# CONFIG_HWMON_VID is not set
937# CONFIG_SENSORS_AD7414 is not set
938# CONFIG_SENSORS_AD7418 is not set
939# CONFIG_SENSORS_ADM1021 is not set
940# CONFIG_SENSORS_ADM1025 is not set
941# CONFIG_SENSORS_ADM1026 is not set
942# CONFIG_SENSORS_ADM1029 is not set
943# CONFIG_SENSORS_ADM1031 is not set
944# CONFIG_SENSORS_ADM9240 is not set
945# CONFIG_SENSORS_ADT7462 is not set
946# CONFIG_SENSORS_ADT7470 is not set
947# CONFIG_SENSORS_ADT7473 is not set
948# CONFIG_SENSORS_ATXP1 is not set
949# CONFIG_SENSORS_DS1621 is not set
950# CONFIG_SENSORS_I5K_AMB is not set
951# CONFIG_SENSORS_F71805F is not set
952# CONFIG_SENSORS_F71882FG is not set
953# CONFIG_SENSORS_F75375S is not set
954# CONFIG_SENSORS_GL518SM is not set
955# CONFIG_SENSORS_GL520SM is not set
956# CONFIG_SENSORS_IT87 is not set
957# CONFIG_SENSORS_LM63 is not set
958# CONFIG_SENSORS_LM75 is not set
959# CONFIG_SENSORS_LM77 is not set
960# CONFIG_SENSORS_LM78 is not set
961# CONFIG_SENSORS_LM80 is not set
962# CONFIG_SENSORS_LM83 is not set
963# CONFIG_SENSORS_LM85 is not set
964# CONFIG_SENSORS_LM87 is not set
965# CONFIG_SENSORS_LM90 is not set
966# CONFIG_SENSORS_LM92 is not set
967# CONFIG_SENSORS_LM93 is not set
968# CONFIG_SENSORS_LTC4245 is not set
969# CONFIG_SENSORS_MAX1619 is not set
970# CONFIG_SENSORS_MAX6650 is not set
971# CONFIG_SENSORS_PC87360 is not set
972# CONFIG_SENSORS_PC87427 is not set
973# CONFIG_SENSORS_SIS5595 is not set
974# CONFIG_SENSORS_DME1737 is not set
975# CONFIG_SENSORS_SMSC47M1 is not set
976# CONFIG_SENSORS_SMSC47M192 is not set
977# CONFIG_SENSORS_SMSC47B397 is not set
978# CONFIG_SENSORS_ADS7828 is not set
979# CONFIG_SENSORS_THMC50 is not set
980# CONFIG_SENSORS_VIA686A is not set
981# CONFIG_SENSORS_VT1211 is not set
982# CONFIG_SENSORS_VT8231 is not set
983# CONFIG_SENSORS_W83781D is not set
984# CONFIG_SENSORS_W83791D is not set
985# CONFIG_SENSORS_W83792D is not set
986# CONFIG_SENSORS_W83793 is not set
987# CONFIG_SENSORS_W83L785TS is not set
988# CONFIG_SENSORS_W83L786NG is not set
989# CONFIG_SENSORS_W83627HF is not set
990# CONFIG_SENSORS_W83627EHF is not set
991# CONFIG_SENSORS_LIS3LV02D is not set
992# CONFIG_HWMON_DEBUG_CHIP is not set
993CONFIG_THERMAL=m
994# CONFIG_THERMAL_HWMON is not set
995# CONFIG_WATCHDOG is not set
996CONFIG_SSB_POSSIBLE=y
997
998#
999# Sonics Silicon Backplane
1000#
1001# CONFIG_SSB is not set
1002
1003#
1004# Multifunction device drivers
1005#
1006# CONFIG_MFD_CORE is not set
1007# CONFIG_MFD_SM501 is not set
1008# CONFIG_HTC_PASIC3 is not set
1009# CONFIG_MFD_TMIO is not set
1010# CONFIG_MFD_WM8400 is not set
1011# CONFIG_MFD_WM8350_I2C is not set
1012# CONFIG_MFD_PCF50633 is not set
1013# CONFIG_REGULATOR is not set
1014
1015#
1016# Multimedia devices
1017#
1018
1019#
1020# Multimedia core support
1021#
1022# CONFIG_VIDEO_DEV is not set
1023# CONFIG_DVB_CORE is not set
1024# CONFIG_VIDEO_MEDIA is not set
1025
1026#
1027# Multimedia drivers
1028#
1029CONFIG_DAB=y
1030# CONFIG_USB_DABUSB is not set
1031
1032#
1033# Graphics support
1034#
1035CONFIG_AGP=m
1036CONFIG_DRM=m
1037CONFIG_DRM_TDFX=m
1038CONFIG_DRM_R128=m
1039CONFIG_DRM_RADEON=m
1040CONFIG_DRM_MGA=m
1041CONFIG_DRM_SIS=m
1042# CONFIG_DRM_VIA is not set
1043# CONFIG_DRM_SAVAGE is not set
1044# CONFIG_VGASTATE is not set
1045# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1046# CONFIG_FB is not set
1047# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1048
1049#
1050# Display device support
1051#
1052# CONFIG_DISPLAY_SUPPORT is not set
1053
1054#
1055# Console display driver support
1056#
1057CONFIG_VGA_CONSOLE=y
1058# CONFIG_VGACON_SOFT_SCROLLBACK is not set
1059CONFIG_DUMMY_CONSOLE=y
1060# CONFIG_SOUND is not set
1061CONFIG_HID_SUPPORT=y
1062CONFIG_HID=y
1063# CONFIG_HID_DEBUG is not set
1064# CONFIG_HIDRAW is not set
1065
1066#
1067# USB Input Devices
1068#
1069CONFIG_USB_HID=y
1070# CONFIG_HID_PID is not set
1071# CONFIG_USB_HIDDEV is not set
1072
1073#
1074# Special HID drivers
1075#
1076CONFIG_HID_COMPAT=y
1077CONFIG_HID_A4TECH=y
1078CONFIG_HID_APPLE=y
1079CONFIG_HID_BELKIN=y
1080CONFIG_HID_CHERRY=y
1081CONFIG_HID_CHICONY=y
1082CONFIG_HID_CYPRESS=y
1083CONFIG_HID_EZKEY=y
1084CONFIG_HID_GYRATION=y
1085CONFIG_HID_LOGITECH=y
1086# CONFIG_LOGITECH_FF is not set
1087# CONFIG_LOGIRUMBLEPAD2_FF is not set
1088CONFIG_HID_MICROSOFT=y
1089CONFIG_HID_MONTEREY=y
1090CONFIG_HID_NTRIG=y
1091CONFIG_HID_PANTHERLORD=y
1092# CONFIG_PANTHERLORD_FF is not set
1093CONFIG_HID_PETALYNX=y
1094CONFIG_HID_SAMSUNG=y
1095CONFIG_HID_SONY=y
1096CONFIG_HID_SUNPLUS=y
1097# CONFIG_GREENASIA_FF is not set
1098CONFIG_HID_TOPSEED=y
1099# CONFIG_THRUSTMASTER_FF is not set
1100# CONFIG_ZEROPLUS_FF is not set
1101CONFIG_USB_SUPPORT=y
1102CONFIG_USB_ARCH_HAS_HCD=y
1103CONFIG_USB_ARCH_HAS_OHCI=y
1104CONFIG_USB_ARCH_HAS_EHCI=y
1105CONFIG_USB=y
1106# CONFIG_USB_DEBUG is not set
1107# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1108
1109#
1110# Miscellaneous USB options
1111#
1112CONFIG_USB_DEVICEFS=y
1113CONFIG_USB_DEVICE_CLASS=y
1114# CONFIG_USB_DYNAMIC_MINORS is not set
1115# CONFIG_USB_SUSPEND is not set
1116# CONFIG_USB_OTG is not set
1117# CONFIG_USB_MON is not set
1118# CONFIG_USB_WUSB is not set
1119# CONFIG_USB_WUSB_CBAF is not set
1120
1121#
1122# USB Host Controller Drivers
1123#
1124# CONFIG_USB_C67X00_HCD is not set
1125CONFIG_USB_EHCI_HCD=m
1126# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1127# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1128# CONFIG_USB_OXU210HP_HCD is not set
1129# CONFIG_USB_ISP116X_HCD is not set
1130# CONFIG_USB_ISP1760_HCD is not set
1131CONFIG_USB_OHCI_HCD=m
1132# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1133# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1134CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1135CONFIG_USB_UHCI_HCD=y
1136# CONFIG_USB_SL811_HCD is not set
1137# CONFIG_USB_R8A66597_HCD is not set
1138# CONFIG_USB_WHCI_HCD is not set
1139# CONFIG_USB_HWA_HCD is not set
1140
1141#
1142# USB Device Class drivers
1143#
1144# CONFIG_USB_ACM is not set
1145# CONFIG_USB_PRINTER is not set
1146# CONFIG_USB_WDM is not set
1147# CONFIG_USB_TMC is not set
1148
1149#
1150# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1151#
1152
1153#
1154# see USB_STORAGE Help for more information
1155#
1156CONFIG_USB_STORAGE=m
1157# CONFIG_USB_STORAGE_DEBUG is not set
1158# CONFIG_USB_STORAGE_DATAFAB is not set
1159# CONFIG_USB_STORAGE_FREECOM is not set
1160# CONFIG_USB_STORAGE_ISD200 is not set
1161# CONFIG_USB_STORAGE_USBAT is not set
1162# CONFIG_USB_STORAGE_SDDR09 is not set
1163# CONFIG_USB_STORAGE_SDDR55 is not set
1164# CONFIG_USB_STORAGE_JUMPSHOT is not set
1165# CONFIG_USB_STORAGE_ALAUDA is not set
1166# CONFIG_USB_STORAGE_ONETOUCH is not set
1167# CONFIG_USB_STORAGE_KARMA is not set
1168# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1169# CONFIG_USB_LIBUSUAL is not set
1170
1171#
1172# USB Imaging devices
1173#
1174# CONFIG_USB_MDC800 is not set
1175# CONFIG_USB_MICROTEK is not set
1176
1177#
1178# USB port drivers
1179#
1180# CONFIG_USB_SERIAL is not set
1181
1182#
1183# USB Miscellaneous drivers
1184#
1185# CONFIG_USB_EMI62 is not set
1186# CONFIG_USB_EMI26 is not set
1187# CONFIG_USB_ADUTUX is not set
1188# CONFIG_USB_SEVSEG is not set
1189# CONFIG_USB_RIO500 is not set
1190# CONFIG_USB_LEGOTOWER is not set
1191# CONFIG_USB_LCD is not set
1192# CONFIG_USB_BERRY_CHARGE is not set
1193# CONFIG_USB_LED is not set
1194# CONFIG_USB_CYPRESS_CY7C63 is not set
1195# CONFIG_USB_CYTHERM is not set
1196# CONFIG_USB_PHIDGET is not set
1197# CONFIG_USB_IDMOUSE is not set
1198# CONFIG_USB_FTDI_ELAN is not set
1199# CONFIG_USB_APPLEDISPLAY is not set
1200# CONFIG_USB_SISUSBVGA is not set
1201# CONFIG_USB_LD is not set
1202# CONFIG_USB_TRANCEVIBRATOR is not set
1203# CONFIG_USB_IOWARRIOR is not set
1204# CONFIG_USB_TEST is not set
1205# CONFIG_USB_ISIGHTFW is not set
1206# CONFIG_USB_VST is not set
1207# CONFIG_USB_GADGET is not set
1208
1209#
1210# OTG and related infrastructure
1211#
1212# CONFIG_UWB is not set
1213# CONFIG_MMC is not set
1214# CONFIG_MEMSTICK is not set
1215# CONFIG_NEW_LEDS is not set
1216# CONFIG_ACCESSIBILITY is not set
1217# CONFIG_INFINIBAND is not set
1218# CONFIG_RTC_CLASS is not set
1219# CONFIG_DMADEVICES is not set
1220# CONFIG_UIO is not set
1221CONFIG_XEN_BALLOON=y
1222CONFIG_XEN_SCRUB_PAGES=y
1223CONFIG_XENFS=y
1224CONFIG_XEN_COMPAT_XENFS=y
1225# CONFIG_STAGING is not set
1226# CONFIG_MSPEC is not set
1227
1228#
1229# File systems
1230#
1231CONFIG_EXT2_FS=y
1232CONFIG_EXT2_FS_XATTR=y
1233CONFIG_EXT2_FS_POSIX_ACL=y
1234CONFIG_EXT2_FS_SECURITY=y
1235# CONFIG_EXT2_FS_XIP is not set
1236CONFIG_EXT3_FS=y
1237CONFIG_EXT3_FS_XATTR=y
1238CONFIG_EXT3_FS_POSIX_ACL=y
1239CONFIG_EXT3_FS_SECURITY=y
1240# CONFIG_EXT4_FS is not set
1241CONFIG_JBD=y
1242CONFIG_FS_MBCACHE=y
1243CONFIG_REISERFS_FS=y
1244# CONFIG_REISERFS_CHECK is not set
1245# CONFIG_REISERFS_PROC_INFO is not set
1246CONFIG_REISERFS_FS_XATTR=y
1247CONFIG_REISERFS_FS_POSIX_ACL=y
1248CONFIG_REISERFS_FS_SECURITY=y
1249# CONFIG_JFS_FS is not set
1250CONFIG_FS_POSIX_ACL=y
1251CONFIG_FILE_LOCKING=y
1252CONFIG_XFS_FS=y
1253# CONFIG_XFS_QUOTA is not set
1254# CONFIG_XFS_POSIX_ACL is not set
1255# CONFIG_XFS_RT is not set
1256# CONFIG_XFS_DEBUG is not set
1257# CONFIG_GFS2_FS is not set
1258# CONFIG_OCFS2_FS is not set
1259# CONFIG_BTRFS_FS is not set
1260CONFIG_DNOTIFY=y
1261CONFIG_INOTIFY=y
1262CONFIG_INOTIFY_USER=y
1263# CONFIG_QUOTA is not set
1264CONFIG_AUTOFS_FS=y
1265CONFIG_AUTOFS4_FS=y
1266# CONFIG_FUSE_FS is not set
1267
1268#
1269# CD-ROM/DVD Filesystems
1270#
1271CONFIG_ISO9660_FS=m
1272CONFIG_JOLIET=y
1273# CONFIG_ZISOFS is not set
1274CONFIG_UDF_FS=m
1275CONFIG_UDF_NLS=y
1276
1277#
1278# DOS/FAT/NT Filesystems
1279#
1280CONFIG_FAT_FS=y
1281# CONFIG_MSDOS_FS is not set
1282CONFIG_VFAT_FS=y
1283CONFIG_FAT_DEFAULT_CODEPAGE=437
1284CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1285CONFIG_NTFS_FS=m
1286# CONFIG_NTFS_DEBUG is not set
1287# CONFIG_NTFS_RW is not set
1288
1289#
1290# Pseudo filesystems
1291#
1292CONFIG_PROC_FS=y
1293CONFIG_PROC_KCORE=y
1294CONFIG_PROC_SYSCTL=y
1295CONFIG_PROC_PAGE_MONITOR=y
1296CONFIG_SYSFS=y
1297CONFIG_TMPFS=y
1298# CONFIG_TMPFS_POSIX_ACL is not set
1299CONFIG_HUGETLBFS=y
1300CONFIG_HUGETLB_PAGE=y
1301# CONFIG_CONFIGFS_FS is not set
1302CONFIG_MISC_FILESYSTEMS=y
1303# CONFIG_ADFS_FS is not set
1304# CONFIG_AFFS_FS is not set
1305# CONFIG_HFS_FS is not set
1306# CONFIG_HFSPLUS_FS is not set
1307# CONFIG_BEFS_FS is not set
1308# CONFIG_BFS_FS is not set
1309# CONFIG_EFS_FS is not set
1310# CONFIG_CRAMFS is not set
1311# CONFIG_SQUASHFS is not set
1312# CONFIG_VXFS_FS is not set
1313# CONFIG_MINIX_FS is not set
1314# CONFIG_OMFS_FS is not set
1315# CONFIG_HPFS_FS is not set
1316# CONFIG_QNX4FS_FS is not set
1317# CONFIG_ROMFS_FS is not set
1318# CONFIG_SYSV_FS is not set
1319# CONFIG_UFS_FS is not set
1320CONFIG_NETWORK_FILESYSTEMS=y
1321CONFIG_NFS_FS=m
1322CONFIG_NFS_V3=y
1323# CONFIG_NFS_V3_ACL is not set
1324CONFIG_NFS_V4=y
1325CONFIG_NFSD=m
1326CONFIG_NFSD_V3=y
1327# CONFIG_NFSD_V3_ACL is not set
1328CONFIG_NFSD_V4=y
1329CONFIG_LOCKD=m
1330CONFIG_LOCKD_V4=y
1331CONFIG_EXPORTFS=m
1332CONFIG_NFS_COMMON=y
1333CONFIG_SUNRPC=m
1334CONFIG_SUNRPC_GSS=m
1335# CONFIG_SUNRPC_REGISTER_V4 is not set
1336CONFIG_RPCSEC_GSS_KRB5=m
1337# CONFIG_RPCSEC_GSS_SPKM3 is not set
1338CONFIG_SMB_FS=m
1339CONFIG_SMB_NLS_DEFAULT=y
1340CONFIG_SMB_NLS_REMOTE="cp437"
1341CONFIG_CIFS=m
1342# CONFIG_CIFS_STATS is not set
1343# CONFIG_CIFS_WEAK_PW_HASH is not set
1344# CONFIG_CIFS_XATTR is not set
1345# CONFIG_CIFS_DEBUG2 is not set
1346# CONFIG_CIFS_EXPERIMENTAL is not set
1347# CONFIG_NCP_FS is not set
1348# CONFIG_CODA_FS is not set
1349# CONFIG_AFS_FS is not set
1350
1351#
1352# Partition Types
1353#
1354CONFIG_PARTITION_ADVANCED=y
1355# CONFIG_ACORN_PARTITION is not set
1356# CONFIG_OSF_PARTITION is not set
1357# CONFIG_AMIGA_PARTITION is not set
1358# CONFIG_ATARI_PARTITION is not set
1359# CONFIG_MAC_PARTITION is not set
1360CONFIG_MSDOS_PARTITION=y
1361# CONFIG_BSD_DISKLABEL is not set
1362# CONFIG_MINIX_SUBPARTITION is not set
1363# CONFIG_SOLARIS_X86_PARTITION is not set
1364# CONFIG_UNIXWARE_DISKLABEL is not set
1365# CONFIG_LDM_PARTITION is not set
1366CONFIG_SGI_PARTITION=y
1367# CONFIG_ULTRIX_PARTITION is not set
1368# CONFIG_SUN_PARTITION is not set
1369# CONFIG_KARMA_PARTITION is not set
1370CONFIG_EFI_PARTITION=y
1371# CONFIG_SYSV68_PARTITION is not set
1372CONFIG_NLS=y
1373CONFIG_NLS_DEFAULT="iso8859-1"
1374CONFIG_NLS_CODEPAGE_437=y
1375CONFIG_NLS_CODEPAGE_737=m
1376CONFIG_NLS_CODEPAGE_775=m
1377CONFIG_NLS_CODEPAGE_850=m
1378CONFIG_NLS_CODEPAGE_852=m
1379CONFIG_NLS_CODEPAGE_855=m
1380CONFIG_NLS_CODEPAGE_857=m
1381CONFIG_NLS_CODEPAGE_860=m
1382CONFIG_NLS_CODEPAGE_861=m
1383CONFIG_NLS_CODEPAGE_862=m
1384CONFIG_NLS_CODEPAGE_863=m
1385CONFIG_NLS_CODEPAGE_864=m
1386CONFIG_NLS_CODEPAGE_865=m
1387CONFIG_NLS_CODEPAGE_866=m
1388CONFIG_NLS_CODEPAGE_869=m
1389CONFIG_NLS_CODEPAGE_936=m
1390CONFIG_NLS_CODEPAGE_950=m
1391CONFIG_NLS_CODEPAGE_932=m
1392CONFIG_NLS_CODEPAGE_949=m
1393CONFIG_NLS_CODEPAGE_874=m
1394CONFIG_NLS_ISO8859_8=m
1395CONFIG_NLS_CODEPAGE_1250=m
1396CONFIG_NLS_CODEPAGE_1251=m
1397# CONFIG_NLS_ASCII is not set
1398CONFIG_NLS_ISO8859_1=y
1399CONFIG_NLS_ISO8859_2=m
1400CONFIG_NLS_ISO8859_3=m
1401CONFIG_NLS_ISO8859_4=m
1402CONFIG_NLS_ISO8859_5=m
1403CONFIG_NLS_ISO8859_6=m
1404CONFIG_NLS_ISO8859_7=m
1405CONFIG_NLS_ISO8859_9=m
1406CONFIG_NLS_ISO8859_13=m
1407CONFIG_NLS_ISO8859_14=m
1408CONFIG_NLS_ISO8859_15=m
1409CONFIG_NLS_KOI8_R=m
1410CONFIG_NLS_KOI8_U=m
1411CONFIG_NLS_UTF8=m
1412# CONFIG_DLM is not set
1413
1414#
1415# Kernel hacking
1416#
1417# CONFIG_PRINTK_TIME is not set
1418CONFIG_ENABLE_WARN_DEPRECATED=y
1419CONFIG_ENABLE_MUST_CHECK=y
1420CONFIG_FRAME_WARN=2048
1421CONFIG_MAGIC_SYSRQ=y
1422# CONFIG_UNUSED_SYMBOLS is not set
1423# CONFIG_DEBUG_FS is not set
1424# CONFIG_HEADERS_CHECK is not set
1425CONFIG_DEBUG_KERNEL=y
1426# CONFIG_DEBUG_SHIRQ is not set
1427CONFIG_DETECT_SOFTLOCKUP=y
1428# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1429CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1430CONFIG_SCHED_DEBUG=y
1431# CONFIG_SCHEDSTATS is not set
1432# CONFIG_TIMER_STATS is not set
1433# CONFIG_DEBUG_OBJECTS is not set
1434# CONFIG_SLUB_DEBUG_ON is not set
1435# CONFIG_SLUB_STATS is not set
1436# CONFIG_DEBUG_RT_MUTEXES is not set
1437# CONFIG_RT_MUTEX_TESTER is not set
1438# CONFIG_DEBUG_SPINLOCK is not set
1439CONFIG_DEBUG_MUTEXES=y
1440# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1441# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1442# CONFIG_DEBUG_KOBJECT is not set
1443# CONFIG_DEBUG_INFO is not set
1444# CONFIG_DEBUG_VM is not set
1445# CONFIG_DEBUG_WRITECOUNT is not set
1446CONFIG_DEBUG_MEMORY_INIT=y
1447# CONFIG_DEBUG_LIST is not set
1448# CONFIG_DEBUG_SG is not set
1449# CONFIG_DEBUG_NOTIFIERS is not set
1450# CONFIG_BOOT_PRINTK_DELAY is not set
1451# CONFIG_RCU_TORTURE_TEST is not set
1452# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1453# CONFIG_BACKTRACE_SELF_TEST is not set
1454# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1455# CONFIG_FAULT_INJECTION is not set
1456# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1457
1458#
1459# Tracers
1460#
1461# CONFIG_SCHED_TRACER is not set
1462# CONFIG_CONTEXT_SWITCH_TRACER is not set
1463# CONFIG_BOOT_TRACER is not set
1464# CONFIG_TRACE_BRANCH_PROFILING is not set
1465# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1466# CONFIG_SAMPLES is not set
1467CONFIG_IA64_GRANULE_16MB=y
1468# CONFIG_IA64_GRANULE_64MB is not set
1469# CONFIG_IA64_PRINT_HAZARDS is not set
1470# CONFIG_DISABLE_VHPT is not set
1471# CONFIG_IA64_DEBUG_CMPXCHG is not set
1472# CONFIG_IA64_DEBUG_IRQ is not set
1473
1474#
1475# Security options
1476#
1477# CONFIG_KEYS is not set
1478# CONFIG_SECURITY is not set
1479# CONFIG_SECURITYFS is not set
1480# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1481CONFIG_CRYPTO=y
1482
1483#
1484# Crypto core or helper
1485#
1486# CONFIG_CRYPTO_FIPS is not set
1487CONFIG_CRYPTO_ALGAPI=y
1488CONFIG_CRYPTO_ALGAPI2=y
1489CONFIG_CRYPTO_AEAD2=y
1490CONFIG_CRYPTO_BLKCIPHER=m
1491CONFIG_CRYPTO_BLKCIPHER2=y
1492CONFIG_CRYPTO_HASH=y
1493CONFIG_CRYPTO_HASH2=y
1494CONFIG_CRYPTO_RNG2=y
1495CONFIG_CRYPTO_MANAGER=m
1496CONFIG_CRYPTO_MANAGER2=y
1497# CONFIG_CRYPTO_GF128MUL is not set
1498# CONFIG_CRYPTO_NULL is not set
1499# CONFIG_CRYPTO_CRYPTD is not set
1500# CONFIG_CRYPTO_AUTHENC is not set
1501# CONFIG_CRYPTO_TEST is not set
1502
1503#
1504# Authenticated Encryption with Associated Data
1505#
1506# CONFIG_CRYPTO_CCM is not set
1507# CONFIG_CRYPTO_GCM is not set
1508# CONFIG_CRYPTO_SEQIV is not set
1509
1510#
1511# Block modes
1512#
1513CONFIG_CRYPTO_CBC=m
1514# CONFIG_CRYPTO_CTR is not set
1515# CONFIG_CRYPTO_CTS is not set
1516CONFIG_CRYPTO_ECB=m
1517# CONFIG_CRYPTO_LRW is not set
1518CONFIG_CRYPTO_PCBC=m
1519# CONFIG_CRYPTO_XTS is not set
1520
1521#
1522# Hash modes
1523#
1524# CONFIG_CRYPTO_HMAC is not set
1525# CONFIG_CRYPTO_XCBC is not set
1526
1527#
1528# Digest
1529#
1530# CONFIG_CRYPTO_CRC32C is not set
1531# CONFIG_CRYPTO_MD4 is not set
1532CONFIG_CRYPTO_MD5=y
1533# CONFIG_CRYPTO_MICHAEL_MIC is not set
1534# CONFIG_CRYPTO_RMD128 is not set
1535# CONFIG_CRYPTO_RMD160 is not set
1536# CONFIG_CRYPTO_RMD256 is not set
1537# CONFIG_CRYPTO_RMD320 is not set
1538# CONFIG_CRYPTO_SHA1 is not set
1539# CONFIG_CRYPTO_SHA256 is not set
1540# CONFIG_CRYPTO_SHA512 is not set
1541# CONFIG_CRYPTO_TGR192 is not set
1542# CONFIG_CRYPTO_WP512 is not set
1543
1544#
1545# Ciphers
1546#
1547# CONFIG_CRYPTO_AES is not set
1548# CONFIG_CRYPTO_ANUBIS is not set
1549# CONFIG_CRYPTO_ARC4 is not set
1550# CONFIG_CRYPTO_BLOWFISH is not set
1551# CONFIG_CRYPTO_CAMELLIA is not set
1552# CONFIG_CRYPTO_CAST5 is not set
1553# CONFIG_CRYPTO_CAST6 is not set
1554CONFIG_CRYPTO_DES=m
1555# CONFIG_CRYPTO_FCRYPT is not set
1556# CONFIG_CRYPTO_KHAZAD is not set
1557# CONFIG_CRYPTO_SALSA20 is not set
1558# CONFIG_CRYPTO_SEED is not set
1559# CONFIG_CRYPTO_SERPENT is not set
1560# CONFIG_CRYPTO_TEA is not set
1561# CONFIG_CRYPTO_TWOFISH is not set
1562
1563#
1564# Compression
1565#
1566# CONFIG_CRYPTO_DEFLATE is not set
1567# CONFIG_CRYPTO_LZO is not set
1568
1569#
1570# Random Number Generation
1571#
1572# CONFIG_CRYPTO_ANSI_CPRNG is not set
1573CONFIG_CRYPTO_HW=y
1574# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1575CONFIG_HAVE_KVM=y
1576CONFIG_VIRTUALIZATION=y
1577# CONFIG_KVM is not set
1578# CONFIG_VIRTIO_PCI is not set
1579# CONFIG_VIRTIO_BALLOON is not set
1580
1581#
1582# Library routines
1583#
1584CONFIG_BITREVERSE=y
1585CONFIG_GENERIC_FIND_LAST_BIT=y
1586# CONFIG_CRC_CCITT is not set
1587# CONFIG_CRC16 is not set
1588# CONFIG_CRC_T10DIF is not set
1589CONFIG_CRC_ITU_T=m
1590CONFIG_CRC32=y
1591# CONFIG_CRC7 is not set
1592# CONFIG_LIBCRC32C is not set
1593CONFIG_PLIST=y
1594CONFIG_HAS_IOMEM=y
1595CONFIG_HAS_IOPORT=y
1596CONFIG_HAS_DMA=y
1597CONFIG_GENERIC_HARDIRQS=y
1598CONFIG_GENERIC_IRQ_PROBE=y
1599CONFIG_GENERIC_PENDING_IRQ=y
1600CONFIG_IRQ_PER_CPU=y
1601# CONFIG_IOMMU_API is not set
diff --git a/arch/ia64/include/asm/kvm.h b/arch/ia64/include/asm/kvm.h
index 68aa6da807c1..bfa86b6af7cd 100644
--- a/arch/ia64/include/asm/kvm.h
+++ b/arch/ia64/include/asm/kvm.h
@@ -25,6 +25,10 @@
25 25
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27 27
28/* Select x86 specific features in <linux/kvm.h> */
29#define __KVM_HAVE_IOAPIC
30#define __KVM_HAVE_DEVICE_ASSIGNMENT
31
28/* Architectural interrupt line count. */ 32/* Architectural interrupt line count. */
29#define KVM_NR_INTERRUPTS 256 33#define KVM_NR_INTERRUPTS 256
30 34
diff --git a/arch/ia64/include/asm/mmzone.h b/arch/ia64/include/asm/mmzone.h
index 34efe88eb849..f2ca32069b3f 100644
--- a/arch/ia64/include/asm/mmzone.h
+++ b/arch/ia64/include/asm/mmzone.h
@@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned long pfn)
31#endif 31#endif
32} 32}
33 33
34#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
35extern int early_pfn_to_nid(unsigned long pfn);
36#endif
37
38#ifdef CONFIG_IA64_DIG /* DIG systems are small */ 34#ifdef CONFIG_IA64_DIG /* DIG systems are small */
39# define MAX_PHYSNODE_ID 8 35# define MAX_PHYSNODE_ID 8
40# define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) 36# define NR_NODE_MEMBLKS (MAX_NUMNODES * 8)
diff --git a/arch/ia64/include/asm/sn/bte.h b/arch/ia64/include/asm/sn/bte.h
index 5efecf06c9a4..96798d2da7c2 100644
--- a/arch/ia64/include/asm/sn/bte.h
+++ b/arch/ia64/include/asm/sn/bte.h
@@ -39,7 +39,7 @@
39/* BTE status register only supports 16 bits for length field */ 39/* BTE status register only supports 16 bits for length field */
40#define BTE_LEN_BITS (16) 40#define BTE_LEN_BITS (16)
41#define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1) 41#define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1)
42#define BTE_MAX_XFER ((1 << BTE_LEN_BITS) * L1_CACHE_BYTES) 42#define BTE_MAX_XFER (BTE_LEN_MASK << L1_CACHE_SHIFT)
43 43
44 44
45/* Define hardware */ 45/* Define hardware */
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 5cfd3d91001a..e13125058bed 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -507,7 +507,7 @@ static int iosapic_find_sharable_irq(unsigned long trigger, unsigned long pol)
507 if (trigger == IOSAPIC_EDGE) 507 if (trigger == IOSAPIC_EDGE)
508 return -EINVAL; 508 return -EINVAL;
509 509
510 for (i = 0; i <= NR_IRQS; i++) { 510 for (i = 0; i < NR_IRQS; i++) {
511 info = &iosapic_intr_info[i]; 511 info = &iosapic_intr_info[i];
512 if (info->trigger == trigger && info->polarity == pol && 512 if (info->trigger == trigger && info->polarity == pol &&
513 (info->dmode == IOSAPIC_FIXED || 513 (info->dmode == IOSAPIC_FIXED ||
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 11463994a7d5..52290547c85b 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -736,14 +736,15 @@ int __cpu_disable(void)
736 return -EBUSY; 736 return -EBUSY;
737 } 737 }
738 738
739 cpu_clear(cpu, cpu_online_map);
740
739 if (migrate_platform_irqs(cpu)) { 741 if (migrate_platform_irqs(cpu)) {
740 cpu_set(cpu, cpu_online_map); 742 cpu_set(cpu, cpu_online_map);
741 return (-EBUSY); 743 return -EBUSY;
742 } 744 }
743 745
744 remove_siblinginfo(cpu); 746 remove_siblinginfo(cpu);
745 fixup_irqs(); 747 fixup_irqs();
746 cpu_clear(cpu, cpu_online_map);
747 local_flush_tlb_all(); 748 local_flush_tlb_all();
748 cpu_clear(cpu, cpu_callin_map); 749 cpu_clear(cpu, cpu_callin_map);
749 return 0; 750 return 0;
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 67810b77d998..b6c0e63a0bf6 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -2149,7 +2149,7 @@ unw_remove_unwind_table (void *handle)
2149 2149
2150 /* next, remove hash table entries for this table */ 2150 /* next, remove hash table entries for this table */
2151 2151
2152 for (index = 0; index <= UNW_HASH_SIZE; ++index) { 2152 for (index = 0; index < UNW_HASH_SIZE; ++index) {
2153 tmp = unw.cache + unw.hash[index]; 2153 tmp = unw.cache + unw.hash[index];
2154 if (unw.hash[index] >= UNW_CACHE_SIZE 2154 if (unw.hash[index] >= UNW_CACHE_SIZE
2155 || tmp->ip < table->start || tmp->ip >= table->end) 2155 || tmp->ip < table->start || tmp->ip >= table->end)
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 4e586f6110aa..28f982045f29 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1337,6 +1337,10 @@ static void kvm_release_vm_pages(struct kvm *kvm)
1337 } 1337 }
1338} 1338}
1339 1339
1340void kvm_arch_sync_events(struct kvm *kvm)
1341{
1342}
1343
1340void kvm_arch_destroy_vm(struct kvm *kvm) 1344void kvm_arch_destroy_vm(struct kvm *kvm)
1341{ 1345{
1342 kvm_iommu_unmap_guest(kvm); 1346 kvm_iommu_unmap_guest(kvm);
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c
index 552d07724207..230eae482f32 100644
--- a/arch/ia64/kvm/process.c
+++ b/arch/ia64/kvm/process.c
@@ -455,13 +455,18 @@ fpswa_ret_t vmm_fp_emulate(int fp_fault, void *bundle, unsigned long *ipsr,
455 if (!vmm_fpswa_interface) 455 if (!vmm_fpswa_interface)
456 return (fpswa_ret_t) {-1, 0, 0, 0}; 456 return (fpswa_ret_t) {-1, 0, 0, 0};
457 457
458 /*
459 * Just let fpswa driver to use hardware fp registers.
460 * No fp register is valid in memory.
461 */
462 memset(&fp_state, 0, sizeof(fp_state_t)); 458 memset(&fp_state, 0, sizeof(fp_state_t));
463 459
464 /* 460 /*
461 * compute fp_state. only FP registers f6 - f11 are used by the
462 * vmm, so set those bits in the mask and set the low volatile
463 * pointer to point to these registers.
464 */
465 fp_state.bitmask_low64 = 0xfc0; /* bit6..bit11 */
466
467 fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) &regs->f6;
468
469 /*
465 * unsigned long (*EFI_FPSWA) ( 470 * unsigned long (*EFI_FPSWA) (
466 * unsigned long trap_type, 471 * unsigned long trap_type,
467 * void *Bundle, 472 * void *Bundle,
@@ -545,10 +550,6 @@ void reflect_interruption(u64 ifa, u64 isr, u64 iim,
545 status = vmm_handle_fpu_swa(0, regs, isr); 550 status = vmm_handle_fpu_swa(0, regs, isr);
546 if (!status) 551 if (!status)
547 return ; 552 return ;
548 else if (-EAGAIN == status) {
549 vcpu_decrement_iip(vcpu);
550 return ;
551 }
552 break; 553 break;
553 } 554 }
554 555
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index b73bf1838e57..3efea7d0a351 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr)
58 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where 58 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
59 * the section resides. 59 * the section resides.
60 */ 60 */
61int early_pfn_to_nid(unsigned long pfn) 61int __meminit __early_pfn_to_nid(unsigned long pfn)
62{ 62{
63 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; 63 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
64 64
@@ -70,7 +70,7 @@ int early_pfn_to_nid(unsigned long pfn)
70 return node_memblk[i].nid; 70 return node_memblk[i].nid;
71 } 71 }
72 72
73 return 0; 73 return -1;
74} 74}
75 75
76#ifdef CONFIG_MEMORY_HOTPLUG 76#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index 9456d4034024..c6d6b62db66c 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -97,9 +97,10 @@ bte_result_t bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
97 return BTE_SUCCESS; 97 return BTE_SUCCESS;
98 } 98 }
99 99
100 BUG_ON((len & L1_CACHE_MASK) || 100 BUG_ON(len & L1_CACHE_MASK);
101 (src & L1_CACHE_MASK) || (dest & L1_CACHE_MASK)); 101 BUG_ON(src & L1_CACHE_MASK);
102 BUG_ON(!(len < ((BTE_LEN_MASK + 1) << L1_CACHE_SHIFT))); 102 BUG_ON(dest & L1_CACHE_MASK);
103 BUG_ON(len > BTE_MAX_XFER);
103 104
104 /* 105 /*
105 * Start with interface corresponding to cpu number 106 * Start with interface corresponding to cpu number
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index e626e50a938a..060df4aa9916 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -135,11 +135,10 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
135 if (SN_DMA_ADDRTYPE(dma_flags) == SN_DMA_ADDR_PHYS) 135 if (SN_DMA_ADDRTYPE(dma_flags) == SN_DMA_ADDR_PHYS)
136 pci_addr = IS_PIC_SOFT(pcibus_info) ? 136 pci_addr = IS_PIC_SOFT(pcibus_info) ?
137 PHYS_TO_DMA(paddr) : 137 PHYS_TO_DMA(paddr) :
138 PHYS_TO_TIODMA(paddr) | dma_attributes; 138 PHYS_TO_TIODMA(paddr);
139 else 139 else
140 pci_addr = IS_PIC_SOFT(pcibus_info) ? 140 pci_addr = paddr;
141 paddr : 141 pci_addr |= dma_attributes;
142 paddr | dma_attributes;
143 142
144 /* Handle Bus mode */ 143 /* Handle Bus mode */
145 if (IS_PCIX(pcibus_info)) 144 if (IS_PCIX(pcibus_info))
diff --git a/arch/ia64/xen/Kconfig b/arch/ia64/xen/Kconfig
index f1683a20275b..515e0826803a 100644
--- a/arch/ia64/xen/Kconfig
+++ b/arch/ia64/xen/Kconfig
@@ -8,8 +8,7 @@ config XEN
8 depends on PARAVIRT && MCKINLEY && IA64_PAGE_SIZE_16KB && EXPERIMENTAL 8 depends on PARAVIRT && MCKINLEY && IA64_PAGE_SIZE_16KB && EXPERIMENTAL
9 select XEN_XENCOMM 9 select XEN_XENCOMM
10 select NO_IDLE_HZ 10 select NO_IDLE_HZ
11 11 # followings are required to save/restore.
12 # those are required to save/restore.
13 select ARCH_SUSPEND_POSSIBLE 12 select ARCH_SUSPEND_POSSIBLE
14 select SUSPEND 13 select SUSPEND
15 select PM_SLEEP 14 select PM_SLEEP
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
index 04cd12350455..936cff3c96e0 100644
--- a/arch/ia64/xen/xen_pv_ops.c
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void)
153 xen_setup_vcpu_info_placement(); 153 xen_setup_vcpu_info_placement();
154} 154}
155 155
156static const struct pv_init_ops xen_init_ops __initdata = { 156static const struct pv_init_ops xen_init_ops __initconst = {
157 .banner = xen_banner, 157 .banner = xen_banner,
158 158
159 .reserve_memory = xen_reserve_memory, 159 .reserve_memory = xen_reserve_memory,
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
337 HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op); 337 HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
338} 338}
339 339
340static const struct pv_iosapic_ops xen_iosapic_ops __initdata = { 340static const struct pv_iosapic_ops xen_iosapic_ops __initconst = {
341 .pcat_compat_init = xen_pcat_compat_init, 341 .pcat_compat_init = xen_pcat_compat_init,
342 .__get_irq_chip = xen_iosapic_get_irq_chip, 342 .__get_irq_chip = xen_iosapic_get_irq_chip,
343 343
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index dba4afabb444..39478dd08e67 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -187,8 +187,8 @@ __asm__ (__ALIGN_STR "\n" \
187" jbra ret_from_interrupt\n" \ 187" jbra ret_from_interrupt\n" \
188 : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]), \ 188 : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]), \
189 "n" (PT_OFF_SR), "n" (n), \ 189 "n" (PT_OFF_SR), "n" (n), \
190 "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &mfp.int_mk_a) \ 190 "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &st_mfp.int_mk_a) \
191 : (n & 16 ? &tt_mfp.int_mk_b : &mfp.int_mk_b)), \ 191 : (n & 16 ? &tt_mfp.int_mk_b : &st_mfp.int_mk_b)), \
192 "m" (preempt_count()), "di" (HARDIRQ_OFFSET) \ 192 "m" (preempt_count()), "di" (HARDIRQ_OFFSET) \
193); \ 193); \
194 for (;;); /* fake noreturn */ \ 194 for (;;); /* fake noreturn */ \
@@ -366,14 +366,14 @@ void __init atari_init_IRQ(void)
366 /* Initialize the MFP(s) */ 366 /* Initialize the MFP(s) */
367 367
368#ifdef ATARI_USE_SOFTWARE_EOI 368#ifdef ATARI_USE_SOFTWARE_EOI
369 mfp.vec_adr = 0x48; /* Software EOI-Mode */ 369 st_mfp.vec_adr = 0x48; /* Software EOI-Mode */
370#else 370#else
371 mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ 371 st_mfp.vec_adr = 0x40; /* Automatic EOI-Mode */
372#endif 372#endif
373 mfp.int_en_a = 0x00; /* turn off MFP-Ints */ 373 st_mfp.int_en_a = 0x00; /* turn off MFP-Ints */
374 mfp.int_en_b = 0x00; 374 st_mfp.int_en_b = 0x00;
375 mfp.int_mk_a = 0xff; /* no Masking */ 375 st_mfp.int_mk_a = 0xff; /* no Masking */
376 mfp.int_mk_b = 0xff; 376 st_mfp.int_mk_b = 0xff;
377 377
378 if (ATARIHW_PRESENT(TT_MFP)) { 378 if (ATARIHW_PRESENT(TT_MFP)) {
379#ifdef ATARI_USE_SOFTWARE_EOI 379#ifdef ATARI_USE_SOFTWARE_EOI
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index a5f33c059979..4add96d13b19 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -609,10 +609,10 @@ int atari_keyb_init(void)
609 ACIA_RHTID : 0); 609 ACIA_RHTID : 0);
610 610
611 /* make sure the interrupt line is up */ 611 /* make sure the interrupt line is up */
612 } while ((mfp.par_dt_reg & 0x10) == 0); 612 } while ((st_mfp.par_dt_reg & 0x10) == 0);
613 613
614 /* enable ACIA Interrupts */ 614 /* enable ACIA Interrupts */
615 mfp.active_edge &= ~0x10; 615 st_mfp.active_edge &= ~0x10;
616 atari_turnon_irq(IRQ_MFP_ACIA); 616 atari_turnon_irq(IRQ_MFP_ACIA);
617 617
618 ikbd_self_test = 1; 618 ikbd_self_test = 1;
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 49c28cdbea5c..ae2d96e5d618 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -258,7 +258,7 @@ void __init config_atari(void)
258 printk("STND_SHIFTER "); 258 printk("STND_SHIFTER ");
259 } 259 }
260 } 260 }
261 if (hwreg_present(&mfp.par_dt_reg)) { 261 if (hwreg_present(&st_mfp.par_dt_reg)) {
262 ATARIHW_SET(ST_MFP); 262 ATARIHW_SET(ST_MFP);
263 printk("ST_MFP "); 263 printk("ST_MFP ");
264 } 264 }
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index 702b15ccfab7..28efdc33c1ae 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -34,9 +34,9 @@ static struct console atari_console_driver = {
34 34
35static inline void ata_mfp_out(char c) 35static inline void ata_mfp_out(char c)
36{ 36{
37 while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ 37 while (!(st_mfp.trn_stat & 0x80)) /* wait for tx buf empty */
38 barrier(); 38 barrier();
39 mfp.usart_dta = c; 39 st_mfp.usart_dta = c;
40} 40}
41 41
42static void atari_mfp_console_write(struct console *co, const char *str, 42static void atari_mfp_console_write(struct console *co, const char *str,
@@ -91,7 +91,7 @@ static int ata_par_out(char c)
91 /* This a some-seconds timeout in case no printer is connected */ 91 /* This a some-seconds timeout in case no printer is connected */
92 unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; 92 unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ;
93 93
94 while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */ 94 while ((st_mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
95 ; 95 ;
96 if (!i) 96 if (!i)
97 return 0; 97 return 0;
@@ -131,9 +131,9 @@ static void atari_par_console_write(struct console *co, const char *str,
131#if 0 131#if 0
132int atari_mfp_console_wait_key(struct console *co) 132int atari_mfp_console_wait_key(struct console *co)
133{ 133{
134 while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ 134 while (!(st_mfp.rcv_stat & 0x80)) /* wait for rx buf filled */
135 barrier(); 135 barrier();
136 return mfp.usart_dta; 136 return st_mfp.usart_dta;
137} 137}
138 138
139int atari_scc_console_wait_key(struct console *co) 139int atari_scc_console_wait_key(struct console *co)
@@ -175,12 +175,12 @@ static void __init atari_init_mfp_port(int cflag)
175 baud = B9600; /* use default 9600bps for non-implemented rates */ 175 baud = B9600; /* use default 9600bps for non-implemented rates */
176 baud -= B1200; /* baud_table[] starts at 1200bps */ 176 baud -= B1200; /* baud_table[] starts at 1200bps */
177 177
178 mfp.trn_stat &= ~0x01; /* disable TX */ 178 st_mfp.trn_stat &= ~0x01; /* disable TX */
179 mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ 179 st_mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
180 mfp.tim_ct_cd &= 0x70; /* stop timer D */ 180 st_mfp.tim_ct_cd &= 0x70; /* stop timer D */
181 mfp.tim_dt_d = baud_table[baud]; 181 st_mfp.tim_dt_d = baud_table[baud];
182 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ 182 st_mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */
183 mfp.trn_stat |= 0x01; /* enable TX */ 183 st_mfp.trn_stat |= 0x01; /* enable TX */
184} 184}
185 185
186#define SCC_WRITE(reg, val) \ 186#define SCC_WRITE(reg, val) \
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index d076ff8d1b39..a0531f34c617 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -27,9 +27,9 @@ void __init
27atari_sched_init(irq_handler_t timer_routine) 27atari_sched_init(irq_handler_t timer_routine)
28{ 28{
29 /* set Timer C data Register */ 29 /* set Timer C data Register */
30 mfp.tim_dt_c = INT_TICKS; 30 st_mfp.tim_dt_c = INT_TICKS;
31 /* start timer C, div = 1:100 */ 31 /* start timer C, div = 1:100 */
32 mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60; 32 st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 15) | 0x60;
33 /* install interrupt service routine for MFP Timer C */ 33 /* install interrupt service routine for MFP Timer C */
34 if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW, 34 if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW,
35 "timer", timer_routine)) 35 "timer", timer_routine))
@@ -46,11 +46,11 @@ unsigned long atari_gettimeoffset (void)
46 unsigned long ticks, offset = 0; 46 unsigned long ticks, offset = 0;
47 47
48 /* read MFP timer C current value */ 48 /* read MFP timer C current value */
49 ticks = mfp.tim_dt_c; 49 ticks = st_mfp.tim_dt_c;
50 /* The probability of underflow is less than 2% */ 50 /* The probability of underflow is less than 2% */
51 if (ticks > INT_TICKS - INT_TICKS / 50) 51 if (ticks > INT_TICKS - INT_TICKS / 50)
52 /* Check for pending timer interrupt */ 52 /* Check for pending timer interrupt */
53 if (mfp.int_pn_b & (1 << 5)) 53 if (st_mfp.int_pn_b & (1 << 5))
54 offset = TICK_SIZE; 54 offset = TICK_SIZE;
55 55
56 ticks = INT_TICKS - ticks; 56 ticks = INT_TICKS - ticks;
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h
index 1412b4ab202f..a714e1aa072a 100644
--- a/arch/m68k/include/asm/atarihw.h
+++ b/arch/m68k/include/asm/atarihw.h
@@ -113,7 +113,7 @@ extern struct atari_hw_present atari_hw_present;
113 * of nops on various machines. Somebody claimed that the tstb takes 600 ns. 113 * of nops on various machines. Somebody claimed that the tstb takes 600 ns.
114 */ 114 */
115#define MFPDELAY() \ 115#define MFPDELAY() \
116 __asm__ __volatile__ ( "tstb %0" : : "m" (mfp.par_dt_reg) : "cc" ); 116 __asm__ __volatile__ ( "tstb %0" : : "m" (st_mfp.par_dt_reg) : "cc" );
117 117
118/* Do cache push/invalidate for DMA read/write. This function obeys the 118/* Do cache push/invalidate for DMA read/write. This function obeys the
119 * snooping on some machines (Medusa) and processors: The Medusa itself can 119 * snooping on some machines (Medusa) and processors: The Medusa itself can
@@ -565,7 +565,7 @@ struct MFP
565 u_char char_dummy23; 565 u_char char_dummy23;
566 u_char usart_dta; 566 u_char usart_dta;
567 }; 567 };
568# define mfp ((*(volatile struct MFP*)MFP_BAS)) 568# define st_mfp ((*(volatile struct MFP*)MFP_BAS))
569 569
570/* TT's second MFP */ 570/* TT's second MFP */
571 571
diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h
index 5748e99f4e26..f597892e43a0 100644
--- a/arch/m68k/include/asm/atariints.h
+++ b/arch/m68k/include/asm/atariints.h
@@ -113,7 +113,7 @@ static inline int get_mfp_bit( unsigned irq, int type )
113{ unsigned char mask, *reg; 113{ unsigned char mask, *reg;
114 114
115 mask = 1 << (irq & 7); 115 mask = 1 << (irq & 7);
116 reg = (unsigned char *)&mfp.int_en_a + type*4 + 116 reg = (unsigned char *)&st_mfp.int_en_a + type*4 +
117 ((irq & 8) >> 2) + (((irq-8) & 16) << 3); 117 ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
118 return( *reg & mask ); 118 return( *reg & mask );
119} 119}
@@ -123,7 +123,7 @@ static inline void set_mfp_bit( unsigned irq, int type )
123{ unsigned char mask, *reg; 123{ unsigned char mask, *reg;
124 124
125 mask = 1 << (irq & 7); 125 mask = 1 << (irq & 7);
126 reg = (unsigned char *)&mfp.int_en_a + type*4 + 126 reg = (unsigned char *)&st_mfp.int_en_a + type*4 +
127 ((irq & 8) >> 2) + (((irq-8) & 16) << 3); 127 ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
128 __asm__ __volatile__ ( "orb %0,%1" 128 __asm__ __volatile__ ( "orb %0,%1"
129 : : "di" (mask), "m" (*reg) : "memory" ); 129 : : "di" (mask), "m" (*reg) : "memory" );
@@ -134,7 +134,7 @@ static inline void clear_mfp_bit( unsigned irq, int type )
134{ unsigned char mask, *reg; 134{ unsigned char mask, *reg;
135 135
136 mask = ~(1 << (irq & 7)); 136 mask = ~(1 << (irq & 7));
137 reg = (unsigned char *)&mfp.int_en_a + type*4 + 137 reg = (unsigned char *)&st_mfp.int_en_a + type*4 +
138 ((irq & 8) >> 2) + (((irq-8) & 16) << 3); 138 ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
139 if (type == MFP_PENDING || type == MFP_SERVICE) 139 if (type == MFP_PENDING || type == MFP_SERVICE)
140 __asm__ __volatile__ ( "moveb %0,%1" 140 __asm__ __volatile__ ( "moveb %0,%1"
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
index d01a5d2b7557..db902540bf2c 100644
--- a/arch/m68knommu/platform/5206e/config.c
+++ b/arch/m68knommu/platform/5206e/config.c
@@ -17,6 +17,7 @@
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfdma.h> 19#include <asm/mcfdma.h>
20#include <asm/mcfuart.h>
20 21
21/***************************************************************************/ 22/***************************************************************************/
22 23
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c
index dfdb5c2ed8e6..44baeb225dc7 100644
--- a/arch/m68knommu/platform/528x/config.c
+++ b/arch/m68knommu/platform/528x/config.c
@@ -24,7 +24,6 @@
24#include <asm/coldfire.h> 24#include <asm/coldfire.h>
25#include <asm/mcfsim.h> 25#include <asm/mcfsim.h>
26#include <asm/mcfuart.h> 26#include <asm/mcfuart.h>
27#include <asm/mcfqspi.h>
28 27
29#ifdef CONFIG_MTD_PARTITIONS 28#ifdef CONFIG_MTD_PARTITIONS
30#include <linux/mtd/partitions.h> 29#include <linux/mtd/partitions.h>
@@ -33,233 +32,6 @@
33/***************************************************************************/ 32/***************************************************************************/
34 33
35void coldfire_reset(void); 34void coldfire_reset(void);
36static void coldfire_qspi_cs_control(u8 cs, u8 command);
37
38/***************************************************************************/
39
40#if defined(CONFIG_SPI)
41
42#if defined(CONFIG_WILDFIRE)
43#define SPI_NUM_CHIPSELECTS 0x02
44#define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */
45#define SPI_CS_MASK 0x18
46
47#define FLASH_BLOCKSIZE (1024*64)
48#define FLASH_NUMBLOCKS 16
49#define FLASH_TYPE "m25p80"
50
51#define M25P80_CS 0
52#define MMC_CS 1
53
54#ifdef CONFIG_MTD_PARTITIONS
55static struct mtd_partition stm25p_partitions[] = {
56 /* sflash */
57 [0] = {
58 .name = "stm25p80",
59 .offset = 0x00000000,
60 .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS,
61 .mask_flags = 0
62 }
63};
64
65#endif
66
67#elif defined(CONFIG_WILDFIREMOD)
68
69#define SPI_NUM_CHIPSELECTS 0x08
70#define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */
71#define SPI_CS_MASK 0x78
72
73#define FLASH_BLOCKSIZE (1024*64)
74#define FLASH_NUMBLOCKS 64
75#define FLASH_TYPE "m25p32"
76/* Reserve 1M for the kernel parition */
77#define FLASH_KERNEL_SIZE (1024 * 1024)
78
79#define M25P80_CS 5
80#define MMC_CS 6
81
82#ifdef CONFIG_MTD_PARTITIONS
83static struct mtd_partition stm25p_partitions[] = {
84 /* sflash */
85 [0] = {
86 .name = "kernel",
87 .offset = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE,
88 .size = FLASH_KERNEL_SIZE,
89 .mask_flags = 0
90 },
91 [1] = {
92 .name = "image",
93 .offset = 0x00000000,
94 .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE,
95 .mask_flags = 0
96 },
97 [2] = {
98 .name = "all",
99 .offset = 0x00000000,
100 .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS,
101 .mask_flags = 0
102 }
103};
104#endif
105
106#else
107#define SPI_NUM_CHIPSELECTS 0x04
108#define SPI_PAR_VAL 0x7F /* Enable DIN, DOUT, CLK, CS0 - CS4 */
109#endif
110
111#ifdef MMC_CS
112static struct coldfire_spi_chip flash_chip_info = {
113 .mode = SPI_MODE_0,
114 .bits_per_word = 16,
115 .del_cs_to_clk = 17,
116 .del_after_trans = 1,
117 .void_write_data = 0
118};
119
120static struct coldfire_spi_chip mmc_chip_info = {
121 .mode = SPI_MODE_0,
122 .bits_per_word = 16,
123 .del_cs_to_clk = 17,
124 .del_after_trans = 1,
125 .void_write_data = 0xFFFF
126};
127#endif
128
129#ifdef M25P80_CS
130static struct flash_platform_data stm25p80_platform_data = {
131 .name = "ST M25P80 SPI Flash chip",
132#ifdef CONFIG_MTD_PARTITIONS
133 .parts = stm25p_partitions,
134 .nr_parts = sizeof(stm25p_partitions) / sizeof(*stm25p_partitions),
135#endif
136 .type = FLASH_TYPE
137};
138#endif
139
140static struct spi_board_info spi_board_info[] __initdata = {
141#ifdef M25P80_CS
142 {
143 .modalias = "m25p80",
144 .max_speed_hz = 16000000,
145 .bus_num = 1,
146 .chip_select = M25P80_CS,
147 .platform_data = &stm25p80_platform_data,
148 .controller_data = &flash_chip_info
149 },
150#endif
151#ifdef MMC_CS
152 {
153 .modalias = "mmc_spi",
154 .max_speed_hz = 16000000,
155 .bus_num = 1,
156 .chip_select = MMC_CS,
157 .controller_data = &mmc_chip_info
158 }
159#endif
160};
161
162static struct coldfire_spi_master coldfire_master_info = {
163 .bus_num = 1,
164 .num_chipselect = SPI_NUM_CHIPSELECTS,
165 .irq_source = MCF5282_QSPI_IRQ_SOURCE,
166 .irq_vector = MCF5282_QSPI_IRQ_VECTOR,
167 .irq_mask = ((0x01 << MCF5282_QSPI_IRQ_SOURCE) | 0x01),
168 .irq_lp = 0x2B, /* Level 5 and Priority 3 */
169 .par_val = SPI_PAR_VAL,
170 .cs_control = coldfire_qspi_cs_control,
171};
172
173static struct resource coldfire_spi_resources[] = {
174 [0] = {
175 .name = "qspi-par",
176 .start = MCF5282_QSPI_PAR,
177 .end = MCF5282_QSPI_PAR,
178 .flags = IORESOURCE_MEM
179 },
180
181 [1] = {
182 .name = "qspi-module",
183 .start = MCF5282_QSPI_QMR,
184 .end = MCF5282_QSPI_QMR + 0x18,
185 .flags = IORESOURCE_MEM
186 },
187
188 [2] = {
189 .name = "qspi-int-level",
190 .start = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE,
191 .end = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE,
192 .flags = IORESOURCE_MEM
193 },
194
195 [3] = {
196 .name = "qspi-int-mask",
197 .start = MCF5282_INTC0 + MCFINTC_IMRL,
198 .end = MCF5282_INTC0 + MCFINTC_IMRL,
199 .flags = IORESOURCE_MEM
200 }
201};
202
203static struct platform_device coldfire_spi = {
204 .name = "spi_coldfire",
205 .id = -1,
206 .resource = coldfire_spi_resources,
207 .num_resources = ARRAY_SIZE(coldfire_spi_resources),
208 .dev = {
209 .platform_data = &coldfire_master_info,
210 }
211};
212
213static void coldfire_qspi_cs_control(u8 cs, u8 command)
214{
215 u8 cs_bit = ((0x01 << cs) << 3) & SPI_CS_MASK;
216
217#if defined(CONFIG_WILDFIRE)
218 u8 cs_mask = ~(((0x01 << cs) << 3) & SPI_CS_MASK);
219#endif
220#if defined(CONFIG_WILDFIREMOD)
221 u8 cs_mask = (cs << 3) & SPI_CS_MASK;
222#endif
223
224 /*
225 * Don't do anything if the chip select is not
226 * one of the port qs pins.
227 */
228 if (command & QSPI_CS_INIT) {
229#if defined(CONFIG_WILDFIRE)
230 MCF5282_GPIO_DDRQS |= cs_bit;
231 MCF5282_GPIO_PQSPAR &= ~cs_bit;
232#endif
233
234#if defined(CONFIG_WILDFIREMOD)
235 MCF5282_GPIO_DDRQS |= SPI_CS_MASK;
236 MCF5282_GPIO_PQSPAR &= ~SPI_CS_MASK;
237#endif
238 }
239
240 if (command & QSPI_CS_ASSERT) {
241 MCF5282_GPIO_PORTQS &= ~SPI_CS_MASK;
242 MCF5282_GPIO_PORTQS |= cs_mask;
243 } else if (command & QSPI_CS_DROP) {
244 MCF5282_GPIO_PORTQS |= SPI_CS_MASK;
245 }
246}
247
248static int __init spi_dev_init(void)
249{
250 int retval;
251
252 retval = platform_device_register(&coldfire_spi);
253 if (retval < 0)
254 return retval;
255
256 if (ARRAY_SIZE(spi_board_info))
257 retval = spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
258
259 return retval;
260}
261
262#endif /* CONFIG_SPI */
263 35
264/***************************************************************************/ 36/***************************************************************************/
265 37
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 600eef3f3ac7..206cb7953b0c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -238,8 +238,12 @@ config MIPS_SIM
238 This option enables support for MIPS Technologies MIPSsim software 238 This option enables support for MIPS Technologies MIPSsim software
239 emulator. 239 emulator.
240 240
241config MACH_EMMA 241config NEC_MARKEINS
242 bool "NEC EMMA series based machines" 242 bool "NEC EMMA2RH Mark-eins board"
243 select SOC_EMMA2RH
244 select HW_HAS_PCI
245 help
246 This enables support for the NEC Electronics Mark-eins boards.
243 247
244config MACH_VR41XX 248config MACH_VR41XX
245 bool "NEC VR4100 series based machines" 249 bool "NEC VR4100 series based machines"
@@ -603,7 +607,7 @@ config CAVIUM_OCTEON_SIMULATOR
603 select SYS_SUPPORTS_64BIT_KERNEL 607 select SYS_SUPPORTS_64BIT_KERNEL
604 select SYS_SUPPORTS_BIG_ENDIAN 608 select SYS_SUPPORTS_BIG_ENDIAN
605 select SYS_SUPPORTS_HIGHMEM 609 select SYS_SUPPORTS_HIGHMEM
606 select CPU_CAVIUM_OCTEON 610 select SYS_HAS_CPU_CAVIUM_OCTEON
607 help 611 help
608 The Octeon simulator is software performance model of the Cavium 612 The Octeon simulator is software performance model of the Cavium
609 Octeon Processor. It supports simulating Octeon processors on x86 613 Octeon Processor. It supports simulating Octeon processors on x86
@@ -618,7 +622,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
618 select SYS_SUPPORTS_BIG_ENDIAN 622 select SYS_SUPPORTS_BIG_ENDIAN
619 select SYS_SUPPORTS_HIGHMEM 623 select SYS_SUPPORTS_HIGHMEM
620 select SYS_HAS_EARLY_PRINTK 624 select SYS_HAS_EARLY_PRINTK
621 select CPU_CAVIUM_OCTEON 625 select SYS_HAS_CPU_CAVIUM_OCTEON
622 select SWAP_IO_SPACE 626 select SWAP_IO_SPACE
623 help 627 help
624 This option supports all of the Octeon reference boards from Cavium 628 This option supports all of the Octeon reference boards from Cavium
@@ -637,7 +641,6 @@ endchoice
637 641
638source "arch/mips/alchemy/Kconfig" 642source "arch/mips/alchemy/Kconfig"
639source "arch/mips/basler/excite/Kconfig" 643source "arch/mips/basler/excite/Kconfig"
640source "arch/mips/emma/Kconfig"
641source "arch/mips/jazz/Kconfig" 644source "arch/mips/jazz/Kconfig"
642source "arch/mips/lasat/Kconfig" 645source "arch/mips/lasat/Kconfig"
643source "arch/mips/pmc-sierra/Kconfig" 646source "arch/mips/pmc-sierra/Kconfig"
@@ -895,6 +898,18 @@ config MIPS_RM9122
895 bool 898 bool
896 select SERIAL_RM9000 899 select SERIAL_RM9000
897 900
901config SOC_EMMA2RH
902 bool
903 select CEVT_R4K
904 select CSRC_R4K
905 select DMA_NONCOHERENT
906 select IRQ_CPU
907 select SWAP_IO_SPACE
908 select SYS_HAS_CPU_R5500
909 select SYS_SUPPORTS_32BIT_KERNEL
910 select SYS_SUPPORTS_64BIT_KERNEL
911 select SYS_SUPPORTS_BIG_ENDIAN
912
898config SOC_PNX833X 913config SOC_PNX833X
899 bool 914 bool
900 select CEVT_R4K 915 select CEVT_R4K
@@ -930,11 +945,6 @@ config SOC_PNX8550
930config SWAP_IO_SPACE 945config SWAP_IO_SPACE
931 bool 946 bool
932 947
933config EMMA2RH
934 bool
935 depends on MARKEINS
936 default y
937
938config SERIAL_RM9000 948config SERIAL_RM9000
939 bool 949 bool
940 950
@@ -1234,6 +1244,7 @@ config CPU_SB1
1234 1244
1235config CPU_CAVIUM_OCTEON 1245config CPU_CAVIUM_OCTEON
1236 bool "Cavium Octeon processor" 1246 bool "Cavium Octeon processor"
1247 depends on SYS_HAS_CPU_CAVIUM_OCTEON
1237 select IRQ_CPU 1248 select IRQ_CPU
1238 select IRQ_CPU_OCTEON 1249 select IRQ_CPU_OCTEON
1239 select CPU_HAS_PREFETCH 1250 select CPU_HAS_PREFETCH
@@ -1314,6 +1325,9 @@ config SYS_HAS_CPU_RM9000
1314config SYS_HAS_CPU_SB1 1325config SYS_HAS_CPU_SB1
1315 bool 1326 bool
1316 1327
1328config SYS_HAS_CPU_CAVIUM_OCTEON
1329 bool
1330
1317# 1331#
1318# CPU may reorder R->R, R->W, W->R, W->W 1332# CPU may reorder R->R, R->W, W->R, W->W
1319# Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC 1333# Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC
@@ -1387,6 +1401,7 @@ config 32BIT
1387config 64BIT 1401config 64BIT
1388 bool "64-bit kernel" 1402 bool "64-bit kernel"
1389 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL 1403 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
1404 select HAVE_SYSCALL_WRAPPERS
1390 help 1405 help
1391 Select this option if you want to build a 64-bit kernel. 1406 Select this option if you want to build a 64-bit kernel.
1392 1407
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 21b00e95daef..22dab2e14348 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -416,7 +416,7 @@ load-$(CONFIG_PNX8550_STB810) += 0xffffffff80060000
416# 416#
417# Common NEC EMMAXXX 417# Common NEC EMMAXXX
418# 418#
419core-$(CONFIG_SOC_EMMA) += arch/mips/emma/common/ 419core-$(CONFIG_SOC_EMMA2RH) += arch/mips/emma/common/
420cflags-$(CONFIG_SOC_EMMA2RH) += -I$(srctree)/arch/mips/include/asm/mach-emma2rh 420cflags-$(CONFIG_SOC_EMMA2RH) += -I$(srctree)/arch/mips/include/asm/mach-emma2rh
421 421
422# 422#
diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c
index 6fd441d16af5..f58d4ffb8945 100644
--- a/arch/mips/alchemy/common/time.c
+++ b/arch/mips/alchemy/common/time.c
@@ -118,7 +118,7 @@ void __init plat_time_init(void)
118 * setup counter 1 (RTC) to tick at full speed 118 * setup counter 1 (RTC) to tick at full speed
119 */ 119 */
120 t = 0xffffff; 120 t = 0xffffff;
121 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && t--) 121 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && --t)
122 asm volatile ("nop"); 122 asm volatile ("nop");
123 if (!t) 123 if (!t)
124 goto cntr_err; 124 goto cntr_err;
@@ -127,7 +127,7 @@ void __init plat_time_init(void)
127 au_sync(); 127 au_sync();
128 128
129 t = 0xffffff; 129 t = 0xffffff;
130 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && t--) 130 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t)
131 asm volatile ("nop"); 131 asm volatile ("nop");
132 if (!t) 132 if (!t)
133 goto cntr_err; 133 goto cntr_err;
@@ -135,7 +135,7 @@ void __init plat_time_init(void)
135 au_sync(); 135 au_sync();
136 136
137 t = 0xffffff; 137 t = 0xffffff;
138 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && t--) 138 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t)
139 asm volatile ("nop"); 139 asm volatile ("nop");
140 if (!t) 140 if (!t)
141 goto cntr_err; 141 goto cntr_err;
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index f2baea3039bb..0208723adf28 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -512,7 +512,7 @@ CONFIG_MD_LINEAR=m
512CONFIG_MD_RAID0=y 512CONFIG_MD_RAID0=y
513CONFIG_MD_RAID1=y 513CONFIG_MD_RAID1=y
514CONFIG_MD_RAID10=m 514CONFIG_MD_RAID10=m
515CONFIG_MD_RAID456=m 515CONFIG_MD_RAID456=y
516CONFIG_MD_RAID5_RESHAPE=y 516CONFIG_MD_RAID5_RESHAPE=y
517CONFIG_MD_MULTIPATH=m 517CONFIG_MD_MULTIPATH=m
518CONFIG_MD_FAULTY=m 518CONFIG_MD_FAULTY=m
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 9d5bd2a0af3d..5380f1f582d9 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc9 3# Linux kernel version: 2.6.29-rc7
4# Fri Jul 11 23:01:36 2008 4# Wed Mar 4 23:07:16 2009
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -18,8 +18,10 @@ CONFIG_MIPS=y
18# CONFIG_LEMOTE_FULONG is not set 18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_MALTA is not set 19# CONFIG_MIPS_MALTA is not set
20# CONFIG_MIPS_SIM is not set 20# CONFIG_MIPS_SIM is not set
21# CONFIG_MARKEINS is not set 21# CONFIG_MACH_EMMA is not set
22# CONFIG_MACH_VR41XX is not set 22# CONFIG_MACH_VR41XX is not set
23# CONFIG_NXP_STB220 is not set
24# CONFIG_NXP_STB225 is not set
23# CONFIG_PNX8550_JBS is not set 25# CONFIG_PNX8550_JBS is not set
24# CONFIG_PNX8550_STB810 is not set 26# CONFIG_PNX8550_STB810 is not set
25# CONFIG_PMC_MSP is not set 27# CONFIG_PMC_MSP is not set
@@ -39,7 +41,11 @@ CONFIG_MIPS=y
39# CONFIG_SNI_RM is not set 41# CONFIG_SNI_RM is not set
40CONFIG_MACH_TX39XX=y 42CONFIG_MACH_TX39XX=y
41# CONFIG_MACH_TX49XX is not set 43# CONFIG_MACH_TX49XX is not set
44# CONFIG_MIKROTIK_RB532 is not set
42# CONFIG_WR_PPMC is not set 45# CONFIG_WR_PPMC is not set
46# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
47# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
48CONFIG_MACH_TXX9=y
43CONFIG_TOSHIBA_JMR3927=y 49CONFIG_TOSHIBA_JMR3927=y
44CONFIG_SOC_TX3927=y 50CONFIG_SOC_TX3927=y
45# CONFIG_TOSHIBA_FPCIB0 is not set 51# CONFIG_TOSHIBA_FPCIB0 is not set
@@ -54,12 +60,14 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
54CONFIG_GENERIC_CLOCKEVENTS=y 60CONFIG_GENERIC_CLOCKEVENTS=y
55CONFIG_GENERIC_TIME=y 61CONFIG_GENERIC_TIME=y
56CONFIG_GENERIC_CMOS_UPDATE=y 62CONFIG_GENERIC_CMOS_UPDATE=y
57CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 63CONFIG_SCHED_OMIT_FRAME_POINTER=y
58CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 64CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
59CONFIG_CEVT_TXX9=y 65CONFIG_CEVT_TXX9=y
60CONFIG_GPIO_TXX9=y 66CONFIG_GPIO_TXX9=y
61CONFIG_DMA_NONCOHERENT=y 67CONFIG_DMA_NONCOHERENT=y
62CONFIG_DMA_NEED_PCI_MAP_STATE=y 68CONFIG_DMA_NEED_PCI_MAP_STATE=y
69CONFIG_EARLY_PRINTK=y
70CONFIG_SYS_HAS_EARLY_PRINTK=y
63# CONFIG_HOTPLUG_CPU is not set 71# CONFIG_HOTPLUG_CPU is not set
64# CONFIG_NO_IOPORT is not set 72# CONFIG_NO_IOPORT is not set
65CONFIG_GENERIC_GPIO=y 73CONFIG_GENERIC_GPIO=y
@@ -87,6 +95,7 @@ CONFIG_CPU_TX39XX=y
87# CONFIG_CPU_TX49XX is not set 95# CONFIG_CPU_TX49XX is not set
88# CONFIG_CPU_R5000 is not set 96# CONFIG_CPU_R5000 is not set
89# CONFIG_CPU_R5432 is not set 97# CONFIG_CPU_R5432 is not set
98# CONFIG_CPU_R5500 is not set
90# CONFIG_CPU_R6000 is not set 99# CONFIG_CPU_R6000 is not set
91# CONFIG_CPU_NEVADA is not set 100# CONFIG_CPU_NEVADA is not set
92# CONFIG_CPU_R8000 is not set 101# CONFIG_CPU_R8000 is not set
@@ -94,6 +103,7 @@ CONFIG_CPU_TX39XX=y
94# CONFIG_CPU_RM7000 is not set 103# CONFIG_CPU_RM7000 is not set
95# CONFIG_CPU_RM9000 is not set 104# CONFIG_CPU_RM9000 is not set
96# CONFIG_CPU_SB1 is not set 105# CONFIG_CPU_SB1 is not set
106# CONFIG_CPU_CAVIUM_OCTEON is not set
97CONFIG_SYS_HAS_CPU_TX39XX=y 107CONFIG_SYS_HAS_CPU_TX39XX=y
98CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 108CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
99CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 109CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
@@ -117,14 +127,12 @@ CONFIG_ARCH_FLATMEM_ENABLE=y
117CONFIG_ARCH_POPULATES_NODE_MAP=y 127CONFIG_ARCH_POPULATES_NODE_MAP=y
118CONFIG_FLATMEM=y 128CONFIG_FLATMEM=y
119CONFIG_FLAT_NODE_MEM_MAP=y 129CONFIG_FLAT_NODE_MEM_MAP=y
120# CONFIG_SPARSEMEM_STATIC is not set
121# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
122CONFIG_PAGEFLAGS_EXTENDED=y 130CONFIG_PAGEFLAGS_EXTENDED=y
123CONFIG_SPLIT_PTLOCK_CPUS=4 131CONFIG_SPLIT_PTLOCK_CPUS=4
124# CONFIG_RESOURCES_64BIT is not set 132# CONFIG_PHYS_ADDR_T_64BIT is not set
125CONFIG_ZONE_DMA_FLAG=0 133CONFIG_ZONE_DMA_FLAG=0
126CONFIG_VIRT_TO_BUS=y 134CONFIG_VIRT_TO_BUS=y
127# CONFIG_TICK_ONESHOT is not set 135CONFIG_UNEVICTABLE_LRU=y
128# CONFIG_NO_HZ is not set 136# CONFIG_NO_HZ is not set
129# CONFIG_HIGH_RES_TIMERS is not set 137# CONFIG_HIGH_RES_TIMERS is not set
130CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 138CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -159,6 +167,15 @@ CONFIG_SYSVIPC_SYSCTL=y
159# CONFIG_BSD_PROCESS_ACCT is not set 167# CONFIG_BSD_PROCESS_ACCT is not set
160# CONFIG_TASKSTATS is not set 168# CONFIG_TASKSTATS is not set
161# CONFIG_AUDIT is not set 169# CONFIG_AUDIT is not set
170
171#
172# RCU Subsystem
173#
174CONFIG_CLASSIC_RCU=y
175# CONFIG_TREE_RCU is not set
176# CONFIG_PREEMPT_RCU is not set
177# CONFIG_TREE_RCU_TRACE is not set
178# CONFIG_PREEMPT_RCU_TRACE is not set
162# CONFIG_IKCONFIG is not set 179# CONFIG_IKCONFIG is not set
163CONFIG_LOG_BUF_SHIFT=14 180CONFIG_LOG_BUF_SHIFT=14
164# CONFIG_CGROUPS is not set 181# CONFIG_CGROUPS is not set
@@ -171,7 +188,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
171CONFIG_SYSCTL=y 188CONFIG_SYSCTL=y
172CONFIG_EMBEDDED=y 189CONFIG_EMBEDDED=y
173CONFIG_SYSCTL_SYSCALL=y 190CONFIG_SYSCTL_SYSCALL=y
174CONFIG_SYSCTL_SYSCALL_CHECK=y
175CONFIG_KALLSYMS=y 191CONFIG_KALLSYMS=y
176# CONFIG_KALLSYMS_EXTRA_PASS is not set 192# CONFIG_KALLSYMS_EXTRA_PASS is not set
177# CONFIG_HOTPLUG is not set 193# CONFIG_HOTPLUG is not set
@@ -188,26 +204,23 @@ CONFIG_SIGNALFD=y
188CONFIG_TIMERFD=y 204CONFIG_TIMERFD=y
189CONFIG_EVENTFD=y 205CONFIG_EVENTFD=y
190CONFIG_SHMEM=y 206CONFIG_SHMEM=y
207CONFIG_AIO=y
191CONFIG_VM_EVENT_COUNTERS=y 208CONFIG_VM_EVENT_COUNTERS=y
209CONFIG_PCI_QUIRKS=y
192CONFIG_SLAB=y 210CONFIG_SLAB=y
193# CONFIG_SLUB is not set 211# CONFIG_SLUB is not set
194# CONFIG_SLOB is not set 212# CONFIG_SLOB is not set
195# CONFIG_PROFILING is not set 213# CONFIG_PROFILING is not set
196# CONFIG_MARKERS is not set
197CONFIG_HAVE_OPROFILE=y 214CONFIG_HAVE_OPROFILE=y
198# CONFIG_HAVE_KPROBES is not set 215# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
199# CONFIG_HAVE_KRETPROBES is not set
200# CONFIG_HAVE_DMA_ATTRS is not set
201CONFIG_PROC_PAGE_MONITOR=y
202CONFIG_SLABINFO=y 216CONFIG_SLABINFO=y
203CONFIG_RT_MUTEXES=y 217CONFIG_RT_MUTEXES=y
204# CONFIG_TINY_SHMEM is not set
205CONFIG_BASE_SMALL=0 218CONFIG_BASE_SMALL=0
206# CONFIG_MODULES is not set 219# CONFIG_MODULES is not set
207CONFIG_BLOCK=y 220CONFIG_BLOCK=y
208# CONFIG_LBD is not set 221# CONFIG_LBD is not set
209# CONFIG_BLK_DEV_IO_TRACE is not set 222# CONFIG_BLK_DEV_IO_TRACE is not set
210# CONFIG_LSF is not set 223# CONFIG_BLK_DEV_INTEGRITY is not set
211 224
212# 225#
213# IO Schedulers 226# IO Schedulers
@@ -221,7 +234,7 @@ CONFIG_IOSCHED_CFQ=y
221CONFIG_DEFAULT_CFQ=y 234CONFIG_DEFAULT_CFQ=y
222# CONFIG_DEFAULT_NOOP is not set 235# CONFIG_DEFAULT_NOOP is not set
223CONFIG_DEFAULT_IOSCHED="cfq" 236CONFIG_DEFAULT_IOSCHED="cfq"
224CONFIG_CLASSIC_RCU=y 237# CONFIG_FREEZER is not set
225 238
226# 239#
227# Bus options (PCI, PCMCIA, EISA, ISA, TC) 240# Bus options (PCI, PCMCIA, EISA, ISA, TC)
@@ -231,12 +244,15 @@ CONFIG_PCI=y
231CONFIG_PCI_DOMAINS=y 244CONFIG_PCI_DOMAINS=y
232# CONFIG_ARCH_SUPPORTS_MSI is not set 245# CONFIG_ARCH_SUPPORTS_MSI is not set
233CONFIG_PCI_LEGACY=y 246CONFIG_PCI_LEGACY=y
247# CONFIG_PCI_STUB is not set
234CONFIG_MMU=y 248CONFIG_MMU=y
235 249
236# 250#
237# Executable file formats 251# Executable file formats
238# 252#
239CONFIG_BINFMT_ELF=y 253CONFIG_BINFMT_ELF=y
254# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
255# CONFIG_HAVE_AOUT is not set
240# CONFIG_BINFMT_MISC is not set 256# CONFIG_BINFMT_MISC is not set
241CONFIG_TRAD_SIGNALS=y 257CONFIG_TRAD_SIGNALS=y
242 258
@@ -245,15 +261,12 @@ CONFIG_TRAD_SIGNALS=y
245# 261#
246CONFIG_ARCH_SUSPEND_POSSIBLE=y 262CONFIG_ARCH_SUSPEND_POSSIBLE=y
247# CONFIG_PM is not set 263# CONFIG_PM is not set
248
249#
250# Networking
251#
252CONFIG_NET=y 264CONFIG_NET=y
253 265
254# 266#
255# Networking options 267# Networking options
256# 268#
269CONFIG_COMPAT_NET_DEV_OPS=y
257CONFIG_PACKET=y 270CONFIG_PACKET=y
258# CONFIG_PACKET_MMAP is not set 271# CONFIG_PACKET_MMAP is not set
259CONFIG_UNIX=y 272CONFIG_UNIX=y
@@ -293,6 +306,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
293# CONFIG_IPX is not set 306# CONFIG_IPX is not set
294# CONFIG_ATALK is not set 307# CONFIG_ATALK is not set
295# CONFIG_NET_SCHED is not set 308# CONFIG_NET_SCHED is not set
309# CONFIG_DCB is not set
296 310
297# 311#
298# Network testing 312# Network testing
@@ -302,14 +316,9 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
302# CONFIG_CAN is not set 316# CONFIG_CAN is not set
303# CONFIG_IRDA is not set 317# CONFIG_IRDA is not set
304# CONFIG_BT is not set 318# CONFIG_BT is not set
305 319# CONFIG_PHONET is not set
306# 320# CONFIG_WIRELESS is not set
307# Wireless 321# CONFIG_WIMAX is not set
308#
309# CONFIG_CFG80211 is not set
310# CONFIG_WIRELESS_EXT is not set
311# CONFIG_MAC80211 is not set
312# CONFIG_IEEE80211 is not set
313# CONFIG_RFKILL is not set 322# CONFIG_RFKILL is not set
314 323
315# 324#
@@ -323,7 +332,89 @@ CONFIG_STANDALONE=y
323CONFIG_PREVENT_FIRMWARE_BUILD=y 332CONFIG_PREVENT_FIRMWARE_BUILD=y
324# CONFIG_SYS_HYPERVISOR is not set 333# CONFIG_SYS_HYPERVISOR is not set
325# CONFIG_CONNECTOR is not set 334# CONFIG_CONNECTOR is not set
326# CONFIG_MTD is not set 335CONFIG_MTD=y
336# CONFIG_MTD_DEBUG is not set
337# CONFIG_MTD_CONCAT is not set
338CONFIG_MTD_PARTITIONS=y
339# CONFIG_MTD_REDBOOT_PARTS is not set
340CONFIG_MTD_CMDLINE_PARTS=y
341# CONFIG_MTD_AR7_PARTS is not set
342
343#
344# User Modules And Translation Layers
345#
346CONFIG_MTD_CHAR=y
347# CONFIG_MTD_BLKDEVS is not set
348# CONFIG_MTD_BLOCK is not set
349# CONFIG_MTD_BLOCK_RO is not set
350# CONFIG_FTL is not set
351# CONFIG_NFTL is not set
352# CONFIG_INFTL is not set
353# CONFIG_RFD_FTL is not set
354# CONFIG_SSFDC is not set
355# CONFIG_MTD_OOPS is not set
356
357#
358# RAM/ROM/Flash chip drivers
359#
360CONFIG_MTD_CFI=y
361CONFIG_MTD_JEDECPROBE=y
362CONFIG_MTD_GEN_PROBE=y
363# CONFIG_MTD_CFI_ADV_OPTIONS is not set
364CONFIG_MTD_MAP_BANK_WIDTH_1=y
365CONFIG_MTD_MAP_BANK_WIDTH_2=y
366CONFIG_MTD_MAP_BANK_WIDTH_4=y
367# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
368# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
369# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
370CONFIG_MTD_CFI_I1=y
371CONFIG_MTD_CFI_I2=y
372# CONFIG_MTD_CFI_I4 is not set
373# CONFIG_MTD_CFI_I8 is not set
374# CONFIG_MTD_CFI_INTELEXT is not set
375CONFIG_MTD_CFI_AMDSTD=y
376# CONFIG_MTD_CFI_STAA is not set
377CONFIG_MTD_CFI_UTIL=y
378# CONFIG_MTD_RAM is not set
379# CONFIG_MTD_ROM is not set
380# CONFIG_MTD_ABSENT is not set
381
382#
383# Mapping drivers for chip access
384#
385# CONFIG_MTD_COMPLEX_MAPPINGS is not set
386CONFIG_MTD_PHYSMAP=y
387# CONFIG_MTD_PHYSMAP_COMPAT is not set
388# CONFIG_MTD_INTEL_VR_NOR is not set
389# CONFIG_MTD_PLATRAM is not set
390
391#
392# Self-contained MTD device drivers
393#
394# CONFIG_MTD_PMC551 is not set
395# CONFIG_MTD_SLRAM is not set
396# CONFIG_MTD_PHRAM is not set
397# CONFIG_MTD_MTDRAM is not set
398# CONFIG_MTD_BLOCK2MTD is not set
399
400#
401# Disk-On-Chip Device Drivers
402#
403# CONFIG_MTD_DOC2000 is not set
404# CONFIG_MTD_DOC2001 is not set
405# CONFIG_MTD_DOC2001PLUS is not set
406# CONFIG_MTD_NAND is not set
407# CONFIG_MTD_ONENAND is not set
408
409#
410# LPDDR flash memory drivers
411#
412# CONFIG_MTD_LPDDR is not set
413
414#
415# UBI - Unsorted block images
416#
417# CONFIG_MTD_UBI is not set
327# CONFIG_PARPORT is not set 418# CONFIG_PARPORT is not set
328CONFIG_BLK_DEV=y 419CONFIG_BLK_DEV=y
329# CONFIG_BLK_CPQ_DA is not set 420# CONFIG_BLK_CPQ_DA is not set
@@ -336,6 +427,7 @@ CONFIG_BLK_DEV=y
336# CONFIG_BLK_DEV_RAM is not set 427# CONFIG_BLK_DEV_RAM is not set
337# CONFIG_CDROM_PKTCDVD is not set 428# CONFIG_CDROM_PKTCDVD is not set
338# CONFIG_ATA_OVER_ETH is not set 429# CONFIG_ATA_OVER_ETH is not set
430# CONFIG_BLK_DEV_HD is not set
339# CONFIG_MISC_DEVICES is not set 431# CONFIG_MISC_DEVICES is not set
340CONFIG_HAVE_IDE=y 432CONFIG_HAVE_IDE=y
341# CONFIG_IDE is not set 433# CONFIG_IDE is not set
@@ -361,7 +453,6 @@ CONFIG_HAVE_IDE=y
361# CONFIG_IEEE1394 is not set 453# CONFIG_IEEE1394 is not set
362# CONFIG_I2O is not set 454# CONFIG_I2O is not set
363CONFIG_NETDEVICES=y 455CONFIG_NETDEVICES=y
364# CONFIG_NETDEVICES_MULTIQUEUE is not set
365# CONFIG_DUMMY is not set 456# CONFIG_DUMMY is not set
366# CONFIG_BONDING is not set 457# CONFIG_BONDING is not set
367# CONFIG_EQUALIZER is not set 458# CONFIG_EQUALIZER is not set
@@ -383,6 +474,9 @@ CONFIG_PHYLIB=y
383# CONFIG_BROADCOM_PHY is not set 474# CONFIG_BROADCOM_PHY is not set
384# CONFIG_ICPLUS_PHY is not set 475# CONFIG_ICPLUS_PHY is not set
385# CONFIG_REALTEK_PHY is not set 476# CONFIG_REALTEK_PHY is not set
477# CONFIG_NATIONAL_PHY is not set
478# CONFIG_STE10XP is not set
479# CONFIG_LSI_ET1011C_PHY is not set
386# CONFIG_FIXED_PHY is not set 480# CONFIG_FIXED_PHY is not set
387# CONFIG_MDIO_BITBANG is not set 481# CONFIG_MDIO_BITBANG is not set
388CONFIG_NET_ETHERNET=y 482CONFIG_NET_ETHERNET=y
@@ -392,6 +486,7 @@ CONFIG_NET_ETHERNET=y
392# CONFIG_SUNGEM is not set 486# CONFIG_SUNGEM is not set
393# CONFIG_CASSINI is not set 487# CONFIG_CASSINI is not set
394# CONFIG_NET_VENDOR_3COM is not set 488# CONFIG_NET_VENDOR_3COM is not set
489# CONFIG_SMC91X is not set
395# CONFIG_DM9000 is not set 490# CONFIG_DM9000 is not set
396# CONFIG_NET_TULIP is not set 491# CONFIG_NET_TULIP is not set
397# CONFIG_HP100 is not set 492# CONFIG_HP100 is not set
@@ -399,6 +494,9 @@ CONFIG_NET_ETHERNET=y
399# CONFIG_IBM_NEW_EMAC_RGMII is not set 494# CONFIG_IBM_NEW_EMAC_RGMII is not set
400# CONFIG_IBM_NEW_EMAC_TAH is not set 495# CONFIG_IBM_NEW_EMAC_TAH is not set
401# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 496# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
497# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
498# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
499# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
402CONFIG_NET_PCI=y 500CONFIG_NET_PCI=y
403# CONFIG_PCNET32 is not set 501# CONFIG_PCNET32 is not set
404# CONFIG_AMD8111_ETH is not set 502# CONFIG_AMD8111_ETH is not set
@@ -406,7 +504,6 @@ CONFIG_NET_PCI=y
406# CONFIG_B44 is not set 504# CONFIG_B44 is not set
407# CONFIG_FORCEDETH is not set 505# CONFIG_FORCEDETH is not set
408CONFIG_TC35815=y 506CONFIG_TC35815=y
409# CONFIG_EEPRO100 is not set
410# CONFIG_E100 is not set 507# CONFIG_E100 is not set
411# CONFIG_FEALNX is not set 508# CONFIG_FEALNX is not set
412# CONFIG_NATSEMI is not set 509# CONFIG_NATSEMI is not set
@@ -415,9 +512,11 @@ CONFIG_TC35815=y
415# CONFIG_R6040 is not set 512# CONFIG_R6040 is not set
416# CONFIG_SIS900 is not set 513# CONFIG_SIS900 is not set
417# CONFIG_EPIC100 is not set 514# CONFIG_EPIC100 is not set
515# CONFIG_SMSC9420 is not set
418# CONFIG_SUNDANCE is not set 516# CONFIG_SUNDANCE is not set
419# CONFIG_TLAN is not set 517# CONFIG_TLAN is not set
420# CONFIG_VIA_RHINE is not set 518# CONFIG_VIA_RHINE is not set
519# CONFIG_ATL2 is not set
421# CONFIG_NETDEV_1000 is not set 520# CONFIG_NETDEV_1000 is not set
422# CONFIG_NETDEV_10000 is not set 521# CONFIG_NETDEV_10000 is not set
423# CONFIG_TR is not set 522# CONFIG_TR is not set
@@ -428,6 +527,10 @@ CONFIG_TC35815=y
428# CONFIG_WLAN_PRE80211 is not set 527# CONFIG_WLAN_PRE80211 is not set
429# CONFIG_WLAN_80211 is not set 528# CONFIG_WLAN_80211 is not set
430# CONFIG_IWLWIFI_LEDS is not set 529# CONFIG_IWLWIFI_LEDS is not set
530
531#
532# Enable WiMAX (Networking options) to see the WiMAX drivers
533#
431# CONFIG_WAN is not set 534# CONFIG_WAN is not set
432# CONFIG_FDDI is not set 535# CONFIG_FDDI is not set
433# CONFIG_PPP is not set 536# CONFIG_PPP is not set
@@ -440,27 +543,7 @@ CONFIG_TC35815=y
440# 543#
441# Input device support 544# Input device support
442# 545#
443CONFIG_INPUT=y 546# CONFIG_INPUT is not set
444# CONFIG_INPUT_FF_MEMLESS is not set
445# CONFIG_INPUT_POLLDEV is not set
446
447#
448# Userland interfaces
449#
450# CONFIG_INPUT_MOUSEDEV is not set
451# CONFIG_INPUT_JOYDEV is not set
452# CONFIG_INPUT_EVDEV is not set
453# CONFIG_INPUT_EVBUG is not set
454
455#
456# Input Device Drivers
457#
458# CONFIG_INPUT_KEYBOARD is not set
459# CONFIG_INPUT_MOUSE is not set
460# CONFIG_INPUT_JOYSTICK is not set
461# CONFIG_INPUT_TABLET is not set
462# CONFIG_INPUT_TOUCHSCREEN is not set
463# CONFIG_INPUT_MISC is not set
464 547
465# 548#
466# Hardware I/O ports 549# Hardware I/O ports
@@ -517,10 +600,11 @@ CONFIG_LEGACY_PTY_COUNT=256
517CONFIG_DEVPORT=y 600CONFIG_DEVPORT=y
518# CONFIG_I2C is not set 601# CONFIG_I2C is not set
519# CONFIG_SPI is not set 602# CONFIG_SPI is not set
520CONFIG_HAVE_GPIO_LIB=y 603CONFIG_ARCH_REQUIRE_GPIOLIB=y
604CONFIG_GPIOLIB=y
521 605
522# 606#
523# GPIO Support 607# Memory mapped GPIO expanders:
524# 608#
525 609
526# 610#
@@ -528,6 +612,11 @@ CONFIG_HAVE_GPIO_LIB=y
528# 612#
529 613
530# 614#
615# PCI GPIO expanders:
616#
617# CONFIG_GPIO_BT8XX is not set
618
619#
531# SPI GPIO expanders: 620# SPI GPIO expanders:
532# 621#
533# CONFIG_W1 is not set 622# CONFIG_W1 is not set
@@ -542,6 +631,7 @@ CONFIG_WATCHDOG=y
542# Watchdog Device Drivers 631# Watchdog Device Drivers
543# 632#
544# CONFIG_SOFT_WATCHDOG is not set 633# CONFIG_SOFT_WATCHDOG is not set
634# CONFIG_ALIM7101_WDT is not set
545CONFIG_TXX9_WDT=y 635CONFIG_TXX9_WDT=y
546 636
547# 637#
@@ -549,18 +639,21 @@ CONFIG_TXX9_WDT=y
549# 639#
550# CONFIG_PCIPCWATCHDOG is not set 640# CONFIG_PCIPCWATCHDOG is not set
551# CONFIG_WDTPCI is not set 641# CONFIG_WDTPCI is not set
642CONFIG_SSB_POSSIBLE=y
552 643
553# 644#
554# Sonics Silicon Backplane 645# Sonics Silicon Backplane
555# 646#
556CONFIG_SSB_POSSIBLE=y
557# CONFIG_SSB is not set 647# CONFIG_SSB is not set
558 648
559# 649#
560# Multifunction device drivers 650# Multifunction device drivers
561# 651#
652# CONFIG_MFD_CORE is not set
562# CONFIG_MFD_SM501 is not set 653# CONFIG_MFD_SM501 is not set
563# CONFIG_HTC_PASIC3 is not set 654# CONFIG_HTC_PASIC3 is not set
655# CONFIG_MFD_TMIO is not set
656# CONFIG_REGULATOR is not set
564 657
565# 658#
566# Multimedia devices 659# Multimedia devices
@@ -591,16 +684,26 @@ CONFIG_SSB_POSSIBLE=y
591# Display device support 684# Display device support
592# 685#
593# CONFIG_DISPLAY_SUPPORT is not set 686# CONFIG_DISPLAY_SUPPORT is not set
594
595#
596# Sound
597#
598# CONFIG_SOUND is not set 687# CONFIG_SOUND is not set
599# CONFIG_HID_SUPPORT is not set
600# CONFIG_USB_SUPPORT is not set 688# CONFIG_USB_SUPPORT is not set
601# CONFIG_MMC is not set 689# CONFIG_MMC is not set
602# CONFIG_MEMSTICK is not set 690# CONFIG_MEMSTICK is not set
603# CONFIG_NEW_LEDS is not set 691CONFIG_NEW_LEDS=y
692CONFIG_LEDS_CLASS=y
693
694#
695# LED drivers
696#
697CONFIG_LEDS_GPIO=y
698
699#
700# LED Triggers
701#
702CONFIG_LEDS_TRIGGERS=y
703# CONFIG_LEDS_TRIGGER_TIMER is not set
704CONFIG_LEDS_TRIGGER_HEARTBEAT=y
705# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
706# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
604# CONFIG_ACCESSIBILITY is not set 707# CONFIG_ACCESSIBILITY is not set
605# CONFIG_INFINIBAND is not set 708# CONFIG_INFINIBAND is not set
606CONFIG_RTC_LIB=y 709CONFIG_RTC_LIB=y
@@ -626,27 +729,34 @@ CONFIG_RTC_INTF_DEV=y
626# Platform RTC drivers 729# Platform RTC drivers
627# 730#
628# CONFIG_RTC_DRV_CMOS is not set 731# CONFIG_RTC_DRV_CMOS is not set
732# CONFIG_RTC_DRV_DS1286 is not set
629# CONFIG_RTC_DRV_DS1511 is not set 733# CONFIG_RTC_DRV_DS1511 is not set
630# CONFIG_RTC_DRV_DS1553 is not set 734# CONFIG_RTC_DRV_DS1553 is not set
631CONFIG_RTC_DRV_DS1742=y 735CONFIG_RTC_DRV_DS1742=y
632# CONFIG_RTC_DRV_STK17TA8 is not set 736# CONFIG_RTC_DRV_STK17TA8 is not set
633# CONFIG_RTC_DRV_M48T86 is not set 737# CONFIG_RTC_DRV_M48T86 is not set
738# CONFIG_RTC_DRV_M48T35 is not set
634# CONFIG_RTC_DRV_M48T59 is not set 739# CONFIG_RTC_DRV_M48T59 is not set
740# CONFIG_RTC_DRV_BQ4802 is not set
635# CONFIG_RTC_DRV_V3020 is not set 741# CONFIG_RTC_DRV_V3020 is not set
636 742
637# 743#
638# on-CPU RTC drivers 744# on-CPU RTC drivers
639# 745#
746# CONFIG_DMADEVICES is not set
640# CONFIG_UIO is not set 747# CONFIG_UIO is not set
748# CONFIG_STAGING is not set
641 749
642# 750#
643# File systems 751# File systems
644# 752#
645# CONFIG_EXT2_FS is not set 753# CONFIG_EXT2_FS is not set
646# CONFIG_EXT3_FS is not set 754# CONFIG_EXT3_FS is not set
755# CONFIG_EXT4_FS is not set
647# CONFIG_REISERFS_FS is not set 756# CONFIG_REISERFS_FS is not set
648# CONFIG_JFS_FS is not set 757# CONFIG_JFS_FS is not set
649# CONFIG_FS_POSIX_ACL is not set 758# CONFIG_FS_POSIX_ACL is not set
759CONFIG_FILE_LOCKING=y
650# CONFIG_XFS_FS is not set 760# CONFIG_XFS_FS is not set
651# CONFIG_OCFS2_FS is not set 761# CONFIG_OCFS2_FS is not set
652CONFIG_DNOTIFY=y 762CONFIG_DNOTIFY=y
@@ -676,28 +786,17 @@ CONFIG_INOTIFY_USER=y
676CONFIG_PROC_FS=y 786CONFIG_PROC_FS=y
677CONFIG_PROC_KCORE=y 787CONFIG_PROC_KCORE=y
678CONFIG_PROC_SYSCTL=y 788CONFIG_PROC_SYSCTL=y
789CONFIG_PROC_PAGE_MONITOR=y
679CONFIG_SYSFS=y 790CONFIG_SYSFS=y
680# CONFIG_TMPFS is not set 791# CONFIG_TMPFS is not set
681# CONFIG_HUGETLB_PAGE is not set 792# CONFIG_HUGETLB_PAGE is not set
682# CONFIG_CONFIGFS_FS is not set 793# CONFIG_CONFIGFS_FS is not set
683 794# CONFIG_MISC_FILESYSTEMS is not set
684#
685# Miscellaneous filesystems
686#
687# CONFIG_HFSPLUS_FS is not set
688# CONFIG_CRAMFS is not set
689# CONFIG_VXFS_FS is not set
690# CONFIG_MINIX_FS is not set
691# CONFIG_HPFS_FS is not set
692# CONFIG_QNX4FS_FS is not set
693# CONFIG_ROMFS_FS is not set
694# CONFIG_SYSV_FS is not set
695# CONFIG_UFS_FS is not set
696CONFIG_NETWORK_FILESYSTEMS=y 795CONFIG_NETWORK_FILESYSTEMS=y
697CONFIG_NFS_FS=y 796CONFIG_NFS_FS=y
698# CONFIG_NFS_V3 is not set 797# CONFIG_NFS_V3 is not set
699# CONFIG_NFSD is not set
700CONFIG_ROOT_NFS=y 798CONFIG_ROOT_NFS=y
799# CONFIG_NFSD is not set
701CONFIG_LOCKD=y 800CONFIG_LOCKD=y
702CONFIG_NFS_COMMON=y 801CONFIG_NFS_COMMON=y
703CONFIG_SUNRPC=y 802CONFIG_SUNRPC=y
@@ -726,7 +825,16 @@ CONFIG_FRAME_WARN=1024
726# CONFIG_DEBUG_FS is not set 825# CONFIG_DEBUG_FS is not set
727# CONFIG_HEADERS_CHECK is not set 826# CONFIG_HEADERS_CHECK is not set
728# CONFIG_DEBUG_KERNEL is not set 827# CONFIG_DEBUG_KERNEL is not set
828# CONFIG_DEBUG_MEMORY_INIT is not set
829# CONFIG_RCU_CPU_STALL_DETECTOR is not set
830CONFIG_SYSCTL_SYSCALL_CHECK=y
831
832#
833# Tracers
834#
835# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
729# CONFIG_SAMPLES is not set 836# CONFIG_SAMPLES is not set
837CONFIG_HAVE_ARCH_KGDB=y
730CONFIG_CMDLINE="" 838CONFIG_CMDLINE=""
731 839
732# 840#
@@ -734,15 +842,18 @@ CONFIG_CMDLINE=""
734# 842#
735# CONFIG_KEYS is not set 843# CONFIG_KEYS is not set
736# CONFIG_SECURITY is not set 844# CONFIG_SECURITY is not set
845# CONFIG_SECURITYFS is not set
846# CONFIG_SECURITY_FILE_CAPABILITIES is not set
737# CONFIG_CRYPTO is not set 847# CONFIG_CRYPTO is not set
738 848
739# 849#
740# Library routines 850# Library routines
741# 851#
742CONFIG_BITREVERSE=y 852CONFIG_BITREVERSE=y
743# CONFIG_GENERIC_FIND_FIRST_BIT is not set 853CONFIG_GENERIC_FIND_LAST_BIT=y
744# CONFIG_CRC_CCITT is not set 854# CONFIG_CRC_CCITT is not set
745# CONFIG_CRC16 is not set 855# CONFIG_CRC16 is not set
856# CONFIG_CRC_T10DIF is not set
746# CONFIG_CRC_ITU_T is not set 857# CONFIG_CRC_ITU_T is not set
747CONFIG_CRC32=y 858CONFIG_CRC32=y
748# CONFIG_CRC7 is not set 859# CONFIG_CRC7 is not set
diff --git a/arch/mips/configs/emma2rh_defconfig b/arch/mips/configs/markeins_defconfig
index fea9bc9865a3..bad8901f8f3c 100644
--- a/arch/mips/configs/emma2rh_defconfig
+++ b/arch/mips/configs/markeins_defconfig
@@ -35,7 +35,7 @@ CONFIG_ZONE_DMA=y
35# CONFIG_PNX8550_STB810 is not set 35# CONFIG_PNX8550_STB810 is not set
36# CONFIG_MACH_VR41XX is not set 36# CONFIG_MACH_VR41XX is not set
37# CONFIG_PMC_YOSEMITE is not set 37# CONFIG_PMC_YOSEMITE is not set
38CONFIG_MARKEINS=y 38CONFIG_NEC_MARKEINS=y
39# CONFIG_SGI_IP22 is not set 39# CONFIG_SGI_IP22 is not set
40# CONFIG_SGI_IP27 is not set 40# CONFIG_SGI_IP27 is not set
41# CONFIG_SGI_IP32 is not set 41# CONFIG_SGI_IP32 is not set
@@ -68,7 +68,7 @@ CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
68CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y 68CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
69CONFIG_IRQ_CPU=y 69CONFIG_IRQ_CPU=y
70CONFIG_SWAP_IO_SPACE=y 70CONFIG_SWAP_IO_SPACE=y
71CONFIG_EMMA2RH=y 71CONFIG_SOC_EMMA2RH=y
72CONFIG_MIPS_L1_CACHE_SHIFT=5 72CONFIG_MIPS_L1_CACHE_SHIFT=5
73 73
74# 74#
@@ -574,9 +574,9 @@ CONFIG_MTD_CFI_UTIL=y
574# 574#
575# CONFIG_MTD_COMPLEX_MAPPINGS is not set 575# CONFIG_MTD_COMPLEX_MAPPINGS is not set
576CONFIG_MTD_PHYSMAP=y 576CONFIG_MTD_PHYSMAP=y
577CONFIG_MTD_PHYSMAP_START=0x1e000000 577CONFIG_MTD_PHYSMAP_START=0x0
578CONFIG_MTD_PHYSMAP_LEN=0x02000000 578CONFIG_MTD_PHYSMAP_LEN=0x0
579CONFIG_MTD_PHYSMAP_BANKWIDTH=2 579CONFIG_MTD_PHYSMAP_BANKWIDTH=0
580# CONFIG_MTD_PLATRAM is not set 580# CONFIG_MTD_PLATRAM is not set
581 581
582# 582#
diff --git a/arch/mips/configs/rbtx49xx_defconfig b/arch/mips/configs/rbtx49xx_defconfig
index 83d5c58662c8..1efe977497dd 100644
--- a/arch/mips/configs/rbtx49xx_defconfig
+++ b/arch/mips/configs/rbtx49xx_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc9 3# Linux kernel version: 2.6.29-rc7
4# Fri Jul 11 23:03:21 2008 4# Wed Mar 4 23:08:06 2009
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -18,8 +18,10 @@ CONFIG_MIPS=y
18# CONFIG_LEMOTE_FULONG is not set 18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_MALTA is not set 19# CONFIG_MIPS_MALTA is not set
20# CONFIG_MIPS_SIM is not set 20# CONFIG_MIPS_SIM is not set
21# CONFIG_MARKEINS is not set 21# CONFIG_MACH_EMMA is not set
22# CONFIG_MACH_VR41XX is not set 22# CONFIG_MACH_VR41XX is not set
23# CONFIG_NXP_STB220 is not set
24# CONFIG_NXP_STB225 is not set
23# CONFIG_PNX8550_JBS is not set 25# CONFIG_PNX8550_JBS is not set
24# CONFIG_PNX8550_STB810 is not set 26# CONFIG_PNX8550_STB810 is not set
25# CONFIG_PMC_MSP is not set 27# CONFIG_PMC_MSP is not set
@@ -39,20 +41,28 @@ CONFIG_MIPS=y
39# CONFIG_SNI_RM is not set 41# CONFIG_SNI_RM is not set
40# CONFIG_MACH_TX39XX is not set 42# CONFIG_MACH_TX39XX is not set
41CONFIG_MACH_TX49XX=y 43CONFIG_MACH_TX49XX=y
44# CONFIG_MIKROTIK_RB532 is not set
42# CONFIG_WR_PPMC is not set 45# CONFIG_WR_PPMC is not set
46# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
47# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
48CONFIG_MACH_TXX9=y
43CONFIG_TOSHIBA_RBTX4927=y 49CONFIG_TOSHIBA_RBTX4927=y
44CONFIG_TOSHIBA_RBTX4938=y 50CONFIG_TOSHIBA_RBTX4938=y
51CONFIG_TOSHIBA_RBTX4939=y
45CONFIG_SOC_TX4927=y 52CONFIG_SOC_TX4927=y
46CONFIG_SOC_TX4938=y 53CONFIG_SOC_TX4938=y
54CONFIG_SOC_TX4939=y
55CONFIG_TXX9_7SEGLED=y
47# CONFIG_TOSHIBA_FPCIB0 is not set 56# CONFIG_TOSHIBA_FPCIB0 is not set
48CONFIG_PICMG_PCI_BACKPLANE_DEFAULT=y 57CONFIG_PICMG_PCI_BACKPLANE_DEFAULT=y
49 58
50# 59#
51# Multiplex Pin Select 60# Multiplex Pin Select
52# 61#
53CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61=y 62# CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61 is not set
54# CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND is not set 63# CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND is not set
55# CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA is not set 64# CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA is not set
65CONFIG_TOSHIBA_RBTX4938_MPLEX_KEEP=y
56CONFIG_PCI_TX4927=y 66CONFIG_PCI_TX4927=y
57CONFIG_RWSEM_GENERIC_SPINLOCK=y 67CONFIG_RWSEM_GENERIC_SPINLOCK=y
58# CONFIG_ARCH_HAS_ILOG2_U32 is not set 68# CONFIG_ARCH_HAS_ILOG2_U32 is not set
@@ -64,14 +74,18 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
64CONFIG_GENERIC_CLOCKEVENTS=y 74CONFIG_GENERIC_CLOCKEVENTS=y
65CONFIG_GENERIC_TIME=y 75CONFIG_GENERIC_TIME=y
66CONFIG_GENERIC_CMOS_UPDATE=y 76CONFIG_GENERIC_CMOS_UPDATE=y
67CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 77CONFIG_SCHED_OMIT_FRAME_POINTER=y
68CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 78CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
79CONFIG_CEVT_R4K_LIB=y
69CONFIG_CEVT_R4K=y 80CONFIG_CEVT_R4K=y
70CONFIG_CEVT_TXX9=y 81CONFIG_CEVT_TXX9=y
82CONFIG_CSRC_R4K_LIB=y
71CONFIG_CSRC_R4K=y 83CONFIG_CSRC_R4K=y
72CONFIG_GPIO_TXX9=y 84CONFIG_GPIO_TXX9=y
73CONFIG_DMA_NONCOHERENT=y 85CONFIG_DMA_NONCOHERENT=y
74CONFIG_DMA_NEED_PCI_MAP_STATE=y 86CONFIG_DMA_NEED_PCI_MAP_STATE=y
87CONFIG_EARLY_PRINTK=y
88CONFIG_SYS_HAS_EARLY_PRINTK=y
75# CONFIG_HOTPLUG_CPU is not set 89# CONFIG_HOTPLUG_CPU is not set
76# CONFIG_NO_IOPORT is not set 90# CONFIG_NO_IOPORT is not set
77CONFIG_GENERIC_GPIO=y 91CONFIG_GENERIC_GPIO=y
@@ -100,6 +114,7 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5
100CONFIG_CPU_TX49XX=y 114CONFIG_CPU_TX49XX=y
101# CONFIG_CPU_R5000 is not set 115# CONFIG_CPU_R5000 is not set
102# CONFIG_CPU_R5432 is not set 116# CONFIG_CPU_R5432 is not set
117# CONFIG_CPU_R5500 is not set
103# CONFIG_CPU_R6000 is not set 118# CONFIG_CPU_R6000 is not set
104# CONFIG_CPU_NEVADA is not set 119# CONFIG_CPU_NEVADA is not set
105# CONFIG_CPU_R8000 is not set 120# CONFIG_CPU_R8000 is not set
@@ -107,6 +122,7 @@ CONFIG_CPU_TX49XX=y
107# CONFIG_CPU_RM7000 is not set 122# CONFIG_CPU_RM7000 is not set
108# CONFIG_CPU_RM9000 is not set 123# CONFIG_CPU_RM9000 is not set
109# CONFIG_CPU_SB1 is not set 124# CONFIG_CPU_SB1 is not set
125# CONFIG_CPU_CAVIUM_OCTEON is not set
110CONFIG_SYS_HAS_CPU_TX49XX=y 126CONFIG_SYS_HAS_CPU_TX49XX=y
111CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 127CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
112CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y 128CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
@@ -134,13 +150,12 @@ CONFIG_ARCH_FLATMEM_ENABLE=y
134CONFIG_ARCH_POPULATES_NODE_MAP=y 150CONFIG_ARCH_POPULATES_NODE_MAP=y
135CONFIG_FLATMEM=y 151CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y 152CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set
138# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
139CONFIG_PAGEFLAGS_EXTENDED=y 153CONFIG_PAGEFLAGS_EXTENDED=y
140CONFIG_SPLIT_PTLOCK_CPUS=4 154CONFIG_SPLIT_PTLOCK_CPUS=4
141# CONFIG_RESOURCES_64BIT is not set 155# CONFIG_PHYS_ADDR_T_64BIT is not set
142CONFIG_ZONE_DMA_FLAG=0 156CONFIG_ZONE_DMA_FLAG=0
143CONFIG_VIRT_TO_BUS=y 157CONFIG_VIRT_TO_BUS=y
158CONFIG_UNEVICTABLE_LRU=y
144CONFIG_TICK_ONESHOT=y 159CONFIG_TICK_ONESHOT=y
145CONFIG_NO_HZ=y 160CONFIG_NO_HZ=y
146CONFIG_HIGH_RES_TIMERS=y 161CONFIG_HIGH_RES_TIMERS=y
@@ -176,6 +191,15 @@ CONFIG_SYSVIPC_SYSCTL=y
176# CONFIG_BSD_PROCESS_ACCT is not set 191# CONFIG_BSD_PROCESS_ACCT is not set
177# CONFIG_TASKSTATS is not set 192# CONFIG_TASKSTATS is not set
178# CONFIG_AUDIT is not set 193# CONFIG_AUDIT is not set
194
195#
196# RCU Subsystem
197#
198CONFIG_CLASSIC_RCU=y
199# CONFIG_TREE_RCU is not set
200# CONFIG_PREEMPT_RCU is not set
201# CONFIG_TREE_RCU_TRACE is not set
202# CONFIG_PREEMPT_RCU_TRACE is not set
179CONFIG_IKCONFIG=y 203CONFIG_IKCONFIG=y
180CONFIG_IKCONFIG_PROC=y 204CONFIG_IKCONFIG_PROC=y
181CONFIG_LOG_BUF_SHIFT=14 205CONFIG_LOG_BUF_SHIFT=14
@@ -190,7 +214,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
190CONFIG_SYSCTL=y 214CONFIG_SYSCTL=y
191CONFIG_EMBEDDED=y 215CONFIG_EMBEDDED=y
192CONFIG_SYSCTL_SYSCALL=y 216CONFIG_SYSCTL_SYSCALL=y
193CONFIG_SYSCTL_SYSCALL_CHECK=y
194CONFIG_KALLSYMS=y 217CONFIG_KALLSYMS=y
195# CONFIG_KALLSYMS_EXTRA_PASS is not set 218# CONFIG_KALLSYMS_EXTRA_PASS is not set
196# CONFIG_HOTPLUG is not set 219# CONFIG_HOTPLUG is not set
@@ -207,30 +230,26 @@ CONFIG_SIGNALFD=y
207CONFIG_TIMERFD=y 230CONFIG_TIMERFD=y
208CONFIG_EVENTFD=y 231CONFIG_EVENTFD=y
209CONFIG_SHMEM=y 232CONFIG_SHMEM=y
233CONFIG_AIO=y
210CONFIG_VM_EVENT_COUNTERS=y 234CONFIG_VM_EVENT_COUNTERS=y
235CONFIG_PCI_QUIRKS=y
211CONFIG_SLAB=y 236CONFIG_SLAB=y
212# CONFIG_SLUB is not set 237# CONFIG_SLUB is not set
213# CONFIG_SLOB is not set 238# CONFIG_SLOB is not set
214# CONFIG_PROFILING is not set 239# CONFIG_PROFILING is not set
215# CONFIG_MARKERS is not set
216CONFIG_HAVE_OPROFILE=y 240CONFIG_HAVE_OPROFILE=y
217# CONFIG_HAVE_KPROBES is not set 241# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
218# CONFIG_HAVE_KRETPROBES is not set
219# CONFIG_HAVE_DMA_ATTRS is not set
220CONFIG_PROC_PAGE_MONITOR=y
221CONFIG_SLABINFO=y 242CONFIG_SLABINFO=y
222# CONFIG_TINY_SHMEM is not set
223CONFIG_BASE_SMALL=0 243CONFIG_BASE_SMALL=0
224CONFIG_MODULES=y 244CONFIG_MODULES=y
225# CONFIG_MODULE_FORCE_LOAD is not set 245# CONFIG_MODULE_FORCE_LOAD is not set
226# CONFIG_MODULE_UNLOAD is not set 246CONFIG_MODULE_UNLOAD=y
227# CONFIG_MODVERSIONS is not set 247# CONFIG_MODVERSIONS is not set
228# CONFIG_MODULE_SRCVERSION_ALL is not set 248# CONFIG_MODULE_SRCVERSION_ALL is not set
229CONFIG_KMOD=y
230CONFIG_BLOCK=y 249CONFIG_BLOCK=y
231# CONFIG_LBD is not set 250# CONFIG_LBD is not set
232# CONFIG_BLK_DEV_IO_TRACE is not set 251# CONFIG_BLK_DEV_IO_TRACE is not set
233# CONFIG_LSF is not set 252# CONFIG_BLK_DEV_INTEGRITY is not set
234 253
235# 254#
236# IO Schedulers 255# IO Schedulers
@@ -244,7 +263,8 @@ CONFIG_DEFAULT_AS=y
244# CONFIG_DEFAULT_CFQ is not set 263# CONFIG_DEFAULT_CFQ is not set
245# CONFIG_DEFAULT_NOOP is not set 264# CONFIG_DEFAULT_NOOP is not set
246CONFIG_DEFAULT_IOSCHED="anticipatory" 265CONFIG_DEFAULT_IOSCHED="anticipatory"
247CONFIG_CLASSIC_RCU=y 266# CONFIG_PROBE_INITRD_HEADER is not set
267# CONFIG_FREEZER is not set
248 268
249# 269#
250# Bus options (PCI, PCMCIA, EISA, ISA, TC) 270# Bus options (PCI, PCMCIA, EISA, ISA, TC)
@@ -254,12 +274,15 @@ CONFIG_PCI=y
254CONFIG_PCI_DOMAINS=y 274CONFIG_PCI_DOMAINS=y
255# CONFIG_ARCH_SUPPORTS_MSI is not set 275# CONFIG_ARCH_SUPPORTS_MSI is not set
256# CONFIG_PCI_LEGACY is not set 276# CONFIG_PCI_LEGACY is not set
277# CONFIG_PCI_STUB is not set
257CONFIG_MMU=y 278CONFIG_MMU=y
258 279
259# 280#
260# Executable file formats 281# Executable file formats
261# 282#
262CONFIG_BINFMT_ELF=y 283CONFIG_BINFMT_ELF=y
284# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
285# CONFIG_HAVE_AOUT is not set
263# CONFIG_BINFMT_MISC is not set 286# CONFIG_BINFMT_MISC is not set
264CONFIG_TRAD_SIGNALS=y 287CONFIG_TRAD_SIGNALS=y
265 288
@@ -268,15 +291,12 @@ CONFIG_TRAD_SIGNALS=y
268# 291#
269CONFIG_ARCH_SUSPEND_POSSIBLE=y 292CONFIG_ARCH_SUSPEND_POSSIBLE=y
270# CONFIG_PM is not set 293# CONFIG_PM is not set
271
272#
273# Networking
274#
275CONFIG_NET=y 294CONFIG_NET=y
276 295
277# 296#
278# Networking options 297# Networking options
279# 298#
299CONFIG_COMPAT_NET_DEV_OPS=y
280CONFIG_PACKET=y 300CONFIG_PACKET=y
281# CONFIG_PACKET_MMAP is not set 301# CONFIG_PACKET_MMAP is not set
282CONFIG_UNIX=y 302CONFIG_UNIX=y
@@ -318,6 +338,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
318# CONFIG_IPX is not set 338# CONFIG_IPX is not set
319# CONFIG_ATALK is not set 339# CONFIG_ATALK is not set
320# CONFIG_NET_SCHED is not set 340# CONFIG_NET_SCHED is not set
341# CONFIG_DCB is not set
321 342
322# 343#
323# Network testing 344# Network testing
@@ -327,14 +348,9 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
327# CONFIG_CAN is not set 348# CONFIG_CAN is not set
328# CONFIG_IRDA is not set 349# CONFIG_IRDA is not set
329# CONFIG_BT is not set 350# CONFIG_BT is not set
330 351# CONFIG_PHONET is not set
331# 352# CONFIG_WIRELESS is not set
332# Wireless 353# CONFIG_WIMAX is not set
333#
334# CONFIG_CFG80211 is not set
335# CONFIG_WIRELESS_EXT is not set
336# CONFIG_MAC80211 is not set
337# CONFIG_IEEE80211 is not set
338# CONFIG_RFKILL is not set 354# CONFIG_RFKILL is not set
339 355
340# 356#
@@ -348,7 +364,90 @@ CONFIG_STANDALONE=y
348CONFIG_PREVENT_FIRMWARE_BUILD=y 364CONFIG_PREVENT_FIRMWARE_BUILD=y
349# CONFIG_SYS_HYPERVISOR is not set 365# CONFIG_SYS_HYPERVISOR is not set
350# CONFIG_CONNECTOR is not set 366# CONFIG_CONNECTOR is not set
351# CONFIG_MTD is not set 367CONFIG_MTD=y
368# CONFIG_MTD_DEBUG is not set
369# CONFIG_MTD_CONCAT is not set
370CONFIG_MTD_PARTITIONS=y
371# CONFIG_MTD_TESTS is not set
372# CONFIG_MTD_REDBOOT_PARTS is not set
373CONFIG_MTD_CMDLINE_PARTS=y
374# CONFIG_MTD_AR7_PARTS is not set
375
376#
377# User Modules And Translation Layers
378#
379CONFIG_MTD_CHAR=y
380# CONFIG_MTD_BLKDEVS is not set
381# CONFIG_MTD_BLOCK is not set
382# CONFIG_MTD_BLOCK_RO is not set
383# CONFIG_FTL is not set
384# CONFIG_NFTL is not set
385# CONFIG_INFTL is not set
386# CONFIG_RFD_FTL is not set
387# CONFIG_SSFDC is not set
388# CONFIG_MTD_OOPS is not set
389
390#
391# RAM/ROM/Flash chip drivers
392#
393CONFIG_MTD_CFI=y
394CONFIG_MTD_JEDECPROBE=y
395CONFIG_MTD_GEN_PROBE=y
396# CONFIG_MTD_CFI_ADV_OPTIONS is not set
397CONFIG_MTD_MAP_BANK_WIDTH_1=y
398CONFIG_MTD_MAP_BANK_WIDTH_2=y
399CONFIG_MTD_MAP_BANK_WIDTH_4=y
400# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
401# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
402# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
403CONFIG_MTD_CFI_I1=y
404CONFIG_MTD_CFI_I2=y
405# CONFIG_MTD_CFI_I4 is not set
406# CONFIG_MTD_CFI_I8 is not set
407# CONFIG_MTD_CFI_INTELEXT is not set
408CONFIG_MTD_CFI_AMDSTD=y
409# CONFIG_MTD_CFI_STAA is not set
410CONFIG_MTD_CFI_UTIL=y
411# CONFIG_MTD_RAM is not set
412# CONFIG_MTD_ROM is not set
413# CONFIG_MTD_ABSENT is not set
414
415#
416# Mapping drivers for chip access
417#
418# CONFIG_MTD_COMPLEX_MAPPINGS is not set
419CONFIG_MTD_PHYSMAP=y
420# CONFIG_MTD_PHYSMAP_COMPAT is not set
421# CONFIG_MTD_INTEL_VR_NOR is not set
422# CONFIG_MTD_PLATRAM is not set
423
424#
425# Self-contained MTD device drivers
426#
427# CONFIG_MTD_PMC551 is not set
428# CONFIG_MTD_SLRAM is not set
429# CONFIG_MTD_PHRAM is not set
430# CONFIG_MTD_MTDRAM is not set
431# CONFIG_MTD_BLOCK2MTD is not set
432
433#
434# Disk-On-Chip Device Drivers
435#
436# CONFIG_MTD_DOC2000 is not set
437# CONFIG_MTD_DOC2001 is not set
438# CONFIG_MTD_DOC2001PLUS is not set
439# CONFIG_MTD_NAND is not set
440# CONFIG_MTD_ONENAND is not set
441
442#
443# LPDDR flash memory drivers
444#
445# CONFIG_MTD_LPDDR is not set
446
447#
448# UBI - Unsorted block images
449#
450# CONFIG_MTD_UBI is not set
352# CONFIG_PARPORT is not set 451# CONFIG_PARPORT is not set
353CONFIG_BLK_DEV=y 452CONFIG_BLK_DEV=y
354# CONFIG_BLK_CPQ_DA is not set 453# CONFIG_BLK_CPQ_DA is not set
@@ -365,9 +464,60 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
365# CONFIG_BLK_DEV_XIP is not set 464# CONFIG_BLK_DEV_XIP is not set
366# CONFIG_CDROM_PKTCDVD is not set 465# CONFIG_CDROM_PKTCDVD is not set
367# CONFIG_ATA_OVER_ETH is not set 466# CONFIG_ATA_OVER_ETH is not set
467# CONFIG_BLK_DEV_HD is not set
368# CONFIG_MISC_DEVICES is not set 468# CONFIG_MISC_DEVICES is not set
369CONFIG_HAVE_IDE=y 469CONFIG_HAVE_IDE=y
370# CONFIG_IDE is not set 470CONFIG_IDE=y
471
472#
473# Please see Documentation/ide/ide.txt for help/info on IDE drives
474#
475CONFIG_IDE_TIMINGS=y
476# CONFIG_BLK_DEV_IDE_SATA is not set
477CONFIG_IDE_GD=y
478CONFIG_IDE_GD_ATA=y
479# CONFIG_IDE_GD_ATAPI is not set
480# CONFIG_BLK_DEV_IDECD is not set
481# CONFIG_BLK_DEV_IDETAPE is not set
482# CONFIG_IDE_TASK_IOCTL is not set
483CONFIG_IDE_PROC_FS=y
484
485#
486# IDE chipset support/bugfixes
487#
488# CONFIG_IDE_GENERIC is not set
489# CONFIG_BLK_DEV_PLATFORM is not set
490CONFIG_BLK_DEV_IDEDMA_SFF=y
491
492#
493# PCI IDE chipsets support
494#
495# CONFIG_BLK_DEV_GENERIC is not set
496# CONFIG_BLK_DEV_AEC62XX is not set
497# CONFIG_BLK_DEV_ALI15X3 is not set
498# CONFIG_BLK_DEV_AMD74XX is not set
499# CONFIG_BLK_DEV_CMD64X is not set
500# CONFIG_BLK_DEV_TRIFLEX is not set
501# CONFIG_BLK_DEV_CS5530 is not set
502# CONFIG_BLK_DEV_HPT366 is not set
503# CONFIG_BLK_DEV_JMICRON is not set
504# CONFIG_BLK_DEV_SC1200 is not set
505# CONFIG_BLK_DEV_PIIX is not set
506# CONFIG_BLK_DEV_IT8172 is not set
507# CONFIG_BLK_DEV_IT8213 is not set
508# CONFIG_BLK_DEV_IT821X is not set
509# CONFIG_BLK_DEV_NS87415 is not set
510# CONFIG_BLK_DEV_PDC202XX_OLD is not set
511# CONFIG_BLK_DEV_PDC202XX_NEW is not set
512# CONFIG_BLK_DEV_SVWKS is not set
513# CONFIG_BLK_DEV_SIIMAGE is not set
514# CONFIG_BLK_DEV_SLC90E66 is not set
515# CONFIG_BLK_DEV_TRM290 is not set
516# CONFIG_BLK_DEV_VIA82CXXX is not set
517# CONFIG_BLK_DEV_TC86C001 is not set
518CONFIG_BLK_DEV_IDE_TX4938=y
519CONFIG_BLK_DEV_IDE_TX4939=y
520CONFIG_BLK_DEV_IDEDMA=y
371 521
372# 522#
373# SCSI device support 523# SCSI device support
@@ -390,7 +540,6 @@ CONFIG_HAVE_IDE=y
390# CONFIG_IEEE1394 is not set 540# CONFIG_IEEE1394 is not set
391# CONFIG_I2O is not set 541# CONFIG_I2O is not set
392CONFIG_NETDEVICES=y 542CONFIG_NETDEVICES=y
393# CONFIG_NETDEVICES_MULTIQUEUE is not set
394# CONFIG_DUMMY is not set 543# CONFIG_DUMMY is not set
395# CONFIG_BONDING is not set 544# CONFIG_BONDING is not set
396# CONFIG_EQUALIZER is not set 545# CONFIG_EQUALIZER is not set
@@ -412,15 +561,19 @@ CONFIG_PHYLIB=y
412# CONFIG_BROADCOM_PHY is not set 561# CONFIG_BROADCOM_PHY is not set
413# CONFIG_ICPLUS_PHY is not set 562# CONFIG_ICPLUS_PHY is not set
414# CONFIG_REALTEK_PHY is not set 563# CONFIG_REALTEK_PHY is not set
564# CONFIG_NATIONAL_PHY is not set
565# CONFIG_STE10XP is not set
566# CONFIG_LSI_ET1011C_PHY is not set
415# CONFIG_FIXED_PHY is not set 567# CONFIG_FIXED_PHY is not set
416# CONFIG_MDIO_BITBANG is not set 568# CONFIG_MDIO_BITBANG is not set
417CONFIG_NET_ETHERNET=y 569CONFIG_NET_ETHERNET=y
418# CONFIG_MII is not set 570CONFIG_MII=y
419# CONFIG_AX88796 is not set 571# CONFIG_AX88796 is not set
420# CONFIG_HAPPYMEAL is not set 572# CONFIG_HAPPYMEAL is not set
421# CONFIG_SUNGEM is not set 573# CONFIG_SUNGEM is not set
422# CONFIG_CASSINI is not set 574# CONFIG_CASSINI is not set
423# CONFIG_NET_VENDOR_3COM is not set 575# CONFIG_NET_VENDOR_3COM is not set
576CONFIG_SMC91X=y
424# CONFIG_DM9000 is not set 577# CONFIG_DM9000 is not set
425# CONFIG_NET_TULIP is not set 578# CONFIG_NET_TULIP is not set
426# CONFIG_HP100 is not set 579# CONFIG_HP100 is not set
@@ -429,6 +582,9 @@ CONFIG_NE2000=y
429# CONFIG_IBM_NEW_EMAC_RGMII is not set 582# CONFIG_IBM_NEW_EMAC_RGMII is not set
430# CONFIG_IBM_NEW_EMAC_TAH is not set 583# CONFIG_IBM_NEW_EMAC_TAH is not set
431# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 584# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
585# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
586# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
587# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
432CONFIG_NET_PCI=y 588CONFIG_NET_PCI=y
433# CONFIG_PCNET32 is not set 589# CONFIG_PCNET32 is not set
434# CONFIG_AMD8111_ETH is not set 590# CONFIG_AMD8111_ETH is not set
@@ -436,7 +592,6 @@ CONFIG_NET_PCI=y
436# CONFIG_B44 is not set 592# CONFIG_B44 is not set
437# CONFIG_FORCEDETH is not set 593# CONFIG_FORCEDETH is not set
438CONFIG_TC35815=y 594CONFIG_TC35815=y
439# CONFIG_EEPRO100 is not set
440# CONFIG_E100 is not set 595# CONFIG_E100 is not set
441# CONFIG_FEALNX is not set 596# CONFIG_FEALNX is not set
442# CONFIG_NATSEMI is not set 597# CONFIG_NATSEMI is not set
@@ -445,9 +600,11 @@ CONFIG_TC35815=y
445# CONFIG_R6040 is not set 600# CONFIG_R6040 is not set
446# CONFIG_SIS900 is not set 601# CONFIG_SIS900 is not set
447# CONFIG_EPIC100 is not set 602# CONFIG_EPIC100 is not set
603# CONFIG_SMSC9420 is not set
448# CONFIG_SUNDANCE is not set 604# CONFIG_SUNDANCE is not set
449# CONFIG_TLAN is not set 605# CONFIG_TLAN is not set
450# CONFIG_VIA_RHINE is not set 606# CONFIG_VIA_RHINE is not set
607# CONFIG_ATL2 is not set
451# CONFIG_NETDEV_1000 is not set 608# CONFIG_NETDEV_1000 is not set
452# CONFIG_NETDEV_10000 is not set 609# CONFIG_NETDEV_10000 is not set
453# CONFIG_TR is not set 610# CONFIG_TR is not set
@@ -458,6 +615,10 @@ CONFIG_TC35815=y
458# CONFIG_WLAN_PRE80211 is not set 615# CONFIG_WLAN_PRE80211 is not set
459# CONFIG_WLAN_80211 is not set 616# CONFIG_WLAN_80211 is not set
460# CONFIG_IWLWIFI_LEDS is not set 617# CONFIG_IWLWIFI_LEDS is not set
618
619#
620# Enable WiMAX (Networking options) to see the WiMAX drivers
621#
461# CONFIG_WAN is not set 622# CONFIG_WAN is not set
462# CONFIG_FDDI is not set 623# CONFIG_FDDI is not set
463# CONFIG_PPP is not set 624# CONFIG_PPP is not set
@@ -502,6 +663,7 @@ CONFIG_SERIAL_TXX9_CONSOLE=y
502CONFIG_SERIAL_TXX9_STDSERIAL=y 663CONFIG_SERIAL_TXX9_STDSERIAL=y
503# CONFIG_SERIAL_JSM is not set 664# CONFIG_SERIAL_JSM is not set
504CONFIG_UNIX98_PTYS=y 665CONFIG_UNIX98_PTYS=y
666# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
505CONFIG_LEGACY_PTYS=y 667CONFIG_LEGACY_PTYS=y
506CONFIG_LEGACY_PTY_COUNT=256 668CONFIG_LEGACY_PTY_COUNT=256
507# CONFIG_IPMI_HANDLER is not set 669# CONFIG_IPMI_HANDLER is not set
@@ -517,17 +679,19 @@ CONFIG_SPI_MASTER=y
517# 679#
518# SPI Master Controller Drivers 680# SPI Master Controller Drivers
519# 681#
682# CONFIG_SPI_BITBANG is not set
683# CONFIG_SPI_GPIO is not set
520CONFIG_SPI_TXX9=y 684CONFIG_SPI_TXX9=y
521 685
522# 686#
523# SPI Protocol Masters 687# SPI Protocol Masters
524# 688#
525CONFIG_EEPROM_AT25=y
526# CONFIG_SPI_TLE62X0 is not set 689# CONFIG_SPI_TLE62X0 is not set
527CONFIG_HAVE_GPIO_LIB=y 690CONFIG_ARCH_REQUIRE_GPIOLIB=y
691CONFIG_GPIOLIB=y
528 692
529# 693#
530# GPIO Support 694# Memory mapped GPIO expanders:
531# 695#
532 696
533# 697#
@@ -535,8 +699,14 @@ CONFIG_HAVE_GPIO_LIB=y
535# 699#
536 700
537# 701#
702# PCI GPIO expanders:
703#
704# CONFIG_GPIO_BT8XX is not set
705
706#
538# SPI GPIO expanders: 707# SPI GPIO expanders:
539# 708#
709# CONFIG_GPIO_MAX7301 is not set
540# CONFIG_GPIO_MCP23S08 is not set 710# CONFIG_GPIO_MCP23S08 is not set
541# CONFIG_W1 is not set 711# CONFIG_W1 is not set
542# CONFIG_POWER_SUPPLY is not set 712# CONFIG_POWER_SUPPLY is not set
@@ -550,6 +720,7 @@ CONFIG_WATCHDOG=y
550# Watchdog Device Drivers 720# Watchdog Device Drivers
551# 721#
552# CONFIG_SOFT_WATCHDOG is not set 722# CONFIG_SOFT_WATCHDOG is not set
723# CONFIG_ALIM7101_WDT is not set
553CONFIG_TXX9_WDT=m 724CONFIG_TXX9_WDT=m
554 725
555# 726#
@@ -557,18 +728,21 @@ CONFIG_TXX9_WDT=m
557# 728#
558# CONFIG_PCIPCWATCHDOG is not set 729# CONFIG_PCIPCWATCHDOG is not set
559# CONFIG_WDTPCI is not set 730# CONFIG_WDTPCI is not set
731CONFIG_SSB_POSSIBLE=y
560 732
561# 733#
562# Sonics Silicon Backplane 734# Sonics Silicon Backplane
563# 735#
564CONFIG_SSB_POSSIBLE=y
565# CONFIG_SSB is not set 736# CONFIG_SSB is not set
566 737
567# 738#
568# Multifunction device drivers 739# Multifunction device drivers
569# 740#
741# CONFIG_MFD_CORE is not set
570# CONFIG_MFD_SM501 is not set 742# CONFIG_MFD_SM501 is not set
571# CONFIG_HTC_PASIC3 is not set 743# CONFIG_HTC_PASIC3 is not set
744# CONFIG_MFD_TMIO is not set
745# CONFIG_REGULATOR is not set
572 746
573# 747#
574# Multimedia devices 748# Multimedia devices
@@ -599,15 +773,27 @@ CONFIG_SSB_POSSIBLE=y
599# Display device support 773# Display device support
600# 774#
601# CONFIG_DISPLAY_SUPPORT is not set 775# CONFIG_DISPLAY_SUPPORT is not set
602
603#
604# Sound
605#
606# CONFIG_SOUND is not set 776# CONFIG_SOUND is not set
607# CONFIG_USB_SUPPORT is not set 777# CONFIG_USB_SUPPORT is not set
608# CONFIG_MMC is not set 778# CONFIG_MMC is not set
609# CONFIG_MEMSTICK is not set 779# CONFIG_MEMSTICK is not set
610# CONFIG_NEW_LEDS is not set 780CONFIG_NEW_LEDS=y
781CONFIG_LEDS_CLASS=y
782
783#
784# LED drivers
785#
786CONFIG_LEDS_GPIO=y
787
788#
789# LED Triggers
790#
791CONFIG_LEDS_TRIGGERS=y
792# CONFIG_LEDS_TRIGGER_TIMER is not set
793CONFIG_LEDS_TRIGGER_IDE_DISK=y
794CONFIG_LEDS_TRIGGER_HEARTBEAT=y
795# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
796# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
611# CONFIG_ACCESSIBILITY is not set 797# CONFIG_ACCESSIBILITY is not set
612# CONFIG_INFINIBAND is not set 798# CONFIG_INFINIBAND is not set
613CONFIG_RTC_LIB=y 799CONFIG_RTC_LIB=y
@@ -628,35 +814,47 @@ CONFIG_RTC_INTF_DEV_UIE_EMUL=y
628# 814#
629# SPI RTC drivers 815# SPI RTC drivers
630# 816#
817# CONFIG_RTC_DRV_M41T94 is not set
818# CONFIG_RTC_DRV_DS1305 is not set
819# CONFIG_RTC_DRV_DS1390 is not set
631# CONFIG_RTC_DRV_MAX6902 is not set 820# CONFIG_RTC_DRV_MAX6902 is not set
632# CONFIG_RTC_DRV_R9701 is not set 821# CONFIG_RTC_DRV_R9701 is not set
633CONFIG_RTC_DRV_RS5C348=y 822CONFIG_RTC_DRV_RS5C348=y
823# CONFIG_RTC_DRV_DS3234 is not set
634 824
635# 825#
636# Platform RTC drivers 826# Platform RTC drivers
637# 827#
638# CONFIG_RTC_DRV_CMOS is not set 828# CONFIG_RTC_DRV_CMOS is not set
829# CONFIG_RTC_DRV_DS1286 is not set
639# CONFIG_RTC_DRV_DS1511 is not set 830# CONFIG_RTC_DRV_DS1511 is not set
640# CONFIG_RTC_DRV_DS1553 is not set 831# CONFIG_RTC_DRV_DS1553 is not set
641CONFIG_RTC_DRV_DS1742=y 832CONFIG_RTC_DRV_DS1742=y
642# CONFIG_RTC_DRV_STK17TA8 is not set 833# CONFIG_RTC_DRV_STK17TA8 is not set
643# CONFIG_RTC_DRV_M48T86 is not set 834# CONFIG_RTC_DRV_M48T86 is not set
835# CONFIG_RTC_DRV_M48T35 is not set
644# CONFIG_RTC_DRV_M48T59 is not set 836# CONFIG_RTC_DRV_M48T59 is not set
837# CONFIG_RTC_DRV_BQ4802 is not set
645# CONFIG_RTC_DRV_V3020 is not set 838# CONFIG_RTC_DRV_V3020 is not set
646 839
647# 840#
648# on-CPU RTC drivers 841# on-CPU RTC drivers
649# 842#
843CONFIG_RTC_DRV_TX4939=y
844# CONFIG_DMADEVICES is not set
650# CONFIG_UIO is not set 845# CONFIG_UIO is not set
846# CONFIG_STAGING is not set
651 847
652# 848#
653# File systems 849# File systems
654# 850#
655# CONFIG_EXT2_FS is not set 851# CONFIG_EXT2_FS is not set
656# CONFIG_EXT3_FS is not set 852# CONFIG_EXT3_FS is not set
853# CONFIG_EXT4_FS is not set
657# CONFIG_REISERFS_FS is not set 854# CONFIG_REISERFS_FS is not set
658# CONFIG_JFS_FS is not set 855# CONFIG_JFS_FS is not set
659CONFIG_FS_POSIX_ACL=y 856CONFIG_FS_POSIX_ACL=y
857CONFIG_FILE_LOCKING=y
660# CONFIG_XFS_FS is not set 858# CONFIG_XFS_FS is not set
661# CONFIG_OCFS2_FS is not set 859# CONFIG_OCFS2_FS is not set
662# CONFIG_DNOTIFY is not set 860# CONFIG_DNOTIFY is not set
@@ -687,30 +885,19 @@ CONFIG_GENERIC_ACL=y
687CONFIG_PROC_FS=y 885CONFIG_PROC_FS=y
688# CONFIG_PROC_KCORE is not set 886# CONFIG_PROC_KCORE is not set
689CONFIG_PROC_SYSCTL=y 887CONFIG_PROC_SYSCTL=y
888CONFIG_PROC_PAGE_MONITOR=y
690CONFIG_SYSFS=y 889CONFIG_SYSFS=y
691CONFIG_TMPFS=y 890CONFIG_TMPFS=y
692CONFIG_TMPFS_POSIX_ACL=y 891CONFIG_TMPFS_POSIX_ACL=y
693# CONFIG_HUGETLB_PAGE is not set 892# CONFIG_HUGETLB_PAGE is not set
694# CONFIG_CONFIGFS_FS is not set 893# CONFIG_CONFIGFS_FS is not set
695 894# CONFIG_MISC_FILESYSTEMS is not set
696#
697# Miscellaneous filesystems
698#
699# CONFIG_HFSPLUS_FS is not set
700# CONFIG_CRAMFS is not set
701# CONFIG_VXFS_FS is not set
702# CONFIG_MINIX_FS is not set
703# CONFIG_HPFS_FS is not set
704# CONFIG_QNX4FS_FS is not set
705# CONFIG_ROMFS_FS is not set
706# CONFIG_SYSV_FS is not set
707# CONFIG_UFS_FS is not set
708CONFIG_NETWORK_FILESYSTEMS=y 895CONFIG_NETWORK_FILESYSTEMS=y
709CONFIG_NFS_FS=y 896CONFIG_NFS_FS=y
710CONFIG_NFS_V3=y 897CONFIG_NFS_V3=y
711# CONFIG_NFS_V3_ACL is not set 898# CONFIG_NFS_V3_ACL is not set
712# CONFIG_NFSD is not set
713CONFIG_ROOT_NFS=y 899CONFIG_ROOT_NFS=y
900# CONFIG_NFSD is not set
714CONFIG_LOCKD=y 901CONFIG_LOCKD=y
715CONFIG_LOCKD_V4=y 902CONFIG_LOCKD_V4=y
716CONFIG_NFS_COMMON=y 903CONFIG_NFS_COMMON=y
@@ -740,7 +927,16 @@ CONFIG_FRAME_WARN=1024
740CONFIG_DEBUG_FS=y 927CONFIG_DEBUG_FS=y
741# CONFIG_HEADERS_CHECK is not set 928# CONFIG_HEADERS_CHECK is not set
742# CONFIG_DEBUG_KERNEL is not set 929# CONFIG_DEBUG_KERNEL is not set
930# CONFIG_DEBUG_MEMORY_INIT is not set
931# CONFIG_RCU_CPU_STALL_DETECTOR is not set
932CONFIG_SYSCTL_SYSCALL_CHECK=y
933
934#
935# Tracers
936#
937# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
743# CONFIG_SAMPLES is not set 938# CONFIG_SAMPLES is not set
939CONFIG_HAVE_ARCH_KGDB=y
744CONFIG_CMDLINE="" 940CONFIG_CMDLINE=""
745 941
746# 942#
@@ -748,15 +944,18 @@ CONFIG_CMDLINE=""
748# 944#
749# CONFIG_KEYS is not set 945# CONFIG_KEYS is not set
750# CONFIG_SECURITY is not set 946# CONFIG_SECURITY is not set
947# CONFIG_SECURITYFS is not set
948# CONFIG_SECURITY_FILE_CAPABILITIES is not set
751# CONFIG_CRYPTO is not set 949# CONFIG_CRYPTO is not set
752 950
753# 951#
754# Library routines 952# Library routines
755# 953#
756CONFIG_BITREVERSE=y 954CONFIG_BITREVERSE=y
757# CONFIG_GENERIC_FIND_FIRST_BIT is not set 955CONFIG_GENERIC_FIND_LAST_BIT=y
758# CONFIG_CRC_CCITT is not set 956# CONFIG_CRC_CCITT is not set
759# CONFIG_CRC16 is not set 957# CONFIG_CRC16 is not set
958# CONFIG_CRC_T10DIF is not set
760# CONFIG_CRC_ITU_T is not set 959# CONFIG_CRC_ITU_T is not set
761CONFIG_CRC32=y 960CONFIG_CRC32=y
762# CONFIG_CRC7 is not set 961# CONFIG_CRC7 is not set
diff --git a/arch/mips/emma/Kconfig b/arch/mips/emma/Kconfig
deleted file mode 100644
index 9669c72123c9..000000000000
--- a/arch/mips/emma/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
1choice
2 prompt "Machine type"
3 depends on MACH_EMMA
4 default NEC_MARKEINS
5
6config NEC_MARKEINS
7 bool "NEC EMMA2RH Mark-eins board"
8 select SOC_EMMA2RH
9 select HW_HAS_PCI
10 help
11 This enables support for the NEC Electronics Mark-eins boards.
12
13endchoice
14
15config SOC_EMMA2RH
16 bool
17 select SOC_EMMA
18 select SYS_HAS_CPU_R5500
19 select SYS_SUPPORTS_32BIT_KERNEL
20 select SYS_SUPPORTS_64BIT_KERNEL
21
22config SOC_EMMA
23 bool
24 select CEVT_R4K
25 select CSRC_R4K
26 select DMA_NONCOHERENT
27 select IRQ_CPU
28 select SWAP_IO_SPACE
29 select SYS_SUPPORTS_BIG_ENDIAN
diff --git a/arch/mips/emma/markeins/platform.c b/arch/mips/emma/markeins/platform.c
index 88e87f6b3442..d5f47e4f0d18 100644
--- a/arch/mips/emma/markeins/platform.c
+++ b/arch/mips/emma/markeins/platform.c
@@ -141,13 +141,6 @@ static struct platform_device serial_emma = {
141 }, 141 },
142}; 142};
143 143
144static struct platform_device *devices[] = {
145 &i2c_emma_devices[0],
146 &i2c_emma_devices[1],
147 &i2c_emma_devices[2],
148 &serial_emma,
149};
150
151static struct mtd_partition markeins_parts[] = { 144static struct mtd_partition markeins_parts[] = {
152 [0] = { 145 [0] = {
153 .name = "RootFS", 146 .name = "RootFS",
@@ -181,11 +174,39 @@ static struct mtd_partition markeins_parts[] = {
181 }, 174 },
182}; 175};
183 176
177static struct physmap_flash_data markeins_flash_data = {
178 .width = 2,
179 .nr_parts = ARRAY_SIZE(markeins_parts),
180 .parts = markeins_parts
181};
182
183static struct resource markeins_flash_resource = {
184 .start = 0x1e000000,
185 .end = 0x02000000,
186 .flags = IORESOURCE_MEM
187};
188
189static struct platform_device markeins_flash_device = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev = {
193 .platform_data = &markeins_flash_data,
194 },
195 .num_resources = 1,
196 .resource = &markeins_flash_resource,
197};
198
199static struct platform_device *devices[] = {
200 i2c_emma_devices,
201 i2c_emma_devices + 1,
202 i2c_emma_devices + 2,
203 &serial_emma,
204 &markeins_flash_device,
205};
206
184static int __init platform_devices_setup(void) 207static int __init platform_devices_setup(void)
185{ 208{
186 physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
187 return platform_add_devices(devices, ARRAY_SIZE(devices)); 209 return platform_add_devices(devices, ARRAY_SIZE(devices));
188} 210}
189 211
190arch_initcall(platform_devices_setup); 212arch_initcall(platform_devices_setup);
191
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index ac5d541368e9..6c5b40905dd6 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -3,6 +3,8 @@
3/* 3/*
4 * Architecture specific compatibility types 4 * Architecture specific compatibility types
5 */ 5 */
6#include <linux/seccomp.h>
7#include <linux/thread_info.h>
6#include <linux/types.h> 8#include <linux/types.h>
7#include <asm/page.h> 9#include <asm/page.h>
8#include <asm/ptrace.h> 10#include <asm/ptrace.h>
@@ -218,4 +220,9 @@ struct compat_shmid64_ds {
218 compat_ulong_t __unused2; 220 compat_ulong_t __unused2;
219}; 221};
220 222
223static inline int is_compat_task(void)
224{
225 return test_thread_flag(TIF_32BIT);
226}
227
221#endif /* _ASM_COMPAT_H */ 228#endif /* _ASM_COMPAT_H */
diff --git a/arch/mips/include/asm/hazards.h b/arch/mips/include/asm/hazards.h
index 43baed16a109..134e1fc8f4d6 100644
--- a/arch/mips/include/asm/hazards.h
+++ b/arch/mips/include/asm/hazards.h
@@ -138,7 +138,8 @@ do { \
138 __instruction_hazard(); \ 138 __instruction_hazard(); \
139} while (0) 139} while (0)
140 140
141#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_CAVIUM_OCTEON) 141#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \
142 defined(CONFIG_CPU_R5500)
142 143
143/* 144/*
144 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 145 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
diff --git a/arch/mips/include/asm/prefetch.h b/arch/mips/include/asm/prefetch.h
index 17850834ccb0..a56594f360ee 100644
--- a/arch/mips/include/asm/prefetch.h
+++ b/arch/mips/include/asm/prefetch.h
@@ -26,7 +26,7 @@
26 * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in 26 * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
27 * current versions due to erratum G105. 27 * current versions due to erratum G105.
28 * 28 *
29 * VR7701 only implements the Load prefetch. 29 * VR5500 (including VR5701 and VR7701) only implement load prefetch.
30 * 30 *
31 * Finally MIPS32 and MIPS64 implement all of the following hints. 31 * Finally MIPS32 and MIPS64 implement all of the following hints.
32 */ 32 */
diff --git a/arch/mips/include/asm/seccomp.h b/arch/mips/include/asm/seccomp.h
index 36ed44070256..ae6306ebdcad 100644
--- a/arch/mips/include/asm/seccomp.h
+++ b/arch/mips/include/asm/seccomp.h
@@ -1,6 +1,5 @@
1#ifndef __ASM_SECCOMP_H 1#ifndef __ASM_SECCOMP_H
2 2
3#include <linux/thread_info.h>
4#include <linux/unistd.h> 3#include <linux/unistd.h>
5 4
6#define __NR_seccomp_read __NR_read 5#define __NR_seccomp_read __NR_read
@@ -16,8 +15,6 @@
16 */ 15 */
17#ifdef CONFIG_MIPS32_O32 16#ifdef CONFIG_MIPS32_O32
18 17
19#define TIF_32BIT TIF_32BIT_REGS
20
21#define __NR_seccomp_read_32 4003 18#define __NR_seccomp_read_32 4003
22#define __NR_seccomp_write_32 4004 19#define __NR_seccomp_write_32 4004
23#define __NR_seccomp_exit_32 4001 20#define __NR_seccomp_exit_32 4001
@@ -25,8 +22,6 @@
25 22
26#elif defined(CONFIG_MIPS32_N32) 23#elif defined(CONFIG_MIPS32_N32)
27 24
28#define TIF_32BIT _TIF_32BIT_ADDR
29
30#define __NR_seccomp_read_32 6000 25#define __NR_seccomp_read_32 6000
31#define __NR_seccomp_write_32 6001 26#define __NR_seccomp_write_32 6001
32#define __NR_seccomp_exit_32 6058 27#define __NR_seccomp_exit_32 6058
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 3f76de73c943..676aa2ae1913 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -127,6 +127,12 @@ register struct thread_info *__current_thread_info __asm__("$28");
127#define TIF_LOAD_WATCH 25 /* If set, load watch registers */ 127#define TIF_LOAD_WATCH 25 /* If set, load watch registers */
128#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 128#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
129 129
130#ifdef CONFIG_MIPS32_O32
131#define TIF_32BIT TIF_32BIT_REGS
132#elif defined(CONFIG_MIPS32_N32)
133#define TIF_32BIT _TIF_32BIT_ADDR
134#endif /* CONFIG_MIPS32_O32 */
135
130#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 136#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
131#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 137#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
132#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 138#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index a7162a4484cf..1bdbcad3bb74 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -149,6 +149,7 @@ void __init check_wait(void)
149 case CPU_R4650: 149 case CPU_R4650:
150 case CPU_R4700: 150 case CPU_R4700:
151 case CPU_R5000: 151 case CPU_R5000:
152 case CPU_R5500:
152 case CPU_NEVADA: 153 case CPU_NEVADA:
153 case CPU_4KC: 154 case CPU_4KC:
154 case CPU_4KEC: 155 case CPU_4KEC:
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 7c2dafa0f584..7b845ba9dff4 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -111,7 +111,6 @@ int show_interrupts(struct seq_file *p, void *v)
111 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 111 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
112#endif 112#endif
113 seq_printf(p, " %14s", irq_desc[i].chip->name); 113 seq_printf(p, " %14s", irq_desc[i].chip->name);
114 seq_printf(p, "-%-8s", irq_desc[i].name);
115 seq_printf(p, " %s", action->name); 114 seq_printf(p, " %s", action->name);
116 115
117 for (action=action->next; action; action = action->next) 116 for (action=action->next; action; action = action->next)
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index aa2c55e3b55f..1a86f84fa947 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -32,6 +32,7 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/binfmts.h> 33#include <linux/binfmts.h>
34#include <linux/security.h> 34#include <linux/security.h>
35#include <linux/syscalls.h>
35#include <linux/compat.h> 36#include <linux/compat.h>
36#include <linux/vfs.h> 37#include <linux/vfs.h>
37#include <linux/ipc.h> 38#include <linux/ipc.h>
@@ -63,9 +64,9 @@
63#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL)) 64#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL))
64#endif 65#endif
65 66
66asmlinkage unsigned long 67SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len,
67sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 68 unsigned long, prot, unsigned long, flags, unsigned long, fd,
68 unsigned long flags, unsigned long fd, unsigned long pgoff) 69 unsigned long, pgoff)
69{ 70{
70 struct file * file = NULL; 71 struct file * file = NULL;
71 unsigned long error; 72 unsigned long error;
@@ -121,21 +122,21 @@ struct rlimit32 {
121 int rlim_max; 122 int rlim_max;
122}; 123};
123 124
124asmlinkage long sys32_truncate64(const char __user * path, 125SYSCALL_DEFINE4(32_truncate64, const char __user *, path,
125 unsigned long __dummy, int a2, int a3) 126 unsigned long, __dummy, unsigned long, a2, unsigned long, a3)
126{ 127{
127 return sys_truncate(path, merge_64(a2, a3)); 128 return sys_truncate(path, merge_64(a2, a3));
128} 129}
129 130
130asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy, 131SYSCALL_DEFINE4(32_ftruncate64, unsigned long, fd, unsigned long, __dummy,
131 int a2, int a3) 132 unsigned long, a2, unsigned long, a3)
132{ 133{
133 return sys_ftruncate(fd, merge_64(a2, a3)); 134 return sys_ftruncate(fd, merge_64(a2, a3));
134} 135}
135 136
136asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, 137SYSCALL_DEFINE5(32_llseek, unsigned long, fd, unsigned long, offset_high,
137 unsigned int offset_low, loff_t __user * result, 138 unsigned long, offset_low, loff_t __user *, result,
138 unsigned int origin) 139 unsigned long, origin)
139{ 140{
140 return sys_llseek(fd, offset_high, offset_low, result, origin); 141 return sys_llseek(fd, offset_high, offset_low, result, origin);
141} 142}
@@ -144,20 +145,20 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
144 lseek back to original location. They fail just like lseek does on 145 lseek back to original location. They fail just like lseek does on
145 non-seekable files. */ 146 non-seekable files. */
146 147
147asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, 148SYSCALL_DEFINE6(32_pread, unsigned long, fd, char __user *, buf, size_t, count,
148 size_t count, u32 unused, u64 a4, u64 a5) 149 unsigned long, unused, unsigned long, a4, unsigned long, a5)
149{ 150{
150 return sys_pread64(fd, buf, count, merge_64(a4, a5)); 151 return sys_pread64(fd, buf, count, merge_64(a4, a5));
151} 152}
152 153
153asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, 154SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
154 size_t count, u32 unused, u64 a4, u64 a5) 155 size_t, count, u32, unused, u64, a4, u64, a5)
155{ 156{
156 return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); 157 return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
157} 158}
158 159
159asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, 160SYSCALL_DEFINE2(32_sched_rr_get_interval, compat_pid_t, pid,
160 struct compat_timespec __user *interval) 161 struct compat_timespec __user *, interval)
161{ 162{
162 struct timespec t; 163 struct timespec t;
163 int ret; 164 int ret;
@@ -174,8 +175,8 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
174 175
175#ifdef CONFIG_SYSVIPC 176#ifdef CONFIG_SYSVIPC
176 177
177asmlinkage long 178SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
178sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth) 179 unsigned long, ptr, unsigned long, fifth)
179{ 180{
180 int version, err; 181 int version, err;
181 182
@@ -233,8 +234,8 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
233 234
234#else 235#else
235 236
236asmlinkage long 237SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third,
237sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth) 238 u32, ptr, u32, fifth)
238{ 239{
239 return -ENOSYS; 240 return -ENOSYS;
240} 241}
@@ -242,7 +243,7 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
242#endif /* CONFIG_SYSVIPC */ 243#endif /* CONFIG_SYSVIPC */
243 244
244#ifdef CONFIG_MIPS32_N32 245#ifdef CONFIG_MIPS32_N32
245asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) 246SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg)
246{ 247{
247 /* compat_sys_semctl expects a pointer to union semun */ 248 /* compat_sys_semctl expects a pointer to union semun */
248 u32 __user *uptr = compat_alloc_user_space(sizeof(u32)); 249 u32 __user *uptr = compat_alloc_user_space(sizeof(u32));
@@ -251,13 +252,14 @@ asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg)
251 return compat_sys_semctl(semid, semnum, cmd, uptr); 252 return compat_sys_semctl(semid, semnum, cmd, uptr);
252} 253}
253 254
254asmlinkage long sysn32_msgsnd(int msqid, u32 msgp, unsigned msgsz, int msgflg) 255SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz,
256 int, msgflg)
255{ 257{
256 return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp)); 258 return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp));
257} 259}
258 260
259asmlinkage long sysn32_msgrcv(int msqid, u32 msgp, size_t msgsz, int msgtyp, 261SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
260 int msgflg) 262 int, msgtyp, int, msgflg)
261{ 263{
262 return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64, 264 return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64,
263 compat_ptr(msgp)); 265 compat_ptr(msgp));
@@ -277,7 +279,7 @@ struct sysctl_args32
277 279
278#ifdef CONFIG_SYSCTL_SYSCALL 280#ifdef CONFIG_SYSCTL_SYSCALL
279 281
280asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args) 282SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
281{ 283{
282 struct sysctl_args32 tmp; 284 struct sysctl_args32 tmp;
283 int error; 285 int error;
@@ -316,9 +318,16 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
316 return error; 318 return error;
317} 319}
318 320
321#else
322
323SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
324{
325 return -ENOSYS;
326}
327
319#endif /* CONFIG_SYSCTL_SYSCALL */ 328#endif /* CONFIG_SYSCTL_SYSCALL */
320 329
321asmlinkage long sys32_newuname(struct new_utsname __user * name) 330SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name)
322{ 331{
323 int ret = 0; 332 int ret = 0;
324 333
@@ -334,7 +343,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * name)
334 return ret; 343 return ret;
335} 344}
336 345
337asmlinkage int sys32_personality(unsigned long personality) 346SYSCALL_DEFINE1(32_personality, unsigned long, personality)
338{ 347{
339 int ret; 348 int ret;
340 personality &= 0xffffffff; 349 personality &= 0xffffffff;
@@ -357,7 +366,7 @@ struct ustat32 {
357 366
358extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf); 367extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf);
359 368
360asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32) 369SYSCALL_DEFINE2(32_ustat, dev_t, dev, struct ustat32 __user *, ubuf32)
361{ 370{
362 int err; 371 int err;
363 struct ustat tmp; 372 struct ustat tmp;
@@ -381,8 +390,8 @@ out:
381 return err; 390 return err;
382} 391}
383 392
384asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, 393SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd,
385 s32 count) 394 compat_off_t __user *, offset, s32, count)
386{ 395{
387 mm_segment_t old_fs = get_fs(); 396 mm_segment_t old_fs = get_fs();
388 int ret; 397 int ret;
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 51d1ba415b90..9ab70c3b5be6 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -399,7 +399,7 @@ einval: li v0, -ENOSYS
399 sys sys_swapon 2 399 sys sys_swapon 2
400 sys sys_reboot 3 400 sys sys_reboot 3
401 sys sys_old_readdir 3 401 sys sys_old_readdir 3
402 sys old_mmap 6 /* 4090 */ 402 sys sys_mips_mmap 6 /* 4090 */
403 sys sys_munmap 2 403 sys sys_munmap 2
404 sys sys_truncate 2 404 sys sys_truncate 2
405 sys sys_ftruncate 2 405 sys sys_ftruncate 2
@@ -519,7 +519,7 @@ einval: li v0, -ENOSYS
519 sys sys_sendfile 4 519 sys sys_sendfile 4
520 sys sys_ni_syscall 0 520 sys sys_ni_syscall 0
521 sys sys_ni_syscall 0 521 sys sys_ni_syscall 0
522 sys sys_mmap2 6 /* 4210 */ 522 sys sys_mips_mmap2 6 /* 4210 */
523 sys sys_truncate64 4 523 sys sys_truncate64 4
524 sys sys_ftruncate64 4 524 sys sys_ftruncate64 4
525 sys sys_stat64 2 525 sys sys_stat64 2
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index a9e171618994..9b4698667154 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -207,7 +207,7 @@ sys_call_table:
207 PTR sys_newlstat 207 PTR sys_newlstat
208 PTR sys_poll 208 PTR sys_poll
209 PTR sys_lseek 209 PTR sys_lseek
210 PTR old_mmap 210 PTR sys_mips_mmap
211 PTR sys_mprotect /* 5010 */ 211 PTR sys_mprotect /* 5010 */
212 PTR sys_munmap 212 PTR sys_munmap
213 PTR sys_brk 213 PTR sys_brk
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 30f3b6317a83..7438e92f8a01 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -129,12 +129,12 @@ EXPORT(sysn32_call_table)
129 PTR sys_newlstat 129 PTR sys_newlstat
130 PTR sys_poll 130 PTR sys_poll
131 PTR sys_lseek 131 PTR sys_lseek
132 PTR old_mmap 132 PTR sys_mips_mmap
133 PTR sys_mprotect /* 6010 */ 133 PTR sys_mprotect /* 6010 */
134 PTR sys_munmap 134 PTR sys_munmap
135 PTR sys_brk 135 PTR sys_brk
136 PTR sys32_rt_sigaction 136 PTR sys_32_rt_sigaction
137 PTR sys32_rt_sigprocmask 137 PTR sys_32_rt_sigprocmask
138 PTR compat_sys_ioctl /* 6015 */ 138 PTR compat_sys_ioctl /* 6015 */
139 PTR sys_pread64 139 PTR sys_pread64
140 PTR sys_pwrite64 140 PTR sys_pwrite64
@@ -159,7 +159,7 @@ EXPORT(sysn32_call_table)
159 PTR compat_sys_setitimer 159 PTR compat_sys_setitimer
160 PTR sys_alarm 160 PTR sys_alarm
161 PTR sys_getpid 161 PTR sys_getpid
162 PTR sys32_sendfile 162 PTR sys_32_sendfile
163 PTR sys_socket /* 6040 */ 163 PTR sys_socket /* 6040 */
164 PTR sys_connect 164 PTR sys_connect
165 PTR sys_accept 165 PTR sys_accept
@@ -181,14 +181,14 @@ EXPORT(sysn32_call_table)
181 PTR sys_exit 181 PTR sys_exit
182 PTR compat_sys_wait4 182 PTR compat_sys_wait4
183 PTR sys_kill /* 6060 */ 183 PTR sys_kill /* 6060 */
184 PTR sys32_newuname 184 PTR sys_32_newuname
185 PTR sys_semget 185 PTR sys_semget
186 PTR sys_semop 186 PTR sys_semop
187 PTR sysn32_semctl 187 PTR sys_n32_semctl
188 PTR sys_shmdt /* 6065 */ 188 PTR sys_shmdt /* 6065 */
189 PTR sys_msgget 189 PTR sys_msgget
190 PTR sysn32_msgsnd 190 PTR sys_n32_msgsnd
191 PTR sysn32_msgrcv 191 PTR sys_n32_msgrcv
192 PTR compat_sys_msgctl 192 PTR compat_sys_msgctl
193 PTR compat_sys_fcntl /* 6070 */ 193 PTR compat_sys_fcntl /* 6070 */
194 PTR sys_flock 194 PTR sys_flock
@@ -245,15 +245,15 @@ EXPORT(sysn32_call_table)
245 PTR sys_getsid 245 PTR sys_getsid
246 PTR sys_capget 246 PTR sys_capget
247 PTR sys_capset 247 PTR sys_capset
248 PTR sys32_rt_sigpending /* 6125 */ 248 PTR sys_32_rt_sigpending /* 6125 */
249 PTR compat_sys_rt_sigtimedwait 249 PTR compat_sys_rt_sigtimedwait
250 PTR sys32_rt_sigqueueinfo 250 PTR sys_32_rt_sigqueueinfo
251 PTR sysn32_rt_sigsuspend 251 PTR sysn32_rt_sigsuspend
252 PTR sys32_sigaltstack 252 PTR sys32_sigaltstack
253 PTR compat_sys_utime /* 6130 */ 253 PTR compat_sys_utime /* 6130 */
254 PTR sys_mknod 254 PTR sys_mknod
255 PTR sys32_personality 255 PTR sys_32_personality
256 PTR sys32_ustat 256 PTR sys_32_ustat
257 PTR compat_sys_statfs 257 PTR compat_sys_statfs
258 PTR compat_sys_fstatfs /* 6135 */ 258 PTR compat_sys_fstatfs /* 6135 */
259 PTR sys_sysfs 259 PTR sys_sysfs
@@ -265,14 +265,14 @@ EXPORT(sysn32_call_table)
265 PTR sys_sched_getscheduler 265 PTR sys_sched_getscheduler
266 PTR sys_sched_get_priority_max 266 PTR sys_sched_get_priority_max
267 PTR sys_sched_get_priority_min 267 PTR sys_sched_get_priority_min
268 PTR sys32_sched_rr_get_interval /* 6145 */ 268 PTR sys_32_sched_rr_get_interval /* 6145 */
269 PTR sys_mlock 269 PTR sys_mlock
270 PTR sys_munlock 270 PTR sys_munlock
271 PTR sys_mlockall 271 PTR sys_mlockall
272 PTR sys_munlockall 272 PTR sys_munlockall
273 PTR sys_vhangup /* 6150 */ 273 PTR sys_vhangup /* 6150 */
274 PTR sys_pivot_root 274 PTR sys_pivot_root
275 PTR sys32_sysctl 275 PTR sys_32_sysctl
276 PTR sys_prctl 276 PTR sys_prctl
277 PTR compat_sys_adjtimex 277 PTR compat_sys_adjtimex
278 PTR compat_sys_setrlimit /* 6155 */ 278 PTR compat_sys_setrlimit /* 6155 */
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index fefef4af8595..b0fef4ff9827 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -265,12 +265,12 @@ sys_call_table:
265 PTR sys_olduname 265 PTR sys_olduname
266 PTR sys_umask /* 4060 */ 266 PTR sys_umask /* 4060 */
267 PTR sys_chroot 267 PTR sys_chroot
268 PTR sys32_ustat 268 PTR sys_32_ustat
269 PTR sys_dup2 269 PTR sys_dup2
270 PTR sys_getppid 270 PTR sys_getppid
271 PTR sys_getpgrp /* 4065 */ 271 PTR sys_getpgrp /* 4065 */
272 PTR sys_setsid 272 PTR sys_setsid
273 PTR sys32_sigaction 273 PTR sys_32_sigaction
274 PTR sys_sgetmask 274 PTR sys_sgetmask
275 PTR sys_ssetmask 275 PTR sys_ssetmask
276 PTR sys_setreuid /* 4070 */ 276 PTR sys_setreuid /* 4070 */
@@ -293,7 +293,7 @@ sys_call_table:
293 PTR sys_swapon 293 PTR sys_swapon
294 PTR sys_reboot 294 PTR sys_reboot
295 PTR compat_sys_old_readdir 295 PTR compat_sys_old_readdir
296 PTR old_mmap /* 4090 */ 296 PTR sys_mips_mmap /* 4090 */
297 PTR sys_munmap 297 PTR sys_munmap
298 PTR sys_truncate 298 PTR sys_truncate
299 PTR sys_ftruncate 299 PTR sys_ftruncate
@@ -320,12 +320,12 @@ sys_call_table:
320 PTR compat_sys_wait4 320 PTR compat_sys_wait4
321 PTR sys_swapoff /* 4115 */ 321 PTR sys_swapoff /* 4115 */
322 PTR compat_sys_sysinfo 322 PTR compat_sys_sysinfo
323 PTR sys32_ipc 323 PTR sys_32_ipc
324 PTR sys_fsync 324 PTR sys_fsync
325 PTR sys32_sigreturn 325 PTR sys32_sigreturn
326 PTR sys32_clone /* 4120 */ 326 PTR sys32_clone /* 4120 */
327 PTR sys_setdomainname 327 PTR sys_setdomainname
328 PTR sys32_newuname 328 PTR sys_32_newuname
329 PTR sys_ni_syscall /* sys_modify_ldt */ 329 PTR sys_ni_syscall /* sys_modify_ldt */
330 PTR compat_sys_adjtimex 330 PTR compat_sys_adjtimex
331 PTR sys_mprotect /* 4125 */ 331 PTR sys_mprotect /* 4125 */
@@ -339,11 +339,11 @@ sys_call_table:
339 PTR sys_fchdir 339 PTR sys_fchdir
340 PTR sys_bdflush 340 PTR sys_bdflush
341 PTR sys_sysfs /* 4135 */ 341 PTR sys_sysfs /* 4135 */
342 PTR sys32_personality 342 PTR sys_32_personality
343 PTR sys_ni_syscall /* for afs_syscall */ 343 PTR sys_ni_syscall /* for afs_syscall */
344 PTR sys_setfsuid 344 PTR sys_setfsuid
345 PTR sys_setfsgid 345 PTR sys_setfsgid
346 PTR sys32_llseek /* 4140 */ 346 PTR sys_32_llseek /* 4140 */
347 PTR compat_sys_getdents 347 PTR compat_sys_getdents
348 PTR compat_sys_select 348 PTR compat_sys_select
349 PTR sys_flock 349 PTR sys_flock
@@ -356,7 +356,7 @@ sys_call_table:
356 PTR sys_ni_syscall /* 4150 */ 356 PTR sys_ni_syscall /* 4150 */
357 PTR sys_getsid 357 PTR sys_getsid
358 PTR sys_fdatasync 358 PTR sys_fdatasync
359 PTR sys32_sysctl 359 PTR sys_32_sysctl
360 PTR sys_mlock 360 PTR sys_mlock
361 PTR sys_munlock /* 4155 */ 361 PTR sys_munlock /* 4155 */
362 PTR sys_mlockall 362 PTR sys_mlockall
@@ -368,7 +368,7 @@ sys_call_table:
368 PTR sys_sched_yield 368 PTR sys_sched_yield
369 PTR sys_sched_get_priority_max 369 PTR sys_sched_get_priority_max
370 PTR sys_sched_get_priority_min 370 PTR sys_sched_get_priority_min
371 PTR sys32_sched_rr_get_interval /* 4165 */ 371 PTR sys_32_sched_rr_get_interval /* 4165 */
372 PTR compat_sys_nanosleep 372 PTR compat_sys_nanosleep
373 PTR sys_mremap 373 PTR sys_mremap
374 PTR sys_accept 374 PTR sys_accept
@@ -397,25 +397,25 @@ sys_call_table:
397 PTR sys_getresgid 397 PTR sys_getresgid
398 PTR sys_prctl 398 PTR sys_prctl
399 PTR sys32_rt_sigreturn 399 PTR sys32_rt_sigreturn
400 PTR sys32_rt_sigaction 400 PTR sys_32_rt_sigaction
401 PTR sys32_rt_sigprocmask /* 4195 */ 401 PTR sys_32_rt_sigprocmask /* 4195 */
402 PTR sys32_rt_sigpending 402 PTR sys_32_rt_sigpending
403 PTR compat_sys_rt_sigtimedwait 403 PTR compat_sys_rt_sigtimedwait
404 PTR sys32_rt_sigqueueinfo 404 PTR sys_32_rt_sigqueueinfo
405 PTR sys32_rt_sigsuspend 405 PTR sys32_rt_sigsuspend
406 PTR sys32_pread /* 4200 */ 406 PTR sys_32_pread /* 4200 */
407 PTR sys32_pwrite 407 PTR sys_32_pwrite
408 PTR sys_chown 408 PTR sys_chown
409 PTR sys_getcwd 409 PTR sys_getcwd
410 PTR sys_capget 410 PTR sys_capget
411 PTR sys_capset /* 4205 */ 411 PTR sys_capset /* 4205 */
412 PTR sys32_sigaltstack 412 PTR sys32_sigaltstack
413 PTR sys32_sendfile 413 PTR sys_32_sendfile
414 PTR sys_ni_syscall 414 PTR sys_ni_syscall
415 PTR sys_ni_syscall 415 PTR sys_ni_syscall
416 PTR sys32_mmap2 /* 4210 */ 416 PTR sys_mips_mmap2 /* 4210 */
417 PTR sys32_truncate64 417 PTR sys_32_truncate64
418 PTR sys32_ftruncate64 418 PTR sys_32_ftruncate64
419 PTR sys_newstat 419 PTR sys_newstat
420 PTR sys_newlstat 420 PTR sys_newlstat
421 PTR sys_newfstat /* 4215 */ 421 PTR sys_newfstat /* 4215 */
@@ -481,7 +481,7 @@ sys_call_table:
481 PTR compat_sys_mq_notify /* 4275 */ 481 PTR compat_sys_mq_notify /* 4275 */
482 PTR compat_sys_mq_getsetattr 482 PTR compat_sys_mq_getsetattr
483 PTR sys_ni_syscall /* sys_vserver */ 483 PTR sys_ni_syscall /* sys_vserver */
484 PTR sys32_waitid 484 PTR sys_32_waitid
485 PTR sys_ni_syscall /* available, was setaltroot */ 485 PTR sys_ni_syscall /* available, was setaltroot */
486 PTR sys_add_key /* 4280 */ 486 PTR sys_add_key /* 4280 */
487 PTR sys_request_key 487 PTR sys_request_key
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index a4e106c56ab5..830c5ef9932b 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -19,6 +19,7 @@
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/unistd.h> 20#include <linux/unistd.h>
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include <linux/syscalls.h>
22#include <linux/uaccess.h> 23#include <linux/uaccess.h>
23 24
24#include <asm/abi.h> 25#include <asm/abi.h>
@@ -338,8 +339,8 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
338} 339}
339 340
340#ifdef CONFIG_TRAD_SIGNALS 341#ifdef CONFIG_TRAD_SIGNALS
341asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act, 342SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
342 struct sigaction __user *oact) 343 struct sigaction __user *, oact)
343{ 344{
344 struct k_sigaction new_ka, old_ka; 345 struct k_sigaction new_ka, old_ka;
345 int ret; 346 int ret;
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 652709b353ad..2e74075ac0ca 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -349,8 +349,8 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
349 return -ERESTARTNOHAND; 349 return -ERESTARTNOHAND;
350} 350}
351 351
352asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act, 352SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act,
353 struct sigaction32 __user *oact) 353 struct sigaction32 __user *, oact)
354{ 354{
355 struct k_sigaction new_ka, old_ka; 355 struct k_sigaction new_ka, old_ka;
356 int ret; 356 int ret;
@@ -704,9 +704,9 @@ struct mips_abi mips_abi_32 = {
704 .restart = __NR_O32_restart_syscall 704 .restart = __NR_O32_restart_syscall
705}; 705};
706 706
707asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, 707SYSCALL_DEFINE4(32_rt_sigaction, int, sig,
708 struct sigaction32 __user *oact, 708 const struct sigaction32 __user *, act,
709 unsigned int sigsetsize) 709 struct sigaction32 __user *, oact, unsigned int, sigsetsize)
710{ 710{
711 struct k_sigaction new_sa, old_sa; 711 struct k_sigaction new_sa, old_sa;
712 int ret = -EINVAL; 712 int ret = -EINVAL;
@@ -748,8 +748,8 @@ out:
748 return ret; 748 return ret;
749} 749}
750 750
751asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, 751SYSCALL_DEFINE4(32_rt_sigprocmask, int, how, compat_sigset_t __user *, set,
752 compat_sigset_t __user *oset, unsigned int sigsetsize) 752 compat_sigset_t __user *, oset, unsigned int, sigsetsize)
753{ 753{
754 sigset_t old_set, new_set; 754 sigset_t old_set, new_set;
755 int ret; 755 int ret;
@@ -770,8 +770,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
770 return ret; 770 return ret;
771} 771}
772 772
773asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset, 773SYSCALL_DEFINE2(32_rt_sigpending, compat_sigset_t __user *, uset,
774 unsigned int sigsetsize) 774 unsigned int, sigsetsize)
775{ 775{
776 int ret; 776 int ret;
777 sigset_t set; 777 sigset_t set;
@@ -787,7 +787,8 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
787 return ret; 787 return ret;
788} 788}
789 789
790asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) 790SYSCALL_DEFINE3(32_rt_sigqueueinfo, int, pid, int, sig,
791 compat_siginfo_t __user *, uinfo)
791{ 792{
792 siginfo_t info; 793 siginfo_t info;
793 int ret; 794 int ret;
@@ -802,10 +803,9 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *
802 return ret; 803 return ret;
803} 804}
804 805
805asmlinkage long 806SYSCALL_DEFINE5(32_waitid, int, which, compat_pid_t, pid,
806sys32_waitid(int which, compat_pid_t pid, 807 compat_siginfo_t __user *, uinfo, int, options,
807 compat_siginfo_t __user *uinfo, int options, 808 struct compat_rusage __user *, uru)
808 struct compat_rusage __user *uru)
809{ 809{
810 siginfo_t info; 810 siginfo_t info;
811 struct rusage ru; 811 struct rusage ru;
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 37970d9b2186..8cf384644040 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -152,9 +152,9 @@ out:
152 return error; 152 return error;
153} 153}
154 154
155asmlinkage unsigned long 155SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
156old_mmap(unsigned long addr, unsigned long len, int prot, 156 unsigned long, prot, unsigned long, flags, unsigned long,
157 int flags, int fd, off_t offset) 157 fd, off_t, offset)
158{ 158{
159 unsigned long result; 159 unsigned long result;
160 160
@@ -168,9 +168,9 @@ out:
168 return result; 168 return result;
169} 169}
170 170
171asmlinkage unsigned long 171SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
172sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 172 unsigned long, prot, unsigned long, flags, unsigned long, fd,
173 unsigned long flags, unsigned long fd, unsigned long pgoff) 173 unsigned long, pgoff)
174{ 174{
175 if (pgoff & (~PAGE_MASK >> 12)) 175 if (pgoff & (~PAGE_MASK >> 12))
176 return -EINVAL; 176 return -EINVAL;
@@ -240,7 +240,7 @@ out:
240/* 240/*
241 * Compacrapability ... 241 * Compacrapability ...
242 */ 242 */
243asmlinkage int sys_uname(struct old_utsname __user * name) 243SYSCALL_DEFINE1(uname, struct old_utsname __user *, name)
244{ 244{
245 if (name && !copy_to_user(name, utsname(), sizeof (*name))) 245 if (name && !copy_to_user(name, utsname(), sizeof (*name)))
246 return 0; 246 return 0;
@@ -250,7 +250,7 @@ asmlinkage int sys_uname(struct old_utsname __user * name)
250/* 250/*
251 * Compacrapability ... 251 * Compacrapability ...
252 */ 252 */
253asmlinkage int sys_olduname(struct oldold_utsname __user * name) 253SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
254{ 254{
255 int error; 255 int error;
256 256
@@ -279,7 +279,7 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
279 return error; 279 return error;
280} 280}
281 281
282asmlinkage int sys_set_thread_area(unsigned long addr) 282SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
283{ 283{
284 struct thread_info *ti = task_thread_info(current); 284 struct thread_info *ti = task_thread_info(current);
285 285
@@ -290,7 +290,7 @@ asmlinkage int sys_set_thread_area(unsigned long addr)
290 return 0; 290 return 0;
291} 291}
292 292
293asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 293asmlinkage int _sys_sysmips(long cmd, long arg1, long arg2, long arg3)
294{ 294{
295 switch (cmd) { 295 switch (cmd) {
296 case MIPS_ATOMIC_SET: 296 case MIPS_ATOMIC_SET:
@@ -325,8 +325,8 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
325 * 325 *
326 * This is really horribly ugly. 326 * This is really horribly ugly.
327 */ 327 */
328asmlinkage int sys_ipc(unsigned int call, int first, int second, 328SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
329 unsigned long third, void __user *ptr, long fifth) 329 unsigned long, third, void __user *, ptr, long, fifth)
330{ 330{
331 int version, ret; 331 int version, ret;
332 332
@@ -411,7 +411,7 @@ asmlinkage int sys_ipc(unsigned int call, int first, int second,
411/* 411/*
412 * No implemented yet ... 412 * No implemented yet ...
413 */ 413 */
414asmlinkage int sys_cachectl(char *addr, int nbytes, int op) 414SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op)
415{ 415{
416 return -ENOSYS; 416 return -ENOSYS;
417} 417}
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 98ad0a82c29e..694d51f523d1 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -13,6 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/syscalls.h>
16#include <linux/mm.h> 17#include <linux/mm.h>
17 18
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
@@ -58,8 +59,8 @@ EXPORT_SYMBOL(_dma_cache_wback_inv);
58 * We could optimize the case where the cache argument is not BCACHE but 59 * We could optimize the case where the cache argument is not BCACHE but
59 * that seems very atypical use ... 60 * that seems very atypical use ...
60 */ 61 */
61asmlinkage int sys_cacheflush(unsigned long addr, 62SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes,
62 unsigned long bytes, unsigned int cache) 63 unsigned int, cache)
63{ 64{
64 if (bytes == 0) 65 if (bytes == 0)
65 return 0; 66 return 0;
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 1417c6494858..48060c635acd 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -172,8 +172,9 @@ static void __cpuinit set_prefetch_parameters(void)
172 */ 172 */
173 cache_line_size = cpu_dcache_line_size(); 173 cache_line_size = cpu_dcache_line_size();
174 switch (current_cpu_type()) { 174 switch (current_cpu_type()) {
175 case CPU_R5500:
175 case CPU_TX49XX: 176 case CPU_TX49XX:
176 /* TX49 supports only Pref_Load */ 177 /* These processors only support the Pref_Load. */
177 pref_bias_copy_load = 256; 178 pref_bias_copy_load = 256;
178 break; 179 break;
179 180
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 42942038d0fd..f335cf6cdd78 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -318,6 +318,7 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
318 case CPU_BCM4710: 318 case CPU_BCM4710:
319 case CPU_LOONGSON2: 319 case CPU_LOONGSON2:
320 case CPU_CAVIUM_OCTEON: 320 case CPU_CAVIUM_OCTEON:
321 case CPU_R5500:
321 if (m4kc_tlbp_war()) 322 if (m4kc_tlbp_war())
322 uasm_i_nop(p); 323 uasm_i_nop(p);
323 tlbw(p); 324 tlbw(p);
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 9a9f43358879..41d16822e616 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -7,6 +7,7 @@ mainmenu "Linux Kernel Configuration"
7 7
8config MN10300 8config MN10300
9 def_bool y 9 def_bool y
10 select HAVE_OPROFILE
10 11
11config AM33 12config AM33
12 def_bool y 13 def_bool y
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 1a86425fec42..07dbbcda3b2e 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -173,7 +173,7 @@ static int pci_ampci_write_config_byte(struct pci_bus *bus, unsigned int devfn,
173 BRIDGEREGB(where) = value; 173 BRIDGEREGB(where) = value;
174 } else { 174 } else {
175 if (bus->number == 0 && 175 if (bus->number == 0 &&
176 (devfn == PCI_DEVFN(2, 0) && devfn == PCI_DEVFN(3, 0)) 176 (devfn == PCI_DEVFN(2, 0) || devfn == PCI_DEVFN(3, 0))
177 ) 177 )
178 __pcidebug("<= %02x", bus, devfn, where, value); 178 __pcidebug("<= %02x", bus, devfn, where, value);
179 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); 179 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where);
diff --git a/arch/parisc/configs/712_defconfig b/arch/parisc/configs/712_defconfig
index 9fc96e727165..bf34a28895fa 100644
--- a/arch/parisc/configs/712_defconfig
+++ b/arch/parisc/configs/712_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23 3# Linux kernel version: 2.6.29-rc8
4# Fri Oct 12 21:00:07 2007 4# Fri Mar 13 01:32:55 2009
5# 5#
6CONFIG_PARISC=y 6CONFIG_PARISC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -33,17 +33,35 @@ CONFIG_SYSVIPC_SYSCTL=y
33CONFIG_POSIX_MQUEUE=y 33CONFIG_POSIX_MQUEUE=y
34# CONFIG_BSD_PROCESS_ACCT is not set 34# CONFIG_BSD_PROCESS_ACCT is not set
35# CONFIG_TASKSTATS is not set 35# CONFIG_TASKSTATS is not set
36# CONFIG_USER_NS is not set
37# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
37
38#
39# RCU Subsystem
40#
41CONFIG_CLASSIC_RCU=y
42# CONFIG_TREE_RCU is not set
43# CONFIG_PREEMPT_RCU is not set
44# CONFIG_TREE_RCU_TRACE is not set
45# CONFIG_PREEMPT_RCU_TRACE is not set
38CONFIG_IKCONFIG=y 46CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y 47CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=16 48CONFIG_LOG_BUF_SHIFT=16
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_CGROUPS is not set
41CONFIG_SYSFS_DEPRECATED=y 51CONFIG_SYSFS_DEPRECATED=y
52CONFIG_SYSFS_DEPRECATED_V2=y
42# CONFIG_RELAY is not set 53# CONFIG_RELAY is not set
54CONFIG_NAMESPACES=y
55# CONFIG_UTS_NS is not set
56# CONFIG_IPC_NS is not set
57# CONFIG_USER_NS is not set
58# CONFIG_PID_NS is not set
59# CONFIG_NET_NS is not set
43CONFIG_BLK_DEV_INITRD=y 60CONFIG_BLK_DEV_INITRD=y
44CONFIG_INITRAMFS_SOURCE="" 61CONFIG_INITRAMFS_SOURCE=""
45CONFIG_CC_OPTIMIZE_FOR_SIZE=y 62CONFIG_CC_OPTIMIZE_FOR_SIZE=y
46CONFIG_SYSCTL=y 63CONFIG_SYSCTL=y
64CONFIG_ANON_INODES=y
47# CONFIG_EMBEDDED is not set 65# CONFIG_EMBEDDED is not set
48CONFIG_SYSCTL_SYSCALL=y 66CONFIG_SYSCTL_SYSCALL=y
49CONFIG_KALLSYMS=y 67CONFIG_KALLSYMS=y
@@ -55,29 +73,38 @@ CONFIG_BUG=y
55CONFIG_ELF_CORE=y 73CONFIG_ELF_CORE=y
56CONFIG_BASE_FULL=y 74CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 75CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y 76CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y 77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
61CONFIG_EVENTFD=y 79CONFIG_EVENTFD=y
62CONFIG_SHMEM=y 80CONFIG_SHMEM=y
81CONFIG_AIO=y
63CONFIG_VM_EVENT_COUNTERS=y 82CONFIG_VM_EVENT_COUNTERS=y
83CONFIG_COMPAT_BRK=y
64CONFIG_SLAB=y 84CONFIG_SLAB=y
65# CONFIG_SLUB is not set 85# CONFIG_SLUB is not set
66# CONFIG_SLOB is not set 86# CONFIG_SLOB is not set
87CONFIG_PROFILING=y
88CONFIG_TRACEPOINTS=y
89# CONFIG_MARKERS is not set
90CONFIG_OPROFILE=m
91CONFIG_HAVE_OPROFILE=y
92# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
93CONFIG_SLABINFO=y
67CONFIG_RT_MUTEXES=y 94CONFIG_RT_MUTEXES=y
68# CONFIG_TINY_SHMEM is not set
69CONFIG_BASE_SMALL=0 95CONFIG_BASE_SMALL=0
70CONFIG_MODULES=y 96CONFIG_MODULES=y
97# CONFIG_MODULE_FORCE_LOAD is not set
71CONFIG_MODULE_UNLOAD=y 98CONFIG_MODULE_UNLOAD=y
72CONFIG_MODULE_FORCE_UNLOAD=y 99CONFIG_MODULE_FORCE_UNLOAD=y
73# CONFIG_MODVERSIONS is not set 100# CONFIG_MODVERSIONS is not set
74# CONFIG_MODULE_SRCVERSION_ALL is not set 101# CONFIG_MODULE_SRCVERSION_ALL is not set
75CONFIG_KMOD=y 102CONFIG_INIT_ALL_POSSIBLE=y
76CONFIG_BLOCK=y 103CONFIG_BLOCK=y
77# CONFIG_LBD is not set 104# CONFIG_LBD is not set
78# CONFIG_BLK_DEV_IO_TRACE is not set 105# CONFIG_BLK_DEV_IO_TRACE is not set
79# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set 106# CONFIG_BLK_DEV_BSG is not set
107# CONFIG_BLK_DEV_INTEGRITY is not set
81 108
82# 109#
83# IO Schedulers 110# IO Schedulers
@@ -91,6 +118,7 @@ CONFIG_DEFAULT_AS=y
91# CONFIG_DEFAULT_CFQ is not set 118# CONFIG_DEFAULT_CFQ is not set
92# CONFIG_DEFAULT_NOOP is not set 119# CONFIG_DEFAULT_NOOP is not set
93CONFIG_DEFAULT_IOSCHED="anticipatory" 120CONFIG_DEFAULT_IOSCHED="anticipatory"
121# CONFIG_FREEZER is not set
94 122
95# 123#
96# Processor type and features 124# Processor type and features
@@ -114,17 +142,19 @@ CONFIG_HZ_250=y
114# CONFIG_HZ_300 is not set 142# CONFIG_HZ_300 is not set
115# CONFIG_HZ_1000 is not set 143# CONFIG_HZ_1000 is not set
116CONFIG_HZ=250 144CONFIG_HZ=250
145# CONFIG_SCHED_HRTICK is not set
117CONFIG_SELECT_MEMORY_MODEL=y 146CONFIG_SELECT_MEMORY_MODEL=y
118CONFIG_FLATMEM_MANUAL=y 147CONFIG_FLATMEM_MANUAL=y
119# CONFIG_DISCONTIGMEM_MANUAL is not set 148# CONFIG_DISCONTIGMEM_MANUAL is not set
120# CONFIG_SPARSEMEM_MANUAL is not set 149# CONFIG_SPARSEMEM_MANUAL is not set
121CONFIG_FLATMEM=y 150CONFIG_FLATMEM=y
122CONFIG_FLAT_NODE_MEM_MAP=y 151CONFIG_FLAT_NODE_MEM_MAP=y
123# CONFIG_SPARSEMEM_STATIC is not set 152CONFIG_PAGEFLAGS_EXTENDED=y
124CONFIG_SPLIT_PTLOCK_CPUS=4096 153CONFIG_SPLIT_PTLOCK_CPUS=4096
125# CONFIG_RESOURCES_64BIT is not set 154# CONFIG_PHYS_ADDR_T_64BIT is not set
126CONFIG_ZONE_DMA_FLAG=0 155CONFIG_ZONE_DMA_FLAG=0
127CONFIG_VIRT_TO_BUS=y 156CONFIG_VIRT_TO_BUS=y
157CONFIG_UNEVICTABLE_LRU=y
128# CONFIG_HPUX is not set 158# CONFIG_HPUX is not set
129 159
130# 160#
@@ -138,10 +168,6 @@ CONFIG_GSC_LASI=y
138# CONFIG_EISA is not set 168# CONFIG_EISA is not set
139# CONFIG_PCI is not set 169# CONFIG_PCI is not set
140# CONFIG_ARCH_SUPPORTS_MSI is not set 170# CONFIG_ARCH_SUPPORTS_MSI is not set
141
142#
143# PCCARD (PCMCIA/CardBus) support
144#
145# CONFIG_PCCARD is not set 171# CONFIG_PCCARD is not set
146 172
147# 173#
@@ -156,16 +182,15 @@ CONFIG_PDC_STABLE=y
156# Executable file formats 182# Executable file formats
157# 183#
158CONFIG_BINFMT_ELF=y 184CONFIG_BINFMT_ELF=y
185# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
186# CONFIG_HAVE_AOUT is not set
159CONFIG_BINFMT_MISC=m 187CONFIG_BINFMT_MISC=m
160
161#
162# Networking
163#
164CONFIG_NET=y 188CONFIG_NET=y
165 189
166# 190#
167# Networking options 191# Networking options
168# 192#
193CONFIG_COMPAT_NET_DEV_OPS=y
169CONFIG_PACKET=y 194CONFIG_PACKET=y
170CONFIG_PACKET_MMAP=y 195CONFIG_PACKET_MMAP=y
171CONFIG_UNIX=y 196CONFIG_UNIX=y
@@ -173,6 +198,7 @@ CONFIG_XFRM=y
173CONFIG_XFRM_USER=m 198CONFIG_XFRM_USER=m
174# CONFIG_XFRM_SUB_POLICY is not set 199# CONFIG_XFRM_SUB_POLICY is not set
175# CONFIG_XFRM_MIGRATE is not set 200# CONFIG_XFRM_MIGRATE is not set
201# CONFIG_XFRM_STATISTICS is not set
176CONFIG_NET_KEY=m 202CONFIG_NET_KEY=m
177# CONFIG_NET_KEY_MIGRATE is not set 203# CONFIG_NET_KEY_MIGRATE is not set
178CONFIG_INET=y 204CONFIG_INET=y
@@ -203,25 +229,25 @@ CONFIG_INET_TCP_DIAG=m
203CONFIG_TCP_CONG_CUBIC=y 229CONFIG_TCP_CONG_CUBIC=y
204CONFIG_DEFAULT_TCP_CONG="cubic" 230CONFIG_DEFAULT_TCP_CONG="cubic"
205# CONFIG_TCP_MD5SIG is not set 231# CONFIG_TCP_MD5SIG is not set
206# CONFIG_IP_VS is not set
207# CONFIG_IPV6 is not set 232# CONFIG_IPV6 is not set
208# CONFIG_INET6_XFRM_TUNNEL is not set
209# CONFIG_INET6_TUNNEL is not set
210# CONFIG_NETWORK_SECMARK is not set 233# CONFIG_NETWORK_SECMARK is not set
211CONFIG_NETFILTER=y 234CONFIG_NETFILTER=y
212# CONFIG_NETFILTER_DEBUG is not set 235# CONFIG_NETFILTER_DEBUG is not set
236CONFIG_NETFILTER_ADVANCED=y
213 237
214# 238#
215# Core Netfilter Configuration 239# Core Netfilter Configuration
216# 240#
217# CONFIG_NETFILTER_NETLINK is not set 241# CONFIG_NETFILTER_NETLINK_QUEUE is not set
218# CONFIG_NF_CONNTRACK_ENABLED is not set 242# CONFIG_NETFILTER_NETLINK_LOG is not set
219# CONFIG_NF_CONNTRACK is not set 243# CONFIG_NF_CONNTRACK is not set
220# CONFIG_NETFILTER_XTABLES is not set 244# CONFIG_NETFILTER_XTABLES is not set
245# CONFIG_IP_VS is not set
221 246
222# 247#
223# IP: Netfilter Configuration 248# IP: Netfilter Configuration
224# 249#
250# CONFIG_NF_DEFRAG_IPV4 is not set
225CONFIG_IP_NF_QUEUE=m 251CONFIG_IP_NF_QUEUE=m
226# CONFIG_IP_NF_IPTABLES is not set 252# CONFIG_IP_NF_IPTABLES is not set
227# CONFIG_IP_NF_ARPTABLES is not set 253# CONFIG_IP_NF_ARPTABLES is not set
@@ -230,6 +256,7 @@ CONFIG_IP_NF_QUEUE=m
230# CONFIG_TIPC is not set 256# CONFIG_TIPC is not set
231# CONFIG_ATM is not set 257# CONFIG_ATM is not set
232# CONFIG_BRIDGE is not set 258# CONFIG_BRIDGE is not set
259# CONFIG_NET_DSA is not set
233# CONFIG_VLAN_8021Q is not set 260# CONFIG_VLAN_8021Q is not set
234# CONFIG_DECNET is not set 261# CONFIG_DECNET is not set
235CONFIG_LLC=m 262CONFIG_LLC=m
@@ -240,28 +267,26 @@ CONFIG_LLC2=m
240# CONFIG_LAPB is not set 267# CONFIG_LAPB is not set
241# CONFIG_ECONET is not set 268# CONFIG_ECONET is not set
242# CONFIG_WAN_ROUTER is not set 269# CONFIG_WAN_ROUTER is not set
243
244#
245# QoS and/or fair queueing
246#
247# CONFIG_NET_SCHED is not set 270# CONFIG_NET_SCHED is not set
271# CONFIG_DCB is not set
248 272
249# 273#
250# Network testing 274# Network testing
251# 275#
252CONFIG_NET_PKTGEN=m 276CONFIG_NET_PKTGEN=m
253# CONFIG_HAMRADIO is not set 277# CONFIG_HAMRADIO is not set
278# CONFIG_CAN is not set
254# CONFIG_IRDA is not set 279# CONFIG_IRDA is not set
255# CONFIG_BT is not set 280# CONFIG_BT is not set
256# CONFIG_AF_RXRPC is not set 281# CONFIG_AF_RXRPC is not set
257 282# CONFIG_PHONET is not set
258# 283CONFIG_WIRELESS=y
259# Wireless
260#
261# CONFIG_CFG80211 is not set 284# CONFIG_CFG80211 is not set
285CONFIG_WIRELESS_OLD_REGULATORY=y
262# CONFIG_WIRELESS_EXT is not set 286# CONFIG_WIRELESS_EXT is not set
287# CONFIG_LIB80211 is not set
263# CONFIG_MAC80211 is not set 288# CONFIG_MAC80211 is not set
264# CONFIG_IEEE80211 is not set 289# CONFIG_WIMAX is not set
265# CONFIG_RFKILL is not set 290# CONFIG_RFKILL is not set
266# CONFIG_NET_9P is not set 291# CONFIG_NET_9P is not set
267 292
@@ -276,6 +301,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
276# CONFIG_STANDALONE is not set 301# CONFIG_STANDALONE is not set
277# CONFIG_PREVENT_FIRMWARE_BUILD is not set 302# CONFIG_PREVENT_FIRMWARE_BUILD is not set
278CONFIG_FW_LOADER=y 303CONFIG_FW_LOADER=y
304CONFIG_FIRMWARE_IN_KERNEL=y
305CONFIG_EXTRA_FIRMWARE=""
279# CONFIG_DEBUG_DRIVER is not set 306# CONFIG_DEBUG_DRIVER is not set
280# CONFIG_DEBUG_DEVRES is not set 307# CONFIG_DEBUG_DEVRES is not set
281# CONFIG_SYS_HYPERVISOR is not set 308# CONFIG_SYS_HYPERVISOR is not set
@@ -298,11 +325,19 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y
298CONFIG_BLK_DEV_RAM=y 325CONFIG_BLK_DEV_RAM=y
299CONFIG_BLK_DEV_RAM_COUNT=16 326CONFIG_BLK_DEV_RAM_COUNT=16
300CONFIG_BLK_DEV_RAM_SIZE=6144 327CONFIG_BLK_DEV_RAM_SIZE=6144
301CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 328# CONFIG_BLK_DEV_XIP is not set
302# CONFIG_CDROM_PKTCDVD is not set 329# CONFIG_CDROM_PKTCDVD is not set
303CONFIG_ATA_OVER_ETH=m 330CONFIG_ATA_OVER_ETH=m
331# CONFIG_BLK_DEV_HD is not set
304CONFIG_MISC_DEVICES=y 332CONFIG_MISC_DEVICES=y
333# CONFIG_ENCLOSURE_SERVICES is not set
334# CONFIG_C2PORT is not set
335
336#
337# EEPROM support
338#
305# CONFIG_EEPROM_93CX6 is not set 339# CONFIG_EEPROM_93CX6 is not set
340CONFIG_HAVE_IDE=y
306# CONFIG_IDE is not set 341# CONFIG_IDE is not set
307 342
308# 343#
@@ -342,14 +377,17 @@ CONFIG_SCSI_SPI_ATTRS=y
342# CONFIG_SCSI_FC_ATTRS is not set 377# CONFIG_SCSI_FC_ATTRS is not set
343CONFIG_SCSI_ISCSI_ATTRS=m 378CONFIG_SCSI_ISCSI_ATTRS=m
344# CONFIG_SCSI_SAS_LIBSAS is not set 379# CONFIG_SCSI_SAS_LIBSAS is not set
380# CONFIG_SCSI_SRP_ATTRS is not set
345CONFIG_SCSI_LOWLEVEL=y 381CONFIG_SCSI_LOWLEVEL=y
346# CONFIG_ISCSI_TCP is not set 382# CONFIG_ISCSI_TCP is not set
383# CONFIG_LIBFC is not set
347# CONFIG_SCSI_PPA is not set 384# CONFIG_SCSI_PPA is not set
348# CONFIG_SCSI_IMM is not set 385# CONFIG_SCSI_IMM is not set
349CONFIG_SCSI_LASI700=y 386CONFIG_SCSI_LASI700=y
350CONFIG_53C700_LE_ON_BE=y 387CONFIG_53C700_LE_ON_BE=y
351# CONFIG_SCSI_ZALON is not set 388# CONFIG_SCSI_ZALON is not set
352CONFIG_SCSI_DEBUG=m 389CONFIG_SCSI_DEBUG=m
390# CONFIG_SCSI_DH is not set
353# CONFIG_ATA is not set 391# CONFIG_ATA is not set
354CONFIG_MD=y 392CONFIG_MD=y
355CONFIG_BLK_DEV_MD=m 393CONFIG_BLK_DEV_MD=m
@@ -362,7 +400,6 @@ CONFIG_MD_RAID1=m
362# CONFIG_MD_FAULTY is not set 400# CONFIG_MD_FAULTY is not set
363# CONFIG_BLK_DEV_DM is not set 401# CONFIG_BLK_DEV_DM is not set
364CONFIG_NETDEVICES=y 402CONFIG_NETDEVICES=y
365# CONFIG_NETDEVICES_MULTIQUEUE is not set
366CONFIG_DUMMY=m 403CONFIG_DUMMY=m
367CONFIG_BONDING=m 404CONFIG_BONDING=m
368# CONFIG_MACVLAN is not set 405# CONFIG_MACVLAN is not set
@@ -377,6 +414,9 @@ CONFIG_LASI_82596=y
377# CONFIG_IBM_NEW_EMAC_RGMII is not set 414# CONFIG_IBM_NEW_EMAC_RGMII is not set
378# CONFIG_IBM_NEW_EMAC_TAH is not set 415# CONFIG_IBM_NEW_EMAC_TAH is not set
379# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 416# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
417# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
418# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
419# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
380# CONFIG_B44 is not set 420# CONFIG_B44 is not set
381# CONFIG_NET_POCKET is not set 421# CONFIG_NET_POCKET is not set
382CONFIG_NETDEV_1000=y 422CONFIG_NETDEV_1000=y
@@ -387,6 +427,11 @@ CONFIG_NETDEV_10000=y
387# 427#
388# CONFIG_WLAN_PRE80211 is not set 428# CONFIG_WLAN_PRE80211 is not set
389# CONFIG_WLAN_80211 is not set 429# CONFIG_WLAN_80211 is not set
430# CONFIG_IWLWIFI_LEDS is not set
431
432#
433# Enable WiMAX (Networking options) to see the WiMAX drivers
434#
390# CONFIG_WAN is not set 435# CONFIG_WAN is not set
391# CONFIG_PLIP is not set 436# CONFIG_PLIP is not set
392CONFIG_PPP=m 437CONFIG_PPP=m
@@ -401,7 +446,6 @@ CONFIG_PPPOE=m
401# CONFIG_PPPOL2TP is not set 446# CONFIG_PPPOL2TP is not set
402# CONFIG_SLIP is not set 447# CONFIG_SLIP is not set
403CONFIG_SLHC=m 448CONFIG_SLHC=m
404# CONFIG_SHAPER is not set
405# CONFIG_NETCONSOLE is not set 449# CONFIG_NETCONSOLE is not set
406# CONFIG_NETPOLL is not set 450# CONFIG_NETPOLL is not set
407# CONFIG_NET_POLL_CONTROLLER is not set 451# CONFIG_NET_POLL_CONTROLLER is not set
@@ -423,7 +467,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
423CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 467CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
424CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 468CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
425# CONFIG_INPUT_JOYDEV is not set 469# CONFIG_INPUT_JOYDEV is not set
426# CONFIG_INPUT_TSDEV is not set
427# CONFIG_INPUT_EVDEV is not set 470# CONFIG_INPUT_EVDEV is not set
428# CONFIG_INPUT_EVBUG is not set 471# CONFIG_INPUT_EVBUG is not set
429 472
@@ -446,8 +489,8 @@ CONFIG_MOUSE_PS2=y
446CONFIG_MOUSE_PS2_ALPS=y 489CONFIG_MOUSE_PS2_ALPS=y
447CONFIG_MOUSE_PS2_LOGIPS2PP=y 490CONFIG_MOUSE_PS2_LOGIPS2PP=y
448CONFIG_MOUSE_PS2_SYNAPTICS=y 491CONFIG_MOUSE_PS2_SYNAPTICS=y
449CONFIG_MOUSE_PS2_LIFEBOOK=y
450CONFIG_MOUSE_PS2_TRACKPOINT=y 492CONFIG_MOUSE_PS2_TRACKPOINT=y
493# CONFIG_MOUSE_PS2_ELANTECH is not set
451# CONFIG_MOUSE_PS2_TOUCHKIT is not set 494# CONFIG_MOUSE_PS2_TOUCHKIT is not set
452CONFIG_MOUSE_SERIAL=m 495CONFIG_MOUSE_SERIAL=m
453# CONFIG_MOUSE_VSXXXAA is not set 496# CONFIG_MOUSE_VSXXXAA is not set
@@ -474,9 +517,11 @@ CONFIG_SERIO_LIBPS2=y
474# Character devices 517# Character devices
475# 518#
476CONFIG_VT=y 519CONFIG_VT=y
520CONFIG_CONSOLE_TRANSLATIONS=y
477CONFIG_VT_CONSOLE=y 521CONFIG_VT_CONSOLE=y
478CONFIG_HW_CONSOLE=y 522CONFIG_HW_CONSOLE=y
479# CONFIG_VT_HW_CONSOLE_BINDING is not set 523# CONFIG_VT_HW_CONSOLE_BINDING is not set
524CONFIG_DEVKMEM=y
480# CONFIG_SERIAL_NONSTANDARD is not set 525# CONFIG_SERIAL_NONSTANDARD is not set
481 526
482# 527#
@@ -501,72 +546,76 @@ CONFIG_PDC_CONSOLE=y
501CONFIG_SERIAL_CORE=y 546CONFIG_SERIAL_CORE=y
502CONFIG_SERIAL_CORE_CONSOLE=y 547CONFIG_SERIAL_CORE_CONSOLE=y
503CONFIG_UNIX98_PTYS=y 548CONFIG_UNIX98_PTYS=y
549# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
504CONFIG_LEGACY_PTYS=y 550CONFIG_LEGACY_PTYS=y
505CONFIG_LEGACY_PTY_COUNT=64 551CONFIG_LEGACY_PTY_COUNT=64
506CONFIG_PRINTER=m 552CONFIG_PRINTER=m
507# CONFIG_LP_CONSOLE is not set 553# CONFIG_LP_CONSOLE is not set
508CONFIG_PPDEV=m 554CONFIG_PPDEV=m
509# CONFIG_TIPAR is not set
510# CONFIG_IPMI_HANDLER is not set 555# CONFIG_IPMI_HANDLER is not set
511# CONFIG_WATCHDOG is not set
512# CONFIG_HW_RANDOM is not set 556# CONFIG_HW_RANDOM is not set
513CONFIG_GEN_RTC=y
514CONFIG_GEN_RTC_X=y
515# CONFIG_R3964 is not set 557# CONFIG_R3964 is not set
516CONFIG_RAW_DRIVER=y 558CONFIG_RAW_DRIVER=y
517CONFIG_MAX_RAW_DEVS=256 559CONFIG_MAX_RAW_DEVS=256
518# CONFIG_TCG_TPM is not set 560# CONFIG_TCG_TPM is not set
519# CONFIG_I2C is not set 561# CONFIG_I2C is not set
520
521#
522# SPI support
523#
524# CONFIG_SPI is not set 562# CONFIG_SPI is not set
525# CONFIG_SPI_MASTER is not set
526# CONFIG_W1 is not set 563# CONFIG_W1 is not set
527# CONFIG_POWER_SUPPLY is not set 564# CONFIG_POWER_SUPPLY is not set
528# CONFIG_HWMON is not set 565# CONFIG_HWMON is not set
566# CONFIG_THERMAL is not set
567# CONFIG_THERMAL_HWMON is not set
568# CONFIG_WATCHDOG is not set
569CONFIG_SSB_POSSIBLE=y
529 570
530# 571#
531# Sonics Silicon Backplane 572# Sonics Silicon Backplane
532# 573#
533CONFIG_SSB_POSSIBLE=y
534# CONFIG_SSB is not set 574# CONFIG_SSB is not set
535 575
536# 576#
537# Multifunction device drivers 577# Multifunction device drivers
538# 578#
579# CONFIG_MFD_CORE is not set
539# CONFIG_MFD_SM501 is not set 580# CONFIG_MFD_SM501 is not set
581# CONFIG_HTC_PASIC3 is not set
582# CONFIG_MFD_TMIO is not set
583# CONFIG_REGULATOR is not set
540 584
541# 585#
542# Multimedia devices 586# Multimedia devices
543# 587#
588
589#
590# Multimedia core support
591#
544# CONFIG_VIDEO_DEV is not set 592# CONFIG_VIDEO_DEV is not set
545# CONFIG_DVB_CORE is not set 593# CONFIG_DVB_CORE is not set
546# CONFIG_DAB is not set 594# CONFIG_VIDEO_MEDIA is not set
547 595
548# 596#
549# Graphics support 597# Multimedia drivers
550# 598#
551# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 599# CONFIG_DAB is not set
552 600
553# 601#
554# Display device support 602# Graphics support
555# 603#
556# CONFIG_DISPLAY_SUPPORT is not set
557# CONFIG_VGASTATE is not set 604# CONFIG_VGASTATE is not set
558CONFIG_VIDEO_OUTPUT_CONTROL=m 605CONFIG_VIDEO_OUTPUT_CONTROL=m
559CONFIG_FB=y 606CONFIG_FB=y
560# CONFIG_FIRMWARE_EDID is not set 607# CONFIG_FIRMWARE_EDID is not set
561# CONFIG_FB_DDC is not set 608# CONFIG_FB_DDC is not set
609# CONFIG_FB_BOOT_VESA_SUPPORT is not set
562CONFIG_FB_CFB_FILLRECT=y 610CONFIG_FB_CFB_FILLRECT=y
563CONFIG_FB_CFB_COPYAREA=y 611CONFIG_FB_CFB_COPYAREA=y
564CONFIG_FB_CFB_IMAGEBLIT=y 612CONFIG_FB_CFB_IMAGEBLIT=y
613# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
565# CONFIG_FB_SYS_FILLRECT is not set 614# CONFIG_FB_SYS_FILLRECT is not set
566# CONFIG_FB_SYS_COPYAREA is not set 615# CONFIG_FB_SYS_COPYAREA is not set
567# CONFIG_FB_SYS_IMAGEBLIT is not set 616# CONFIG_FB_SYS_IMAGEBLIT is not set
617# CONFIG_FB_FOREIGN_ENDIAN is not set
568# CONFIG_FB_SYS_FOPS is not set 618# CONFIG_FB_SYS_FOPS is not set
569CONFIG_FB_DEFERRED_IO=y
570# CONFIG_FB_SVGALIB is not set 619# CONFIG_FB_SVGALIB is not set
571# CONFIG_FB_MACMODES is not set 620# CONFIG_FB_MACMODES is not set
572# CONFIG_FB_BACKLIGHT is not set 621# CONFIG_FB_BACKLIGHT is not set
@@ -579,6 +628,14 @@ CONFIG_FB_TILEBLITTING=y
579CONFIG_FB_STI=y 628CONFIG_FB_STI=y
580# CONFIG_FB_S1D13XXX is not set 629# CONFIG_FB_S1D13XXX is not set
581# CONFIG_FB_VIRTUAL is not set 630# CONFIG_FB_VIRTUAL is not set
631# CONFIG_FB_METRONOME is not set
632# CONFIG_FB_MB862XX is not set
633# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
634
635#
636# Display device support
637#
638# CONFIG_DISPLAY_SUPPORT is not set
582 639
583# 640#
584# Console display driver support 641# Console display driver support
@@ -606,15 +663,8 @@ CONFIG_LOGO=y
606# CONFIG_LOGO_LINUX_VGA16 is not set 663# CONFIG_LOGO_LINUX_VGA16 is not set
607# CONFIG_LOGO_LINUX_CLUT224 is not set 664# CONFIG_LOGO_LINUX_CLUT224 is not set
608CONFIG_LOGO_PARISC_CLUT224=y 665CONFIG_LOGO_PARISC_CLUT224=y
609
610#
611# Sound
612#
613CONFIG_SOUND=y 666CONFIG_SOUND=y
614 667CONFIG_SOUND_OSS_CORE=y
615#
616# Advanced Linux Sound Architecture
617#
618CONFIG_SND=y 668CONFIG_SND=y
619CONFIG_SND_TIMER=y 669CONFIG_SND_TIMER=y
620CONFIG_SND_PCM=y 670CONFIG_SND_PCM=y
@@ -630,10 +680,7 @@ CONFIG_SND_SUPPORT_OLD_API=y
630CONFIG_SND_VERBOSE_PROCFS=y 680CONFIG_SND_VERBOSE_PROCFS=y
631# CONFIG_SND_VERBOSE_PRINTK is not set 681# CONFIG_SND_VERBOSE_PRINTK is not set
632# CONFIG_SND_DEBUG is not set 682# CONFIG_SND_DEBUG is not set
633 683CONFIG_SND_DRIVERS=y
634#
635# Generic devices
636#
637# CONFIG_SND_DUMMY is not set 684# CONFIG_SND_DUMMY is not set
638# CONFIG_SND_VIRMIDI is not set 685# CONFIG_SND_VIRMIDI is not set
639# CONFIG_SND_MTPAV is not set 686# CONFIG_SND_MTPAV is not set
@@ -641,63 +688,82 @@ CONFIG_SND_VERBOSE_PROCFS=y
641# CONFIG_SND_SERIAL_U16550 is not set 688# CONFIG_SND_SERIAL_U16550 is not set
642# CONFIG_SND_MPU401 is not set 689# CONFIG_SND_MPU401 is not set
643# CONFIG_SND_PORTMAN2X4 is not set 690# CONFIG_SND_PORTMAN2X4 is not set
644 691CONFIG_SND_GSC=y
645#
646# GSC devices
647#
648CONFIG_SND_HARMONY=y 692CONFIG_SND_HARMONY=y
649
650#
651# System on Chip audio support
652#
653# CONFIG_SND_SOC is not set 693# CONFIG_SND_SOC is not set
654
655#
656# SoC Audio support for SuperH
657#
658
659#
660# Open Sound System
661#
662# CONFIG_SOUND_PRIME is not set 694# CONFIG_SOUND_PRIME is not set
663CONFIG_HID_SUPPORT=y 695CONFIG_HID_SUPPORT=y
664CONFIG_HID=y 696CONFIG_HID=y
665CONFIG_HID_DEBUG=y 697CONFIG_HID_DEBUG=y
698# CONFIG_HIDRAW is not set
699# CONFIG_HID_PID is not set
700
701#
702# Special HID drivers
703#
704CONFIG_HID_COMPAT=y
666CONFIG_USB_SUPPORT=y 705CONFIG_USB_SUPPORT=y
667# CONFIG_USB_ARCH_HAS_HCD is not set 706# CONFIG_USB_ARCH_HAS_HCD is not set
668# CONFIG_USB_ARCH_HAS_OHCI is not set 707# CONFIG_USB_ARCH_HAS_OHCI is not set
669# CONFIG_USB_ARCH_HAS_EHCI is not set 708# CONFIG_USB_ARCH_HAS_EHCI is not set
670 709
671# 710#
672# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 711# Enable Host or Gadget support to see Inventra options
673# 712#
674 713
675# 714#
676# USB Gadget Support 715# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
677# 716#
678# CONFIG_USB_GADGET is not set 717# CONFIG_USB_GADGET is not set
718
719#
720# OTG and related infrastructure
721#
679# CONFIG_MMC is not set 722# CONFIG_MMC is not set
723# CONFIG_MEMSTICK is not set
680# CONFIG_NEW_LEDS is not set 724# CONFIG_NEW_LEDS is not set
681# CONFIG_RTC_CLASS is not set 725# CONFIG_ACCESSIBILITY is not set
726CONFIG_RTC_LIB=y
727CONFIG_RTC_CLASS=y
728CONFIG_RTC_HCTOSYS=y
729CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
730# CONFIG_RTC_DEBUG is not set
682 731
683# 732#
684# DMA Engine support 733# RTC interfaces
685# 734#
686# CONFIG_DMA_ENGINE is not set 735CONFIG_RTC_INTF_SYSFS=y
736CONFIG_RTC_INTF_PROC=y
737CONFIG_RTC_INTF_DEV=y
738# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
739# CONFIG_RTC_DRV_TEST is not set
687 740
688# 741#
689# DMA Clients 742# SPI RTC drivers
690# 743#
691 744
692# 745#
693# DMA Devices 746# Platform RTC drivers
694# 747#
695# CONFIG_AUXDISPLAY is not set 748# CONFIG_RTC_DRV_DS1286 is not set
749# CONFIG_RTC_DRV_DS1511 is not set
750# CONFIG_RTC_DRV_DS1553 is not set
751# CONFIG_RTC_DRV_DS1742 is not set
752# CONFIG_RTC_DRV_STK17TA8 is not set
753# CONFIG_RTC_DRV_M48T86 is not set
754# CONFIG_RTC_DRV_M48T35 is not set
755# CONFIG_RTC_DRV_M48T59 is not set
756# CONFIG_RTC_DRV_BQ4802 is not set
757# CONFIG_RTC_DRV_V3020 is not set
696 758
697# 759#
698# Userspace I/O 760# on-CPU RTC drivers
699# 761#
762CONFIG_RTC_DRV_PARISC=y
763# CONFIG_DMADEVICES is not set
764# CONFIG_AUXDISPLAY is not set
700# CONFIG_UIO is not set 765# CONFIG_UIO is not set
766# CONFIG_STAGING is not set
701 767
702# 768#
703# File systems 769# File systems
@@ -707,7 +773,7 @@ CONFIG_EXT2_FS=y
707# CONFIG_EXT2_FS_XIP is not set 773# CONFIG_EXT2_FS_XIP is not set
708CONFIG_EXT3_FS=y 774CONFIG_EXT3_FS=y
709# CONFIG_EXT3_FS_XATTR is not set 775# CONFIG_EXT3_FS_XATTR is not set
710# CONFIG_EXT4DEV_FS is not set 776# CONFIG_EXT4_FS is not set
711CONFIG_JBD=y 777CONFIG_JBD=y
712# CONFIG_JBD_DEBUG is not set 778# CONFIG_JBD_DEBUG is not set
713# CONFIG_REISERFS_FS is not set 779# CONFIG_REISERFS_FS is not set
@@ -717,19 +783,18 @@ CONFIG_JFS_FS=m
717# CONFIG_JFS_DEBUG is not set 783# CONFIG_JFS_DEBUG is not set
718# CONFIG_JFS_STATISTICS is not set 784# CONFIG_JFS_STATISTICS is not set
719CONFIG_FS_POSIX_ACL=y 785CONFIG_FS_POSIX_ACL=y
786CONFIG_FILE_LOCKING=y
720CONFIG_XFS_FS=m 787CONFIG_XFS_FS=m
721# CONFIG_XFS_QUOTA is not set 788# CONFIG_XFS_QUOTA is not set
722# CONFIG_XFS_SECURITY is not set
723# CONFIG_XFS_POSIX_ACL is not set 789# CONFIG_XFS_POSIX_ACL is not set
724# CONFIG_XFS_RT is not set 790# CONFIG_XFS_RT is not set
725# CONFIG_GFS2_FS is not set 791# CONFIG_XFS_DEBUG is not set
726# CONFIG_OCFS2_FS is not set 792# CONFIG_OCFS2_FS is not set
727# CONFIG_MINIX_FS is not set 793# CONFIG_BTRFS_FS is not set
728# CONFIG_ROMFS_FS is not set 794CONFIG_DNOTIFY=y
729CONFIG_INOTIFY=y 795CONFIG_INOTIFY=y
730CONFIG_INOTIFY_USER=y 796CONFIG_INOTIFY_USER=y
731# CONFIG_QUOTA is not set 797# CONFIG_QUOTA is not set
732CONFIG_DNOTIFY=y
733# CONFIG_AUTOFS_FS is not set 798# CONFIG_AUTOFS_FS is not set
734CONFIG_AUTOFS4_FS=y 799CONFIG_AUTOFS4_FS=y
735# CONFIG_FUSE_FS is not set 800# CONFIG_FUSE_FS is not set
@@ -759,16 +824,13 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
759CONFIG_PROC_FS=y 824CONFIG_PROC_FS=y
760CONFIG_PROC_KCORE=y 825CONFIG_PROC_KCORE=y
761CONFIG_PROC_SYSCTL=y 826CONFIG_PROC_SYSCTL=y
827CONFIG_PROC_PAGE_MONITOR=y
762CONFIG_SYSFS=y 828CONFIG_SYSFS=y
763CONFIG_TMPFS=y 829CONFIG_TMPFS=y
764# CONFIG_TMPFS_POSIX_ACL is not set 830# CONFIG_TMPFS_POSIX_ACL is not set
765# CONFIG_HUGETLB_PAGE is not set 831# CONFIG_HUGETLB_PAGE is not set
766CONFIG_RAMFS=y
767# CONFIG_CONFIGFS_FS is not set 832# CONFIG_CONFIGFS_FS is not set
768 833CONFIG_MISC_FILESYSTEMS=y
769#
770# Miscellaneous filesystems
771#
772# CONFIG_ADFS_FS is not set 834# CONFIG_ADFS_FS is not set
773# CONFIG_AFFS_FS is not set 835# CONFIG_AFFS_FS is not set
774# CONFIG_ECRYPT_FS is not set 836# CONFIG_ECRYPT_FS is not set
@@ -778,35 +840,34 @@ CONFIG_RAMFS=y
778# CONFIG_BFS_FS is not set 840# CONFIG_BFS_FS is not set
779# CONFIG_EFS_FS is not set 841# CONFIG_EFS_FS is not set
780# CONFIG_CRAMFS is not set 842# CONFIG_CRAMFS is not set
843# CONFIG_SQUASHFS is not set
781# CONFIG_VXFS_FS is not set 844# CONFIG_VXFS_FS is not set
845# CONFIG_MINIX_FS is not set
846# CONFIG_OMFS_FS is not set
782# CONFIG_HPFS_FS is not set 847# CONFIG_HPFS_FS is not set
783# CONFIG_QNX4FS_FS is not set 848# CONFIG_QNX4FS_FS is not set
849# CONFIG_ROMFS_FS is not set
784# CONFIG_SYSV_FS is not set 850# CONFIG_SYSV_FS is not set
785CONFIG_UFS_FS=m 851CONFIG_UFS_FS=m
786# CONFIG_UFS_FS_WRITE is not set 852# CONFIG_UFS_FS_WRITE is not set
787# CONFIG_UFS_DEBUG is not set 853# CONFIG_UFS_DEBUG is not set
788 854CONFIG_NETWORK_FILESYSTEMS=y
789#
790# Network File Systems
791#
792CONFIG_NFS_FS=y 855CONFIG_NFS_FS=y
793CONFIG_NFS_V3=y 856CONFIG_NFS_V3=y
794# CONFIG_NFS_V3_ACL is not set 857# CONFIG_NFS_V3_ACL is not set
795CONFIG_NFS_V4=y 858CONFIG_NFS_V4=y
796CONFIG_NFS_DIRECTIO=y 859CONFIG_ROOT_NFS=y
797CONFIG_NFSD=m 860CONFIG_NFSD=m
798CONFIG_NFSD_V3=y 861CONFIG_NFSD_V3=y
799# CONFIG_NFSD_V3_ACL is not set 862# CONFIG_NFSD_V3_ACL is not set
800CONFIG_NFSD_V4=y 863CONFIG_NFSD_V4=y
801CONFIG_NFSD_TCP=y
802CONFIG_ROOT_NFS=y
803CONFIG_LOCKD=y 864CONFIG_LOCKD=y
804CONFIG_LOCKD_V4=y 865CONFIG_LOCKD_V4=y
805CONFIG_EXPORTFS=m 866CONFIG_EXPORTFS=m
806CONFIG_NFS_COMMON=y 867CONFIG_NFS_COMMON=y
807CONFIG_SUNRPC=y 868CONFIG_SUNRPC=y
808CONFIG_SUNRPC_GSS=y 869CONFIG_SUNRPC_GSS=y
809# CONFIG_SUNRPC_BIND34 is not set 870# CONFIG_SUNRPC_REGISTER_V4 is not set
810CONFIG_RPCSEC_GSS_KRB5=y 871CONFIG_RPCSEC_GSS_KRB5=y
811CONFIG_RPCSEC_GSS_SPKM3=m 872CONFIG_RPCSEC_GSS_SPKM3=m
812CONFIG_SMB_FS=m 873CONFIG_SMB_FS=m
@@ -815,6 +876,7 @@ CONFIG_SMB_NLS_REMOTE="cp437"
815CONFIG_CIFS=m 876CONFIG_CIFS=m
816# CONFIG_CIFS_STATS is not set 877# CONFIG_CIFS_STATS is not set
817# CONFIG_CIFS_WEAK_PW_HASH is not set 878# CONFIG_CIFS_WEAK_PW_HASH is not set
879# CONFIG_CIFS_UPCALL is not set
818# CONFIG_CIFS_XATTR is not set 880# CONFIG_CIFS_XATTR is not set
819# CONFIG_CIFS_DEBUG2 is not set 881# CONFIG_CIFS_DEBUG2 is not set
820# CONFIG_CIFS_EXPERIMENTAL is not set 882# CONFIG_CIFS_EXPERIMENTAL is not set
@@ -827,10 +889,6 @@ CONFIG_CIFS=m
827# 889#
828# CONFIG_PARTITION_ADVANCED is not set 890# CONFIG_PARTITION_ADVANCED is not set
829CONFIG_MSDOS_PARTITION=y 891CONFIG_MSDOS_PARTITION=y
830
831#
832# Native Language Support
833#
834CONFIG_NLS=y 892CONFIG_NLS=y
835CONFIG_NLS_DEFAULT="iso8859-1" 893CONFIG_NLS_DEFAULT="iso8859-1"
836CONFIG_NLS_CODEPAGE_437=m 894CONFIG_NLS_CODEPAGE_437=m
@@ -871,33 +929,28 @@ CONFIG_NLS_ISO8859_15=m
871CONFIG_NLS_KOI8_R=m 929CONFIG_NLS_KOI8_R=m
872CONFIG_NLS_KOI8_U=m 930CONFIG_NLS_KOI8_U=m
873CONFIG_NLS_UTF8=m 931CONFIG_NLS_UTF8=m
874
875#
876# Distributed Lock Manager
877#
878# CONFIG_DLM is not set 932# CONFIG_DLM is not set
879 933
880# 934#
881# Profiling support
882#
883CONFIG_PROFILING=y
884CONFIG_OPROFILE=m
885
886#
887# Kernel hacking 935# Kernel hacking
888# 936#
889# CONFIG_PRINTK_TIME is not set 937# CONFIG_PRINTK_TIME is not set
938CONFIG_ENABLE_WARN_DEPRECATED=y
890CONFIG_ENABLE_MUST_CHECK=y 939CONFIG_ENABLE_MUST_CHECK=y
940CONFIG_FRAME_WARN=1024
891CONFIG_MAGIC_SYSRQ=y 941CONFIG_MAGIC_SYSRQ=y
892# CONFIG_UNUSED_SYMBOLS is not set 942# CONFIG_UNUSED_SYMBOLS is not set
893# CONFIG_DEBUG_FS is not set 943CONFIG_DEBUG_FS=y
894# CONFIG_HEADERS_CHECK is not set 944# CONFIG_HEADERS_CHECK is not set
895CONFIG_DEBUG_KERNEL=y 945CONFIG_DEBUG_KERNEL=y
896# CONFIG_DEBUG_SHIRQ is not set 946# CONFIG_DEBUG_SHIRQ is not set
897CONFIG_DETECT_SOFTLOCKUP=y 947CONFIG_DETECT_SOFTLOCKUP=y
948# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
949CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
898CONFIG_SCHED_DEBUG=y 950CONFIG_SCHED_DEBUG=y
899# CONFIG_SCHEDSTATS is not set 951# CONFIG_SCHEDSTATS is not set
900# CONFIG_TIMER_STATS is not set 952# CONFIG_TIMER_STATS is not set
953# CONFIG_DEBUG_OBJECTS is not set
901# CONFIG_DEBUG_SLAB is not set 954# CONFIG_DEBUG_SLAB is not set
902# CONFIG_DEBUG_RT_MUTEXES is not set 955# CONFIG_DEBUG_RT_MUTEXES is not set
903# CONFIG_RT_MUTEX_TESTER is not set 956# CONFIG_RT_MUTEX_TESTER is not set
@@ -909,10 +962,32 @@ CONFIG_DEBUG_MUTEXES=y
909CONFIG_DEBUG_BUGVERBOSE=y 962CONFIG_DEBUG_BUGVERBOSE=y
910# CONFIG_DEBUG_INFO is not set 963# CONFIG_DEBUG_INFO is not set
911# CONFIG_DEBUG_VM is not set 964# CONFIG_DEBUG_VM is not set
965# CONFIG_DEBUG_WRITECOUNT is not set
966CONFIG_DEBUG_MEMORY_INIT=y
912# CONFIG_DEBUG_LIST is not set 967# CONFIG_DEBUG_LIST is not set
913CONFIG_FORCED_INLINING=y 968# CONFIG_DEBUG_SG is not set
969# CONFIG_DEBUG_NOTIFIERS is not set
970# CONFIG_BOOT_PRINTK_DELAY is not set
914# CONFIG_RCU_TORTURE_TEST is not set 971# CONFIG_RCU_TORTURE_TEST is not set
972# CONFIG_RCU_CPU_STALL_DETECTOR is not set
973# CONFIG_BACKTRACE_SELF_TEST is not set
974# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
915# CONFIG_FAULT_INJECTION is not set 975# CONFIG_FAULT_INJECTION is not set
976# CONFIG_SYSCTL_SYSCALL_CHECK is not set
977CONFIG_NOP_TRACER=y
978CONFIG_RING_BUFFER=y
979CONFIG_TRACING=y
980
981#
982# Tracers
983#
984# CONFIG_SCHED_TRACER is not set
985# CONFIG_CONTEXT_SWITCH_TRACER is not set
986# CONFIG_BOOT_TRACER is not set
987# CONFIG_TRACE_BRANCH_PROFILING is not set
988# CONFIG_FTRACE_STARTUP_TEST is not set
989# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
990# CONFIG_SAMPLES is not set
916CONFIG_DEBUG_RODATA=y 991CONFIG_DEBUG_RODATA=y
917 992
918# 993#
@@ -921,57 +996,113 @@ CONFIG_DEBUG_RODATA=y
921CONFIG_KEYS=y 996CONFIG_KEYS=y
922CONFIG_KEYS_DEBUG_PROC_KEYS=y 997CONFIG_KEYS_DEBUG_PROC_KEYS=y
923# CONFIG_SECURITY is not set 998# CONFIG_SECURITY is not set
999# CONFIG_SECURITYFS is not set
1000# CONFIG_SECURITY_FILE_CAPABILITIES is not set
924CONFIG_CRYPTO=y 1001CONFIG_CRYPTO=y
1002
1003#
1004# Crypto core or helper
1005#
1006# CONFIG_CRYPTO_FIPS is not set
925CONFIG_CRYPTO_ALGAPI=y 1007CONFIG_CRYPTO_ALGAPI=y
1008CONFIG_CRYPTO_ALGAPI2=y
1009CONFIG_CRYPTO_AEAD=m
1010CONFIG_CRYPTO_AEAD2=y
926CONFIG_CRYPTO_BLKCIPHER=y 1011CONFIG_CRYPTO_BLKCIPHER=y
1012CONFIG_CRYPTO_BLKCIPHER2=y
927CONFIG_CRYPTO_HASH=y 1013CONFIG_CRYPTO_HASH=y
1014CONFIG_CRYPTO_HASH2=y
1015CONFIG_CRYPTO_RNG2=y
928CONFIG_CRYPTO_MANAGER=y 1016CONFIG_CRYPTO_MANAGER=y
1017CONFIG_CRYPTO_MANAGER2=y
1018# CONFIG_CRYPTO_GF128MUL is not set
1019CONFIG_CRYPTO_NULL=m
1020# CONFIG_CRYPTO_CRYPTD is not set
1021CONFIG_CRYPTO_AUTHENC=m
1022CONFIG_CRYPTO_TEST=m
1023
1024#
1025# Authenticated Encryption with Associated Data
1026#
1027# CONFIG_CRYPTO_CCM is not set
1028# CONFIG_CRYPTO_GCM is not set
1029# CONFIG_CRYPTO_SEQIV is not set
1030
1031#
1032# Block modes
1033#
1034CONFIG_CRYPTO_CBC=y
1035# CONFIG_CRYPTO_CTR is not set
1036# CONFIG_CRYPTO_CTS is not set
1037CONFIG_CRYPTO_ECB=m
1038# CONFIG_CRYPTO_LRW is not set
1039# CONFIG_CRYPTO_PCBC is not set
1040# CONFIG_CRYPTO_XTS is not set
1041
1042#
1043# Hash modes
1044#
929CONFIG_CRYPTO_HMAC=y 1045CONFIG_CRYPTO_HMAC=y
930# CONFIG_CRYPTO_XCBC is not set 1046# CONFIG_CRYPTO_XCBC is not set
931CONFIG_CRYPTO_NULL=m 1047
1048#
1049# Digest
1050#
1051CONFIG_CRYPTO_CRC32C=m
932CONFIG_CRYPTO_MD4=m 1052CONFIG_CRYPTO_MD4=m
933CONFIG_CRYPTO_MD5=y 1053CONFIG_CRYPTO_MD5=y
1054CONFIG_CRYPTO_MICHAEL_MIC=m
1055# CONFIG_CRYPTO_RMD128 is not set
1056# CONFIG_CRYPTO_RMD160 is not set
1057# CONFIG_CRYPTO_RMD256 is not set
1058# CONFIG_CRYPTO_RMD320 is not set
934CONFIG_CRYPTO_SHA1=m 1059CONFIG_CRYPTO_SHA1=m
935CONFIG_CRYPTO_SHA256=m 1060CONFIG_CRYPTO_SHA256=m
936CONFIG_CRYPTO_SHA512=m 1061CONFIG_CRYPTO_SHA512=m
937CONFIG_CRYPTO_WP512=m
938CONFIG_CRYPTO_TGR192=m 1062CONFIG_CRYPTO_TGR192=m
939# CONFIG_CRYPTO_GF128MUL is not set 1063CONFIG_CRYPTO_WP512=m
940CONFIG_CRYPTO_ECB=m 1064
941CONFIG_CRYPTO_CBC=y 1065#
942# CONFIG_CRYPTO_PCBC is not set 1066# Ciphers
943# CONFIG_CRYPTO_LRW is not set 1067#
944# CONFIG_CRYPTO_XTS is not set
945# CONFIG_CRYPTO_CRYPTD is not set
946CONFIG_CRYPTO_DES=y
947# CONFIG_CRYPTO_FCRYPT is not set
948CONFIG_CRYPTO_BLOWFISH=m
949CONFIG_CRYPTO_TWOFISH=m
950CONFIG_CRYPTO_TWOFISH_COMMON=m
951CONFIG_CRYPTO_SERPENT=m
952CONFIG_CRYPTO_AES=m 1068CONFIG_CRYPTO_AES=m
1069CONFIG_CRYPTO_ANUBIS=m
1070CONFIG_CRYPTO_ARC4=m
1071CONFIG_CRYPTO_BLOWFISH=m
1072# CONFIG_CRYPTO_CAMELLIA is not set
953CONFIG_CRYPTO_CAST5=m 1073CONFIG_CRYPTO_CAST5=m
954CONFIG_CRYPTO_CAST6=m 1074CONFIG_CRYPTO_CAST6=m
955CONFIG_CRYPTO_TEA=m 1075CONFIG_CRYPTO_DES=y
956CONFIG_CRYPTO_ARC4=m 1076# CONFIG_CRYPTO_FCRYPT is not set
957CONFIG_CRYPTO_KHAZAD=m 1077CONFIG_CRYPTO_KHAZAD=m
958CONFIG_CRYPTO_ANUBIS=m 1078# CONFIG_CRYPTO_SALSA20 is not set
959# CONFIG_CRYPTO_SEED is not set 1079# CONFIG_CRYPTO_SEED is not set
1080CONFIG_CRYPTO_SERPENT=m
1081CONFIG_CRYPTO_TEA=m
1082CONFIG_CRYPTO_TWOFISH=m
1083CONFIG_CRYPTO_TWOFISH_COMMON=m
1084
1085#
1086# Compression
1087#
960CONFIG_CRYPTO_DEFLATE=m 1088CONFIG_CRYPTO_DEFLATE=m
961CONFIG_CRYPTO_MICHAEL_MIC=m 1089# CONFIG_CRYPTO_LZO is not set
962CONFIG_CRYPTO_CRC32C=m 1090
963# CONFIG_CRYPTO_CAMELLIA is not set 1091#
964CONFIG_CRYPTO_TEST=m 1092# Random Number Generation
965# CONFIG_CRYPTO_AUTHENC is not set 1093#
1094# CONFIG_CRYPTO_ANSI_CPRNG is not set
966# CONFIG_CRYPTO_HW is not set 1095# CONFIG_CRYPTO_HW is not set
967 1096
968# 1097#
969# Library routines 1098# Library routines
970# 1099#
971CONFIG_BITREVERSE=y 1100CONFIG_BITREVERSE=y
1101CONFIG_GENERIC_FIND_LAST_BIT=y
972CONFIG_CRC_CCITT=m 1102CONFIG_CRC_CCITT=m
973# CONFIG_CRC16 is not set 1103# CONFIG_CRC16 is not set
974# CONFIG_CRC_ITU_T is not set 1104# CONFIG_CRC_T10DIF is not set
1105CONFIG_CRC_ITU_T=m
975CONFIG_CRC32=y 1106CONFIG_CRC32=y
976# CONFIG_CRC7 is not set 1107# CONFIG_CRC7 is not set
977CONFIG_LIBCRC32C=m 1108CONFIG_LIBCRC32C=m
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index ddacc72e38fb..f12e4b8349d9 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23 3# Linux kernel version: 2.6.29-rc8
4# Fri Oct 12 21:12:44 2007 4# Fri Mar 13 01:32:56 2009
5# 5#
6CONFIG_PARISC=y 6CONFIG_PARISC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -34,18 +34,30 @@ CONFIG_SYSVIPC_SYSCTL=y
34CONFIG_POSIX_MQUEUE=y 34CONFIG_POSIX_MQUEUE=y
35# CONFIG_BSD_PROCESS_ACCT is not set 35# CONFIG_BSD_PROCESS_ACCT is not set
36# CONFIG_TASKSTATS is not set 36# CONFIG_TASKSTATS is not set
37# CONFIG_USER_NS is not set
38# CONFIG_AUDIT is not set 37# CONFIG_AUDIT is not set
38
39#
40# RCU Subsystem
41#
42CONFIG_CLASSIC_RCU=y
43# CONFIG_TREE_RCU is not set
44# CONFIG_PREEMPT_RCU is not set
45# CONFIG_TREE_RCU_TRACE is not set
46# CONFIG_PREEMPT_RCU_TRACE is not set
39CONFIG_IKCONFIG=y 47CONFIG_IKCONFIG=y
40CONFIG_IKCONFIG_PROC=y 48CONFIG_IKCONFIG_PROC=y
41CONFIG_LOG_BUF_SHIFT=16 49CONFIG_LOG_BUF_SHIFT=16
42# CONFIG_CPUSETS is not set 50# CONFIG_GROUP_SCHED is not set
51# CONFIG_CGROUPS is not set
43CONFIG_SYSFS_DEPRECATED=y 52CONFIG_SYSFS_DEPRECATED=y
53CONFIG_SYSFS_DEPRECATED_V2=y
44# CONFIG_RELAY is not set 54# CONFIG_RELAY is not set
55# CONFIG_NAMESPACES is not set
45CONFIG_BLK_DEV_INITRD=y 56CONFIG_BLK_DEV_INITRD=y
46CONFIG_INITRAMFS_SOURCE="" 57CONFIG_INITRAMFS_SOURCE=""
47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 58# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
48CONFIG_SYSCTL=y 59CONFIG_SYSCTL=y
60CONFIG_ANON_INODES=y
49CONFIG_EMBEDDED=y 61CONFIG_EMBEDDED=y
50CONFIG_SYSCTL_SYSCALL=y 62CONFIG_SYSCTL_SYSCALL=y
51CONFIG_KALLSYMS=y 63CONFIG_KALLSYMS=y
@@ -57,28 +69,40 @@ CONFIG_BUG=y
57CONFIG_ELF_CORE=y 69CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y 70CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 71CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y 72CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y 73CONFIG_SIGNALFD=y
74CONFIG_TIMERFD=y
63CONFIG_EVENTFD=y 75CONFIG_EVENTFD=y
64CONFIG_SHMEM=y 76CONFIG_SHMEM=y
77CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 78CONFIG_VM_EVENT_COUNTERS=y
79CONFIG_PCI_QUIRKS=y
80CONFIG_COMPAT_BRK=y
66CONFIG_SLAB=y 81CONFIG_SLAB=y
67# CONFIG_SLUB is not set 82# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 83# CONFIG_SLOB is not set
84CONFIG_PROFILING=y
85CONFIG_TRACEPOINTS=y
86# CONFIG_MARKERS is not set
87CONFIG_OPROFILE=m
88CONFIG_HAVE_OPROFILE=y
89CONFIG_USE_GENERIC_SMP_HELPERS=y
90# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
91CONFIG_SLABINFO=y
69CONFIG_RT_MUTEXES=y 92CONFIG_RT_MUTEXES=y
70# CONFIG_TINY_SHMEM is not set
71CONFIG_BASE_SMALL=0 93CONFIG_BASE_SMALL=0
72CONFIG_MODULES=y 94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
73CONFIG_MODULE_UNLOAD=y 96CONFIG_MODULE_UNLOAD=y
74CONFIG_MODULE_FORCE_UNLOAD=y 97CONFIG_MODULE_FORCE_UNLOAD=y
75# CONFIG_MODVERSIONS is not set 98# CONFIG_MODVERSIONS is not set
76# CONFIG_MODULE_SRCVERSION_ALL is not set 99# CONFIG_MODULE_SRCVERSION_ALL is not set
77CONFIG_KMOD=y 100CONFIG_INIT_ALL_POSSIBLE=y
78CONFIG_STOP_MACHINE=y 101CONFIG_STOP_MACHINE=y
79CONFIG_BLOCK=y 102CONFIG_BLOCK=y
80# CONFIG_BLK_DEV_IO_TRACE is not set 103# CONFIG_BLK_DEV_IO_TRACE is not set
81# CONFIG_BLK_DEV_BSG is not set 104# CONFIG_BLK_DEV_BSG is not set
105# CONFIG_BLK_DEV_INTEGRITY is not set
82CONFIG_BLOCK_COMPAT=y 106CONFIG_BLOCK_COMPAT=y
83 107
84# 108#
@@ -93,6 +117,7 @@ CONFIG_IOSCHED_CFQ=y
93CONFIG_DEFAULT_CFQ=y 117CONFIG_DEFAULT_CFQ=y
94# CONFIG_DEFAULT_NOOP is not set 118# CONFIG_DEFAULT_NOOP is not set
95CONFIG_DEFAULT_IOSCHED="cfq" 119CONFIG_DEFAULT_IOSCHED="cfq"
120# CONFIG_FREEZER is not set
96 121
97# 122#
98# Processor type and features 123# Processor type and features
@@ -118,12 +143,12 @@ CONFIG_NODES_SHIFT=3
118CONFIG_PREEMPT_NONE=y 143CONFIG_PREEMPT_NONE=y
119# CONFIG_PREEMPT_VOLUNTARY is not set 144# CONFIG_PREEMPT_VOLUNTARY is not set
120# CONFIG_PREEMPT is not set 145# CONFIG_PREEMPT is not set
121CONFIG_PREEMPT_BKL=y
122# CONFIG_HZ_100 is not set 146# CONFIG_HZ_100 is not set
123CONFIG_HZ_250=y 147CONFIG_HZ_250=y
124# CONFIG_HZ_300 is not set 148# CONFIG_HZ_300 is not set
125# CONFIG_HZ_1000 is not set 149# CONFIG_HZ_1000 is not set
126CONFIG_HZ=250 150CONFIG_HZ=250
151# CONFIG_SCHED_HRTICK is not set
127CONFIG_SELECT_MEMORY_MODEL=y 152CONFIG_SELECT_MEMORY_MODEL=y
128# CONFIG_FLATMEM_MANUAL is not set 153# CONFIG_FLATMEM_MANUAL is not set
129CONFIG_DISCONTIGMEM_MANUAL=y 154CONFIG_DISCONTIGMEM_MANUAL=y
@@ -131,11 +156,12 @@ CONFIG_DISCONTIGMEM_MANUAL=y
131CONFIG_DISCONTIGMEM=y 156CONFIG_DISCONTIGMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 157CONFIG_FLAT_NODE_MEM_MAP=y
133CONFIG_NEED_MULTIPLE_NODES=y 158CONFIG_NEED_MULTIPLE_NODES=y
134# CONFIG_SPARSEMEM_STATIC is not set 159CONFIG_PAGEFLAGS_EXTENDED=y
135CONFIG_SPLIT_PTLOCK_CPUS=4 160CONFIG_SPLIT_PTLOCK_CPUS=4
136CONFIG_RESOURCES_64BIT=y 161CONFIG_PHYS_ADDR_T_64BIT=y
137CONFIG_ZONE_DMA_FLAG=0 162CONFIG_ZONE_DMA_FLAG=0
138CONFIG_VIRT_TO_BUS=y 163CONFIG_VIRT_TO_BUS=y
164CONFIG_UNEVICTABLE_LRU=y
139CONFIG_COMPAT=y 165CONFIG_COMPAT=y
140CONFIG_NR_CPUS=8 166CONFIG_NR_CPUS=8
141 167
@@ -145,14 +171,13 @@ CONFIG_NR_CPUS=8
145# CONFIG_GSC is not set 171# CONFIG_GSC is not set
146CONFIG_PCI=y 172CONFIG_PCI=y
147# CONFIG_ARCH_SUPPORTS_MSI is not set 173# CONFIG_ARCH_SUPPORTS_MSI is not set
174CONFIG_PCI_LEGACY=y
148# CONFIG_PCI_DEBUG is not set 175# CONFIG_PCI_DEBUG is not set
176# CONFIG_PCI_STUB is not set
149CONFIG_PCI_LBA=y 177CONFIG_PCI_LBA=y
150CONFIG_IOSAPIC=y 178CONFIG_IOSAPIC=y
151CONFIG_IOMMU_SBA=y 179CONFIG_IOMMU_SBA=y
152 180CONFIG_IOMMU_HELPER=y
153#
154# PCCARD (PCMCIA/CardBus) support
155#
156CONFIG_PCCARD=m 181CONFIG_PCCARD=m
157# CONFIG_PCMCIA_DEBUG is not set 182# CONFIG_PCMCIA_DEBUG is not set
158CONFIG_PCMCIA=m 183CONFIG_PCMCIA=m
@@ -187,16 +212,15 @@ CONFIG_PDC_STABLE=y
187# Executable file formats 212# Executable file formats
188# 213#
189CONFIG_BINFMT_ELF=y 214CONFIG_BINFMT_ELF=y
215# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
216# CONFIG_HAVE_AOUT is not set
190# CONFIG_BINFMT_MISC is not set 217# CONFIG_BINFMT_MISC is not set
191
192#
193# Networking
194#
195CONFIG_NET=y 218CONFIG_NET=y
196 219
197# 220#
198# Networking options 221# Networking options
199# 222#
223CONFIG_COMPAT_NET_DEV_OPS=y
200CONFIG_PACKET=y 224CONFIG_PACKET=y
201CONFIG_PACKET_MMAP=y 225CONFIG_PACKET_MMAP=y
202CONFIG_UNIX=y 226CONFIG_UNIX=y
@@ -204,6 +228,8 @@ CONFIG_XFRM=y
204CONFIG_XFRM_USER=m 228CONFIG_XFRM_USER=m
205# CONFIG_XFRM_SUB_POLICY is not set 229# CONFIG_XFRM_SUB_POLICY is not set
206# CONFIG_XFRM_MIGRATE is not set 230# CONFIG_XFRM_MIGRATE is not set
231# CONFIG_XFRM_STATISTICS is not set
232CONFIG_XFRM_IPCOMP=m
207CONFIG_NET_KEY=m 233CONFIG_NET_KEY=m
208# CONFIG_NET_KEY_MIGRATE is not set 234# CONFIG_NET_KEY_MIGRATE is not set
209CONFIG_INET=y 235CONFIG_INET=y
@@ -234,7 +260,6 @@ CONFIG_INET_TCP_DIAG=y
234CONFIG_TCP_CONG_CUBIC=y 260CONFIG_TCP_CONG_CUBIC=y
235CONFIG_DEFAULT_TCP_CONG="cubic" 261CONFIG_DEFAULT_TCP_CONG="cubic"
236# CONFIG_TCP_MD5SIG is not set 262# CONFIG_TCP_MD5SIG is not set
237# CONFIG_IP_VS is not set
238CONFIG_IPV6=m 263CONFIG_IPV6=m
239# CONFIG_IPV6_PRIVACY is not set 264# CONFIG_IPV6_PRIVACY is not set
240# CONFIG_IPV6_ROUTER_PREF is not set 265# CONFIG_IPV6_ROUTER_PREF is not set
@@ -250,66 +275,72 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
250CONFIG_INET6_XFRM_MODE_BEET=m 275CONFIG_INET6_XFRM_MODE_BEET=m
251# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 276# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
252CONFIG_IPV6_SIT=m 277CONFIG_IPV6_SIT=m
278CONFIG_IPV6_NDISC_NODETYPE=y
253CONFIG_IPV6_TUNNEL=m 279CONFIG_IPV6_TUNNEL=m
254# CONFIG_IPV6_MULTIPLE_TABLES is not set 280# CONFIG_IPV6_MULTIPLE_TABLES is not set
281# CONFIG_IPV6_MROUTE is not set
255# CONFIG_NETWORK_SECMARK is not set 282# CONFIG_NETWORK_SECMARK is not set
256CONFIG_NETFILTER=y 283CONFIG_NETFILTER=y
257# CONFIG_NETFILTER_DEBUG is not set 284# CONFIG_NETFILTER_DEBUG is not set
285CONFIG_NETFILTER_ADVANCED=y
258 286
259# 287#
260# Core Netfilter Configuration 288# Core Netfilter Configuration
261# 289#
262# CONFIG_NETFILTER_NETLINK is not set 290# CONFIG_NETFILTER_NETLINK_QUEUE is not set
263# CONFIG_NF_CONNTRACK_ENABLED is not set 291# CONFIG_NETFILTER_NETLINK_LOG is not set
264# CONFIG_NF_CONNTRACK is not set 292# CONFIG_NF_CONNTRACK is not set
265CONFIG_NETFILTER_XTABLES=m 293CONFIG_NETFILTER_XTABLES=m
266# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set 294# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
267# CONFIG_NETFILTER_XT_TARGET_DSCP is not set 295# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
268# CONFIG_NETFILTER_XT_TARGET_MARK is not set 296# CONFIG_NETFILTER_XT_TARGET_MARK is not set
269# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
270# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set 297# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
298# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
299# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
271# CONFIG_NETFILTER_XT_TARGET_TRACE is not set 300# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
272# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set 301# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
302# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
273# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set 303# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
274# CONFIG_NETFILTER_XT_MATCH_DCCP is not set 304# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
275# CONFIG_NETFILTER_XT_MATCH_DSCP is not set 305# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
276# CONFIG_NETFILTER_XT_MATCH_ESP is not set 306# CONFIG_NETFILTER_XT_MATCH_ESP is not set
307# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
308# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
277# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set 309# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
278# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set 310# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
279# CONFIG_NETFILTER_XT_MATCH_MAC is not set 311# CONFIG_NETFILTER_XT_MATCH_MAC is not set
280# CONFIG_NETFILTER_XT_MATCH_MARK is not set 312# CONFIG_NETFILTER_XT_MATCH_MARK is not set
281# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
282# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set 313# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set
314# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
315# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
283# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set 316# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
284# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set 317# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
318# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
285# CONFIG_NETFILTER_XT_MATCH_REALM is not set 319# CONFIG_NETFILTER_XT_MATCH_REALM is not set
320# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
286# CONFIG_NETFILTER_XT_MATCH_SCTP is not set 321# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
287# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set 322# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
288# CONFIG_NETFILTER_XT_MATCH_STRING is not set 323# CONFIG_NETFILTER_XT_MATCH_STRING is not set
289# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set 324# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
290# CONFIG_NETFILTER_XT_MATCH_TIME is not set 325# CONFIG_NETFILTER_XT_MATCH_TIME is not set
291# CONFIG_NETFILTER_XT_MATCH_U32 is not set 326# CONFIG_NETFILTER_XT_MATCH_U32 is not set
292# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set 327# CONFIG_IP_VS is not set
293 328
294# 329#
295# IP: Netfilter Configuration 330# IP: Netfilter Configuration
296# 331#
332# CONFIG_NF_DEFRAG_IPV4 is not set
297CONFIG_IP_NF_QUEUE=m 333CONFIG_IP_NF_QUEUE=m
298CONFIG_IP_NF_IPTABLES=m 334CONFIG_IP_NF_IPTABLES=m
299CONFIG_IP_NF_MATCH_IPRANGE=m 335# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
300CONFIG_IP_NF_MATCH_TOS=m
301CONFIG_IP_NF_MATCH_RECENT=m
302CONFIG_IP_NF_MATCH_ECN=m
303# CONFIG_IP_NF_MATCH_AH is not set 336# CONFIG_IP_NF_MATCH_AH is not set
337CONFIG_IP_NF_MATCH_ECN=m
304CONFIG_IP_NF_MATCH_TTL=m 338CONFIG_IP_NF_MATCH_TTL=m
305CONFIG_IP_NF_MATCH_OWNER=m
306# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
307CONFIG_IP_NF_FILTER=m 339CONFIG_IP_NF_FILTER=m
308CONFIG_IP_NF_TARGET_REJECT=m 340CONFIG_IP_NF_TARGET_REJECT=m
309CONFIG_IP_NF_TARGET_LOG=m 341CONFIG_IP_NF_TARGET_LOG=m
310CONFIG_IP_NF_TARGET_ULOG=m 342CONFIG_IP_NF_TARGET_ULOG=m
311CONFIG_IP_NF_MANGLE=m 343CONFIG_IP_NF_MANGLE=m
312CONFIG_IP_NF_TARGET_TOS=m
313CONFIG_IP_NF_TARGET_ECN=m 344CONFIG_IP_NF_TARGET_ECN=m
314# CONFIG_IP_NF_TARGET_TTL is not set 345# CONFIG_IP_NF_TARGET_TTL is not set
315CONFIG_IP_NF_RAW=m 346CONFIG_IP_NF_RAW=m
@@ -318,33 +349,30 @@ CONFIG_IP_NF_ARPFILTER=m
318CONFIG_IP_NF_ARP_MANGLE=m 349CONFIG_IP_NF_ARP_MANGLE=m
319 350
320# 351#
321# IPv6: Netfilter Configuration (EXPERIMENTAL) 352# IPv6: Netfilter Configuration
322# 353#
323# CONFIG_IP6_NF_QUEUE is not set 354# CONFIG_IP6_NF_QUEUE is not set
324CONFIG_IP6_NF_IPTABLES=m 355CONFIG_IP6_NF_IPTABLES=m
325CONFIG_IP6_NF_MATCH_RT=m 356# CONFIG_IP6_NF_MATCH_AH is not set
326CONFIG_IP6_NF_MATCH_OPTS=m 357# CONFIG_IP6_NF_MATCH_EUI64 is not set
327CONFIG_IP6_NF_MATCH_FRAG=m 358CONFIG_IP6_NF_MATCH_FRAG=m
359CONFIG_IP6_NF_MATCH_OPTS=m
328CONFIG_IP6_NF_MATCH_HL=m 360CONFIG_IP6_NF_MATCH_HL=m
329# CONFIG_IP6_NF_MATCH_OWNER is not set
330CONFIG_IP6_NF_MATCH_IPV6HEADER=m 361CONFIG_IP6_NF_MATCH_IPV6HEADER=m
331# CONFIG_IP6_NF_MATCH_AH is not set
332# CONFIG_IP6_NF_MATCH_MH is not set 362# CONFIG_IP6_NF_MATCH_MH is not set
333# CONFIG_IP6_NF_MATCH_EUI64 is not set 363CONFIG_IP6_NF_MATCH_RT=m
334CONFIG_IP6_NF_FILTER=m
335CONFIG_IP6_NF_TARGET_LOG=m 364CONFIG_IP6_NF_TARGET_LOG=m
365CONFIG_IP6_NF_FILTER=m
336CONFIG_IP6_NF_TARGET_REJECT=m 366CONFIG_IP6_NF_TARGET_REJECT=m
337CONFIG_IP6_NF_MANGLE=m 367CONFIG_IP6_NF_MANGLE=m
338# CONFIG_IP6_NF_TARGET_HL is not set 368# CONFIG_IP6_NF_TARGET_HL is not set
339CONFIG_IP6_NF_RAW=m 369CONFIG_IP6_NF_RAW=m
340CONFIG_IP_DCCP=m 370CONFIG_IP_DCCP=m
341CONFIG_INET_DCCP_DIAG=m 371CONFIG_INET_DCCP_DIAG=m
342CONFIG_IP_DCCP_ACKVEC=y
343 372
344# 373#
345# DCCP CCIDs Configuration (EXPERIMENTAL) 374# DCCP CCIDs Configuration (EXPERIMENTAL)
346# 375#
347CONFIG_IP_DCCP_CCID2=m
348# CONFIG_IP_DCCP_CCID2_DEBUG is not set 376# CONFIG_IP_DCCP_CCID2_DEBUG is not set
349# CONFIG_IP_DCCP_CCID3 is not set 377# CONFIG_IP_DCCP_CCID3 is not set
350 378
@@ -356,6 +384,7 @@ CONFIG_IP_DCCP_CCID2=m
356# CONFIG_TIPC is not set 384# CONFIG_TIPC is not set
357# CONFIG_ATM is not set 385# CONFIG_ATM is not set
358# CONFIG_BRIDGE is not set 386# CONFIG_BRIDGE is not set
387# CONFIG_NET_DSA is not set
359# CONFIG_VLAN_8021Q is not set 388# CONFIG_VLAN_8021Q is not set
360# CONFIG_DECNET is not set 389# CONFIG_DECNET is not set
361CONFIG_LLC=m 390CONFIG_LLC=m
@@ -366,28 +395,26 @@ CONFIG_LLC2=m
366# CONFIG_LAPB is not set 395# CONFIG_LAPB is not set
367# CONFIG_ECONET is not set 396# CONFIG_ECONET is not set
368# CONFIG_WAN_ROUTER is not set 397# CONFIG_WAN_ROUTER is not set
369
370#
371# QoS and/or fair queueing
372#
373# CONFIG_NET_SCHED is not set 398# CONFIG_NET_SCHED is not set
399# CONFIG_DCB is not set
374 400
375# 401#
376# Network testing 402# Network testing
377# 403#
378CONFIG_NET_PKTGEN=m 404CONFIG_NET_PKTGEN=m
379# CONFIG_HAMRADIO is not set 405# CONFIG_HAMRADIO is not set
406# CONFIG_CAN is not set
380# CONFIG_IRDA is not set 407# CONFIG_IRDA is not set
381# CONFIG_BT is not set 408# CONFIG_BT is not set
382# CONFIG_AF_RXRPC is not set 409# CONFIG_AF_RXRPC is not set
383 410# CONFIG_PHONET is not set
384# 411CONFIG_WIRELESS=y
385# Wireless
386#
387# CONFIG_CFG80211 is not set 412# CONFIG_CFG80211 is not set
413CONFIG_WIRELESS_OLD_REGULATORY=y
388# CONFIG_WIRELESS_EXT is not set 414# CONFIG_WIRELESS_EXT is not set
415# CONFIG_LIB80211 is not set
389# CONFIG_MAC80211 is not set 416# CONFIG_MAC80211 is not set
390# CONFIG_IEEE80211 is not set 417# CONFIG_WIMAX is not set
391# CONFIG_RFKILL is not set 418# CONFIG_RFKILL is not set
392# CONFIG_NET_9P is not set 419# CONFIG_NET_9P is not set
393 420
@@ -402,6 +429,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
402# CONFIG_STANDALONE is not set 429# CONFIG_STANDALONE is not set
403# CONFIG_PREVENT_FIRMWARE_BUILD is not set 430# CONFIG_PREVENT_FIRMWARE_BUILD is not set
404CONFIG_FW_LOADER=y 431CONFIG_FW_LOADER=y
432CONFIG_FIRMWARE_IN_KERNEL=y
433CONFIG_EXTRA_FIRMWARE=""
405# CONFIG_DEBUG_DRIVER is not set 434# CONFIG_DEBUG_DRIVER is not set
406# CONFIG_DEBUG_DEVRES is not set 435# CONFIG_DEBUG_DEVRES is not set
407# CONFIG_SYS_HYPERVISOR is not set 436# CONFIG_SYS_HYPERVISOR is not set
@@ -421,14 +450,23 @@ CONFIG_BLK_DEV_LOOP=y
421CONFIG_BLK_DEV_RAM=y 450CONFIG_BLK_DEV_RAM=y
422CONFIG_BLK_DEV_RAM_COUNT=16 451CONFIG_BLK_DEV_RAM_COUNT=16
423CONFIG_BLK_DEV_RAM_SIZE=6144 452CONFIG_BLK_DEV_RAM_SIZE=6144
424CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 453# CONFIG_BLK_DEV_XIP is not set
425# CONFIG_CDROM_PKTCDVD is not set 454# CONFIG_CDROM_PKTCDVD is not set
426# CONFIG_ATA_OVER_ETH is not set 455# CONFIG_ATA_OVER_ETH is not set
456# CONFIG_BLK_DEV_HD is not set
427CONFIG_MISC_DEVICES=y 457CONFIG_MISC_DEVICES=y
428# CONFIG_PHANTOM is not set 458# CONFIG_PHANTOM is not set
429# CONFIG_EEPROM_93CX6 is not set
430# CONFIG_SGI_IOC4 is not set 459# CONFIG_SGI_IOC4 is not set
431# CONFIG_TIFM_CORE is not set 460# CONFIG_TIFM_CORE is not set
461# CONFIG_ENCLOSURE_SERVICES is not set
462# CONFIG_HP_ILO is not set
463# CONFIG_C2PORT is not set
464
465#
466# EEPROM support
467#
468# CONFIG_EEPROM_93CX6 is not set
469CONFIG_HAVE_IDE=y
432# CONFIG_IDE is not set 470# CONFIG_IDE is not set
433 471
434# 472#
@@ -468,8 +506,10 @@ CONFIG_SCSI_SPI_ATTRS=y
468CONFIG_SCSI_FC_ATTRS=m 506CONFIG_SCSI_FC_ATTRS=m
469CONFIG_SCSI_ISCSI_ATTRS=m 507CONFIG_SCSI_ISCSI_ATTRS=m
470# CONFIG_SCSI_SAS_LIBSAS is not set 508# CONFIG_SCSI_SAS_LIBSAS is not set
509# CONFIG_SCSI_SRP_ATTRS is not set
471CONFIG_SCSI_LOWLEVEL=y 510CONFIG_SCSI_LOWLEVEL=y
472# CONFIG_ISCSI_TCP is not set 511# CONFIG_ISCSI_TCP is not set
512# CONFIG_SCSI_CXGB3_ISCSI is not set
473# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 513# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
474# CONFIG_SCSI_3W_9XXX is not set 514# CONFIG_SCSI_3W_9XXX is not set
475# CONFIG_SCSI_ACARD is not set 515# CONFIG_SCSI_ACARD is not set
@@ -478,16 +518,21 @@ CONFIG_SCSI_LOWLEVEL=y
478# CONFIG_SCSI_AIC7XXX_OLD is not set 518# CONFIG_SCSI_AIC7XXX_OLD is not set
479# CONFIG_SCSI_AIC79XX is not set 519# CONFIG_SCSI_AIC79XX is not set
480# CONFIG_SCSI_AIC94XX is not set 520# CONFIG_SCSI_AIC94XX is not set
521# CONFIG_SCSI_DPT_I2O is not set
522# CONFIG_SCSI_ADVANSYS is not set
481# CONFIG_SCSI_ARCMSR is not set 523# CONFIG_SCSI_ARCMSR is not set
482# CONFIG_MEGARAID_NEWGEN is not set 524# CONFIG_MEGARAID_NEWGEN is not set
483# CONFIG_MEGARAID_LEGACY is not set 525# CONFIG_MEGARAID_LEGACY is not set
484# CONFIG_MEGARAID_SAS is not set 526# CONFIG_MEGARAID_SAS is not set
485# CONFIG_SCSI_HPTIOP is not set 527# CONFIG_SCSI_HPTIOP is not set
528# CONFIG_LIBFC is not set
529# CONFIG_FCOE is not set
486# CONFIG_SCSI_DMX3191D is not set 530# CONFIG_SCSI_DMX3191D is not set
487# CONFIG_SCSI_FUTURE_DOMAIN is not set 531# CONFIG_SCSI_FUTURE_DOMAIN is not set
488# CONFIG_SCSI_IPS is not set 532# CONFIG_SCSI_IPS is not set
489# CONFIG_SCSI_INITIO is not set 533# CONFIG_SCSI_INITIO is not set
490# CONFIG_SCSI_INIA100 is not set 534# CONFIG_SCSI_INIA100 is not set
535# CONFIG_SCSI_MVSAS is not set
491# CONFIG_SCSI_STEX is not set 536# CONFIG_SCSI_STEX is not set
492CONFIG_SCSI_SYM53C8XX_2=y 537CONFIG_SCSI_SYM53C8XX_2=y
493CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 538CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
@@ -503,9 +548,11 @@ CONFIG_SCSI_QLOGIC_1280=m
503CONFIG_SCSI_DEBUG=m 548CONFIG_SCSI_DEBUG=m
504# CONFIG_SCSI_SRP is not set 549# CONFIG_SCSI_SRP is not set
505# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 550# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
551# CONFIG_SCSI_DH is not set
506# CONFIG_ATA is not set 552# CONFIG_ATA is not set
507CONFIG_MD=y 553CONFIG_MD=y
508CONFIG_BLK_DEV_MD=y 554CONFIG_BLK_DEV_MD=y
555CONFIG_MD_AUTODETECT=y
509CONFIG_MD_LINEAR=y 556CONFIG_MD_LINEAR=y
510CONFIG_MD_RAID0=y 557CONFIG_MD_RAID0=y
511CONFIG_MD_RAID1=y 558CONFIG_MD_RAID1=y
@@ -514,10 +561,6 @@ CONFIG_MD_RAID1=y
514# CONFIG_MD_MULTIPATH is not set 561# CONFIG_MD_MULTIPATH is not set
515# CONFIG_MD_FAULTY is not set 562# CONFIG_MD_FAULTY is not set
516# CONFIG_BLK_DEV_DM is not set 563# CONFIG_BLK_DEV_DM is not set
517
518#
519# Fusion MPT device support
520#
521CONFIG_FUSION=y 564CONFIG_FUSION=y
522CONFIG_FUSION_SPI=m 565CONFIG_FUSION_SPI=m
523CONFIG_FUSION_FC=m 566CONFIG_FUSION_FC=m
@@ -529,20 +572,40 @@ CONFIG_FUSION_CTL=m
529# 572#
530# IEEE 1394 (FireWire) support 573# IEEE 1394 (FireWire) support
531# 574#
575
576#
577# Enable only one of the two stacks, unless you know what you are doing
578#
532# CONFIG_FIREWIRE is not set 579# CONFIG_FIREWIRE is not set
533# CONFIG_IEEE1394 is not set 580# CONFIG_IEEE1394 is not set
534# CONFIG_I2O is not set 581# CONFIG_I2O is not set
535CONFIG_NETDEVICES=y 582CONFIG_NETDEVICES=y
536# CONFIG_NETDEVICES_MULTIQUEUE is not set
537CONFIG_DUMMY=m 583CONFIG_DUMMY=m
538CONFIG_BONDING=m 584CONFIG_BONDING=m
539# CONFIG_MACVLAN is not set 585# CONFIG_MACVLAN is not set
540# CONFIG_EQUALIZER is not set 586# CONFIG_EQUALIZER is not set
541CONFIG_TUN=m 587CONFIG_TUN=m
542# CONFIG_VETH is not set 588# CONFIG_VETH is not set
543# CONFIG_IP1000 is not set
544# CONFIG_ARCNET is not set 589# CONFIG_ARCNET is not set
545# CONFIG_PHYLIB is not set 590CONFIG_PHYLIB=m
591
592#
593# MII PHY device drivers
594#
595# CONFIG_MARVELL_PHY is not set
596# CONFIG_DAVICOM_PHY is not set
597# CONFIG_QSEMI_PHY is not set
598# CONFIG_LXT_PHY is not set
599# CONFIG_CICADA_PHY is not set
600# CONFIG_VITESSE_PHY is not set
601# CONFIG_SMSC_PHY is not set
602# CONFIG_BROADCOM_PHY is not set
603# CONFIG_ICPLUS_PHY is not set
604# CONFIG_REALTEK_PHY is not set
605# CONFIG_NATIONAL_PHY is not set
606# CONFIG_STE10XP is not set
607# CONFIG_LSI_ET1011C_PHY is not set
608# CONFIG_MDIO_BITBANG is not set
546CONFIG_NET_ETHERNET=y 609CONFIG_NET_ETHERNET=y
547CONFIG_MII=m 610CONFIG_MII=m
548# CONFIG_HAPPYMEAL is not set 611# CONFIG_HAPPYMEAL is not set
@@ -567,33 +630,38 @@ CONFIG_HP100=m
567# CONFIG_IBM_NEW_EMAC_RGMII is not set 630# CONFIG_IBM_NEW_EMAC_RGMII is not set
568# CONFIG_IBM_NEW_EMAC_TAH is not set 631# CONFIG_IBM_NEW_EMAC_TAH is not set
569# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 632# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
633# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
634# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
635# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
570CONFIG_NET_PCI=y 636CONFIG_NET_PCI=y
571CONFIG_PCNET32=m 637CONFIG_PCNET32=m
572# CONFIG_PCNET32_NAPI is not set
573# CONFIG_AMD8111_ETH is not set 638# CONFIG_AMD8111_ETH is not set
574# CONFIG_ADAPTEC_STARFIRE is not set 639# CONFIG_ADAPTEC_STARFIRE is not set
575# CONFIG_B44 is not set 640# CONFIG_B44 is not set
576# CONFIG_FORCEDETH is not set 641# CONFIG_FORCEDETH is not set
577# CONFIG_EEPRO100 is not set
578CONFIG_E100=m 642CONFIG_E100=m
579# CONFIG_FEALNX is not set 643# CONFIG_FEALNX is not set
580# CONFIG_NATSEMI is not set 644# CONFIG_NATSEMI is not set
581# CONFIG_NE2K_PCI is not set 645# CONFIG_NE2K_PCI is not set
582# CONFIG_8139CP is not set 646# CONFIG_8139CP is not set
583# CONFIG_8139TOO is not set 647# CONFIG_8139TOO is not set
648# CONFIG_R6040 is not set
584# CONFIG_SIS900 is not set 649# CONFIG_SIS900 is not set
585# CONFIG_EPIC100 is not set 650# CONFIG_EPIC100 is not set
651# CONFIG_SMSC9420 is not set
586# CONFIG_SUNDANCE is not set 652# CONFIG_SUNDANCE is not set
653# CONFIG_TLAN is not set
587# CONFIG_VIA_RHINE is not set 654# CONFIG_VIA_RHINE is not set
588# CONFIG_SC92031 is not set 655# CONFIG_SC92031 is not set
656# CONFIG_ATL2 is not set
589CONFIG_NETDEV_1000=y 657CONFIG_NETDEV_1000=y
590CONFIG_ACENIC=m 658CONFIG_ACENIC=m
591CONFIG_ACENIC_OMIT_TIGON_I=y 659CONFIG_ACENIC_OMIT_TIGON_I=y
592# CONFIG_DL2K is not set 660# CONFIG_DL2K is not set
593CONFIG_E1000=m 661CONFIG_E1000=m
594CONFIG_E1000_NAPI=y
595# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
596# CONFIG_E1000E is not set 662# CONFIG_E1000E is not set
663# CONFIG_IP1000 is not set
664# CONFIG_IGB is not set
597# CONFIG_NS83820 is not set 665# CONFIG_NS83820 is not set
598# CONFIG_HAMACHI is not set 666# CONFIG_HAMACHI is not set
599# CONFIG_YELLOWFIN is not set 667# CONFIG_YELLOWFIN is not set
@@ -601,23 +669,31 @@ CONFIG_E1000_NAPI=y
601# CONFIG_SIS190 is not set 669# CONFIG_SIS190 is not set
602# CONFIG_SKGE is not set 670# CONFIG_SKGE is not set
603# CONFIG_SKY2 is not set 671# CONFIG_SKY2 is not set
604# CONFIG_SK98LIN is not set
605# CONFIG_VIA_VELOCITY is not set 672# CONFIG_VIA_VELOCITY is not set
606CONFIG_TIGON3=m 673CONFIG_TIGON3=m
607# CONFIG_BNX2 is not set 674# CONFIG_BNX2 is not set
608# CONFIG_QLA3XXX is not set 675# CONFIG_QLA3XXX is not set
609# CONFIG_ATL1 is not set 676# CONFIG_ATL1 is not set
677# CONFIG_ATL1E is not set
678# CONFIG_ATL1C is not set
679# CONFIG_JME is not set
610CONFIG_NETDEV_10000=y 680CONFIG_NETDEV_10000=y
611# CONFIG_CHELSIO_T1 is not set 681# CONFIG_CHELSIO_T1 is not set
682CONFIG_CHELSIO_T3_DEPENDS=y
612# CONFIG_CHELSIO_T3 is not set 683# CONFIG_CHELSIO_T3 is not set
684# CONFIG_ENIC is not set
613# CONFIG_IXGBE is not set 685# CONFIG_IXGBE is not set
614# CONFIG_IXGB is not set 686# CONFIG_IXGB is not set
615# CONFIG_S2IO is not set 687# CONFIG_S2IO is not set
616# CONFIG_MYRI10GE is not set 688# CONFIG_MYRI10GE is not set
617# CONFIG_NETXEN_NIC is not set 689# CONFIG_NETXEN_NIC is not set
618# CONFIG_NIU is not set 690# CONFIG_NIU is not set
691# CONFIG_MLX4_EN is not set
619# CONFIG_MLX4_CORE is not set 692# CONFIG_MLX4_CORE is not set
620# CONFIG_TEHUTI is not set 693# CONFIG_TEHUTI is not set
694# CONFIG_BNX2X is not set
695# CONFIG_QLGE is not set
696# CONFIG_SFC is not set
621# CONFIG_TR is not set 697# CONFIG_TR is not set
622 698
623# 699#
@@ -625,6 +701,11 @@ CONFIG_NETDEV_10000=y
625# 701#
626# CONFIG_WLAN_PRE80211 is not set 702# CONFIG_WLAN_PRE80211 is not set
627# CONFIG_WLAN_80211 is not set 703# CONFIG_WLAN_80211 is not set
704# CONFIG_IWLWIFI_LEDS is not set
705
706#
707# Enable WiMAX (Networking options) to see the WiMAX drivers
708#
628CONFIG_NET_PCMCIA=y 709CONFIG_NET_PCMCIA=y
629CONFIG_PCMCIA_3C589=m 710CONFIG_PCMCIA_3C589=m
630CONFIG_PCMCIA_3C574=m 711CONFIG_PCMCIA_3C574=m
@@ -650,7 +731,6 @@ CONFIG_PPP_BSDCOMP=m
650# CONFIG_SLIP is not set 731# CONFIG_SLIP is not set
651CONFIG_SLHC=m 732CONFIG_SLHC=m
652# CONFIG_NET_FC is not set 733# CONFIG_NET_FC is not set
653# CONFIG_SHAPER is not set
654# CONFIG_NETCONSOLE is not set 734# CONFIG_NETCONSOLE is not set
655# CONFIG_NETPOLL is not set 735# CONFIG_NETPOLL is not set
656# CONFIG_NET_POLL_CONTROLLER is not set 736# CONFIG_NET_POLL_CONTROLLER is not set
@@ -669,7 +749,6 @@ CONFIG_INPUT=y
669# 749#
670# CONFIG_INPUT_MOUSEDEV is not set 750# CONFIG_INPUT_MOUSEDEV is not set
671# CONFIG_INPUT_JOYDEV is not set 751# CONFIG_INPUT_JOYDEV is not set
672# CONFIG_INPUT_TSDEV is not set
673# CONFIG_INPUT_EVDEV is not set 752# CONFIG_INPUT_EVDEV is not set
674# CONFIG_INPUT_EVBUG is not set 753# CONFIG_INPUT_EVBUG is not set
675 754
@@ -693,10 +772,13 @@ CONFIG_INPUT=y
693# Character devices 772# Character devices
694# 773#
695CONFIG_VT=y 774CONFIG_VT=y
775CONFIG_CONSOLE_TRANSLATIONS=y
696CONFIG_VT_CONSOLE=y 776CONFIG_VT_CONSOLE=y
697CONFIG_HW_CONSOLE=y 777CONFIG_HW_CONSOLE=y
698# CONFIG_VT_HW_CONSOLE_BINDING is not set 778# CONFIG_VT_HW_CONSOLE_BINDING is not set
779CONFIG_DEVKMEM=y
699# CONFIG_SERIAL_NONSTANDARD is not set 780# CONFIG_SERIAL_NONSTANDARD is not set
781# CONFIG_NOZOMI is not set
700 782
701# 783#
702# Serial drivers 784# Serial drivers
@@ -721,17 +803,12 @@ CONFIG_SERIAL_CORE=y
721CONFIG_SERIAL_CORE_CONSOLE=y 803CONFIG_SERIAL_CORE_CONSOLE=y
722# CONFIG_SERIAL_JSM is not set 804# CONFIG_SERIAL_JSM is not set
723CONFIG_UNIX98_PTYS=y 805CONFIG_UNIX98_PTYS=y
806# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
724# CONFIG_LEGACY_PTYS is not set 807# CONFIG_LEGACY_PTYS is not set
725# CONFIG_IPMI_HANDLER is not set 808# CONFIG_IPMI_HANDLER is not set
726# CONFIG_WATCHDOG is not set
727# CONFIG_HW_RANDOM is not set 809# CONFIG_HW_RANDOM is not set
728CONFIG_GEN_RTC=y
729CONFIG_GEN_RTC_X=y
730# CONFIG_R3964 is not set 810# CONFIG_R3964 is not set
731# CONFIG_APPLICOM is not set 811# CONFIG_APPLICOM is not set
732CONFIG_AGP=y
733CONFIG_AGP_PARISC=y
734# CONFIG_DRM is not set
735 812
736# 813#
737# PCMCIA character devices 814# PCMCIA character devices
@@ -739,51 +816,66 @@ CONFIG_AGP_PARISC=y
739# CONFIG_SYNCLINK_CS is not set 816# CONFIG_SYNCLINK_CS is not set
740# CONFIG_CARDMAN_4000 is not set 817# CONFIG_CARDMAN_4000 is not set
741# CONFIG_CARDMAN_4040 is not set 818# CONFIG_CARDMAN_4040 is not set
819# CONFIG_IPWIRELESS is not set
742CONFIG_RAW_DRIVER=y 820CONFIG_RAW_DRIVER=y
743CONFIG_MAX_RAW_DEVS=256 821CONFIG_MAX_RAW_DEVS=256
744# CONFIG_TCG_TPM is not set 822# CONFIG_TCG_TPM is not set
745CONFIG_DEVPORT=y 823CONFIG_DEVPORT=y
746# CONFIG_I2C is not set 824# CONFIG_I2C is not set
747
748#
749# SPI support
750#
751# CONFIG_SPI is not set 825# CONFIG_SPI is not set
752# CONFIG_SPI_MASTER is not set
753# CONFIG_W1 is not set 826# CONFIG_W1 is not set
754# CONFIG_POWER_SUPPLY is not set 827# CONFIG_POWER_SUPPLY is not set
755# CONFIG_HWMON is not set 828# CONFIG_HWMON is not set
829# CONFIG_THERMAL is not set
830# CONFIG_THERMAL_HWMON is not set
831# CONFIG_WATCHDOG is not set
832CONFIG_SSB_POSSIBLE=y
756 833
757# 834#
758# Sonics Silicon Backplane 835# Sonics Silicon Backplane
759# 836#
760CONFIG_SSB_POSSIBLE=y
761# CONFIG_SSB is not set 837# CONFIG_SSB is not set
762 838
763# 839#
764# Multifunction device drivers 840# Multifunction device drivers
765# 841#
842# CONFIG_MFD_CORE is not set
766# CONFIG_MFD_SM501 is not set 843# CONFIG_MFD_SM501 is not set
844# CONFIG_HTC_PASIC3 is not set
845# CONFIG_MFD_TMIO is not set
846# CONFIG_REGULATOR is not set
767 847
768# 848#
769# Multimedia devices 849# Multimedia devices
770# 850#
851
852#
853# Multimedia core support
854#
771# CONFIG_VIDEO_DEV is not set 855# CONFIG_VIDEO_DEV is not set
772# CONFIG_DVB_CORE is not set 856# CONFIG_DVB_CORE is not set
857# CONFIG_VIDEO_MEDIA is not set
858
859#
860# Multimedia drivers
861#
773# CONFIG_DAB is not set 862# CONFIG_DAB is not set
774 863
775# 864#
776# Graphics support 865# Graphics support
777# 866#
867CONFIG_AGP=y
868CONFIG_AGP_PARISC=y
869# CONFIG_DRM is not set
870# CONFIG_VGASTATE is not set
871# CONFIG_VIDEO_OUTPUT_CONTROL is not set
872# CONFIG_FB is not set
778# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 873# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
779 874
780# 875#
781# Display device support 876# Display device support
782# 877#
783# CONFIG_DISPLAY_SUPPORT is not set 878# CONFIG_DISPLAY_SUPPORT is not set
784# CONFIG_VGASTATE is not set
785# CONFIG_VIDEO_OUTPUT_CONTROL is not set
786# CONFIG_FB is not set
787 879
788# 880#
789# Console display driver support 881# Console display driver support
@@ -792,50 +884,83 @@ CONFIG_DUMMY_CONSOLE=y
792CONFIG_DUMMY_CONSOLE_COLUMNS=160 884CONFIG_DUMMY_CONSOLE_COLUMNS=160
793CONFIG_DUMMY_CONSOLE_ROWS=64 885CONFIG_DUMMY_CONSOLE_ROWS=64
794# CONFIG_STI_CONSOLE is not set 886# CONFIG_STI_CONSOLE is not set
795
796#
797# Sound
798#
799# CONFIG_SOUND is not set 887# CONFIG_SOUND is not set
800CONFIG_HID_SUPPORT=y 888CONFIG_HID_SUPPORT=y
801CONFIG_HID=y 889CONFIG_HID=y
802# CONFIG_HID_DEBUG is not set 890# CONFIG_HID_DEBUG is not set
891# CONFIG_HIDRAW is not set
892# CONFIG_HID_PID is not set
893
894#
895# Special HID drivers
896#
897CONFIG_HID_COMPAT=y
803CONFIG_USB_SUPPORT=y 898CONFIG_USB_SUPPORT=y
804CONFIG_USB_ARCH_HAS_HCD=y 899CONFIG_USB_ARCH_HAS_HCD=y
805CONFIG_USB_ARCH_HAS_OHCI=y 900CONFIG_USB_ARCH_HAS_OHCI=y
806CONFIG_USB_ARCH_HAS_EHCI=y 901CONFIG_USB_ARCH_HAS_EHCI=y
807# CONFIG_USB is not set 902# CONFIG_USB is not set
903# CONFIG_USB_OTG_WHITELIST is not set
904# CONFIG_USB_OTG_BLACKLIST_HUB is not set
808 905
809# 906#
810# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 907# Enable Host or Gadget support to see Inventra options
811# 908#
812 909
813# 910#
814# USB Gadget Support 911# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
815# 912#
816# CONFIG_USB_GADGET is not set 913# CONFIG_USB_GADGET is not set
914
915#
916# OTG and related infrastructure
917#
918# CONFIG_UWB is not set
817# CONFIG_MMC is not set 919# CONFIG_MMC is not set
920# CONFIG_MEMSTICK is not set
818# CONFIG_NEW_LEDS is not set 921# CONFIG_NEW_LEDS is not set
922# CONFIG_ACCESSIBILITY is not set
819# CONFIG_INFINIBAND is not set 923# CONFIG_INFINIBAND is not set
820# CONFIG_RTC_CLASS is not set 924CONFIG_RTC_LIB=y
925CONFIG_RTC_CLASS=y
926CONFIG_RTC_HCTOSYS=y
927CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
928# CONFIG_RTC_DEBUG is not set
821 929
822# 930#
823# DMA Engine support 931# RTC interfaces
824# 932#
825# CONFIG_DMA_ENGINE is not set 933CONFIG_RTC_INTF_SYSFS=y
934CONFIG_RTC_INTF_PROC=y
935CONFIG_RTC_INTF_DEV=y
936# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
937# CONFIG_RTC_DRV_TEST is not set
826 938
827# 939#
828# DMA Clients 940# SPI RTC drivers
829# 941#
830 942
831# 943#
832# DMA Devices 944# Platform RTC drivers
833# 945#
946# CONFIG_RTC_DRV_DS1286 is not set
947# CONFIG_RTC_DRV_DS1511 is not set
948# CONFIG_RTC_DRV_DS1553 is not set
949# CONFIG_RTC_DRV_DS1742 is not set
950# CONFIG_RTC_DRV_STK17TA8 is not set
951# CONFIG_RTC_DRV_M48T86 is not set
952# CONFIG_RTC_DRV_M48T35 is not set
953# CONFIG_RTC_DRV_M48T59 is not set
954# CONFIG_RTC_DRV_BQ4802 is not set
955# CONFIG_RTC_DRV_V3020 is not set
834 956
835# 957#
836# Userspace I/O 958# on-CPU RTC drivers
837# 959#
960CONFIG_RTC_DRV_PARISC=y
961# CONFIG_DMADEVICES is not set
838# CONFIG_UIO is not set 962# CONFIG_UIO is not set
963# CONFIG_STAGING is not set
839 964
840# 965#
841# File systems 966# File systems
@@ -845,7 +970,7 @@ CONFIG_EXT2_FS=y
845# CONFIG_EXT2_FS_XIP is not set 970# CONFIG_EXT2_FS_XIP is not set
846CONFIG_EXT3_FS=y 971CONFIG_EXT3_FS=y
847# CONFIG_EXT3_FS_XATTR is not set 972# CONFIG_EXT3_FS_XATTR is not set
848# CONFIG_EXT4DEV_FS is not set 973# CONFIG_EXT4_FS is not set
849CONFIG_JBD=y 974CONFIG_JBD=y
850# CONFIG_JBD_DEBUG is not set 975# CONFIG_JBD_DEBUG is not set
851# CONFIG_REISERFS_FS is not set 976# CONFIG_REISERFS_FS is not set
@@ -855,19 +980,19 @@ CONFIG_JFS_FS=m
855# CONFIG_JFS_DEBUG is not set 980# CONFIG_JFS_DEBUG is not set
856# CONFIG_JFS_STATISTICS is not set 981# CONFIG_JFS_STATISTICS is not set
857CONFIG_FS_POSIX_ACL=y 982CONFIG_FS_POSIX_ACL=y
983CONFIG_FILE_LOCKING=y
858CONFIG_XFS_FS=m 984CONFIG_XFS_FS=m
859# CONFIG_XFS_QUOTA is not set 985# CONFIG_XFS_QUOTA is not set
860# CONFIG_XFS_SECURITY is not set
861# CONFIG_XFS_POSIX_ACL is not set 986# CONFIG_XFS_POSIX_ACL is not set
862# CONFIG_XFS_RT is not set 987# CONFIG_XFS_RT is not set
988# CONFIG_XFS_DEBUG is not set
863# CONFIG_GFS2_FS is not set 989# CONFIG_GFS2_FS is not set
864# CONFIG_OCFS2_FS is not set 990# CONFIG_OCFS2_FS is not set
865# CONFIG_MINIX_FS is not set 991# CONFIG_BTRFS_FS is not set
866# CONFIG_ROMFS_FS is not set 992CONFIG_DNOTIFY=y
867CONFIG_INOTIFY=y 993CONFIG_INOTIFY=y
868CONFIG_INOTIFY_USER=y 994CONFIG_INOTIFY_USER=y
869# CONFIG_QUOTA is not set 995# CONFIG_QUOTA is not set
870CONFIG_DNOTIFY=y
871# CONFIG_AUTOFS_FS is not set 996# CONFIG_AUTOFS_FS is not set
872CONFIG_AUTOFS4_FS=y 997CONFIG_AUTOFS4_FS=y
873# CONFIG_FUSE_FS is not set 998# CONFIG_FUSE_FS is not set
@@ -897,16 +1022,13 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
897CONFIG_PROC_FS=y 1022CONFIG_PROC_FS=y
898CONFIG_PROC_KCORE=y 1023CONFIG_PROC_KCORE=y
899CONFIG_PROC_SYSCTL=y 1024CONFIG_PROC_SYSCTL=y
1025CONFIG_PROC_PAGE_MONITOR=y
900CONFIG_SYSFS=y 1026CONFIG_SYSFS=y
901CONFIG_TMPFS=y 1027CONFIG_TMPFS=y
902# CONFIG_TMPFS_POSIX_ACL is not set 1028# CONFIG_TMPFS_POSIX_ACL is not set
903# CONFIG_HUGETLB_PAGE is not set 1029# CONFIG_HUGETLB_PAGE is not set
904CONFIG_RAMFS=y
905# CONFIG_CONFIGFS_FS is not set 1030# CONFIG_CONFIGFS_FS is not set
906 1031CONFIG_MISC_FILESYSTEMS=y
907#
908# Miscellaneous filesystems
909#
910# CONFIG_ADFS_FS is not set 1032# CONFIG_ADFS_FS is not set
911# CONFIG_AFFS_FS is not set 1033# CONFIG_AFFS_FS is not set
912# CONFIG_ECRYPT_FS is not set 1034# CONFIG_ECRYPT_FS is not set
@@ -916,34 +1038,33 @@ CONFIG_RAMFS=y
916# CONFIG_BFS_FS is not set 1038# CONFIG_BFS_FS is not set
917# CONFIG_EFS_FS is not set 1039# CONFIG_EFS_FS is not set
918# CONFIG_CRAMFS is not set 1040# CONFIG_CRAMFS is not set
1041# CONFIG_SQUASHFS is not set
919# CONFIG_VXFS_FS is not set 1042# CONFIG_VXFS_FS is not set
1043# CONFIG_MINIX_FS is not set
1044# CONFIG_OMFS_FS is not set
920# CONFIG_HPFS_FS is not set 1045# CONFIG_HPFS_FS is not set
921# CONFIG_QNX4FS_FS is not set 1046# CONFIG_QNX4FS_FS is not set
1047# CONFIG_ROMFS_FS is not set
922# CONFIG_SYSV_FS is not set 1048# CONFIG_SYSV_FS is not set
923CONFIG_UFS_FS=m 1049CONFIG_UFS_FS=m
924# CONFIG_UFS_FS_WRITE is not set 1050# CONFIG_UFS_FS_WRITE is not set
925# CONFIG_UFS_DEBUG is not set 1051# CONFIG_UFS_DEBUG is not set
926 1052CONFIG_NETWORK_FILESYSTEMS=y
927#
928# Network File Systems
929#
930CONFIG_NFS_FS=m 1053CONFIG_NFS_FS=m
931CONFIG_NFS_V3=y 1054CONFIG_NFS_V3=y
932# CONFIG_NFS_V3_ACL is not set 1055# CONFIG_NFS_V3_ACL is not set
933CONFIG_NFS_V4=y 1056CONFIG_NFS_V4=y
934CONFIG_NFS_DIRECTIO=y
935CONFIG_NFSD=m 1057CONFIG_NFSD=m
936CONFIG_NFSD_V3=y 1058CONFIG_NFSD_V3=y
937# CONFIG_NFSD_V3_ACL is not set 1059# CONFIG_NFSD_V3_ACL is not set
938CONFIG_NFSD_V4=y 1060CONFIG_NFSD_V4=y
939CONFIG_NFSD_TCP=y
940CONFIG_LOCKD=m 1061CONFIG_LOCKD=m
941CONFIG_LOCKD_V4=y 1062CONFIG_LOCKD_V4=y
942CONFIG_EXPORTFS=m 1063CONFIG_EXPORTFS=m
943CONFIG_NFS_COMMON=y 1064CONFIG_NFS_COMMON=y
944CONFIG_SUNRPC=m 1065CONFIG_SUNRPC=m
945CONFIG_SUNRPC_GSS=m 1066CONFIG_SUNRPC_GSS=m
946# CONFIG_SUNRPC_BIND34 is not set 1067# CONFIG_SUNRPC_REGISTER_V4 is not set
947CONFIG_RPCSEC_GSS_KRB5=m 1068CONFIG_RPCSEC_GSS_KRB5=m
948CONFIG_RPCSEC_GSS_SPKM3=m 1069CONFIG_RPCSEC_GSS_SPKM3=m
949CONFIG_SMB_FS=m 1070CONFIG_SMB_FS=m
@@ -952,6 +1073,7 @@ CONFIG_SMB_NLS_REMOTE="cp437"
952CONFIG_CIFS=m 1073CONFIG_CIFS=m
953# CONFIG_CIFS_STATS is not set 1074# CONFIG_CIFS_STATS is not set
954# CONFIG_CIFS_WEAK_PW_HASH is not set 1075# CONFIG_CIFS_WEAK_PW_HASH is not set
1076# CONFIG_CIFS_UPCALL is not set
955# CONFIG_CIFS_XATTR is not set 1077# CONFIG_CIFS_XATTR is not set
956# CONFIG_CIFS_DEBUG2 is not set 1078# CONFIG_CIFS_DEBUG2 is not set
957# CONFIG_CIFS_EXPERIMENTAL is not set 1079# CONFIG_CIFS_EXPERIMENTAL is not set
@@ -964,10 +1086,6 @@ CONFIG_CIFS=m
964# 1086#
965# CONFIG_PARTITION_ADVANCED is not set 1087# CONFIG_PARTITION_ADVANCED is not set
966CONFIG_MSDOS_PARTITION=y 1088CONFIG_MSDOS_PARTITION=y
967
968#
969# Native Language Support
970#
971CONFIG_NLS=y 1089CONFIG_NLS=y
972CONFIG_NLS_DEFAULT="iso8859-1" 1090CONFIG_NLS_DEFAULT="iso8859-1"
973CONFIG_NLS_CODEPAGE_437=m 1091CONFIG_NLS_CODEPAGE_437=m
@@ -1008,33 +1126,28 @@ CONFIG_NLS_ISO8859_15=m
1008# CONFIG_NLS_KOI8_R is not set 1126# CONFIG_NLS_KOI8_R is not set
1009# CONFIG_NLS_KOI8_U is not set 1127# CONFIG_NLS_KOI8_U is not set
1010CONFIG_NLS_UTF8=m 1128CONFIG_NLS_UTF8=m
1011
1012#
1013# Distributed Lock Manager
1014#
1015# CONFIG_DLM is not set 1129# CONFIG_DLM is not set
1016 1130
1017# 1131#
1018# Profiling support
1019#
1020CONFIG_PROFILING=y
1021CONFIG_OPROFILE=m
1022
1023#
1024# Kernel hacking 1132# Kernel hacking
1025# 1133#
1026# CONFIG_PRINTK_TIME is not set 1134# CONFIG_PRINTK_TIME is not set
1135CONFIG_ENABLE_WARN_DEPRECATED=y
1027CONFIG_ENABLE_MUST_CHECK=y 1136CONFIG_ENABLE_MUST_CHECK=y
1137CONFIG_FRAME_WARN=2048
1028CONFIG_MAGIC_SYSRQ=y 1138CONFIG_MAGIC_SYSRQ=y
1029# CONFIG_UNUSED_SYMBOLS is not set 1139# CONFIG_UNUSED_SYMBOLS is not set
1030# CONFIG_DEBUG_FS is not set 1140CONFIG_DEBUG_FS=y
1031CONFIG_HEADERS_CHECK=y 1141CONFIG_HEADERS_CHECK=y
1032CONFIG_DEBUG_KERNEL=y 1142CONFIG_DEBUG_KERNEL=y
1033# CONFIG_DEBUG_SHIRQ is not set 1143# CONFIG_DEBUG_SHIRQ is not set
1034CONFIG_DETECT_SOFTLOCKUP=y 1144CONFIG_DETECT_SOFTLOCKUP=y
1145# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1146CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1035CONFIG_SCHED_DEBUG=y 1147CONFIG_SCHED_DEBUG=y
1036# CONFIG_SCHEDSTATS is not set 1148# CONFIG_SCHEDSTATS is not set
1037# CONFIG_TIMER_STATS is not set 1149# CONFIG_TIMER_STATS is not set
1150# CONFIG_DEBUG_OBJECTS is not set
1038# CONFIG_DEBUG_SLAB is not set 1151# CONFIG_DEBUG_SLAB is not set
1039# CONFIG_DEBUG_RT_MUTEXES is not set 1152# CONFIG_DEBUG_RT_MUTEXES is not set
1040# CONFIG_RT_MUTEX_TESTER is not set 1153# CONFIG_RT_MUTEX_TESTER is not set
@@ -1046,10 +1159,33 @@ CONFIG_SCHED_DEBUG=y
1046# CONFIG_DEBUG_BUGVERBOSE is not set 1159# CONFIG_DEBUG_BUGVERBOSE is not set
1047# CONFIG_DEBUG_INFO is not set 1160# CONFIG_DEBUG_INFO is not set
1048# CONFIG_DEBUG_VM is not set 1161# CONFIG_DEBUG_VM is not set
1162# CONFIG_DEBUG_WRITECOUNT is not set
1163# CONFIG_DEBUG_MEMORY_INIT is not set
1049# CONFIG_DEBUG_LIST is not set 1164# CONFIG_DEBUG_LIST is not set
1050CONFIG_FORCED_INLINING=y 1165# CONFIG_DEBUG_SG is not set
1166# CONFIG_DEBUG_NOTIFIERS is not set
1167# CONFIG_BOOT_PRINTK_DELAY is not set
1051# CONFIG_RCU_TORTURE_TEST is not set 1168# CONFIG_RCU_TORTURE_TEST is not set
1169# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1170# CONFIG_BACKTRACE_SELF_TEST is not set
1171# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1052# CONFIG_FAULT_INJECTION is not set 1172# CONFIG_FAULT_INJECTION is not set
1173# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1174CONFIG_NOP_TRACER=y
1175CONFIG_RING_BUFFER=y
1176CONFIG_TRACING=y
1177
1178#
1179# Tracers
1180#
1181# CONFIG_SCHED_TRACER is not set
1182# CONFIG_CONTEXT_SWITCH_TRACER is not set
1183# CONFIG_BOOT_TRACER is not set
1184# CONFIG_TRACE_BRANCH_PROFILING is not set
1185# CONFIG_FTRACE_STARTUP_TEST is not set
1186# CONFIG_BUILD_DOCSRC is not set
1187# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1188# CONFIG_SAMPLES is not set
1053# CONFIG_DEBUG_RODATA is not set 1189# CONFIG_DEBUG_RODATA is not set
1054 1190
1055# 1191#
@@ -1058,56 +1194,112 @@ CONFIG_FORCED_INLINING=y
1058CONFIG_KEYS=y 1194CONFIG_KEYS=y
1059CONFIG_KEYS_DEBUG_PROC_KEYS=y 1195CONFIG_KEYS_DEBUG_PROC_KEYS=y
1060# CONFIG_SECURITY is not set 1196# CONFIG_SECURITY is not set
1197# CONFIG_SECURITYFS is not set
1198# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1061CONFIG_CRYPTO=y 1199CONFIG_CRYPTO=y
1200
1201#
1202# Crypto core or helper
1203#
1204# CONFIG_CRYPTO_FIPS is not set
1062CONFIG_CRYPTO_ALGAPI=y 1205CONFIG_CRYPTO_ALGAPI=y
1206CONFIG_CRYPTO_ALGAPI2=y
1207CONFIG_CRYPTO_AEAD=m
1208CONFIG_CRYPTO_AEAD2=y
1063CONFIG_CRYPTO_BLKCIPHER=m 1209CONFIG_CRYPTO_BLKCIPHER=m
1210CONFIG_CRYPTO_BLKCIPHER2=y
1064CONFIG_CRYPTO_HASH=y 1211CONFIG_CRYPTO_HASH=y
1212CONFIG_CRYPTO_HASH2=y
1213CONFIG_CRYPTO_RNG2=y
1065CONFIG_CRYPTO_MANAGER=y 1214CONFIG_CRYPTO_MANAGER=y
1215CONFIG_CRYPTO_MANAGER2=y
1216# CONFIG_CRYPTO_GF128MUL is not set
1217CONFIG_CRYPTO_NULL=m
1218# CONFIG_CRYPTO_CRYPTD is not set
1219CONFIG_CRYPTO_AUTHENC=m
1220CONFIG_CRYPTO_TEST=m
1221
1222#
1223# Authenticated Encryption with Associated Data
1224#
1225# CONFIG_CRYPTO_CCM is not set
1226# CONFIG_CRYPTO_GCM is not set
1227# CONFIG_CRYPTO_SEQIV is not set
1228
1229#
1230# Block modes
1231#
1232CONFIG_CRYPTO_CBC=m
1233# CONFIG_CRYPTO_CTR is not set
1234# CONFIG_CRYPTO_CTS is not set
1235# CONFIG_CRYPTO_ECB is not set
1236# CONFIG_CRYPTO_LRW is not set
1237# CONFIG_CRYPTO_PCBC is not set
1238# CONFIG_CRYPTO_XTS is not set
1239
1240#
1241# Hash modes
1242#
1066CONFIG_CRYPTO_HMAC=y 1243CONFIG_CRYPTO_HMAC=y
1067# CONFIG_CRYPTO_XCBC is not set 1244# CONFIG_CRYPTO_XCBC is not set
1068CONFIG_CRYPTO_NULL=m 1245
1246#
1247# Digest
1248#
1249CONFIG_CRYPTO_CRC32C=m
1069# CONFIG_CRYPTO_MD4 is not set 1250# CONFIG_CRYPTO_MD4 is not set
1070CONFIG_CRYPTO_MD5=y 1251CONFIG_CRYPTO_MD5=y
1252# CONFIG_CRYPTO_MICHAEL_MIC is not set
1253# CONFIG_CRYPTO_RMD128 is not set
1254# CONFIG_CRYPTO_RMD160 is not set
1255# CONFIG_CRYPTO_RMD256 is not set
1256# CONFIG_CRYPTO_RMD320 is not set
1071CONFIG_CRYPTO_SHA1=m 1257CONFIG_CRYPTO_SHA1=m
1072# CONFIG_CRYPTO_SHA256 is not set 1258# CONFIG_CRYPTO_SHA256 is not set
1073# CONFIG_CRYPTO_SHA512 is not set 1259# CONFIG_CRYPTO_SHA512 is not set
1074# CONFIG_CRYPTO_WP512 is not set
1075# CONFIG_CRYPTO_TGR192 is not set 1260# CONFIG_CRYPTO_TGR192 is not set
1076# CONFIG_CRYPTO_GF128MUL is not set 1261# CONFIG_CRYPTO_WP512 is not set
1077# CONFIG_CRYPTO_ECB is not set 1262
1078CONFIG_CRYPTO_CBC=m 1263#
1079# CONFIG_CRYPTO_PCBC is not set 1264# Ciphers
1080# CONFIG_CRYPTO_LRW is not set 1265#
1081# CONFIG_CRYPTO_XTS is not set
1082# CONFIG_CRYPTO_CRYPTD is not set
1083CONFIG_CRYPTO_DES=m
1084# CONFIG_CRYPTO_FCRYPT is not set
1085CONFIG_CRYPTO_BLOWFISH=m
1086# CONFIG_CRYPTO_TWOFISH is not set
1087# CONFIG_CRYPTO_SERPENT is not set
1088# CONFIG_CRYPTO_AES is not set 1266# CONFIG_CRYPTO_AES is not set
1267# CONFIG_CRYPTO_ANUBIS is not set
1268# CONFIG_CRYPTO_ARC4 is not set
1269CONFIG_CRYPTO_BLOWFISH=m
1270# CONFIG_CRYPTO_CAMELLIA is not set
1089CONFIG_CRYPTO_CAST5=m 1271CONFIG_CRYPTO_CAST5=m
1090# CONFIG_CRYPTO_CAST6 is not set 1272# CONFIG_CRYPTO_CAST6 is not set
1091# CONFIG_CRYPTO_TEA is not set 1273CONFIG_CRYPTO_DES=m
1092# CONFIG_CRYPTO_ARC4 is not set 1274# CONFIG_CRYPTO_FCRYPT is not set
1093# CONFIG_CRYPTO_KHAZAD is not set 1275# CONFIG_CRYPTO_KHAZAD is not set
1094# CONFIG_CRYPTO_ANUBIS is not set 1276# CONFIG_CRYPTO_SALSA20 is not set
1095# CONFIG_CRYPTO_SEED is not set 1277# CONFIG_CRYPTO_SEED is not set
1278# CONFIG_CRYPTO_SERPENT is not set
1279# CONFIG_CRYPTO_TEA is not set
1280# CONFIG_CRYPTO_TWOFISH is not set
1281
1282#
1283# Compression
1284#
1096CONFIG_CRYPTO_DEFLATE=m 1285CONFIG_CRYPTO_DEFLATE=m
1097# CONFIG_CRYPTO_MICHAEL_MIC is not set 1286# CONFIG_CRYPTO_LZO is not set
1098CONFIG_CRYPTO_CRC32C=m 1287
1099# CONFIG_CRYPTO_CAMELLIA is not set 1288#
1100CONFIG_CRYPTO_TEST=m 1289# Random Number Generation
1101# CONFIG_CRYPTO_AUTHENC is not set 1290#
1291# CONFIG_CRYPTO_ANSI_CPRNG is not set
1102# CONFIG_CRYPTO_HW is not set 1292# CONFIG_CRYPTO_HW is not set
1103 1293
1104# 1294#
1105# Library routines 1295# Library routines
1106# 1296#
1107CONFIG_BITREVERSE=y 1297CONFIG_BITREVERSE=y
1298CONFIG_GENERIC_FIND_LAST_BIT=y
1108CONFIG_CRC_CCITT=m 1299CONFIG_CRC_CCITT=m
1109# CONFIG_CRC16 is not set 1300# CONFIG_CRC16 is not set
1110# CONFIG_CRC_ITU_T is not set 1301# CONFIG_CRC_T10DIF is not set
1302CONFIG_CRC_ITU_T=m
1111CONFIG_CRC32=y 1303CONFIG_CRC32=y
1112# CONFIG_CRC7 is not set 1304# CONFIG_CRC7 is not set
1113CONFIG_LIBCRC32C=m 1305CONFIG_LIBCRC32C=m
diff --git a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig
index 1bf22c9a4614..98bb05ee6e8d 100644
--- a/arch/parisc/configs/b180_defconfig
+++ b/arch/parisc/configs/b180_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23 3# Linux kernel version: 2.6.29-rc8
4# Fri Oct 12 21:16:46 2007 4# Fri Mar 13 01:32:57 2009
5# 5#
6CONFIG_PARISC=y 6CONFIG_PARISC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -33,13 +33,29 @@ CONFIG_SYSVIPC_SYSCTL=y
33# CONFIG_BSD_PROCESS_ACCT is not set 33# CONFIG_BSD_PROCESS_ACCT is not set
34# CONFIG_TASKSTATS is not set 34# CONFIG_TASKSTATS is not set
35# CONFIG_AUDIT is not set 35# CONFIG_AUDIT is not set
36
37#
38# RCU Subsystem
39#
40CONFIG_CLASSIC_RCU=y
41# CONFIG_TREE_RCU is not set
42# CONFIG_PREEMPT_RCU is not set
43# CONFIG_TREE_RCU_TRACE is not set
44# CONFIG_PREEMPT_RCU_TRACE is not set
36CONFIG_IKCONFIG=y 45CONFIG_IKCONFIG=y
37CONFIG_IKCONFIG_PROC=y 46CONFIG_IKCONFIG_PROC=y
38CONFIG_LOG_BUF_SHIFT=16 47CONFIG_LOG_BUF_SHIFT=16
48# CONFIG_CGROUPS is not set
39CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
40# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
52CONFIG_NAMESPACES=y
53# CONFIG_UTS_NS is not set
54# CONFIG_IPC_NS is not set
41# CONFIG_BLK_DEV_INITRD is not set 55# CONFIG_BLK_DEV_INITRD is not set
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
42CONFIG_SYSCTL=y 57CONFIG_SYSCTL=y
58CONFIG_ANON_INODES=y
43# CONFIG_EMBEDDED is not set 59# CONFIG_EMBEDDED is not set
44CONFIG_SYSCTL_SYSCALL=y 60CONFIG_SYSCTL_SYSCALL=y
45CONFIG_KALLSYMS=y 61CONFIG_KALLSYMS=y
@@ -51,27 +67,34 @@ CONFIG_BUG=y
51CONFIG_ELF_CORE=y 67CONFIG_ELF_CORE=y
52CONFIG_BASE_FULL=y 68CONFIG_BASE_FULL=y
53CONFIG_FUTEX=y 69CONFIG_FUTEX=y
54CONFIG_ANON_INODES=y
55CONFIG_EPOLL=y 70CONFIG_EPOLL=y
56CONFIG_SIGNALFD=y 71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
57CONFIG_EVENTFD=y 73CONFIG_EVENTFD=y
58CONFIG_SHMEM=y 74CONFIG_SHMEM=y
75CONFIG_AIO=y
59CONFIG_VM_EVENT_COUNTERS=y 76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_PCI_QUIRKS=y
78CONFIG_COMPAT_BRK=y
60CONFIG_SLAB=y 79CONFIG_SLAB=y
61# CONFIG_SLUB is not set 80# CONFIG_SLUB is not set
62# CONFIG_SLOB is not set 81# CONFIG_SLOB is not set
82# CONFIG_PROFILING is not set
83CONFIG_HAVE_OPROFILE=y
84# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
85CONFIG_SLABINFO=y
63CONFIG_RT_MUTEXES=y 86CONFIG_RT_MUTEXES=y
64# CONFIG_TINY_SHMEM is not set
65CONFIG_BASE_SMALL=0 87CONFIG_BASE_SMALL=0
66CONFIG_MODULES=y 88CONFIG_MODULES=y
89# CONFIG_MODULE_FORCE_LOAD is not set
67# CONFIG_MODULE_UNLOAD is not set 90# CONFIG_MODULE_UNLOAD is not set
68CONFIG_MODVERSIONS=y 91CONFIG_MODVERSIONS=y
69# CONFIG_MODULE_SRCVERSION_ALL is not set 92# CONFIG_MODULE_SRCVERSION_ALL is not set
70# CONFIG_KMOD is not set 93CONFIG_INIT_ALL_POSSIBLE=y
71CONFIG_BLOCK=y 94CONFIG_BLOCK=y
72# CONFIG_LBD is not set 95# CONFIG_LBD is not set
73# CONFIG_BLK_DEV_IO_TRACE is not set 96# CONFIG_BLK_DEV_IO_TRACE is not set
74# CONFIG_LSF is not set 97# CONFIG_BLK_DEV_INTEGRITY is not set
75 98
76# 99#
77# IO Schedulers 100# IO Schedulers
@@ -85,6 +108,7 @@ CONFIG_IOSCHED_CFQ=y
85CONFIG_DEFAULT_CFQ=y 108CONFIG_DEFAULT_CFQ=y
86# CONFIG_DEFAULT_NOOP is not set 109# CONFIG_DEFAULT_NOOP is not set
87CONFIG_DEFAULT_IOSCHED="cfq" 110CONFIG_DEFAULT_IOSCHED="cfq"
111# CONFIG_FREEZER is not set
88 112
89# 113#
90# Processor type and features 114# Processor type and features
@@ -108,13 +132,15 @@ CONFIG_HZ_250=y
108# CONFIG_HZ_300 is not set 132# CONFIG_HZ_300 is not set
109# CONFIG_HZ_1000 is not set 133# CONFIG_HZ_1000 is not set
110CONFIG_HZ=250 134CONFIG_HZ=250
135# CONFIG_SCHED_HRTICK is not set
111CONFIG_FLATMEM=y 136CONFIG_FLATMEM=y
112CONFIG_FLAT_NODE_MEM_MAP=y 137CONFIG_FLAT_NODE_MEM_MAP=y
113# CONFIG_SPARSEMEM_STATIC is not set 138CONFIG_PAGEFLAGS_EXTENDED=y
114CONFIG_SPLIT_PTLOCK_CPUS=4096 139CONFIG_SPLIT_PTLOCK_CPUS=4096
115# CONFIG_RESOURCES_64BIT is not set 140# CONFIG_PHYS_ADDR_T_64BIT is not set
116CONFIG_ZONE_DMA_FLAG=0 141CONFIG_ZONE_DMA_FLAG=0
117CONFIG_VIRT_TO_BUS=y 142CONFIG_VIRT_TO_BUS=y
143CONFIG_UNEVICTABLE_LRU=y
118# CONFIG_HPUX is not set 144# CONFIG_HPUX is not set
119 145
120# 146#
@@ -130,14 +156,14 @@ CONFIG_EISA_NAMES=y
130CONFIG_ISA=y 156CONFIG_ISA=y
131CONFIG_PCI=y 157CONFIG_PCI=y
132# CONFIG_ARCH_SUPPORTS_MSI is not set 158# CONFIG_ARCH_SUPPORTS_MSI is not set
159CONFIG_PCI_LEGACY=y
133# CONFIG_PCI_DEBUG is not set 160# CONFIG_PCI_DEBUG is not set
161# CONFIG_PCI_STUB is not set
134CONFIG_GSC_DINO=y 162CONFIG_GSC_DINO=y
135# CONFIG_PCI_LBA is not set 163# CONFIG_PCI_LBA is not set
136 164CONFIG_IOMMU_HELPER=y
137#
138# PCCARD (PCMCIA/CardBus) support
139#
140# CONFIG_PCCARD is not set 165# CONFIG_PCCARD is not set
166# CONFIG_HOTPLUG_PCI is not set
141 167
142# 168#
143# PA-RISC specific drivers 169# PA-RISC specific drivers
@@ -151,16 +177,15 @@ CONFIG_PDC_STABLE=y
151# Executable file formats 177# Executable file formats
152# 178#
153CONFIG_BINFMT_ELF=y 179CONFIG_BINFMT_ELF=y
180# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
181# CONFIG_HAVE_AOUT is not set
154# CONFIG_BINFMT_MISC is not set 182# CONFIG_BINFMT_MISC is not set
155
156#
157# Networking
158#
159CONFIG_NET=y 183CONFIG_NET=y
160 184
161# 185#
162# Networking options 186# Networking options
163# 187#
188CONFIG_COMPAT_NET_DEV_OPS=y
164CONFIG_PACKET=y 189CONFIG_PACKET=y
165CONFIG_PACKET_MMAP=y 190CONFIG_PACKET_MMAP=y
166CONFIG_UNIX=y 191CONFIG_UNIX=y
@@ -205,36 +230,37 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=y
205CONFIG_INET6_XFRM_MODE_TUNNEL=y 230CONFIG_INET6_XFRM_MODE_TUNNEL=y
206CONFIG_INET6_XFRM_MODE_BEET=y 231CONFIG_INET6_XFRM_MODE_BEET=y
207CONFIG_IPV6_SIT=y 232CONFIG_IPV6_SIT=y
233CONFIG_IPV6_NDISC_NODETYPE=y
208# CONFIG_IPV6_TUNNEL is not set 234# CONFIG_IPV6_TUNNEL is not set
209# CONFIG_NETLABEL is not set 235# CONFIG_NETLABEL is not set
210# CONFIG_NETWORK_SECMARK is not set 236# CONFIG_NETWORK_SECMARK is not set
211# CONFIG_NETFILTER is not set 237# CONFIG_NETFILTER is not set
238# CONFIG_ATM is not set
212# CONFIG_BRIDGE is not set 239# CONFIG_BRIDGE is not set
213# CONFIG_VLAN_8021Q is not set 240# CONFIG_VLAN_8021Q is not set
214# CONFIG_DECNET is not set 241# CONFIG_DECNET is not set
215# CONFIG_LLC2 is not set 242# CONFIG_LLC2 is not set
216# CONFIG_IPX is not set 243# CONFIG_IPX is not set
217# CONFIG_ATALK is not set 244# CONFIG_ATALK is not set
218
219#
220# QoS and/or fair queueing
221#
222# CONFIG_NET_SCHED is not set 245# CONFIG_NET_SCHED is not set
246# CONFIG_DCB is not set
223 247
224# 248#
225# Network testing 249# Network testing
226# 250#
227# CONFIG_NET_PKTGEN is not set 251# CONFIG_NET_PKTGEN is not set
228# CONFIG_HAMRADIO is not set 252# CONFIG_HAMRADIO is not set
253# CONFIG_CAN is not set
229# CONFIG_IRDA is not set 254# CONFIG_IRDA is not set
230# CONFIG_BT is not set 255# CONFIG_BT is not set
231 256# CONFIG_PHONET is not set
232# 257CONFIG_WIRELESS=y
233# Wireless
234#
235# CONFIG_CFG80211 is not set 258# CONFIG_CFG80211 is not set
259CONFIG_WIRELESS_OLD_REGULATORY=y
236# CONFIG_WIRELESS_EXT is not set 260# CONFIG_WIRELESS_EXT is not set
237# CONFIG_IEEE80211 is not set 261# CONFIG_LIB80211 is not set
262# CONFIG_MAC80211 is not set
263# CONFIG_WIMAX is not set
238# CONFIG_RFKILL is not set 264# CONFIG_RFKILL is not set
239 265
240# 266#
@@ -247,7 +273,9 @@ CONFIG_IPV6_SIT=y
247CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 273CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
248CONFIG_STANDALONE=y 274CONFIG_STANDALONE=y
249# CONFIG_PREVENT_FIRMWARE_BUILD is not set 275# CONFIG_PREVENT_FIRMWARE_BUILD is not set
250# CONFIG_FW_LOADER is not set 276CONFIG_FW_LOADER=y
277CONFIG_FIRMWARE_IN_KERNEL=y
278CONFIG_EXTRA_FIRMWARE=""
251# CONFIG_DEBUG_DRIVER is not set 279# CONFIG_DEBUG_DRIVER is not set
252# CONFIG_DEBUG_DEVRES is not set 280# CONFIG_DEBUG_DEVRES is not set
253# CONFIG_SYS_HYPERVISOR is not set 281# CONFIG_SYS_HYPERVISOR is not set
@@ -275,10 +303,18 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y
275CONFIG_CDROM_PKTCDVD=m 303CONFIG_CDROM_PKTCDVD=m
276CONFIG_CDROM_PKTCDVD_BUFFERS=8 304CONFIG_CDROM_PKTCDVD_BUFFERS=8
277CONFIG_ATA_OVER_ETH=y 305CONFIG_ATA_OVER_ETH=y
306# CONFIG_BLK_DEV_HD is not set
278CONFIG_MISC_DEVICES=y 307CONFIG_MISC_DEVICES=y
279# CONFIG_PHANTOM is not set 308# CONFIG_PHANTOM is not set
280# CONFIG_EEPROM_93CX6 is not set
281# CONFIG_SGI_IOC4 is not set 309# CONFIG_SGI_IOC4 is not set
310# CONFIG_ENCLOSURE_SERVICES is not set
311# CONFIG_HP_ILO is not set
312
313#
314# EEPROM support
315#
316# CONFIG_EEPROM_93CX6 is not set
317CONFIG_HAVE_IDE=y
282# CONFIG_IDE is not set 318# CONFIG_IDE is not set
283 319
284# 320#
@@ -317,8 +353,10 @@ CONFIG_SCSI_SPI_ATTRS=y
317# CONFIG_SCSI_FC_ATTRS is not set 353# CONFIG_SCSI_FC_ATTRS is not set
318# CONFIG_SCSI_ISCSI_ATTRS is not set 354# CONFIG_SCSI_ISCSI_ATTRS is not set
319# CONFIG_SCSI_SAS_LIBSAS is not set 355# CONFIG_SCSI_SAS_LIBSAS is not set
356# CONFIG_SCSI_SRP_ATTRS is not set
320CONFIG_SCSI_LOWLEVEL=y 357CONFIG_SCSI_LOWLEVEL=y
321# CONFIG_ISCSI_TCP is not set 358# CONFIG_ISCSI_TCP is not set
359# CONFIG_SCSI_CXGB3_ISCSI is not set
322# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 360# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
323# CONFIG_SCSI_3W_9XXX is not set 361# CONFIG_SCSI_3W_9XXX is not set
324# CONFIG_SCSI_ACARD is not set 362# CONFIG_SCSI_ACARD is not set
@@ -330,12 +368,15 @@ CONFIG_SCSI_LOWLEVEL=y
330# CONFIG_SCSI_AIC79XX is not set 368# CONFIG_SCSI_AIC79XX is not set
331# CONFIG_SCSI_AIC94XX is not set 369# CONFIG_SCSI_AIC94XX is not set
332# CONFIG_SCSI_DPT_I2O is not set 370# CONFIG_SCSI_DPT_I2O is not set
371# CONFIG_SCSI_ADVANSYS is not set
333# CONFIG_SCSI_IN2000 is not set 372# CONFIG_SCSI_IN2000 is not set
334# CONFIG_SCSI_ARCMSR is not set 373# CONFIG_SCSI_ARCMSR is not set
335# CONFIG_MEGARAID_NEWGEN is not set 374# CONFIG_MEGARAID_NEWGEN is not set
336# CONFIG_MEGARAID_LEGACY is not set 375# CONFIG_MEGARAID_LEGACY is not set
337# CONFIG_MEGARAID_SAS is not set 376# CONFIG_MEGARAID_SAS is not set
338# CONFIG_SCSI_HPTIOP is not set 377# CONFIG_SCSI_HPTIOP is not set
378# CONFIG_LIBFC is not set
379# CONFIG_FCOE is not set
339# CONFIG_SCSI_DMX3191D is not set 380# CONFIG_SCSI_DMX3191D is not set
340# CONFIG_SCSI_DTC3280 is not set 381# CONFIG_SCSI_DTC3280 is not set
341# CONFIG_SCSI_FUTURE_DOMAIN is not set 382# CONFIG_SCSI_FUTURE_DOMAIN is not set
@@ -346,6 +387,7 @@ CONFIG_SCSI_LOWLEVEL=y
346# CONFIG_SCSI_INIA100 is not set 387# CONFIG_SCSI_INIA100 is not set
347# CONFIG_SCSI_PPA is not set 388# CONFIG_SCSI_PPA is not set
348# CONFIG_SCSI_IMM is not set 389# CONFIG_SCSI_IMM is not set
390# CONFIG_SCSI_MVSAS is not set
349# CONFIG_SCSI_NCR53C406A is not set 391# CONFIG_SCSI_NCR53C406A is not set
350CONFIG_SCSI_LASI700=y 392CONFIG_SCSI_LASI700=y
351CONFIG_53C700_LE_ON_BE=y 393CONFIG_53C700_LE_ON_BE=y
@@ -360,7 +402,6 @@ CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
360CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32 402CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
361CONFIG_SCSI_NCR53C8XX_SYNC=40 403CONFIG_SCSI_NCR53C8XX_SYNC=40
362# CONFIG_SCSI_PAS16 is not set 404# CONFIG_SCSI_PAS16 is not set
363# CONFIG_SCSI_PSI240I is not set
364# CONFIG_SCSI_QLOGIC_FAS is not set 405# CONFIG_SCSI_QLOGIC_FAS is not set
365# CONFIG_SCSI_QLOGIC_1280 is not set 406# CONFIG_SCSI_QLOGIC_1280 is not set
366# CONFIG_SCSI_QLA_FC is not set 407# CONFIG_SCSI_QLA_FC is not set
@@ -373,9 +414,11 @@ CONFIG_SCSI_NCR53C8XX_SYNC=40
373# CONFIG_SCSI_NSP32 is not set 414# CONFIG_SCSI_NSP32 is not set
374# CONFIG_SCSI_DEBUG is not set 415# CONFIG_SCSI_DEBUG is not set
375# CONFIG_SCSI_SRP is not set 416# CONFIG_SCSI_SRP is not set
417# CONFIG_SCSI_DH is not set
376# CONFIG_ATA is not set 418# CONFIG_ATA is not set
377CONFIG_MD=y 419CONFIG_MD=y
378CONFIG_BLK_DEV_MD=y 420CONFIG_BLK_DEV_MD=y
421CONFIG_MD_AUTODETECT=y
379CONFIG_MD_LINEAR=y 422CONFIG_MD_LINEAR=y
380CONFIG_MD_RAID0=y 423CONFIG_MD_RAID0=y
381CONFIG_MD_RAID1=y 424CONFIG_MD_RAID1=y
@@ -383,26 +426,18 @@ CONFIG_MD_RAID1=y
383# CONFIG_MD_MULTIPATH is not set 426# CONFIG_MD_MULTIPATH is not set
384# CONFIG_MD_FAULTY is not set 427# CONFIG_MD_FAULTY is not set
385# CONFIG_BLK_DEV_DM is not set 428# CONFIG_BLK_DEV_DM is not set
386
387#
388# Fusion MPT device support
389#
390# CONFIG_FUSION is not set 429# CONFIG_FUSION is not set
391# CONFIG_FUSION_SPI is not set
392# CONFIG_FUSION_FC is not set
393# CONFIG_FUSION_SAS is not set
394 430
395# 431#
396# IEEE 1394 (FireWire) support 432# IEEE 1394 (FireWire) support
397# 433#
398 434
399# 435#
400# An alternative FireWire stack is available with EXPERIMENTAL=y 436# A new alternative FireWire stack is available with EXPERIMENTAL=y
401# 437#
402# CONFIG_IEEE1394 is not set 438# CONFIG_IEEE1394 is not set
403# CONFIG_I2O is not set 439# CONFIG_I2O is not set
404CONFIG_NETDEVICES=y 440CONFIG_NETDEVICES=y
405# CONFIG_NETDEVICES_MULTIQUEUE is not set
406# CONFIG_DUMMY is not set 441# CONFIG_DUMMY is not set
407# CONFIG_BONDING is not set 442# CONFIG_BONDING is not set
408# CONFIG_EQUALIZER is not set 443# CONFIG_EQUALIZER is not set
@@ -434,36 +469,49 @@ CONFIG_TULIP=y
434# CONFIG_IBM_NEW_EMAC_RGMII is not set 469# CONFIG_IBM_NEW_EMAC_RGMII is not set
435# CONFIG_IBM_NEW_EMAC_TAH is not set 470# CONFIG_IBM_NEW_EMAC_TAH is not set
436# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 471# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
472# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
473# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
474# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
437# CONFIG_NET_PCI is not set 475# CONFIG_NET_PCI is not set
438# CONFIG_B44 is not set 476# CONFIG_B44 is not set
477# CONFIG_CS89x0 is not set
439# CONFIG_NET_POCKET is not set 478# CONFIG_NET_POCKET is not set
479# CONFIG_ATL2 is not set
440CONFIG_NETDEV_1000=y 480CONFIG_NETDEV_1000=y
441# CONFIG_ACENIC is not set 481# CONFIG_ACENIC is not set
442# CONFIG_DL2K is not set 482# CONFIG_DL2K is not set
443# CONFIG_E1000 is not set 483# CONFIG_E1000 is not set
444# CONFIG_E1000E is not set 484# CONFIG_E1000E is not set
485# CONFIG_IGB is not set
445# CONFIG_NS83820 is not set 486# CONFIG_NS83820 is not set
446# CONFIG_HAMACHI is not set 487# CONFIG_HAMACHI is not set
447# CONFIG_R8169 is not set 488# CONFIG_R8169 is not set
448# CONFIG_SIS190 is not set 489# CONFIG_SIS190 is not set
449# CONFIG_SKGE is not set 490# CONFIG_SKGE is not set
450# CONFIG_SKY2 is not set 491# CONFIG_SKY2 is not set
451# CONFIG_SK98LIN is not set
452# CONFIG_VIA_VELOCITY is not set 492# CONFIG_VIA_VELOCITY is not set
453# CONFIG_TIGON3 is not set 493# CONFIG_TIGON3 is not set
454# CONFIG_BNX2 is not set 494# CONFIG_BNX2 is not set
455# CONFIG_QLA3XXX is not set 495# CONFIG_QLA3XXX is not set
496# CONFIG_ATL1 is not set
497# CONFIG_JME is not set
456CONFIG_NETDEV_10000=y 498CONFIG_NETDEV_10000=y
457# CONFIG_CHELSIO_T1 is not set 499# CONFIG_CHELSIO_T1 is not set
500CONFIG_CHELSIO_T3_DEPENDS=y
458# CONFIG_CHELSIO_T3 is not set 501# CONFIG_CHELSIO_T3 is not set
502# CONFIG_ENIC is not set
459# CONFIG_IXGBE is not set 503# CONFIG_IXGBE is not set
460# CONFIG_IXGB is not set 504# CONFIG_IXGB is not set
461# CONFIG_S2IO is not set 505# CONFIG_S2IO is not set
462# CONFIG_MYRI10GE is not set 506# CONFIG_MYRI10GE is not set
463# CONFIG_NETXEN_NIC is not set 507# CONFIG_NETXEN_NIC is not set
464# CONFIG_NIU is not set 508# CONFIG_NIU is not set
509# CONFIG_MLX4_EN is not set
465# CONFIG_MLX4_CORE is not set 510# CONFIG_MLX4_CORE is not set
466# CONFIG_TEHUTI is not set 511# CONFIG_TEHUTI is not set
512# CONFIG_BNX2X is not set
513# CONFIG_QLGE is not set
514# CONFIG_SFC is not set
467# CONFIG_TR is not set 515# CONFIG_TR is not set
468 516
469# 517#
@@ -471,6 +519,11 @@ CONFIG_NETDEV_10000=y
471# 519#
472# CONFIG_WLAN_PRE80211 is not set 520# CONFIG_WLAN_PRE80211 is not set
473# CONFIG_WLAN_80211 is not set 521# CONFIG_WLAN_80211 is not set
522# CONFIG_IWLWIFI_LEDS is not set
523
524#
525# Enable WiMAX (Networking options) to see the WiMAX drivers
526#
474# CONFIG_WAN is not set 527# CONFIG_WAN is not set
475# CONFIG_FDDI is not set 528# CONFIG_FDDI is not set
476# CONFIG_PLIP is not set 529# CONFIG_PLIP is not set
@@ -503,7 +556,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
503CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 556CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
504CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 557CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
505# CONFIG_INPUT_JOYDEV is not set 558# CONFIG_INPUT_JOYDEV is not set
506# CONFIG_INPUT_TSDEV is not set
507CONFIG_INPUT_EVDEV=y 559CONFIG_INPUT_EVDEV=y
508# CONFIG_INPUT_EVBUG is not set 560# CONFIG_INPUT_EVBUG is not set
509 561
@@ -526,11 +578,12 @@ CONFIG_MOUSE_PS2=y
526CONFIG_MOUSE_PS2_ALPS=y 578CONFIG_MOUSE_PS2_ALPS=y
527CONFIG_MOUSE_PS2_LOGIPS2PP=y 579CONFIG_MOUSE_PS2_LOGIPS2PP=y
528CONFIG_MOUSE_PS2_SYNAPTICS=y 580CONFIG_MOUSE_PS2_SYNAPTICS=y
529CONFIG_MOUSE_PS2_LIFEBOOK=y
530CONFIG_MOUSE_PS2_TRACKPOINT=y 581CONFIG_MOUSE_PS2_TRACKPOINT=y
582# CONFIG_MOUSE_PS2_ELANTECH is not set
531# CONFIG_MOUSE_PS2_TOUCHKIT is not set 583# CONFIG_MOUSE_PS2_TOUCHKIT is not set
532# CONFIG_MOUSE_SERIAL is not set 584# CONFIG_MOUSE_SERIAL is not set
533# CONFIG_MOUSE_APPLETOUCH is not set 585# CONFIG_MOUSE_APPLETOUCH is not set
586# CONFIG_MOUSE_BCM5974 is not set
534# CONFIG_MOUSE_INPORT is not set 587# CONFIG_MOUSE_INPORT is not set
535# CONFIG_MOUSE_LOGIBM is not set 588# CONFIG_MOUSE_LOGIBM is not set
536# CONFIG_MOUSE_PC110PAD is not set 589# CONFIG_MOUSE_PC110PAD is not set
@@ -564,9 +617,11 @@ CONFIG_SERIO_LIBPS2=y
564# Character devices 617# Character devices
565# 618#
566CONFIG_VT=y 619CONFIG_VT=y
620CONFIG_CONSOLE_TRANSLATIONS=y
567CONFIG_VT_CONSOLE=y 621CONFIG_VT_CONSOLE=y
568CONFIG_HW_CONSOLE=y 622CONFIG_HW_CONSOLE=y
569# CONFIG_VT_HW_CONSOLE_BINDING is not set 623# CONFIG_VT_HW_CONSOLE_BINDING is not set
624CONFIG_DEVKMEM=y
570# CONFIG_SERIAL_NONSTANDARD is not set 625# CONFIG_SERIAL_NONSTANDARD is not set
571 626
572# 627#
@@ -598,75 +653,79 @@ CONFIG_SERIAL_CORE=y
598CONFIG_SERIAL_CORE_CONSOLE=y 653CONFIG_SERIAL_CORE_CONSOLE=y
599# CONFIG_SERIAL_JSM is not set 654# CONFIG_SERIAL_JSM is not set
600CONFIG_UNIX98_PTYS=y 655CONFIG_UNIX98_PTYS=y
656# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
601CONFIG_LEGACY_PTYS=y 657CONFIG_LEGACY_PTYS=y
602CONFIG_LEGACY_PTY_COUNT=256 658CONFIG_LEGACY_PTY_COUNT=256
603CONFIG_PRINTER=y 659CONFIG_PRINTER=y
604# CONFIG_LP_CONSOLE is not set 660# CONFIG_LP_CONSOLE is not set
605# CONFIG_PPDEV is not set 661# CONFIG_PPDEV is not set
606# CONFIG_TIPAR is not set
607# CONFIG_IPMI_HANDLER is not set 662# CONFIG_IPMI_HANDLER is not set
608# CONFIG_WATCHDOG is not set
609# CONFIG_HW_RANDOM is not set 663# CONFIG_HW_RANDOM is not set
610CONFIG_GEN_RTC=y
611# CONFIG_GEN_RTC_X is not set
612# CONFIG_DTLK is not set 664# CONFIG_DTLK is not set
613# CONFIG_R3964 is not set 665# CONFIG_R3964 is not set
614# CONFIG_APPLICOM is not set 666# CONFIG_APPLICOM is not set
615# CONFIG_AGP is not set
616# CONFIG_DRM is not set
617# CONFIG_RAW_DRIVER is not set 667# CONFIG_RAW_DRIVER is not set
618CONFIG_DEVPORT=y 668CONFIG_DEVPORT=y
619# CONFIG_I2C is not set 669# CONFIG_I2C is not set
620
621#
622# SPI support
623#
624# CONFIG_SPI is not set 670# CONFIG_SPI is not set
625# CONFIG_SPI_MASTER is not set
626# CONFIG_W1 is not set 671# CONFIG_W1 is not set
627# CONFIG_POWER_SUPPLY is not set 672# CONFIG_POWER_SUPPLY is not set
628# CONFIG_HWMON is not set 673# CONFIG_HWMON is not set
674# CONFIG_THERMAL is not set
675# CONFIG_THERMAL_HWMON is not set
676# CONFIG_WATCHDOG is not set
677CONFIG_SSB_POSSIBLE=y
629 678
630# 679#
631# Sonics Silicon Backplane 680# Sonics Silicon Backplane
632# 681#
633CONFIG_SSB_POSSIBLE=y
634# CONFIG_SSB is not set 682# CONFIG_SSB is not set
635 683
636# 684#
637# Multifunction device drivers 685# Multifunction device drivers
638# 686#
687# CONFIG_MFD_CORE is not set
639# CONFIG_MFD_SM501 is not set 688# CONFIG_MFD_SM501 is not set
689# CONFIG_HTC_PASIC3 is not set
690# CONFIG_MFD_TMIO is not set
691# CONFIG_REGULATOR is not set
640 692
641# 693#
642# Multimedia devices 694# Multimedia devices
643# 695#
696
697#
698# Multimedia core support
699#
644# CONFIG_VIDEO_DEV is not set 700# CONFIG_VIDEO_DEV is not set
645# CONFIG_DVB_CORE is not set 701# CONFIG_DVB_CORE is not set
646# CONFIG_DAB is not set 702# CONFIG_VIDEO_MEDIA is not set
647 703
648# 704#
649# Graphics support 705# Multimedia drivers
650# 706#
651# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 707# CONFIG_DAB is not set
652 708
653# 709#
654# Display device support 710# Graphics support
655# 711#
656# CONFIG_DISPLAY_SUPPORT is not set 712# CONFIG_AGP is not set
713# CONFIG_DRM is not set
657# CONFIG_VGASTATE is not set 714# CONFIG_VGASTATE is not set
658CONFIG_VIDEO_OUTPUT_CONTROL=m 715CONFIG_VIDEO_OUTPUT_CONTROL=m
659CONFIG_FB=y 716CONFIG_FB=y
660# CONFIG_FIRMWARE_EDID is not set 717# CONFIG_FIRMWARE_EDID is not set
661# CONFIG_FB_DDC is not set 718# CONFIG_FB_DDC is not set
719# CONFIG_FB_BOOT_VESA_SUPPORT is not set
662CONFIG_FB_CFB_FILLRECT=y 720CONFIG_FB_CFB_FILLRECT=y
663CONFIG_FB_CFB_COPYAREA=y 721CONFIG_FB_CFB_COPYAREA=y
664CONFIG_FB_CFB_IMAGEBLIT=y 722CONFIG_FB_CFB_IMAGEBLIT=y
723# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
665# CONFIG_FB_SYS_FILLRECT is not set 724# CONFIG_FB_SYS_FILLRECT is not set
666# CONFIG_FB_SYS_COPYAREA is not set 725# CONFIG_FB_SYS_COPYAREA is not set
667# CONFIG_FB_SYS_IMAGEBLIT is not set 726# CONFIG_FB_SYS_IMAGEBLIT is not set
727# CONFIG_FB_FOREIGN_ENDIAN is not set
668# CONFIG_FB_SYS_FOPS is not set 728# CONFIG_FB_SYS_FOPS is not set
669CONFIG_FB_DEFERRED_IO=y
670# CONFIG_FB_SVGALIB is not set 729# CONFIG_FB_SVGALIB is not set
671# CONFIG_FB_MACMODES is not set 730# CONFIG_FB_MACMODES is not set
672# CONFIG_FB_BACKLIGHT is not set 731# CONFIG_FB_BACKLIGHT is not set
@@ -691,6 +750,7 @@ CONFIG_FB_STI=y
691# CONFIG_FB_ATY is not set 750# CONFIG_FB_ATY is not set
692# CONFIG_FB_S3 is not set 751# CONFIG_FB_S3 is not set
693# CONFIG_FB_SIS is not set 752# CONFIG_FB_SIS is not set
753# CONFIG_FB_VIA is not set
694# CONFIG_FB_NEOMAGIC is not set 754# CONFIG_FB_NEOMAGIC is not set
695# CONFIG_FB_KYRO is not set 755# CONFIG_FB_KYRO is not set
696# CONFIG_FB_3DFX is not set 756# CONFIG_FB_3DFX is not set
@@ -698,7 +758,16 @@ CONFIG_FB_STI=y
698# CONFIG_FB_VT8623 is not set 758# CONFIG_FB_VT8623 is not set
699# CONFIG_FB_TRIDENT is not set 759# CONFIG_FB_TRIDENT is not set
700# CONFIG_FB_ARK is not set 760# CONFIG_FB_ARK is not set
761# CONFIG_FB_CARMINE is not set
701# CONFIG_FB_VIRTUAL is not set 762# CONFIG_FB_VIRTUAL is not set
763# CONFIG_FB_METRONOME is not set
764# CONFIG_FB_MB862XX is not set
765# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
766
767#
768# Display device support
769#
770# CONFIG_DISPLAY_SUPPORT is not set
702 771
703# 772#
704# Console display driver support 773# Console display driver support
@@ -718,15 +787,8 @@ CONFIG_LOGO_LINUX_MONO=y
718CONFIG_LOGO_LINUX_VGA16=y 787CONFIG_LOGO_LINUX_VGA16=y
719CONFIG_LOGO_LINUX_CLUT224=y 788CONFIG_LOGO_LINUX_CLUT224=y
720CONFIG_LOGO_PARISC_CLUT224=y 789CONFIG_LOGO_PARISC_CLUT224=y
721
722#
723# Sound
724#
725CONFIG_SOUND=y 790CONFIG_SOUND=y
726 791CONFIG_SOUND_OSS_CORE=y
727#
728# Advanced Linux Sound Architecture
729#
730CONFIG_SND=y 792CONFIG_SND=y
731CONFIG_SND_TIMER=y 793CONFIG_SND_TIMER=y
732CONFIG_SND_PCM=y 794CONFIG_SND_PCM=y
@@ -742,10 +804,7 @@ CONFIG_SND_SUPPORT_OLD_API=y
742CONFIG_SND_VERBOSE_PROCFS=y 804CONFIG_SND_VERBOSE_PROCFS=y
743# CONFIG_SND_VERBOSE_PRINTK is not set 805# CONFIG_SND_VERBOSE_PRINTK is not set
744# CONFIG_SND_DEBUG is not set 806# CONFIG_SND_DEBUG is not set
745 807CONFIG_SND_DRIVERS=y
746#
747# Generic devices
748#
749# CONFIG_SND_DUMMY is not set 808# CONFIG_SND_DUMMY is not set
750# CONFIG_SND_VIRMIDI is not set 809# CONFIG_SND_VIRMIDI is not set
751# CONFIG_SND_MTPAV is not set 810# CONFIG_SND_MTPAV is not set
@@ -753,10 +812,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
753# CONFIG_SND_SERIAL_U16550 is not set 812# CONFIG_SND_SERIAL_U16550 is not set
754# CONFIG_SND_MPU401 is not set 813# CONFIG_SND_MPU401 is not set
755# CONFIG_SND_PORTMAN2X4 is not set 814# CONFIG_SND_PORTMAN2X4 is not set
756 815CONFIG_SND_PCI=y
757#
758# PCI devices
759#
760# CONFIG_SND_AD1889 is not set 816# CONFIG_SND_AD1889 is not set
761# CONFIG_SND_ALS300 is not set 817# CONFIG_SND_ALS300 is not set
762# CONFIG_SND_ALI5451 is not set 818# CONFIG_SND_ALI5451 is not set
@@ -765,9 +821,11 @@ CONFIG_SND_VERBOSE_PROCFS=y
765# CONFIG_SND_AU8810 is not set 821# CONFIG_SND_AU8810 is not set
766# CONFIG_SND_AU8820 is not set 822# CONFIG_SND_AU8820 is not set
767# CONFIG_SND_AU8830 is not set 823# CONFIG_SND_AU8830 is not set
824# CONFIG_SND_AW2 is not set
768# CONFIG_SND_BT87X is not set 825# CONFIG_SND_BT87X is not set
769# CONFIG_SND_CA0106 is not set 826# CONFIG_SND_CA0106 is not set
770# CONFIG_SND_CMIPCI is not set 827# CONFIG_SND_CMIPCI is not set
828# CONFIG_SND_OXYGEN is not set
771# CONFIG_SND_CS4281 is not set 829# CONFIG_SND_CS4281 is not set
772# CONFIG_SND_CS46XX is not set 830# CONFIG_SND_CS46XX is not set
773# CONFIG_SND_DARLA20 is not set 831# CONFIG_SND_DARLA20 is not set
@@ -792,6 +850,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
792# CONFIG_SND_HDA_INTEL is not set 850# CONFIG_SND_HDA_INTEL is not set
793# CONFIG_SND_HDSP is not set 851# CONFIG_SND_HDSP is not set
794# CONFIG_SND_HDSPM is not set 852# CONFIG_SND_HDSPM is not set
853# CONFIG_SND_HIFIER is not set
795# CONFIG_SND_ICE1712 is not set 854# CONFIG_SND_ICE1712 is not set
796# CONFIG_SND_ICE1724 is not set 855# CONFIG_SND_ICE1724 is not set
797# CONFIG_SND_INTEL8X0 is not set 856# CONFIG_SND_INTEL8X0 is not set
@@ -809,30 +868,23 @@ CONFIG_SND_VERBOSE_PROCFS=y
809# CONFIG_SND_TRIDENT is not set 868# CONFIG_SND_TRIDENT is not set
810# CONFIG_SND_VIA82XX is not set 869# CONFIG_SND_VIA82XX is not set
811# CONFIG_SND_VIA82XX_MODEM is not set 870# CONFIG_SND_VIA82XX_MODEM is not set
871# CONFIG_SND_VIRTUOSO is not set
812# CONFIG_SND_VX222 is not set 872# CONFIG_SND_VX222 is not set
813# CONFIG_SND_YMFPCI is not set 873# CONFIG_SND_YMFPCI is not set
814 874CONFIG_SND_GSC=y
815#
816# GSC devices
817#
818CONFIG_SND_HARMONY=y 875CONFIG_SND_HARMONY=y
819
820#
821# System on Chip audio support
822#
823# CONFIG_SND_SOC is not set 876# CONFIG_SND_SOC is not set
824
825#
826# SoC Audio support for SuperH
827#
828
829#
830# Open Sound System
831#
832# CONFIG_SOUND_PRIME is not set 877# CONFIG_SOUND_PRIME is not set
833CONFIG_HID_SUPPORT=y 878CONFIG_HID_SUPPORT=y
834CONFIG_HID=y 879CONFIG_HID=y
835CONFIG_HID_DEBUG=y 880CONFIG_HID_DEBUG=y
881# CONFIG_HIDRAW is not set
882# CONFIG_HID_PID is not set
883
884#
885# Special HID drivers
886#
887CONFIG_HID_COMPAT=y
836CONFIG_USB_SUPPORT=y 888CONFIG_USB_SUPPORT=y
837CONFIG_USB_ARCH_HAS_HCD=y 889CONFIG_USB_ARCH_HAS_HCD=y
838CONFIG_USB_ARCH_HAS_OHCI=y 890CONFIG_USB_ARCH_HAS_OHCI=y
@@ -840,36 +892,63 @@ CONFIG_USB_ARCH_HAS_EHCI=y
840# CONFIG_USB is not set 892# CONFIG_USB is not set
841 893
842# 894#
843# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 895# Enable Host or Gadget support to see Inventra options
844# 896#
845 897
846# 898#
847# USB Gadget Support 899# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
848# 900#
849# CONFIG_USB_GADGET is not set 901# CONFIG_USB_GADGET is not set
902
903#
904# OTG and related infrastructure
905#
850# CONFIG_MMC is not set 906# CONFIG_MMC is not set
907# CONFIG_MEMSTICK is not set
851# CONFIG_NEW_LEDS is not set 908# CONFIG_NEW_LEDS is not set
909# CONFIG_ACCESSIBILITY is not set
852# CONFIG_INFINIBAND is not set 910# CONFIG_INFINIBAND is not set
853# CONFIG_RTC_CLASS is not set 911CONFIG_RTC_LIB=y
912CONFIG_RTC_CLASS=y
913CONFIG_RTC_HCTOSYS=y
914CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
915# CONFIG_RTC_DEBUG is not set
854 916
855# 917#
856# DMA Engine support 918# RTC interfaces
857# 919#
858# CONFIG_DMA_ENGINE is not set 920CONFIG_RTC_INTF_SYSFS=y
921CONFIG_RTC_INTF_PROC=y
922CONFIG_RTC_INTF_DEV=y
923# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
924# CONFIG_RTC_DRV_TEST is not set
859 925
860# 926#
861# DMA Clients 927# SPI RTC drivers
862# 928#
863 929
864# 930#
865# DMA Devices 931# Platform RTC drivers
866# 932#
867# CONFIG_AUXDISPLAY is not set 933# CONFIG_RTC_DRV_DS1286 is not set
934# CONFIG_RTC_DRV_DS1511 is not set
935# CONFIG_RTC_DRV_DS1553 is not set
936# CONFIG_RTC_DRV_DS1742 is not set
937# CONFIG_RTC_DRV_STK17TA8 is not set
938# CONFIG_RTC_DRV_M48T86 is not set
939# CONFIG_RTC_DRV_M48T35 is not set
940# CONFIG_RTC_DRV_M48T59 is not set
941# CONFIG_RTC_DRV_BQ4802 is not set
942# CONFIG_RTC_DRV_V3020 is not set
868 943
869# 944#
870# Userspace I/O 945# on-CPU RTC drivers
871# 946#
947CONFIG_RTC_DRV_PARISC=y
948# CONFIG_DMADEVICES is not set
949# CONFIG_AUXDISPLAY is not set
872# CONFIG_UIO is not set 950# CONFIG_UIO is not set
951# CONFIG_STAGING is not set
873 952
874# 953#
875# File systems 954# File systems
@@ -879,19 +958,18 @@ CONFIG_EXT2_FS=y
879# CONFIG_EXT2_FS_XIP is not set 958# CONFIG_EXT2_FS_XIP is not set
880CONFIG_EXT3_FS=y 959CONFIG_EXT3_FS=y
881# CONFIG_EXT3_FS_XATTR is not set 960# CONFIG_EXT3_FS_XATTR is not set
961# CONFIG_EXT4_FS is not set
882CONFIG_JBD=y 962CONFIG_JBD=y
883# CONFIG_JBD_DEBUG is not set
884# CONFIG_REISERFS_FS is not set 963# CONFIG_REISERFS_FS is not set
885# CONFIG_JFS_FS is not set 964# CONFIG_JFS_FS is not set
886# CONFIG_FS_POSIX_ACL is not set 965# CONFIG_FS_POSIX_ACL is not set
966CONFIG_FILE_LOCKING=y
887# CONFIG_XFS_FS is not set 967# CONFIG_XFS_FS is not set
888# CONFIG_OCFS2_FS is not set 968# CONFIG_OCFS2_FS is not set
889# CONFIG_MINIX_FS is not set 969CONFIG_DNOTIFY=y
890# CONFIG_ROMFS_FS is not set
891CONFIG_INOTIFY=y 970CONFIG_INOTIFY=y
892CONFIG_INOTIFY_USER=y 971CONFIG_INOTIFY_USER=y
893# CONFIG_QUOTA is not set 972# CONFIG_QUOTA is not set
894CONFIG_DNOTIFY=y
895# CONFIG_AUTOFS_FS is not set 973# CONFIG_AUTOFS_FS is not set
896CONFIG_AUTOFS4_FS=y 974CONFIG_AUTOFS4_FS=y
897# CONFIG_FUSE_FS is not set 975# CONFIG_FUSE_FS is not set
@@ -917,35 +995,32 @@ CONFIG_JOLIET=y
917CONFIG_PROC_FS=y 995CONFIG_PROC_FS=y
918CONFIG_PROC_KCORE=y 996CONFIG_PROC_KCORE=y
919CONFIG_PROC_SYSCTL=y 997CONFIG_PROC_SYSCTL=y
998CONFIG_PROC_PAGE_MONITOR=y
920CONFIG_SYSFS=y 999CONFIG_SYSFS=y
921CONFIG_TMPFS=y 1000CONFIG_TMPFS=y
922# CONFIG_TMPFS_POSIX_ACL is not set 1001# CONFIG_TMPFS_POSIX_ACL is not set
923# CONFIG_HUGETLB_PAGE is not set 1002# CONFIG_HUGETLB_PAGE is not set
924CONFIG_RAMFS=y 1003# CONFIG_CONFIGFS_FS is not set
925 1004CONFIG_MISC_FILESYSTEMS=y
926#
927# Miscellaneous filesystems
928#
929# CONFIG_HFSPLUS_FS is not set 1005# CONFIG_HFSPLUS_FS is not set
930# CONFIG_CRAMFS is not set 1006# CONFIG_CRAMFS is not set
1007# CONFIG_SQUASHFS is not set
931# CONFIG_VXFS_FS is not set 1008# CONFIG_VXFS_FS is not set
1009# CONFIG_MINIX_FS is not set
1010# CONFIG_OMFS_FS is not set
932# CONFIG_HPFS_FS is not set 1011# CONFIG_HPFS_FS is not set
933# CONFIG_QNX4FS_FS is not set 1012# CONFIG_QNX4FS_FS is not set
1013# CONFIG_ROMFS_FS is not set
934# CONFIG_SYSV_FS is not set 1014# CONFIG_SYSV_FS is not set
935# CONFIG_UFS_FS is not set 1015# CONFIG_UFS_FS is not set
936 1016CONFIG_NETWORK_FILESYSTEMS=y
937#
938# Network File Systems
939#
940CONFIG_NFS_FS=y 1017CONFIG_NFS_FS=y
941CONFIG_NFS_V3=y 1018CONFIG_NFS_V3=y
942# CONFIG_NFS_V3_ACL is not set 1019# CONFIG_NFS_V3_ACL is not set
943# CONFIG_NFS_DIRECTIO is not set 1020CONFIG_ROOT_NFS=y
944CONFIG_NFSD=y 1021CONFIG_NFSD=y
945CONFIG_NFSD_V3=y 1022CONFIG_NFSD_V3=y
946# CONFIG_NFSD_V3_ACL is not set 1023# CONFIG_NFSD_V3_ACL is not set
947CONFIG_NFSD_TCP=y
948CONFIG_ROOT_NFS=y
949CONFIG_LOCKD=y 1024CONFIG_LOCKD=y
950CONFIG_LOCKD_V4=y 1025CONFIG_LOCKD_V4=y
951CONFIG_EXPORTFS=y 1026CONFIG_EXPORTFS=y
@@ -962,10 +1037,6 @@ CONFIG_SMB_FS=y
962# 1037#
963# CONFIG_PARTITION_ADVANCED is not set 1038# CONFIG_PARTITION_ADVANCED is not set
964CONFIG_MSDOS_PARTITION=y 1039CONFIG_MSDOS_PARTITION=y
965
966#
967# Native Language Support
968#
969CONFIG_NLS=y 1040CONFIG_NLS=y
970CONFIG_NLS_DEFAULT="iso8859-1" 1041CONFIG_NLS_DEFAULT="iso8859-1"
971CONFIG_NLS_CODEPAGE_437=m 1042CONFIG_NLS_CODEPAGE_437=m
@@ -1011,7 +1082,9 @@ CONFIG_NLS_UTF8=m
1011# Kernel hacking 1082# Kernel hacking
1012# 1083#
1013# CONFIG_PRINTK_TIME is not set 1084# CONFIG_PRINTK_TIME is not set
1085CONFIG_ENABLE_WARN_DEPRECATED=y
1014CONFIG_ENABLE_MUST_CHECK=y 1086CONFIG_ENABLE_MUST_CHECK=y
1087CONFIG_FRAME_WARN=1024
1015CONFIG_MAGIC_SYSRQ=y 1088CONFIG_MAGIC_SYSRQ=y
1016# CONFIG_UNUSED_SYMBOLS is not set 1089# CONFIG_UNUSED_SYMBOLS is not set
1017# CONFIG_DEBUG_FS is not set 1090# CONFIG_DEBUG_FS is not set
@@ -1019,9 +1092,12 @@ CONFIG_HEADERS_CHECK=y
1019CONFIG_DEBUG_KERNEL=y 1092CONFIG_DEBUG_KERNEL=y
1020# CONFIG_DEBUG_SHIRQ is not set 1093# CONFIG_DEBUG_SHIRQ is not set
1021CONFIG_DETECT_SOFTLOCKUP=y 1094CONFIG_DETECT_SOFTLOCKUP=y
1095# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1096CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1022CONFIG_SCHED_DEBUG=y 1097CONFIG_SCHED_DEBUG=y
1023# CONFIG_SCHEDSTATS is not set 1098# CONFIG_SCHEDSTATS is not set
1024# CONFIG_TIMER_STATS is not set 1099# CONFIG_TIMER_STATS is not set
1100# CONFIG_DEBUG_OBJECTS is not set
1025# CONFIG_DEBUG_SLAB is not set 1101# CONFIG_DEBUG_SLAB is not set
1026# CONFIG_DEBUG_RT_MUTEXES is not set 1102# CONFIG_DEBUG_RT_MUTEXES is not set
1027# CONFIG_RT_MUTEX_TESTER is not set 1103# CONFIG_RT_MUTEX_TESTER is not set
@@ -1033,10 +1109,29 @@ CONFIG_SCHED_DEBUG=y
1033CONFIG_DEBUG_BUGVERBOSE=y 1109CONFIG_DEBUG_BUGVERBOSE=y
1034# CONFIG_DEBUG_INFO is not set 1110# CONFIG_DEBUG_INFO is not set
1035# CONFIG_DEBUG_VM is not set 1111# CONFIG_DEBUG_VM is not set
1112# CONFIG_DEBUG_WRITECOUNT is not set
1113CONFIG_DEBUG_MEMORY_INIT=y
1036# CONFIG_DEBUG_LIST is not set 1114# CONFIG_DEBUG_LIST is not set
1037CONFIG_FORCED_INLINING=y 1115# CONFIG_DEBUG_SG is not set
1116# CONFIG_DEBUG_NOTIFIERS is not set
1117# CONFIG_BOOT_PRINTK_DELAY is not set
1038# CONFIG_RCU_TORTURE_TEST is not set 1118# CONFIG_RCU_TORTURE_TEST is not set
1119# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1120# CONFIG_BACKTRACE_SELF_TEST is not set
1121# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1039# CONFIG_FAULT_INJECTION is not set 1122# CONFIG_FAULT_INJECTION is not set
1123# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1124
1125#
1126# Tracers
1127#
1128# CONFIG_SCHED_TRACER is not set
1129# CONFIG_CONTEXT_SWITCH_TRACER is not set
1130# CONFIG_BOOT_TRACER is not set
1131# CONFIG_TRACE_BRANCH_PROFILING is not set
1132# CONFIG_BUILD_DOCSRC is not set
1133# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1134# CONFIG_SAMPLES is not set
1040# CONFIG_DEBUG_RODATA is not set 1135# CONFIG_DEBUG_RODATA is not set
1041 1136
1042# 1137#
@@ -1044,52 +1139,108 @@ CONFIG_FORCED_INLINING=y
1044# 1139#
1045# CONFIG_KEYS is not set 1140# CONFIG_KEYS is not set
1046CONFIG_SECURITY=y 1141CONFIG_SECURITY=y
1142# CONFIG_SECURITYFS is not set
1047# CONFIG_SECURITY_NETWORK is not set 1143# CONFIG_SECURITY_NETWORK is not set
1048CONFIG_SECURITY_CAPABILITIES=y 1144# CONFIG_SECURITY_PATH is not set
1145# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1146CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1049CONFIG_CRYPTO=y 1147CONFIG_CRYPTO=y
1148
1149#
1150# Crypto core or helper
1151#
1152# CONFIG_CRYPTO_FIPS is not set
1050CONFIG_CRYPTO_ALGAPI=y 1153CONFIG_CRYPTO_ALGAPI=y
1154CONFIG_CRYPTO_ALGAPI2=y
1155CONFIG_CRYPTO_AEAD2=y
1051CONFIG_CRYPTO_BLKCIPHER=y 1156CONFIG_CRYPTO_BLKCIPHER=y
1157CONFIG_CRYPTO_BLKCIPHER2=y
1158CONFIG_CRYPTO_HASH2=y
1159CONFIG_CRYPTO_RNG2=y
1052CONFIG_CRYPTO_MANAGER=y 1160CONFIG_CRYPTO_MANAGER=y
1053# CONFIG_CRYPTO_HMAC is not set 1161CONFIG_CRYPTO_MANAGER2=y
1054# CONFIG_CRYPTO_NULL is not set 1162# CONFIG_CRYPTO_NULL is not set
1163# CONFIG_CRYPTO_CRYPTD is not set
1164# CONFIG_CRYPTO_AUTHENC is not set
1165# CONFIG_CRYPTO_TEST is not set
1166
1167#
1168# Authenticated Encryption with Associated Data
1169#
1170# CONFIG_CRYPTO_CCM is not set
1171# CONFIG_CRYPTO_GCM is not set
1172# CONFIG_CRYPTO_SEQIV is not set
1173
1174#
1175# Block modes
1176#
1177CONFIG_CRYPTO_CBC=y
1178# CONFIG_CRYPTO_CTR is not set
1179# CONFIG_CRYPTO_CTS is not set
1180# CONFIG_CRYPTO_ECB is not set
1181# CONFIG_CRYPTO_PCBC is not set
1182
1183#
1184# Hash modes
1185#
1186# CONFIG_CRYPTO_HMAC is not set
1187
1188#
1189# Digest
1190#
1191# CONFIG_CRYPTO_CRC32C is not set
1055# CONFIG_CRYPTO_MD4 is not set 1192# CONFIG_CRYPTO_MD4 is not set
1056# CONFIG_CRYPTO_MD5 is not set 1193# CONFIG_CRYPTO_MD5 is not set
1194# CONFIG_CRYPTO_MICHAEL_MIC is not set
1195# CONFIG_CRYPTO_RMD128 is not set
1196# CONFIG_CRYPTO_RMD160 is not set
1197# CONFIG_CRYPTO_RMD256 is not set
1198# CONFIG_CRYPTO_RMD320 is not set
1057# CONFIG_CRYPTO_SHA1 is not set 1199# CONFIG_CRYPTO_SHA1 is not set
1058# CONFIG_CRYPTO_SHA256 is not set 1200# CONFIG_CRYPTO_SHA256 is not set
1059# CONFIG_CRYPTO_SHA512 is not set 1201# CONFIG_CRYPTO_SHA512 is not set
1060# CONFIG_CRYPTO_WP512 is not set
1061# CONFIG_CRYPTO_TGR192 is not set 1202# CONFIG_CRYPTO_TGR192 is not set
1062# CONFIG_CRYPTO_ECB is not set 1203# CONFIG_CRYPTO_WP512 is not set
1063CONFIG_CRYPTO_CBC=y 1204
1064# CONFIG_CRYPTO_PCBC is not set 1205#
1065# CONFIG_CRYPTO_CRYPTD is not set 1206# Ciphers
1066# CONFIG_CRYPTO_DES is not set 1207#
1067# CONFIG_CRYPTO_FCRYPT is not set
1068# CONFIG_CRYPTO_BLOWFISH is not set
1069# CONFIG_CRYPTO_TWOFISH is not set
1070# CONFIG_CRYPTO_SERPENT is not set
1071# CONFIG_CRYPTO_AES is not set 1208# CONFIG_CRYPTO_AES is not set
1209# CONFIG_CRYPTO_ANUBIS is not set
1210# CONFIG_CRYPTO_ARC4 is not set
1211# CONFIG_CRYPTO_BLOWFISH is not set
1212# CONFIG_CRYPTO_CAMELLIA is not set
1072# CONFIG_CRYPTO_CAST5 is not set 1213# CONFIG_CRYPTO_CAST5 is not set
1073# CONFIG_CRYPTO_CAST6 is not set 1214# CONFIG_CRYPTO_CAST6 is not set
1074# CONFIG_CRYPTO_TEA is not set 1215# CONFIG_CRYPTO_DES is not set
1075# CONFIG_CRYPTO_ARC4 is not set 1216# CONFIG_CRYPTO_FCRYPT is not set
1076# CONFIG_CRYPTO_KHAZAD is not set 1217# CONFIG_CRYPTO_KHAZAD is not set
1077# CONFIG_CRYPTO_ANUBIS is not set
1078# CONFIG_CRYPTO_SEED is not set 1218# CONFIG_CRYPTO_SEED is not set
1219# CONFIG_CRYPTO_SERPENT is not set
1220# CONFIG_CRYPTO_TEA is not set
1221# CONFIG_CRYPTO_TWOFISH is not set
1222
1223#
1224# Compression
1225#
1079# CONFIG_CRYPTO_DEFLATE is not set 1226# CONFIG_CRYPTO_DEFLATE is not set
1080# CONFIG_CRYPTO_MICHAEL_MIC is not set 1227# CONFIG_CRYPTO_LZO is not set
1081# CONFIG_CRYPTO_CRC32C is not set 1228
1082# CONFIG_CRYPTO_CAMELLIA is not set 1229#
1083# CONFIG_CRYPTO_TEST is not set 1230# Random Number Generation
1084# CONFIG_CRYPTO_AUTHENC is not set 1231#
1232# CONFIG_CRYPTO_ANSI_CPRNG is not set
1085CONFIG_CRYPTO_HW=y 1233CONFIG_CRYPTO_HW=y
1234# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1086 1235
1087# 1236#
1088# Library routines 1237# Library routines
1089# 1238#
1090CONFIG_BITREVERSE=y 1239CONFIG_BITREVERSE=y
1240CONFIG_GENERIC_FIND_LAST_BIT=y
1091# CONFIG_CRC_CCITT is not set 1241# CONFIG_CRC_CCITT is not set
1092# CONFIG_CRC16 is not set 1242# CONFIG_CRC16 is not set
1243# CONFIG_CRC_T10DIF is not set
1093# CONFIG_CRC_ITU_T is not set 1244# CONFIG_CRC_ITU_T is not set
1094CONFIG_CRC32=y 1245CONFIG_CRC32=y
1095# CONFIG_CRC7 is not set 1246# CONFIG_CRC7 is not set
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index c6def3c1d209..0aa8014f758c 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23 3# Linux kernel version: 2.6.29-rc8
4# Fri Oct 12 21:24:00 2007 4# Fri Mar 13 01:32:58 2009
5# 5#
6CONFIG_PARISC=y 6CONFIG_PARISC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -33,16 +33,29 @@ CONFIG_SYSVIPC_SYSCTL=y
33# CONFIG_POSIX_MQUEUE is not set 33# CONFIG_POSIX_MQUEUE is not set
34# CONFIG_BSD_PROCESS_ACCT is not set 34# CONFIG_BSD_PROCESS_ACCT is not set
35# CONFIG_TASKSTATS is not set 35# CONFIG_TASKSTATS is not set
36# CONFIG_USER_NS is not set
37# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
37
38#
39# RCU Subsystem
40#
41CONFIG_CLASSIC_RCU=y
42# CONFIG_TREE_RCU is not set
43# CONFIG_PREEMPT_RCU is not set
44# CONFIG_TREE_RCU_TRACE is not set
45# CONFIG_PREEMPT_RCU_TRACE is not set
38CONFIG_IKCONFIG=y 46CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y 47CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=16 48CONFIG_LOG_BUF_SHIFT=16
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_CGROUPS is not set
41CONFIG_SYSFS_DEPRECATED=y 51CONFIG_SYSFS_DEPRECATED=y
52CONFIG_SYSFS_DEPRECATED_V2=y
42# CONFIG_RELAY is not set 53# CONFIG_RELAY is not set
54# CONFIG_NAMESPACES is not set
43# CONFIG_BLK_DEV_INITRD is not set 55# CONFIG_BLK_DEV_INITRD is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 56# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y 57CONFIG_SYSCTL=y
58CONFIG_ANON_INODES=y
46CONFIG_EMBEDDED=y 59CONFIG_EMBEDDED=y
47CONFIG_SYSCTL_SYSCALL=y 60CONFIG_SYSCTL_SYSCALL=y
48CONFIG_KALLSYMS=y 61CONFIG_KALLSYMS=y
@@ -54,29 +67,39 @@ CONFIG_BUG=y
54CONFIG_ELF_CORE=y 67CONFIG_ELF_CORE=y
55CONFIG_BASE_FULL=y 68CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 69CONFIG_FUTEX=y
57CONFIG_ANON_INODES=y
58CONFIG_EPOLL=y 70CONFIG_EPOLL=y
59CONFIG_SIGNALFD=y 71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
60CONFIG_EVENTFD=y 73CONFIG_EVENTFD=y
61CONFIG_SHMEM=y 74CONFIG_SHMEM=y
75CONFIG_AIO=y
62CONFIG_VM_EVENT_COUNTERS=y 76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_PCI_QUIRKS=y
78CONFIG_COMPAT_BRK=y
63CONFIG_SLAB=y 79CONFIG_SLAB=y
64# CONFIG_SLUB is not set 80# CONFIG_SLUB is not set
65# CONFIG_SLOB is not set 81# CONFIG_SLOB is not set
82CONFIG_PROFILING=y
83CONFIG_TRACEPOINTS=y
84# CONFIG_MARKERS is not set
85CONFIG_OPROFILE=m
86CONFIG_HAVE_OPROFILE=y
87# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
88CONFIG_SLABINFO=y
66CONFIG_RT_MUTEXES=y 89CONFIG_RT_MUTEXES=y
67# CONFIG_TINY_SHMEM is not set
68CONFIG_BASE_SMALL=0 90CONFIG_BASE_SMALL=0
69CONFIG_MODULES=y 91CONFIG_MODULES=y
92# CONFIG_MODULE_FORCE_LOAD is not set
70CONFIG_MODULE_UNLOAD=y 93CONFIG_MODULE_UNLOAD=y
71CONFIG_MODULE_FORCE_UNLOAD=y 94CONFIG_MODULE_FORCE_UNLOAD=y
72# CONFIG_MODVERSIONS is not set 95# CONFIG_MODVERSIONS is not set
73# CONFIG_MODULE_SRCVERSION_ALL is not set 96# CONFIG_MODULE_SRCVERSION_ALL is not set
74CONFIG_KMOD=y 97CONFIG_INIT_ALL_POSSIBLE=y
75CONFIG_BLOCK=y 98CONFIG_BLOCK=y
76# CONFIG_LBD is not set 99# CONFIG_LBD is not set
77# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
78# CONFIG_LSF is not set
79# CONFIG_BLK_DEV_BSG is not set 101# CONFIG_BLK_DEV_BSG is not set
102# CONFIG_BLK_DEV_INTEGRITY is not set
80 103
81# 104#
82# IO Schedulers 105# IO Schedulers
@@ -90,6 +113,7 @@ CONFIG_DEFAULT_AS=y
90# CONFIG_DEFAULT_CFQ is not set 113# CONFIG_DEFAULT_CFQ is not set
91# CONFIG_DEFAULT_NOOP is not set 114# CONFIG_DEFAULT_NOOP is not set
92CONFIG_DEFAULT_IOSCHED="anticipatory" 115CONFIG_DEFAULT_IOSCHED="anticipatory"
116# CONFIG_FREEZER is not set
93 117
94# 118#
95# Processor type and features 119# Processor type and features
@@ -115,17 +139,19 @@ CONFIG_HZ_250=y
115# CONFIG_HZ_300 is not set 139# CONFIG_HZ_300 is not set
116# CONFIG_HZ_1000 is not set 140# CONFIG_HZ_1000 is not set
117CONFIG_HZ=250 141CONFIG_HZ=250
142# CONFIG_SCHED_HRTICK is not set
118CONFIG_SELECT_MEMORY_MODEL=y 143CONFIG_SELECT_MEMORY_MODEL=y
119CONFIG_FLATMEM_MANUAL=y 144CONFIG_FLATMEM_MANUAL=y
120# CONFIG_DISCONTIGMEM_MANUAL is not set 145# CONFIG_DISCONTIGMEM_MANUAL is not set
121# CONFIG_SPARSEMEM_MANUAL is not set 146# CONFIG_SPARSEMEM_MANUAL is not set
122CONFIG_FLATMEM=y 147CONFIG_FLATMEM=y
123CONFIG_FLAT_NODE_MEM_MAP=y 148CONFIG_FLAT_NODE_MEM_MAP=y
124# CONFIG_SPARSEMEM_STATIC is not set 149CONFIG_PAGEFLAGS_EXTENDED=y
125CONFIG_SPLIT_PTLOCK_CPUS=4 150CONFIG_SPLIT_PTLOCK_CPUS=4
126# CONFIG_RESOURCES_64BIT is not set 151# CONFIG_PHYS_ADDR_T_64BIT is not set
127CONFIG_ZONE_DMA_FLAG=0 152CONFIG_ZONE_DMA_FLAG=0
128CONFIG_VIRT_TO_BUS=y 153CONFIG_VIRT_TO_BUS=y
154CONFIG_UNEVICTABLE_LRU=y
129# CONFIG_HPUX is not set 155# CONFIG_HPUX is not set
130 156
131# 157#
@@ -134,14 +160,13 @@ CONFIG_VIRT_TO_BUS=y
134# CONFIG_GSC is not set 160# CONFIG_GSC is not set
135CONFIG_PCI=y 161CONFIG_PCI=y
136# CONFIG_ARCH_SUPPORTS_MSI is not set 162# CONFIG_ARCH_SUPPORTS_MSI is not set
163CONFIG_PCI_LEGACY=y
137# CONFIG_PCI_DEBUG is not set 164# CONFIG_PCI_DEBUG is not set
165# CONFIG_PCI_STUB is not set
138CONFIG_PCI_LBA=y 166CONFIG_PCI_LBA=y
139CONFIG_IOSAPIC=y 167CONFIG_IOSAPIC=y
140CONFIG_IOMMU_SBA=y 168CONFIG_IOMMU_SBA=y
141 169CONFIG_IOMMU_HELPER=y
142#
143# PCCARD (PCMCIA/CardBus) support
144#
145# CONFIG_PCCARD is not set 170# CONFIG_PCCARD is not set
146# CONFIG_HOTPLUG_PCI is not set 171# CONFIG_HOTPLUG_PCI is not set
147 172
@@ -158,16 +183,15 @@ CONFIG_PDC_STABLE=y
158# Executable file formats 183# Executable file formats
159# 184#
160CONFIG_BINFMT_ELF=y 185CONFIG_BINFMT_ELF=y
186# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
187# CONFIG_HAVE_AOUT is not set
161# CONFIG_BINFMT_MISC is not set 188# CONFIG_BINFMT_MISC is not set
162
163#
164# Networking
165#
166CONFIG_NET=y 189CONFIG_NET=y
167 190
168# 191#
169# Networking options 192# Networking options
170# 193#
194CONFIG_COMPAT_NET_DEV_OPS=y
171CONFIG_PACKET=y 195CONFIG_PACKET=y
172CONFIG_PACKET_MMAP=y 196CONFIG_PACKET_MMAP=y
173CONFIG_UNIX=y 197CONFIG_UNIX=y
@@ -175,6 +199,8 @@ CONFIG_XFRM=y
175CONFIG_XFRM_USER=m 199CONFIG_XFRM_USER=m
176# CONFIG_XFRM_SUB_POLICY is not set 200# CONFIG_XFRM_SUB_POLICY is not set
177# CONFIG_XFRM_MIGRATE is not set 201# CONFIG_XFRM_MIGRATE is not set
202# CONFIG_XFRM_STATISTICS is not set
203CONFIG_XFRM_IPCOMP=m
178CONFIG_NET_KEY=m 204CONFIG_NET_KEY=m
179# CONFIG_NET_KEY_MIGRATE is not set 205# CONFIG_NET_KEY_MIGRATE is not set
180CONFIG_INET=y 206CONFIG_INET=y
@@ -204,7 +230,6 @@ CONFIG_INET_XFRM_MODE_BEET=y
204CONFIG_TCP_CONG_CUBIC=y 230CONFIG_TCP_CONG_CUBIC=y
205CONFIG_DEFAULT_TCP_CONG="cubic" 231CONFIG_DEFAULT_TCP_CONG="cubic"
206# CONFIG_TCP_MD5SIG is not set 232# CONFIG_TCP_MD5SIG is not set
207# CONFIG_IP_VS is not set
208CONFIG_IPV6=m 233CONFIG_IPV6=m
209# CONFIG_IPV6_PRIVACY is not set 234# CONFIG_IPV6_PRIVACY is not set
210# CONFIG_IPV6_ROUTER_PREF is not set 235# CONFIG_IPV6_ROUTER_PREF is not set
@@ -220,29 +245,34 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
220CONFIG_INET6_XFRM_MODE_BEET=m 245CONFIG_INET6_XFRM_MODE_BEET=m
221# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 246# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
222CONFIG_IPV6_SIT=m 247CONFIG_IPV6_SIT=m
248CONFIG_IPV6_NDISC_NODETYPE=y
223CONFIG_IPV6_TUNNEL=m 249CONFIG_IPV6_TUNNEL=m
224# CONFIG_IPV6_MULTIPLE_TABLES is not set 250# CONFIG_IPV6_MULTIPLE_TABLES is not set
251# CONFIG_IPV6_MROUTE is not set
225# CONFIG_NETWORK_SECMARK is not set 252# CONFIG_NETWORK_SECMARK is not set
226CONFIG_NETFILTER=y 253CONFIG_NETFILTER=y
227CONFIG_NETFILTER_DEBUG=y 254CONFIG_NETFILTER_DEBUG=y
255CONFIG_NETFILTER_ADVANCED=y
228 256
229# 257#
230# Core Netfilter Configuration 258# Core Netfilter Configuration
231# 259#
232# CONFIG_NETFILTER_NETLINK is not set 260# CONFIG_NETFILTER_NETLINK_QUEUE is not set
233# CONFIG_NF_CONNTRACK_ENABLED is not set 261# CONFIG_NETFILTER_NETLINK_LOG is not set
234# CONFIG_NF_CONNTRACK is not set 262# CONFIG_NF_CONNTRACK is not set
235# CONFIG_NETFILTER_XTABLES is not set 263# CONFIG_NETFILTER_XTABLES is not set
264# CONFIG_IP_VS is not set
236 265
237# 266#
238# IP: Netfilter Configuration 267# IP: Netfilter Configuration
239# 268#
269# CONFIG_NF_DEFRAG_IPV4 is not set
240CONFIG_IP_NF_QUEUE=m 270CONFIG_IP_NF_QUEUE=m
241# CONFIG_IP_NF_IPTABLES is not set 271# CONFIG_IP_NF_IPTABLES is not set
242# CONFIG_IP_NF_ARPTABLES is not set 272# CONFIG_IP_NF_ARPTABLES is not set
243 273
244# 274#
245# IPv6: Netfilter Configuration (EXPERIMENTAL) 275# IPv6: Netfilter Configuration
246# 276#
247# CONFIG_IP6_NF_QUEUE is not set 277# CONFIG_IP6_NF_QUEUE is not set
248# CONFIG_IP6_NF_IPTABLES is not set 278# CONFIG_IP6_NF_IPTABLES is not set
@@ -251,6 +281,7 @@ CONFIG_IP_NF_QUEUE=m
251# CONFIG_TIPC is not set 281# CONFIG_TIPC is not set
252# CONFIG_ATM is not set 282# CONFIG_ATM is not set
253# CONFIG_BRIDGE is not set 283# CONFIG_BRIDGE is not set
284# CONFIG_NET_DSA is not set
254# CONFIG_VLAN_8021Q is not set 285# CONFIG_VLAN_8021Q is not set
255# CONFIG_DECNET is not set 286# CONFIG_DECNET is not set
256# CONFIG_LLC2 is not set 287# CONFIG_LLC2 is not set
@@ -260,28 +291,26 @@ CONFIG_IP_NF_QUEUE=m
260# CONFIG_LAPB is not set 291# CONFIG_LAPB is not set
261# CONFIG_ECONET is not set 292# CONFIG_ECONET is not set
262# CONFIG_WAN_ROUTER is not set 293# CONFIG_WAN_ROUTER is not set
263
264#
265# QoS and/or fair queueing
266#
267# CONFIG_NET_SCHED is not set 294# CONFIG_NET_SCHED is not set
295# CONFIG_DCB is not set
268 296
269# 297#
270# Network testing 298# Network testing
271# 299#
272CONFIG_NET_PKTGEN=m 300CONFIG_NET_PKTGEN=m
273# CONFIG_HAMRADIO is not set 301# CONFIG_HAMRADIO is not set
302# CONFIG_CAN is not set
274# CONFIG_IRDA is not set 303# CONFIG_IRDA is not set
275# CONFIG_BT is not set 304# CONFIG_BT is not set
276# CONFIG_AF_RXRPC is not set 305# CONFIG_AF_RXRPC is not set
277 306# CONFIG_PHONET is not set
278# 307CONFIG_WIRELESS=y
279# Wireless
280#
281# CONFIG_CFG80211 is not set 308# CONFIG_CFG80211 is not set
309CONFIG_WIRELESS_OLD_REGULATORY=y
282# CONFIG_WIRELESS_EXT is not set 310# CONFIG_WIRELESS_EXT is not set
311# CONFIG_LIB80211 is not set
283# CONFIG_MAC80211 is not set 312# CONFIG_MAC80211 is not set
284# CONFIG_IEEE80211 is not set 313# CONFIG_WIMAX is not set
285# CONFIG_RFKILL is not set 314# CONFIG_RFKILL is not set
286# CONFIG_NET_9P is not set 315# CONFIG_NET_9P is not set
287 316
@@ -296,6 +325,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
296# CONFIG_STANDALONE is not set 325# CONFIG_STANDALONE is not set
297# CONFIG_PREVENT_FIRMWARE_BUILD is not set 326# CONFIG_PREVENT_FIRMWARE_BUILD is not set
298CONFIG_FW_LOADER=y 327CONFIG_FW_LOADER=y
328CONFIG_FIRMWARE_IN_KERNEL=y
329CONFIG_EXTRA_FIRMWARE=""
299# CONFIG_DEBUG_DRIVER is not set 330# CONFIG_DEBUG_DRIVER is not set
300# CONFIG_DEBUG_DEVRES is not set 331# CONFIG_DEBUG_DEVRES is not set
301# CONFIG_SYS_HYPERVISOR is not set 332# CONFIG_SYS_HYPERVISOR is not set
@@ -316,59 +347,62 @@ CONFIG_BLK_DEV_CRYPTOLOOP=m
316# CONFIG_BLK_DEV_RAM is not set 347# CONFIG_BLK_DEV_RAM is not set
317# CONFIG_CDROM_PKTCDVD is not set 348# CONFIG_CDROM_PKTCDVD is not set
318# CONFIG_ATA_OVER_ETH is not set 349# CONFIG_ATA_OVER_ETH is not set
350# CONFIG_BLK_DEV_HD is not set
319CONFIG_MISC_DEVICES=y 351CONFIG_MISC_DEVICES=y
320# CONFIG_PHANTOM is not set 352# CONFIG_PHANTOM is not set
321# CONFIG_EEPROM_93CX6 is not set
322# CONFIG_SGI_IOC4 is not set 353# CONFIG_SGI_IOC4 is not set
323# CONFIG_TIFM_CORE is not set 354# CONFIG_TIFM_CORE is not set
355# CONFIG_ENCLOSURE_SERVICES is not set
356# CONFIG_HP_ILO is not set
357# CONFIG_C2PORT is not set
358
359#
360# EEPROM support
361#
362# CONFIG_EEPROM_93CX6 is not set
363CONFIG_HAVE_IDE=y
324CONFIG_IDE=y 364CONFIG_IDE=y
325CONFIG_IDE_MAX_HWIFS=4
326CONFIG_BLK_DEV_IDE=y
327 365
328# 366#
329# Please see Documentation/ide.txt for help/info on IDE drives 367# Please see Documentation/ide/ide.txt for help/info on IDE drives
330# 368#
369CONFIG_IDE_ATAPI=y
331# CONFIG_BLK_DEV_IDE_SATA is not set 370# CONFIG_BLK_DEV_IDE_SATA is not set
332CONFIG_BLK_DEV_IDEDISK=m 371CONFIG_IDE_GD=y
333# CONFIG_IDEDISK_MULTI_MODE is not set 372CONFIG_IDE_GD_ATA=y
373# CONFIG_IDE_GD_ATAPI is not set
334CONFIG_BLK_DEV_IDECD=y 374CONFIG_BLK_DEV_IDECD=y
375CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
335# CONFIG_BLK_DEV_IDETAPE is not set 376# CONFIG_BLK_DEV_IDETAPE is not set
336# CONFIG_BLK_DEV_IDEFLOPPY is not set
337CONFIG_BLK_DEV_IDESCSI=y
338# CONFIG_IDE_TASK_IOCTL is not set 377# CONFIG_IDE_TASK_IOCTL is not set
339CONFIG_IDE_PROC_FS=y 378CONFIG_IDE_PROC_FS=y
340 379
341# 380#
342# IDE chipset support/bugfixes 381# IDE chipset support/bugfixes
343# 382#
344CONFIG_IDE_GENERIC=y
345# CONFIG_BLK_DEV_PLATFORM is not set 383# CONFIG_BLK_DEV_PLATFORM is not set
384CONFIG_BLK_DEV_IDEDMA_SFF=y
346 385
347# 386#
348# PCI IDE chipsets support 387# PCI IDE chipsets support
349# 388#
350CONFIG_BLK_DEV_IDEPCI=y 389CONFIG_BLK_DEV_IDEPCI=y
351CONFIG_IDEPCI_SHARE_IRQ=y
352CONFIG_IDEPCI_PCIBUS_ORDER=y 390CONFIG_IDEPCI_PCIBUS_ORDER=y
353# CONFIG_BLK_DEV_OFFBOARD is not set
354# CONFIG_BLK_DEV_GENERIC is not set 391# CONFIG_BLK_DEV_GENERIC is not set
355# CONFIG_BLK_DEV_OPTI621 is not set 392# CONFIG_BLK_DEV_OPTI621 is not set
356CONFIG_BLK_DEV_IDEDMA_PCI=y 393CONFIG_BLK_DEV_IDEDMA_PCI=y
357# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
358CONFIG_IDEDMA_ONLYDISK=y
359# CONFIG_BLK_DEV_AEC62XX is not set 394# CONFIG_BLK_DEV_AEC62XX is not set
360# CONFIG_BLK_DEV_ALI15X3 is not set 395# CONFIG_BLK_DEV_ALI15X3 is not set
361# CONFIG_BLK_DEV_AMD74XX is not set 396# CONFIG_BLK_DEV_AMD74XX is not set
362# CONFIG_BLK_DEV_CMD64X is not set 397# CONFIG_BLK_DEV_CMD64X is not set
363# CONFIG_BLK_DEV_TRIFLEX is not set 398# CONFIG_BLK_DEV_TRIFLEX is not set
364# CONFIG_BLK_DEV_CY82C693 is not set
365# CONFIG_BLK_DEV_CS5520 is not set 399# CONFIG_BLK_DEV_CS5520 is not set
366# CONFIG_BLK_DEV_CS5530 is not set 400# CONFIG_BLK_DEV_CS5530 is not set
367# CONFIG_BLK_DEV_HPT34X is not set
368# CONFIG_BLK_DEV_HPT366 is not set 401# CONFIG_BLK_DEV_HPT366 is not set
369# CONFIG_BLK_DEV_JMICRON is not set 402# CONFIG_BLK_DEV_JMICRON is not set
370# CONFIG_BLK_DEV_SC1200 is not set 403# CONFIG_BLK_DEV_SC1200 is not set
371# CONFIG_BLK_DEV_PIIX is not set 404# CONFIG_BLK_DEV_PIIX is not set
405# CONFIG_BLK_DEV_IT8172 is not set
372# CONFIG_BLK_DEV_IT8213 is not set 406# CONFIG_BLK_DEV_IT8213 is not set
373# CONFIG_BLK_DEV_IT821X is not set 407# CONFIG_BLK_DEV_IT821X is not set
374CONFIG_BLK_DEV_NS87415=y 408CONFIG_BLK_DEV_NS87415=y
@@ -380,10 +414,7 @@ CONFIG_BLK_DEV_SIIMAGE=m
380# CONFIG_BLK_DEV_TRM290 is not set 414# CONFIG_BLK_DEV_TRM290 is not set
381# CONFIG_BLK_DEV_VIA82CXXX is not set 415# CONFIG_BLK_DEV_VIA82CXXX is not set
382# CONFIG_BLK_DEV_TC86C001 is not set 416# CONFIG_BLK_DEV_TC86C001 is not set
383# CONFIG_IDE_ARM is not set
384CONFIG_BLK_DEV_IDEDMA=y 417CONFIG_BLK_DEV_IDEDMA=y
385# CONFIG_IDEDMA_IVB is not set
386# CONFIG_BLK_DEV_HD is not set
387 418
388# 419#
389# SCSI device support 420# SCSI device support
@@ -422,8 +453,10 @@ CONFIG_SCSI_SPI_ATTRS=y
422# CONFIG_SCSI_FC_ATTRS is not set 453# CONFIG_SCSI_FC_ATTRS is not set
423CONFIG_SCSI_ISCSI_ATTRS=m 454CONFIG_SCSI_ISCSI_ATTRS=m
424# CONFIG_SCSI_SAS_LIBSAS is not set 455# CONFIG_SCSI_SAS_LIBSAS is not set
456# CONFIG_SCSI_SRP_ATTRS is not set
425CONFIG_SCSI_LOWLEVEL=y 457CONFIG_SCSI_LOWLEVEL=y
426# CONFIG_ISCSI_TCP is not set 458# CONFIG_ISCSI_TCP is not set
459# CONFIG_SCSI_CXGB3_ISCSI is not set
427# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 460# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
428# CONFIG_SCSI_3W_9XXX is not set 461# CONFIG_SCSI_3W_9XXX is not set
429# CONFIG_SCSI_ACARD is not set 462# CONFIG_SCSI_ACARD is not set
@@ -433,16 +466,20 @@ CONFIG_SCSI_LOWLEVEL=y
433# CONFIG_SCSI_AIC79XX is not set 466# CONFIG_SCSI_AIC79XX is not set
434# CONFIG_SCSI_AIC94XX is not set 467# CONFIG_SCSI_AIC94XX is not set
435# CONFIG_SCSI_DPT_I2O is not set 468# CONFIG_SCSI_DPT_I2O is not set
469# CONFIG_SCSI_ADVANSYS is not set
436# CONFIG_SCSI_ARCMSR is not set 470# CONFIG_SCSI_ARCMSR is not set
437# CONFIG_MEGARAID_NEWGEN is not set 471# CONFIG_MEGARAID_NEWGEN is not set
438# CONFIG_MEGARAID_LEGACY is not set 472# CONFIG_MEGARAID_LEGACY is not set
439# CONFIG_MEGARAID_SAS is not set 473# CONFIG_MEGARAID_SAS is not set
440# CONFIG_SCSI_HPTIOP is not set 474# CONFIG_SCSI_HPTIOP is not set
475# CONFIG_LIBFC is not set
476# CONFIG_FCOE is not set
441# CONFIG_SCSI_DMX3191D is not set 477# CONFIG_SCSI_DMX3191D is not set
442# CONFIG_SCSI_FUTURE_DOMAIN is not set 478# CONFIG_SCSI_FUTURE_DOMAIN is not set
443# CONFIG_SCSI_IPS is not set 479# CONFIG_SCSI_IPS is not set
444# CONFIG_SCSI_INITIO is not set 480# CONFIG_SCSI_INITIO is not set
445# CONFIG_SCSI_INIA100 is not set 481# CONFIG_SCSI_INIA100 is not set
482# CONFIG_SCSI_MVSAS is not set
446# CONFIG_SCSI_STEX is not set 483# CONFIG_SCSI_STEX is not set
447CONFIG_SCSI_SYM53C8XX_2=y 484CONFIG_SCSI_SYM53C8XX_2=y
448CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 485CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
@@ -458,9 +495,11 @@ CONFIG_SCSI_SYM53C8XX_MMIO=y
458# CONFIG_SCSI_NSP32 is not set 495# CONFIG_SCSI_NSP32 is not set
459CONFIG_SCSI_DEBUG=m 496CONFIG_SCSI_DEBUG=m
460# CONFIG_SCSI_SRP is not set 497# CONFIG_SCSI_SRP is not set
498# CONFIG_SCSI_DH is not set
461# CONFIG_ATA is not set 499# CONFIG_ATA is not set
462CONFIG_MD=y 500CONFIG_MD=y
463CONFIG_BLK_DEV_MD=y 501CONFIG_BLK_DEV_MD=y
502CONFIG_MD_AUTODETECT=y
464CONFIG_MD_LINEAR=y 503CONFIG_MD_LINEAR=y
465CONFIG_MD_RAID0=y 504CONFIG_MD_RAID0=y
466CONFIG_MD_RAID1=y 505CONFIG_MD_RAID1=y
@@ -475,13 +514,8 @@ CONFIG_DM_SNAPSHOT=m
475CONFIG_DM_MIRROR=m 514CONFIG_DM_MIRROR=m
476CONFIG_DM_ZERO=m 515CONFIG_DM_ZERO=m
477CONFIG_DM_MULTIPATH=m 516CONFIG_DM_MULTIPATH=m
478# CONFIG_DM_MULTIPATH_EMC is not set
479# CONFIG_DM_MULTIPATH_RDAC is not set
480# CONFIG_DM_DELAY is not set 517# CONFIG_DM_DELAY is not set
481 518# CONFIG_DM_UEVENT is not set
482#
483# Fusion MPT device support
484#
485CONFIG_FUSION=y 519CONFIG_FUSION=y
486CONFIG_FUSION_SPI=m 520CONFIG_FUSION_SPI=m
487# CONFIG_FUSION_FC is not set 521# CONFIG_FUSION_FC is not set
@@ -493,20 +527,40 @@ CONFIG_FUSION_CTL=m
493# 527#
494# IEEE 1394 (FireWire) support 528# IEEE 1394 (FireWire) support
495# 529#
530
531#
532# Enable only one of the two stacks, unless you know what you are doing
533#
496# CONFIG_FIREWIRE is not set 534# CONFIG_FIREWIRE is not set
497# CONFIG_IEEE1394 is not set 535# CONFIG_IEEE1394 is not set
498# CONFIG_I2O is not set 536# CONFIG_I2O is not set
499CONFIG_NETDEVICES=y 537CONFIG_NETDEVICES=y
500# CONFIG_NETDEVICES_MULTIQUEUE is not set
501CONFIG_DUMMY=m 538CONFIG_DUMMY=m
502CONFIG_BONDING=m 539CONFIG_BONDING=m
503# CONFIG_MACVLAN is not set 540# CONFIG_MACVLAN is not set
504# CONFIG_EQUALIZER is not set 541# CONFIG_EQUALIZER is not set
505CONFIG_TUN=m 542CONFIG_TUN=m
506# CONFIG_VETH is not set 543# CONFIG_VETH is not set
507# CONFIG_IP1000 is not set
508# CONFIG_ARCNET is not set 544# CONFIG_ARCNET is not set
509# CONFIG_PHYLIB is not set 545CONFIG_PHYLIB=m
546
547#
548# MII PHY device drivers
549#
550# CONFIG_MARVELL_PHY is not set
551# CONFIG_DAVICOM_PHY is not set
552# CONFIG_QSEMI_PHY is not set
553# CONFIG_LXT_PHY is not set
554# CONFIG_CICADA_PHY is not set
555# CONFIG_VITESSE_PHY is not set
556# CONFIG_SMSC_PHY is not set
557# CONFIG_BROADCOM_PHY is not set
558# CONFIG_ICPLUS_PHY is not set
559# CONFIG_REALTEK_PHY is not set
560# CONFIG_NATIONAL_PHY is not set
561# CONFIG_STE10XP is not set
562# CONFIG_LSI_ET1011C_PHY is not set
563# CONFIG_MDIO_BITBANG is not set
510CONFIG_NET_ETHERNET=y 564CONFIG_NET_ETHERNET=y
511CONFIG_MII=m 565CONFIG_MII=m
512# CONFIG_HAPPYMEAL is not set 566# CONFIG_HAPPYMEAL is not set
@@ -528,33 +582,38 @@ CONFIG_TULIP_MMIO=y
528# CONFIG_IBM_NEW_EMAC_RGMII is not set 582# CONFIG_IBM_NEW_EMAC_RGMII is not set
529# CONFIG_IBM_NEW_EMAC_TAH is not set 583# CONFIG_IBM_NEW_EMAC_TAH is not set
530# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 584# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
585# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
586# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
587# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
531CONFIG_NET_PCI=y 588CONFIG_NET_PCI=y
532# CONFIG_PCNET32 is not set 589# CONFIG_PCNET32 is not set
533# CONFIG_AMD8111_ETH is not set 590# CONFIG_AMD8111_ETH is not set
534# CONFIG_ADAPTEC_STARFIRE is not set 591# CONFIG_ADAPTEC_STARFIRE is not set
535# CONFIG_B44 is not set 592# CONFIG_B44 is not set
536# CONFIG_FORCEDETH is not set 593# CONFIG_FORCEDETH is not set
537# CONFIG_EEPRO100 is not set
538CONFIG_E100=m 594CONFIG_E100=m
539# CONFIG_FEALNX is not set 595# CONFIG_FEALNX is not set
540# CONFIG_NATSEMI is not set 596# CONFIG_NATSEMI is not set
541# CONFIG_NE2K_PCI is not set 597# CONFIG_NE2K_PCI is not set
542# CONFIG_8139CP is not set 598# CONFIG_8139CP is not set
543# CONFIG_8139TOO is not set 599# CONFIG_8139TOO is not set
600# CONFIG_R6040 is not set
544# CONFIG_SIS900 is not set 601# CONFIG_SIS900 is not set
545# CONFIG_EPIC100 is not set 602# CONFIG_EPIC100 is not set
603# CONFIG_SMSC9420 is not set
546# CONFIG_SUNDANCE is not set 604# CONFIG_SUNDANCE is not set
547# CONFIG_TLAN is not set 605# CONFIG_TLAN is not set
548# CONFIG_VIA_RHINE is not set 606# CONFIG_VIA_RHINE is not set
549# CONFIG_SC92031 is not set 607# CONFIG_SC92031 is not set
608# CONFIG_ATL2 is not set
550CONFIG_NETDEV_1000=y 609CONFIG_NETDEV_1000=y
551CONFIG_ACENIC=m 610CONFIG_ACENIC=m
552# CONFIG_ACENIC_OMIT_TIGON_I is not set 611# CONFIG_ACENIC_OMIT_TIGON_I is not set
553# CONFIG_DL2K is not set 612# CONFIG_DL2K is not set
554CONFIG_E1000=m 613CONFIG_E1000=m
555# CONFIG_E1000_NAPI is not set
556# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
557# CONFIG_E1000E is not set 614# CONFIG_E1000E is not set
615# CONFIG_IP1000 is not set
616# CONFIG_IGB is not set
558# CONFIG_NS83820 is not set 617# CONFIG_NS83820 is not set
559# CONFIG_HAMACHI is not set 618# CONFIG_HAMACHI is not set
560# CONFIG_YELLOWFIN is not set 619# CONFIG_YELLOWFIN is not set
@@ -562,23 +621,31 @@ CONFIG_E1000=m
562# CONFIG_SIS190 is not set 621# CONFIG_SIS190 is not set
563# CONFIG_SKGE is not set 622# CONFIG_SKGE is not set
564# CONFIG_SKY2 is not set 623# CONFIG_SKY2 is not set
565# CONFIG_SK98LIN is not set
566# CONFIG_VIA_VELOCITY is not set 624# CONFIG_VIA_VELOCITY is not set
567CONFIG_TIGON3=m 625CONFIG_TIGON3=m
568# CONFIG_BNX2 is not set 626# CONFIG_BNX2 is not set
569# CONFIG_QLA3XXX is not set 627# CONFIG_QLA3XXX is not set
570# CONFIG_ATL1 is not set 628# CONFIG_ATL1 is not set
629# CONFIG_ATL1E is not set
630# CONFIG_ATL1C is not set
631# CONFIG_JME is not set
571CONFIG_NETDEV_10000=y 632CONFIG_NETDEV_10000=y
572# CONFIG_CHELSIO_T1 is not set 633# CONFIG_CHELSIO_T1 is not set
634CONFIG_CHELSIO_T3_DEPENDS=y
573# CONFIG_CHELSIO_T3 is not set 635# CONFIG_CHELSIO_T3 is not set
636# CONFIG_ENIC is not set
574# CONFIG_IXGBE is not set 637# CONFIG_IXGBE is not set
575# CONFIG_IXGB is not set 638# CONFIG_IXGB is not set
576# CONFIG_S2IO is not set 639# CONFIG_S2IO is not set
577# CONFIG_MYRI10GE is not set 640# CONFIG_MYRI10GE is not set
578# CONFIG_NETXEN_NIC is not set 641# CONFIG_NETXEN_NIC is not set
579# CONFIG_NIU is not set 642# CONFIG_NIU is not set
643# CONFIG_MLX4_EN is not set
580# CONFIG_MLX4_CORE is not set 644# CONFIG_MLX4_CORE is not set
581# CONFIG_TEHUTI is not set 645# CONFIG_TEHUTI is not set
646# CONFIG_BNX2X is not set
647# CONFIG_QLGE is not set
648# CONFIG_SFC is not set
582# CONFIG_TR is not set 649# CONFIG_TR is not set
583 650
584# 651#
@@ -586,6 +653,11 @@ CONFIG_NETDEV_10000=y
586# 653#
587# CONFIG_WLAN_PRE80211 is not set 654# CONFIG_WLAN_PRE80211 is not set
588# CONFIG_WLAN_80211 is not set 655# CONFIG_WLAN_80211 is not set
656# CONFIG_IWLWIFI_LEDS is not set
657
658#
659# Enable WiMAX (Networking options) to see the WiMAX drivers
660#
589 661
590# 662#
591# USB Network Adapters 663# USB Network Adapters
@@ -594,7 +666,6 @@ CONFIG_NETDEV_10000=y
594# CONFIG_USB_KAWETH is not set 666# CONFIG_USB_KAWETH is not set
595# CONFIG_USB_PEGASUS is not set 667# CONFIG_USB_PEGASUS is not set
596# CONFIG_USB_RTL8150 is not set 668# CONFIG_USB_RTL8150 is not set
597# CONFIG_USB_USBNET_MII is not set
598# CONFIG_USB_USBNET is not set 669# CONFIG_USB_USBNET is not set
599# CONFIG_WAN is not set 670# CONFIG_WAN is not set
600# CONFIG_FDDI is not set 671# CONFIG_FDDI is not set
@@ -612,7 +683,6 @@ CONFIG_PPPOE=m
612# CONFIG_SLIP is not set 683# CONFIG_SLIP is not set
613CONFIG_SLHC=m 684CONFIG_SLHC=m
614# CONFIG_NET_FC is not set 685# CONFIG_NET_FC is not set
615# CONFIG_SHAPER is not set
616# CONFIG_NETCONSOLE is not set 686# CONFIG_NETCONSOLE is not set
617# CONFIG_NETPOLL is not set 687# CONFIG_NETPOLL is not set
618# CONFIG_NET_POLL_CONTROLLER is not set 688# CONFIG_NET_POLL_CONTROLLER is not set
@@ -634,7 +704,6 @@ CONFIG_INPUT_MOUSEDEV=y
634CONFIG_INPUT_MOUSEDEV_SCREEN_X=1600 704CONFIG_INPUT_MOUSEDEV_SCREEN_X=1600
635CONFIG_INPUT_MOUSEDEV_SCREEN_Y=1200 705CONFIG_INPUT_MOUSEDEV_SCREEN_Y=1200
636# CONFIG_INPUT_JOYDEV is not set 706# CONFIG_INPUT_JOYDEV is not set
637# CONFIG_INPUT_TSDEV is not set
638# CONFIG_INPUT_EVDEV is not set 707# CONFIG_INPUT_EVDEV is not set
639# CONFIG_INPUT_EVBUG is not set 708# CONFIG_INPUT_EVBUG is not set
640 709
@@ -652,6 +721,7 @@ CONFIG_INPUT_MOUSE=y
652# CONFIG_MOUSE_PS2 is not set 721# CONFIG_MOUSE_PS2 is not set
653# CONFIG_MOUSE_SERIAL is not set 722# CONFIG_MOUSE_SERIAL is not set
654# CONFIG_MOUSE_APPLETOUCH is not set 723# CONFIG_MOUSE_APPLETOUCH is not set
724# CONFIG_MOUSE_BCM5974 is not set
655# CONFIG_MOUSE_VSXXXAA is not set 725# CONFIG_MOUSE_VSXXXAA is not set
656# CONFIG_INPUT_JOYSTICK is not set 726# CONFIG_INPUT_JOYSTICK is not set
657# CONFIG_INPUT_TABLET is not set 727# CONFIG_INPUT_TABLET is not set
@@ -672,10 +742,13 @@ CONFIG_SERIO_LIBPS2=m
672# Character devices 742# Character devices
673# 743#
674CONFIG_VT=y 744CONFIG_VT=y
745CONFIG_CONSOLE_TRANSLATIONS=y
675CONFIG_VT_CONSOLE=y 746CONFIG_VT_CONSOLE=y
676CONFIG_HW_CONSOLE=y 747CONFIG_HW_CONSOLE=y
677# CONFIG_VT_HW_CONSOLE_BINDING is not set 748# CONFIG_VT_HW_CONSOLE_BINDING is not set
749CONFIG_DEVKMEM=y
678# CONFIG_SERIAL_NONSTANDARD is not set 750# CONFIG_SERIAL_NONSTANDARD is not set
751# CONFIG_NOZOMI is not set
679 752
680# 753#
681# Serial drivers 754# Serial drivers
@@ -699,72 +772,77 @@ CONFIG_SERIAL_CORE=y
699CONFIG_SERIAL_CORE_CONSOLE=y 772CONFIG_SERIAL_CORE_CONSOLE=y
700# CONFIG_SERIAL_JSM is not set 773# CONFIG_SERIAL_JSM is not set
701CONFIG_UNIX98_PTYS=y 774CONFIG_UNIX98_PTYS=y
775# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
702CONFIG_LEGACY_PTYS=y 776CONFIG_LEGACY_PTYS=y
703CONFIG_LEGACY_PTY_COUNT=256 777CONFIG_LEGACY_PTY_COUNT=256
704# CONFIG_IPMI_HANDLER is not set 778# CONFIG_IPMI_HANDLER is not set
705# CONFIG_WATCHDOG is not set
706# CONFIG_HW_RANDOM is not set 779# CONFIG_HW_RANDOM is not set
707CONFIG_GEN_RTC=y
708CONFIG_GEN_RTC_X=y
709# CONFIG_R3964 is not set 780# CONFIG_R3964 is not set
710# CONFIG_APPLICOM is not set 781# CONFIG_APPLICOM is not set
711# CONFIG_AGP is not set
712# CONFIG_DRM is not set
713CONFIG_RAW_DRIVER=y 782CONFIG_RAW_DRIVER=y
714CONFIG_MAX_RAW_DEVS=256 783CONFIG_MAX_RAW_DEVS=256
715# CONFIG_TCG_TPM is not set 784# CONFIG_TCG_TPM is not set
716CONFIG_DEVPORT=y 785CONFIG_DEVPORT=y
717# CONFIG_I2C is not set 786# CONFIG_I2C is not set
718
719#
720# SPI support
721#
722# CONFIG_SPI is not set 787# CONFIG_SPI is not set
723# CONFIG_SPI_MASTER is not set
724# CONFIG_W1 is not set 788# CONFIG_W1 is not set
725# CONFIG_POWER_SUPPLY is not set 789# CONFIG_POWER_SUPPLY is not set
726# CONFIG_HWMON is not set 790# CONFIG_HWMON is not set
791# CONFIG_THERMAL is not set
792# CONFIG_THERMAL_HWMON is not set
793# CONFIG_WATCHDOG is not set
794CONFIG_SSB_POSSIBLE=y
727 795
728# 796#
729# Sonics Silicon Backplane 797# Sonics Silicon Backplane
730# 798#
731CONFIG_SSB_POSSIBLE=y
732# CONFIG_SSB is not set 799# CONFIG_SSB is not set
733 800
734# 801#
735# Multifunction device drivers 802# Multifunction device drivers
736# 803#
804# CONFIG_MFD_CORE is not set
737# CONFIG_MFD_SM501 is not set 805# CONFIG_MFD_SM501 is not set
806# CONFIG_HTC_PASIC3 is not set
807# CONFIG_MFD_TMIO is not set
808# CONFIG_REGULATOR is not set
738 809
739# 810#
740# Multimedia devices 811# Multimedia devices
741# 812#
813
814#
815# Multimedia core support
816#
742# CONFIG_VIDEO_DEV is not set 817# CONFIG_VIDEO_DEV is not set
743# CONFIG_DVB_CORE is not set 818# CONFIG_DVB_CORE is not set
744# CONFIG_DAB is not set 819# CONFIG_VIDEO_MEDIA is not set
745 820
746# 821#
747# Graphics support 822# Multimedia drivers
748# 823#
749# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 824# CONFIG_DAB is not set
750 825
751# 826#
752# Display device support 827# Graphics support
753# 828#
754# CONFIG_DISPLAY_SUPPORT is not set 829# CONFIG_AGP is not set
830# CONFIG_DRM is not set
755# CONFIG_VGASTATE is not set 831# CONFIG_VGASTATE is not set
756CONFIG_VIDEO_OUTPUT_CONTROL=m 832CONFIG_VIDEO_OUTPUT_CONTROL=m
757CONFIG_FB=y 833CONFIG_FB=y
758# CONFIG_FIRMWARE_EDID is not set 834# CONFIG_FIRMWARE_EDID is not set
759# CONFIG_FB_DDC is not set 835# CONFIG_FB_DDC is not set
836# CONFIG_FB_BOOT_VESA_SUPPORT is not set
760CONFIG_FB_CFB_FILLRECT=y 837CONFIG_FB_CFB_FILLRECT=y
761CONFIG_FB_CFB_COPYAREA=y 838CONFIG_FB_CFB_COPYAREA=y
762CONFIG_FB_CFB_IMAGEBLIT=y 839CONFIG_FB_CFB_IMAGEBLIT=y
840# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
763# CONFIG_FB_SYS_FILLRECT is not set 841# CONFIG_FB_SYS_FILLRECT is not set
764# CONFIG_FB_SYS_COPYAREA is not set 842# CONFIG_FB_SYS_COPYAREA is not set
765# CONFIG_FB_SYS_IMAGEBLIT is not set 843# CONFIG_FB_SYS_IMAGEBLIT is not set
844# CONFIG_FB_FOREIGN_ENDIAN is not set
766# CONFIG_FB_SYS_FOPS is not set 845# CONFIG_FB_SYS_FOPS is not set
767CONFIG_FB_DEFERRED_IO=y
768# CONFIG_FB_SVGALIB is not set 846# CONFIG_FB_SVGALIB is not set
769# CONFIG_FB_MACMODES is not set 847# CONFIG_FB_MACMODES is not set
770# CONFIG_FB_BACKLIGHT is not set 848# CONFIG_FB_BACKLIGHT is not set
@@ -790,6 +868,7 @@ CONFIG_FB_STI=y
790# CONFIG_FB_S3 is not set 868# CONFIG_FB_S3 is not set
791# CONFIG_FB_SAVAGE is not set 869# CONFIG_FB_SAVAGE is not set
792# CONFIG_FB_SIS is not set 870# CONFIG_FB_SIS is not set
871# CONFIG_FB_VIA is not set
793# CONFIG_FB_NEOMAGIC is not set 872# CONFIG_FB_NEOMAGIC is not set
794# CONFIG_FB_KYRO is not set 873# CONFIG_FB_KYRO is not set
795# CONFIG_FB_3DFX is not set 874# CONFIG_FB_3DFX is not set
@@ -798,7 +877,16 @@ CONFIG_FB_STI=y
798# CONFIG_FB_TRIDENT is not set 877# CONFIG_FB_TRIDENT is not set
799# CONFIG_FB_ARK is not set 878# CONFIG_FB_ARK is not set
800# CONFIG_FB_PM3 is not set 879# CONFIG_FB_PM3 is not set
880# CONFIG_FB_CARMINE is not set
801# CONFIG_FB_VIRTUAL is not set 881# CONFIG_FB_VIRTUAL is not set
882# CONFIG_FB_METRONOME is not set
883# CONFIG_FB_MB862XX is not set
884# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
885
886#
887# Display device support
888#
889# CONFIG_DISPLAY_SUPPORT is not set
802 890
803# 891#
804# Console display driver support 892# Console display driver support
@@ -818,15 +906,8 @@ CONFIG_LOGO=y
818# CONFIG_LOGO_LINUX_VGA16 is not set 906# CONFIG_LOGO_LINUX_VGA16 is not set
819# CONFIG_LOGO_LINUX_CLUT224 is not set 907# CONFIG_LOGO_LINUX_CLUT224 is not set
820CONFIG_LOGO_PARISC_CLUT224=y 908CONFIG_LOGO_PARISC_CLUT224=y
821
822#
823# Sound
824#
825CONFIG_SOUND=y 909CONFIG_SOUND=y
826 910CONFIG_SOUND_OSS_CORE=y
827#
828# Advanced Linux Sound Architecture
829#
830CONFIG_SND=y 911CONFIG_SND=y
831CONFIG_SND_TIMER=y 912CONFIG_SND_TIMER=y
832CONFIG_SND_PCM=y 913CONFIG_SND_PCM=y
@@ -842,20 +923,16 @@ CONFIG_SND_SUPPORT_OLD_API=y
842CONFIG_SND_VERBOSE_PROCFS=y 923CONFIG_SND_VERBOSE_PROCFS=y
843# CONFIG_SND_VERBOSE_PRINTK is not set 924# CONFIG_SND_VERBOSE_PRINTK is not set
844# CONFIG_SND_DEBUG is not set 925# CONFIG_SND_DEBUG is not set
845 926CONFIG_SND_VMASTER=y
846#
847# Generic devices
848#
849CONFIG_SND_AC97_CODEC=y 927CONFIG_SND_AC97_CODEC=y
928CONFIG_SND_DRIVERS=y
850# CONFIG_SND_DUMMY is not set 929# CONFIG_SND_DUMMY is not set
851# CONFIG_SND_VIRMIDI is not set 930# CONFIG_SND_VIRMIDI is not set
852# CONFIG_SND_MTPAV is not set 931# CONFIG_SND_MTPAV is not set
853# CONFIG_SND_SERIAL_U16550 is not set 932# CONFIG_SND_SERIAL_U16550 is not set
854# CONFIG_SND_MPU401 is not set 933# CONFIG_SND_MPU401 is not set
855 934# CONFIG_SND_AC97_POWER_SAVE is not set
856# 935CONFIG_SND_PCI=y
857# PCI devices
858#
859CONFIG_SND_AD1889=y 936CONFIG_SND_AD1889=y
860# CONFIG_SND_ALS300 is not set 937# CONFIG_SND_ALS300 is not set
861# CONFIG_SND_ALI5451 is not set 938# CONFIG_SND_ALI5451 is not set
@@ -864,10 +941,12 @@ CONFIG_SND_AD1889=y
864# CONFIG_SND_AU8810 is not set 941# CONFIG_SND_AU8810 is not set
865# CONFIG_SND_AU8820 is not set 942# CONFIG_SND_AU8820 is not set
866# CONFIG_SND_AU8830 is not set 943# CONFIG_SND_AU8830 is not set
944# CONFIG_SND_AW2 is not set
867# CONFIG_SND_AZT3328 is not set 945# CONFIG_SND_AZT3328 is not set
868# CONFIG_SND_BT87X is not set 946# CONFIG_SND_BT87X is not set
869# CONFIG_SND_CA0106 is not set 947# CONFIG_SND_CA0106 is not set
870# CONFIG_SND_CMIPCI is not set 948# CONFIG_SND_CMIPCI is not set
949# CONFIG_SND_OXYGEN is not set
871# CONFIG_SND_CS4281 is not set 950# CONFIG_SND_CS4281 is not set
872# CONFIG_SND_CS46XX is not set 951# CONFIG_SND_CS46XX is not set
873# CONFIG_SND_DARLA20 is not set 952# CONFIG_SND_DARLA20 is not set
@@ -892,6 +971,7 @@ CONFIG_SND_AD1889=y
892# CONFIG_SND_HDA_INTEL is not set 971# CONFIG_SND_HDA_INTEL is not set
893# CONFIG_SND_HDSP is not set 972# CONFIG_SND_HDSP is not set
894# CONFIG_SND_HDSPM is not set 973# CONFIG_SND_HDSPM is not set
974# CONFIG_SND_HIFIER is not set
895# CONFIG_SND_ICE1712 is not set 975# CONFIG_SND_ICE1712 is not set
896# CONFIG_SND_ICE1724 is not set 976# CONFIG_SND_ICE1724 is not set
897# CONFIG_SND_INTEL8X0 is not set 977# CONFIG_SND_INTEL8X0 is not set
@@ -909,47 +989,59 @@ CONFIG_SND_AD1889=y
909# CONFIG_SND_TRIDENT is not set 989# CONFIG_SND_TRIDENT is not set
910# CONFIG_SND_VIA82XX is not set 990# CONFIG_SND_VIA82XX is not set
911# CONFIG_SND_VIA82XX_MODEM is not set 991# CONFIG_SND_VIA82XX_MODEM is not set
992# CONFIG_SND_VIRTUOSO is not set
912# CONFIG_SND_VX222 is not set 993# CONFIG_SND_VX222 is not set
913# CONFIG_SND_YMFPCI is not set 994# CONFIG_SND_YMFPCI is not set
914# CONFIG_SND_AC97_POWER_SAVE is not set 995CONFIG_SND_USB=y
915
916#
917# USB devices
918#
919# CONFIG_SND_USB_AUDIO is not set 996# CONFIG_SND_USB_AUDIO is not set
920# CONFIG_SND_USB_CAIAQ is not set 997# CONFIG_SND_USB_CAIAQ is not set
921
922#
923# System on Chip audio support
924#
925# CONFIG_SND_SOC is not set 998# CONFIG_SND_SOC is not set
926
927#
928# SoC Audio support for SuperH
929#
930
931#
932# Open Sound System
933#
934# CONFIG_SOUND_PRIME is not set 999# CONFIG_SOUND_PRIME is not set
935CONFIG_AC97_BUS=y 1000CONFIG_AC97_BUS=y
936CONFIG_HID_SUPPORT=y 1001CONFIG_HID_SUPPORT=y
937CONFIG_HID=y 1002CONFIG_HID=y
938# CONFIG_HID_DEBUG is not set 1003# CONFIG_HID_DEBUG is not set
1004# CONFIG_HIDRAW is not set
939 1005
940# 1006#
941# USB Input Devices 1007# USB Input Devices
942# 1008#
943CONFIG_USB_HID=y 1009CONFIG_USB_HID=y
944# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1010# CONFIG_HID_PID is not set
945# CONFIG_HID_FF is not set
946CONFIG_USB_HIDDEV=y 1011CONFIG_USB_HIDDEV=y
1012
1013#
1014# Special HID drivers
1015#
1016CONFIG_HID_COMPAT=y
1017# CONFIG_HID_A4TECH is not set
1018# CONFIG_HID_APPLE is not set
1019# CONFIG_HID_BELKIN is not set
1020# CONFIG_HID_CHERRY is not set
1021# CONFIG_HID_CHICONY is not set
1022# CONFIG_HID_CYPRESS is not set
1023# CONFIG_HID_EZKEY is not set
1024# CONFIG_HID_GYRATION is not set
1025# CONFIG_HID_LOGITECH is not set
1026# CONFIG_HID_MICROSOFT is not set
1027# CONFIG_HID_MONTEREY is not set
1028# CONFIG_HID_NTRIG is not set
1029# CONFIG_HID_PANTHERLORD is not set
1030# CONFIG_HID_PETALYNX is not set
1031# CONFIG_HID_SAMSUNG is not set
1032# CONFIG_HID_SONY is not set
1033# CONFIG_HID_SUNPLUS is not set
1034# CONFIG_GREENASIA_FF is not set
1035# CONFIG_HID_TOPSEED is not set
1036# CONFIG_THRUSTMASTER_FF is not set
1037# CONFIG_ZEROPLUS_FF is not set
947CONFIG_USB_SUPPORT=y 1038CONFIG_USB_SUPPORT=y
948CONFIG_USB_ARCH_HAS_HCD=y 1039CONFIG_USB_ARCH_HAS_HCD=y
949CONFIG_USB_ARCH_HAS_OHCI=y 1040CONFIG_USB_ARCH_HAS_OHCI=y
950CONFIG_USB_ARCH_HAS_EHCI=y 1041CONFIG_USB_ARCH_HAS_EHCI=y
951CONFIG_USB=y 1042CONFIG_USB=y
952CONFIG_USB_DEBUG=y 1043CONFIG_USB_DEBUG=y
1044# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
953 1045
954# 1046#
955# Miscellaneous USB options 1047# Miscellaneous USB options
@@ -958,12 +1050,20 @@ CONFIG_USB_DEVICEFS=y
958CONFIG_USB_DEVICE_CLASS=y 1050CONFIG_USB_DEVICE_CLASS=y
959# CONFIG_USB_DYNAMIC_MINORS is not set 1051# CONFIG_USB_DYNAMIC_MINORS is not set
960# CONFIG_USB_OTG is not set 1052# CONFIG_USB_OTG is not set
1053# CONFIG_USB_OTG_WHITELIST is not set
1054# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1055# CONFIG_USB_MON is not set
1056# CONFIG_USB_WUSB is not set
1057# CONFIG_USB_WUSB_CBAF is not set
961 1058
962# 1059#
963# USB Host Controller Drivers 1060# USB Host Controller Drivers
964# 1061#
1062# CONFIG_USB_C67X00_HCD is not set
965# CONFIG_USB_EHCI_HCD is not set 1063# CONFIG_USB_EHCI_HCD is not set
1064# CONFIG_USB_OXU210HP_HCD is not set
966# CONFIG_USB_ISP116X_HCD is not set 1065# CONFIG_USB_ISP116X_HCD is not set
1066# CONFIG_USB_ISP1760_HCD is not set
967CONFIG_USB_OHCI_HCD=y 1067CONFIG_USB_OHCI_HCD=y
968# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1068# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
969# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1069# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -971,32 +1071,37 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
971# CONFIG_USB_UHCI_HCD is not set 1071# CONFIG_USB_UHCI_HCD is not set
972# CONFIG_USB_SL811_HCD is not set 1072# CONFIG_USB_SL811_HCD is not set
973# CONFIG_USB_R8A66597_HCD is not set 1073# CONFIG_USB_R8A66597_HCD is not set
1074# CONFIG_USB_WHCI_HCD is not set
1075# CONFIG_USB_HWA_HCD is not set
974 1076
975# 1077#
976# USB Device Class drivers 1078# USB Device Class drivers
977# 1079#
978# CONFIG_USB_ACM is not set 1080# CONFIG_USB_ACM is not set
979CONFIG_USB_PRINTER=m 1081CONFIG_USB_PRINTER=m
1082# CONFIG_USB_WDM is not set
1083# CONFIG_USB_TMC is not set
980 1084
981# 1085#
982# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1086# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
983# 1087#
984 1088
985# 1089#
986# may also be needed; see USB_STORAGE Help for more information 1090# see USB_STORAGE Help for more information
987# 1091#
988CONFIG_USB_STORAGE=m 1092CONFIG_USB_STORAGE=m
989# CONFIG_USB_STORAGE_DEBUG is not set 1093# CONFIG_USB_STORAGE_DEBUG is not set
990# CONFIG_USB_STORAGE_DATAFAB is not set 1094# CONFIG_USB_STORAGE_DATAFAB is not set
991# CONFIG_USB_STORAGE_FREECOM is not set 1095# CONFIG_USB_STORAGE_FREECOM is not set
992# CONFIG_USB_STORAGE_ISD200 is not set 1096# CONFIG_USB_STORAGE_ISD200 is not set
993CONFIG_USB_STORAGE_DPCM=y
994CONFIG_USB_STORAGE_USBAT=y 1097CONFIG_USB_STORAGE_USBAT=y
995CONFIG_USB_STORAGE_SDDR09=y 1098CONFIG_USB_STORAGE_SDDR09=y
996CONFIG_USB_STORAGE_SDDR55=y 1099CONFIG_USB_STORAGE_SDDR55=y
997CONFIG_USB_STORAGE_JUMPSHOT=y 1100CONFIG_USB_STORAGE_JUMPSHOT=y
998# CONFIG_USB_STORAGE_ALAUDA is not set 1101# CONFIG_USB_STORAGE_ALAUDA is not set
1102# CONFIG_USB_STORAGE_ONETOUCH is not set
999# CONFIG_USB_STORAGE_KARMA is not set 1103# CONFIG_USB_STORAGE_KARMA is not set
1104# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1000# CONFIG_USB_LIBUSUAL is not set 1105# CONFIG_USB_LIBUSUAL is not set
1001 1106
1002# 1107#
@@ -1004,15 +1109,10 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
1004# 1109#
1005CONFIG_USB_MDC800=m 1110CONFIG_USB_MDC800=m
1006CONFIG_USB_MICROTEK=m 1111CONFIG_USB_MICROTEK=m
1007# CONFIG_USB_MON is not set
1008 1112
1009# 1113#
1010# USB port drivers 1114# USB port drivers
1011# 1115#
1012
1013#
1014# USB Serial Converter support
1015#
1016# CONFIG_USB_SERIAL is not set 1116# CONFIG_USB_SERIAL is not set
1017 1117
1018# 1118#
@@ -1021,7 +1121,7 @@ CONFIG_USB_MICROTEK=m
1021# CONFIG_USB_EMI62 is not set 1121# CONFIG_USB_EMI62 is not set
1022# CONFIG_USB_EMI26 is not set 1122# CONFIG_USB_EMI26 is not set
1023# CONFIG_USB_ADUTUX is not set 1123# CONFIG_USB_ADUTUX is not set
1024# CONFIG_USB_AUERSWALD is not set 1124# CONFIG_USB_SEVSEG is not set
1025# CONFIG_USB_RIO500 is not set 1125# CONFIG_USB_RIO500 is not set
1026CONFIG_USB_LEGOTOWER=m 1126CONFIG_USB_LEGOTOWER=m
1027# CONFIG_USB_LCD is not set 1127# CONFIG_USB_LCD is not set
@@ -1037,37 +1137,59 @@ CONFIG_USB_LEGOTOWER=m
1037# CONFIG_USB_TRANCEVIBRATOR is not set 1137# CONFIG_USB_TRANCEVIBRATOR is not set
1038# CONFIG_USB_IOWARRIOR is not set 1138# CONFIG_USB_IOWARRIOR is not set
1039# CONFIG_USB_TEST is not set 1139# CONFIG_USB_TEST is not set
1140# CONFIG_USB_ISIGHTFW is not set
1141# CONFIG_USB_VST is not set
1142# CONFIG_USB_GADGET is not set
1040 1143
1041# 1144#
1042# USB DSL modem support 1145# OTG and related infrastructure
1043#
1044
1045#
1046# USB Gadget Support
1047# 1146#
1048# CONFIG_USB_GADGET is not set 1147# CONFIG_UWB is not set
1049# CONFIG_MMC is not set 1148# CONFIG_MMC is not set
1149# CONFIG_MEMSTICK is not set
1050# CONFIG_NEW_LEDS is not set 1150# CONFIG_NEW_LEDS is not set
1151# CONFIG_ACCESSIBILITY is not set
1051# CONFIG_INFINIBAND is not set 1152# CONFIG_INFINIBAND is not set
1052# CONFIG_RTC_CLASS is not set 1153CONFIG_RTC_LIB=y
1154CONFIG_RTC_CLASS=y
1155CONFIG_RTC_HCTOSYS=y
1156CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1157# CONFIG_RTC_DEBUG is not set
1053 1158
1054# 1159#
1055# DMA Engine support 1160# RTC interfaces
1056# 1161#
1057# CONFIG_DMA_ENGINE is not set 1162CONFIG_RTC_INTF_SYSFS=y
1163CONFIG_RTC_INTF_PROC=y
1164CONFIG_RTC_INTF_DEV=y
1165# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1166# CONFIG_RTC_DRV_TEST is not set
1058 1167
1059# 1168#
1060# DMA Clients 1169# SPI RTC drivers
1061# 1170#
1062 1171
1063# 1172#
1064# DMA Devices 1173# Platform RTC drivers
1065# 1174#
1175# CONFIG_RTC_DRV_DS1286 is not set
1176# CONFIG_RTC_DRV_DS1511 is not set
1177# CONFIG_RTC_DRV_DS1553 is not set
1178# CONFIG_RTC_DRV_DS1742 is not set
1179# CONFIG_RTC_DRV_STK17TA8 is not set
1180# CONFIG_RTC_DRV_M48T86 is not set
1181# CONFIG_RTC_DRV_M48T35 is not set
1182# CONFIG_RTC_DRV_M48T59 is not set
1183# CONFIG_RTC_DRV_BQ4802 is not set
1184# CONFIG_RTC_DRV_V3020 is not set
1066 1185
1067# 1186#
1068# Userspace I/O 1187# on-CPU RTC drivers
1069# 1188#
1189CONFIG_RTC_DRV_PARISC=y
1190# CONFIG_DMADEVICES is not set
1070# CONFIG_UIO is not set 1191# CONFIG_UIO is not set
1192# CONFIG_STAGING is not set
1071 1193
1072# 1194#
1073# File systems 1195# File systems
@@ -1077,25 +1199,24 @@ CONFIG_EXT2_FS=y
1077# CONFIG_EXT2_FS_XIP is not set 1199# CONFIG_EXT2_FS_XIP is not set
1078CONFIG_EXT3_FS=y 1200CONFIG_EXT3_FS=y
1079# CONFIG_EXT3_FS_XATTR is not set 1201# CONFIG_EXT3_FS_XATTR is not set
1080# CONFIG_EXT4DEV_FS is not set 1202# CONFIG_EXT4_FS is not set
1081CONFIG_JBD=y 1203CONFIG_JBD=y
1082# CONFIG_JBD_DEBUG is not set 1204# CONFIG_JBD_DEBUG is not set
1083# CONFIG_REISERFS_FS is not set 1205# CONFIG_REISERFS_FS is not set
1084# CONFIG_JFS_FS is not set 1206# CONFIG_JFS_FS is not set
1085# CONFIG_FS_POSIX_ACL is not set 1207# CONFIG_FS_POSIX_ACL is not set
1208CONFIG_FILE_LOCKING=y
1086CONFIG_XFS_FS=m 1209CONFIG_XFS_FS=m
1087# CONFIG_XFS_QUOTA is not set 1210# CONFIG_XFS_QUOTA is not set
1088# CONFIG_XFS_SECURITY is not set
1089# CONFIG_XFS_POSIX_ACL is not set 1211# CONFIG_XFS_POSIX_ACL is not set
1090# CONFIG_XFS_RT is not set 1212# CONFIG_XFS_RT is not set
1091# CONFIG_GFS2_FS is not set 1213# CONFIG_XFS_DEBUG is not set
1092# CONFIG_OCFS2_FS is not set 1214# CONFIG_OCFS2_FS is not set
1093# CONFIG_MINIX_FS is not set 1215# CONFIG_BTRFS_FS is not set
1094# CONFIG_ROMFS_FS is not set 1216CONFIG_DNOTIFY=y
1095CONFIG_INOTIFY=y 1217CONFIG_INOTIFY=y
1096CONFIG_INOTIFY_USER=y 1218CONFIG_INOTIFY_USER=y
1097# CONFIG_QUOTA is not set 1219# CONFIG_QUOTA is not set
1098CONFIG_DNOTIFY=y
1099# CONFIG_AUTOFS_FS is not set 1220# CONFIG_AUTOFS_FS is not set
1100CONFIG_AUTOFS4_FS=y 1221CONFIG_AUTOFS4_FS=y
1101# CONFIG_FUSE_FS is not set 1222# CONFIG_FUSE_FS is not set
@@ -1124,16 +1245,13 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1124CONFIG_PROC_FS=y 1245CONFIG_PROC_FS=y
1125CONFIG_PROC_KCORE=y 1246CONFIG_PROC_KCORE=y
1126CONFIG_PROC_SYSCTL=y 1247CONFIG_PROC_SYSCTL=y
1248CONFIG_PROC_PAGE_MONITOR=y
1127CONFIG_SYSFS=y 1249CONFIG_SYSFS=y
1128CONFIG_TMPFS=y 1250CONFIG_TMPFS=y
1129# CONFIG_TMPFS_POSIX_ACL is not set 1251# CONFIG_TMPFS_POSIX_ACL is not set
1130# CONFIG_HUGETLB_PAGE is not set 1252# CONFIG_HUGETLB_PAGE is not set
1131CONFIG_RAMFS=y
1132# CONFIG_CONFIGFS_FS is not set 1253# CONFIG_CONFIGFS_FS is not set
1133 1254CONFIG_MISC_FILESYSTEMS=y
1134#
1135# Miscellaneous filesystems
1136#
1137# CONFIG_ADFS_FS is not set 1255# CONFIG_ADFS_FS is not set
1138# CONFIG_AFFS_FS is not set 1256# CONFIG_AFFS_FS is not set
1139# CONFIG_HFS_FS is not set 1257# CONFIG_HFS_FS is not set
@@ -1142,32 +1260,31 @@ CONFIG_RAMFS=y
1142# CONFIG_BFS_FS is not set 1260# CONFIG_BFS_FS is not set
1143# CONFIG_EFS_FS is not set 1261# CONFIG_EFS_FS is not set
1144# CONFIG_CRAMFS is not set 1262# CONFIG_CRAMFS is not set
1263# CONFIG_SQUASHFS is not set
1145# CONFIG_VXFS_FS is not set 1264# CONFIG_VXFS_FS is not set
1265# CONFIG_MINIX_FS is not set
1266# CONFIG_OMFS_FS is not set
1146# CONFIG_HPFS_FS is not set 1267# CONFIG_HPFS_FS is not set
1147# CONFIG_QNX4FS_FS is not set 1268# CONFIG_QNX4FS_FS is not set
1269# CONFIG_ROMFS_FS is not set
1148# CONFIG_SYSV_FS is not set 1270# CONFIG_SYSV_FS is not set
1149# CONFIG_UFS_FS is not set 1271# CONFIG_UFS_FS is not set
1150 1272CONFIG_NETWORK_FILESYSTEMS=y
1151#
1152# Network File Systems
1153#
1154CONFIG_NFS_FS=y 1273CONFIG_NFS_FS=y
1155CONFIG_NFS_V3=y 1274CONFIG_NFS_V3=y
1156# CONFIG_NFS_V3_ACL is not set 1275# CONFIG_NFS_V3_ACL is not set
1157# CONFIG_NFS_V4 is not set 1276# CONFIG_NFS_V4 is not set
1158# CONFIG_NFS_DIRECTIO is not set 1277CONFIG_ROOT_NFS=y
1159CONFIG_NFSD=y 1278CONFIG_NFSD=y
1160CONFIG_NFSD_V3=y 1279CONFIG_NFSD_V3=y
1161# CONFIG_NFSD_V3_ACL is not set 1280# CONFIG_NFSD_V3_ACL is not set
1162# CONFIG_NFSD_V4 is not set 1281# CONFIG_NFSD_V4 is not set
1163# CONFIG_NFSD_TCP is not set
1164CONFIG_ROOT_NFS=y
1165CONFIG_LOCKD=y 1282CONFIG_LOCKD=y
1166CONFIG_LOCKD_V4=y 1283CONFIG_LOCKD_V4=y
1167CONFIG_EXPORTFS=y 1284CONFIG_EXPORTFS=y
1168CONFIG_NFS_COMMON=y 1285CONFIG_NFS_COMMON=y
1169CONFIG_SUNRPC=y 1286CONFIG_SUNRPC=y
1170# CONFIG_SUNRPC_BIND34 is not set 1287# CONFIG_SUNRPC_REGISTER_V4 is not set
1171# CONFIG_RPCSEC_GSS_KRB5 is not set 1288# CONFIG_RPCSEC_GSS_KRB5 is not set
1172# CONFIG_RPCSEC_GSS_SPKM3 is not set 1289# CONFIG_RPCSEC_GSS_SPKM3 is not set
1173# CONFIG_SMB_FS is not set 1290# CONFIG_SMB_FS is not set
@@ -1181,10 +1298,6 @@ CONFIG_SUNRPC=y
1181# 1298#
1182# CONFIG_PARTITION_ADVANCED is not set 1299# CONFIG_PARTITION_ADVANCED is not set
1183CONFIG_MSDOS_PARTITION=y 1300CONFIG_MSDOS_PARTITION=y
1184
1185#
1186# Native Language Support
1187#
1188CONFIG_NLS=y 1301CONFIG_NLS=y
1189CONFIG_NLS_DEFAULT="iso8859-1" 1302CONFIG_NLS_DEFAULT="iso8859-1"
1190CONFIG_NLS_CODEPAGE_437=m 1303CONFIG_NLS_CODEPAGE_437=m
@@ -1225,33 +1338,28 @@ CONFIG_NLS_ISO8859_15=m
1225# CONFIG_NLS_KOI8_R is not set 1338# CONFIG_NLS_KOI8_R is not set
1226# CONFIG_NLS_KOI8_U is not set 1339# CONFIG_NLS_KOI8_U is not set
1227CONFIG_NLS_UTF8=m 1340CONFIG_NLS_UTF8=m
1228
1229#
1230# Distributed Lock Manager
1231#
1232# CONFIG_DLM is not set 1341# CONFIG_DLM is not set
1233 1342
1234# 1343#
1235# Profiling support
1236#
1237CONFIG_PROFILING=y
1238CONFIG_OPROFILE=m
1239
1240#
1241# Kernel hacking 1344# Kernel hacking
1242# 1345#
1243# CONFIG_PRINTK_TIME is not set 1346# CONFIG_PRINTK_TIME is not set
1347CONFIG_ENABLE_WARN_DEPRECATED=y
1244CONFIG_ENABLE_MUST_CHECK=y 1348CONFIG_ENABLE_MUST_CHECK=y
1349CONFIG_FRAME_WARN=1024
1245CONFIG_MAGIC_SYSRQ=y 1350CONFIG_MAGIC_SYSRQ=y
1246# CONFIG_UNUSED_SYMBOLS is not set 1351# CONFIG_UNUSED_SYMBOLS is not set
1247# CONFIG_DEBUG_FS is not set 1352CONFIG_DEBUG_FS=y
1248CONFIG_HEADERS_CHECK=y 1353CONFIG_HEADERS_CHECK=y
1249CONFIG_DEBUG_KERNEL=y 1354CONFIG_DEBUG_KERNEL=y
1250# CONFIG_DEBUG_SHIRQ is not set 1355# CONFIG_DEBUG_SHIRQ is not set
1251CONFIG_DETECT_SOFTLOCKUP=y 1356CONFIG_DETECT_SOFTLOCKUP=y
1357# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1358CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1252CONFIG_SCHED_DEBUG=y 1359CONFIG_SCHED_DEBUG=y
1253# CONFIG_SCHEDSTATS is not set 1360# CONFIG_SCHEDSTATS is not set
1254# CONFIG_TIMER_STATS is not set 1361# CONFIG_TIMER_STATS is not set
1362# CONFIG_DEBUG_OBJECTS is not set
1255# CONFIG_DEBUG_SLAB is not set 1363# CONFIG_DEBUG_SLAB is not set
1256# CONFIG_DEBUG_RT_MUTEXES is not set 1364# CONFIG_DEBUG_RT_MUTEXES is not set
1257# CONFIG_RT_MUTEX_TESTER is not set 1365# CONFIG_RT_MUTEX_TESTER is not set
@@ -1263,10 +1371,33 @@ CONFIG_DEBUG_MUTEXES=y
1263# CONFIG_DEBUG_BUGVERBOSE is not set 1371# CONFIG_DEBUG_BUGVERBOSE is not set
1264# CONFIG_DEBUG_INFO is not set 1372# CONFIG_DEBUG_INFO is not set
1265# CONFIG_DEBUG_VM is not set 1373# CONFIG_DEBUG_VM is not set
1374# CONFIG_DEBUG_WRITECOUNT is not set
1375# CONFIG_DEBUG_MEMORY_INIT is not set
1266# CONFIG_DEBUG_LIST is not set 1376# CONFIG_DEBUG_LIST is not set
1267CONFIG_FORCED_INLINING=y 1377# CONFIG_DEBUG_SG is not set
1378# CONFIG_DEBUG_NOTIFIERS is not set
1379# CONFIG_BOOT_PRINTK_DELAY is not set
1268# CONFIG_RCU_TORTURE_TEST is not set 1380# CONFIG_RCU_TORTURE_TEST is not set
1381# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1382# CONFIG_BACKTRACE_SELF_TEST is not set
1383# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1269# CONFIG_FAULT_INJECTION is not set 1384# CONFIG_FAULT_INJECTION is not set
1385# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1386CONFIG_NOP_TRACER=y
1387CONFIG_RING_BUFFER=y
1388CONFIG_TRACING=y
1389
1390#
1391# Tracers
1392#
1393# CONFIG_SCHED_TRACER is not set
1394# CONFIG_CONTEXT_SWITCH_TRACER is not set
1395# CONFIG_BOOT_TRACER is not set
1396# CONFIG_TRACE_BRANCH_PROFILING is not set
1397# CONFIG_FTRACE_STARTUP_TEST is not set
1398# CONFIG_BUILD_DOCSRC is not set
1399# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1400# CONFIG_SAMPLES is not set
1270CONFIG_DEBUG_RODATA=y 1401CONFIG_DEBUG_RODATA=y
1271 1402
1272# 1403#
@@ -1274,54 +1405,110 @@ CONFIG_DEBUG_RODATA=y
1274# 1405#
1275# CONFIG_KEYS is not set 1406# CONFIG_KEYS is not set
1276# CONFIG_SECURITY is not set 1407# CONFIG_SECURITY is not set
1408# CONFIG_SECURITYFS is not set
1409# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1277CONFIG_CRYPTO=y 1410CONFIG_CRYPTO=y
1411
1412#
1413# Crypto core or helper
1414#
1415# CONFIG_CRYPTO_FIPS is not set
1278CONFIG_CRYPTO_ALGAPI=m 1416CONFIG_CRYPTO_ALGAPI=m
1417CONFIG_CRYPTO_ALGAPI2=m
1418CONFIG_CRYPTO_AEAD2=m
1279CONFIG_CRYPTO_BLKCIPHER=m 1419CONFIG_CRYPTO_BLKCIPHER=m
1420CONFIG_CRYPTO_BLKCIPHER2=m
1421CONFIG_CRYPTO_HASH=m
1422CONFIG_CRYPTO_HASH2=m
1423CONFIG_CRYPTO_RNG2=m
1280CONFIG_CRYPTO_MANAGER=m 1424CONFIG_CRYPTO_MANAGER=m
1425CONFIG_CRYPTO_MANAGER2=m
1426# CONFIG_CRYPTO_GF128MUL is not set
1427CONFIG_CRYPTO_NULL=m
1428# CONFIG_CRYPTO_CRYPTD is not set
1429# CONFIG_CRYPTO_AUTHENC is not set
1430CONFIG_CRYPTO_TEST=m
1431
1432#
1433# Authenticated Encryption with Associated Data
1434#
1435# CONFIG_CRYPTO_CCM is not set
1436# CONFIG_CRYPTO_GCM is not set
1437# CONFIG_CRYPTO_SEQIV is not set
1438
1439#
1440# Block modes
1441#
1442CONFIG_CRYPTO_CBC=m
1443# CONFIG_CRYPTO_CTR is not set
1444# CONFIG_CRYPTO_CTS is not set
1445# CONFIG_CRYPTO_ECB is not set
1446# CONFIG_CRYPTO_LRW is not set
1447# CONFIG_CRYPTO_PCBC is not set
1448# CONFIG_CRYPTO_XTS is not set
1449
1450#
1451# Hash modes
1452#
1281# CONFIG_CRYPTO_HMAC is not set 1453# CONFIG_CRYPTO_HMAC is not set
1282# CONFIG_CRYPTO_XCBC is not set 1454# CONFIG_CRYPTO_XCBC is not set
1283CONFIG_CRYPTO_NULL=m 1455
1456#
1457# Digest
1458#
1459CONFIG_CRYPTO_CRC32C=m
1284# CONFIG_CRYPTO_MD4 is not set 1460# CONFIG_CRYPTO_MD4 is not set
1285CONFIG_CRYPTO_MD5=m 1461CONFIG_CRYPTO_MD5=m
1462# CONFIG_CRYPTO_MICHAEL_MIC is not set
1463# CONFIG_CRYPTO_RMD128 is not set
1464# CONFIG_CRYPTO_RMD160 is not set
1465# CONFIG_CRYPTO_RMD256 is not set
1466# CONFIG_CRYPTO_RMD320 is not set
1286# CONFIG_CRYPTO_SHA1 is not set 1467# CONFIG_CRYPTO_SHA1 is not set
1287# CONFIG_CRYPTO_SHA256 is not set 1468# CONFIG_CRYPTO_SHA256 is not set
1288# CONFIG_CRYPTO_SHA512 is not set 1469# CONFIG_CRYPTO_SHA512 is not set
1289# CONFIG_CRYPTO_WP512 is not set
1290# CONFIG_CRYPTO_TGR192 is not set 1470# CONFIG_CRYPTO_TGR192 is not set
1291# CONFIG_CRYPTO_GF128MUL is not set 1471# CONFIG_CRYPTO_WP512 is not set
1292# CONFIG_CRYPTO_ECB is not set 1472
1293CONFIG_CRYPTO_CBC=m 1473#
1294# CONFIG_CRYPTO_PCBC is not set 1474# Ciphers
1295# CONFIG_CRYPTO_LRW is not set 1475#
1296# CONFIG_CRYPTO_XTS is not set
1297# CONFIG_CRYPTO_CRYPTD is not set
1298CONFIG_CRYPTO_DES=m
1299# CONFIG_CRYPTO_FCRYPT is not set
1300CONFIG_CRYPTO_BLOWFISH=m
1301# CONFIG_CRYPTO_TWOFISH is not set
1302# CONFIG_CRYPTO_SERPENT is not set
1303# CONFIG_CRYPTO_AES is not set 1476# CONFIG_CRYPTO_AES is not set
1477# CONFIG_CRYPTO_ANUBIS is not set
1478# CONFIG_CRYPTO_ARC4 is not set
1479CONFIG_CRYPTO_BLOWFISH=m
1480# CONFIG_CRYPTO_CAMELLIA is not set
1304# CONFIG_CRYPTO_CAST5 is not set 1481# CONFIG_CRYPTO_CAST5 is not set
1305# CONFIG_CRYPTO_CAST6 is not set 1482# CONFIG_CRYPTO_CAST6 is not set
1306# CONFIG_CRYPTO_TEA is not set 1483CONFIG_CRYPTO_DES=m
1307# CONFIG_CRYPTO_ARC4 is not set 1484# CONFIG_CRYPTO_FCRYPT is not set
1308# CONFIG_CRYPTO_KHAZAD is not set 1485# CONFIG_CRYPTO_KHAZAD is not set
1309# CONFIG_CRYPTO_ANUBIS is not set 1486# CONFIG_CRYPTO_SALSA20 is not set
1310# CONFIG_CRYPTO_SEED is not set 1487# CONFIG_CRYPTO_SEED is not set
1488# CONFIG_CRYPTO_SERPENT is not set
1489# CONFIG_CRYPTO_TEA is not set
1490# CONFIG_CRYPTO_TWOFISH is not set
1491
1492#
1493# Compression
1494#
1311CONFIG_CRYPTO_DEFLATE=m 1495CONFIG_CRYPTO_DEFLATE=m
1312# CONFIG_CRYPTO_MICHAEL_MIC is not set 1496# CONFIG_CRYPTO_LZO is not set
1313CONFIG_CRYPTO_CRC32C=m 1497
1314# CONFIG_CRYPTO_CAMELLIA is not set 1498#
1315CONFIG_CRYPTO_TEST=m 1499# Random Number Generation
1316# CONFIG_CRYPTO_AUTHENC is not set 1500#
1501# CONFIG_CRYPTO_ANSI_CPRNG is not set
1317# CONFIG_CRYPTO_HW is not set 1502# CONFIG_CRYPTO_HW is not set
1318 1503
1319# 1504#
1320# Library routines 1505# Library routines
1321# 1506#
1322CONFIG_BITREVERSE=y 1507CONFIG_BITREVERSE=y
1508CONFIG_GENERIC_FIND_LAST_BIT=y
1323CONFIG_CRC_CCITT=m 1509CONFIG_CRC_CCITT=m
1324# CONFIG_CRC16 is not set 1510# CONFIG_CRC16 is not set
1511# CONFIG_CRC_T10DIF is not set
1325# CONFIG_CRC_ITU_T is not set 1512# CONFIG_CRC_ITU_T is not set
1326CONFIG_CRC32=y 1513CONFIG_CRC32=y
1327# CONFIG_CRC7 is not set 1514# CONFIG_CRC7 is not set
diff --git a/arch/parisc/configs/default_defconfig b/arch/parisc/configs/default_defconfig
index 448a757b06c6..283a96c1b5ea 100644
--- a/arch/parisc/configs/default_defconfig
+++ b/arch/parisc/configs/default_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23 3# Linux kernel version: 2.6.29-rc8
4# Fri Oct 12 20:54:57 2007 4# Fri Mar 13 01:32:59 2009
5# 5#
6CONFIG_PARISC=y 6CONFIG_PARISC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -33,17 +33,35 @@ CONFIG_SYSVIPC_SYSCTL=y
33CONFIG_POSIX_MQUEUE=y 33CONFIG_POSIX_MQUEUE=y
34# CONFIG_BSD_PROCESS_ACCT is not set 34# CONFIG_BSD_PROCESS_ACCT is not set
35# CONFIG_TASKSTATS is not set 35# CONFIG_TASKSTATS is not set
36# CONFIG_USER_NS is not set
37# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
37
38#
39# RCU Subsystem
40#
41CONFIG_CLASSIC_RCU=y
42# CONFIG_TREE_RCU is not set
43# CONFIG_PREEMPT_RCU is not set
44# CONFIG_TREE_RCU_TRACE is not set
45# CONFIG_PREEMPT_RCU_TRACE is not set
38CONFIG_IKCONFIG=y 46CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y 47CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=16 48CONFIG_LOG_BUF_SHIFT=16
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_CGROUPS is not set
41CONFIG_SYSFS_DEPRECATED=y 51CONFIG_SYSFS_DEPRECATED=y
52CONFIG_SYSFS_DEPRECATED_V2=y
42# CONFIG_RELAY is not set 53# CONFIG_RELAY is not set
54CONFIG_NAMESPACES=y
55# CONFIG_UTS_NS is not set
56# CONFIG_IPC_NS is not set
57# CONFIG_USER_NS is not set
58# CONFIG_PID_NS is not set
59# CONFIG_NET_NS is not set
43CONFIG_BLK_DEV_INITRD=y 60CONFIG_BLK_DEV_INITRD=y
44CONFIG_INITRAMFS_SOURCE="" 61CONFIG_INITRAMFS_SOURCE=""
45CONFIG_CC_OPTIMIZE_FOR_SIZE=y 62CONFIG_CC_OPTIMIZE_FOR_SIZE=y
46CONFIG_SYSCTL=y 63CONFIG_SYSCTL=y
64CONFIG_ANON_INODES=y
47# CONFIG_EMBEDDED is not set 65# CONFIG_EMBEDDED is not set
48CONFIG_SYSCTL_SYSCALL=y 66CONFIG_SYSCTL_SYSCALL=y
49CONFIG_KALLSYMS=y 67CONFIG_KALLSYMS=y
@@ -55,29 +73,39 @@ CONFIG_BUG=y
55CONFIG_ELF_CORE=y 73CONFIG_ELF_CORE=y
56CONFIG_BASE_FULL=y 74CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 75CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y 76CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y 77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
61CONFIG_EVENTFD=y 79CONFIG_EVENTFD=y
62CONFIG_SHMEM=y 80CONFIG_SHMEM=y
81CONFIG_AIO=y
63CONFIG_VM_EVENT_COUNTERS=y 82CONFIG_VM_EVENT_COUNTERS=y
83CONFIG_PCI_QUIRKS=y
84CONFIG_COMPAT_BRK=y
64CONFIG_SLAB=y 85CONFIG_SLAB=y
65# CONFIG_SLUB is not set 86# CONFIG_SLUB is not set
66# CONFIG_SLOB is not set 87# CONFIG_SLOB is not set
88CONFIG_PROFILING=y
89CONFIG_TRACEPOINTS=y
90# CONFIG_MARKERS is not set
91CONFIG_OPROFILE=m
92CONFIG_HAVE_OPROFILE=y
93# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
94CONFIG_SLABINFO=y
67CONFIG_RT_MUTEXES=y 95CONFIG_RT_MUTEXES=y
68# CONFIG_TINY_SHMEM is not set
69CONFIG_BASE_SMALL=0 96CONFIG_BASE_SMALL=0
70CONFIG_MODULES=y 97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
71CONFIG_MODULE_UNLOAD=y 99CONFIG_MODULE_UNLOAD=y
72CONFIG_MODULE_FORCE_UNLOAD=y 100CONFIG_MODULE_FORCE_UNLOAD=y
73# CONFIG_MODVERSIONS is not set 101# CONFIG_MODVERSIONS is not set
74# CONFIG_MODULE_SRCVERSION_ALL is not set 102# CONFIG_MODULE_SRCVERSION_ALL is not set
75CONFIG_KMOD=y 103CONFIG_INIT_ALL_POSSIBLE=y
76CONFIG_BLOCK=y 104CONFIG_BLOCK=y
77# CONFIG_LBD is not set 105# CONFIG_LBD is not set
78# CONFIG_BLK_DEV_IO_TRACE is not set 106# CONFIG_BLK_DEV_IO_TRACE is not set
79# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set 107# CONFIG_BLK_DEV_BSG is not set
108# CONFIG_BLK_DEV_INTEGRITY is not set
81 109
82# 110#
83# IO Schedulers 111# IO Schedulers
@@ -91,6 +119,7 @@ CONFIG_DEFAULT_AS=y
91# CONFIG_DEFAULT_CFQ is not set 119# CONFIG_DEFAULT_CFQ is not set
92# CONFIG_DEFAULT_NOOP is not set 120# CONFIG_DEFAULT_NOOP is not set
93CONFIG_DEFAULT_IOSCHED="anticipatory" 121CONFIG_DEFAULT_IOSCHED="anticipatory"
122# CONFIG_FREEZER is not set
94 123
95# 124#
96# Processor type and features 125# Processor type and features
@@ -114,17 +143,19 @@ CONFIG_HZ_250=y
114# CONFIG_HZ_300 is not set 143# CONFIG_HZ_300 is not set
115# CONFIG_HZ_1000 is not set 144# CONFIG_HZ_1000 is not set
116CONFIG_HZ=250 145CONFIG_HZ=250
146# CONFIG_SCHED_HRTICK is not set
117CONFIG_SELECT_MEMORY_MODEL=y 147CONFIG_SELECT_MEMORY_MODEL=y
118CONFIG_FLATMEM_MANUAL=y 148CONFIG_FLATMEM_MANUAL=y
119# CONFIG_DISCONTIGMEM_MANUAL is not set 149# CONFIG_DISCONTIGMEM_MANUAL is not set
120# CONFIG_SPARSEMEM_MANUAL is not set 150# CONFIG_SPARSEMEM_MANUAL is not set
121CONFIG_FLATMEM=y 151CONFIG_FLATMEM=y
122CONFIG_FLAT_NODE_MEM_MAP=y 152CONFIG_FLAT_NODE_MEM_MAP=y
123# CONFIG_SPARSEMEM_STATIC is not set 153CONFIG_PAGEFLAGS_EXTENDED=y
124CONFIG_SPLIT_PTLOCK_CPUS=4096 154CONFIG_SPLIT_PTLOCK_CPUS=4096
125# CONFIG_RESOURCES_64BIT is not set 155# CONFIG_PHYS_ADDR_T_64BIT is not set
126CONFIG_ZONE_DMA_FLAG=0 156CONFIG_ZONE_DMA_FLAG=0
127CONFIG_VIRT_TO_BUS=y 157CONFIG_VIRT_TO_BUS=y
158CONFIG_UNEVICTABLE_LRU=y
128# CONFIG_HPUX is not set 159# CONFIG_HPUX is not set
129 160
130# 161#
@@ -140,15 +171,14 @@ CONFIG_EISA_NAMES=y
140# CONFIG_ISA is not set 171# CONFIG_ISA is not set
141CONFIG_PCI=y 172CONFIG_PCI=y
142# CONFIG_ARCH_SUPPORTS_MSI is not set 173# CONFIG_ARCH_SUPPORTS_MSI is not set
174CONFIG_PCI_LEGACY=y
143# CONFIG_PCI_DEBUG is not set 175# CONFIG_PCI_DEBUG is not set
176# CONFIG_PCI_STUB is not set
144CONFIG_GSC_DINO=y 177CONFIG_GSC_DINO=y
145CONFIG_PCI_LBA=y 178CONFIG_PCI_LBA=y
146CONFIG_IOSAPIC=y 179CONFIG_IOSAPIC=y
147CONFIG_IOMMU_SBA=y 180CONFIG_IOMMU_SBA=y
148 181CONFIG_IOMMU_HELPER=y
149#
150# PCCARD (PCMCIA/CardBus) support
151#
152CONFIG_PCCARD=y 182CONFIG_PCCARD=y
153# CONFIG_PCMCIA_DEBUG is not set 183# CONFIG_PCMCIA_DEBUG is not set
154CONFIG_PCMCIA=y 184CONFIG_PCMCIA=y
@@ -183,16 +213,15 @@ CONFIG_PDC_STABLE=y
183# Executable file formats 213# Executable file formats
184# 214#
185CONFIG_BINFMT_ELF=y 215CONFIG_BINFMT_ELF=y
216# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
217# CONFIG_HAVE_AOUT is not set
186CONFIG_BINFMT_MISC=m 218CONFIG_BINFMT_MISC=m
187
188#
189# Networking
190#
191CONFIG_NET=y 219CONFIG_NET=y
192 220
193# 221#
194# Networking options 222# Networking options
195# 223#
224CONFIG_COMPAT_NET_DEV_OPS=y
196CONFIG_PACKET=y 225CONFIG_PACKET=y
197CONFIG_PACKET_MMAP=y 226CONFIG_PACKET_MMAP=y
198CONFIG_UNIX=y 227CONFIG_UNIX=y
@@ -200,6 +229,8 @@ CONFIG_XFRM=y
200CONFIG_XFRM_USER=m 229CONFIG_XFRM_USER=m
201# CONFIG_XFRM_SUB_POLICY is not set 230# CONFIG_XFRM_SUB_POLICY is not set
202# CONFIG_XFRM_MIGRATE is not set 231# CONFIG_XFRM_MIGRATE is not set
232# CONFIG_XFRM_STATISTICS is not set
233CONFIG_XFRM_IPCOMP=y
203CONFIG_NET_KEY=m 234CONFIG_NET_KEY=m
204# CONFIG_NET_KEY_MIGRATE is not set 235# CONFIG_NET_KEY_MIGRATE is not set
205CONFIG_INET=y 236CONFIG_INET=y
@@ -245,8 +276,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
245CONFIG_INET6_XFRM_MODE_BEET=y 276CONFIG_INET6_XFRM_MODE_BEET=y
246# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 277# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
247CONFIG_IPV6_SIT=y 278CONFIG_IPV6_SIT=y
279CONFIG_IPV6_NDISC_NODETYPE=y
248# CONFIG_IPV6_TUNNEL is not set 280# CONFIG_IPV6_TUNNEL is not set
249# CONFIG_IPV6_MULTIPLE_TABLES is not set 281# CONFIG_IPV6_MULTIPLE_TABLES is not set
282# CONFIG_IPV6_MROUTE is not set
250# CONFIG_NETWORK_SECMARK is not set 283# CONFIG_NETWORK_SECMARK is not set
251# CONFIG_NETFILTER is not set 284# CONFIG_NETFILTER is not set
252# CONFIG_IP_DCCP is not set 285# CONFIG_IP_DCCP is not set
@@ -254,6 +287,7 @@ CONFIG_IPV6_SIT=y
254# CONFIG_TIPC is not set 287# CONFIG_TIPC is not set
255# CONFIG_ATM is not set 288# CONFIG_ATM is not set
256# CONFIG_BRIDGE is not set 289# CONFIG_BRIDGE is not set
290# CONFIG_NET_DSA is not set
257# CONFIG_VLAN_8021Q is not set 291# CONFIG_VLAN_8021Q is not set
258# CONFIG_DECNET is not set 292# CONFIG_DECNET is not set
259CONFIG_LLC=m 293CONFIG_LLC=m
@@ -264,28 +298,26 @@ CONFIG_LLC2=m
264# CONFIG_LAPB is not set 298# CONFIG_LAPB is not set
265# CONFIG_ECONET is not set 299# CONFIG_ECONET is not set
266# CONFIG_WAN_ROUTER is not set 300# CONFIG_WAN_ROUTER is not set
267
268#
269# QoS and/or fair queueing
270#
271# CONFIG_NET_SCHED is not set 301# CONFIG_NET_SCHED is not set
302# CONFIG_DCB is not set
272 303
273# 304#
274# Network testing 305# Network testing
275# 306#
276# CONFIG_NET_PKTGEN is not set 307# CONFIG_NET_PKTGEN is not set
277# CONFIG_HAMRADIO is not set 308# CONFIG_HAMRADIO is not set
309# CONFIG_CAN is not set
278# CONFIG_IRDA is not set 310# CONFIG_IRDA is not set
279# CONFIG_BT is not set 311# CONFIG_BT is not set
280# CONFIG_AF_RXRPC is not set 312# CONFIG_AF_RXRPC is not set
281 313# CONFIG_PHONET is not set
282# 314CONFIG_WIRELESS=y
283# Wireless
284#
285# CONFIG_CFG80211 is not set 315# CONFIG_CFG80211 is not set
316CONFIG_WIRELESS_OLD_REGULATORY=y
286# CONFIG_WIRELESS_EXT is not set 317# CONFIG_WIRELESS_EXT is not set
318# CONFIG_LIB80211 is not set
287# CONFIG_MAC80211 is not set 319# CONFIG_MAC80211 is not set
288# CONFIG_IEEE80211 is not set 320# CONFIG_WIMAX is not set
289# CONFIG_RFKILL is not set 321# CONFIG_RFKILL is not set
290# CONFIG_NET_9P is not set 322# CONFIG_NET_9P is not set
291 323
@@ -300,6 +332,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
300# CONFIG_STANDALONE is not set 332# CONFIG_STANDALONE is not set
301# CONFIG_PREVENT_FIRMWARE_BUILD is not set 333# CONFIG_PREVENT_FIRMWARE_BUILD is not set
302CONFIG_FW_LOADER=y 334CONFIG_FW_LOADER=y
335CONFIG_FIRMWARE_IN_KERNEL=y
336CONFIG_EXTRA_FIRMWARE=""
303# CONFIG_DEBUG_DRIVER is not set 337# CONFIG_DEBUG_DRIVER is not set
304# CONFIG_DEBUG_DEVRES is not set 338# CONFIG_DEBUG_DEVRES is not set
305# CONFIG_SYS_HYPERVISOR is not set 339# CONFIG_SYS_HYPERVISOR is not set
@@ -330,63 +364,68 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y
330CONFIG_BLK_DEV_RAM=y 364CONFIG_BLK_DEV_RAM=y
331CONFIG_BLK_DEV_RAM_COUNT=16 365CONFIG_BLK_DEV_RAM_COUNT=16
332CONFIG_BLK_DEV_RAM_SIZE=6144 366CONFIG_BLK_DEV_RAM_SIZE=6144
333CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 367# CONFIG_BLK_DEV_XIP is not set
334# CONFIG_CDROM_PKTCDVD is not set 368# CONFIG_CDROM_PKTCDVD is not set
335# CONFIG_ATA_OVER_ETH is not set 369# CONFIG_ATA_OVER_ETH is not set
370# CONFIG_BLK_DEV_HD is not set
336CONFIG_MISC_DEVICES=y 371CONFIG_MISC_DEVICES=y
337# CONFIG_PHANTOM is not set 372# CONFIG_PHANTOM is not set
338# CONFIG_EEPROM_93CX6 is not set
339# CONFIG_SGI_IOC4 is not set 373# CONFIG_SGI_IOC4 is not set
340# CONFIG_TIFM_CORE is not set 374# CONFIG_TIFM_CORE is not set
375# CONFIG_ENCLOSURE_SERVICES is not set
376# CONFIG_HP_ILO is not set
377# CONFIG_C2PORT is not set
378
379#
380# EEPROM support
381#
382# CONFIG_EEPROM_93CX6 is not set
383CONFIG_HAVE_IDE=y
341CONFIG_IDE=y 384CONFIG_IDE=y
342CONFIG_BLK_DEV_IDE=y
343 385
344# 386#
345# Please see Documentation/ide.txt for help/info on IDE drives 387# Please see Documentation/ide/ide.txt for help/info on IDE drives
346# 388#
389CONFIG_IDE_ATAPI=y
347# CONFIG_BLK_DEV_IDE_SATA is not set 390# CONFIG_BLK_DEV_IDE_SATA is not set
348CONFIG_BLK_DEV_IDEDISK=y 391CONFIG_IDE_GD=y
349CONFIG_IDEDISK_MULTI_MODE=y 392CONFIG_IDE_GD_ATA=y
393# CONFIG_IDE_GD_ATAPI is not set
350CONFIG_BLK_DEV_IDECS=y 394CONFIG_BLK_DEV_IDECS=y
351# CONFIG_BLK_DEV_DELKIN is not set 395# CONFIG_BLK_DEV_DELKIN is not set
352CONFIG_BLK_DEV_IDECD=y 396CONFIG_BLK_DEV_IDECD=y
397CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
353# CONFIG_BLK_DEV_IDETAPE is not set 398# CONFIG_BLK_DEV_IDETAPE is not set
354# CONFIG_BLK_DEV_IDEFLOPPY is not set
355CONFIG_BLK_DEV_IDESCSI=y
356# CONFIG_IDE_TASK_IOCTL is not set 399# CONFIG_IDE_TASK_IOCTL is not set
357CONFIG_IDE_PROC_FS=y 400CONFIG_IDE_PROC_FS=y
358 401
359# 402#
360# IDE chipset support/bugfixes 403# IDE chipset support/bugfixes
361# 404#
362CONFIG_IDE_GENERIC=y
363# CONFIG_BLK_DEV_PLATFORM is not set 405# CONFIG_BLK_DEV_PLATFORM is not set
406CONFIG_BLK_DEV_IDEDMA_SFF=y
364 407
365# 408#
366# PCI IDE chipsets support 409# PCI IDE chipsets support
367# 410#
368CONFIG_BLK_DEV_IDEPCI=y 411CONFIG_BLK_DEV_IDEPCI=y
369CONFIG_IDEPCI_SHARE_IRQ=y
370CONFIG_IDEPCI_PCIBUS_ORDER=y 412CONFIG_IDEPCI_PCIBUS_ORDER=y
371# CONFIG_BLK_DEV_OFFBOARD is not set 413# CONFIG_BLK_DEV_OFFBOARD is not set
372CONFIG_BLK_DEV_GENERIC=y 414CONFIG_BLK_DEV_GENERIC=y
373# CONFIG_BLK_DEV_OPTI621 is not set 415# CONFIG_BLK_DEV_OPTI621 is not set
374CONFIG_BLK_DEV_IDEDMA_PCI=y 416CONFIG_BLK_DEV_IDEDMA_PCI=y
375# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
376CONFIG_IDEDMA_ONLYDISK=y
377# CONFIG_BLK_DEV_AEC62XX is not set 417# CONFIG_BLK_DEV_AEC62XX is not set
378# CONFIG_BLK_DEV_ALI15X3 is not set 418# CONFIG_BLK_DEV_ALI15X3 is not set
379# CONFIG_BLK_DEV_AMD74XX is not set 419# CONFIG_BLK_DEV_AMD74XX is not set
380# CONFIG_BLK_DEV_CMD64X is not set 420# CONFIG_BLK_DEV_CMD64X is not set
381# CONFIG_BLK_DEV_TRIFLEX is not set 421# CONFIG_BLK_DEV_TRIFLEX is not set
382# CONFIG_BLK_DEV_CY82C693 is not set
383# CONFIG_BLK_DEV_CS5520 is not set 422# CONFIG_BLK_DEV_CS5520 is not set
384# CONFIG_BLK_DEV_CS5530 is not set 423# CONFIG_BLK_DEV_CS5530 is not set
385# CONFIG_BLK_DEV_HPT34X is not set
386# CONFIG_BLK_DEV_HPT366 is not set 424# CONFIG_BLK_DEV_HPT366 is not set
387# CONFIG_BLK_DEV_JMICRON is not set 425# CONFIG_BLK_DEV_JMICRON is not set
388# CONFIG_BLK_DEV_SC1200 is not set 426# CONFIG_BLK_DEV_SC1200 is not set
389# CONFIG_BLK_DEV_PIIX is not set 427# CONFIG_BLK_DEV_PIIX is not set
428# CONFIG_BLK_DEV_IT8172 is not set
390# CONFIG_BLK_DEV_IT8213 is not set 429# CONFIG_BLK_DEV_IT8213 is not set
391# CONFIG_BLK_DEV_IT821X is not set 430# CONFIG_BLK_DEV_IT821X is not set
392CONFIG_BLK_DEV_NS87415=y 431CONFIG_BLK_DEV_NS87415=y
@@ -398,10 +437,7 @@ CONFIG_BLK_DEV_NS87415=y
398# CONFIG_BLK_DEV_TRM290 is not set 437# CONFIG_BLK_DEV_TRM290 is not set
399# CONFIG_BLK_DEV_VIA82CXXX is not set 438# CONFIG_BLK_DEV_VIA82CXXX is not set
400# CONFIG_BLK_DEV_TC86C001 is not set 439# CONFIG_BLK_DEV_TC86C001 is not set
401# CONFIG_IDE_ARM is not set
402CONFIG_BLK_DEV_IDEDMA=y 440CONFIG_BLK_DEV_IDEDMA=y
403# CONFIG_IDEDMA_IVB is not set
404# CONFIG_BLK_DEV_HD is not set
405 441
406# 442#
407# SCSI device support 443# SCSI device support
@@ -440,8 +476,10 @@ CONFIG_SCSI_SPI_ATTRS=y
440# CONFIG_SCSI_FC_ATTRS is not set 476# CONFIG_SCSI_FC_ATTRS is not set
441# CONFIG_SCSI_ISCSI_ATTRS is not set 477# CONFIG_SCSI_ISCSI_ATTRS is not set
442# CONFIG_SCSI_SAS_LIBSAS is not set 478# CONFIG_SCSI_SAS_LIBSAS is not set
479# CONFIG_SCSI_SRP_ATTRS is not set
443CONFIG_SCSI_LOWLEVEL=y 480CONFIG_SCSI_LOWLEVEL=y
444# CONFIG_ISCSI_TCP is not set 481# CONFIG_ISCSI_TCP is not set
482# CONFIG_SCSI_CXGB3_ISCSI is not set
445# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 483# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
446# CONFIG_SCSI_3W_9XXX is not set 484# CONFIG_SCSI_3W_9XXX is not set
447# CONFIG_SCSI_ACARD is not set 485# CONFIG_SCSI_ACARD is not set
@@ -452,11 +490,14 @@ CONFIG_SCSI_LOWLEVEL=y
452# CONFIG_SCSI_AIC79XX is not set 490# CONFIG_SCSI_AIC79XX is not set
453# CONFIG_SCSI_AIC94XX is not set 491# CONFIG_SCSI_AIC94XX is not set
454# CONFIG_SCSI_DPT_I2O is not set 492# CONFIG_SCSI_DPT_I2O is not set
493# CONFIG_SCSI_ADVANSYS is not set
455# CONFIG_SCSI_ARCMSR is not set 494# CONFIG_SCSI_ARCMSR is not set
456# CONFIG_MEGARAID_NEWGEN is not set 495# CONFIG_MEGARAID_NEWGEN is not set
457# CONFIG_MEGARAID_LEGACY is not set 496# CONFIG_MEGARAID_LEGACY is not set
458# CONFIG_MEGARAID_SAS is not set 497# CONFIG_MEGARAID_SAS is not set
459# CONFIG_SCSI_HPTIOP is not set 498# CONFIG_SCSI_HPTIOP is not set
499# CONFIG_LIBFC is not set
500# CONFIG_FCOE is not set
460# CONFIG_SCSI_DMX3191D is not set 501# CONFIG_SCSI_DMX3191D is not set
461# CONFIG_SCSI_FUTURE_DOMAIN is not set 502# CONFIG_SCSI_FUTURE_DOMAIN is not set
462# CONFIG_SCSI_IPS is not set 503# CONFIG_SCSI_IPS is not set
@@ -464,6 +505,7 @@ CONFIG_SCSI_LOWLEVEL=y
464# CONFIG_SCSI_INIA100 is not set 505# CONFIG_SCSI_INIA100 is not set
465# CONFIG_SCSI_PPA is not set 506# CONFIG_SCSI_PPA is not set
466# CONFIG_SCSI_IMM is not set 507# CONFIG_SCSI_IMM is not set
508# CONFIG_SCSI_MVSAS is not set
467CONFIG_SCSI_LASI700=y 509CONFIG_SCSI_LASI700=y
468CONFIG_53C700_LE_ON_BE=y 510CONFIG_53C700_LE_ON_BE=y
469# CONFIG_SCSI_STEX is not set 511# CONFIG_SCSI_STEX is not set
@@ -487,9 +529,11 @@ CONFIG_SCSI_NCR53C8XX_SYNC=20
487# CONFIG_SCSI_DEBUG is not set 529# CONFIG_SCSI_DEBUG is not set
488# CONFIG_SCSI_SRP is not set 530# CONFIG_SCSI_SRP is not set
489# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 531# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
532# CONFIG_SCSI_DH is not set
490# CONFIG_ATA is not set 533# CONFIG_ATA is not set
491CONFIG_MD=y 534CONFIG_MD=y
492CONFIG_BLK_DEV_MD=y 535CONFIG_BLK_DEV_MD=y
536CONFIG_MD_AUTODETECT=y
493CONFIG_MD_LINEAR=y 537CONFIG_MD_LINEAR=y
494CONFIG_MD_RAID0=y 538CONFIG_MD_RAID0=y
495CONFIG_MD_RAID1=y 539CONFIG_MD_RAID1=y
@@ -505,32 +549,47 @@ CONFIG_BLK_DEV_DM=y
505# CONFIG_DM_ZERO is not set 549# CONFIG_DM_ZERO is not set
506# CONFIG_DM_MULTIPATH is not set 550# CONFIG_DM_MULTIPATH is not set
507# CONFIG_DM_DELAY is not set 551# CONFIG_DM_DELAY is not set
552# CONFIG_DM_UEVENT is not set
553# CONFIG_FUSION is not set
508 554
509# 555#
510# Fusion MPT device support 556# IEEE 1394 (FireWire) support
511# 557#
512# CONFIG_FUSION is not set
513# CONFIG_FUSION_SPI is not set
514# CONFIG_FUSION_FC is not set
515# CONFIG_FUSION_SAS is not set
516 558
517# 559#
518# IEEE 1394 (FireWire) support 560# Enable only one of the two stacks, unless you know what you are doing
519# 561#
520# CONFIG_FIREWIRE is not set 562# CONFIG_FIREWIRE is not set
521# CONFIG_IEEE1394 is not set 563# CONFIG_IEEE1394 is not set
522# CONFIG_I2O is not set 564# CONFIG_I2O is not set
523CONFIG_NETDEVICES=y 565CONFIG_NETDEVICES=y
524# CONFIG_NETDEVICES_MULTIQUEUE is not set
525CONFIG_DUMMY=m 566CONFIG_DUMMY=m
526CONFIG_BONDING=m 567CONFIG_BONDING=m
527# CONFIG_MACVLAN is not set 568# CONFIG_MACVLAN is not set
528# CONFIG_EQUALIZER is not set 569# CONFIG_EQUALIZER is not set
529CONFIG_TUN=m 570CONFIG_TUN=m
530# CONFIG_VETH is not set 571# CONFIG_VETH is not set
531# CONFIG_IP1000 is not set
532# CONFIG_ARCNET is not set 572# CONFIG_ARCNET is not set
533# CONFIG_PHYLIB is not set 573CONFIG_PHYLIB=y
574
575#
576# MII PHY device drivers
577#
578# CONFIG_MARVELL_PHY is not set
579# CONFIG_DAVICOM_PHY is not set
580# CONFIG_QSEMI_PHY is not set
581# CONFIG_LXT_PHY is not set
582# CONFIG_CICADA_PHY is not set
583# CONFIG_VITESSE_PHY is not set
584# CONFIG_SMSC_PHY is not set
585# CONFIG_BROADCOM_PHY is not set
586# CONFIG_ICPLUS_PHY is not set
587# CONFIG_REALTEK_PHY is not set
588# CONFIG_NATIONAL_PHY is not set
589# CONFIG_STE10XP is not set
590# CONFIG_LSI_ET1011C_PHY is not set
591# CONFIG_FIXED_PHY is not set
592# CONFIG_MDIO_BITBANG is not set
534CONFIG_NET_ETHERNET=y 593CONFIG_NET_ETHERNET=y
535CONFIG_MII=m 594CONFIG_MII=m
536CONFIG_LASI_82596=y 595CONFIG_LASI_82596=y
@@ -550,13 +609,15 @@ CONFIG_TULIP=y
550# CONFIG_DM9102 is not set 609# CONFIG_DM9102 is not set
551# CONFIG_ULI526X is not set 610# CONFIG_ULI526X is not set
552# CONFIG_PCMCIA_XIRCOM is not set 611# CONFIG_PCMCIA_XIRCOM is not set
553# CONFIG_PCMCIA_XIRTULIP is not set
554# CONFIG_DEPCA is not set 612# CONFIG_DEPCA is not set
555# CONFIG_HP100 is not set 613# CONFIG_HP100 is not set
556# CONFIG_IBM_NEW_EMAC_ZMII is not set 614# CONFIG_IBM_NEW_EMAC_ZMII is not set
557# CONFIG_IBM_NEW_EMAC_RGMII is not set 615# CONFIG_IBM_NEW_EMAC_RGMII is not set
558# CONFIG_IBM_NEW_EMAC_TAH is not set 616# CONFIG_IBM_NEW_EMAC_TAH is not set
559# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 617# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
618# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
619# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
620# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
560CONFIG_NET_PCI=y 621CONFIG_NET_PCI=y
561# CONFIG_PCNET32 is not set 622# CONFIG_PCNET32 is not set
562# CONFIG_AMD8111_ETH is not set 623# CONFIG_AMD8111_ETH is not set
@@ -564,7 +625,7 @@ CONFIG_NET_PCI=y
564# CONFIG_AC3200 is not set 625# CONFIG_AC3200 is not set
565# CONFIG_B44 is not set 626# CONFIG_B44 is not set
566# CONFIG_FORCEDETH is not set 627# CONFIG_FORCEDETH is not set
567# CONFIG_EEPRO100 is not set 628# CONFIG_CS89x0 is not set
568# CONFIG_E100 is not set 629# CONFIG_E100 is not set
569# CONFIG_LNE390 is not set 630# CONFIG_LNE390 is not set
570# CONFIG_FEALNX is not set 631# CONFIG_FEALNX is not set
@@ -574,19 +635,24 @@ CONFIG_NET_PCI=y
574# CONFIG_ES3210 is not set 635# CONFIG_ES3210 is not set
575# CONFIG_8139CP is not set 636# CONFIG_8139CP is not set
576# CONFIG_8139TOO is not set 637# CONFIG_8139TOO is not set
638# CONFIG_R6040 is not set
577# CONFIG_SIS900 is not set 639# CONFIG_SIS900 is not set
578# CONFIG_EPIC100 is not set 640# CONFIG_EPIC100 is not set
641# CONFIG_SMSC9420 is not set
579# CONFIG_SUNDANCE is not set 642# CONFIG_SUNDANCE is not set
580# CONFIG_TLAN is not set 643# CONFIG_TLAN is not set
581# CONFIG_VIA_RHINE is not set 644# CONFIG_VIA_RHINE is not set
582# CONFIG_SC92031 is not set 645# CONFIG_SC92031 is not set
583# CONFIG_NET_POCKET is not set 646# CONFIG_NET_POCKET is not set
647# CONFIG_ATL2 is not set
584CONFIG_NETDEV_1000=y 648CONFIG_NETDEV_1000=y
585CONFIG_ACENIC=y 649CONFIG_ACENIC=y
586# CONFIG_ACENIC_OMIT_TIGON_I is not set 650# CONFIG_ACENIC_OMIT_TIGON_I is not set
587# CONFIG_DL2K is not set 651# CONFIG_DL2K is not set
588# CONFIG_E1000 is not set 652# CONFIG_E1000 is not set
589# CONFIG_E1000E is not set 653# CONFIG_E1000E is not set
654# CONFIG_IP1000 is not set
655# CONFIG_IGB is not set
590# CONFIG_NS83820 is not set 656# CONFIG_NS83820 is not set
591# CONFIG_HAMACHI is not set 657# CONFIG_HAMACHI is not set
592# CONFIG_YELLOWFIN is not set 658# CONFIG_YELLOWFIN is not set
@@ -594,23 +660,31 @@ CONFIG_ACENIC=y
594# CONFIG_SIS190 is not set 660# CONFIG_SIS190 is not set
595# CONFIG_SKGE is not set 661# CONFIG_SKGE is not set
596# CONFIG_SKY2 is not set 662# CONFIG_SKY2 is not set
597# CONFIG_SK98LIN is not set
598# CONFIG_VIA_VELOCITY is not set 663# CONFIG_VIA_VELOCITY is not set
599CONFIG_TIGON3=y 664CONFIG_TIGON3=y
600# CONFIG_BNX2 is not set 665# CONFIG_BNX2 is not set
601# CONFIG_QLA3XXX is not set 666# CONFIG_QLA3XXX is not set
602# CONFIG_ATL1 is not set 667# CONFIG_ATL1 is not set
668# CONFIG_ATL1E is not set
669# CONFIG_ATL1C is not set
670# CONFIG_JME is not set
603CONFIG_NETDEV_10000=y 671CONFIG_NETDEV_10000=y
604# CONFIG_CHELSIO_T1 is not set 672# CONFIG_CHELSIO_T1 is not set
673CONFIG_CHELSIO_T3_DEPENDS=y
605# CONFIG_CHELSIO_T3 is not set 674# CONFIG_CHELSIO_T3 is not set
675# CONFIG_ENIC is not set
606# CONFIG_IXGBE is not set 676# CONFIG_IXGBE is not set
607# CONFIG_IXGB is not set 677# CONFIG_IXGB is not set
608# CONFIG_S2IO is not set 678# CONFIG_S2IO is not set
609# CONFIG_MYRI10GE is not set 679# CONFIG_MYRI10GE is not set
610# CONFIG_NETXEN_NIC is not set 680# CONFIG_NETXEN_NIC is not set
611# CONFIG_NIU is not set 681# CONFIG_NIU is not set
682# CONFIG_MLX4_EN is not set
612# CONFIG_MLX4_CORE is not set 683# CONFIG_MLX4_CORE is not set
613# CONFIG_TEHUTI is not set 684# CONFIG_TEHUTI is not set
685# CONFIG_BNX2X is not set
686# CONFIG_QLGE is not set
687# CONFIG_SFC is not set
614# CONFIG_TR is not set 688# CONFIG_TR is not set
615 689
616# 690#
@@ -618,6 +692,11 @@ CONFIG_NETDEV_10000=y
618# 692#
619# CONFIG_WLAN_PRE80211 is not set 693# CONFIG_WLAN_PRE80211 is not set
620# CONFIG_WLAN_80211 is not set 694# CONFIG_WLAN_80211 is not set
695# CONFIG_IWLWIFI_LEDS is not set
696
697#
698# Enable WiMAX (Networking options) to see the WiMAX drivers
699#
621 700
622# 701#
623# USB Network Adapters 702# USB Network Adapters
@@ -626,7 +705,6 @@ CONFIG_NETDEV_10000=y
626# CONFIG_USB_KAWETH is not set 705# CONFIG_USB_KAWETH is not set
627# CONFIG_USB_PEGASUS is not set 706# CONFIG_USB_PEGASUS is not set
628# CONFIG_USB_RTL8150 is not set 707# CONFIG_USB_RTL8150 is not set
629# CONFIG_USB_USBNET_MII is not set
630# CONFIG_USB_USBNET is not set 708# CONFIG_USB_USBNET is not set
631CONFIG_NET_PCMCIA=y 709CONFIG_NET_PCMCIA=y
632# CONFIG_PCMCIA_3C589 is not set 710# CONFIG_PCMCIA_3C589 is not set
@@ -654,7 +732,6 @@ CONFIG_PPPOE=m
654# CONFIG_SLIP is not set 732# CONFIG_SLIP is not set
655CONFIG_SLHC=m 733CONFIG_SLHC=m
656# CONFIG_NET_FC is not set 734# CONFIG_NET_FC is not set
657# CONFIG_SHAPER is not set
658# CONFIG_NETCONSOLE is not set 735# CONFIG_NETCONSOLE is not set
659# CONFIG_NETPOLL is not set 736# CONFIG_NETPOLL is not set
660# CONFIG_NET_POLL_CONTROLLER is not set 737# CONFIG_NET_POLL_CONTROLLER is not set
@@ -676,7 +753,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
676CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 753CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
677CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 754CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
678# CONFIG_INPUT_JOYDEV is not set 755# CONFIG_INPUT_JOYDEV is not set
679# CONFIG_INPUT_TSDEV is not set
680# CONFIG_INPUT_EVDEV is not set 756# CONFIG_INPUT_EVDEV is not set
681# CONFIG_INPUT_EVBUG is not set 757# CONFIG_INPUT_EVBUG is not set
682 758
@@ -699,11 +775,12 @@ CONFIG_MOUSE_PS2=y
699CONFIG_MOUSE_PS2_ALPS=y 775CONFIG_MOUSE_PS2_ALPS=y
700CONFIG_MOUSE_PS2_LOGIPS2PP=y 776CONFIG_MOUSE_PS2_LOGIPS2PP=y
701CONFIG_MOUSE_PS2_SYNAPTICS=y 777CONFIG_MOUSE_PS2_SYNAPTICS=y
702CONFIG_MOUSE_PS2_LIFEBOOK=y
703CONFIG_MOUSE_PS2_TRACKPOINT=y 778CONFIG_MOUSE_PS2_TRACKPOINT=y
779# CONFIG_MOUSE_PS2_ELANTECH is not set
704# CONFIG_MOUSE_PS2_TOUCHKIT is not set 780# CONFIG_MOUSE_PS2_TOUCHKIT is not set
705CONFIG_MOUSE_SERIAL=y 781CONFIG_MOUSE_SERIAL=y
706# CONFIG_MOUSE_APPLETOUCH is not set 782# CONFIG_MOUSE_APPLETOUCH is not set
783# CONFIG_MOUSE_BCM5974 is not set
707# CONFIG_MOUSE_VSXXXAA is not set 784# CONFIG_MOUSE_VSXXXAA is not set
708CONFIG_MOUSE_HIL=y 785CONFIG_MOUSE_HIL=y
709# CONFIG_INPUT_JOYSTICK is not set 786# CONFIG_INPUT_JOYSTICK is not set
@@ -729,10 +806,13 @@ CONFIG_SERIO_LIBPS2=y
729# Character devices 806# Character devices
730# 807#
731CONFIG_VT=y 808CONFIG_VT=y
809CONFIG_CONSOLE_TRANSLATIONS=y
732CONFIG_VT_CONSOLE=y 810CONFIG_VT_CONSOLE=y
733CONFIG_HW_CONSOLE=y 811CONFIG_HW_CONSOLE=y
734# CONFIG_VT_HW_CONSOLE_BINDING is not set 812# CONFIG_VT_HW_CONSOLE_BINDING is not set
813CONFIG_DEVKMEM=y
735# CONFIG_SERIAL_NONSTANDARD is not set 814# CONFIG_SERIAL_NONSTANDARD is not set
815# CONFIG_NOZOMI is not set
736 816
737# 817#
738# Serial drivers 818# Serial drivers
@@ -759,21 +839,16 @@ CONFIG_SERIAL_CORE=y
759CONFIG_SERIAL_CORE_CONSOLE=y 839CONFIG_SERIAL_CORE_CONSOLE=y
760# CONFIG_SERIAL_JSM is not set 840# CONFIG_SERIAL_JSM is not set
761CONFIG_UNIX98_PTYS=y 841CONFIG_UNIX98_PTYS=y
842# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
762CONFIG_LEGACY_PTYS=y 843CONFIG_LEGACY_PTYS=y
763CONFIG_LEGACY_PTY_COUNT=64 844CONFIG_LEGACY_PTY_COUNT=64
764CONFIG_PRINTER=m 845CONFIG_PRINTER=m
765# CONFIG_LP_CONSOLE is not set 846# CONFIG_LP_CONSOLE is not set
766CONFIG_PPDEV=m 847CONFIG_PPDEV=m
767# CONFIG_TIPAR is not set
768# CONFIG_IPMI_HANDLER is not set 848# CONFIG_IPMI_HANDLER is not set
769# CONFIG_WATCHDOG is not set
770# CONFIG_HW_RANDOM is not set 849# CONFIG_HW_RANDOM is not set
771CONFIG_GEN_RTC=y
772CONFIG_GEN_RTC_X=y
773# CONFIG_R3964 is not set 850# CONFIG_R3964 is not set
774# CONFIG_APPLICOM is not set 851# CONFIG_APPLICOM is not set
775# CONFIG_AGP is not set
776# CONFIG_DRM is not set
777 852
778# 853#
779# PCMCIA character devices 854# PCMCIA character devices
@@ -781,60 +856,70 @@ CONFIG_GEN_RTC_X=y
781# CONFIG_SYNCLINK_CS is not set 856# CONFIG_SYNCLINK_CS is not set
782# CONFIG_CARDMAN_4000 is not set 857# CONFIG_CARDMAN_4000 is not set
783# CONFIG_CARDMAN_4040 is not set 858# CONFIG_CARDMAN_4040 is not set
859# CONFIG_IPWIRELESS is not set
784# CONFIG_RAW_DRIVER is not set 860# CONFIG_RAW_DRIVER is not set
785# CONFIG_TCG_TPM is not set 861# CONFIG_TCG_TPM is not set
786CONFIG_DEVPORT=y 862CONFIG_DEVPORT=y
787# CONFIG_I2C is not set 863# CONFIG_I2C is not set
788
789#
790# SPI support
791#
792# CONFIG_SPI is not set 864# CONFIG_SPI is not set
793# CONFIG_SPI_MASTER is not set
794# CONFIG_W1 is not set 865# CONFIG_W1 is not set
795# CONFIG_POWER_SUPPLY is not set 866# CONFIG_POWER_SUPPLY is not set
796# CONFIG_HWMON is not set 867# CONFIG_HWMON is not set
868# CONFIG_THERMAL is not set
869# CONFIG_THERMAL_HWMON is not set
870# CONFIG_WATCHDOG is not set
871CONFIG_SSB_POSSIBLE=y
797 872
798# 873#
799# Sonics Silicon Backplane 874# Sonics Silicon Backplane
800# 875#
801CONFIG_SSB_POSSIBLE=y
802# CONFIG_SSB is not set 876# CONFIG_SSB is not set
803 877
804# 878#
805# Multifunction device drivers 879# Multifunction device drivers
806# 880#
881# CONFIG_MFD_CORE is not set
807# CONFIG_MFD_SM501 is not set 882# CONFIG_MFD_SM501 is not set
883# CONFIG_HTC_PASIC3 is not set
884# CONFIG_MFD_TMIO is not set
885# CONFIG_REGULATOR is not set
808 886
809# 887#
810# Multimedia devices 888# Multimedia devices
811# 889#
890
891#
892# Multimedia core support
893#
812# CONFIG_VIDEO_DEV is not set 894# CONFIG_VIDEO_DEV is not set
813# CONFIG_DVB_CORE is not set 895# CONFIG_DVB_CORE is not set
814# CONFIG_DAB is not set 896# CONFIG_VIDEO_MEDIA is not set
815 897
816# 898#
817# Graphics support 899# Multimedia drivers
818# 900#
819# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 901# CONFIG_DAB is not set
820 902
821# 903#
822# Display device support 904# Graphics support
823# 905#
824# CONFIG_DISPLAY_SUPPORT is not set 906# CONFIG_AGP is not set
907# CONFIG_DRM is not set
825# CONFIG_VGASTATE is not set 908# CONFIG_VGASTATE is not set
826CONFIG_VIDEO_OUTPUT_CONTROL=m 909CONFIG_VIDEO_OUTPUT_CONTROL=m
827CONFIG_FB=y 910CONFIG_FB=y
828# CONFIG_FIRMWARE_EDID is not set 911# CONFIG_FIRMWARE_EDID is not set
829# CONFIG_FB_DDC is not set 912# CONFIG_FB_DDC is not set
913# CONFIG_FB_BOOT_VESA_SUPPORT is not set
830CONFIG_FB_CFB_FILLRECT=y 914CONFIG_FB_CFB_FILLRECT=y
831CONFIG_FB_CFB_COPYAREA=y 915CONFIG_FB_CFB_COPYAREA=y
832CONFIG_FB_CFB_IMAGEBLIT=y 916CONFIG_FB_CFB_IMAGEBLIT=y
917# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
833# CONFIG_FB_SYS_FILLRECT is not set 918# CONFIG_FB_SYS_FILLRECT is not set
834# CONFIG_FB_SYS_COPYAREA is not set 919# CONFIG_FB_SYS_COPYAREA is not set
835# CONFIG_FB_SYS_IMAGEBLIT is not set 920# CONFIG_FB_SYS_IMAGEBLIT is not set
921# CONFIG_FB_FOREIGN_ENDIAN is not set
836# CONFIG_FB_SYS_FOPS is not set 922# CONFIG_FB_SYS_FOPS is not set
837CONFIG_FB_DEFERRED_IO=y
838# CONFIG_FB_SVGALIB is not set 923# CONFIG_FB_SVGALIB is not set
839# CONFIG_FB_MACMODES is not set 924# CONFIG_FB_MACMODES is not set
840# CONFIG_FB_BACKLIGHT is not set 925# CONFIG_FB_BACKLIGHT is not set
@@ -860,6 +945,7 @@ CONFIG_FB_STI=y
860# CONFIG_FB_S3 is not set 945# CONFIG_FB_S3 is not set
861# CONFIG_FB_SAVAGE is not set 946# CONFIG_FB_SAVAGE is not set
862# CONFIG_FB_SIS is not set 947# CONFIG_FB_SIS is not set
948# CONFIG_FB_VIA is not set
863# CONFIG_FB_NEOMAGIC is not set 949# CONFIG_FB_NEOMAGIC is not set
864# CONFIG_FB_KYRO is not set 950# CONFIG_FB_KYRO is not set
865# CONFIG_FB_3DFX is not set 951# CONFIG_FB_3DFX is not set
@@ -868,7 +954,16 @@ CONFIG_FB_STI=y
868# CONFIG_FB_TRIDENT is not set 954# CONFIG_FB_TRIDENT is not set
869# CONFIG_FB_ARK is not set 955# CONFIG_FB_ARK is not set
870# CONFIG_FB_PM3 is not set 956# CONFIG_FB_PM3 is not set
957# CONFIG_FB_CARMINE is not set
871# CONFIG_FB_VIRTUAL is not set 958# CONFIG_FB_VIRTUAL is not set
959# CONFIG_FB_METRONOME is not set
960# CONFIG_FB_MB862XX is not set
961# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
962
963#
964# Display device support
965#
966# CONFIG_DISPLAY_SUPPORT is not set
872 967
873# 968#
874# Console display driver support 969# Console display driver support
@@ -896,15 +991,8 @@ CONFIG_LOGO=y
896# CONFIG_LOGO_LINUX_VGA16 is not set 991# CONFIG_LOGO_LINUX_VGA16 is not set
897# CONFIG_LOGO_LINUX_CLUT224 is not set 992# CONFIG_LOGO_LINUX_CLUT224 is not set
898CONFIG_LOGO_PARISC_CLUT224=y 993CONFIG_LOGO_PARISC_CLUT224=y
899
900#
901# Sound
902#
903CONFIG_SOUND=y 994CONFIG_SOUND=y
904 995CONFIG_SOUND_OSS_CORE=y
905#
906# Advanced Linux Sound Architecture
907#
908CONFIG_SND=y 996CONFIG_SND=y
909CONFIG_SND_TIMER=y 997CONFIG_SND_TIMER=y
910CONFIG_SND_PCM=y 998CONFIG_SND_PCM=y
@@ -920,11 +1008,9 @@ CONFIG_SND_SUPPORT_OLD_API=y
920CONFIG_SND_VERBOSE_PROCFS=y 1008CONFIG_SND_VERBOSE_PROCFS=y
921# CONFIG_SND_VERBOSE_PRINTK is not set 1009# CONFIG_SND_VERBOSE_PRINTK is not set
922# CONFIG_SND_DEBUG is not set 1010# CONFIG_SND_DEBUG is not set
923 1011CONFIG_SND_VMASTER=y
924#
925# Generic devices
926#
927CONFIG_SND_AC97_CODEC=y 1012CONFIG_SND_AC97_CODEC=y
1013CONFIG_SND_DRIVERS=y
928# CONFIG_SND_DUMMY is not set 1014# CONFIG_SND_DUMMY is not set
929# CONFIG_SND_VIRMIDI is not set 1015# CONFIG_SND_VIRMIDI is not set
930# CONFIG_SND_MTPAV is not set 1016# CONFIG_SND_MTPAV is not set
@@ -932,10 +1018,8 @@ CONFIG_SND_AC97_CODEC=y
932# CONFIG_SND_SERIAL_U16550 is not set 1018# CONFIG_SND_SERIAL_U16550 is not set
933# CONFIG_SND_MPU401 is not set 1019# CONFIG_SND_MPU401 is not set
934# CONFIG_SND_PORTMAN2X4 is not set 1020# CONFIG_SND_PORTMAN2X4 is not set
935 1021# CONFIG_SND_AC97_POWER_SAVE is not set
936# 1022CONFIG_SND_PCI=y
937# PCI devices
938#
939CONFIG_SND_AD1889=y 1023CONFIG_SND_AD1889=y
940# CONFIG_SND_ALS300 is not set 1024# CONFIG_SND_ALS300 is not set
941# CONFIG_SND_ALI5451 is not set 1025# CONFIG_SND_ALI5451 is not set
@@ -944,10 +1028,12 @@ CONFIG_SND_AD1889=y
944# CONFIG_SND_AU8810 is not set 1028# CONFIG_SND_AU8810 is not set
945# CONFIG_SND_AU8820 is not set 1029# CONFIG_SND_AU8820 is not set
946# CONFIG_SND_AU8830 is not set 1030# CONFIG_SND_AU8830 is not set
1031# CONFIG_SND_AW2 is not set
947# CONFIG_SND_AZT3328 is not set 1032# CONFIG_SND_AZT3328 is not set
948# CONFIG_SND_BT87X is not set 1033# CONFIG_SND_BT87X is not set
949# CONFIG_SND_CA0106 is not set 1034# CONFIG_SND_CA0106 is not set
950# CONFIG_SND_CMIPCI is not set 1035# CONFIG_SND_CMIPCI is not set
1036# CONFIG_SND_OXYGEN is not set
951# CONFIG_SND_CS4281 is not set 1037# CONFIG_SND_CS4281 is not set
952# CONFIG_SND_CS46XX is not set 1038# CONFIG_SND_CS46XX is not set
953# CONFIG_SND_DARLA20 is not set 1039# CONFIG_SND_DARLA20 is not set
@@ -972,6 +1058,7 @@ CONFIG_SND_AD1889=y
972# CONFIG_SND_HDA_INTEL is not set 1058# CONFIG_SND_HDA_INTEL is not set
973# CONFIG_SND_HDSP is not set 1059# CONFIG_SND_HDSP is not set
974# CONFIG_SND_HDSPM is not set 1060# CONFIG_SND_HDSPM is not set
1061# CONFIG_SND_HIFIER is not set
975# CONFIG_SND_ICE1712 is not set 1062# CONFIG_SND_ICE1712 is not set
976# CONFIG_SND_ICE1724 is not set 1063# CONFIG_SND_ICE1724 is not set
977# CONFIG_SND_INTEL8X0 is not set 1064# CONFIG_SND_INTEL8X0 is not set
@@ -989,58 +1076,67 @@ CONFIG_SND_AD1889=y
989# CONFIG_SND_TRIDENT is not set 1076# CONFIG_SND_TRIDENT is not set
990# CONFIG_SND_VIA82XX is not set 1077# CONFIG_SND_VIA82XX is not set
991# CONFIG_SND_VIA82XX_MODEM is not set 1078# CONFIG_SND_VIA82XX_MODEM is not set
1079# CONFIG_SND_VIRTUOSO is not set
992# CONFIG_SND_VX222 is not set 1080# CONFIG_SND_VX222 is not set
993# CONFIG_SND_YMFPCI is not set 1081# CONFIG_SND_YMFPCI is not set
994# CONFIG_SND_AC97_POWER_SAVE is not set 1082CONFIG_SND_USB=y
995
996#
997# USB devices
998#
999# CONFIG_SND_USB_AUDIO is not set 1083# CONFIG_SND_USB_AUDIO is not set
1000# CONFIG_SND_USB_CAIAQ is not set 1084# CONFIG_SND_USB_CAIAQ is not set
1001 1085CONFIG_SND_PCMCIA=y
1002#
1003# PCMCIA devices
1004#
1005# CONFIG_SND_VXPOCKET is not set 1086# CONFIG_SND_VXPOCKET is not set
1006# CONFIG_SND_PDAUDIOCF is not set 1087# CONFIG_SND_PDAUDIOCF is not set
1007 1088CONFIG_SND_GSC=y
1008#
1009# GSC devices
1010#
1011CONFIG_SND_HARMONY=y 1089CONFIG_SND_HARMONY=y
1012
1013#
1014# System on Chip audio support
1015#
1016# CONFIG_SND_SOC is not set 1090# CONFIG_SND_SOC is not set
1017
1018#
1019# SoC Audio support for SuperH
1020#
1021
1022#
1023# Open Sound System
1024#
1025# CONFIG_SOUND_PRIME is not set 1091# CONFIG_SOUND_PRIME is not set
1026CONFIG_AC97_BUS=y 1092CONFIG_AC97_BUS=y
1027CONFIG_HID_SUPPORT=y 1093CONFIG_HID_SUPPORT=y
1028CONFIG_HID=y 1094CONFIG_HID=y
1029CONFIG_HID_DEBUG=y 1095CONFIG_HID_DEBUG=y
1096# CONFIG_HIDRAW is not set
1030 1097
1031# 1098#
1032# USB Input Devices 1099# USB Input Devices
1033# 1100#
1034CONFIG_USB_HID=y 1101CONFIG_USB_HID=y
1035# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1102# CONFIG_HID_PID is not set
1036# CONFIG_HID_FF is not set
1037# CONFIG_USB_HIDDEV is not set 1103# CONFIG_USB_HIDDEV is not set
1104
1105#
1106# Special HID drivers
1107#
1108CONFIG_HID_COMPAT=y
1109CONFIG_HID_A4TECH=y
1110CONFIG_HID_APPLE=y
1111CONFIG_HID_BELKIN=y
1112CONFIG_HID_CHERRY=y
1113CONFIG_HID_CHICONY=y
1114CONFIG_HID_CYPRESS=y
1115CONFIG_HID_EZKEY=y
1116CONFIG_HID_GYRATION=y
1117CONFIG_HID_LOGITECH=y
1118# CONFIG_LOGITECH_FF is not set
1119# CONFIG_LOGIRUMBLEPAD2_FF is not set
1120CONFIG_HID_MICROSOFT=y
1121CONFIG_HID_MONTEREY=y
1122CONFIG_HID_NTRIG=y
1123CONFIG_HID_PANTHERLORD=y
1124# CONFIG_PANTHERLORD_FF is not set
1125CONFIG_HID_PETALYNX=y
1126CONFIG_HID_SAMSUNG=y
1127CONFIG_HID_SONY=y
1128CONFIG_HID_SUNPLUS=y
1129# CONFIG_GREENASIA_FF is not set
1130CONFIG_HID_TOPSEED=y
1131# CONFIG_THRUSTMASTER_FF is not set
1132# CONFIG_ZEROPLUS_FF is not set
1038CONFIG_USB_SUPPORT=y 1133CONFIG_USB_SUPPORT=y
1039CONFIG_USB_ARCH_HAS_HCD=y 1134CONFIG_USB_ARCH_HAS_HCD=y
1040CONFIG_USB_ARCH_HAS_OHCI=y 1135CONFIG_USB_ARCH_HAS_OHCI=y
1041CONFIG_USB_ARCH_HAS_EHCI=y 1136CONFIG_USB_ARCH_HAS_EHCI=y
1042CONFIG_USB=y 1137CONFIG_USB=y
1043# CONFIG_USB_DEBUG is not set 1138# CONFIG_USB_DEBUG is not set
1139# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1044 1140
1045# 1141#
1046# Miscellaneous USB options 1142# Miscellaneous USB options
@@ -1049,12 +1145,18 @@ CONFIG_USB_DEVICEFS=y
1049CONFIG_USB_DEVICE_CLASS=y 1145CONFIG_USB_DEVICE_CLASS=y
1050# CONFIG_USB_DYNAMIC_MINORS is not set 1146# CONFIG_USB_DYNAMIC_MINORS is not set
1051# CONFIG_USB_OTG is not set 1147# CONFIG_USB_OTG is not set
1148CONFIG_USB_MON=y
1149# CONFIG_USB_WUSB is not set
1150# CONFIG_USB_WUSB_CBAF is not set
1052 1151
1053# 1152#
1054# USB Host Controller Drivers 1153# USB Host Controller Drivers
1055# 1154#
1155# CONFIG_USB_C67X00_HCD is not set
1056# CONFIG_USB_EHCI_HCD is not set 1156# CONFIG_USB_EHCI_HCD is not set
1157# CONFIG_USB_OXU210HP_HCD is not set
1057# CONFIG_USB_ISP116X_HCD is not set 1158# CONFIG_USB_ISP116X_HCD is not set
1159# CONFIG_USB_ISP1760_HCD is not set
1058CONFIG_USB_OHCI_HCD=y 1160CONFIG_USB_OHCI_HCD=y
1059# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1161# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1060# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1162# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1062,19 +1164,23 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1062CONFIG_USB_UHCI_HCD=y 1164CONFIG_USB_UHCI_HCD=y
1063# CONFIG_USB_SL811_HCD is not set 1165# CONFIG_USB_SL811_HCD is not set
1064# CONFIG_USB_R8A66597_HCD is not set 1166# CONFIG_USB_R8A66597_HCD is not set
1167# CONFIG_USB_WHCI_HCD is not set
1168# CONFIG_USB_HWA_HCD is not set
1065 1169
1066# 1170#
1067# USB Device Class drivers 1171# USB Device Class drivers
1068# 1172#
1069# CONFIG_USB_ACM is not set 1173# CONFIG_USB_ACM is not set
1070# CONFIG_USB_PRINTER is not set 1174# CONFIG_USB_PRINTER is not set
1175# CONFIG_USB_WDM is not set
1176# CONFIG_USB_TMC is not set
1071 1177
1072# 1178#
1073# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1179# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1074# 1180#
1075 1181
1076# 1182#
1077# may also be needed; see USB_STORAGE Help for more information 1183# see USB_STORAGE Help for more information
1078# 1184#
1079# CONFIG_USB_STORAGE is not set 1185# CONFIG_USB_STORAGE is not set
1080# CONFIG_USB_LIBUSUAL is not set 1186# CONFIG_USB_LIBUSUAL is not set
@@ -1084,16 +1190,11 @@ CONFIG_USB_UHCI_HCD=y
1084# 1190#
1085# CONFIG_USB_MDC800 is not set 1191# CONFIG_USB_MDC800 is not set
1086# CONFIG_USB_MICROTEK is not set 1192# CONFIG_USB_MICROTEK is not set
1087CONFIG_USB_MON=y
1088 1193
1089# 1194#
1090# USB port drivers 1195# USB port drivers
1091# 1196#
1092# CONFIG_USB_USS720 is not set 1197# CONFIG_USB_USS720 is not set
1093
1094#
1095# USB Serial Converter support
1096#
1097# CONFIG_USB_SERIAL is not set 1198# CONFIG_USB_SERIAL is not set
1098 1199
1099# 1200#
@@ -1102,7 +1203,7 @@ CONFIG_USB_MON=y
1102# CONFIG_USB_EMI62 is not set 1203# CONFIG_USB_EMI62 is not set
1103# CONFIG_USB_EMI26 is not set 1204# CONFIG_USB_EMI26 is not set
1104# CONFIG_USB_ADUTUX is not set 1205# CONFIG_USB_ADUTUX is not set
1105# CONFIG_USB_AUERSWALD is not set 1206# CONFIG_USB_SEVSEG is not set
1106# CONFIG_USB_RIO500 is not set 1207# CONFIG_USB_RIO500 is not set
1107# CONFIG_USB_LEGOTOWER is not set 1208# CONFIG_USB_LEGOTOWER is not set
1108# CONFIG_USB_LCD is not set 1209# CONFIG_USB_LCD is not set
@@ -1118,38 +1219,60 @@ CONFIG_USB_MON=y
1118# CONFIG_USB_TRANCEVIBRATOR is not set 1219# CONFIG_USB_TRANCEVIBRATOR is not set
1119# CONFIG_USB_IOWARRIOR is not set 1220# CONFIG_USB_IOWARRIOR is not set
1120# CONFIG_USB_TEST is not set 1221# CONFIG_USB_TEST is not set
1222# CONFIG_USB_ISIGHTFW is not set
1223# CONFIG_USB_VST is not set
1224# CONFIG_USB_GADGET is not set
1121 1225
1122# 1226#
1123# USB DSL modem support 1227# OTG and related infrastructure
1124#
1125
1126#
1127# USB Gadget Support
1128# 1228#
1129# CONFIG_USB_GADGET is not set 1229# CONFIG_UWB is not set
1130# CONFIG_MMC is not set 1230# CONFIG_MMC is not set
1231# CONFIG_MEMSTICK is not set
1131# CONFIG_NEW_LEDS is not set 1232# CONFIG_NEW_LEDS is not set
1233# CONFIG_ACCESSIBILITY is not set
1132# CONFIG_INFINIBAND is not set 1234# CONFIG_INFINIBAND is not set
1133# CONFIG_RTC_CLASS is not set 1235CONFIG_RTC_LIB=y
1236CONFIG_RTC_CLASS=y
1237CONFIG_RTC_HCTOSYS=y
1238CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1239# CONFIG_RTC_DEBUG is not set
1134 1240
1135# 1241#
1136# DMA Engine support 1242# RTC interfaces
1137# 1243#
1138# CONFIG_DMA_ENGINE is not set 1244CONFIG_RTC_INTF_SYSFS=y
1245CONFIG_RTC_INTF_PROC=y
1246CONFIG_RTC_INTF_DEV=y
1247# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1248# CONFIG_RTC_DRV_TEST is not set
1139 1249
1140# 1250#
1141# DMA Clients 1251# SPI RTC drivers
1142# 1252#
1143 1253
1144# 1254#
1145# DMA Devices 1255# Platform RTC drivers
1146# 1256#
1147# CONFIG_AUXDISPLAY is not set 1257# CONFIG_RTC_DRV_DS1286 is not set
1258# CONFIG_RTC_DRV_DS1511 is not set
1259# CONFIG_RTC_DRV_DS1553 is not set
1260# CONFIG_RTC_DRV_DS1742 is not set
1261# CONFIG_RTC_DRV_STK17TA8 is not set
1262# CONFIG_RTC_DRV_M48T86 is not set
1263# CONFIG_RTC_DRV_M48T35 is not set
1264# CONFIG_RTC_DRV_M48T59 is not set
1265# CONFIG_RTC_DRV_BQ4802 is not set
1266# CONFIG_RTC_DRV_V3020 is not set
1148 1267
1149# 1268#
1150# Userspace I/O 1269# on-CPU RTC drivers
1151# 1270#
1271CONFIG_RTC_DRV_PARISC=y
1272# CONFIG_DMADEVICES is not set
1273# CONFIG_AUXDISPLAY is not set
1152# CONFIG_UIO is not set 1274# CONFIG_UIO is not set
1275# CONFIG_STAGING is not set
1153 1276
1154# 1277#
1155# File systems 1278# File systems
@@ -1159,21 +1282,20 @@ CONFIG_EXT2_FS=y
1159# CONFIG_EXT2_FS_XIP is not set 1282# CONFIG_EXT2_FS_XIP is not set
1160CONFIG_EXT3_FS=y 1283CONFIG_EXT3_FS=y
1161# CONFIG_EXT3_FS_XATTR is not set 1284# CONFIG_EXT3_FS_XATTR is not set
1162# CONFIG_EXT4DEV_FS is not set 1285# CONFIG_EXT4_FS is not set
1163CONFIG_JBD=y 1286CONFIG_JBD=y
1164# CONFIG_JBD_DEBUG is not set 1287# CONFIG_JBD_DEBUG is not set
1165# CONFIG_REISERFS_FS is not set 1288# CONFIG_REISERFS_FS is not set
1166# CONFIG_JFS_FS is not set 1289# CONFIG_JFS_FS is not set
1167CONFIG_FS_POSIX_ACL=y 1290CONFIG_FS_POSIX_ACL=y
1291CONFIG_FILE_LOCKING=y
1168# CONFIG_XFS_FS is not set 1292# CONFIG_XFS_FS is not set
1169# CONFIG_GFS2_FS is not set
1170# CONFIG_OCFS2_FS is not set 1293# CONFIG_OCFS2_FS is not set
1171# CONFIG_MINIX_FS is not set 1294# CONFIG_BTRFS_FS is not set
1172# CONFIG_ROMFS_FS is not set 1295CONFIG_DNOTIFY=y
1173CONFIG_INOTIFY=y 1296CONFIG_INOTIFY=y
1174CONFIG_INOTIFY_USER=y 1297CONFIG_INOTIFY_USER=y
1175# CONFIG_QUOTA is not set 1298# CONFIG_QUOTA is not set
1176CONFIG_DNOTIFY=y
1177CONFIG_AUTOFS_FS=y 1299CONFIG_AUTOFS_FS=y
1178# CONFIG_AUTOFS4_FS is not set 1300# CONFIG_AUTOFS4_FS is not set
1179# CONFIG_FUSE_FS is not set 1301# CONFIG_FUSE_FS is not set
@@ -1202,16 +1324,13 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1202CONFIG_PROC_FS=y 1324CONFIG_PROC_FS=y
1203CONFIG_PROC_KCORE=y 1325CONFIG_PROC_KCORE=y
1204CONFIG_PROC_SYSCTL=y 1326CONFIG_PROC_SYSCTL=y
1327CONFIG_PROC_PAGE_MONITOR=y
1205CONFIG_SYSFS=y 1328CONFIG_SYSFS=y
1206CONFIG_TMPFS=y 1329CONFIG_TMPFS=y
1207# CONFIG_TMPFS_POSIX_ACL is not set 1330# CONFIG_TMPFS_POSIX_ACL is not set
1208# CONFIG_HUGETLB_PAGE is not set 1331# CONFIG_HUGETLB_PAGE is not set
1209CONFIG_RAMFS=y
1210# CONFIG_CONFIGFS_FS is not set 1332# CONFIG_CONFIGFS_FS is not set
1211 1333CONFIG_MISC_FILESYSTEMS=y
1212#
1213# Miscellaneous filesystems
1214#
1215# CONFIG_ADFS_FS is not set 1334# CONFIG_ADFS_FS is not set
1216# CONFIG_AFFS_FS is not set 1335# CONFIG_AFFS_FS is not set
1217# CONFIG_ECRYPT_FS is not set 1336# CONFIG_ECRYPT_FS is not set
@@ -1221,33 +1340,32 @@ CONFIG_RAMFS=y
1221# CONFIG_BFS_FS is not set 1340# CONFIG_BFS_FS is not set
1222# CONFIG_EFS_FS is not set 1341# CONFIG_EFS_FS is not set
1223# CONFIG_CRAMFS is not set 1342# CONFIG_CRAMFS is not set
1343# CONFIG_SQUASHFS is not set
1224# CONFIG_VXFS_FS is not set 1344# CONFIG_VXFS_FS is not set
1345# CONFIG_MINIX_FS is not set
1346# CONFIG_OMFS_FS is not set
1225# CONFIG_HPFS_FS is not set 1347# CONFIG_HPFS_FS is not set
1226# CONFIG_QNX4FS_FS is not set 1348# CONFIG_QNX4FS_FS is not set
1349# CONFIG_ROMFS_FS is not set
1227# CONFIG_SYSV_FS is not set 1350# CONFIG_SYSV_FS is not set
1228# CONFIG_UFS_FS is not set 1351# CONFIG_UFS_FS is not set
1229 1352CONFIG_NETWORK_FILESYSTEMS=y
1230#
1231# Network File Systems
1232#
1233CONFIG_NFS_FS=y 1353CONFIG_NFS_FS=y
1234CONFIG_NFS_V3=y 1354CONFIG_NFS_V3=y
1235# CONFIG_NFS_V3_ACL is not set 1355# CONFIG_NFS_V3_ACL is not set
1236# CONFIG_NFS_V4 is not set 1356# CONFIG_NFS_V4 is not set
1237# CONFIG_NFS_DIRECTIO is not set 1357CONFIG_ROOT_NFS=y
1238CONFIG_NFSD=y 1358CONFIG_NFSD=y
1239CONFIG_NFSD_V3=y 1359CONFIG_NFSD_V3=y
1240# CONFIG_NFSD_V3_ACL is not set 1360# CONFIG_NFSD_V3_ACL is not set
1241CONFIG_NFSD_V4=y 1361CONFIG_NFSD_V4=y
1242CONFIG_NFSD_TCP=y
1243CONFIG_ROOT_NFS=y
1244CONFIG_LOCKD=y 1362CONFIG_LOCKD=y
1245CONFIG_LOCKD_V4=y 1363CONFIG_LOCKD_V4=y
1246CONFIG_EXPORTFS=y 1364CONFIG_EXPORTFS=y
1247CONFIG_NFS_COMMON=y 1365CONFIG_NFS_COMMON=y
1248CONFIG_SUNRPC=y 1366CONFIG_SUNRPC=y
1249CONFIG_SUNRPC_GSS=y 1367CONFIG_SUNRPC_GSS=y
1250# CONFIG_SUNRPC_BIND34 is not set 1368# CONFIG_SUNRPC_REGISTER_V4 is not set
1251CONFIG_RPCSEC_GSS_KRB5=y 1369CONFIG_RPCSEC_GSS_KRB5=y
1252CONFIG_RPCSEC_GSS_SPKM3=m 1370CONFIG_RPCSEC_GSS_SPKM3=m
1253CONFIG_SMB_FS=m 1371CONFIG_SMB_FS=m
@@ -1256,6 +1374,7 @@ CONFIG_SMB_NLS_REMOTE="cp437"
1256CONFIG_CIFS=m 1374CONFIG_CIFS=m
1257# CONFIG_CIFS_STATS is not set 1375# CONFIG_CIFS_STATS is not set
1258# CONFIG_CIFS_WEAK_PW_HASH is not set 1376# CONFIG_CIFS_WEAK_PW_HASH is not set
1377# CONFIG_CIFS_UPCALL is not set
1259# CONFIG_CIFS_XATTR is not set 1378# CONFIG_CIFS_XATTR is not set
1260# CONFIG_CIFS_DEBUG2 is not set 1379# CONFIG_CIFS_DEBUG2 is not set
1261# CONFIG_CIFS_EXPERIMENTAL is not set 1380# CONFIG_CIFS_EXPERIMENTAL is not set
@@ -1268,10 +1387,6 @@ CONFIG_CIFS=m
1268# 1387#
1269# CONFIG_PARTITION_ADVANCED is not set 1388# CONFIG_PARTITION_ADVANCED is not set
1270CONFIG_MSDOS_PARTITION=y 1389CONFIG_MSDOS_PARTITION=y
1271
1272#
1273# Native Language Support
1274#
1275CONFIG_NLS=y 1390CONFIG_NLS=y
1276CONFIG_NLS_DEFAULT="iso8859-1" 1391CONFIG_NLS_DEFAULT="iso8859-1"
1277CONFIG_NLS_CODEPAGE_437=y 1392CONFIG_NLS_CODEPAGE_437=y
@@ -1312,33 +1427,28 @@ CONFIG_NLS_ISO8859_15=m
1312CONFIG_NLS_KOI8_R=m 1427CONFIG_NLS_KOI8_R=m
1313CONFIG_NLS_KOI8_U=m 1428CONFIG_NLS_KOI8_U=m
1314CONFIG_NLS_UTF8=y 1429CONFIG_NLS_UTF8=y
1315
1316#
1317# Distributed Lock Manager
1318#
1319# CONFIG_DLM is not set 1430# CONFIG_DLM is not set
1320 1431
1321# 1432#
1322# Profiling support
1323#
1324CONFIG_PROFILING=y
1325CONFIG_OPROFILE=m
1326
1327#
1328# Kernel hacking 1433# Kernel hacking
1329# 1434#
1330# CONFIG_PRINTK_TIME is not set 1435# CONFIG_PRINTK_TIME is not set
1436CONFIG_ENABLE_WARN_DEPRECATED=y
1331CONFIG_ENABLE_MUST_CHECK=y 1437CONFIG_ENABLE_MUST_CHECK=y
1438CONFIG_FRAME_WARN=1024
1332CONFIG_MAGIC_SYSRQ=y 1439CONFIG_MAGIC_SYSRQ=y
1333# CONFIG_UNUSED_SYMBOLS is not set 1440# CONFIG_UNUSED_SYMBOLS is not set
1334# CONFIG_DEBUG_FS is not set 1441CONFIG_DEBUG_FS=y
1335CONFIG_HEADERS_CHECK=y 1442CONFIG_HEADERS_CHECK=y
1336CONFIG_DEBUG_KERNEL=y 1443CONFIG_DEBUG_KERNEL=y
1337# CONFIG_DEBUG_SHIRQ is not set 1444# CONFIG_DEBUG_SHIRQ is not set
1338CONFIG_DETECT_SOFTLOCKUP=y 1445CONFIG_DETECT_SOFTLOCKUP=y
1446# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1447CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1339CONFIG_SCHED_DEBUG=y 1448CONFIG_SCHED_DEBUG=y
1340# CONFIG_SCHEDSTATS is not set 1449# CONFIG_SCHEDSTATS is not set
1341# CONFIG_TIMER_STATS is not set 1450# CONFIG_TIMER_STATS is not set
1451# CONFIG_DEBUG_OBJECTS is not set
1342# CONFIG_DEBUG_SLAB is not set 1452# CONFIG_DEBUG_SLAB is not set
1343# CONFIG_DEBUG_RT_MUTEXES is not set 1453# CONFIG_DEBUG_RT_MUTEXES is not set
1344# CONFIG_RT_MUTEX_TESTER is not set 1454# CONFIG_RT_MUTEX_TESTER is not set
@@ -1350,10 +1460,33 @@ CONFIG_DEBUG_MUTEXES=y
1350CONFIG_DEBUG_BUGVERBOSE=y 1460CONFIG_DEBUG_BUGVERBOSE=y
1351# CONFIG_DEBUG_INFO is not set 1461# CONFIG_DEBUG_INFO is not set
1352# CONFIG_DEBUG_VM is not set 1462# CONFIG_DEBUG_VM is not set
1463# CONFIG_DEBUG_WRITECOUNT is not set
1464CONFIG_DEBUG_MEMORY_INIT=y
1353# CONFIG_DEBUG_LIST is not set 1465# CONFIG_DEBUG_LIST is not set
1354CONFIG_FORCED_INLINING=y 1466# CONFIG_DEBUG_SG is not set
1467# CONFIG_DEBUG_NOTIFIERS is not set
1468# CONFIG_BOOT_PRINTK_DELAY is not set
1355# CONFIG_RCU_TORTURE_TEST is not set 1469# CONFIG_RCU_TORTURE_TEST is not set
1470# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1471# CONFIG_BACKTRACE_SELF_TEST is not set
1472# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1356# CONFIG_FAULT_INJECTION is not set 1473# CONFIG_FAULT_INJECTION is not set
1474# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1475CONFIG_NOP_TRACER=y
1476CONFIG_RING_BUFFER=y
1477CONFIG_TRACING=y
1478
1479#
1480# Tracers
1481#
1482# CONFIG_SCHED_TRACER is not set
1483# CONFIG_CONTEXT_SWITCH_TRACER is not set
1484# CONFIG_BOOT_TRACER is not set
1485# CONFIG_TRACE_BRANCH_PROFILING is not set
1486# CONFIG_FTRACE_STARTUP_TEST is not set
1487# CONFIG_BUILD_DOCSRC is not set
1488# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1489# CONFIG_SAMPLES is not set
1357# CONFIG_DEBUG_RODATA is not set 1490# CONFIG_DEBUG_RODATA is not set
1358 1491
1359# 1492#
@@ -1362,56 +1495,112 @@ CONFIG_FORCED_INLINING=y
1362CONFIG_KEYS=y 1495CONFIG_KEYS=y
1363CONFIG_KEYS_DEBUG_PROC_KEYS=y 1496CONFIG_KEYS_DEBUG_PROC_KEYS=y
1364# CONFIG_SECURITY is not set 1497# CONFIG_SECURITY is not set
1498# CONFIG_SECURITYFS is not set
1499# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1365CONFIG_CRYPTO=y 1500CONFIG_CRYPTO=y
1501
1502#
1503# Crypto core or helper
1504#
1505# CONFIG_CRYPTO_FIPS is not set
1366CONFIG_CRYPTO_ALGAPI=y 1506CONFIG_CRYPTO_ALGAPI=y
1507CONFIG_CRYPTO_ALGAPI2=y
1508CONFIG_CRYPTO_AEAD=y
1509CONFIG_CRYPTO_AEAD2=y
1367CONFIG_CRYPTO_BLKCIPHER=y 1510CONFIG_CRYPTO_BLKCIPHER=y
1511CONFIG_CRYPTO_BLKCIPHER2=y
1368CONFIG_CRYPTO_HASH=y 1512CONFIG_CRYPTO_HASH=y
1513CONFIG_CRYPTO_HASH2=y
1514CONFIG_CRYPTO_RNG2=y
1369CONFIG_CRYPTO_MANAGER=y 1515CONFIG_CRYPTO_MANAGER=y
1516CONFIG_CRYPTO_MANAGER2=y
1517# CONFIG_CRYPTO_GF128MUL is not set
1518CONFIG_CRYPTO_NULL=m
1519# CONFIG_CRYPTO_CRYPTD is not set
1520CONFIG_CRYPTO_AUTHENC=y
1521CONFIG_CRYPTO_TEST=m
1522
1523#
1524# Authenticated Encryption with Associated Data
1525#
1526# CONFIG_CRYPTO_CCM is not set
1527# CONFIG_CRYPTO_GCM is not set
1528# CONFIG_CRYPTO_SEQIV is not set
1529
1530#
1531# Block modes
1532#
1533CONFIG_CRYPTO_CBC=y
1534# CONFIG_CRYPTO_CTR is not set
1535# CONFIG_CRYPTO_CTS is not set
1536# CONFIG_CRYPTO_ECB is not set
1537# CONFIG_CRYPTO_LRW is not set
1538# CONFIG_CRYPTO_PCBC is not set
1539# CONFIG_CRYPTO_XTS is not set
1540
1541#
1542# Hash modes
1543#
1370CONFIG_CRYPTO_HMAC=y 1544CONFIG_CRYPTO_HMAC=y
1371# CONFIG_CRYPTO_XCBC is not set 1545# CONFIG_CRYPTO_XCBC is not set
1372CONFIG_CRYPTO_NULL=m 1546
1547#
1548# Digest
1549#
1550CONFIG_CRYPTO_CRC32C=m
1373CONFIG_CRYPTO_MD4=m 1551CONFIG_CRYPTO_MD4=m
1374CONFIG_CRYPTO_MD5=y 1552CONFIG_CRYPTO_MD5=y
1553CONFIG_CRYPTO_MICHAEL_MIC=m
1554# CONFIG_CRYPTO_RMD128 is not set
1555# CONFIG_CRYPTO_RMD160 is not set
1556# CONFIG_CRYPTO_RMD256 is not set
1557# CONFIG_CRYPTO_RMD320 is not set
1375CONFIG_CRYPTO_SHA1=y 1558CONFIG_CRYPTO_SHA1=y
1376CONFIG_CRYPTO_SHA256=m 1559CONFIG_CRYPTO_SHA256=m
1377CONFIG_CRYPTO_SHA512=m 1560CONFIG_CRYPTO_SHA512=m
1378CONFIG_CRYPTO_WP512=m
1379CONFIG_CRYPTO_TGR192=m 1561CONFIG_CRYPTO_TGR192=m
1380# CONFIG_CRYPTO_GF128MUL is not set 1562CONFIG_CRYPTO_WP512=m
1381# CONFIG_CRYPTO_ECB is not set 1563
1382CONFIG_CRYPTO_CBC=y 1564#
1383# CONFIG_CRYPTO_PCBC is not set 1565# Ciphers
1384# CONFIG_CRYPTO_LRW is not set 1566#
1385# CONFIG_CRYPTO_XTS is not set
1386# CONFIG_CRYPTO_CRYPTD is not set
1387CONFIG_CRYPTO_DES=y
1388# CONFIG_CRYPTO_FCRYPT is not set
1389CONFIG_CRYPTO_BLOWFISH=m
1390CONFIG_CRYPTO_TWOFISH=m
1391CONFIG_CRYPTO_TWOFISH_COMMON=m
1392CONFIG_CRYPTO_SERPENT=m
1393CONFIG_CRYPTO_AES=m 1567CONFIG_CRYPTO_AES=m
1568CONFIG_CRYPTO_ANUBIS=m
1569CONFIG_CRYPTO_ARC4=m
1570CONFIG_CRYPTO_BLOWFISH=m
1571# CONFIG_CRYPTO_CAMELLIA is not set
1394CONFIG_CRYPTO_CAST5=m 1572CONFIG_CRYPTO_CAST5=m
1395CONFIG_CRYPTO_CAST6=m 1573CONFIG_CRYPTO_CAST6=m
1396CONFIG_CRYPTO_TEA=m 1574CONFIG_CRYPTO_DES=y
1397CONFIG_CRYPTO_ARC4=m 1575# CONFIG_CRYPTO_FCRYPT is not set
1398CONFIG_CRYPTO_KHAZAD=m 1576CONFIG_CRYPTO_KHAZAD=m
1399CONFIG_CRYPTO_ANUBIS=m 1577# CONFIG_CRYPTO_SALSA20 is not set
1400# CONFIG_CRYPTO_SEED is not set 1578# CONFIG_CRYPTO_SEED is not set
1579CONFIG_CRYPTO_SERPENT=m
1580CONFIG_CRYPTO_TEA=m
1581CONFIG_CRYPTO_TWOFISH=m
1582CONFIG_CRYPTO_TWOFISH_COMMON=m
1583
1584#
1585# Compression
1586#
1401CONFIG_CRYPTO_DEFLATE=y 1587CONFIG_CRYPTO_DEFLATE=y
1402CONFIG_CRYPTO_MICHAEL_MIC=m 1588# CONFIG_CRYPTO_LZO is not set
1403CONFIG_CRYPTO_CRC32C=m 1589
1404# CONFIG_CRYPTO_CAMELLIA is not set 1590#
1405CONFIG_CRYPTO_TEST=m 1591# Random Number Generation
1406# CONFIG_CRYPTO_AUTHENC is not set 1592#
1593# CONFIG_CRYPTO_ANSI_CPRNG is not set
1407# CONFIG_CRYPTO_HW is not set 1594# CONFIG_CRYPTO_HW is not set
1408 1595
1409# 1596#
1410# Library routines 1597# Library routines
1411# 1598#
1412CONFIG_BITREVERSE=y 1599CONFIG_BITREVERSE=y
1600CONFIG_GENERIC_FIND_LAST_BIT=y
1413CONFIG_CRC_CCITT=m 1601CONFIG_CRC_CCITT=m
1414# CONFIG_CRC16 is not set 1602# CONFIG_CRC16 is not set
1603# CONFIG_CRC_T10DIF is not set
1415# CONFIG_CRC_ITU_T is not set 1604# CONFIG_CRC_ITU_T is not set
1416CONFIG_CRC32=y 1605CONFIG_CRC32=y
1417# CONFIG_CRC7 is not set 1606# CONFIG_CRC7 is not set
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index bd9a4db3bd4c..5cbe9f9e5d9e 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -137,7 +137,6 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i
137 error = count - buf.count; 137 error = count - buf.count;
138 } 138 }
139 139
140out_putf:
141 fput(file); 140 fput(file);
142out: 141out:
143 return error; 142 return error;
diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h
index ffb208840ecc..89fb40005e3f 100644
--- a/arch/parisc/include/asm/assembly.h
+++ b/arch/parisc/include/asm/assembly.h
@@ -79,6 +79,7 @@
79 79
80#include <asm/asm-offsets.h> 80#include <asm/asm-offsets.h>
81#include <asm/page.h> 81#include <asm/page.h>
82#include <asm/types.h>
82 83
83#include <asm/asmregs.h> 84#include <asm/asmregs.h>
84 85
@@ -129,27 +130,27 @@
129 130
130 /* Shift Left - note the r and t can NOT be the same! */ 131 /* Shift Left - note the r and t can NOT be the same! */
131 .macro shl r, sa, t 132 .macro shl r, sa, t
132 dep,z \r, 31-\sa, 32-\sa, \t 133 dep,z \r, 31-(\sa), 32-(\sa), \t
133 .endm 134 .endm
134 135
135 /* The PA 2.0 shift left */ 136 /* The PA 2.0 shift left */
136 .macro shlw r, sa, t 137 .macro shlw r, sa, t
137 depw,z \r, 31-\sa, 32-\sa, \t 138 depw,z \r, 31-(\sa), 32-(\sa), \t
138 .endm 139 .endm
139 140
140 /* And the PA 2.0W shift left */ 141 /* And the PA 2.0W shift left */
141 .macro shld r, sa, t 142 .macro shld r, sa, t
142 depd,z \r, 63-\sa, 64-\sa, \t 143 depd,z \r, 63-(\sa), 64-(\sa), \t
143 .endm 144 .endm
144 145
145 /* Shift Right - note the r and t can NOT be the same! */ 146 /* Shift Right - note the r and t can NOT be the same! */
146 .macro shr r, sa, t 147 .macro shr r, sa, t
147 extru \r, 31-\sa, 32-\sa, \t 148 extru \r, 31-(\sa), 32-(\sa), \t
148 .endm 149 .endm
149 150
150 /* pa20w version of shift right */ 151 /* pa20w version of shift right */
151 .macro shrd r, sa, t 152 .macro shrd r, sa, t
152 extrd,u \r, 63-\sa, 64-\sa, \t 153 extrd,u \r, 63-(\sa), 64-(\sa), \t
153 .endm 154 .endm
154 155
155 /* load 32-bit 'value' into 'reg' compensating for the ldil 156 /* load 32-bit 'value' into 'reg' compensating for the ldil
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index d3031d1f9d03..1f6d2ae7aba5 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -174,15 +174,48 @@ static inline void __raw_writeq(unsigned long long b, volatile void __iomem *add
174 *(volatile unsigned long long __force *) addr = b; 174 *(volatile unsigned long long __force *) addr = b;
175} 175}
176 176
177/* readb can never be const, so use __fswab instead of le*_to_cpu */ 177static inline unsigned char readb(const volatile void __iomem *addr)
178#define readb(addr) __raw_readb(addr) 178{
179#define readw(addr) le16_to_cpu(__raw_readw(addr)) 179 return __raw_readb(addr);
180#define readl(addr) le32_to_cpu(__raw_readl(addr)) 180}
181#define readq(addr) le64_to_cpu(__raw_readq(addr)) 181static inline unsigned short readw(const volatile void __iomem *addr)
182#define writeb(b, addr) __raw_writeb(b, addr) 182{
183#define writew(b, addr) __raw_writew(cpu_to_le16(b), addr) 183 return le16_to_cpu(__raw_readw(addr));
184#define writel(b, addr) __raw_writel(cpu_to_le32(b), addr) 184}
185#define writeq(b, addr) __raw_writeq(cpu_to_le64(b), addr) 185static inline unsigned int readl(const volatile void __iomem *addr)
186{
187 return le32_to_cpu(__raw_readl(addr));
188}
189static inline unsigned long long readq(const volatile void __iomem *addr)
190{
191 return le64_to_cpu(__raw_readq(addr));
192}
193
194static inline void writeb(unsigned char b, volatile void __iomem *addr)
195{
196 __raw_writeb(b, addr);
197}
198static inline void writew(unsigned short w, volatile void __iomem *addr)
199{
200 __raw_writew(cpu_to_le16(w), addr);
201}
202static inline void writel(unsigned int l, volatile void __iomem *addr)
203{
204 __raw_writel(cpu_to_le32(l), addr);
205}
206static inline void writeq(unsigned long long q, volatile void __iomem *addr)
207{
208 __raw_writeq(cpu_to_le64(q), addr);
209}
210
211#define readb readb
212#define readw readw
213#define readl readl
214#define readq readq
215#define writeb writeb
216#define writew writew
217#define writel writel
218#define writeq writeq
186 219
187#define readb_relaxed(addr) readb(addr) 220#define readb_relaxed(addr) readb(addr)
188#define readw_relaxed(addr) readw(addr) 221#define readw_relaxed(addr) readw(addr)
diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h
index 399c81981ed5..dfa26b67f919 100644
--- a/arch/parisc/include/asm/irq.h
+++ b/arch/parisc/include/asm/irq.h
@@ -49,7 +49,7 @@ extern unsigned long txn_alloc_addr(unsigned int);
49extern unsigned long txn_affinity_addr(unsigned int irq, int cpu); 49extern unsigned long txn_affinity_addr(unsigned int irq, int cpu);
50 50
51extern int cpu_claim_irq(unsigned int irq, struct irq_chip *, void *); 51extern int cpu_claim_irq(unsigned int irq, struct irq_chip *, void *);
52extern int cpu_check_affinity(unsigned int irq, cpumask_t *dest); 52extern int cpu_check_affinity(unsigned int irq, const struct cpumask *dest);
53 53
54/* soft power switch support (power.c) */ 54/* soft power switch support (power.c) */
55extern struct tasklet_struct power_tasklet; 55extern struct tasklet_struct power_tasklet;
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h
index 1c6dbb6f6e56..cd4c0b2a8e70 100644
--- a/arch/parisc/include/asm/uaccess.h
+++ b/arch/parisc/include/asm/uaccess.h
@@ -241,6 +241,7 @@ unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned lo
241#define __copy_to_user_inatomic __copy_to_user 241#define __copy_to_user_inatomic __copy_to_user
242#define __copy_from_user_inatomic __copy_from_user 242#define __copy_from_user_inatomic __copy_from_user
243 243
244struct pt_regs;
244int fixup_exception(struct pt_regs *regs); 245int fixup_exception(struct pt_regs *regs);
245 246
246#endif /* __PARISC_UACCESS_H */ 247#endif /* __PARISC_UACCESS_H */
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 5259d8c20676..837530ea32e7 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -551,10 +551,7 @@ void flush_cache_range(struct vm_area_struct *vma,
551{ 551{
552 int sr3; 552 int sr3;
553 553
554 if (!vma->vm_mm->context) { 554 BUG_ON(!vma->vm_mm->context);
555 BUG();
556 return;
557 }
558 555
559 sr3 = mfsp(3); 556 sr3 = mfsp(3);
560 if (vma->vm_mm->context == sr3) { 557 if (vma->vm_mm->context == sr3) {
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index d1fa4edd2d80..0db9fdcb7709 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -368,7 +368,7 @@
368 * abstractions for the macros */ 368 * abstractions for the macros */
369 .macro EXTR reg1,start,length,reg2 369 .macro EXTR reg1,start,length,reg2
370#ifdef CONFIG_64BIT 370#ifdef CONFIG_64BIT
371 extrd,u \reg1,32+\start,\length,\reg2 371 extrd,u \reg1,32+(\start),\length,\reg2
372#else 372#else
373 extrw,u \reg1,\start,\length,\reg2 373 extrw,u \reg1,\start,\length,\reg2
374#endif 374#endif
@@ -376,7 +376,7 @@
376 376
377 .macro DEP reg1,start,length,reg2 377 .macro DEP reg1,start,length,reg2
378#ifdef CONFIG_64BIT 378#ifdef CONFIG_64BIT
379 depd \reg1,32+\start,\length,\reg2 379 depd \reg1,32+(\start),\length,\reg2
380#else 380#else
381 depw \reg1,\start,\length,\reg2 381 depw \reg1,\start,\length,\reg2
382#endif 382#endif
@@ -384,7 +384,7 @@
384 384
385 .macro DEPI val,start,length,reg 385 .macro DEPI val,start,length,reg
386#ifdef CONFIG_64BIT 386#ifdef CONFIG_64BIT
387 depdi \val,32+\start,\length,\reg 387 depdi \val,32+(\start),\length,\reg
388#else 388#else
389 depwi \val,\start,\length,\reg 389 depwi \val,\start,\length,\reg
390#endif 390#endif
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 03f26bd75bd8..f6d241238a78 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -151,7 +151,7 @@ static void convert_to_wide(unsigned long *addr)
151} 151}
152 152
153#ifdef CONFIG_64BIT 153#ifdef CONFIG_64BIT
154void __init set_firmware_width_unlocked(void) 154void __cpuinit set_firmware_width_unlocked(void)
155{ 155{
156 int ret; 156 int ret;
157 157
@@ -168,7 +168,7 @@ void __init set_firmware_width_unlocked(void)
168 * This function must be called before any pdc_* function that uses the 168 * This function must be called before any pdc_* function that uses the
169 * convert_to_wide function. 169 * convert_to_wide function.
170 */ 170 */
171void __init set_firmware_width(void) 171void __cpuinit set_firmware_width(void)
172{ 172{
173 unsigned long flags; 173 unsigned long flags;
174 spin_lock_irqsave(&pdc_lock, flags); 174 spin_lock_irqsave(&pdc_lock, flags);
@@ -176,11 +176,11 @@ void __init set_firmware_width(void)
176 spin_unlock_irqrestore(&pdc_lock, flags); 176 spin_unlock_irqrestore(&pdc_lock, flags);
177} 177}
178#else 178#else
179void __init set_firmware_width_unlocked(void) { 179void __cpuinit set_firmware_width_unlocked(void) {
180 return; 180 return;
181} 181}
182 182
183void __init set_firmware_width(void) { 183void __cpuinit set_firmware_width(void) {
184 return; 184 return;
185} 185}
186#endif /*CONFIG_64BIT*/ 186#endif /*CONFIG_64BIT*/
@@ -302,7 +302,7 @@ int pdc_chassis_warn(unsigned long *warn)
302 return retval; 302 return retval;
303} 303}
304 304
305int __init pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info) 305int __cpuinit pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info)
306{ 306{
307 int ret; 307 int ret;
308 308
@@ -323,7 +323,7 @@ int __init pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info)
323 * This PDC call returns the presence and status of all the coprocessors 323 * This PDC call returns the presence and status of all the coprocessors
324 * attached to the processor. 324 * attached to the processor.
325 */ 325 */
326int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info) 326int __cpuinit pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info)
327{ 327{
328 int ret; 328 int ret;
329 unsigned long flags; 329 unsigned long flags;
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 704341b0b098..adfd617b4c18 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -112,7 +112,7 @@ void cpu_end_irq(unsigned int irq)
112} 112}
113 113
114#ifdef CONFIG_SMP 114#ifdef CONFIG_SMP
115int cpu_check_affinity(unsigned int irq, cpumask_t *dest) 115int cpu_check_affinity(unsigned int irq, const struct cpumask *dest)
116{ 116{
117 int cpu_dest; 117 int cpu_dest;
118 118
@@ -120,23 +120,25 @@ int cpu_check_affinity(unsigned int irq, cpumask_t *dest)
120 if (CHECK_IRQ_PER_CPU(irq)) { 120 if (CHECK_IRQ_PER_CPU(irq)) {
121 /* Bad linux design decision. The mask has already 121 /* Bad linux design decision. The mask has already
122 * been set; we must reset it */ 122 * been set; we must reset it */
123 irq_desc[irq].affinity = CPU_MASK_ALL; 123 cpumask_setall(&irq_desc[irq].affinity);
124 return -EINVAL; 124 return -EINVAL;
125 } 125 }
126 126
127 /* whatever mask they set, we just allow one CPU */ 127 /* whatever mask they set, we just allow one CPU */
128 cpu_dest = first_cpu(*dest); 128 cpu_dest = first_cpu(*dest);
129 *dest = cpumask_of_cpu(cpu_dest);
130 129
131 return 0; 130 return cpu_dest;
132} 131}
133 132
134static void cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest) 133static void cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest)
135{ 134{
136 if (cpu_check_affinity(irq, dest)) 135 int cpu_dest;
136
137 cpu_dest = cpu_check_affinity(irq, dest);
138 if (cpu_dest < 0)
137 return; 139 return;
138 140
139 irq_desc[irq].affinity = *dest; 141 cpumask_copy(&irq_desc[irq].affinity, &cpumask_of_cpu(cpu_dest));
140} 142}
141#endif 143#endif
142 144
@@ -295,7 +297,7 @@ int txn_alloc_irq(unsigned int bits_wide)
295unsigned long txn_affinity_addr(unsigned int irq, int cpu) 297unsigned long txn_affinity_addr(unsigned int irq, int cpu)
296{ 298{
297#ifdef CONFIG_SMP 299#ifdef CONFIG_SMP
298 irq_desc[irq].affinity = cpumask_of_cpu(cpu); 300 cpumask_copy(&irq_desc[irq].affinity, cpumask_of(cpu));
299#endif 301#endif
300 302
301 return per_cpu(cpu_data, cpu).txn_addr; 303 return per_cpu(cpu_data, cpu).txn_addr;
@@ -352,7 +354,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
352 irq = eirr_to_irq(eirr_val); 354 irq = eirr_to_irq(eirr_val);
353 355
354#ifdef CONFIG_SMP 356#ifdef CONFIG_SMP
355 dest = irq_desc[irq].affinity; 357 cpumask_copy(&dest, &irq_desc[irq].affinity);
356 if (CHECK_IRQ_PER_CPU(irq_desc[irq].status) && 358 if (CHECK_IRQ_PER_CPU(irq_desc[irq].status) &&
357 !cpu_isset(smp_processor_id(), dest)) { 359 !cpu_isset(smp_processor_id(), dest)) {
358 int cpu = first_cpu(dest); 360 int cpu = first_cpu(dest);
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index df47895db828..7d927eac932b 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -447,10 +447,7 @@ static void pa11_dma_free_consistent (struct device *dev, size_t size, void *vad
447 447
448static dma_addr_t pa11_dma_map_single(struct device *dev, void *addr, size_t size, enum dma_data_direction direction) 448static dma_addr_t pa11_dma_map_single(struct device *dev, void *addr, size_t size, enum dma_data_direction direction)
449{ 449{
450 if (direction == DMA_NONE) { 450 BUG_ON(direction == DMA_NONE);
451 printk(KERN_ERR "pa11_dma_map_single(PCI_DMA_NONE) called by %p\n", __builtin_return_address(0));
452 BUG();
453 }
454 451
455 flush_kernel_dcache_range((unsigned long) addr, size); 452 flush_kernel_dcache_range((unsigned long) addr, size);
456 return virt_to_phys(addr); 453 return virt_to_phys(addr);
@@ -458,10 +455,7 @@ static dma_addr_t pa11_dma_map_single(struct device *dev, void *addr, size_t siz
458 455
459static void pa11_dma_unmap_single(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) 456static void pa11_dma_unmap_single(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
460{ 457{
461 if (direction == DMA_NONE) { 458 BUG_ON(direction == DMA_NONE);
462 printk(KERN_ERR "pa11_dma_unmap_single(PCI_DMA_NONE) called by %p\n", __builtin_return_address(0));
463 BUG();
464 }
465 459
466 if (direction == DMA_TO_DEVICE) 460 if (direction == DMA_TO_DEVICE)
467 return; 461 return;
@@ -480,8 +474,7 @@ static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist, int n
480{ 474{
481 int i; 475 int i;
482 476
483 if (direction == DMA_NONE) 477 BUG_ON(direction == DMA_NONE);
484 BUG();
485 478
486 for (i = 0; i < nents; i++, sglist++ ) { 479 for (i = 0; i < nents; i++, sglist++ ) {
487 unsigned long vaddr = sg_virt_addr(sglist); 480 unsigned long vaddr = sg_virt_addr(sglist);
@@ -496,8 +489,7 @@ static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, in
496{ 489{
497 int i; 490 int i;
498 491
499 if (direction == DMA_NONE) 492 BUG_ON(direction == DMA_NONE);
500 BUG();
501 493
502 if (direction == DMA_TO_DEVICE) 494 if (direction == DMA_TO_DEVICE)
503 return; 495 return;
@@ -511,16 +503,14 @@ static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, in
511 503
512static void pa11_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction) 504static void pa11_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction)
513{ 505{
514 if (direction == DMA_NONE) 506 BUG_ON(direction == DMA_NONE);
515 BUG();
516 507
517 flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle) + offset, size); 508 flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle) + offset, size);
518} 509}
519 510
520static void pa11_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction) 511static void pa11_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction)
521{ 512{
522 if (direction == DMA_NONE) 513 BUG_ON(direction == DMA_NONE);
523 BUG();
524 514
525 flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle) + offset, size); 515 flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle) + offset, size);
526} 516}
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 7c155c254e72..9d704d9831d1 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -304,10 +304,8 @@ static void __init setup_bootmem(void)
304 */ 304 */
305 max_low_pfn = max_pfn; 305 max_low_pfn = max_pfn;
306 306
307 if ((bootmap_pfn - bootmap_start_pfn) != bootmap_pages) { 307 /* bootmap sizing messed up? */
308 printk(KERN_WARNING "WARNING! bootmap sizing is messed up!\n"); 308 BUG_ON((bootmap_pfn - bootmap_start_pfn) != bootmap_pages);
309 BUG();
310 }
311 309
312 /* reserve PAGE0 pdc memory, kernel text/data/bss & bootmap */ 310 /* reserve PAGE0 pdc memory, kernel text/data/bss & bootmap */
313 311
diff --git a/arch/powerpc/configs/40x/virtex_defconfig b/arch/powerpc/configs/40x/virtex_defconfig
index b6888384dd74..f5698f962e58 100644
--- a/arch/powerpc/configs/40x/virtex_defconfig
+++ b/arch/powerpc/configs/40x/virtex_defconfig
@@ -686,7 +686,7 @@ CONFIG_SERIAL_UARTLITE_CONSOLE=y
686CONFIG_SERIAL_CORE=y 686CONFIG_SERIAL_CORE=y
687CONFIG_SERIAL_CORE_CONSOLE=y 687CONFIG_SERIAL_CORE_CONSOLE=y
688# CONFIG_SERIAL_JSM is not set 688# CONFIG_SERIAL_JSM is not set
689# CONFIG_SERIAL_OF_PLATFORM is not set 689CONFIG_SERIAL_OF_PLATFORM=y
690# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set 690# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
691CONFIG_UNIX98_PTYS=y 691CONFIG_UNIX98_PTYS=y
692# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 692# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
diff --git a/arch/powerpc/configs/44x/virtex5_defconfig b/arch/powerpc/configs/44x/virtex5_defconfig
index 15aab1ca6384..1bf0a63614b1 100644
--- a/arch/powerpc/configs/44x/virtex5_defconfig
+++ b/arch/powerpc/configs/44x/virtex5_defconfig
@@ -691,7 +691,7 @@ CONFIG_SERIAL_UARTLITE_CONSOLE=y
691CONFIG_SERIAL_CORE=y 691CONFIG_SERIAL_CORE=y
692CONFIG_SERIAL_CORE_CONSOLE=y 692CONFIG_SERIAL_CORE_CONSOLE=y
693# CONFIG_SERIAL_JSM is not set 693# CONFIG_SERIAL_JSM is not set
694# CONFIG_SERIAL_OF_PLATFORM is not set 694CONFIG_SERIAL_OF_PLATFORM=y
695# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set 695# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
696CONFIG_UNIX98_PTYS=y 696CONFIG_UNIX98_PTYS=y
697# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 697# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
diff --git a/arch/powerpc/configs/linkstation_defconfig b/arch/powerpc/configs/linkstation_defconfig
index aa5855a156de..15900dcf0bfa 100644
--- a/arch/powerpc/configs/linkstation_defconfig
+++ b/arch/powerpc/configs/linkstation_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.29-rc2 3# Linux kernel version: 2.6.29-rc6
4# Mon Jan 26 15:35:29 2009 4# Fri Mar 6 00:07:38 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -71,6 +71,15 @@ CONFIG_POSIX_MQUEUE=y
71# CONFIG_BSD_PROCESS_ACCT is not set 71# CONFIG_BSD_PROCESS_ACCT is not set
72# CONFIG_TASKSTATS is not set 72# CONFIG_TASKSTATS is not set
73# CONFIG_AUDIT is not set 73# CONFIG_AUDIT is not set
74
75#
76# RCU Subsystem
77#
78CONFIG_CLASSIC_RCU=y
79# CONFIG_TREE_RCU is not set
80# CONFIG_PREEMPT_RCU is not set
81# CONFIG_TREE_RCU_TRACE is not set
82# CONFIG_PREEMPT_RCU_TRACE is not set
74CONFIG_IKCONFIG=y 83CONFIG_IKCONFIG=y
75CONFIG_IKCONFIG_PROC=y 84CONFIG_IKCONFIG_PROC=y
76CONFIG_LOG_BUF_SHIFT=14 85CONFIG_LOG_BUF_SHIFT=14
@@ -88,6 +97,7 @@ CONFIG_NAMESPACES=y
88# CONFIG_IPC_NS is not set 97# CONFIG_IPC_NS is not set
89# CONFIG_USER_NS is not set 98# CONFIG_USER_NS is not set
90# CONFIG_PID_NS is not set 99# CONFIG_PID_NS is not set
100# CONFIG_NET_NS is not set
91CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
92CONFIG_INITRAMFS_SOURCE="" 102CONFIG_INITRAMFS_SOURCE=""
93CONFIG_CC_OPTIMIZE_FOR_SIZE=y 103CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -153,11 +163,6 @@ CONFIG_DEFAULT_AS=y
153# CONFIG_DEFAULT_CFQ is not set 163# CONFIG_DEFAULT_CFQ is not set
154# CONFIG_DEFAULT_NOOP is not set 164# CONFIG_DEFAULT_NOOP is not set
155CONFIG_DEFAULT_IOSCHED="anticipatory" 165CONFIG_DEFAULT_IOSCHED="anticipatory"
156CONFIG_CLASSIC_RCU=y
157# CONFIG_TREE_RCU is not set
158# CONFIG_PREEMPT_RCU is not set
159# CONFIG_TREE_RCU_TRACE is not set
160# CONFIG_PREEMPT_RCU_TRACE is not set
161# CONFIG_FREEZER is not set 166# CONFIG_FREEZER is not set
162 167
163# 168#
@@ -294,7 +299,6 @@ CONFIG_NET=y
294# 299#
295# Networking options 300# Networking options
296# 301#
297# CONFIG_NET_NS is not set
298CONFIG_COMPAT_NET_DEV_OPS=y 302CONFIG_COMPAT_NET_DEV_OPS=y
299CONFIG_PACKET=y 303CONFIG_PACKET=y
300CONFIG_PACKET_MMAP=y 304CONFIG_PACKET_MMAP=y
@@ -508,8 +512,8 @@ CONFIG_MTD_CONCAT=y
508CONFIG_MTD_PARTITIONS=y 512CONFIG_MTD_PARTITIONS=y
509# CONFIG_MTD_TESTS is not set 513# CONFIG_MTD_TESTS is not set
510# CONFIG_MTD_REDBOOT_PARTS is not set 514# CONFIG_MTD_REDBOOT_PARTS is not set
511# CONFIG_MTD_CMDLINE_PARTS is not set 515CONFIG_MTD_CMDLINE_PARTS=y
512# CONFIG_MTD_OF_PARTS is not set 516CONFIG_MTD_OF_PARTS=y
513# CONFIG_MTD_AR7_PARTS is not set 517# CONFIG_MTD_AR7_PARTS is not set
514 518
515# 519#
@@ -587,7 +591,6 @@ CONFIG_MTD_PHYSMAP=y
587# LPDDR flash memory drivers 591# LPDDR flash memory drivers
588# 592#
589# CONFIG_MTD_LPDDR is not set 593# CONFIG_MTD_LPDDR is not set
590# CONFIG_MTD_QINFO_PROBE is not set
591 594
592# 595#
593# UBI - Unsorted block images 596# UBI - Unsorted block images
@@ -617,13 +620,19 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
617# CONFIG_BLK_DEV_HD is not set 620# CONFIG_BLK_DEV_HD is not set
618CONFIG_MISC_DEVICES=y 621CONFIG_MISC_DEVICES=y
619# CONFIG_PHANTOM is not set 622# CONFIG_PHANTOM is not set
620# CONFIG_EEPROM_93CX6 is not set
621# CONFIG_SGI_IOC4 is not set 623# CONFIG_SGI_IOC4 is not set
622# CONFIG_TIFM_CORE is not set 624# CONFIG_TIFM_CORE is not set
623# CONFIG_ICS932S401 is not set 625# CONFIG_ICS932S401 is not set
624# CONFIG_ENCLOSURE_SERVICES is not set 626# CONFIG_ENCLOSURE_SERVICES is not set
625# CONFIG_HP_ILO is not set 627# CONFIG_HP_ILO is not set
626# CONFIG_C2PORT is not set 628# CONFIG_C2PORT is not set
629
630#
631# EEPROM support
632#
633# CONFIG_EEPROM_AT24 is not set
634CONFIG_EEPROM_LEGACY=m
635# CONFIG_EEPROM_93CX6 is not set
627CONFIG_HAVE_IDE=y 636CONFIG_HAVE_IDE=y
628# CONFIG_IDE is not set 637# CONFIG_IDE is not set
629 638
@@ -839,6 +848,7 @@ CONFIG_R8169=y
839# CONFIG_QLA3XXX is not set 848# CONFIG_QLA3XXX is not set
840# CONFIG_ATL1 is not set 849# CONFIG_ATL1 is not set
841# CONFIG_ATL1E is not set 850# CONFIG_ATL1E is not set
851# CONFIG_ATL1C is not set
842# CONFIG_JME is not set 852# CONFIG_JME is not set
843CONFIG_NETDEV_10000=y 853CONFIG_NETDEV_10000=y
844# CONFIG_CHELSIO_T1 is not set 854# CONFIG_CHELSIO_T1 is not set
@@ -1037,8 +1047,6 @@ CONFIG_I2C_MPC=y
1037# Miscellaneous I2C Chip support 1047# Miscellaneous I2C Chip support
1038# 1048#
1039# CONFIG_DS1682 is not set 1049# CONFIG_DS1682 is not set
1040# CONFIG_EEPROM_AT24 is not set
1041CONFIG_EEPROM_LEGACY=m
1042# CONFIG_SENSORS_PCF8574 is not set 1050# CONFIG_SENSORS_PCF8574 is not set
1043# CONFIG_PCF8575 is not set 1051# CONFIG_PCF8575 is not set
1044# CONFIG_SENSORS_PCA9539 is not set 1052# CONFIG_SENSORS_PCA9539 is not set
diff --git a/arch/powerpc/configs/storcenter_defconfig b/arch/powerpc/configs/storcenter_defconfig
index 86512c8790d1..94903465ea12 100644
--- a/arch/powerpc/configs/storcenter_defconfig
+++ b/arch/powerpc/configs/storcenter_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.29-rc2 3# Linux kernel version: 2.6.29-rc6
4# Mon Jan 26 15:35:46 2009 4# Fri Mar 6 00:09:08 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -71,6 +71,15 @@ CONFIG_SYSVIPC_SYSCTL=y
71# CONFIG_BSD_PROCESS_ACCT is not set 71# CONFIG_BSD_PROCESS_ACCT is not set
72# CONFIG_TASKSTATS is not set 72# CONFIG_TASKSTATS is not set
73# CONFIG_AUDIT is not set 73# CONFIG_AUDIT is not set
74
75#
76# RCU Subsystem
77#
78CONFIG_CLASSIC_RCU=y
79# CONFIG_TREE_RCU is not set
80# CONFIG_PREEMPT_RCU is not set
81# CONFIG_TREE_RCU_TRACE is not set
82# CONFIG_PREEMPT_RCU_TRACE is not set
74# CONFIG_IKCONFIG is not set 83# CONFIG_IKCONFIG is not set
75CONFIG_LOG_BUF_SHIFT=14 84CONFIG_LOG_BUF_SHIFT=14
76CONFIG_GROUP_SCHED=y 85CONFIG_GROUP_SCHED=y
@@ -144,11 +153,6 @@ CONFIG_IOSCHED_CFQ=y
144CONFIG_DEFAULT_CFQ=y 153CONFIG_DEFAULT_CFQ=y
145# CONFIG_DEFAULT_NOOP is not set 154# CONFIG_DEFAULT_NOOP is not set
146CONFIG_DEFAULT_IOSCHED="cfq" 155CONFIG_DEFAULT_IOSCHED="cfq"
147CONFIG_CLASSIC_RCU=y
148# CONFIG_TREE_RCU is not set
149# CONFIG_PREEMPT_RCU is not set
150# CONFIG_TREE_RCU_TRACE is not set
151# CONFIG_PREEMPT_RCU_TRACE is not set
152# CONFIG_FREEZER is not set 156# CONFIG_FREEZER is not set
153 157
154# 158#
@@ -377,8 +381,8 @@ CONFIG_MTD=y
377CONFIG_MTD_PARTITIONS=y 381CONFIG_MTD_PARTITIONS=y
378# CONFIG_MTD_TESTS is not set 382# CONFIG_MTD_TESTS is not set
379# CONFIG_MTD_REDBOOT_PARTS is not set 383# CONFIG_MTD_REDBOOT_PARTS is not set
380# CONFIG_MTD_CMDLINE_PARTS is not set 384CONFIG_MTD_CMDLINE_PARTS=y
381# CONFIG_MTD_OF_PARTS is not set 385CONFIG_MTD_OF_PARTS=y
382# CONFIG_MTD_AR7_PARTS is not set 386# CONFIG_MTD_AR7_PARTS is not set
383 387
384# 388#
@@ -452,7 +456,6 @@ CONFIG_MTD_PHYSMAP=y
452# LPDDR flash memory drivers 456# LPDDR flash memory drivers
453# 457#
454# CONFIG_MTD_LPDDR is not set 458# CONFIG_MTD_LPDDR is not set
455# CONFIG_MTD_QINFO_PROBE is not set
456 459
457# 460#
458# UBI - Unsorted block images 461# UBI - Unsorted block images
@@ -478,13 +481,19 @@ CONFIG_BLK_DEV=y
478# CONFIG_BLK_DEV_HD is not set 481# CONFIG_BLK_DEV_HD is not set
479CONFIG_MISC_DEVICES=y 482CONFIG_MISC_DEVICES=y
480# CONFIG_PHANTOM is not set 483# CONFIG_PHANTOM is not set
481# CONFIG_EEPROM_93CX6 is not set
482# CONFIG_SGI_IOC4 is not set 484# CONFIG_SGI_IOC4 is not set
483# CONFIG_TIFM_CORE is not set 485# CONFIG_TIFM_CORE is not set
484# CONFIG_ICS932S401 is not set 486# CONFIG_ICS932S401 is not set
485# CONFIG_ENCLOSURE_SERVICES is not set 487# CONFIG_ENCLOSURE_SERVICES is not set
486# CONFIG_HP_ILO is not set 488# CONFIG_HP_ILO is not set
487# CONFIG_C2PORT is not set 489# CONFIG_C2PORT is not set
490
491#
492# EEPROM support
493#
494# CONFIG_EEPROM_AT24 is not set
495# CONFIG_EEPROM_LEGACY is not set
496# CONFIG_EEPROM_93CX6 is not set
488CONFIG_HAVE_IDE=y 497CONFIG_HAVE_IDE=y
489CONFIG_IDE=y 498CONFIG_IDE=y
490 499
@@ -677,6 +686,7 @@ CONFIG_R8169=y
677# CONFIG_QLA3XXX is not set 686# CONFIG_QLA3XXX is not set
678# CONFIG_ATL1 is not set 687# CONFIG_ATL1 is not set
679# CONFIG_ATL1E is not set 688# CONFIG_ATL1E is not set
689# CONFIG_ATL1C is not set
680# CONFIG_JME is not set 690# CONFIG_JME is not set
681# CONFIG_NETDEV_10000 is not set 691# CONFIG_NETDEV_10000 is not set
682# CONFIG_TR is not set 692# CONFIG_TR is not set
@@ -818,8 +828,6 @@ CONFIG_I2C_MPC=y
818# Miscellaneous I2C Chip support 828# Miscellaneous I2C Chip support
819# 829#
820# CONFIG_DS1682 is not set 830# CONFIG_DS1682 is not set
821# CONFIG_EEPROM_AT24 is not set
822# CONFIG_EEPROM_LEGACY is not set
823# CONFIG_SENSORS_PCF8574 is not set 831# CONFIG_SENSORS_PCF8574 is not set
824# CONFIG_PCF8575 is not set 832# CONFIG_PCF8575 is not set
825# CONFIG_SENSORS_PCA9539 is not set 833# CONFIG_SENSORS_PCA9539 is not set
@@ -1159,6 +1167,7 @@ CONFIG_JFFS2_RTIME=y
1159# CONFIG_SYSV_FS is not set 1167# CONFIG_SYSV_FS is not set
1160# CONFIG_UFS_FS is not set 1168# CONFIG_UFS_FS is not set
1161# CONFIG_NETWORK_FILESYSTEMS is not set 1169# CONFIG_NETWORK_FILESYSTEMS is not set
1170CONFIG_EXPORTFS=m
1162 1171
1163# 1172#
1164# Partition Types 1173# Partition Types
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index d811a8cd7b58..4774c2f92232 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -210,5 +210,10 @@ struct compat_shmid64_ds {
210 compat_ulong_t __unused6; 210 compat_ulong_t __unused6;
211}; 211};
212 212
213static inline int is_compat_task(void)
214{
215 return test_thread_flag(TIF_32BIT);
216}
217
213#endif /* __KERNEL__ */ 218#endif /* __KERNEL__ */
214#endif /* _ASM_POWERPC_COMPAT_H */ 219#endif /* _ASM_POWERPC_COMPAT_H */
diff --git a/arch/powerpc/include/asm/pgtable-4k.h b/arch/powerpc/include/asm/pgtable-4k.h
index 6b18ba9d2d85..1dbca4e7de67 100644
--- a/arch/powerpc/include/asm/pgtable-4k.h
+++ b/arch/powerpc/include/asm/pgtable-4k.h
@@ -60,7 +60,7 @@
60/* It should be preserving the high 48 bits and then specifically */ 60/* It should be preserving the high 48 bits and then specifically */
61/* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ 61/* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */
62#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ 62#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
63 _PAGE_HPTEFLAGS) 63 _PAGE_HPTEFLAGS | _PAGE_SPECIAL)
64 64
65/* Bits to mask out from a PMD to get to the PTE page */ 65/* Bits to mask out from a PMD to get to the PTE page */
66#define PMD_MASKED_BITS 0 66#define PMD_MASKED_BITS 0
diff --git a/arch/powerpc/include/asm/pgtable-64k.h b/arch/powerpc/include/asm/pgtable-64k.h
index 07b0d8f09cb6..7389003349a6 100644
--- a/arch/powerpc/include/asm/pgtable-64k.h
+++ b/arch/powerpc/include/asm/pgtable-64k.h
@@ -114,7 +114,7 @@ static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd)
114 * pgprot changes 114 * pgprot changes
115 */ 115 */
116#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ 116#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
117 _PAGE_ACCESSED) 117 _PAGE_ACCESSED | _PAGE_SPECIAL)
118 118
119/* Bits to mask out from a PMD to get to the PTE page */ 119/* Bits to mask out from a PMD to get to the PTE page */
120#define PMD_MASKED_BITS 0x1ff 120#define PMD_MASKED_BITS 0x1ff
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index f69a4d977729..820b5f0a35ce 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -429,7 +429,8 @@ extern int icache_44x_need_flush;
429#define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() 429#define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE()
430#endif 430#endif
431 431
432#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 432#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
433 _PAGE_SPECIAL)
433 434
434 435
435#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ 436#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
diff --git a/arch/powerpc/include/asm/seccomp.h b/arch/powerpc/include/asm/seccomp.h
index 853765eb1f65..00c1d9133cfe 100644
--- a/arch/powerpc/include/asm/seccomp.h
+++ b/arch/powerpc/include/asm/seccomp.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_POWERPC_SECCOMP_H 1#ifndef _ASM_POWERPC_SECCOMP_H
2#define _ASM_POWERPC_SECCOMP_H 2#define _ASM_POWERPC_SECCOMP_H
3 3
4#ifdef __KERNEL__
5#include <linux/thread_info.h>
6#endif
7
8#include <linux/unistd.h> 4#include <linux/unistd.h>
9 5
10#define __NR_seccomp_read __NR_read 6#define __NR_seccomp_read __NR_read
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 5af4e9b2dbe2..73cb6a3229ae 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -367,27 +367,24 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
367static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, 367static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg,
368 unsigned int flags) 368 unsigned int flags)
369{ 369{
370 char *ptr = (char *) &current->thread.TS_FPR(reg); 370 char *ptr0 = (char *) &current->thread.TS_FPR(reg);
371 int i, ret; 371 char *ptr1 = (char *) &current->thread.TS_FPR(reg+1);
372 int i, ret, sw = 0;
372 373
373 if (!(flags & F)) 374 if (!(flags & F))
374 return 0; 375 return 0;
375 if (reg & 1) 376 if (reg & 1)
376 return 0; /* invalid form: FRS/FRT must be even */ 377 return 0; /* invalid form: FRS/FRT must be even */
377 if (!(flags & SW)) { 378 if (flags & SW)
378 /* not byte-swapped - easy */ 379 sw = 7;
379 if (!(flags & ST)) 380 ret = 0;
380 ret = __copy_from_user(ptr, addr, 16); 381 for (i = 0; i < 8; ++i) {
381 else 382 if (!(flags & ST)) {
382 ret = __copy_to_user(addr, ptr, 16); 383 ret |= __get_user(ptr0[i^sw], addr + i);
383 } else { 384 ret |= __get_user(ptr1[i^sw], addr + i + 8);
384 /* each FPR value is byte-swapped separately */ 385 } else {
385 ret = 0; 386 ret |= __put_user(ptr0[i^sw], addr + i);
386 for (i = 0; i < 16; ++i) { 387 ret |= __put_user(ptr1[i^sw], addr + i + 8);
387 if (!(flags & ST))
388 ret |= __get_user(ptr[i^7], addr + i);
389 else
390 ret |= __put_user(ptr[i^7], addr + i);
391 } 388 }
392 } 389 }
393 if (ret) 390 if (ret)
@@ -646,11 +643,16 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
646 unsigned int areg, struct pt_regs *regs, 643 unsigned int areg, struct pt_regs *regs,
647 unsigned int flags, unsigned int length) 644 unsigned int flags, unsigned int length)
648{ 645{
649 char *ptr = (char *) &current->thread.TS_FPR(reg); 646 char *ptr;
650 int ret = 0; 647 int ret = 0;
651 648
652 flush_vsx_to_thread(current); 649 flush_vsx_to_thread(current);
653 650
651 if (reg < 32)
652 ptr = (char *) &current->thread.TS_FPR(reg);
653 else
654 ptr = (char *) &current->thread.vr[reg - 32];
655
654 if (flags & ST) 656 if (flags & ST)
655 ret = __copy_to_user(addr, ptr, length); 657 ret = __copy_to_user(addr, ptr, length);
656 else { 658 else {
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2822c8ccfaaf..5f81256287f5 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -125,6 +125,10 @@ static void kvmppc_free_vcpus(struct kvm *kvm)
125 } 125 }
126} 126}
127 127
128void kvm_arch_sync_events(struct kvm *kvm)
129{
130}
131
128void kvm_arch_destroy_vm(struct kvm *kvm) 132void kvm_arch_destroy_vm(struct kvm *kvm)
129{ 133{
130 kvmppc_free_vcpus(kvm); 134 kvmppc_free_vcpus(kvm);
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 70693a5c12a1..693b14a778fa 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -62,18 +62,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
6272: std r8,8(r3) 6272: std r8,8(r3)
63 beq+ 3f 63 beq+ 3f
64 addi r3,r3,16 64 addi r3,r3,16
6523: ld r9,8(r4)
66.Ldo_tail: 65.Ldo_tail:
67 bf cr7*4+1,1f 66 bf cr7*4+1,1f
68 rotldi r9,r9,32 6723: lwz r9,8(r4)
68 addi r4,r4,4
6973: stw r9,0(r3) 6973: stw r9,0(r3)
70 addi r3,r3,4 70 addi r3,r3,4
711: bf cr7*4+2,2f 711: bf cr7*4+2,2f
72 rotldi r9,r9,16 7244: lhz r9,8(r4)
73 addi r4,r4,2
7374: sth r9,0(r3) 7474: sth r9,0(r3)
74 addi r3,r3,2 75 addi r3,r3,2
752: bf cr7*4+3,3f 762: bf cr7*4+3,3f
76 rotldi r9,r9,8 7745: lbz r9,8(r4)
7775: stb r9,0(r3) 7875: stb r9,0(r3)
783: li r3,0 793: li r3,0
79 blr 80 blr
@@ -141,11 +142,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
1416: cmpwi cr1,r5,8 1426: cmpwi cr1,r5,8
142 addi r3,r3,32 143 addi r3,r3,32
143 sld r9,r9,r10 144 sld r9,r9,r10
144 ble cr1,.Ldo_tail 145 ble cr1,7f
14534: ld r0,8(r4) 14634: ld r0,8(r4)
146 srd r7,r0,r11 147 srd r7,r0,r11
147 or r9,r7,r9 148 or r9,r7,r9
148 b .Ldo_tail 1497:
150 bf cr7*4+1,1f
151 rotldi r9,r9,32
15294: stw r9,0(r3)
153 addi r3,r3,4
1541: bf cr7*4+2,2f
155 rotldi r9,r9,16
15695: sth r9,0(r3)
157 addi r3,r3,2
1582: bf cr7*4+3,3f
159 rotldi r9,r9,8
16096: stb r9,0(r3)
1613: li r3,0
162 blr
149 163
150.Ldst_unaligned: 164.Ldst_unaligned:
151 PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */ 165 PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */
@@ -218,7 +232,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
218121: 232121:
219132: 233132:
220 addi r3,r3,8 234 addi r3,r3,8
221123:
222134: 235134:
223135: 236135:
224138: 237138:
@@ -226,6 +239,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
226140: 239140:
227141: 240141:
228142: 241142:
242123:
243144:
244145:
229 245
230/* 246/*
231 * here we have had a fault on a load and r3 points to the first 247 * here we have had a fault on a load and r3 points to the first
@@ -309,6 +325,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
309187: 325187:
310188: 326188:
311189: 327189:
328194:
329195:
330196:
3121: 3311:
313 ld r6,-24(r1) 332 ld r6,-24(r1)
314 ld r5,-8(r1) 333 ld r5,-8(r1)
@@ -329,7 +348,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
329 .llong 72b,172b 348 .llong 72b,172b
330 .llong 23b,123b 349 .llong 23b,123b
331 .llong 73b,173b 350 .llong 73b,173b
351 .llong 44b,144b
332 .llong 74b,174b 352 .llong 74b,174b
353 .llong 45b,145b
333 .llong 75b,175b 354 .llong 75b,175b
334 .llong 24b,124b 355 .llong 24b,124b
335 .llong 25b,125b 356 .llong 25b,125b
@@ -347,6 +368,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
347 .llong 79b,179b 368 .llong 79b,179b
348 .llong 80b,180b 369 .llong 80b,180b
349 .llong 34b,134b 370 .llong 34b,134b
371 .llong 94b,194b
372 .llong 95b,195b
373 .llong 96b,196b
350 .llong 35b,135b 374 .llong 35b,135b
351 .llong 81b,181b 375 .llong 81b,181b
352 .llong 36b,136b 376 .llong 36b,136b
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index fe2d34e5332d..e178922b2c21 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -53,18 +53,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
533: std r8,8(r3) 533: std r8,8(r3)
54 beq 3f 54 beq 3f
55 addi r3,r3,16 55 addi r3,r3,16
56 ld r9,8(r4)
57.Ldo_tail: 56.Ldo_tail:
58 bf cr7*4+1,1f 57 bf cr7*4+1,1f
59 rotldi r9,r9,32 58 lwz r9,8(r4)
59 addi r4,r4,4
60 stw r9,0(r3) 60 stw r9,0(r3)
61 addi r3,r3,4 61 addi r3,r3,4
621: bf cr7*4+2,2f 621: bf cr7*4+2,2f
63 rotldi r9,r9,16 63 lhz r9,8(r4)
64 addi r4,r4,2
64 sth r9,0(r3) 65 sth r9,0(r3)
65 addi r3,r3,2 66 addi r3,r3,2
662: bf cr7*4+3,3f 672: bf cr7*4+3,3f
67 rotldi r9,r9,8 68 lbz r9,8(r4)
68 stb r9,0(r3) 69 stb r9,0(r3)
693: ld r3,48(r1) /* return dest pointer */ 703: ld r3,48(r1) /* return dest pointer */
70 blr 71 blr
@@ -133,11 +134,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
133 cmpwi cr1,r5,8 134 cmpwi cr1,r5,8
134 addi r3,r3,32 135 addi r3,r3,32
135 sld r9,r9,r10 136 sld r9,r9,r10
136 ble cr1,.Ldo_tail 137 ble cr1,6f
137 ld r0,8(r4) 138 ld r0,8(r4)
138 srd r7,r0,r11 139 srd r7,r0,r11
139 or r9,r7,r9 140 or r9,r7,r9
140 b .Ldo_tail 1416:
142 bf cr7*4+1,1f
143 rotldi r9,r9,32
144 stw r9,0(r3)
145 addi r3,r3,4
1461: bf cr7*4+2,2f
147 rotldi r9,r9,16
148 sth r9,0(r3)
149 addi r3,r3,2
1502: bf cr7*4+3,3f
151 rotldi r9,r9,8
152 stb r9,0(r3)
1533: ld r3,48(r1) /* return dest pointer */
154 blr
141 155
142.Ldst_unaligned: 156.Ldst_unaligned:
143 PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7 157 PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 7393bd76d698..5ac08b8ab654 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/lmb.h> 20#include <linux/lmb.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/pfn.h>
22#include <asm/sparsemem.h> 23#include <asm/sparsemem.h>
23#include <asm/prom.h> 24#include <asm/prom.h>
24#include <asm/system.h> 25#include <asm/system.h>
@@ -882,7 +883,7 @@ static void mark_reserved_regions_for_nid(int nid)
882 unsigned long physbase = lmb.reserved.region[i].base; 883 unsigned long physbase = lmb.reserved.region[i].base;
883 unsigned long size = lmb.reserved.region[i].size; 884 unsigned long size = lmb.reserved.region[i].size;
884 unsigned long start_pfn = physbase >> PAGE_SHIFT; 885 unsigned long start_pfn = physbase >> PAGE_SHIFT;
885 unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT); 886 unsigned long end_pfn = PFN_UP(physbase + size);
886 struct node_active_region node_ar; 887 struct node_active_region node_ar;
887 unsigned long node_end_pfn = node->node_start_pfn + 888 unsigned long node_end_pfn = node->node_start_pfn +
888 node->node_spanned_pages; 889 node->node_spanned_pages;
@@ -908,7 +909,7 @@ static void mark_reserved_regions_for_nid(int nid)
908 */ 909 */
909 if (end_pfn > node_ar.end_pfn) 910 if (end_pfn > node_ar.end_pfn)
910 reserve_size = (node_ar.end_pfn << PAGE_SHIFT) 911 reserve_size = (node_ar.end_pfn << PAGE_SHIFT)
911 - (start_pfn << PAGE_SHIFT); 912 - physbase;
912 /* 913 /*
913 * Only worry about *this* node, others may not 914 * Only worry about *this* node, others may not
914 * yet have valid NODE_DATA(). 915 * yet have valid NODE_DATA().
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index fb371f5ce132..d6b772ba3b8f 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -142,6 +142,10 @@ static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev)
142{ 142{
143 unsigned int val; 143 unsigned int val;
144 144
145 /* Do not do the fixup on other platforms! */
146 if (!machine_is(gef_sbc610))
147 return;
148
145 printk(KERN_INFO "Running NEC uPD720101 Fixup\n"); 149 printk(KERN_INFO "Running NEC uPD720101 Fixup\n");
146 150
147 /* Ensure ports 1, 2, 3, 4 & 5 are enabled */ 151 /* Ensure ports 1, 2, 3, 4 & 5 are enabled */
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 2ca7be65c2d2..244f997de791 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/initrd.h> 14#include <linux/initrd.h>
15#include <linux/mtd/physmap.h>
16#include <linux/of_platform.h> 15#include <linux/of_platform.h>
17 16
18#include <asm/time.h> 17#include <asm/time.h>
@@ -22,39 +21,6 @@
22 21
23#include "mpc10x.h" 22#include "mpc10x.h"
24 23
25static struct mtd_partition linkstation_physmap_partitions[] = {
26 {
27 .name = "mtd_firmimg",
28 .offset = 0x000000,
29 .size = 0x300000,
30 },
31 {
32 .name = "mtd_bootcode",
33 .offset = 0x300000,
34 .size = 0x070000,
35 },
36 {
37 .name = "mtd_status",
38 .offset = 0x370000,
39 .size = 0x010000,
40 },
41 {
42 .name = "mtd_conf",
43 .offset = 0x380000,
44 .size = 0x080000,
45 },
46 {
47 .name = "mtd_allflash",
48 .offset = 0x000000,
49 .size = 0x400000,
50 },
51 {
52 .name = "mtd_data",
53 .offset = 0x310000,
54 .size = 0x0f0000,
55 },
56};
57
58static __initdata struct of_device_id of_bus_ids[] = { 24static __initdata struct of_device_id of_bus_ids[] = {
59 { .type = "soc", }, 25 { .type = "soc", },
60 { .compatible = "simple-bus", }, 26 { .compatible = "simple-bus", },
@@ -99,10 +65,6 @@ static int __init linkstation_add_bridge(struct device_node *dev)
99static void __init linkstation_setup_arch(void) 65static void __init linkstation_setup_arch(void)
100{ 66{
101 struct device_node *np; 67 struct device_node *np;
102#ifdef CONFIG_MTD_PHYSMAP
103 physmap_set_partitions(linkstation_physmap_partitions,
104 ARRAY_SIZE(linkstation_physmap_partitions));
105#endif
106 68
107 /* Lookup PCI host bridges */ 69 /* Lookup PCI host bridges */
108 for_each_compatible_node(np, "pci", "mpc10x-pci") 70 for_each_compatible_node(np, "pci", "mpc10x-pci")
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index 8864e4884980..613070e9ddbe 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/initrd.h> 16#include <linux/initrd.h>
17#include <linux/mtd/physmap.h>
18#include <linux/of_platform.h> 17#include <linux/of_platform.h>
19 18
20#include <asm/system.h> 19#include <asm/system.h>
@@ -26,32 +25,6 @@
26#include "mpc10x.h" 25#include "mpc10x.h"
27 26
28 27
29#ifdef CONFIG_MTD_PHYSMAP
30static struct mtd_partition storcenter_physmap_partitions[] = {
31 {
32 .name = "kernel",
33 .offset = 0x000000,
34 .size = 0x170000,
35 },
36 {
37 .name = "rootfs",
38 .offset = 0x170000,
39 .size = 0x590000,
40 },
41 {
42 .name = "uboot",
43 .offset = 0x700000,
44 .size = 0x040000,
45 },
46 {
47 .name = "config",
48 .offset = 0x740000,
49 .size = 0x0c0000,
50 },
51};
52#endif
53
54
55static __initdata struct of_device_id storcenter_of_bus[] = { 28static __initdata struct of_device_id storcenter_of_bus[] = {
56 { .name = "soc", }, 29 { .name = "soc", },
57 {}, 30 {},
@@ -96,11 +69,6 @@ static void __init storcenter_setup_arch(void)
96{ 69{
97 struct device_node *np; 70 struct device_node *np;
98 71
99#ifdef CONFIG_MTD_PHYSMAP
100 physmap_set_partitions(storcenter_physmap_partitions,
101 ARRAY_SIZE(storcenter_physmap_partitions));
102#endif
103
104 /* Lookup PCI host bridges */ 72 /* Lookup PCI host bridges */
105 for_each_compatible_node(np, "pci", "mpc10x-pci") 73 for_each_compatible_node(np, "pci", "mpc10x-pci")
106 storcenter_add_bridge(np); 74 storcenter_add_bridge(np);
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 67de6bf3db3d..d281cc0bca71 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -328,7 +328,7 @@ static int __init ps3_mm_add_memory(void)
328 return result; 328 return result;
329} 329}
330 330
331core_initcall(ps3_mm_add_memory); 331device_initcall(ps3_mm_add_memory);
332 332
333/*============================================================================*/ 333/*============================================================================*/
334/* dma routines */ 334/* dma routines */
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 77fae5f64f2e..5558d932b4d5 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -204,6 +204,23 @@ static int __init ppc4xx_setup_one_pci_PMM(struct pci_controller *hose,
204{ 204{
205 u32 ma, pcila, pciha; 205 u32 ma, pcila, pciha;
206 206
207 /* Hack warning ! The "old" PCI 2.x cell only let us configure the low
208 * 32-bit of incoming PLB addresses. The top 4 bits of the 36-bit
209 * address are actually hard wired to a value that appears to depend
210 * on the specific SoC. For example, it's 0 on 440EP and 1 on 440EPx.
211 *
212 * The trick here is we just crop those top bits and ignore them when
213 * programming the chip. That means the device-tree has to be right
214 * for the specific part used (we don't print a warning if it's wrong
215 * but on the other hand, you'll crash quickly enough), but at least
216 * this code should work whatever the hard coded value is
217 */
218 plb_addr &= 0xffffffffull;
219
220 /* Note: Due to the above hack, the test below doesn't actually test
221 * if you address is above 4G, but it tests that address and
222 * (address + size) are both contained in the same 4G
223 */
207 if ((plb_addr + size) > 0xffffffffull || !is_power_of_2(size) || 224 if ((plb_addr + size) > 0xffffffffull || !is_power_of_2(size) ||
208 size < 0x1000 || (plb_addr & (size - 1)) != 0) { 225 size < 0x1000 || (plb_addr & (size - 1)) != 0) {
209 printk(KERN_WARNING "%s: Resource out of range\n", 226 printk(KERN_WARNING "%s: Resource out of range\n",
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index c42cd898f68b..6118890c946d 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -556,7 +556,7 @@ static void __exit aes_s390_fini(void)
556module_init(aes_s390_init); 556module_init(aes_s390_init);
557module_exit(aes_s390_fini); 557module_exit(aes_s390_fini);
558 558
559MODULE_ALIAS("aes"); 559MODULE_ALIAS("aes-all");
560 560
561MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); 561MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
562MODULE_LICENSE("GPL"); 562MODULE_LICENSE("GPL");
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 521726430afa..95b0f7db3c69 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -145,7 +145,7 @@ cputime_to_timeval(const cputime_t cputime, struct timeval *value)
145 value->tv_usec = rp.subreg.even / 4096; 145 value->tv_usec = rp.subreg.even / 4096;
146 value->tv_sec = rp.subreg.odd; 146 value->tv_sec = rp.subreg.odd;
147#else 147#else
148 value->tv_usec = cputime % 4096000000ULL; 148 value->tv_usec = (cputime % 4096000000ULL) / 4096;
149 value->tv_sec = cputime / 4096000000ULL; 149 value->tv_sec = cputime / 4096000000ULL;
150#endif 150#endif
151} 151}
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index 2bd9faeb3919..e8bd6ac22c99 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -43,6 +43,8 @@ struct mem_chunk {
43 43
44extern struct mem_chunk memory_chunk[]; 44extern struct mem_chunk memory_chunk[];
45extern unsigned long real_memory_size; 45extern unsigned long real_memory_size;
46extern int memory_end_set;
47extern unsigned long memory_end;
46 48
47void detect_memory_layout(struct mem_chunk chunk[]); 49void detect_memory_layout(struct mem_chunk chunk[]);
48 50
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index d825f4950e4e..c5cfb6185eac 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -82,7 +82,9 @@ char elf_platform[ELF_PLATFORM_SIZE];
82 82
83struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 83struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
84volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ 84volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
85static unsigned long __initdata memory_end; 85
86int __initdata memory_end_set;
87unsigned long __initdata memory_end;
86 88
87/* 89/*
88 * This is set up by the setup-routine at boot-time 90 * This is set up by the setup-routine at boot-time
@@ -281,6 +283,7 @@ void (*pm_power_off)(void) = machine_power_off;
281static int __init early_parse_mem(char *p) 283static int __init early_parse_mem(char *p)
282{ 284{
283 memory_end = memparse(p, &p); 285 memory_end = memparse(p, &p);
286 memory_end_set = 1;
284 return 0; 287 return 0;
285} 288}
286early_param("mem", early_parse_mem); 289early_param("mem", early_parse_mem);
@@ -508,8 +511,10 @@ static void __init setup_memory_end(void)
508 int i; 511 int i;
509 512
510#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) 513#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE)
511 if (ipl_info.type == IPL_TYPE_FCP_DUMP) 514 if (ipl_info.type == IPL_TYPE_FCP_DUMP) {
512 memory_end = ZFCPDUMP_HSA_SIZE; 515 memory_end = ZFCPDUMP_HSA_SIZE;
516 memory_end_set = 1;
517 }
513#endif 518#endif
514 memory_size = 0; 519 memory_size = 0;
515 memory_end &= PAGE_MASK; 520 memory_end &= PAGE_MASK;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index be8497186b96..0d33893e1e89 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -212,6 +212,10 @@ static void kvm_free_vcpus(struct kvm *kvm)
212 } 212 }
213} 213}
214 214
215void kvm_arch_sync_events(struct kvm *kvm)
216{
217}
218
215void kvm_arch_destroy_vm(struct kvm *kvm) 219void kvm_arch_destroy_vm(struct kvm *kvm)
216{ 220{
217 kvm_free_vcpus(kvm); 221 kvm_free_vcpus(kvm);
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 7c35787d29b4..15b6d450fbf0 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -22,7 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/spi/spi_gpio.h> 24#include <linux/spi/spi_gpio.h>
25#include <media/ov772x.h> 25#include <media/soc_camera.h>
26#include <media/soc_camera_platform.h> 26#include <media/soc_camera_platform.h>
27#include <media/sh_mobile_ceu.h> 27#include <media/sh_mobile_ceu.h>
28#include <video/sh_mobile_lcdc.h> 28#include <video/sh_mobile_lcdc.h>
@@ -224,7 +224,6 @@ static void camera_power(int val)
224} 224}
225 225
226#ifdef CONFIG_I2C 226#ifdef CONFIG_I2C
227/* support for the old ncm03j camera */
228static unsigned char camera_ncm03j_magic[] = 227static unsigned char camera_ncm03j_magic[] =
229{ 228{
230 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, 229 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
@@ -245,23 +244,6 @@ static unsigned char camera_ncm03j_magic[] =
245 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, 244 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
246}; 245};
247 246
248static int camera_probe(void)
249{
250 struct i2c_adapter *a = i2c_get_adapter(0);
251 struct i2c_msg msg;
252 int ret;
253
254 camera_power(1);
255 msg.addr = 0x6e;
256 msg.buf = camera_ncm03j_magic;
257 msg.len = 2;
258 msg.flags = 0;
259 ret = i2c_transfer(a, &msg, 1);
260 camera_power(0);
261
262 return ret;
263}
264
265static int camera_set_capture(struct soc_camera_platform_info *info, 247static int camera_set_capture(struct soc_camera_platform_info *info,
266 int enable) 248 int enable)
267{ 249{
@@ -313,35 +295,8 @@ static struct platform_device camera_device = {
313 .platform_data = &camera_info, 295 .platform_data = &camera_info,
314 }, 296 },
315}; 297};
316
317static int __init camera_setup(void)
318{
319 if (camera_probe() > 0)
320 platform_device_register(&camera_device);
321
322 return 0;
323}
324late_initcall(camera_setup);
325
326#endif /* CONFIG_I2C */ 298#endif /* CONFIG_I2C */
327 299
328static int ov7725_power(struct device *dev, int mode)
329{
330 camera_power(0);
331 if (mode)
332 camera_power(1);
333
334 return 0;
335}
336
337static struct ov772x_camera_info ov7725_info = {
338 .buswidth = SOCAM_DATAWIDTH_8,
339 .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
340 .link = {
341 .power = ov7725_power,
342 },
343};
344
345static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 300static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
346 .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | 301 .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
347 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, 302 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
@@ -392,6 +347,9 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
392 &ap325rxa_nor_flash_device, 347 &ap325rxa_nor_flash_device,
393 &lcdc_device, 348 &lcdc_device,
394 &ceu_device, 349 &ceu_device,
350#ifdef CONFIG_I2C
351 &camera_device,
352#endif
395 &nand_flash_device, 353 &nand_flash_device,
396 &sdcard_cn3_device, 354 &sdcard_cn3_device,
397}; 355};
@@ -400,10 +358,6 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
400 { 358 {
401 I2C_BOARD_INFO("pcf8563", 0x51), 359 I2C_BOARD_INFO("pcf8563", 0x51),
402 }, 360 },
403 {
404 I2C_BOARD_INFO("ov772x", 0x21),
405 .platform_data = &ov7725_info,
406 },
407}; 361};
408 362
409static struct spi_board_info ap325rxa_spi_devices[] = { 363static struct spi_board_info ap325rxa_spi_devices[] = {
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
index 020a96fe961a..4a5e59732334 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
@@ -18,8 +18,8 @@
18#include <asm/freq.h> 18#include <asm/freq.h>
19#include <asm/io.h> 19#include <asm/io.h>
20 20
21const static int pll1rate[]={1,2,3,4,6,8}; 21static const int pll1rate[]={1,2,3,4,6,8};
22const static int pfc_divisors[]={1,2,3,4,6,8,12}; 22static const int pfc_divisors[]={1,2,3,4,6,8,12};
23#define ifc_divisors pfc_divisors 23#define ifc_divisors pfc_divisors
24 24
25#if (CONFIG_SH_CLK_MD == 0) 25#if (CONFIG_SH_CLK_MD == 0)
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index f260b58f5ce9..0e706257918f 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -240,4 +240,9 @@ struct compat_shmid64_ds {
240 unsigned int __unused2; 240 unsigned int __unused2;
241}; 241};
242 242
243static inline int is_compat_task(void)
244{
245 return test_thread_flag(TIF_32BIT);
246}
247
243#endif /* _ASM_SPARC64_COMPAT_H */ 248#endif /* _ASM_SPARC64_COMPAT_H */
diff --git a/arch/sparc/include/asm/seccomp.h b/arch/sparc/include/asm/seccomp.h
index 7fcd9968192b..adca1bce41d4 100644
--- a/arch/sparc/include/asm/seccomp.h
+++ b/arch/sparc/include/asm/seccomp.h
@@ -1,11 +1,5 @@
1#ifndef _ASM_SECCOMP_H 1#ifndef _ASM_SECCOMP_H
2 2
3#include <linux/thread_info.h> /* already defines TIF_32BIT */
4
5#ifndef TIF_32BIT
6#error "unexpected TIF_32BIT on sparc64"
7#endif
8
9#include <linux/unistd.h> 3#include <linux/unistd.h>
10 4
11#define __NR_seccomp_read __NR_read 5#define __NR_seccomp_read __NR_read
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 3b9f4d6e14a9..e1a9598e2a4d 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -306,6 +306,7 @@ static int jbusmc_print_dimm(int syndrome_code,
306 buf[1] = '?'; 306 buf[1] = '?';
307 buf[2] = '?'; 307 buf[2] = '?';
308 buf[3] = '\0'; 308 buf[3] = '\0';
309 return 0;
309 } 310 }
310 p = dp->controller; 311 p = dp->controller;
311 prop = &p->layout; 312 prop = &p->layout;
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index e53138365490..8ba064f08a6f 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -323,17 +323,25 @@ static void sun4u_set_affinity(unsigned int virt_irq,
323 sun4u_irq_enable(virt_irq); 323 sun4u_irq_enable(virt_irq);
324} 324}
325 325
326/* Don't do anything. The desc->status check for IRQ_DISABLED in
327 * handler_irq() will skip the handler call and that will leave the
328 * interrupt in the sent state. The next ->enable() call will hit the
329 * ICLR register to reset the state machine.
330 *
331 * This scheme is necessary, instead of clearing the Valid bit in the
332 * IMAP register, to handle the case of IMAP registers being shared by
333 * multiple INOs (and thus ICLR registers). Since we use a different
334 * virtual IRQ for each shared IMAP instance, the generic code thinks
335 * there is only one user so it prematurely calls ->disable() on
336 * free_irq().
337 *
338 * We have to provide an explicit ->disable() method instead of using
339 * NULL to get the default. The reason is that if the generic code
340 * sees that, it also hooks up a default ->shutdown method which
341 * invokes ->mask() which we do not want. See irq_chip_set_defaults().
342 */
326static void sun4u_irq_disable(unsigned int virt_irq) 343static void sun4u_irq_disable(unsigned int virt_irq)
327{ 344{
328 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
329
330 if (likely(data)) {
331 unsigned long imap = data->imap;
332 unsigned long tmp = upa_readq(imap);
333
334 tmp &= ~IMAP_VALID;
335 upa_writeq(tmp, imap);
336 }
337} 345}
338 346
339static void sun4u_irq_eoi(unsigned int virt_irq) 347static void sun4u_irq_eoi(unsigned int virt_irq)
@@ -746,7 +754,8 @@ void handler_irq(int irq, struct pt_regs *regs)
746 754
747 desc = irq_desc + virt_irq; 755 desc = irq_desc + virt_irq;
748 756
749 desc->handle_irq(virt_irq, desc); 757 if (!(desc->status & IRQ_DISABLED))
758 desc->handle_irq(virt_irq, desc);
750 759
751 bucket_pa = next_pa; 760 bucket_pa = next_pa;
752 } 761 }
diff --git a/arch/um/drivers/vde_user.c b/arch/um/drivers/vde_user.c
index 56533db25343..c5c43253e6ce 100644
--- a/arch/um/drivers/vde_user.c
+++ b/arch/um/drivers/vde_user.c
@@ -78,7 +78,7 @@ void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init)
78{ 78{
79 struct vde_open_args *args; 79 struct vde_open_args *args;
80 80
81 vpri->args = kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL); 81 vpri->args = uml_kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL);
82 if (vpri->args == NULL) { 82 if (vpri->args == NULL) {
83 printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args " 83 printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args "
84 "allocation failed"); 84 "allocation failed");
@@ -91,8 +91,8 @@ void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init)
91 args->group = init->group; 91 args->group = init->group;
92 args->mode = init->mode ? init->mode : 0700; 92 args->mode = init->mode ? init->mode : 0700;
93 93
94 args->port ? printk(UM_KERN_INFO "port %d", args->port) : 94 args->port ? printk("port %d", args->port) :
95 printk(UM_KERN_INFO "undefined port"); 95 printk("undefined port");
96} 96}
97 97
98int vde_user_read(void *conn, void *buf, int len) 98int vde_user_read(void *conn, void *buf, int len)
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 15e8b7c4de13..8e3d69e4fcb5 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -64,6 +64,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
64 ret = poke_user(child, addr, data); 64 ret = poke_user(child, addr, data);
65 break; 65 break;
66 66
67 case PTRACE_SYSEMU:
68 case PTRACE_SYSEMU_SINGLESTEP:
69 ret = -EIO;
70 break;
71
67 /* continue and stop at next (return from) syscall */ 72 /* continue and stop at next (return from) syscall */
68 case PTRACE_SYSCALL: 73 case PTRACE_SYSCALL:
69 /* restart after signal. */ 74 /* restart after signal. */
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 74f49bb9b125..89b48a116a89 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -14,7 +14,6 @@
14#undef memset 14#undef memset
15 15
16extern size_t strlen(const char *); 16extern size_t strlen(const char *);
17extern void *memcpy(void *, const void *, size_t);
18extern void *memmove(void *, const void *, size_t); 17extern void *memmove(void *, const void *, size_t);
19extern void *memset(void *, int, size_t); 18extern void *memset(void *, int, size_t);
20extern int printf(const char *, ...); 19extern int printf(const char *, ...);
@@ -24,7 +23,11 @@ extern int printf(const char *, ...);
24EXPORT_SYMBOL(strstr); 23EXPORT_SYMBOL(strstr);
25#endif 24#endif
26 25
26#ifndef __x86_64__
27extern void *memcpy(void *, const void *, size_t);
27EXPORT_SYMBOL(memcpy); 28EXPORT_SYMBOL(memcpy);
29#endif
30
28EXPORT_SYMBOL(memmove); 31EXPORT_SYMBOL(memmove);
29EXPORT_SYMBOL(memset); 32EXPORT_SYMBOL(memset);
30EXPORT_SYMBOL(printf); 33EXPORT_SYMBOL(printf);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9c39095b33fc..bc2fbadff9f9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1803,7 +1803,7 @@ config DMAR
1803 remapping devices. 1803 remapping devices.
1804 1804
1805config DMAR_DEFAULT_ON 1805config DMAR_DEFAULT_ON
1806 def_bool n 1806 def_bool y
1807 prompt "Enable DMA Remapping Devices by default" 1807 prompt "Enable DMA Remapping Devices by default"
1808 depends on DMAR 1808 depends on DMAR
1809 help 1809 help
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 10d6cc3fd052..e1983fa025d2 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -174,28 +174,8 @@ config IOMMU_LEAK
174 Add a simple leak tracer to the IOMMU code. This is useful when you 174 Add a simple leak tracer to the IOMMU code. This is useful when you
175 are debugging a buggy device driver that leaks IOMMU mappings. 175 are debugging a buggy device driver that leaks IOMMU mappings.
176 176
177config MMIOTRACE 177config HAVE_MMIOTRACE_SUPPORT
178 bool "Memory mapped IO tracing" 178 def_bool y
179 depends on DEBUG_KERNEL && PCI
180 select TRACING
181 help
182 Mmiotrace traces Memory Mapped I/O access and is meant for
183 debugging and reverse engineering. It is called from the ioremap
184 implementation and works via page faults. Tracing is disabled by
185 default and can be enabled at run-time.
186
187 See Documentation/tracers/mmiotrace.txt.
188 If you are not helping to develop drivers, say N.
189
190config MMIOTRACE_TEST
191 tristate "Test module for mmiotrace"
192 depends on MMIOTRACE && m
193 help
194 This is a dumb module for testing mmiotrace. It is very dangerous
195 as it will write garbage to IO memory starting at a given address.
196 However, it should be safe to use on e.g. unused portion of VRAM.
197
198 Say N, unless you absolutely know what you are doing.
199 179
200# 180#
201# IO delay types: 181# IO delay types:
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index ca5ffb2856b6..edc90f23e708 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -37,8 +37,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
37 37
38#else /* !CONFIG_X86_32 */ 38#else /* !CONFIG_X86_32 */
39 39
40#define MAX_EFI_IO_PAGES 100
41
42extern u64 efi_call0(void *fp); 40extern u64 efi_call0(void *fp);
43extern u64 efi_call1(void *fp, u64 arg1); 41extern u64 efi_call1(void *fp, u64 arg1);
44extern u64 efi_call2(void *fp, u64 arg1, u64 arg2); 42extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
diff --git a/arch/x86/include/asm/fixmap_64.h b/arch/x86/include/asm/fixmap_64.h
index 00a30ab9b1a5..8be740977db8 100644
--- a/arch/x86/include/asm/fixmap_64.h
+++ b/arch/x86/include/asm/fixmap_64.h
@@ -16,7 +16,6 @@
16#include <asm/apicdef.h> 16#include <asm/apicdef.h>
17#include <asm/page.h> 17#include <asm/page.h>
18#include <asm/vsyscall.h> 18#include <asm/vsyscall.h>
19#include <asm/efi.h>
20 19
21/* 20/*
22 * Here we define all the compile-time 'special' virtual 21 * Here we define all the compile-time 'special' virtual
@@ -43,9 +42,6 @@ enum fixed_addresses {
43 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ 42 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
44 FIX_IO_APIC_BASE_0, 43 FIX_IO_APIC_BASE_0,
45 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1, 44 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
46 FIX_EFI_IO_MAP_LAST_PAGE,
47 FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE
48 + MAX_EFI_IO_PAGES - 1,
49#ifdef CONFIG_PARAVIRT 45#ifdef CONFIG_PARAVIRT
50 FIX_PARAVIRT_BOOTMAP, 46 FIX_PARAVIRT_BOOTMAP,
51#endif 47#endif
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index 48f0004db8c9..71c9e5183982 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -172,7 +172,13 @@ static inline void __save_init_fpu(struct task_struct *tsk)
172 172
173#else /* CONFIG_X86_32 */ 173#else /* CONFIG_X86_32 */
174 174
175extern void finit(void); 175#ifdef CONFIG_MATH_EMULATION
176extern void finit_task(struct task_struct *tsk);
177#else
178static inline void finit_task(struct task_struct *tsk)
179{
180}
181#endif
176 182
177static inline void tolerant_fwait(void) 183static inline void tolerant_fwait(void)
178{ 184{
diff --git a/arch/x86/include/asm/iomap.h b/arch/x86/include/asm/iomap.h
index c1f06289b14b..86af26091d6c 100644
--- a/arch/x86/include/asm/iomap.h
+++ b/arch/x86/include/asm/iomap.h
@@ -23,6 +23,9 @@
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25 25
26int
27is_io_mapping_possible(resource_size_t base, unsigned long size);
28
26void * 29void *
27iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot); 30iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot);
28 31
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
index d2e3bf3608af..886c9402ec45 100644
--- a/arch/x86/include/asm/kvm.h
+++ b/arch/x86/include/asm/kvm.h
@@ -9,6 +9,13 @@
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11 11
12/* Select x86 specific features in <linux/kvm.h> */
13#define __KVM_HAVE_PIT
14#define __KVM_HAVE_IOAPIC
15#define __KVM_HAVE_DEVICE_ASSIGNMENT
16#define __KVM_HAVE_MSI
17#define __KVM_HAVE_USER_NMI
18
12/* Architectural interrupt line count. */ 19/* Architectural interrupt line count. */
13#define KVM_NR_INTERRUPTS 256 20#define KVM_NR_INTERRUPTS 256
14 21
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
index 07f1af494ca5..105fb90a0635 100644
--- a/arch/x86/include/asm/mmzone_32.h
+++ b/arch/x86/include/asm/mmzone_32.h
@@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void)
32 get_memcfg_numa_flat(); 32 get_memcfg_numa_flat();
33} 33}
34 34
35extern int early_pfn_to_nid(unsigned long pfn);
36
37extern void resume_map_numa_kva(pgd_t *pgd); 35extern void resume_map_numa_kva(pgd_t *pgd);
38 36
39#else /* !CONFIG_NUMA */ 37#else /* !CONFIG_NUMA */
diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h
index a5b3817d4b9e..a29f48c2a322 100644
--- a/arch/x86/include/asm/mmzone_64.h
+++ b/arch/x86/include/asm/mmzone_64.h
@@ -40,8 +40,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
40#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ 40#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
41 NODE_DATA(nid)->node_spanned_pages) 41 NODE_DATA(nid)->node_spanned_pages)
42 42
43extern int early_pfn_to_nid(unsigned long pfn);
44
45#ifdef CONFIG_NUMA_EMU 43#ifdef CONFIG_NUMA_EMU
46#define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024) 44#define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024)
47#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) 45#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
index e9873a2e8695..776579119a00 100644
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -57,7 +57,6 @@ typedef struct { pgdval_t pgd; } pgd_t;
57typedef struct { pgprotval_t pgprot; } pgprot_t; 57typedef struct { pgprotval_t pgprot; } pgprot_t;
58 58
59extern int page_is_ram(unsigned long pagenr); 59extern int page_is_ram(unsigned long pagenr);
60extern int pagerange_is_ram(unsigned long start, unsigned long end);
61extern int devmem_is_allowed(unsigned long pagenr); 60extern int devmem_is_allowed(unsigned long pagenr);
62extern void map_devmem(unsigned long pfn, unsigned long size, 61extern void map_devmem(unsigned long pfn, unsigned long size,
63 pgprot_t vma_prot); 62 pgprot_t vma_prot);
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index c09a14127584..e299287e8e33 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -1352,14 +1352,7 @@ static inline void arch_leave_lazy_cpu_mode(void)
1352 PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave); 1352 PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave);
1353} 1353}
1354 1354
1355static inline void arch_flush_lazy_cpu_mode(void) 1355void arch_flush_lazy_cpu_mode(void);
1356{
1357 if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)) {
1358 arch_leave_lazy_cpu_mode();
1359 arch_enter_lazy_cpu_mode();
1360 }
1361}
1362
1363 1356
1364#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 1357#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
1365static inline void arch_enter_lazy_mmu_mode(void) 1358static inline void arch_enter_lazy_mmu_mode(void)
@@ -1372,13 +1365,7 @@ static inline void arch_leave_lazy_mmu_mode(void)
1372 PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); 1365 PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave);
1373} 1366}
1374 1367
1375static inline void arch_flush_lazy_mmu_mode(void) 1368void arch_flush_lazy_mmu_mode(void);
1376{
1377 if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) {
1378 arch_leave_lazy_mmu_mode();
1379 arch_enter_lazy_mmu_mode();
1380 }
1381}
1382 1369
1383static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, 1370static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
1384 unsigned long phys, pgprot_t flags) 1371 unsigned long phys, pgprot_t flags)
diff --git a/arch/x86/include/asm/seccomp_32.h b/arch/x86/include/asm/seccomp_32.h
index a6ad87b352c4..b811d6f5780c 100644
--- a/arch/x86/include/asm/seccomp_32.h
+++ b/arch/x86/include/asm/seccomp_32.h
@@ -1,12 +1,6 @@
1#ifndef _ASM_X86_SECCOMP_32_H 1#ifndef _ASM_X86_SECCOMP_32_H
2#define _ASM_X86_SECCOMP_32_H 2#define _ASM_X86_SECCOMP_32_H
3 3
4#include <linux/thread_info.h>
5
6#ifdef TIF_32BIT
7#error "unexpected TIF_32BIT on i386"
8#endif
9
10#include <linux/unistd.h> 4#include <linux/unistd.h>
11 5
12#define __NR_seccomp_read __NR_read 6#define __NR_seccomp_read __NR_read
diff --git a/arch/x86/include/asm/seccomp_64.h b/arch/x86/include/asm/seccomp_64.h
index 4171bb794e9e..84ec1bd161a5 100644
--- a/arch/x86/include/asm/seccomp_64.h
+++ b/arch/x86/include/asm/seccomp_64.h
@@ -1,14 +1,6 @@
1#ifndef _ASM_X86_SECCOMP_64_H 1#ifndef _ASM_X86_SECCOMP_64_H
2#define _ASM_X86_SECCOMP_64_H 2#define _ASM_X86_SECCOMP_64_H
3 3
4#include <linux/thread_info.h>
5
6#ifdef TIF_32BIT
7#error "unexpected TIF_32BIT on x86_64"
8#else
9#define TIF_32BIT TIF_IA32
10#endif
11
12#include <linux/unistd.h> 4#include <linux/unistd.h>
13#include <asm/ia32_unistd.h> 5#include <asm/ia32_unistd.h>
14 6
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
index bcc293423a70..96258d9dc974 100644
--- a/arch/x86/kernel/acpi/wakeup_64.S
+++ b/arch/x86/kernel/acpi/wakeup_64.S
@@ -13,7 +13,6 @@
13 * Hooray, we are in Long 64-bit mode (but still running in low memory) 13 * Hooray, we are in Long 64-bit mode (but still running in low memory)
14 */ 14 */
15ENTRY(wakeup_long64) 15ENTRY(wakeup_long64)
16wakeup_long64:
17 movq saved_magic, %rax 16 movq saved_magic, %rax
18 movq $0x123456789abcdef0, %rdx 17 movq $0x123456789abcdef0, %rdx
19 cmpq %rdx, %rax 18 cmpq %rdx, %rax
@@ -34,16 +33,12 @@ wakeup_long64:
34 33
35 movq saved_rip, %rax 34 movq saved_rip, %rax
36 jmp *%rax 35 jmp *%rax
36ENDPROC(wakeup_long64)
37 37
38bogus_64_magic: 38bogus_64_magic:
39 jmp bogus_64_magic 39 jmp bogus_64_magic
40 40
41 .align 2 41ENTRY(do_suspend_lowlevel)
42 .p2align 4,,15
43.globl do_suspend_lowlevel
44 .type do_suspend_lowlevel,@function
45do_suspend_lowlevel:
46.LFB5:
47 subq $8, %rsp 42 subq $8, %rsp
48 xorl %eax, %eax 43 xorl %eax, %eax
49 call save_processor_state 44 call save_processor_state
@@ -67,7 +62,7 @@ do_suspend_lowlevel:
67 pushfq 62 pushfq
68 popq pt_regs_flags(%rax) 63 popq pt_regs_flags(%rax)
69 64
70 movq $.L97, saved_rip(%rip) 65 movq $resume_point, saved_rip(%rip)
71 66
72 movq %rsp, saved_rsp 67 movq %rsp, saved_rsp
73 movq %rbp, saved_rbp 68 movq %rbp, saved_rbp
@@ -78,14 +73,12 @@ do_suspend_lowlevel:
78 addq $8, %rsp 73 addq $8, %rsp
79 movl $3, %edi 74 movl $3, %edi
80 xorl %eax, %eax 75 xorl %eax, %eax
81 jmp acpi_enter_sleep_state 76 call acpi_enter_sleep_state
82.L97: 77 /* in case something went wrong, restore the machine status and go on */
83 .p2align 4,,7 78 jmp resume_point
84.L99:
85 .align 4
86 movl $24, %eax
87 movw %ax, %ds
88 79
80 .align 4
81resume_point:
89 /* We don't restore %rax, it must be 0 anyway */ 82 /* We don't restore %rax, it must be 0 anyway */
90 movq $saved_context, %rax 83 movq $saved_context, %rax
91 movq saved_context_cr4(%rax), %rbx 84 movq saved_context_cr4(%rax), %rbx
@@ -117,12 +110,9 @@ do_suspend_lowlevel:
117 xorl %eax, %eax 110 xorl %eax, %eax
118 addq $8, %rsp 111 addq $8, %rsp
119 jmp restore_processor_state 112 jmp restore_processor_state
120.LFE5: 113ENDPROC(do_suspend_lowlevel)
121.Lfe5: 114
122 .size do_suspend_lowlevel, .Lfe5-do_suspend_lowlevel
123
124.data 115.data
125ALIGN
126ENTRY(saved_rbp) .quad 0 116ENTRY(saved_rbp) .quad 0
127ENTRY(saved_rsi) .quad 0 117ENTRY(saved_rsi) .quad 0
128ENTRY(saved_rdi) .quad 0 118ENTRY(saved_rdi) .quad 0
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c
index 115449f869ee..570f36e44e59 100644
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@ -862,7 +862,7 @@ void clear_local_APIC(void)
862 } 862 }
863 863
864 /* lets not touch this if we didn't frob it */ 864 /* lets not touch this if we didn't frob it */
865#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(X86_MCE_INTEL) 865#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
866 if (maxlvt >= 5) { 866 if (maxlvt >= 5) {
867 v = apic_read(APIC_LVTTHMR); 867 v = apic_read(APIC_LVTTHMR);
868 apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED); 868 apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED);
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 98807bb095ad..266ec6c18b6c 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1192,6 +1192,7 @@ static int suspend(int vetoable)
1192 device_suspend(PMSG_SUSPEND); 1192 device_suspend(PMSG_SUSPEND);
1193 local_irq_disable(); 1193 local_irq_disable();
1194 device_power_down(PMSG_SUSPEND); 1194 device_power_down(PMSG_SUSPEND);
1195 sysdev_suspend(PMSG_SUSPEND);
1195 1196
1196 local_irq_enable(); 1197 local_irq_enable();
1197 1198
@@ -1208,6 +1209,7 @@ static int suspend(int vetoable)
1208 if (err != APM_SUCCESS) 1209 if (err != APM_SUCCESS)
1209 apm_error("suspend", err); 1210 apm_error("suspend", err);
1210 err = (err == APM_SUCCESS) ? 0 : -EIO; 1211 err = (err == APM_SUCCESS) ? 0 : -EIO;
1212 sysdev_resume();
1211 device_power_up(PMSG_RESUME); 1213 device_power_up(PMSG_RESUME);
1212 local_irq_enable(); 1214 local_irq_enable();
1213 device_resume(PMSG_RESUME); 1215 device_resume(PMSG_RESUME);
@@ -1228,6 +1230,7 @@ static void standby(void)
1228 1230
1229 local_irq_disable(); 1231 local_irq_disable();
1230 device_power_down(PMSG_SUSPEND); 1232 device_power_down(PMSG_SUSPEND);
1233 sysdev_suspend(PMSG_SUSPEND);
1231 local_irq_enable(); 1234 local_irq_enable();
1232 1235
1233 err = set_system_power_state(APM_STATE_STANDBY); 1236 err = set_system_power_state(APM_STATE_STANDBY);
@@ -1235,6 +1238,7 @@ static void standby(void)
1235 apm_error("standby", err); 1238 apm_error("standby", err);
1236 1239
1237 local_irq_disable(); 1240 local_irq_disable();
1241 sysdev_resume();
1238 device_power_up(PMSG_RESUME); 1242 device_power_up(PMSG_RESUME);
1239 local_irq_enable(); 1243 local_irq_enable();
1240} 1244}
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index b585e04cbc9e..3178c3acd97e 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -277,7 +277,6 @@ static struct cpufreq_driver p4clockmod_driver = {
277 .name = "p4-clockmod", 277 .name = "p4-clockmod",
278 .owner = THIS_MODULE, 278 .owner = THIS_MODULE,
279 .attr = p4clockmod_attr, 279 .attr = p4clockmod_attr,
280 .hide_interface = 1,
281}; 280};
282 281
283 282
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index fb039cd345d8..6428aa17b40e 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1157,8 +1157,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1157 data->cpu = pol->cpu; 1157 data->cpu = pol->cpu;
1158 data->currpstate = HW_PSTATE_INVALID; 1158 data->currpstate = HW_PSTATE_INVALID;
1159 1159
1160 rc = powernow_k8_cpu_init_acpi(data); 1160 if (powernow_k8_cpu_init_acpi(data)) {
1161 if (rc) {
1162 /* 1161 /*
1163 * Use the PSB BIOS structure. This is only availabe on 1162 * Use the PSB BIOS structure. This is only availabe on
1164 * an UP version, and is deprecated by AMD. 1163 * an UP version, and is deprecated by AMD.
@@ -1176,17 +1175,20 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1176 "ACPI maintainers and complain to your BIOS " 1175 "ACPI maintainers and complain to your BIOS "
1177 "vendor.\n"); 1176 "vendor.\n");
1178#endif 1177#endif
1179 goto err_out; 1178 kfree(data);
1179 return -ENODEV;
1180 } 1180 }
1181 if (pol->cpu != 0) { 1181 if (pol->cpu != 0) {
1182 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " 1182 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
1183 "CPU other than CPU0. Complain to your BIOS " 1183 "CPU other than CPU0. Complain to your BIOS "
1184 "vendor.\n"); 1184 "vendor.\n");
1185 goto err_out; 1185 kfree(data);
1186 return -ENODEV;
1186 } 1187 }
1187 rc = find_psb_table(data); 1188 rc = find_psb_table(data);
1188 if (rc) { 1189 if (rc) {
1189 goto err_out; 1190 kfree(data);
1191 return -ENODEV;
1190 } 1192 }
1191 /* Take a crude guess here. 1193 /* Take a crude guess here.
1192 * That guess was in microseconds, so multiply with 1000 */ 1194 * That guess was in microseconds, so multiply with 1000 */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 1c838032fd37..fe79985ce0f2 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -295,11 +295,11 @@ void do_machine_check(struct pt_regs * regs, long error_code)
295 * If we know that the error was in user space, send a 295 * If we know that the error was in user space, send a
296 * SIGBUS. Otherwise, panic if tolerance is low. 296 * SIGBUS. Otherwise, panic if tolerance is low.
297 * 297 *
298 * do_exit() takes an awful lot of locks and has a slight 298 * force_sig() takes an awful lot of locks and has a slight
299 * risk of deadlocking. 299 * risk of deadlocking.
300 */ 300 */
301 if (user_space) { 301 if (user_space) {
302 do_exit(SIGBUS); 302 force_sig(SIGBUS, current);
303 } else if (panic_on_oops || tolerant < 2) { 303 } else if (panic_on_oops || tolerant < 2) {
304 mce_panic("Uncorrected machine check", 304 mce_panic("Uncorrected machine check",
305 &panicm, mcestart); 305 &panicm, mcestart);
@@ -490,7 +490,7 @@ static void __cpuinit mce_cpu_quirks(struct cpuinfo_x86 *c)
490 490
491} 491}
492 492
493static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c) 493static void mce_cpu_features(struct cpuinfo_x86 *c)
494{ 494{
495 switch (c->x86_vendor) { 495 switch (c->x86_vendor) {
496 case X86_VENDOR_INTEL: 496 case X86_VENDOR_INTEL:
@@ -734,6 +734,7 @@ __setup("mce=", mcheck_enable);
734static int mce_resume(struct sys_device *dev) 734static int mce_resume(struct sys_device *dev)
735{ 735{
736 mce_init(NULL); 736 mce_init(NULL);
737 mce_cpu_features(&current_cpu_data);
737 return 0; 738 return 0;
738} 739}
739 740
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 8ae8c4ff094d..f2ee0ae29bd6 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -121,7 +121,7 @@ static long threshold_restart_bank(void *_tr)
121} 121}
122 122
123/* cpu init entry point, called from mce.c with preempt off */ 123/* cpu init entry point, called from mce.c with preempt off */
124void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c) 124void mce_amd_feature_init(struct cpuinfo_x86 *c)
125{ 125{
126 unsigned int bank, block; 126 unsigned int bank, block;
127 unsigned int cpu = smp_processor_id(); 127 unsigned int cpu = smp_processor_id();
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
index 4b48f251fd39..f44c36624360 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
@@ -30,7 +30,7 @@ asmlinkage void smp_thermal_interrupt(void)
30 irq_exit(); 30 irq_exit();
31} 31}
32 32
33static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) 33static void intel_init_thermal(struct cpuinfo_x86 *c)
34{ 34{
35 u32 l, h; 35 u32 l, h;
36 int tm2 = 0; 36 int tm2 = 0;
@@ -84,7 +84,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
84 return; 84 return;
85} 85}
86 86
87void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c) 87void mce_intel_feature_init(struct cpuinfo_x86 *c)
88{ 88{
89 intel_init_thermal(c); 89 intel_init_thermal(c);
90} 90}
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index 169a120587be..87b67e3a765a 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -729,7 +729,7 @@ struct pebs_tracer *ds_request_pebs(struct task_struct *task,
729 729
730 spin_unlock_irqrestore(&ds_lock, irq); 730 spin_unlock_irqrestore(&ds_lock, irq);
731 731
732 ds_write_config(tracer->ds.context, &tracer->trace.ds, ds_bts); 732 ds_write_config(tracer->ds.context, &tracer->trace.ds, ds_pebs);
733 ds_resume_pebs(tracer); 733 ds_resume_pebs(tracer);
734 734
735 return tracer; 735 return tracer;
@@ -1029,5 +1029,4 @@ void ds_copy_thread(struct task_struct *tsk, struct task_struct *father)
1029 1029
1030void ds_exit_thread(struct task_struct *tsk) 1030void ds_exit_thread(struct task_struct *tsk)
1031{ 1031{
1032 WARN_ON(tsk->thread.ds_ctx);
1033} 1032}
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 1119d247fe11..eb1ef3b67dd5 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -467,7 +467,7 @@ void __init efi_enter_virtual_mode(void)
467 efi_memory_desc_t *md; 467 efi_memory_desc_t *md;
468 efi_status_t status; 468 efi_status_t status;
469 unsigned long size; 469 unsigned long size;
470 u64 end, systab, addr, npages; 470 u64 end, systab, addr, npages, end_pfn;
471 void *p, *va; 471 void *p, *va;
472 472
473 efi.systab = NULL; 473 efi.systab = NULL;
@@ -479,7 +479,10 @@ void __init efi_enter_virtual_mode(void)
479 size = md->num_pages << EFI_PAGE_SHIFT; 479 size = md->num_pages << EFI_PAGE_SHIFT;
480 end = md->phys_addr + size; 480 end = md->phys_addr + size;
481 481
482 if (PFN_UP(end) <= max_low_pfn_mapped) 482 end_pfn = PFN_UP(end);
483 if (end_pfn <= max_low_pfn_mapped
484 || (end_pfn > (1UL << (32 - PAGE_SHIFT))
485 && end_pfn <= max_pfn_mapped))
483 va = __va(md->phys_addr); 486 va = __va(md->phys_addr);
484 else 487 else
485 va = efi_ioremap(md->phys_addr, size); 488 va = efi_ioremap(md->phys_addr, size);
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 652c5287215f..cb783b92c50c 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -99,24 +99,11 @@ void __init efi_call_phys_epilog(void)
99 99
100void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size) 100void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size)
101{ 101{
102 static unsigned pages_mapped __initdata; 102 unsigned long last_map_pfn;
103 unsigned i, pages;
104 unsigned long offset;
105 103
106 pages = PFN_UP(phys_addr + size) - PFN_DOWN(phys_addr); 104 last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size);
107 offset = phys_addr & ~PAGE_MASK; 105 if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size)
108 phys_addr &= PAGE_MASK;
109
110 if (pages_mapped + pages > MAX_EFI_IO_PAGES)
111 return NULL; 106 return NULL;
112 107
113 for (i = 0; i < pages; i++) { 108 return (void __iomem *)__va(phys_addr);
114 __set_fixmap(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped,
115 phys_addr, PAGE_KERNEL);
116 phys_addr += PAGE_SIZE;
117 pages_mapped++;
118 }
119
120 return (void __iomem *)__fix_to_virt(FIX_EFI_IO_MAP_FIRST_PAGE - \
121 (pages_mapped - pages)) + offset;
122} 109}
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 388254f69a2a..a00545fe5cdd 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -269,6 +269,8 @@ static void hpet_set_mode(enum clock_event_mode mode,
269 now = hpet_readl(HPET_COUNTER); 269 now = hpet_readl(HPET_COUNTER);
270 cmp = now + (unsigned long) delta; 270 cmp = now + (unsigned long) delta;
271 cfg = hpet_readl(HPET_Tn_CFG(timer)); 271 cfg = hpet_readl(HPET_Tn_CFG(timer));
272 /* Make sure we use edge triggered interrupts */
273 cfg &= ~HPET_TN_LEVEL;
272 cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC | 274 cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
273 HPET_TN_SETVAL | HPET_TN_32BIT; 275 HPET_TN_SETVAL | HPET_TN_32BIT;
274 hpet_writel(cfg, HPET_Tn_CFG(timer)); 276 hpet_writel(cfg, HPET_Tn_CFG(timer));
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index b0f61f0dcd0a..f2f8540a7f3d 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -136,7 +136,7 @@ int init_fpu(struct task_struct *tsk)
136#ifdef CONFIG_X86_32 136#ifdef CONFIG_X86_32
137 if (!HAVE_HWFP) { 137 if (!HAVE_HWFP) {
138 memset(tsk->thread.xstate, 0, xstate_size); 138 memset(tsk->thread.xstate, 0, xstate_size);
139 finit(); 139 finit_task(tsk);
140 set_stopped_child_used_math(tsk); 140 set_stopped_child_used_math(tsk);
141 return 0; 141 return 0;
142 } 142 }
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
index 7a13fac63a1f..4006c522adc7 100644
--- a/arch/x86/kernel/olpc.c
+++ b/arch/x86/kernel/olpc.c
@@ -203,7 +203,7 @@ static void __init platform_detect(void)
203static void __init platform_detect(void) 203static void __init platform_detect(void)
204{ 204{
205 /* stopgap until OFW support is added to the kernel */ 205 /* stopgap until OFW support is added to the kernel */
206 olpc_platform_info.boardrev = 0xc2; 206 olpc_platform_info.boardrev = olpc_board(0xc2);
207} 207}
208#endif 208#endif
209 209
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index e4c8fb608873..c6520a4e85d4 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -268,6 +268,32 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
268 return __get_cpu_var(paravirt_lazy_mode); 268 return __get_cpu_var(paravirt_lazy_mode);
269} 269}
270 270
271void arch_flush_lazy_mmu_mode(void)
272{
273 preempt_disable();
274
275 if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
276 WARN_ON(preempt_count() == 1);
277 arch_leave_lazy_mmu_mode();
278 arch_enter_lazy_mmu_mode();
279 }
280
281 preempt_enable();
282}
283
284void arch_flush_lazy_cpu_mode(void)
285{
286 preempt_disable();
287
288 if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) {
289 WARN_ON(preempt_count() == 1);
290 arch_leave_lazy_cpu_mode();
291 arch_enter_lazy_cpu_mode();
292 }
293
294 preempt_enable();
295}
296
271struct pv_info pv_info = { 297struct pv_info pv_info = {
272 .name = "bare hardware", 298 .name = "bare hardware",
273 .paravirt_enabled = 0, 299 .paravirt_enabled = 0,
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index a546f55c77b4..bd4da2af08ae 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -104,9 +104,6 @@ void cpu_idle(void)
104 check_pgt_cache(); 104 check_pgt_cache();
105 rmb(); 105 rmb();
106 106
107 if (rcu_pending(cpu))
108 rcu_check_callbacks(cpu, 0);
109
110 if (cpu_is_offline(cpu)) 107 if (cpu_is_offline(cpu))
111 play_dead(); 108 play_dead();
112 109
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 0a5df5f82fb9..06ca07f6ad86 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -810,12 +810,16 @@ static void ptrace_bts_untrace(struct task_struct *child)
810 810
811static void ptrace_bts_detach(struct task_struct *child) 811static void ptrace_bts_detach(struct task_struct *child)
812{ 812{
813 if (unlikely(child->bts)) { 813 /*
814 ds_release_bts(child->bts); 814 * Ptrace_detach() races with ptrace_untrace() in case
815 child->bts = NULL; 815 * the child dies and is reaped by another thread.
816 816 *
817 ptrace_bts_free_buffer(child); 817 * We only do the memory accounting at this point and
818 } 818 * leave the buffer deallocation and the bts tracer
819 * release to ptrace_bts_untrace() which will be called
820 * later on with tasklist_lock held.
821 */
822 release_locked_buffer(child->bts_buffer, child->bts_size);
819} 823}
820#else 824#else
821static inline void ptrace_bts_fork(struct task_struct *tsk) {} 825static inline void ptrace_bts_fork(struct task_struct *tsk) {}
@@ -1384,7 +1388,7 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
1384#ifdef CONFIG_X86_32 1388#ifdef CONFIG_X86_32
1385# define IS_IA32 1 1389# define IS_IA32 1
1386#elif defined CONFIG_IA32_EMULATION 1390#elif defined CONFIG_IA32_EMULATION
1387# define IS_IA32 test_thread_flag(TIF_IA32) 1391# define IS_IA32 is_compat_task()
1388#else 1392#else
1389# define IS_IA32 0 1393# define IS_IA32 0
1390#endif 1394#endif
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 2b46eb41643b..4526b3a75ed2 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -217,6 +217,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
217 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"), 217 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"),
218 }, 218 },
219 }, 219 },
220 { /* Handle problems with rebooting on Dell XPS710 */
221 .callback = set_bios_reboot,
222 .ident = "Dell XPS710",
223 .matches = {
224 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
225 DMI_MATCH(DMI_PRODUCT_NAME, "Dell XPS710"),
226 },
227 },
220 { } 228 { }
221}; 229};
222 230
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c461f6d69074..6a8811a69324 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -770,6 +770,9 @@ void __init setup_arch(char **cmdline_p)
770 770
771 finish_e820_parsing(); 771 finish_e820_parsing();
772 772
773 if (efi_enabled)
774 efi_init();
775
773 dmi_scan_machine(); 776 dmi_scan_machine();
774 777
775 dmi_check_system(bad_bios_dmi_table); 778 dmi_check_system(bad_bios_dmi_table);
@@ -789,8 +792,6 @@ void __init setup_arch(char **cmdline_p)
789 insert_resource(&iomem_resource, &data_resource); 792 insert_resource(&iomem_resource, &data_resource);
790 insert_resource(&iomem_resource, &bss_resource); 793 insert_resource(&iomem_resource, &bss_resource);
791 794
792 if (efi_enabled)
793 efi_init();
794 795
795#ifdef CONFIG_X86_32 796#ifdef CONFIG_X86_32
796 if (ppro_with_ram_bug()) { 797 if (ppro_with_ram_bug()) {
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index e6e695acd725..241ec3923f61 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -115,7 +115,7 @@ unsigned long __init calibrate_cpu(void)
115 115
116static struct irqaction irq0 = { 116static struct irqaction irq0 = {
117 .handler = timer_interrupt, 117 .handler = timer_interrupt,
118 .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING, 118 .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING | IRQF_TIMER,
119 .mask = CPU_MASK_NONE, 119 .mask = CPU_MASK_NONE,
120 .name = "timer" 120 .name = "timer"
121}; 121};
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 7932338d7cb3..a9e7548e1790 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -99,6 +99,12 @@ static inline void preempt_conditional_sti(struct pt_regs *regs)
99 local_irq_enable(); 99 local_irq_enable();
100} 100}
101 101
102static inline void conditional_cli(struct pt_regs *regs)
103{
104 if (regs->flags & X86_EFLAGS_IF)
105 local_irq_disable();
106}
107
102static inline void preempt_conditional_cli(struct pt_regs *regs) 108static inline void preempt_conditional_cli(struct pt_regs *regs)
103{ 109{
104 if (regs->flags & X86_EFLAGS_IF) 110 if (regs->flags & X86_EFLAGS_IF)
@@ -626,8 +632,10 @@ clear_dr7:
626 632
627#ifdef CONFIG_X86_32 633#ifdef CONFIG_X86_32
628debug_vm86: 634debug_vm86:
635 /* reenable preemption: handle_vm86_trap() might sleep */
636 dec_preempt_count();
629 handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1); 637 handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
630 preempt_conditional_cli(regs); 638 conditional_cli(regs);
631 return; 639 return;
632#endif 640#endif
633 641
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
index c4c1f9e09402..e5b088fffa40 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -202,7 +202,7 @@ static irqreturn_t vmi_timer_interrupt(int irq, void *dev_id)
202static struct irqaction vmi_clock_action = { 202static struct irqaction vmi_clock_action = {
203 .name = "vmi-timer", 203 .name = "vmi-timer",
204 .handler = vmi_timer_interrupt, 204 .handler = vmi_timer_interrupt,
205 .flags = IRQF_DISABLED | IRQF_NOBALANCING, 205 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
206 .mask = CPU_MASK_ALL, 206 .mask = CPU_MASK_ALL,
207}; 207};
208 208
@@ -283,10 +283,13 @@ void __devinit vmi_time_ap_init(void)
283#endif 283#endif
284 284
285/** vmi clocksource */ 285/** vmi clocksource */
286static struct clocksource clocksource_vmi;
286 287
287static cycle_t read_real_cycles(void) 288static cycle_t read_real_cycles(void)
288{ 289{
289 return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); 290 cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
291 return ret >= clocksource_vmi.cycle_last ?
292 ret : clocksource_vmi.cycle_last;
290} 293}
291 294
292static struct clocksource clocksource_vmi = { 295static struct clocksource clocksource_vmi = {
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index e665d1c623ca..72bd275a9b5c 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -207,7 +207,7 @@ static int __pit_timer_fn(struct kvm_kpit_state *ps)
207 hrtimer_add_expires_ns(&pt->timer, pt->period); 207 hrtimer_add_expires_ns(&pt->timer, pt->period);
208 pt->scheduled = hrtimer_get_expires_ns(&pt->timer); 208 pt->scheduled = hrtimer_get_expires_ns(&pt->timer);
209 if (pt->period) 209 if (pt->period)
210 ps->channels[0].count_load_time = hrtimer_get_expires(&pt->timer); 210 ps->channels[0].count_load_time = ktime_get();
211 211
212 return (pt->period == 0 ? 0 : 1); 212 return (pt->period == 0 ? 0 : 1);
213} 213}
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index c019b8edcdb7..cf17ed52f6fb 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -87,13 +87,6 @@ void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
87} 87}
88EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs); 88EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);
89 89
90void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec)
91{
92 kvm_apic_timer_intr_post(vcpu, vec);
93 /* TODO: PIT, RTC etc. */
94}
95EXPORT_SYMBOL_GPL(kvm_timer_intr_post);
96
97void __kvm_migrate_timers(struct kvm_vcpu *vcpu) 90void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
98{ 91{
99 __kvm_migrate_apic_timer(vcpu); 92 __kvm_migrate_apic_timer(vcpu);
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 2bf32a03ceec..82579ee538d0 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -89,7 +89,6 @@ static inline int irqchip_in_kernel(struct kvm *kvm)
89 89
90void kvm_pic_reset(struct kvm_kpic_state *s); 90void kvm_pic_reset(struct kvm_kpic_state *s);
91 91
92void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
93void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); 92void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
94void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); 93void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
95void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); 94void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index afac68c0815c..f0b67f2cdd69 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -35,6 +35,12 @@
35#include "kvm_cache_regs.h" 35#include "kvm_cache_regs.h"
36#include "irq.h" 36#include "irq.h"
37 37
38#ifndef CONFIG_X86_64
39#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
40#else
41#define mod_64(x, y) ((x) % (y))
42#endif
43
38#define PRId64 "d" 44#define PRId64 "d"
39#define PRIx64 "llx" 45#define PRIx64 "llx"
40#define PRIu64 "u" 46#define PRIu64 "u"
@@ -511,52 +517,22 @@ static void apic_send_ipi(struct kvm_lapic *apic)
511 517
512static u32 apic_get_tmcct(struct kvm_lapic *apic) 518static u32 apic_get_tmcct(struct kvm_lapic *apic)
513{ 519{
514 u64 counter_passed; 520 ktime_t remaining;
515 ktime_t passed, now; 521 s64 ns;
516 u32 tmcct; 522 u32 tmcct;
517 523
518 ASSERT(apic != NULL); 524 ASSERT(apic != NULL);
519 525
520 now = apic->timer.dev.base->get_time();
521 tmcct = apic_get_reg(apic, APIC_TMICT);
522
523 /* if initial count is 0, current count should also be 0 */ 526 /* if initial count is 0, current count should also be 0 */
524 if (tmcct == 0) 527 if (apic_get_reg(apic, APIC_TMICT) == 0)
525 return 0; 528 return 0;
526 529
527 if (unlikely(ktime_to_ns(now) <= 530 remaining = hrtimer_expires_remaining(&apic->timer.dev);
528 ktime_to_ns(apic->timer.last_update))) { 531 if (ktime_to_ns(remaining) < 0)
529 /* Wrap around */ 532 remaining = ktime_set(0, 0);
530 passed = ktime_add(( { 533
531 (ktime_t) { 534 ns = mod_64(ktime_to_ns(remaining), apic->timer.period);
532 .tv64 = KTIME_MAX - 535 tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
533 (apic->timer.last_update).tv64}; }
534 ), now);
535 apic_debug("time elapsed\n");
536 } else
537 passed = ktime_sub(now, apic->timer.last_update);
538
539 counter_passed = div64_u64(ktime_to_ns(passed),
540 (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
541
542 if (counter_passed > tmcct) {
543 if (unlikely(!apic_lvtt_period(apic))) {
544 /* one-shot timers stick at 0 until reset */
545 tmcct = 0;
546 } else {
547 /*
548 * periodic timers reset to APIC_TMICT when they
549 * hit 0. The while loop simulates this happening N
550 * times. (counter_passed %= tmcct) would also work,
551 * but might be slower or not work on 32-bit??
552 */
553 while (counter_passed > tmcct)
554 counter_passed -= tmcct;
555 tmcct -= counter_passed;
556 }
557 } else {
558 tmcct -= counter_passed;
559 }
560 536
561 return tmcct; 537 return tmcct;
562} 538}
@@ -653,8 +629,6 @@ static void start_apic_timer(struct kvm_lapic *apic)
653{ 629{
654 ktime_t now = apic->timer.dev.base->get_time(); 630 ktime_t now = apic->timer.dev.base->get_time();
655 631
656 apic->timer.last_update = now;
657
658 apic->timer.period = apic_get_reg(apic, APIC_TMICT) * 632 apic->timer.period = apic_get_reg(apic, APIC_TMICT) *
659 APIC_BUS_CYCLE_NS * apic->timer.divide_count; 633 APIC_BUS_CYCLE_NS * apic->timer.divide_count;
660 atomic_set(&apic->timer.pending, 0); 634 atomic_set(&apic->timer.pending, 0);
@@ -1110,16 +1084,6 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
1110 } 1084 }
1111} 1085}
1112 1086
1113void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec)
1114{
1115 struct kvm_lapic *apic = vcpu->arch.apic;
1116
1117 if (apic && apic_lvt_vector(apic, APIC_LVTT) == vec)
1118 apic->timer.last_update = ktime_add_ns(
1119 apic->timer.last_update,
1120 apic->timer.period);
1121}
1122
1123int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) 1087int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
1124{ 1088{
1125 int vector = kvm_apic_has_interrupt(vcpu); 1089 int vector = kvm_apic_has_interrupt(vcpu);
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
index 81858881287e..45ab6ee71209 100644
--- a/arch/x86/kvm/lapic.h
+++ b/arch/x86/kvm/lapic.h
@@ -12,7 +12,6 @@ struct kvm_lapic {
12 atomic_t pending; 12 atomic_t pending;
13 s64 period; /* unit: ns */ 13 s64 period; /* unit: ns */
14 u32 divide_count; 14 u32 divide_count;
15 ktime_t last_update;
16 struct hrtimer dev; 15 struct hrtimer dev;
17 } timer; 16 } timer;
18 struct kvm_vcpu *vcpu; 17 struct kvm_vcpu *vcpu;
@@ -42,7 +41,6 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data);
42void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); 41void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu);
43int kvm_lapic_enabled(struct kvm_vcpu *vcpu); 42int kvm_lapic_enabled(struct kvm_vcpu *vcpu);
44int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); 43int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu);
45void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
46 44
47void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); 45void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr);
48void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); 46void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 83f11c7474a1..2d4477c71473 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1698,8 +1698,13 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1698 if (largepage) 1698 if (largepage)
1699 spte |= PT_PAGE_SIZE_MASK; 1699 spte |= PT_PAGE_SIZE_MASK;
1700 if (mt_mask) { 1700 if (mt_mask) {
1701 mt_mask = get_memory_type(vcpu, gfn) << 1701 if (!kvm_is_mmio_pfn(pfn)) {
1702 kvm_x86_ops->get_mt_mask_shift(); 1702 mt_mask = get_memory_type(vcpu, gfn) <<
1703 kvm_x86_ops->get_mt_mask_shift();
1704 mt_mask |= VMX_EPT_IGMT_BIT;
1705 } else
1706 mt_mask = MTRR_TYPE_UNCACHABLE <<
1707 kvm_x86_ops->get_mt_mask_shift();
1703 spte |= mt_mask; 1708 spte |= mt_mask;
1704 } 1709 }
1705 1710
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1452851ae258..a9e769e4e251 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1600,7 +1600,6 @@ static void svm_intr_assist(struct kvm_vcpu *vcpu)
1600 /* Okay, we can deliver the interrupt: grab it and update PIC state. */ 1600 /* Okay, we can deliver the interrupt: grab it and update PIC state. */
1601 intr_vector = kvm_cpu_get_interrupt(vcpu); 1601 intr_vector = kvm_cpu_get_interrupt(vcpu);
1602 svm_inject_irq(svm, intr_vector); 1602 svm_inject_irq(svm, intr_vector);
1603 kvm_timer_intr_post(vcpu, intr_vector);
1604out: 1603out:
1605 update_cr8_intercept(vcpu); 1604 update_cr8_intercept(vcpu);
1606} 1605}
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 6259d7467648..7611af576829 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -903,6 +903,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
903 data = vmcs_readl(GUEST_SYSENTER_ESP); 903 data = vmcs_readl(GUEST_SYSENTER_ESP);
904 break; 904 break;
905 default: 905 default:
906 vmx_load_host_state(to_vmx(vcpu));
906 msr = find_msr_entry(to_vmx(vcpu), msr_index); 907 msr = find_msr_entry(to_vmx(vcpu), msr_index);
907 if (msr) { 908 if (msr) {
908 data = msr->data; 909 data = msr->data;
@@ -3285,7 +3286,6 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
3285 } 3286 }
3286 if (vcpu->arch.interrupt.pending) { 3287 if (vcpu->arch.interrupt.pending) {
3287 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); 3288 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr);
3288 kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr);
3289 if (kvm_cpu_has_interrupt(vcpu)) 3289 if (kvm_cpu_has_interrupt(vcpu))
3290 enable_irq_window(vcpu); 3290 enable_irq_window(vcpu);
3291 } 3291 }
@@ -3687,8 +3687,7 @@ static int __init vmx_init(void)
3687 if (vm_need_ept()) { 3687 if (vm_need_ept()) {
3688 bypass_guest_pf = 0; 3688 bypass_guest_pf = 0;
3689 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | 3689 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
3690 VMX_EPT_WRITABLE_MASK | 3690 VMX_EPT_WRITABLE_MASK);
3691 VMX_EPT_IGMT_BIT);
3692 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, 3691 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
3693 VMX_EPT_EXECUTABLE_MASK, 3692 VMX_EPT_EXECUTABLE_MASK,
3694 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); 3693 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index cc17546a2406..758b7a155ae9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -967,7 +967,6 @@ int kvm_dev_ioctl_check_extension(long ext)
967 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: 967 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
968 case KVM_CAP_SET_TSS_ADDR: 968 case KVM_CAP_SET_TSS_ADDR:
969 case KVM_CAP_EXT_CPUID: 969 case KVM_CAP_EXT_CPUID:
970 case KVM_CAP_CLOCKSOURCE:
971 case KVM_CAP_PIT: 970 case KVM_CAP_PIT:
972 case KVM_CAP_NOP_IO_DELAY: 971 case KVM_CAP_NOP_IO_DELAY:
973 case KVM_CAP_MP_STATE: 972 case KVM_CAP_MP_STATE:
@@ -992,6 +991,9 @@ int kvm_dev_ioctl_check_extension(long ext)
992 case KVM_CAP_IOMMU: 991 case KVM_CAP_IOMMU:
993 r = iommu_found(); 992 r = iommu_found();
994 break; 993 break;
994 case KVM_CAP_CLOCKSOURCE:
995 r = boot_cpu_has(X86_FEATURE_CONSTANT_TSC);
996 break;
995 default: 997 default:
996 r = 0; 998 r = 0;
997 break; 999 break;
@@ -4127,9 +4129,13 @@ static void kvm_free_vcpus(struct kvm *kvm)
4127 4129
4128} 4130}
4129 4131
4130void kvm_arch_destroy_vm(struct kvm *kvm) 4132void kvm_arch_sync_events(struct kvm *kvm)
4131{ 4133{
4132 kvm_free_all_assigned_devices(kvm); 4134 kvm_free_all_assigned_devices(kvm);
4135}
4136
4137void kvm_arch_destroy_vm(struct kvm *kvm)
4138{
4133 kvm_iommu_unmap_guest(kvm); 4139 kvm_iommu_unmap_guest(kvm);
4134 kvm_free_pit(kvm); 4140 kvm_free_pit(kvm);
4135 kfree(kvm->arch.vpic); 4141 kfree(kvm->arch.vpic);
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 92f1c6f3e19d..960a8d9c049c 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -343,6 +343,11 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx,
343 * flush_tlb_user() for both user and kernel mappings unless 343 * flush_tlb_user() for both user and kernel mappings unless
344 * the Page Global Enable (PGE) feature bit is set. */ 344 * the Page Global Enable (PGE) feature bit is set. */
345 *dx |= 0x00002000; 345 *dx |= 0x00002000;
346 /* We also lie, and say we're family id 5. 6 or greater
347 * leads to a rdmsr in early_init_intel which we can't handle.
348 * Family ID is returned as bits 8-12 in ax. */
349 *ax &= 0xFFFFF0FF;
350 *ax |= 0x00000500;
346 break; 351 break;
347 case 0x80000000: 352 case 0x80000000:
348 /* Futureproof this a little: if they ask how much extended 353 /* Futureproof this a little: if they ask how much extended
@@ -589,19 +594,21 @@ static void __init lguest_init_IRQ(void)
589 /* Some systems map "vectors" to interrupts weirdly. Lguest has 594 /* Some systems map "vectors" to interrupts weirdly. Lguest has
590 * a straightforward 1 to 1 mapping, so force that here. */ 595 * a straightforward 1 to 1 mapping, so force that here. */
591 __get_cpu_var(vector_irq)[vector] = i; 596 __get_cpu_var(vector_irq)[vector] = i;
592 if (vector != SYSCALL_VECTOR) { 597 if (vector != SYSCALL_VECTOR)
593 set_intr_gate(vector, 598 set_intr_gate(vector, interrupt[i]);
594 interrupt[vector-FIRST_EXTERNAL_VECTOR]);
595 set_irq_chip_and_handler_name(i, &lguest_irq_controller,
596 handle_level_irq,
597 "level");
598 }
599 } 599 }
600 /* This call is required to set up for 4k stacks, where we have 600 /* This call is required to set up for 4k stacks, where we have
601 * separate stacks for hard and soft interrupts. */ 601 * separate stacks for hard and soft interrupts. */
602 irq_ctx_init(smp_processor_id()); 602 irq_ctx_init(smp_processor_id());
603} 603}
604 604
605void lguest_setup_irq(unsigned int irq)
606{
607 irq_to_desc_alloc_cpu(irq, 0);
608 set_irq_chip_and_handler_name(irq, &lguest_irq_controller,
609 handle_level_irq, "level");
610}
611
605/* 612/*
606 * Time. 613 * Time.
607 * 614 *
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index a265a7c63190..50b591871128 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -96,7 +96,7 @@ void __init trap_init_hook(void)
96 96
97static struct irqaction irq0 = { 97static struct irqaction irq0 = {
98 .handler = timer_interrupt, 98 .handler = timer_interrupt,
99 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, 99 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
100 .mask = CPU_MASK_NONE, 100 .mask = CPU_MASK_NONE,
101 .name = "timer" 101 .name = "timer"
102}; 102};
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index d914a7996a66..8e5118371f0f 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -56,7 +56,7 @@ void __init trap_init_hook(void)
56 56
57static struct irqaction irq0 = { 57static struct irqaction irq0 = {
58 .handler = timer_interrupt, 58 .handler = timer_interrupt,
59 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, 59 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
60 .mask = CPU_MASK_NONE, 60 .mask = CPU_MASK_NONE,
61 .name = "timer" 61 .name = "timer"
62}; 62};
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 7ffcdeec4631..b9cc84a2a4fc 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -65,7 +65,7 @@ static volatile unsigned long smp_invalidate_needed;
65 65
66/* Bitmask of CPUs present in the system - exported by i386_syms.c, used 66/* Bitmask of CPUs present in the system - exported by i386_syms.c, used
67 * by scheduler but indexed physically */ 67 * by scheduler but indexed physically */
68cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 68static cpumask_t voyager_phys_cpu_present_map = CPU_MASK_NONE;
69 69
70/* The internal functions */ 70/* The internal functions */
71static void send_CPI(__u32 cpuset, __u8 cpi); 71static void send_CPI(__u32 cpuset, __u8 cpi);
@@ -366,19 +366,19 @@ void __init find_smp_config(void)
366 /* set up everything for just this CPU, we can alter 366 /* set up everything for just this CPU, we can alter
367 * this as we start the other CPUs later */ 367 * this as we start the other CPUs later */
368 /* now get the CPU disposition from the extended CMOS */ 368 /* now get the CPU disposition from the extended CMOS */
369 cpus_addr(phys_cpu_present_map)[0] = 369 cpus_addr(voyager_phys_cpu_present_map)[0] =
370 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK); 370 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK);
371 cpus_addr(phys_cpu_present_map)[0] |= 371 cpus_addr(voyager_phys_cpu_present_map)[0] |=
372 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; 372 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
373 cpus_addr(phys_cpu_present_map)[0] |= 373 cpus_addr(voyager_phys_cpu_present_map)[0] |=
374 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 374 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
375 2) << 16; 375 2) << 16;
376 cpus_addr(phys_cpu_present_map)[0] |= 376 cpus_addr(voyager_phys_cpu_present_map)[0] |=
377 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 377 voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
378 3) << 24; 378 3) << 24;
379 init_cpu_possible(&phys_cpu_present_map); 379 init_cpu_possible(&voyager_phys_cpu_present_map);
380 printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", 380 printk("VOYAGER SMP: voyager_phys_cpu_present_map = 0x%lx\n",
381 cpus_addr(phys_cpu_present_map)[0]); 381 cpus_addr(voyager_phys_cpu_present_map)[0]);
382 /* Here we set up the VIC to enable SMP */ 382 /* Here we set up the VIC to enable SMP */
383 /* enable the CPIs by writing the base vector to their register */ 383 /* enable the CPIs by writing the base vector to their register */
384 outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER); 384 outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER);
@@ -628,15 +628,15 @@ void __init smp_boot_cpus(void)
628 /* now that the cat has probed the Voyager System Bus, sanity 628 /* now that the cat has probed the Voyager System Bus, sanity
629 * check the cpu map */ 629 * check the cpu map */
630 if (((voyager_quad_processors | voyager_extended_vic_processors) 630 if (((voyager_quad_processors | voyager_extended_vic_processors)
631 & cpus_addr(phys_cpu_present_map)[0]) != 631 & cpus_addr(voyager_phys_cpu_present_map)[0]) !=
632 cpus_addr(phys_cpu_present_map)[0]) { 632 cpus_addr(voyager_phys_cpu_present_map)[0]) {
633 /* should panic */ 633 /* should panic */
634 printk("\n\n***WARNING*** " 634 printk("\n\n***WARNING*** "
635 "Sanity check of CPU present map FAILED\n"); 635 "Sanity check of CPU present map FAILED\n");
636 } 636 }
637 } else if (voyager_level == 4) 637 } else if (voyager_level == 4)
638 voyager_extended_vic_processors = 638 voyager_extended_vic_processors =
639 cpus_addr(phys_cpu_present_map)[0]; 639 cpus_addr(voyager_phys_cpu_present_map)[0];
640 640
641 /* this sets up the idle task to run on the current cpu */ 641 /* this sets up the idle task to run on the current cpu */
642 voyager_extended_cpus = 1; 642 voyager_extended_cpus = 1;
@@ -670,7 +670,7 @@ void __init smp_boot_cpus(void)
670 /* loop over all the extended VIC CPUs and boot them. The 670 /* loop over all the extended VIC CPUs and boot them. The
671 * Quad CPUs must be bootstrapped by their extended VIC cpu */ 671 * Quad CPUs must be bootstrapped by their extended VIC cpu */
672 for (i = 0; i < nr_cpu_ids; i++) { 672 for (i = 0; i < nr_cpu_ids; i++) {
673 if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map)) 673 if (i == boot_cpu_id || !cpu_isset(i, voyager_phys_cpu_present_map))
674 continue; 674 continue;
675 do_boot_cpu(i); 675 do_boot_cpu(i);
676 /* This udelay seems to be needed for the Quad boots 676 /* This udelay seems to be needed for the Quad boots
diff --git a/arch/x86/math-emu/fpu_aux.c b/arch/x86/math-emu/fpu_aux.c
index 491e737ce547..aa0987088774 100644
--- a/arch/x86/math-emu/fpu_aux.c
+++ b/arch/x86/math-emu/fpu_aux.c
@@ -30,20 +30,29 @@ static void fclex(void)
30} 30}
31 31
32/* Needs to be externally visible */ 32/* Needs to be externally visible */
33void finit(void) 33void finit_task(struct task_struct *tsk)
34{ 34{
35 control_word = 0x037f; 35 struct i387_soft_struct *soft = &tsk->thread.xstate->soft;
36 partial_status = 0; 36 struct address *oaddr, *iaddr;
37 top = 0; /* We don't keep top in the status word internally. */ 37 soft->cwd = 0x037f;
38 fpu_tag_word = 0xffff; 38 soft->swd = 0;
39 soft->ftop = 0; /* We don't keep top in the status word internally. */
40 soft->twd = 0xffff;
39 /* The behaviour is different from that detailed in 41 /* The behaviour is different from that detailed in
40 Section 15.1.6 of the Intel manual */ 42 Section 15.1.6 of the Intel manual */
41 operand_address.offset = 0; 43 oaddr = (struct address *)&soft->foo;
42 operand_address.selector = 0; 44 oaddr->offset = 0;
43 instruction_address.offset = 0; 45 oaddr->selector = 0;
44 instruction_address.selector = 0; 46 iaddr = (struct address *)&soft->fip;
45 instruction_address.opcode = 0; 47 iaddr->offset = 0;
46 no_ip_update = 1; 48 iaddr->selector = 0;
49 iaddr->opcode = 0;
50 soft->no_update = 1;
51}
52
53void finit(void)
54{
55 finit_task(current);
47} 56}
48 57
49/* 58/*
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index e6d36b490250..b1352250096e 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -714,6 +714,8 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
714 pos = start_pfn << PAGE_SHIFT; 714 pos = start_pfn << PAGE_SHIFT;
715 end_pfn = ((pos + (PMD_SIZE - 1)) >> PMD_SHIFT) 715 end_pfn = ((pos + (PMD_SIZE - 1)) >> PMD_SHIFT)
716 << (PMD_SHIFT - PAGE_SHIFT); 716 << (PMD_SHIFT - PAGE_SHIFT);
717 if (end_pfn > (end >> PAGE_SHIFT))
718 end_pfn = end >> PAGE_SHIFT;
717 if (start_pfn < end_pfn) { 719 if (start_pfn < end_pfn) {
718 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); 720 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
719 pos = end_pfn << PAGE_SHIFT; 721 pos = end_pfn << PAGE_SHIFT;
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index ca53224fc56c..04102d42ff42 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -20,6 +20,17 @@
20#include <asm/pat.h> 20#include <asm/pat.h>
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23int is_io_mapping_possible(resource_size_t base, unsigned long size)
24{
25#ifndef CONFIG_X86_PAE
26 /* There is no way to map greater than 1 << 32 address without PAE */
27 if (base + size > 0x100000000ULL)
28 return 0;
29#endif
30 return 1;
31}
32EXPORT_SYMBOL_GPL(is_io_mapping_possible);
33
23/* Map 'pfn' using fixed map 'type' and protections 'prot' 34/* Map 'pfn' using fixed map 'type' and protections 'prot'
24 */ 35 */
25void * 36void *
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index af750ab973b6..f45d5e29a72e 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -134,25 +134,6 @@ int page_is_ram(unsigned long pagenr)
134 return 0; 134 return 0;
135} 135}
136 136
137int pagerange_is_ram(unsigned long start, unsigned long end)
138{
139 int ram_page = 0, not_rampage = 0;
140 unsigned long page_nr;
141
142 for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);
143 ++page_nr) {
144 if (page_is_ram(page_nr))
145 ram_page = 1;
146 else
147 not_rampage = 1;
148
149 if (ram_page == not_rampage)
150 return -1;
151 }
152
153 return ram_page;
154}
155
156/* 137/*
157 * Fix up the linear direct mapping of the kernel to avoid cache attribute 138 * Fix up the linear direct mapping of the kernel to avoid cache attribute
158 * conflicts. 139 * conflicts.
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index 93d82038af4b..6a518dd08a36 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -32,11 +32,14 @@ struct kmmio_fault_page {
32 struct list_head list; 32 struct list_head list;
33 struct kmmio_fault_page *release_next; 33 struct kmmio_fault_page *release_next;
34 unsigned long page; /* location of the fault page */ 34 unsigned long page; /* location of the fault page */
35 bool old_presence; /* page presence prior to arming */
36 bool armed;
35 37
36 /* 38 /*
37 * Number of times this page has been registered as a part 39 * Number of times this page has been registered as a part
38 * of a probe. If zero, page is disarmed and this may be freed. 40 * of a probe. If zero, page is disarmed and this may be freed.
39 * Used only by writers (RCU). 41 * Used only by writers (RCU) and post_kmmio_handler().
42 * Protected by kmmio_lock, when linked into kmmio_page_table.
40 */ 43 */
41 int count; 44 int count;
42}; 45};
@@ -105,57 +108,85 @@ static struct kmmio_fault_page *get_kmmio_fault_page(unsigned long page)
105 return NULL; 108 return NULL;
106} 109}
107 110
108static void set_page_present(unsigned long addr, bool present, 111static void set_pmd_presence(pmd_t *pmd, bool present, bool *old)
109 unsigned int *pglevel) 112{
113 pmdval_t v = pmd_val(*pmd);
114 *old = !!(v & _PAGE_PRESENT);
115 v &= ~_PAGE_PRESENT;
116 if (present)
117 v |= _PAGE_PRESENT;
118 set_pmd(pmd, __pmd(v));
119}
120
121static void set_pte_presence(pte_t *pte, bool present, bool *old)
122{
123 pteval_t v = pte_val(*pte);
124 *old = !!(v & _PAGE_PRESENT);
125 v &= ~_PAGE_PRESENT;
126 if (present)
127 v |= _PAGE_PRESENT;
128 set_pte_atomic(pte, __pte(v));
129}
130
131static int set_page_presence(unsigned long addr, bool present, bool *old)
110{ 132{
111 pteval_t pteval;
112 pmdval_t pmdval;
113 unsigned int level; 133 unsigned int level;
114 pmd_t *pmd;
115 pte_t *pte = lookup_address(addr, &level); 134 pte_t *pte = lookup_address(addr, &level);
116 135
117 if (!pte) { 136 if (!pte) {
118 pr_err("kmmio: no pte for page 0x%08lx\n", addr); 137 pr_err("kmmio: no pte for page 0x%08lx\n", addr);
119 return; 138 return -1;
120 } 139 }
121 140
122 if (pglevel)
123 *pglevel = level;
124
125 switch (level) { 141 switch (level) {
126 case PG_LEVEL_2M: 142 case PG_LEVEL_2M:
127 pmd = (pmd_t *)pte; 143 set_pmd_presence((pmd_t *)pte, present, old);
128 pmdval = pmd_val(*pmd) & ~_PAGE_PRESENT;
129 if (present)
130 pmdval |= _PAGE_PRESENT;
131 set_pmd(pmd, __pmd(pmdval));
132 break; 144 break;
133
134 case PG_LEVEL_4K: 145 case PG_LEVEL_4K:
135 pteval = pte_val(*pte) & ~_PAGE_PRESENT; 146 set_pte_presence(pte, present, old);
136 if (present)
137 pteval |= _PAGE_PRESENT;
138 set_pte_atomic(pte, __pte(pteval));
139 break; 147 break;
140
141 default: 148 default:
142 pr_err("kmmio: unexpected page level 0x%x.\n", level); 149 pr_err("kmmio: unexpected page level 0x%x.\n", level);
143 return; 150 return -1;
144 } 151 }
145 152
146 __flush_tlb_one(addr); 153 __flush_tlb_one(addr);
154 return 0;
147} 155}
148 156
149/** Mark the given page as not present. Access to it will trigger a fault. */ 157/*
150static void arm_kmmio_fault_page(unsigned long page, unsigned int *pglevel) 158 * Mark the given page as not present. Access to it will trigger a fault.
159 *
160 * Struct kmmio_fault_page is protected by RCU and kmmio_lock, but the
161 * protection is ignored here. RCU read lock is assumed held, so the struct
162 * will not disappear unexpectedly. Furthermore, the caller must guarantee,
163 * that double arming the same virtual address (page) cannot occur.
164 *
165 * Double disarming on the other hand is allowed, and may occur when a fault
166 * and mmiotrace shutdown happen simultaneously.
167 */
168static int arm_kmmio_fault_page(struct kmmio_fault_page *f)
151{ 169{
152 set_page_present(page & PAGE_MASK, false, pglevel); 170 int ret;
171 WARN_ONCE(f->armed, KERN_ERR "kmmio page already armed.\n");
172 if (f->armed) {
173 pr_warning("kmmio double-arm: page 0x%08lx, ref %d, old %d\n",
174 f->page, f->count, f->old_presence);
175 }
176 ret = set_page_presence(f->page, false, &f->old_presence);
177 WARN_ONCE(ret < 0, KERN_ERR "kmmio arming 0x%08lx failed.\n", f->page);
178 f->armed = true;
179 return ret;
153} 180}
154 181
155/** Mark the given page as present. */ 182/** Restore the given page to saved presence state. */
156static void disarm_kmmio_fault_page(unsigned long page, unsigned int *pglevel) 183static void disarm_kmmio_fault_page(struct kmmio_fault_page *f)
157{ 184{
158 set_page_present(page & PAGE_MASK, true, pglevel); 185 bool tmp;
186 int ret = set_page_presence(f->page, f->old_presence, &tmp);
187 WARN_ONCE(ret < 0,
188 KERN_ERR "kmmio disarming 0x%08lx failed.\n", f->page);
189 f->armed = false;
159} 190}
160 191
161/* 192/*
@@ -202,28 +233,32 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
202 233
203 ctx = &get_cpu_var(kmmio_ctx); 234 ctx = &get_cpu_var(kmmio_ctx);
204 if (ctx->active) { 235 if (ctx->active) {
205 disarm_kmmio_fault_page(faultpage->page, NULL);
206 if (addr == ctx->addr) { 236 if (addr == ctx->addr) {
207 /* 237 /*
208 * On SMP we sometimes get recursive probe hits on the 238 * A second fault on the same page means some other
209 * same address. Context is already saved, fall out. 239 * condition needs handling by do_page_fault(), the
240 * page really not being present is the most common.
210 */ 241 */
211 pr_debug("kmmio: duplicate probe hit on CPU %d, for " 242 pr_debug("kmmio: secondary hit for 0x%08lx CPU %d.\n",
212 "address 0x%08lx.\n", 243 addr, smp_processor_id());
213 smp_processor_id(), addr); 244
214 ret = 1; 245 if (!faultpage->old_presence)
215 goto no_kmmio_ctx; 246 pr_info("kmmio: unexpected secondary hit for "
216 } 247 "address 0x%08lx on CPU %d.\n", addr,
217 /* 248 smp_processor_id());
218 * Prevent overwriting already in-flight context. 249 } else {
219 * This should not happen, let's hope disarming at least 250 /*
220 * prevents a panic. 251 * Prevent overwriting already in-flight context.
221 */ 252 * This should not happen, let's hope disarming at
222 pr_emerg("kmmio: recursive probe hit on CPU %d, " 253 * least prevents a panic.
254 */
255 pr_emerg("kmmio: recursive probe hit on CPU %d, "
223 "for address 0x%08lx. Ignoring.\n", 256 "for address 0x%08lx. Ignoring.\n",
224 smp_processor_id(), addr); 257 smp_processor_id(), addr);
225 pr_emerg("kmmio: previous hit was at 0x%08lx.\n", 258 pr_emerg("kmmio: previous hit was at 0x%08lx.\n",
226 ctx->addr); 259 ctx->addr);
260 disarm_kmmio_fault_page(faultpage);
261 }
227 goto no_kmmio_ctx; 262 goto no_kmmio_ctx;
228 } 263 }
229 ctx->active++; 264 ctx->active++;
@@ -244,7 +279,7 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
244 regs->flags &= ~X86_EFLAGS_IF; 279 regs->flags &= ~X86_EFLAGS_IF;
245 280
246 /* Now we set present bit in PTE and single step. */ 281 /* Now we set present bit in PTE and single step. */
247 disarm_kmmio_fault_page(ctx->fpage->page, NULL); 282 disarm_kmmio_fault_page(ctx->fpage);
248 283
249 /* 284 /*
250 * If another cpu accesses the same page while we are stepping, 285 * If another cpu accesses the same page while we are stepping,
@@ -275,7 +310,7 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
275 struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx); 310 struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);
276 311
277 if (!ctx->active) { 312 if (!ctx->active) {
278 pr_debug("kmmio: spurious debug trap on CPU %d.\n", 313 pr_warning("kmmio: spurious debug trap on CPU %d.\n",
279 smp_processor_id()); 314 smp_processor_id());
280 goto out; 315 goto out;
281 } 316 }
@@ -283,7 +318,11 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
283 if (ctx->probe && ctx->probe->post_handler) 318 if (ctx->probe && ctx->probe->post_handler)
284 ctx->probe->post_handler(ctx->probe, condition, regs); 319 ctx->probe->post_handler(ctx->probe, condition, regs);
285 320
286 arm_kmmio_fault_page(ctx->fpage->page, NULL); 321 /* Prevent racing against release_kmmio_fault_page(). */
322 spin_lock(&kmmio_lock);
323 if (ctx->fpage->count)
324 arm_kmmio_fault_page(ctx->fpage);
325 spin_unlock(&kmmio_lock);
287 326
288 regs->flags &= ~X86_EFLAGS_TF; 327 regs->flags &= ~X86_EFLAGS_TF;
289 regs->flags |= ctx->saved_flags; 328 regs->flags |= ctx->saved_flags;
@@ -315,20 +354,24 @@ static int add_kmmio_fault_page(unsigned long page)
315 f = get_kmmio_fault_page(page); 354 f = get_kmmio_fault_page(page);
316 if (f) { 355 if (f) {
317 if (!f->count) 356 if (!f->count)
318 arm_kmmio_fault_page(f->page, NULL); 357 arm_kmmio_fault_page(f);
319 f->count++; 358 f->count++;
320 return 0; 359 return 0;
321 } 360 }
322 361
323 f = kmalloc(sizeof(*f), GFP_ATOMIC); 362 f = kzalloc(sizeof(*f), GFP_ATOMIC);
324 if (!f) 363 if (!f)
325 return -1; 364 return -1;
326 365
327 f->count = 1; 366 f->count = 1;
328 f->page = page; 367 f->page = page;
329 list_add_rcu(&f->list, kmmio_page_list(f->page));
330 368
331 arm_kmmio_fault_page(f->page, NULL); 369 if (arm_kmmio_fault_page(f)) {
370 kfree(f);
371 return -1;
372 }
373
374 list_add_rcu(&f->list, kmmio_page_list(f->page));
332 375
333 return 0; 376 return 0;
334} 377}
@@ -347,7 +390,7 @@ static void release_kmmio_fault_page(unsigned long page,
347 f->count--; 390 f->count--;
348 BUG_ON(f->count < 0); 391 BUG_ON(f->count < 0);
349 if (!f->count) { 392 if (!f->count) {
350 disarm_kmmio_fault_page(f->page, NULL); 393 disarm_kmmio_fault_page(f);
351 f->release_next = *release_list; 394 f->release_next = *release_list;
352 *release_list = f; 395 *release_list = f;
353 } 396 }
@@ -408,23 +451,24 @@ static void rcu_free_kmmio_fault_pages(struct rcu_head *head)
408 451
409static void remove_kmmio_fault_pages(struct rcu_head *head) 452static void remove_kmmio_fault_pages(struct rcu_head *head)
410{ 453{
411 struct kmmio_delayed_release *dr = container_of( 454 struct kmmio_delayed_release *dr =
412 head, 455 container_of(head, struct kmmio_delayed_release, rcu);
413 struct kmmio_delayed_release,
414 rcu);
415 struct kmmio_fault_page *p = dr->release_list; 456 struct kmmio_fault_page *p = dr->release_list;
416 struct kmmio_fault_page **prevp = &dr->release_list; 457 struct kmmio_fault_page **prevp = &dr->release_list;
417 unsigned long flags; 458 unsigned long flags;
459
418 spin_lock_irqsave(&kmmio_lock, flags); 460 spin_lock_irqsave(&kmmio_lock, flags);
419 while (p) { 461 while (p) {
420 if (!p->count) 462 if (!p->count) {
421 list_del_rcu(&p->list); 463 list_del_rcu(&p->list);
422 else 464 prevp = &p->release_next;
465 } else {
423 *prevp = p->release_next; 466 *prevp = p->release_next;
424 prevp = &p->release_next; 467 }
425 p = p->release_next; 468 p = p->release_next;
426 } 469 }
427 spin_unlock_irqrestore(&kmmio_lock, flags); 470 spin_unlock_irqrestore(&kmmio_lock, flags);
471
428 /* This is the real RCU destroy call. */ 472 /* This is the real RCU destroy call. */
429 call_rcu(&dr->rcu, rcu_free_kmmio_fault_pages); 473 call_rcu(&dr->rcu, rcu_free_kmmio_fault_pages);
430} 474}
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 71a14f89f89e..f3516da035d1 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -145,7 +145,7 @@ int __init compute_hash_shift(struct bootnode *nodes, int numnodes,
145 return shift; 145 return shift;
146} 146}
147 147
148int early_pfn_to_nid(unsigned long pfn) 148int __meminit __early_pfn_to_nid(unsigned long pfn)
149{ 149{
150 return phys_to_nid(pfn << PAGE_SHIFT); 150 return phys_to_nid(pfn << PAGE_SHIFT);
151} 151}
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 84ba74820ad6..7233bd7e357b 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -508,18 +508,24 @@ static int split_large_page(pte_t *kpte, unsigned long address)
508#endif 508#endif
509 509
510 /* 510 /*
511 * Install the new, split up pagetable. Important details here: 511 * Install the new, split up pagetable.
512 * 512 *
513 * On Intel the NX bit of all levels must be cleared to make a 513 * We use the standard kernel pagetable protections for the new
514 * page executable. See section 4.13.2 of Intel 64 and IA-32 514 * pagetable protections, the actual ptes set above control the
515 * Architectures Software Developer's Manual). 515 * primary protection behavior:
516 */
517 __set_pmd_pte(kpte, address, mk_pte(base, __pgprot(_KERNPG_TABLE)));
518
519 /*
520 * Intel Atom errata AAH41 workaround.
516 * 521 *
517 * Mark the entry present. The current mapping might be 522 * The real fix should be in hw or in a microcode update, but
518 * set to not present, which we preserved above. 523 * we also probabilistically try to reduce the window of having
524 * a large TLB mixed with 4K TLBs while instruction fetches are
525 * going on.
519 */ 526 */
520 ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte))); 527 __flush_tlb_all();
521 pgprot_val(ref_prot) |= _PAGE_PRESENT; 528
522 __set_pmd_pte(kpte, address, mk_pte(base, ref_prot));
523 base = NULL; 529 base = NULL;
524 530
525out_unlock: 531out_unlock:
@@ -575,7 +581,6 @@ static int __change_page_attr(struct cpa_data *cpa, int primary)
575 address = cpa->vaddr[cpa->curpage]; 581 address = cpa->vaddr[cpa->curpage];
576 else 582 else
577 address = *cpa->vaddr; 583 address = *cpa->vaddr;
578
579repeat: 584repeat:
580 kpte = lookup_address(address, &level); 585 kpte = lookup_address(address, &level);
581 if (!kpte) 586 if (!kpte)
@@ -812,6 +817,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
812 817
813 vm_unmap_aliases(); 818 vm_unmap_aliases();
814 819
820 /*
821 * If we're called with lazy mmu updates enabled, the
822 * in-memory pte state may be stale. Flush pending updates to
823 * bring them up to date.
824 */
825 arch_flush_lazy_mmu_mode();
826
815 cpa.vaddr = addr; 827 cpa.vaddr = addr;
816 cpa.numpages = numpages; 828 cpa.numpages = numpages;
817 cpa.mask_set = mask_set; 829 cpa.mask_set = mask_set;
@@ -854,6 +866,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
854 } else 866 } else
855 cpa_flush_all(cache); 867 cpa_flush_all(cache);
856 868
869 /*
870 * If we've been called with lazy mmu updates enabled, then
871 * make sure that everything gets flushed out before we
872 * return.
873 */
874 arch_flush_lazy_mmu_mode();
875
857out: 876out:
858 return ret; 877 return ret;
859} 878}
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 7b61036427df..e0ab173b6974 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -11,6 +11,7 @@
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h>
14#include <linux/gfp.h> 15#include <linux/gfp.h>
15#include <linux/mm.h> 16#include <linux/mm.h>
16#include <linux/fs.h> 17#include <linux/fs.h>
@@ -211,6 +212,33 @@ chk_conflict(struct memtype *new, struct memtype *entry, unsigned long *type)
211static struct memtype *cached_entry; 212static struct memtype *cached_entry;
212static u64 cached_start; 213static u64 cached_start;
213 214
215static int pat_pagerange_is_ram(unsigned long start, unsigned long end)
216{
217 int ram_page = 0, not_rampage = 0;
218 unsigned long page_nr;
219
220 for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);
221 ++page_nr) {
222 /*
223 * For legacy reasons, physical address range in the legacy ISA
224 * region is tracked as non-RAM. This will allow users of
225 * /dev/mem to map portions of legacy ISA region, even when
226 * some of those portions are listed(or not even listed) with
227 * different e820 types(RAM/reserved/..)
228 */
229 if (page_nr >= (ISA_END_ADDRESS >> PAGE_SHIFT) &&
230 page_is_ram(page_nr))
231 ram_page = 1;
232 else
233 not_rampage = 1;
234
235 if (ram_page == not_rampage)
236 return -1;
237 }
238
239 return ram_page;
240}
241
214/* 242/*
215 * For RAM pages, mark the pages as non WB memory type using 243 * For RAM pages, mark the pages as non WB memory type using
216 * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or 244 * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or
@@ -336,20 +364,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
336 if (new_type) 364 if (new_type)
337 *new_type = actual_type; 365 *new_type = actual_type;
338 366
339 /* 367 is_range_ram = pat_pagerange_is_ram(start, end);
340 * For legacy reasons, some parts of the physical address range in the 368 if (is_range_ram == 1)
341 * legacy 1MB region is treated as non-RAM (even when listed as RAM in 369 return reserve_ram_pages_type(start, end, req_type,
342 * the e820 tables). So we will track the memory attributes of this 370 new_type);
343 * legacy 1MB region using the linear memtype_list always. 371 else if (is_range_ram < 0)
344 */ 372 return -EINVAL;
345 if (end >= ISA_END_ADDRESS) {
346 is_range_ram = pagerange_is_ram(start, end);
347 if (is_range_ram == 1)
348 return reserve_ram_pages_type(start, end, req_type,
349 new_type);
350 else if (is_range_ram < 0)
351 return -EINVAL;
352 }
353 373
354 new = kmalloc(sizeof(struct memtype), GFP_KERNEL); 374 new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
355 if (!new) 375 if (!new)
@@ -446,19 +466,11 @@ int free_memtype(u64 start, u64 end)
446 if (is_ISA_range(start, end - 1)) 466 if (is_ISA_range(start, end - 1))
447 return 0; 467 return 0;
448 468
449 /* 469 is_range_ram = pat_pagerange_is_ram(start, end);
450 * For legacy reasons, some parts of the physical address range in the 470 if (is_range_ram == 1)
451 * legacy 1MB region is treated as non-RAM (even when listed as RAM in 471 return free_ram_pages_type(start, end);
452 * the e820 tables). So we will track the memory attributes of this 472 else if (is_range_ram < 0)
453 * legacy 1MB region using the linear memtype_list always. 473 return -EINVAL;
454 */
455 if (end >= ISA_END_ADDRESS) {
456 is_range_ram = pagerange_is_ram(start, end);
457 if (is_range_ram == 1)
458 return free_ram_pages_type(start, end);
459 else if (is_range_ram < 0)
460 return -EINVAL;
461 }
462 474
463 spin_lock(&memtype_lock); 475 spin_lock(&memtype_lock);
464 list_for_each_entry(entry, &memtype_list, nd) { 476 list_for_each_entry(entry, &memtype_list, nd) {
@@ -626,17 +638,13 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
626 unsigned long flags; 638 unsigned long flags;
627 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); 639 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK);
628 640
629 is_ram = pagerange_is_ram(paddr, paddr + size); 641 is_ram = pat_pagerange_is_ram(paddr, paddr + size);
630 642
631 if (is_ram != 0) { 643 /*
632 /* 644 * reserve_pfn_range() doesn't support RAM pages.
633 * For mapping RAM pages, drivers need to call 645 */
634 * set_memory_[uc|wc|wb] directly, for reserve and free, before 646 if (is_ram != 0)
635 * setting up the PTE. 647 return -EINVAL;
636 */
637 WARN_ON_ONCE(1);
638 return 0;
639 }
640 648
641 ret = reserve_memtype(paddr, paddr + size, want_flags, &flags); 649 ret = reserve_memtype(paddr, paddr + size, want_flags, &flags);
642 if (ret) 650 if (ret)
@@ -693,7 +701,7 @@ static void free_pfn_range(u64 paddr, unsigned long size)
693{ 701{
694 int is_ram; 702 int is_ram;
695 703
696 is_ram = pagerange_is_ram(paddr, paddr + size); 704 is_ram = pat_pagerange_is_ram(paddr, paddr + size);
697 if (is_ram == 0) 705 if (is_ram == 0)
698 free_memtype(paddr, paddr + size); 706 free_memtype(paddr, paddr + size);
699} 707}
@@ -861,6 +869,7 @@ pgprot_t pgprot_writecombine(pgprot_t prot)
861 else 869 else
862 return pgprot_noncached(prot); 870 return pgprot_noncached(prot);
863} 871}
872EXPORT_SYMBOL_GPL(pgprot_writecombine);
864 873
865#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) 874#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT)
866 875
diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c
index ab50a8d7402c..427fd1b56df5 100644
--- a/arch/x86/mm/testmmiotrace.c
+++ b/arch/x86/mm/testmmiotrace.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Written by Pekka Paalanen, 2008 <pq@iki.fi> 2 * Written by Pekka Paalanen, 2008-2009 <pq@iki.fi>
3 */ 3 */
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/io.h> 5#include <linux/io.h>
@@ -9,35 +9,74 @@
9 9
10static unsigned long mmio_address; 10static unsigned long mmio_address;
11module_param(mmio_address, ulong, 0); 11module_param(mmio_address, ulong, 0);
12MODULE_PARM_DESC(mmio_address, "Start address of the mapping of 16 kB."); 12MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB "
13 "(or 8 MB if read_far is non-zero).");
14
15static unsigned long read_far = 0x400100;
16module_param(read_far, ulong, 0);
17MODULE_PARM_DESC(read_far, " Offset of a 32-bit read within 8 MB "
18 "(default: 0x400100).");
19
20static unsigned v16(unsigned i)
21{
22 return i * 12 + 7;
23}
24
25static unsigned v32(unsigned i)
26{
27 return i * 212371 + 13;
28}
13 29
14static void do_write_test(void __iomem *p) 30static void do_write_test(void __iomem *p)
15{ 31{
16 unsigned int i; 32 unsigned int i;
33 pr_info(MODULE_NAME ": write test.\n");
17 mmiotrace_printk("Write test.\n"); 34 mmiotrace_printk("Write test.\n");
35
18 for (i = 0; i < 256; i++) 36 for (i = 0; i < 256; i++)
19 iowrite8(i, p + i); 37 iowrite8(i, p + i);
38
20 for (i = 1024; i < (5 * 1024); i += 2) 39 for (i = 1024; i < (5 * 1024); i += 2)
21 iowrite16(i * 12 + 7, p + i); 40 iowrite16(v16(i), p + i);
41
22 for (i = (5 * 1024); i < (16 * 1024); i += 4) 42 for (i = (5 * 1024); i < (16 * 1024); i += 4)
23 iowrite32(i * 212371 + 13, p + i); 43 iowrite32(v32(i), p + i);
24} 44}
25 45
26static void do_read_test(void __iomem *p) 46static void do_read_test(void __iomem *p)
27{ 47{
28 unsigned int i; 48 unsigned int i;
49 unsigned errs[3] = { 0 };
50 pr_info(MODULE_NAME ": read test.\n");
29 mmiotrace_printk("Read test.\n"); 51 mmiotrace_printk("Read test.\n");
52
30 for (i = 0; i < 256; i++) 53 for (i = 0; i < 256; i++)
31 ioread8(p + i); 54 if (ioread8(p + i) != i)
55 ++errs[0];
56
32 for (i = 1024; i < (5 * 1024); i += 2) 57 for (i = 1024; i < (5 * 1024); i += 2)
33 ioread16(p + i); 58 if (ioread16(p + i) != v16(i))
59 ++errs[1];
60
34 for (i = (5 * 1024); i < (16 * 1024); i += 4) 61 for (i = (5 * 1024); i < (16 * 1024); i += 4)
35 ioread32(p + i); 62 if (ioread32(p + i) != v32(i))
63 ++errs[2];
64
65 mmiotrace_printk("Read errors: 8-bit %d, 16-bit %d, 32-bit %d.\n",
66 errs[0], errs[1], errs[2]);
36} 67}
37 68
38static void do_test(void) 69static void do_read_far_test(void __iomem *p)
39{ 70{
40 void __iomem *p = ioremap_nocache(mmio_address, 0x4000); 71 pr_info(MODULE_NAME ": read far test.\n");
72 mmiotrace_printk("Read far test.\n");
73
74 ioread32(p + read_far);
75}
76
77static void do_test(unsigned long size)
78{
79 void __iomem *p = ioremap_nocache(mmio_address, size);
41 if (!p) { 80 if (!p) {
42 pr_err(MODULE_NAME ": could not ioremap, aborting.\n"); 81 pr_err(MODULE_NAME ": could not ioremap, aborting.\n");
43 return; 82 return;
@@ -45,11 +84,15 @@ static void do_test(void)
45 mmiotrace_printk("ioremap returned %p.\n", p); 84 mmiotrace_printk("ioremap returned %p.\n", p);
46 do_write_test(p); 85 do_write_test(p);
47 do_read_test(p); 86 do_read_test(p);
87 if (read_far && read_far < size - 4)
88 do_read_far_test(p);
48 iounmap(p); 89 iounmap(p);
49} 90}
50 91
51static int __init init(void) 92static int __init init(void)
52{ 93{
94 unsigned long size = (read_far) ? (8 << 20) : (16 << 10);
95
53 if (mmio_address == 0) { 96 if (mmio_address == 0) {
54 pr_err(MODULE_NAME ": you have to use the module argument " 97 pr_err(MODULE_NAME ": you have to use the module argument "
55 "mmio_address.\n"); 98 "mmio_address.\n");
@@ -58,10 +101,11 @@ static int __init init(void)
58 return -ENXIO; 101 return -ENXIO;
59 } 102 }
60 103
61 pr_warning(MODULE_NAME ": WARNING: mapping 16 kB @ 0x%08lx " 104 pr_warning(MODULE_NAME ": WARNING: mapping %lu kB @ 0x%08lx in PCI "
62 "in PCI address space, and writing " 105 "address space, and writing 16 kB of rubbish in there.\n",
63 "rubbish in there.\n", mmio_address); 106 size >> 10, mmio_address);
64 do_test(); 107 do_test(size);
108 pr_info(MODULE_NAME ": All done.\n");
65 return 0; 109 return 0;
66} 110}
67 111
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index e9f80c744cf3..10131fbdaada 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -78,8 +78,18 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
78 if (cpu_has_arch_perfmon) { 78 if (cpu_has_arch_perfmon) {
79 union cpuid10_eax eax; 79 union cpuid10_eax eax;
80 eax.full = cpuid_eax(0xa); 80 eax.full = cpuid_eax(0xa);
81 if (counter_width < eax.split.bit_width) 81
82 counter_width = eax.split.bit_width; 82 /*
83 * For Core2 (family 6, model 15), don't reset the
84 * counter width:
85 */
86 if (!(eax.split.version_id == 0 &&
87 current_cpu_data.x86 == 6 &&
88 current_cpu_data.x86_model == 15)) {
89
90 if (counter_width < eax.split.bit_width)
91 counter_width = eax.split.bit_width;
92 }
83 } 93 }
84 94
85 /* clear all counters */ 95 /* clear all counters */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index bea215230b20..b58e96338149 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1672,6 +1672,9 @@ asmlinkage void __init xen_start_kernel(void)
1672 possible map and a non-dummy shared_info. */ 1672 possible map and a non-dummy shared_info. */
1673 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1673 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
1674 1674
1675 local_irq_disable();
1676 early_boot_irqs_off();
1677
1675 xen_raw_console_write("mapping kernel into physical memory\n"); 1678 xen_raw_console_write("mapping kernel into physical memory\n");
1676 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); 1679 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
1677 1680
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 6c873dceb177..981200830432 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -103,9 +103,6 @@ config MATH_EMULATION
103 help 103 help
104 Can we use information of configuration file? 104 Can we use information of configuration file?
105 105
106config HIGHMEM
107 bool "High memory support"
108
109endmenu 106endmenu
110 107
111menu "Platform options" 108menu "Platform options"
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 9606d2bd1dd9..4ec1633c2941 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -44,6 +44,8 @@
44#include <asm/setup.h> 44#include <asm/setup.h>
45#include <asm/param.h> 45#include <asm/param.h>
46 46
47#include <platform/hardware.h>
48
47#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 49#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
48struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16}; 50struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16};
49#endif 51#endif
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index c7a021d9f696..c44f830b6c7a 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <linux/stringify.h> 30#include <linux/stringify.h>
31#include <linux/kallsyms.h> 31#include <linux/kallsyms.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/hardirq.h>
33 34
34#include <asm/ptrace.h> 35#include <asm/ptrace.h>
35#include <asm/timex.h> 36#include <asm/timex.h>
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 33f366be323f..bdd860d93f72 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/hardirq.h>
17#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
19#include <asm/hardirq.h> 20#include <asm/hardirq.h>
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index efed8897bef3..25d46c84eb08 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -140,16 +140,14 @@ static void rs_poll(unsigned long priv)
140} 140}
141 141
142 142
143static void rs_put_char(struct tty_struct *tty, unsigned char ch) 143static int rs_put_char(struct tty_struct *tty, unsigned char ch)
144{ 144{
145 char buf[2]; 145 char buf[2];
146 146
147 if (!tty)
148 return;
149
150 buf[0] = ch; 147 buf[0] = ch;
151 buf[1] = '\0'; /* Is this NULL necessary? */ 148 buf[1] = '\0'; /* Is this NULL necessary? */
152 __simc (SYS_write, 1, (unsigned long) buf, 1, 0, 0); 149 __simc (SYS_write, 1, (unsigned long) buf, 1, 0, 0);
150 return 1;
153} 151}
154 152
155static void rs_flush_chars(struct tty_struct *tty) 153static void rs_flush_chars(struct tty_struct *tty)
diff --git a/block/blk-merge.c b/block/blk-merge.c
index b92f5b0866b0..5a244f05360f 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -38,72 +38,77 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect)
38 } 38 }
39} 39}
40 40
41void blk_recalc_rq_segments(struct request *rq) 41static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
42 struct bio *bio)
42{ 43{
43 int nr_phys_segs;
44 unsigned int phys_size; 44 unsigned int phys_size;
45 struct bio_vec *bv, *bvprv = NULL; 45 struct bio_vec *bv, *bvprv = NULL;
46 int seg_size; 46 int cluster, i, high, highprv = 1;
47 int cluster; 47 unsigned int seg_size, nr_phys_segs;
48 struct req_iterator iter; 48 struct bio *fbio, *bbio;
49 int high, highprv = 1;
50 struct request_queue *q = rq->q;
51 49
52 if (!rq->bio) 50 if (!bio)
53 return; 51 return 0;
54 52
53 fbio = bio;
55 cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); 54 cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
56 seg_size = 0; 55 seg_size = 0;
57 phys_size = nr_phys_segs = 0; 56 phys_size = nr_phys_segs = 0;
58 rq_for_each_segment(bv, rq, iter) { 57 for_each_bio(bio) {
59 /* 58 bio_for_each_segment(bv, bio, i) {
60 * the trick here is making sure that a high page is never 59 /*
61 * considered part of another segment, since that might 60 * the trick here is making sure that a high page is
62 * change with the bounce page. 61 * never considered part of another segment, since that
63 */ 62 * might change with the bounce page.
64 high = page_to_pfn(bv->bv_page) > q->bounce_pfn; 63 */
65 if (high || highprv) 64 high = page_to_pfn(bv->bv_page) > q->bounce_pfn;
66 goto new_segment; 65 if (high || highprv)
67 if (cluster) {
68 if (seg_size + bv->bv_len > q->max_segment_size)
69 goto new_segment;
70 if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv))
71 goto new_segment;
72 if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv))
73 goto new_segment; 66 goto new_segment;
67 if (cluster) {
68 if (seg_size + bv->bv_len > q->max_segment_size)
69 goto new_segment;
70 if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv))
71 goto new_segment;
72 if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv))
73 goto new_segment;
74
75 seg_size += bv->bv_len;
76 bvprv = bv;
77 continue;
78 }
79new_segment:
80 if (nr_phys_segs == 1 && seg_size >
81 fbio->bi_seg_front_size)
82 fbio->bi_seg_front_size = seg_size;
74 83
75 seg_size += bv->bv_len; 84 nr_phys_segs++;
76 bvprv = bv; 85 bvprv = bv;
77 continue; 86 seg_size = bv->bv_len;
87 highprv = high;
78 } 88 }
79new_segment: 89 bbio = bio;
80 if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
81 rq->bio->bi_seg_front_size = seg_size;
82
83 nr_phys_segs++;
84 bvprv = bv;
85 seg_size = bv->bv_len;
86 highprv = high;
87 } 90 }
88 91
89 if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size) 92 if (nr_phys_segs == 1 && seg_size > fbio->bi_seg_front_size)
90 rq->bio->bi_seg_front_size = seg_size; 93 fbio->bi_seg_front_size = seg_size;
91 if (seg_size > rq->biotail->bi_seg_back_size) 94 if (seg_size > bbio->bi_seg_back_size)
92 rq->biotail->bi_seg_back_size = seg_size; 95 bbio->bi_seg_back_size = seg_size;
96
97 return nr_phys_segs;
98}
93 99
94 rq->nr_phys_segments = nr_phys_segs; 100void blk_recalc_rq_segments(struct request *rq)
101{
102 rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio);
95} 103}
96 104
97void blk_recount_segments(struct request_queue *q, struct bio *bio) 105void blk_recount_segments(struct request_queue *q, struct bio *bio)
98{ 106{
99 struct request rq;
100 struct bio *nxt = bio->bi_next; 107 struct bio *nxt = bio->bi_next;
101 rq.q = q; 108
102 rq.bio = rq.biotail = bio;
103 bio->bi_next = NULL; 109 bio->bi_next = NULL;
104 blk_recalc_rq_segments(&rq); 110 bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);
105 bio->bi_next = nxt; 111 bio->bi_next = nxt;
106 bio->bi_phys_segments = rq.nr_phys_segments;
107 bio->bi_flags |= (1 << BIO_SEG_VALID); 112 bio->bi_flags |= (1 << BIO_SEG_VALID);
108} 113}
109EXPORT_SYMBOL(blk_recount_segments); 114EXPORT_SYMBOL(blk_recount_segments);
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index a09535377a94..bbbdc4b8ccf2 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -209,12 +209,19 @@ void blk_abort_queue(struct request_queue *q)
209{ 209{
210 unsigned long flags; 210 unsigned long flags;
211 struct request *rq, *tmp; 211 struct request *rq, *tmp;
212 LIST_HEAD(list);
212 213
213 spin_lock_irqsave(q->queue_lock, flags); 214 spin_lock_irqsave(q->queue_lock, flags);
214 215
215 elv_abort_queue(q); 216 elv_abort_queue(q);
216 217
217 list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list) 218 /*
219 * Splice entries to local list, to avoid deadlocking if entries
220 * get readded to the timeout list by error handling
221 */
222 list_splice_init(&q->timeout_list, &list);
223
224 list_for_each_entry_safe(rq, tmp, &list, timeout_list)
218 blk_abort_request(rq); 225 blk_abort_request(rq);
219 226
220 spin_unlock_irqrestore(q->queue_lock, flags); 227 spin_unlock_irqrestore(q->queue_lock, flags);
diff --git a/block/blktrace.c b/block/blktrace.c
index 39cc3bfe56e4..7cf9d1ff45a0 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -142,7 +142,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
142 142
143 what |= ddir_act[rw & WRITE]; 143 what |= ddir_act[rw & WRITE];
144 what |= MASK_TC_BIT(rw, BARRIER); 144 what |= MASK_TC_BIT(rw, BARRIER);
145 what |= MASK_TC_BIT(rw, SYNC); 145 what |= MASK_TC_BIT(rw, SYNCIO);
146 what |= MASK_TC_BIT(rw, AHEAD); 146 what |= MASK_TC_BIT(rw, AHEAD);
147 what |= MASK_TC_BIT(rw, META); 147 what |= MASK_TC_BIT(rw, META);
148 what |= MASK_TC_BIT(rw, DISCARD); 148 what |= MASK_TC_BIT(rw, DISCARD);
diff --git a/block/bsg.c b/block/bsg.c
index d414bb5607e8..0ce8806dd0c1 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -244,7 +244,8 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
244 * map sg_io_v4 to a request. 244 * map sg_io_v4 to a request.
245 */ 245 */
246static struct request * 246static struct request *
247bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) 247bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
248 u8 *sense)
248{ 249{
249 struct request_queue *q = bd->queue; 250 struct request_queue *q = bd->queue;
250 struct request *rq, *next_rq = NULL; 251 struct request *rq, *next_rq = NULL;
@@ -306,6 +307,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
306 if (ret) 307 if (ret)
307 goto out; 308 goto out;
308 } 309 }
310
311 rq->sense = sense;
312 rq->sense_len = 0;
313
309 return rq; 314 return rq;
310out: 315out:
311 if (rq->cmd != rq->__cmd) 316 if (rq->cmd != rq->__cmd)
@@ -348,9 +353,6 @@ static void bsg_rq_end_io(struct request *rq, int uptodate)
348static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, 353static void bsg_add_command(struct bsg_device *bd, struct request_queue *q,
349 struct bsg_command *bc, struct request *rq) 354 struct bsg_command *bc, struct request *rq)
350{ 355{
351 rq->sense = bc->sense;
352 rq->sense_len = 0;
353
354 /* 356 /*
355 * add bc command to busy queue and submit rq for io 357 * add bc command to busy queue and submit rq for io
356 */ 358 */
@@ -419,7 +421,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
419{ 421{
420 int ret = 0; 422 int ret = 0;
421 423
422 dprintk("rq %p bio %p %u\n", rq, bio, rq->errors); 424 dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors);
423 /* 425 /*
424 * fill in all the output members 426 * fill in all the output members
425 */ 427 */
@@ -635,7 +637,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf,
635 /* 637 /*
636 * get a request, fill in the blanks, and add to request queue 638 * get a request, fill in the blanks, and add to request queue
637 */ 639 */
638 rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm); 640 rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense);
639 if (IS_ERR(rq)) { 641 if (IS_ERR(rq)) {
640 ret = PTR_ERR(rq); 642 ret = PTR_ERR(rq);
641 rq = NULL; 643 rq = NULL;
@@ -922,11 +924,12 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
922 struct request *rq; 924 struct request *rq;
923 struct bio *bio, *bidi_bio = NULL; 925 struct bio *bio, *bidi_bio = NULL;
924 struct sg_io_v4 hdr; 926 struct sg_io_v4 hdr;
927 u8 sense[SCSI_SENSE_BUFFERSIZE];
925 928
926 if (copy_from_user(&hdr, uarg, sizeof(hdr))) 929 if (copy_from_user(&hdr, uarg, sizeof(hdr)))
927 return -EFAULT; 930 return -EFAULT;
928 931
929 rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE); 932 rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense);
930 if (IS_ERR(rq)) 933 if (IS_ERR(rq))
931 return PTR_ERR(rq); 934 return PTR_ERR(rq);
932 935
diff --git a/block/genhd.c b/block/genhd.c
index 397960cf26af..a9ec910974c1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -256,6 +256,22 @@ void blkdev_show(struct seq_file *seqf, off_t offset)
256} 256}
257#endif /* CONFIG_PROC_FS */ 257#endif /* CONFIG_PROC_FS */
258 258
259/**
260 * register_blkdev - register a new block device
261 *
262 * @major: the requested major device number [1..255]. If @major=0, try to
263 * allocate any unused major number.
264 * @name: the name of the new block device as a zero terminated string
265 *
266 * The @name must be unique within the system.
267 *
268 * The return value depends on the @major input parameter.
269 * - if a major device number was requested in range [1..255] then the
270 * function returns zero on success, or a negative error code
271 * - if any unused major number was requested with @major=0 parameter
272 * then the return value is the allocated major number in range
273 * [1..255] or a negative error code otherwise
274 */
259int register_blkdev(unsigned int major, const char *name) 275int register_blkdev(unsigned int major, const char *name)
260{ 276{
261 struct blk_major_name **n, *p; 277 struct blk_major_name **n, *p;
@@ -1087,6 +1103,14 @@ dev_t blk_lookup_devt(const char *name, int partno)
1087 if (strcmp(dev_name(dev), name)) 1103 if (strcmp(dev_name(dev), name))
1088 continue; 1104 continue;
1089 1105
1106 if (partno < disk->minors) {
1107 /* We need to return the right devno, even
1108 * if the partition doesn't exist yet.
1109 */
1110 devt = MKDEV(MAJOR(dev->devt),
1111 MINOR(dev->devt) + partno);
1112 break;
1113 }
1090 part = disk_get_part(disk, partno); 1114 part = disk_get_part(disk, partno);
1091 if (part) { 1115 if (part) {
1092 devt = part_devt(part); 1116 devt = part_devt(part);
diff --git a/crypto/ahash.c b/crypto/ahash.c
index ba5292d69ebd..b2d1ee32cfe8 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -214,7 +214,7 @@ static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
214 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? 214 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ?
215 "yes" : "no"); 215 "yes" : "no");
216 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); 216 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
217 seq_printf(m, "digestsize : %u\n", alg->cra_hash.digestsize); 217 seq_printf(m, "digestsize : %u\n", alg->cra_ahash.digestsize);
218} 218}
219 219
220const struct crypto_type crypto_ahash_type = { 220const struct crypto_type crypto_ahash_type = {
diff --git a/crypto/api.c b/crypto/api.c
index efe77df6863f..38a2bc02a98c 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -215,8 +215,19 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
215 mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD); 215 mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD);
216 type &= mask; 216 type &= mask;
217 217
218 alg = try_then_request_module(crypto_alg_lookup(name, type, mask), 218 alg = crypto_alg_lookup(name, type, mask);
219 name); 219 if (!alg) {
220 char tmp[CRYPTO_MAX_ALG_NAME];
221
222 request_module(name);
223
224 if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask) &&
225 snprintf(tmp, sizeof(tmp), "%s-all", name) < sizeof(tmp))
226 request_module(tmp);
227
228 alg = crypto_alg_lookup(name, type, mask);
229 }
230
220 if (alg) 231 if (alg)
221 return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg; 232 return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg;
222 233
diff --git a/crypto/lrw.c b/crypto/lrw.c
index 8ef664e3bcd9..358f80be2bf9 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -45,7 +45,13 @@ struct priv {
45 45
46static inline void setbit128_bbe(void *b, int bit) 46static inline void setbit128_bbe(void *b, int bit)
47{ 47{
48 __set_bit(bit ^ 0x78, b); 48 __set_bit(bit ^ (0x80 -
49#ifdef __BIG_ENDIAN
50 BITS_PER_LONG
51#else
52 BITS_PER_BYTE
53#endif
54 ), b);
49} 55}
50 56
51static int setkey(struct crypto_tfm *parent, const u8 *key, 57static int setkey(struct crypto_tfm *parent, const u8 *key,
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index a7799a99f2d9..8a851d0f4384 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -254,13 +254,6 @@ config ACPI_PCI_SLOT
254 help you correlate PCI bus addresses with the physical geography 254 help you correlate PCI bus addresses with the physical geography
255 of your slots. If you are unsure, say N. 255 of your slots. If you are unsure, say N.
256 256
257config ACPI_SYSTEM
258 bool
259 default y
260 help
261 This driver will enable your system to shut down using ACPI, and
262 dump your ACPI DSDT table using /proc/acpi/dsdt.
263
264config X86_PM_TIMER 257config X86_PM_TIMER
265 bool "Power Management Timer Support" if EMBEDDED 258 bool "Power Management Timer Support" if EMBEDDED
266 depends on X86 259 depends on X86
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 65d90c720b5a..b130ea0d0759 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -52,7 +52,7 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
52obj-$(CONFIG_ACPI_CONTAINER) += container.o 52obj-$(CONFIG_ACPI_CONTAINER) += container.o
53obj-$(CONFIG_ACPI_THERMAL) += thermal.o 53obj-$(CONFIG_ACPI_THERMAL) += thermal.o
54obj-y += power.o 54obj-y += power.o
55obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o 55obj-y += system.o event.o
56obj-$(CONFIG_ACPI_DEBUG) += debug.o 56obj-$(CONFIG_ACPI_DEBUG) += debug.o
57obj-$(CONFIG_ACPI_NUMA) += numa.o 57obj-$(CONFIG_ACPI_NUMA) += numa.o
58obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 58obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 65132f920459..69cbc57c2d1c 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -138,6 +138,29 @@ static int acpi_battery_technology(struct acpi_battery *battery)
138 138
139static int acpi_battery_get_state(struct acpi_battery *battery); 139static int acpi_battery_get_state(struct acpi_battery *battery);
140 140
141static int acpi_battery_is_charged(struct acpi_battery *battery)
142{
143 /* either charging or discharging */
144 if (battery->state != 0)
145 return 0;
146
147 /* battery not reporting charge */
148 if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN ||
149 battery->capacity_now == 0)
150 return 0;
151
152 /* good batteries update full_charge as the batteries degrade */
153 if (battery->full_charge_capacity == battery->capacity_now)
154 return 1;
155
156 /* fallback to using design values for broken batteries */
157 if (battery->design_capacity == battery->capacity_now)
158 return 1;
159
160 /* we don't do any sort of metric based on percentages */
161 return 0;
162}
163
141static int acpi_battery_get_property(struct power_supply *psy, 164static int acpi_battery_get_property(struct power_supply *psy,
142 enum power_supply_property psp, 165 enum power_supply_property psp,
143 union power_supply_propval *val) 166 union power_supply_propval *val)
@@ -155,7 +178,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
155 val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 178 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
156 else if (battery->state & 0x02) 179 else if (battery->state & 0x02)
157 val->intval = POWER_SUPPLY_STATUS_CHARGING; 180 val->intval = POWER_SUPPLY_STATUS_CHARGING;
158 else if (battery->state == 0) 181 else if (acpi_battery_is_charged(battery))
159 val->intval = POWER_SUPPLY_STATUS_FULL; 182 val->intval = POWER_SUPPLY_STATUS_FULL;
160 else 183 else
161 val->intval = POWER_SUPPLY_STATUS_UNKNOWN; 184 val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 5c2f5d343be6..2fe15060dcdc 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -120,6 +120,8 @@ 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
123static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */
124
123/* -------------------------------------------------------------------------- 125/* --------------------------------------------------------------------------
124 Transaction Management 126 Transaction Management
125 -------------------------------------------------------------------------- */ 127 -------------------------------------------------------------------------- */
@@ -259,6 +261,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
259 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); 261 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
260 acpi_disable_gpe(NULL, ec->gpe); 262 acpi_disable_gpe(NULL, ec->gpe);
261 } 263 }
264 if (EC_FLAGS_MSI)
265 udelay(ACPI_EC_DELAY);
262 /* start transaction */ 266 /* start transaction */
263 spin_lock_irqsave(&ec->curr_lock, tmp); 267 spin_lock_irqsave(&ec->curr_lock, tmp);
264 /* following two actions should be kept atomic */ 268 /* following two actions should be kept atomic */
@@ -967,6 +971,11 @@ int __init acpi_ec_ecdt_probe(void)
967 /* 971 /*
968 * Generate a boot ec context 972 * Generate a boot ec context
969 */ 973 */
974 if (dmi_name_in_vendors("Micro-Star") ||
975 dmi_name_in_vendors("Notebook")) {
976 pr_info(PREFIX "Enabling special treatment for EC from MSI.\n");
977 EC_FLAGS_MSI = 1;
978 }
970 status = acpi_get_table(ACPI_SIG_ECDT, 1, 979 status = acpi_get_table(ACPI_SIG_ECDT, 1,
971 (struct acpi_table_header **)&ecdt_ptr); 980 (struct acpi_table_header **)&ecdt_ptr);
972 if (ACPI_SUCCESS(status)) { 981 if (ACPI_SUCCESS(status)) {
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index a603bbf9b1b7..66e012cd3271 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -582,18 +582,18 @@ static const struct pci_device_id ahci_pci_tbl[] = {
582 { PCI_VDEVICE(NVIDIA, 0x0abd), board_ahci }, /* MCP79 */ 582 { PCI_VDEVICE(NVIDIA, 0x0abd), board_ahci }, /* MCP79 */
583 { PCI_VDEVICE(NVIDIA, 0x0abe), board_ahci }, /* MCP79 */ 583 { PCI_VDEVICE(NVIDIA, 0x0abe), board_ahci }, /* MCP79 */
584 { PCI_VDEVICE(NVIDIA, 0x0abf), board_ahci }, /* MCP79 */ 584 { PCI_VDEVICE(NVIDIA, 0x0abf), board_ahci }, /* MCP79 */
585 { PCI_VDEVICE(NVIDIA, 0x0bc8), board_ahci }, /* MCP7B */ 585 { PCI_VDEVICE(NVIDIA, 0x0d84), board_ahci }, /* MCP89 */
586 { PCI_VDEVICE(NVIDIA, 0x0bc9), board_ahci }, /* MCP7B */ 586 { PCI_VDEVICE(NVIDIA, 0x0d85), board_ahci }, /* MCP89 */
587 { PCI_VDEVICE(NVIDIA, 0x0bca), board_ahci }, /* MCP7B */ 587 { PCI_VDEVICE(NVIDIA, 0x0d86), board_ahci }, /* MCP89 */
588 { PCI_VDEVICE(NVIDIA, 0x0bcb), board_ahci }, /* MCP7B */ 588 { PCI_VDEVICE(NVIDIA, 0x0d87), board_ahci }, /* MCP89 */
589 { PCI_VDEVICE(NVIDIA, 0x0bcc), board_ahci }, /* MCP7B */ 589 { PCI_VDEVICE(NVIDIA, 0x0d88), board_ahci }, /* MCP89 */
590 { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ 590 { PCI_VDEVICE(NVIDIA, 0x0d89), board_ahci }, /* MCP89 */
591 { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ 591 { PCI_VDEVICE(NVIDIA, 0x0d8a), board_ahci }, /* MCP89 */
592 { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ 592 { PCI_VDEVICE(NVIDIA, 0x0d8b), board_ahci }, /* MCP89 */
593 { PCI_VDEVICE(NVIDIA, 0x0bc4), board_ahci }, /* MCP7B */ 593 { PCI_VDEVICE(NVIDIA, 0x0d8c), board_ahci }, /* MCP89 */
594 { PCI_VDEVICE(NVIDIA, 0x0bc5), board_ahci }, /* MCP7B */ 594 { PCI_VDEVICE(NVIDIA, 0x0d8d), board_ahci }, /* MCP89 */
595 { PCI_VDEVICE(NVIDIA, 0x0bc6), board_ahci }, /* MCP7B */ 595 { PCI_VDEVICE(NVIDIA, 0x0d8e), board_ahci }, /* MCP89 */
596 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ 596 { PCI_VDEVICE(NVIDIA, 0x0d8f), board_ahci }, /* MCP89 */
597 597
598 /* SiS */ 598 /* SiS */
599 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ 599 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 54961c0b2c73..ef8b30d577bd 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1289,6 +1289,39 @@ static const int *__devinit piix_init_sata_map(struct pci_dev *pdev,
1289 return map; 1289 return map;
1290} 1290}
1291 1291
1292static bool piix_no_sidpr(struct ata_host *host)
1293{
1294 struct pci_dev *pdev = to_pci_dev(host->dev);
1295
1296 /*
1297 * Samsung DB-P70 only has three ATA ports exposed and
1298 * curiously the unconnected first port reports link online
1299 * while not responding to SRST protocol causing excessive
1300 * detection delay.
1301 *
1302 * Unfortunately, the system doesn't carry enough DMI
1303 * information to identify the machine but does have subsystem
1304 * vendor and device set. As it's unclear whether the
1305 * subsystem vendor/device is used only for this specific
1306 * board, the port can't be disabled solely with the
1307 * information; however, turning off SIDPR access works around
1308 * the problem. Turn it off.
1309 *
1310 * This problem is reported in bnc#441240.
1311 *
1312 * https://bugzilla.novell.com/show_bug.cgi?id=441420
1313 */
1314 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2920 &&
1315 pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG &&
1316 pdev->subsystem_device == 0xb049) {
1317 dev_printk(KERN_WARNING, host->dev,
1318 "Samsung DB-P70 detected, disabling SIDPR\n");
1319 return true;
1320 }
1321
1322 return false;
1323}
1324
1292static int __devinit piix_init_sidpr(struct ata_host *host) 1325static int __devinit piix_init_sidpr(struct ata_host *host)
1293{ 1326{
1294 struct pci_dev *pdev = to_pci_dev(host->dev); 1327 struct pci_dev *pdev = to_pci_dev(host->dev);
@@ -1302,6 +1335,10 @@ static int __devinit piix_init_sidpr(struct ata_host *host)
1302 if (hpriv->map[i] == IDE) 1335 if (hpriv->map[i] == IDE)
1303 return 0; 1336 return 0;
1304 1337
1338 /* is it blacklisted? */
1339 if (piix_no_sidpr(host))
1340 return 0;
1341
1305 if (!(host->ports[0]->flags & PIIX_FLAG_SIDPR)) 1342 if (!(host->ports[0]->flags & PIIX_FLAG_SIDPR))
1306 return 0; 1343 return 0;
1307 1344
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9fbf0595f3d4..060bcd601f57 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1322,14 +1322,16 @@ static u64 ata_id_n_sectors(const u16 *id)
1322{ 1322{
1323 if (ata_id_has_lba(id)) { 1323 if (ata_id_has_lba(id)) {
1324 if (ata_id_has_lba48(id)) 1324 if (ata_id_has_lba48(id))
1325 return ata_id_u64(id, 100); 1325 return ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
1326 else 1326 else
1327 return ata_id_u32(id, 60); 1327 return ata_id_u32(id, ATA_ID_LBA_CAPACITY);
1328 } else { 1328 } else {
1329 if (ata_id_current_chs_valid(id)) 1329 if (ata_id_current_chs_valid(id))
1330 return ata_id_u32(id, 57); 1330 return id[ATA_ID_CUR_CYLS] * id[ATA_ID_CUR_HEADS] *
1331 id[ATA_ID_CUR_SECTORS];
1331 else 1332 else
1332 return id[1] * id[3] * id[6]; 1333 return id[ATA_ID_CYLS] * id[ATA_ID_HEADS] *
1334 id[ATA_ID_SECTORS];
1333 } 1335 }
1334} 1336}
1335 1337
@@ -4612,7 +4614,7 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
4612 VPRINTK("unmapping %u sg elements\n", qc->n_elem); 4614 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
4613 4615
4614 if (qc->n_elem) 4616 if (qc->n_elem)
4615 dma_unmap_sg(ap->dev, sg, qc->n_elem, dir); 4617 dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir);
4616 4618
4617 qc->flags &= ~ATA_QCFLAG_DMAMAP; 4619 qc->flags &= ~ATA_QCFLAG_DMAMAP;
4618 qc->sg = NULL; 4620 qc->sg = NULL;
@@ -4727,7 +4729,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
4727 return -1; 4729 return -1;
4728 4730
4729 DPRINTK("%d sg elements mapped\n", n_elem); 4731 DPRINTK("%d sg elements mapped\n", n_elem);
4730 4732 qc->orig_n_elem = qc->n_elem;
4731 qc->n_elem = n_elem; 4733 qc->n_elem = n_elem;
4732 qc->flags |= ATA_QCFLAG_DMAMAP; 4734 qc->flags |= ATA_QCFLAG_DMAMAP;
4733 4735
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index ce2ef0475339..ea890911d4fa 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2423,11 +2423,14 @@ int ata_eh_reset(struct ata_link *link, int classify,
2423 } 2423 }
2424 2424
2425 /* prereset() might have cleared ATA_EH_RESET. If so, 2425 /* prereset() might have cleared ATA_EH_RESET. If so,
2426 * bang classes and return. 2426 * bang classes, thaw and return.
2427 */ 2427 */
2428 if (reset && !(ehc->i.action & ATA_EH_RESET)) { 2428 if (reset && !(ehc->i.action & ATA_EH_RESET)) {
2429 ata_for_each_dev(dev, link, ALL) 2429 ata_for_each_dev(dev, link, ALL)
2430 classes[dev->devno] = ATA_DEV_NONE; 2430 classes[dev->devno] = ATA_DEV_NONE;
2431 if ((ap->pflags & ATA_PFLAG_FROZEN) &&
2432 ata_is_host_link(link))
2433 ata_eh_thaw_port(ap);
2431 rc = 0; 2434 rc = 0;
2432 goto out; 2435 goto out;
2433 } 2436 }
@@ -2901,7 +2904,7 @@ static int atapi_eh_clear_ua(struct ata_device *dev)
2901 int i; 2904 int i;
2902 2905
2903 for (i = 0; i < ATA_EH_UA_TRIES; i++) { 2906 for (i = 0; i < ATA_EH_UA_TRIES; i++) {
2904 u8 sense_buffer[SCSI_SENSE_BUFFERSIZE]; 2907 u8 *sense_buffer = dev->link->ap->sector_buf;
2905 u8 sense_key = 0; 2908 u8 sense_key = 0;
2906 unsigned int err_mask; 2909 unsigned int err_mask;
2907 2910
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 0b299b0f8172..f93dc029dfde 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -773,18 +773,32 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
773 else 773 else
774 iowrite32_rep(data_addr, buf, words); 774 iowrite32_rep(data_addr, buf, words);
775 775
776 /* Transfer trailing bytes, if any */
776 if (unlikely(slop)) { 777 if (unlikely(slop)) {
777 __le32 pad; 778 unsigned char pad[4];
779
780 /* Point buf to the tail of buffer */
781 buf += buflen - slop;
782
783 /*
784 * Use io*_rep() accessors here as well to avoid pointlessly
785 * swapping bytes to and fro on the big endian machines...
786 */
778 if (rw == READ) { 787 if (rw == READ) {
779 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); 788 if (slop < 3)
780 memcpy(buf + buflen - slop, &pad, slop); 789 ioread16_rep(data_addr, pad, 1);
790 else
791 ioread32_rep(data_addr, pad, 1);
792 memcpy(buf, pad, slop);
781 } else { 793 } else {
782 memcpy(&pad, buf + buflen - slop, slop); 794 memcpy(pad, buf, slop);
783 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); 795 if (slop < 3)
796 iowrite16_rep(data_addr, pad, 1);
797 else
798 iowrite32_rep(data_addr, pad, 1);
784 } 799 }
785 words++;
786 } 800 }
787 return words << 2; 801 return (buflen + 1) & ~1;
788} 802}
789EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); 803EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
790 804
@@ -2052,6 +2066,7 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
2052 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); 2066 iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr);
2053 udelay(20); /* FIXME: flush */ 2067 udelay(20); /* FIXME: flush */
2054 iowrite8(ap->ctl, ioaddr->ctl_addr); 2068 iowrite8(ap->ctl, ioaddr->ctl_addr);
2069 ap->last_ctl = ap->ctl;
2055 2070
2056 /* wait the port to become ready */ 2071 /* wait the port to become ready */
2057 return ata_sff_wait_after_reset(&ap->link, devmask, deadline); 2072 return ata_sff_wait_after_reset(&ap->link, devmask, deadline);
@@ -2176,8 +2191,10 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
2176 } 2191 }
2177 2192
2178 /* set up device control */ 2193 /* set up device control */
2179 if (ap->ioaddr.ctl_addr) 2194 if (ap->ioaddr.ctl_addr) {
2180 iowrite8(ap->ctl, ap->ioaddr.ctl_addr); 2195 iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
2196 ap->last_ctl = ap->ctl;
2197 }
2181} 2198}
2182EXPORT_SYMBOL_GPL(ata_sff_postreset); 2199EXPORT_SYMBOL_GPL(ata_sff_postreset);
2183 2200
@@ -2520,6 +2537,7 @@ void ata_bus_reset(struct ata_port *ap)
2520 if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) { 2537 if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) {
2521 /* set up device control for ATA_FLAG_SATA_RESET */ 2538 /* set up device control for ATA_FLAG_SATA_RESET */
2522 iowrite8(ap->ctl, ioaddr->ctl_addr); 2539 iowrite8(ap->ctl, ioaddr->ctl_addr);
2540 ap->last_ctl = ap->ctl;
2523 } 2541 }
2524 2542
2525 DPRINTK("EXIT\n"); 2543 DPRINTK("EXIT\n");
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 63719ab9ea44..115b1cd6dcf5 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -24,7 +24,7 @@
24#include <linux/libata.h> 24#include <linux/libata.h>
25 25
26#define DRV_NAME "pata_amd" 26#define DRV_NAME "pata_amd"
27#define DRV_VERSION "0.3.11" 27#define DRV_VERSION "0.4.1"
28 28
29/** 29/**
30 * timing_setup - shared timing computation and load 30 * timing_setup - shared timing computation and load
@@ -145,6 +145,13 @@ static int amd_pre_reset(struct ata_link *link, unsigned long deadline)
145 return ata_sff_prereset(link, deadline); 145 return ata_sff_prereset(link, deadline);
146} 146}
147 147
148/**
149 * amd_cable_detect - report cable type
150 * @ap: port
151 *
152 * AMD controller/BIOS setups record the cable type in word 0x42
153 */
154
148static int amd_cable_detect(struct ata_port *ap) 155static int amd_cable_detect(struct ata_port *ap)
149{ 156{
150 static const u32 bitmask[2] = {0x03, 0x0C}; 157 static const u32 bitmask[2] = {0x03, 0x0C};
@@ -158,6 +165,40 @@ static int amd_cable_detect(struct ata_port *ap)
158} 165}
159 166
160/** 167/**
168 * amd_fifo_setup - set the PIO FIFO for ATA/ATAPI
169 * @ap: ATA interface
170 * @adev: ATA device
171 *
172 * Set the PCI fifo for this device according to the devices present
173 * on the bus at this point in time. We need to turn the post write buffer
174 * off for ATAPI devices as we may need to issue a word sized write to the
175 * device as the final I/O
176 */
177
178static void amd_fifo_setup(struct ata_port *ap)
179{
180 struct ata_device *adev;
181 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
182 static const u8 fifobit[2] = { 0xC0, 0x30};
183 u8 fifo = fifobit[ap->port_no];
184 u8 r;
185
186
187 ata_for_each_dev(adev, &ap->link, ENABLED) {
188 if (adev->class == ATA_DEV_ATAPI)
189 fifo = 0;
190 }
191 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) /* FIFO is broken */
192 fifo = 0;
193
194 /* On the later chips the read prefetch bits become no-op bits */
195 pci_read_config_byte(pdev, 0x41, &r);
196 r &= ~fifobit[ap->port_no];
197 r |= fifo;
198 pci_write_config_byte(pdev, 0x41, r);
199}
200
201/**
161 * amd33_set_piomode - set initial PIO mode data 202 * amd33_set_piomode - set initial PIO mode data
162 * @ap: ATA interface 203 * @ap: ATA interface
163 * @adev: ATA device 204 * @adev: ATA device
@@ -167,21 +208,25 @@ static int amd_cable_detect(struct ata_port *ap)
167 208
168static void amd33_set_piomode(struct ata_port *ap, struct ata_device *adev) 209static void amd33_set_piomode(struct ata_port *ap, struct ata_device *adev)
169{ 210{
211 amd_fifo_setup(ap);
170 timing_setup(ap, adev, 0x40, adev->pio_mode, 1); 212 timing_setup(ap, adev, 0x40, adev->pio_mode, 1);
171} 213}
172 214
173static void amd66_set_piomode(struct ata_port *ap, struct ata_device *adev) 215static void amd66_set_piomode(struct ata_port *ap, struct ata_device *adev)
174{ 216{
217 amd_fifo_setup(ap);
175 timing_setup(ap, adev, 0x40, adev->pio_mode, 2); 218 timing_setup(ap, adev, 0x40, adev->pio_mode, 2);
176} 219}
177 220
178static void amd100_set_piomode(struct ata_port *ap, struct ata_device *adev) 221static void amd100_set_piomode(struct ata_port *ap, struct ata_device *adev)
179{ 222{
223 amd_fifo_setup(ap);
180 timing_setup(ap, adev, 0x40, adev->pio_mode, 3); 224 timing_setup(ap, adev, 0x40, adev->pio_mode, 3);
181} 225}
182 226
183static void amd133_set_piomode(struct ata_port *ap, struct ata_device *adev) 227static void amd133_set_piomode(struct ata_port *ap, struct ata_device *adev)
184{ 228{
229 amd_fifo_setup(ap);
185 timing_setup(ap, adev, 0x40, adev->pio_mode, 4); 230 timing_setup(ap, adev, 0x40, adev->pio_mode, 4);
186} 231}
187 232
@@ -397,6 +442,16 @@ static struct ata_port_operations nv133_port_ops = {
397 .set_dmamode = nv133_set_dmamode, 442 .set_dmamode = nv133_set_dmamode,
398}; 443};
399 444
445static void amd_clear_fifo(struct pci_dev *pdev)
446{
447 u8 fifo;
448 /* Disable the FIFO, the FIFO logic will re-enable it as
449 appropriate */
450 pci_read_config_byte(pdev, 0x41, &fifo);
451 fifo &= 0x0F;
452 pci_write_config_byte(pdev, 0x41, fifo);
453}
454
400static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 455static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
401{ 456{
402 static const struct ata_port_info info[10] = { 457 static const struct ata_port_info info[10] = {
@@ -503,14 +558,8 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
503 558
504 if (type < 3) 559 if (type < 3)
505 ata_pci_bmdma_clear_simplex(pdev); 560 ata_pci_bmdma_clear_simplex(pdev);
506 561 if (pdev->vendor == PCI_VENDOR_ID_AMD)
507 /* Check for AMD7411 */ 562 amd_clear_fifo(pdev);
508 if (type == 3)
509 /* FIFO is broken */
510 pci_write_config_byte(pdev, 0x41, fifo & 0x0F);
511 else
512 pci_write_config_byte(pdev, 0x41, fifo | 0xF0);
513
514 /* Cable detection on Nvidia chips doesn't work too well, 563 /* Cable detection on Nvidia chips doesn't work too well,
515 * cache BIOS programmed UDMA mode. 564 * cache BIOS programmed UDMA mode.
516 */ 565 */
@@ -536,18 +585,11 @@ static int amd_reinit_one(struct pci_dev *pdev)
536 return rc; 585 return rc;
537 586
538 if (pdev->vendor == PCI_VENDOR_ID_AMD) { 587 if (pdev->vendor == PCI_VENDOR_ID_AMD) {
539 u8 fifo; 588 amd_clear_fifo(pdev);
540 pci_read_config_byte(pdev, 0x41, &fifo);
541 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411)
542 /* FIFO is broken */
543 pci_write_config_byte(pdev, 0x41, fifo & 0x0F);
544 else
545 pci_write_config_byte(pdev, 0x41, fifo | 0xF0);
546 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7409 || 589 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7409 ||
547 pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401) 590 pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
548 ata_pci_bmdma_clear_simplex(pdev); 591 ata_pci_bmdma_clear_simplex(pdev);
549 } 592 }
550
551 ata_host_resume(host); 593 ata_host_resume(host);
552 return 0; 594 return 0;
553} 595}
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index f1bb2f9fecbf..b05b86a912c5 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -557,6 +557,9 @@ static unsigned int it821x_read_id(struct ata_device *adev,
557 id[83] |= 0x4400; /* Word 83 is valid and LBA48 */ 557 id[83] |= 0x4400; /* Word 83 is valid and LBA48 */
558 id[86] |= 0x0400; /* LBA48 on */ 558 id[86] |= 0x0400; /* LBA48 on */
559 id[ATA_ID_MAJOR_VER] |= 0x1F; 559 id[ATA_ID_MAJOR_VER] |= 0x1F;
560 /* Clear the serial number because it's different each boot
561 which breaks validation on resume */
562 memset(&id[ATA_ID_SERNO], 0x20, ATA_ID_SERNO_LEN);
560 } 563 }
561 return err_mask; 564 return err_mask;
562} 565}
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 6c1d778b63a9..e3bc1b436284 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -283,9 +283,10 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev)
283static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, 283static unsigned int pdc_data_xfer_vlb(struct ata_device *dev,
284 unsigned char *buf, unsigned int buflen, int rw) 284 unsigned char *buf, unsigned int buflen, int rw)
285{ 285{
286 if (ata_id_has_dword_io(dev->id)) { 286 int slop = buflen & 3;
287 /* 32bit I/O capable *and* we need to write a whole number of dwords */
288 if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3)) {
287 struct ata_port *ap = dev->link->ap; 289 struct ata_port *ap = dev->link->ap;
288 int slop = buflen & 3;
289 unsigned long flags; 290 unsigned long flags;
290 291
291 local_irq_save(flags); 292 local_irq_save(flags);
@@ -735,7 +736,7 @@ static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf,
735 struct ata_port *ap = adev->link->ap; 736 struct ata_port *ap = adev->link->ap;
736 int slop = buflen & 3; 737 int slop = buflen & 3;
737 738
738 if (ata_id_has_dword_io(adev->id)) { 739 if (ata_id_has_dword_io(adev->id) && (slop == 0 || slop == 3)) {
739 if (rw == WRITE) 740 if (rw == WRITE)
740 iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 741 iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
741 else 742 else
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 79a6c9a0b721..ba556d3e6963 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -110,7 +110,8 @@ static const struct via_isa_bridge {
110 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 110 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
111 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 111 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
112 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, 112 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
113 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES}, 113 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
114 { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
114 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 115 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
115 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 116 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
116 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 117 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
@@ -593,6 +594,7 @@ static int via_reinit_one(struct pci_dev *pdev)
593#endif 594#endif
594 595
595static const struct pci_device_id via[] = { 596static const struct pci_device_id via[] = {
597 { PCI_VDEVICE(VIA, 0x0415), },
596 { PCI_VDEVICE(VIA, 0x0571), }, 598 { PCI_VDEVICE(VIA, 0x0571), },
597 { PCI_VDEVICE(VIA, 0x0581), }, 599 { PCI_VDEVICE(VIA, 0x0581), },
598 { PCI_VDEVICE(VIA, 0x1571), }, 600 { PCI_VDEVICE(VIA, 0x1571), },
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 4ae1a4138b47..74b1080d116d 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -2218,12 +2218,13 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance)
2218 else 2218 else
2219 handled = mv_host_intr(host, pending_irqs); 2219 handled = mv_host_intr(host, pending_irqs);
2220 } 2220 }
2221 spin_unlock(&host->lock);
2222 2221
2223 /* for MSI: unmask; interrupt cause bits will retrigger now */ 2222 /* for MSI: unmask; interrupt cause bits will retrigger now */
2224 if (using_msi) 2223 if (using_msi)
2225 writel(hpriv->main_irq_mask, hpriv->main_irq_mask_addr); 2224 writel(hpriv->main_irq_mask, hpriv->main_irq_mask_addr);
2226 2225
2226 spin_unlock(&host->lock);
2227
2227 return IRQ_RETVAL(handled); 2228 return IRQ_RETVAL(handled);
2228} 2229}
2229 2230
@@ -3114,19 +3115,17 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3114 writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); 3115 writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS);
3115 } 3116 }
3116 3117
3117 if (!IS_SOC(hpriv)) { 3118 /* Clear any currently outstanding host interrupt conditions */
3118 /* Clear any currently outstanding host interrupt conditions */ 3119 writelfl(0, mmio + hpriv->irq_cause_ofs);
3119 writelfl(0, mmio + hpriv->irq_cause_ofs);
3120 3120
3121 /* and unmask interrupt generation for host regs */ 3121 /* and unmask interrupt generation for host regs */
3122 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); 3122 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs);
3123 3123
3124 /* 3124 /*
3125 * enable only global host interrupts for now. 3125 * enable only global host interrupts for now.
3126 * The per-port interrupts get done later as ports are set up. 3126 * The per-port interrupts get done later as ports are set up.
3127 */ 3127 */
3128 mv_set_main_irq_mask(host, 0, PCI_ERR); 3128 mv_set_main_irq_mask(host, 0, PCI_ERR);
3129 }
3130done: 3129done:
3131 return rc; 3130 return rc;
3132} 3131}
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 444af0415ca1..f65b53785a8f 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -421,19 +421,21 @@ static struct ata_port_operations nv_generic_ops = {
421 .hardreset = ATA_OP_NULL, 421 .hardreset = ATA_OP_NULL,
422}; 422};
423 423
424/* OSDL bz3352 reports that nf2/3 controllers can't determine device 424/* nf2 is ripe with hardreset related problems.
425 * signature reliably. Also, the following thread reports detection 425 *
426 * failure on cold boot with the standard debouncing timing. 426 * kernel bz#3352 reports nf2/3 controllers can't determine device
427 * signature reliably. The following thread reports detection failure
428 * on cold boot with the standard debouncing timing.
427 * 429 *
428 * http://thread.gmane.org/gmane.linux.ide/34098 430 * http://thread.gmane.org/gmane.linux.ide/34098
429 * 431 *
430 * Debounce with hotplug timing and request follow-up SRST. 432 * And bz#12176 reports that hardreset simply doesn't work on nf2.
433 * Give up on it and just don't do hardreset.
431 */ 434 */
432static struct ata_port_operations nv_nf2_ops = { 435static struct ata_port_operations nv_nf2_ops = {
433 .inherits = &nv_common_ops, 436 .inherits = &nv_generic_ops,
434 .freeze = nv_nf2_freeze, 437 .freeze = nv_nf2_freeze,
435 .thaw = nv_nf2_thaw, 438 .thaw = nv_nf2_thaw,
436 .hardreset = nv_noclassify_hardreset,
437}; 439};
438 440
439/* For initial probing after boot and hot plugging, hardreset mostly 441/* For initial probing after boot and hot plugging, hardreset mostly
@@ -2521,7 +2523,7 @@ static void __exit nv_exit(void)
2521module_init(nv_init); 2523module_init(nv_init);
2522module_exit(nv_exit); 2524module_exit(nv_exit);
2523module_param_named(adma, adma_enabled, bool, 0444); 2525module_param_named(adma, adma_enabled, bool, 0444);
2524MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: true)"); 2526MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)");
2525module_param_named(swncq, swncq_enabled, bool, 0444); 2527module_param_named(swncq, swncq_enabled, bool, 0444);
2526MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); 2528MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)");
2527 2529
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 144a49f15220..8733a2ea04c2 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -901,7 +901,7 @@ static int __devinit eeprom_read(struct lanai_dev *lanai)
901 clock_l(); udelay(5); 901 clock_l(); udelay(5);
902 for (i = 128; i != 0; i >>= 1) { /* write command out */ 902 for (i = 128; i != 0; i >>= 1) { /* write command out */
903 tmp = (lanai->conf1 & ~CONFIG1_PROMDATA) | 903 tmp = (lanai->conf1 & ~CONFIG1_PROMDATA) |
904 (data & i) ? CONFIG1_PROMDATA : 0; 904 ((data & i) ? CONFIG1_PROMDATA : 0);
905 if (lanai->conf1 != tmp) { 905 if (lanai->conf1 != tmp) {
906 set_config1(tmp); 906 set_config1(tmp);
907 udelay(5); /* Let new data settle */ 907 udelay(5); /* Let new data settle */
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 0a5f055dffba..9f50f1b545dc 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -88,8 +88,6 @@ extern void driver_detach(struct device_driver *drv);
88extern int driver_probe_device(struct device_driver *drv, struct device *dev); 88extern int driver_probe_device(struct device_driver *drv, struct device *dev);
89 89
90extern void sysdev_shutdown(void); 90extern void sysdev_shutdown(void);
91extern int sysdev_suspend(pm_message_t state);
92extern int sysdev_resume(void);
93 91
94extern char *make_class_name(const char *name, struct kobject *kobj); 92extern char *make_class_name(const char *name, struct kobject *kobj);
95 93
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 315bed8d5e7f..135231239103 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -18,9 +18,11 @@
18 */ 18 */
19 19
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/delay.h>
21#include <linux/module.h> 22#include <linux/module.h>
22#include <linux/kthread.h> 23#include <linux/kthread.h>
23#include <linux/wait.h> 24#include <linux/wait.h>
25#include <linux/async.h>
24 26
25#include "base.h" 27#include "base.h"
26#include "power/power.h" 28#include "power/power.h"
@@ -168,6 +170,21 @@ int driver_probe_done(void)
168} 170}
169 171
170/** 172/**
173 * wait_for_device_probe
174 * Wait for device probing to be completed.
175 *
176 * Note: this function polls at 100 msec intervals.
177 */
178int wait_for_device_probe(void)
179{
180 /* wait for the known devices to complete their probing */
181 while (driver_probe_done() != 0)
182 msleep(100);
183 async_synchronize_full();
184 return 0;
185}
186
187/**
171 * driver_probe_device - attempt to bind device & driver together 188 * driver_probe_device - attempt to bind device & driver together
172 * @drv: driver to bind a device to 189 * @drv: driver to bind a device to
173 * @dev: device to try to bind to the driver 190 * @dev: device to try to bind to the driver
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 43fa90b837ee..f8f578a71b25 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -303,7 +303,7 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
303 sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index); 303 sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
304 sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; 304 sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
305 for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { 305 for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
306 unsigned int nid; 306 int nid;
307 307
308 nid = get_nid_for_pfn(pfn); 308 nid = get_nid_for_pfn(pfn);
309 if (nid < 0) 309 if (nid < 0)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 670c9d6c1407..2d14f4ae6c01 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -333,7 +333,6 @@ static void dpm_power_up(pm_message_t state)
333 */ 333 */
334void device_power_up(pm_message_t state) 334void device_power_up(pm_message_t state)
335{ 335{
336 sysdev_resume();
337 dpm_power_up(state); 336 dpm_power_up(state);
338} 337}
339EXPORT_SYMBOL_GPL(device_power_up); 338EXPORT_SYMBOL_GPL(device_power_up);
@@ -577,8 +576,6 @@ int device_power_down(pm_message_t state)
577 } 576 }
578 dev->power.status = DPM_OFF_IRQ; 577 dev->power.status = DPM_OFF_IRQ;
579 } 578 }
580 if (!error)
581 error = sysdev_suspend(state);
582 if (error) 579 if (error)
583 dpm_power_up(resume_event(state)); 580 dpm_power_up(resume_event(state));
584 return error; 581 return error;
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index c98c31ec2f75..b428c8c4bc64 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -303,7 +303,6 @@ void sysdev_unregister(struct sys_device * sysdev)
303 * is guaranteed by virtue of the fact that child devices are registered 303 * is guaranteed by virtue of the fact that child devices are registered
304 * after their parents. 304 * after their parents.
305 */ 305 */
306
307void sysdev_shutdown(void) 306void sysdev_shutdown(void)
308{ 307{
309 struct sysdev_class * cls; 308 struct sysdev_class * cls;
@@ -363,7 +362,6 @@ static void __sysdev_resume(struct sys_device *dev)
363 * This is only called by the device PM core, so we let them handle 362 * This is only called by the device PM core, so we let them handle
364 * all synchronization. 363 * all synchronization.
365 */ 364 */
366
367int sysdev_suspend(pm_message_t state) 365int sysdev_suspend(pm_message_t state)
368{ 366{
369 struct sysdev_class * cls; 367 struct sysdev_class * cls;
@@ -432,7 +430,7 @@ aux_driver:
432 } 430 }
433 return ret; 431 return ret;
434} 432}
435 433EXPORT_SYMBOL_GPL(sysdev_suspend);
436 434
437/** 435/**
438 * sysdev_resume - Bring system devices back to life. 436 * sysdev_resume - Bring system devices back to life.
@@ -442,7 +440,6 @@ aux_driver:
442 * 440 *
443 * Note: Interrupts are disabled when called. 441 * Note: Interrupts are disabled when called.
444 */ 442 */
445
446int sysdev_resume(void) 443int sysdev_resume(void)
447{ 444{
448 struct sysdev_class * cls; 445 struct sysdev_class * cls;
@@ -463,7 +460,7 @@ int sysdev_resume(void)
463 } 460 }
464 return 0; 461 return 0;
465} 462}
466 463EXPORT_SYMBOL_GPL(sysdev_resume);
467 464
468int __init system_bus_init(void) 465int __init system_bus_init(void)
469{ 466{
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index c237527b1aa5..5e41e6dd657b 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -18,6 +18,7 @@
18enum { 18enum {
19 AOECMD_ATA, 19 AOECMD_ATA,
20 AOECMD_CFG, 20 AOECMD_CFG,
21 AOECMD_VEND_MIN = 0xf0,
21 22
22 AOEFL_RSP = (1<<3), 23 AOEFL_RSP = (1<<3),
23 AOEFL_ERR = (1<<2), 24 AOEFL_ERR = (1<<2),
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index cc250577d405..eeea477d9601 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -173,7 +173,7 @@ skbfree(struct sk_buff *skb)
173 return; 173 return;
174 while (atomic_read(&skb_shinfo(skb)->dataref) != 1 && i-- > 0) 174 while (atomic_read(&skb_shinfo(skb)->dataref) != 1 && i-- > 0)
175 msleep(Sms); 175 msleep(Sms);
176 if (i <= 0) { 176 if (i < 0) {
177 printk(KERN_ERR 177 printk(KERN_ERR
178 "aoe: %s holds ref: %s\n", 178 "aoe: %s holds ref: %s\n",
179 skb->dev ? skb->dev->name : "netif", 179 skb->dev ? skb->dev->name : "netif",
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index 30de5b1c647e..c6099ba9a4b8 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -142,6 +142,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
142 aoecmd_cfg_rsp(skb); 142 aoecmd_cfg_rsp(skb);
143 break; 143 break;
144 default: 144 default:
145 if (h->cmd >= AOECMD_VEND_MIN)
146 break; /* don't complain about vendor commands */
145 printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); 147 printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
146 } 148 }
147exit: 149exit:
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 69e1df7dfa14..4234c11c1e4c 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1730,7 +1730,7 @@ static int __init fd_test_drive_present( int drive )
1730 1730
1731 timeout = jiffies + 2*HZ+HZ/2; 1731 timeout = jiffies + 2*HZ+HZ/2;
1732 while (time_before(jiffies, timeout)) 1732 while (time_before(jiffies, timeout))
1733 if (!(mfp.par_dt_reg & 0x20)) 1733 if (!(st_mfp.par_dt_reg & 0x20))
1734 break; 1734 break;
1735 1735
1736 status = FDC_READ( FDCREG_STATUS ); 1736 status = FDC_READ( FDCREG_STATUS );
@@ -1747,7 +1747,7 @@ static int __init fd_test_drive_present( int drive )
1747 /* dummy seek command to make WP bit accessible */ 1747 /* dummy seek command to make WP bit accessible */
1748 FDC_WRITE( FDCREG_DATA, 0 ); 1748 FDC_WRITE( FDCREG_DATA, 0 );
1749 FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK ); 1749 FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK );
1750 while( mfp.par_dt_reg & 0x20 ) 1750 while( st_mfp.par_dt_reg & 0x20 )
1751 ; 1751 ;
1752 status = FDC_READ( FDCREG_STATUS ); 1752 status = FDC_READ( FDCREG_STATUS );
1753 } 1753 }
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 01e69383d9c0..4f9b6d792017 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3390,6 +3390,203 @@ static void free_hba(int i)
3390 kfree(p); 3390 kfree(p);
3391} 3391}
3392 3392
3393/* Send a message CDB to the firmware. */
3394static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type)
3395{
3396 typedef struct {
3397 CommandListHeader_struct CommandHeader;
3398 RequestBlock_struct Request;
3399 ErrDescriptor_struct ErrorDescriptor;
3400 } Command;
3401 static const size_t cmd_sz = sizeof(Command) + sizeof(ErrorInfo_struct);
3402 Command *cmd;
3403 dma_addr_t paddr64;
3404 uint32_t paddr32, tag;
3405 void __iomem *vaddr;
3406 int i, err;
3407
3408 vaddr = ioremap_nocache(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
3409 if (vaddr == NULL)
3410 return -ENOMEM;
3411
3412 /* The Inbound Post Queue only accepts 32-bit physical addresses for the
3413 CCISS commands, so they must be allocated from the lower 4GiB of
3414 memory. */
3415 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
3416 if (err) {
3417 iounmap(vaddr);
3418 return -ENOMEM;
3419 }
3420
3421 cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);
3422 if (cmd == NULL) {
3423 iounmap(vaddr);
3424 return -ENOMEM;
3425 }
3426
3427 /* This must fit, because of the 32-bit consistent DMA mask. Also,
3428 although there's no guarantee, we assume that the address is at
3429 least 4-byte aligned (most likely, it's page-aligned). */
3430 paddr32 = paddr64;
3431
3432 cmd->CommandHeader.ReplyQueue = 0;
3433 cmd->CommandHeader.SGList = 0;
3434 cmd->CommandHeader.SGTotal = 0;
3435 cmd->CommandHeader.Tag.lower = paddr32;
3436 cmd->CommandHeader.Tag.upper = 0;
3437 memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);
3438
3439 cmd->Request.CDBLen = 16;
3440 cmd->Request.Type.Type = TYPE_MSG;
3441 cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE;
3442 cmd->Request.Type.Direction = XFER_NONE;
3443 cmd->Request.Timeout = 0; /* Don't time out */
3444 cmd->Request.CDB[0] = opcode;
3445 cmd->Request.CDB[1] = type;
3446 memset(&cmd->Request.CDB[2], 0, 14); /* the rest of the CDB is reserved */
3447
3448 cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(Command);
3449 cmd->ErrorDescriptor.Addr.upper = 0;
3450 cmd->ErrorDescriptor.Len = sizeof(ErrorInfo_struct);
3451
3452 writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET);
3453
3454 for (i = 0; i < 10; i++) {
3455 tag = readl(vaddr + SA5_REPLY_PORT_OFFSET);
3456 if ((tag & ~3) == paddr32)
3457 break;
3458 schedule_timeout_uninterruptible(HZ);
3459 }
3460
3461 iounmap(vaddr);
3462
3463 /* we leak the DMA buffer here ... no choice since the controller could
3464 still complete the command. */
3465 if (i == 10) {
3466 printk(KERN_ERR "cciss: controller message %02x:%02x timed out\n",
3467 opcode, type);
3468 return -ETIMEDOUT;
3469 }
3470
3471 pci_free_consistent(pdev, cmd_sz, cmd, paddr64);
3472
3473 if (tag & 2) {
3474 printk(KERN_ERR "cciss: controller message %02x:%02x failed\n",
3475 opcode, type);
3476 return -EIO;
3477 }
3478
3479 printk(KERN_INFO "cciss: controller message %02x:%02x succeeded\n",
3480 opcode, type);
3481 return 0;
3482}
3483
3484#define cciss_soft_reset_controller(p) cciss_message(p, 1, 0)
3485#define cciss_noop(p) cciss_message(p, 3, 0)
3486
3487static __devinit int cciss_reset_msi(struct pci_dev *pdev)
3488{
3489/* the #defines are stolen from drivers/pci/msi.h. */
3490#define msi_control_reg(base) (base + PCI_MSI_FLAGS)
3491#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
3492
3493 int pos;
3494 u16 control = 0;
3495
3496 pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
3497 if (pos) {
3498 pci_read_config_word(pdev, msi_control_reg(pos), &control);
3499 if (control & PCI_MSI_FLAGS_ENABLE) {
3500 printk(KERN_INFO "cciss: resetting MSI\n");
3501 pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE);
3502 }
3503 }
3504
3505 pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
3506 if (pos) {
3507 pci_read_config_word(pdev, msi_control_reg(pos), &control);
3508 if (control & PCI_MSIX_FLAGS_ENABLE) {
3509 printk(KERN_INFO "cciss: resetting MSI-X\n");
3510 pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE);
3511 }
3512 }
3513
3514 return 0;
3515}
3516
3517/* This does a hard reset of the controller using PCI power management
3518 * states. */
3519static __devinit int cciss_hard_reset_controller(struct pci_dev *pdev)
3520{
3521 u16 pmcsr, saved_config_space[32];
3522 int i, pos;
3523
3524 printk(KERN_INFO "cciss: using PCI PM to reset controller\n");
3525
3526 /* This is very nearly the same thing as
3527
3528 pci_save_state(pci_dev);
3529 pci_set_power_state(pci_dev, PCI_D3hot);
3530 pci_set_power_state(pci_dev, PCI_D0);
3531 pci_restore_state(pci_dev);
3532
3533 but we can't use these nice canned kernel routines on
3534 kexec, because they also check the MSI/MSI-X state in PCI
3535 configuration space and do the wrong thing when it is
3536 set/cleared. Also, the pci_save/restore_state functions
3537 violate the ordering requirements for restoring the
3538 configuration space from the CCISS document (see the
3539 comment below). So we roll our own .... */
3540
3541 for (i = 0; i < 32; i++)
3542 pci_read_config_word(pdev, 2*i, &saved_config_space[i]);
3543
3544 pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
3545 if (pos == 0) {
3546 printk(KERN_ERR "cciss_reset_controller: PCI PM not supported\n");
3547 return -ENODEV;
3548 }
3549
3550 /* Quoting from the Open CISS Specification: "The Power
3551 * Management Control/Status Register (CSR) controls the power
3552 * state of the device. The normal operating state is D0,
3553 * CSR=00h. The software off state is D3, CSR=03h. To reset
3554 * the controller, place the interface device in D3 then to
3555 * D0, this causes a secondary PCI reset which will reset the
3556 * controller." */
3557
3558 /* enter the D3hot power management state */
3559 pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
3560 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
3561 pmcsr |= PCI_D3hot;
3562 pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
3563
3564 schedule_timeout_uninterruptible(HZ >> 1);
3565
3566 /* enter the D0 power management state */
3567 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
3568 pmcsr |= PCI_D0;
3569 pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
3570
3571 schedule_timeout_uninterruptible(HZ >> 1);
3572
3573 /* Restore the PCI configuration space. The Open CISS
3574 * Specification says, "Restore the PCI Configuration
3575 * Registers, offsets 00h through 60h. It is important to
3576 * restore the command register, 16-bits at offset 04h,
3577 * last. Do not restore the configuration status register,
3578 * 16-bits at offset 06h." Note that the offset is 2*i. */
3579 for (i = 0; i < 32; i++) {
3580 if (i == 2 || i == 3)
3581 continue;
3582 pci_write_config_word(pdev, 2*i, saved_config_space[i]);
3583 }
3584 wmb();
3585 pci_write_config_word(pdev, 4, saved_config_space[2]);
3586
3587 return 0;
3588}
3589
3393/* 3590/*
3394 * This is it. Find all the controllers and register them. I really hate 3591 * This is it. Find all the controllers and register them. I really hate
3395 * stealing all these major device numbers. 3592 * stealing all these major device numbers.
@@ -3404,6 +3601,26 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3404 int dac, return_code; 3601 int dac, return_code;
3405 InquiryData_struct *inq_buff = NULL; 3602 InquiryData_struct *inq_buff = NULL;
3406 3603
3604 if (reset_devices) {
3605 /* Reset the controller with a PCI power-cycle */
3606 if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
3607 return -ENODEV;
3608
3609 /* Now try to get the controller to respond to a no-op. Some
3610 devices (notably the HP Smart Array 5i Controller) need
3611 up to 30 seconds to respond. */
3612 for (i=0; i<30; i++) {
3613 if (cciss_noop(pdev) == 0)
3614 break;
3615
3616 schedule_timeout_uninterruptible(HZ);
3617 }
3618 if (i == 30) {
3619 printk(KERN_ERR "cciss: controller seems dead\n");
3620 return -EBUSY;
3621 }
3622 }
3623
3407 i = alloc_cciss_hba(); 3624 i = alloc_cciss_hba();
3408 if (i < 0) 3625 if (i < 0)
3409 return -1; 3626 return -1;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index cf29cc4e6ab7..83d8ed39433d 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -558,6 +558,8 @@ static void process_fd_request(void);
558static void recalibrate_floppy(void); 558static void recalibrate_floppy(void);
559static void floppy_shutdown(unsigned long); 559static void floppy_shutdown(unsigned long);
560 560
561static int floppy_request_regions(int);
562static void floppy_release_regions(int);
561static int floppy_grab_irq_and_dma(void); 563static int floppy_grab_irq_and_dma(void);
562static void floppy_release_irq_and_dma(void); 564static void floppy_release_irq_and_dma(void);
563 565
@@ -4274,8 +4276,7 @@ static int __init floppy_init(void)
4274 FDCS->rawcmd = 2; 4276 FDCS->rawcmd = 2;
4275 if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { 4277 if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) {
4276 /* free ioports reserved by floppy_grab_irq_and_dma() */ 4278 /* free ioports reserved by floppy_grab_irq_and_dma() */
4277 release_region(FDCS->address + 2, 4); 4279 floppy_release_regions(fdc);
4278 release_region(FDCS->address + 7, 1);
4279 FDCS->address = -1; 4280 FDCS->address = -1;
4280 FDCS->version = FDC_NONE; 4281 FDCS->version = FDC_NONE;
4281 continue; 4282 continue;
@@ -4284,8 +4285,7 @@ static int __init floppy_init(void)
4284 FDCS->version = get_fdc_version(); 4285 FDCS->version = get_fdc_version();
4285 if (FDCS->version == FDC_NONE) { 4286 if (FDCS->version == FDC_NONE) {
4286 /* free ioports reserved by floppy_grab_irq_and_dma() */ 4287 /* free ioports reserved by floppy_grab_irq_and_dma() */
4287 release_region(FDCS->address + 2, 4); 4288 floppy_release_regions(fdc);
4288 release_region(FDCS->address + 7, 1);
4289 FDCS->address = -1; 4289 FDCS->address = -1;
4290 continue; 4290 continue;
4291 } 4291 }
@@ -4358,6 +4358,47 @@ out_put_disk:
4358 4358
4359static DEFINE_SPINLOCK(floppy_usage_lock); 4359static DEFINE_SPINLOCK(floppy_usage_lock);
4360 4360
4361static const struct io_region {
4362 int offset;
4363 int size;
4364} io_regions[] = {
4365 { 2, 1 },
4366 /* address + 3 is sometimes reserved by pnp bios for motherboard */
4367 { 4, 2 },
4368 /* address + 6 is reserved, and may be taken by IDE.
4369 * Unfortunately, Adaptec doesn't know this :-(, */
4370 { 7, 1 },
4371};
4372
4373static void floppy_release_allocated_regions(int fdc, const struct io_region *p)
4374{
4375 while (p != io_regions) {
4376 p--;
4377 release_region(FDCS->address + p->offset, p->size);
4378 }
4379}
4380
4381#define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)]))
4382
4383static int floppy_request_regions(int fdc)
4384{
4385 const struct io_region *p;
4386
4387 for (p = io_regions; p < ARRAY_END(io_regions); p++) {
4388 if (!request_region(FDCS->address + p->offset, p->size, "floppy")) {
4389 DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + p->offset);
4390 floppy_release_allocated_regions(fdc, p);
4391 return -EBUSY;
4392 }
4393 }
4394 return 0;
4395}
4396
4397static void floppy_release_regions(int fdc)
4398{
4399 floppy_release_allocated_regions(fdc, ARRAY_END(io_regions));
4400}
4401
4361static int floppy_grab_irq_and_dma(void) 4402static int floppy_grab_irq_and_dma(void)
4362{ 4403{
4363 unsigned long flags; 4404 unsigned long flags;
@@ -4399,18 +4440,8 @@ static int floppy_grab_irq_and_dma(void)
4399 4440
4400 for (fdc = 0; fdc < N_FDC; fdc++) { 4441 for (fdc = 0; fdc < N_FDC; fdc++) {
4401 if (FDCS->address != -1) { 4442 if (FDCS->address != -1) {
4402 if (!request_region(FDCS->address + 2, 4, "floppy")) { 4443 if (floppy_request_regions(fdc))
4403 DPRINT("Floppy io-port 0x%04lx in use\n", 4444 goto cleanup;
4404 FDCS->address + 2);
4405 goto cleanup1;
4406 }
4407 if (!request_region(FDCS->address + 7, 1, "floppy DIR")) {
4408 DPRINT("Floppy io-port 0x%04lx in use\n",
4409 FDCS->address + 7);
4410 goto cleanup2;
4411 }
4412 /* address + 6 is reserved, and may be taken by IDE.
4413 * Unfortunately, Adaptec doesn't know this :-(, */
4414 } 4445 }
4415 } 4446 }
4416 for (fdc = 0; fdc < N_FDC; fdc++) { 4447 for (fdc = 0; fdc < N_FDC; fdc++) {
@@ -4432,15 +4463,11 @@ static int floppy_grab_irq_and_dma(void)
4432 fdc = 0; 4463 fdc = 0;
4433 irqdma_allocated = 1; 4464 irqdma_allocated = 1;
4434 return 0; 4465 return 0;
4435cleanup2: 4466cleanup:
4436 release_region(FDCS->address + 2, 4);
4437cleanup1:
4438 fd_free_irq(); 4467 fd_free_irq();
4439 fd_free_dma(); 4468 fd_free_dma();
4440 while (--fdc >= 0) { 4469 while (--fdc >= 0)
4441 release_region(FDCS->address + 2, 4); 4470 floppy_release_regions(fdc);
4442 release_region(FDCS->address + 7, 1);
4443 }
4444 spin_lock_irqsave(&floppy_usage_lock, flags); 4471 spin_lock_irqsave(&floppy_usage_lock, flags);
4445 usage_count--; 4472 usage_count--;
4446 spin_unlock_irqrestore(&floppy_usage_lock, flags); 4473 spin_unlock_irqrestore(&floppy_usage_lock, flags);
@@ -4501,10 +4528,8 @@ static void floppy_release_irq_and_dma(void)
4501#endif 4528#endif
4502 old_fdc = fdc; 4529 old_fdc = fdc;
4503 for (fdc = 0; fdc < N_FDC; fdc++) 4530 for (fdc = 0; fdc < N_FDC; fdc++)
4504 if (FDCS->address != -1) { 4531 if (FDCS->address != -1)
4505 release_region(FDCS->address + 2, 4); 4532 floppy_release_regions(fdc);
4506 release_region(FDCS->address + 7, 1);
4507 }
4508 fdc = old_fdc; 4533 fdc = old_fdc;
4509} 4534}
4510 4535
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index edbaac6c0573..bf0345577672 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -392,8 +392,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
392 struct loop_device *lo = p->lo; 392 struct loop_device *lo = p->lo;
393 struct page *page = buf->page; 393 struct page *page = buf->page;
394 sector_t IV; 394 sector_t IV;
395 size_t size; 395 int size, ret;
396 int ret;
397 396
398 ret = buf->ops->confirm(pipe, buf); 397 ret = buf->ops->confirm(pipe, buf);
399 if (unlikely(ret)) 398 if (unlikely(ret))
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 9dfa27163001..c397b3ddba9b 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -422,7 +422,7 @@ static void xs(char *buf, char *targ, int len)
422 422
423 for (k = 0; k < len; k++) { 423 for (k = 0; k < len; k++) {
424 char c = *buf++; 424 char c = *buf++;
425 if (c != ' ' || c != l) 425 if (c != ' ' && c != l)
426 l = *targ++ = c; 426 l = *targ++ = c;
427 } 427 }
428 if (l == ' ') 428 if (l == ' ')
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 918ef725de41..8f905089b72b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -40,6 +40,7 @@
40#include <linux/hdreg.h> 40#include <linux/hdreg.h>
41#include <linux/cdrom.h> 41#include <linux/cdrom.h>
42#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/scatterlist.h>
43 44
44#include <xen/xenbus.h> 45#include <xen/xenbus.h>
45#include <xen/grant_table.h> 46#include <xen/grant_table.h>
@@ -82,6 +83,7 @@ struct blkfront_info
82 enum blkif_state connected; 83 enum blkif_state connected;
83 int ring_ref; 84 int ring_ref;
84 struct blkif_front_ring ring; 85 struct blkif_front_ring ring;
86 struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
85 unsigned int evtchn, irq; 87 unsigned int evtchn, irq;
86 struct request_queue *rq; 88 struct request_queue *rq;
87 struct work_struct work; 89 struct work_struct work;
@@ -204,12 +206,11 @@ static int blkif_queue_request(struct request *req)
204 struct blkfront_info *info = req->rq_disk->private_data; 206 struct blkfront_info *info = req->rq_disk->private_data;
205 unsigned long buffer_mfn; 207 unsigned long buffer_mfn;
206 struct blkif_request *ring_req; 208 struct blkif_request *ring_req;
207 struct req_iterator iter;
208 struct bio_vec *bvec;
209 unsigned long id; 209 unsigned long id;
210 unsigned int fsect, lsect; 210 unsigned int fsect, lsect;
211 int ref; 211 int i, ref;
212 grant_ref_t gref_head; 212 grant_ref_t gref_head;
213 struct scatterlist *sg;
213 214
214 if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) 215 if (unlikely(info->connected != BLKIF_STATE_CONNECTED))
215 return 1; 216 return 1;
@@ -238,12 +239,13 @@ static int blkif_queue_request(struct request *req)
238 if (blk_barrier_rq(req)) 239 if (blk_barrier_rq(req))
239 ring_req->operation = BLKIF_OP_WRITE_BARRIER; 240 ring_req->operation = BLKIF_OP_WRITE_BARRIER;
240 241
241 ring_req->nr_segments = 0; 242 ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg);
242 rq_for_each_segment(bvec, req, iter) { 243 BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST);
243 BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST); 244
244 buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page)); 245 for_each_sg(info->sg, sg, ring_req->nr_segments, i) {
245 fsect = bvec->bv_offset >> 9; 246 buffer_mfn = pfn_to_mfn(page_to_pfn(sg_page(sg)));
246 lsect = fsect + (bvec->bv_len >> 9) - 1; 247 fsect = sg->offset >> 9;
248 lsect = fsect + (sg->length >> 9) - 1;
247 /* install a grant reference. */ 249 /* install a grant reference. */
248 ref = gnttab_claim_grant_reference(&gref_head); 250 ref = gnttab_claim_grant_reference(&gref_head);
249 BUG_ON(ref == -ENOSPC); 251 BUG_ON(ref == -ENOSPC);
@@ -254,16 +256,12 @@ static int blkif_queue_request(struct request *req)
254 buffer_mfn, 256 buffer_mfn,
255 rq_data_dir(req) ); 257 rq_data_dir(req) );
256 258
257 info->shadow[id].frame[ring_req->nr_segments] = 259 info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn);
258 mfn_to_pfn(buffer_mfn); 260 ring_req->seg[i] =
259
260 ring_req->seg[ring_req->nr_segments] =
261 (struct blkif_request_segment) { 261 (struct blkif_request_segment) {
262 .gref = ref, 262 .gref = ref,
263 .first_sect = fsect, 263 .first_sect = fsect,
264 .last_sect = lsect }; 264 .last_sect = lsect };
265
266 ring_req->nr_segments++;
267 } 265 }
268 266
269 info->ring.req_prod_pvt++; 267 info->ring.req_prod_pvt++;
@@ -622,6 +620,8 @@ static int setup_blkring(struct xenbus_device *dev,
622 SHARED_RING_INIT(sring); 620 SHARED_RING_INIT(sring);
623 FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); 621 FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);
624 622
623 sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST);
624
625 err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); 625 err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring));
626 if (err < 0) { 626 if (err < 0) {
627 free_page((unsigned long)sring); 627 free_page((unsigned long)sring);
@@ -977,6 +977,8 @@ static void backend_changed(struct xenbus_device *dev,
977 break; 977 break;
978 978
979 case XenbusStateClosing: 979 case XenbusStateClosing:
980 if (info->gd == NULL)
981 xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
980 bd = bdget_disk(info->gd, 0); 982 bd = bdget_disk(info->gd, 0);
981 if (bd == NULL) 983 if (bd == NULL)
982 xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); 984 xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 381d686fc1a3..119be3442f28 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -489,6 +489,28 @@ static void ace_fsm_dostate(struct ace_device *ace)
489 ace->fsm_state, ace->id_req_count); 489 ace->fsm_state, ace->id_req_count);
490#endif 490#endif
491 491
492 /* Verify that there is actually a CF in the slot. If not, then
493 * bail out back to the idle state and wake up all the waiters */
494 status = ace_in32(ace, ACE_STATUS);
495 if ((status & ACE_STATUS_CFDETECT) == 0) {
496 ace->fsm_state = ACE_FSM_STATE_IDLE;
497 ace->media_change = 1;
498 set_capacity(ace->gd, 0);
499 dev_info(ace->dev, "No CF in slot\n");
500
501 /* Drop all pending requests */
502 while ((req = elv_next_request(ace->queue)) != NULL)
503 end_request(req, 0);
504
505 /* Drop back to IDLE state and notify waiters */
506 ace->fsm_state = ACE_FSM_STATE_IDLE;
507 ace->id_result = -EIO;
508 while (ace->id_req_count) {
509 complete(&ace->id_completion);
510 ace->id_req_count--;
511 }
512 }
513
492 switch (ace->fsm_state) { 514 switch (ace->fsm_state) {
493 case ACE_FSM_STATE_IDLE: 515 case ACE_FSM_STATE_IDLE:
494 /* See if there is anything to do */ 516 /* See if there is anything to do */
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 52f4361eb6e4..d765afda9c2a 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -271,15 +271,15 @@ static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
271 nb_order = (nb_order >> 1) & 7; 271 nb_order = (nb_order >> 1) & 7;
272 pci_read_config_dword(nb, AMD64_GARTAPERTUREBASE, &nb_base); 272 pci_read_config_dword(nb, AMD64_GARTAPERTUREBASE, &nb_base);
273 nb_aper = nb_base << 25; 273 nb_aper = nb_base << 25;
274 if (agp_aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) {
275 return 0;
276 }
277 274
278 /* Northbridge seems to contain crap. Try the AGP bridge. */ 275 /* Northbridge seems to contain crap. Try the AGP bridge. */
279 276
280 pci_read_config_word(agp, cap+0x14, &apsize); 277 pci_read_config_word(agp, cap+0x14, &apsize);
281 if (apsize == 0xffff) 278 if (apsize == 0xffff) {
279 if (agp_aperture_valid(nb_aper, (32*1024*1024)<<nb_order))
280 return 0;
282 return -1; 281 return -1;
282 }
283 283
284 apsize &= 0xfff; 284 apsize &= 0xfff;
285 /* Some BIOS use weird encodings not in the AGPv3 table. */ 285 /* Some BIOS use weird encodings not in the AGPv3 table. */
@@ -301,6 +301,11 @@ static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
301 order = nb_order; 301 order = nb_order;
302 } 302 }
303 303
304 if (nb_order >= order) {
305 if (agp_aperture_valid(nb_aper, (32*1024*1024)<<nb_order))
306 return 0;
307 }
308
304 dev_info(&agp->dev, "aperture from AGP @ %Lx size %u MB\n", 309 dev_info(&agp->dev, "aperture from AGP @ %Lx size %u MB\n",
305 aper, 32 << order); 310 aper, 32 << order);
306 if (order < 0 || !agp_aperture_valid(aper, (32*1024*1024)<<order)) 311 if (order < 0 || !agp_aperture_valid(aper, (32*1024*1024)<<order))
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index c7714185f831..4373adb2119a 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -633,13 +633,15 @@ static void intel_i830_init_gtt_entries(void)
633 break; 633 break;
634 } 634 }
635 } 635 }
636 if (gtt_entries > 0) 636 if (gtt_entries > 0) {
637 dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", 637 dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
638 gtt_entries / KB(1), local ? "local" : "stolen"); 638 gtt_entries / KB(1), local ? "local" : "stolen");
639 else 639 gtt_entries /= KB(4);
640 } else {
640 dev_info(&agp_bridge->dev->dev, 641 dev_info(&agp_bridge->dev->dev,
641 "no pre-allocated video memory detected\n"); 642 "no pre-allocated video memory detected\n");
642 gtt_entries /= KB(4); 643 gtt_entries = 0;
644 }
643 645
644 intel_private.gtt_entries = gtt_entries; 646 intel_private.gtt_entries = gtt_entries;
645} 647}
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index db60539bf67a..699e3422ad93 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -359,9 +359,16 @@ fail:
359 return error; 359 return error;
360} 360}
361 361
362static struct device *next_device(struct klist_iter *i) { 362static int
363 struct klist_node * n = klist_next(i); 363find_quicksilver(struct device *dev, void *data)
364 return n ? container_of(n, struct device, knode_parent) : NULL; 364{
365 struct parisc_device **lba = data;
366 struct parisc_device *padev = to_parisc_device(dev);
367
368 if (IS_QUICKSILVER(padev))
369 *lba = padev;
370
371 return 0;
365} 372}
366 373
367static int 374static int
@@ -372,8 +379,6 @@ parisc_agp_init(void)
372 int err = -1; 379 int err = -1;
373 struct parisc_device *sba = NULL, *lba = NULL; 380 struct parisc_device *sba = NULL, *lba = NULL;
374 struct lba_device *lbadev = NULL; 381 struct lba_device *lbadev = NULL;
375 struct device *dev = NULL;
376 struct klist_iter i;
377 382
378 if (!sba_list) 383 if (!sba_list)
379 goto out; 384 goto out;
@@ -386,13 +391,7 @@ parisc_agp_init(void)
386 } 391 }
387 392
388 /* Now search our Pluto for our precious AGP device... */ 393 /* Now search our Pluto for our precious AGP device... */
389 klist_iter_init(&sba->dev.klist_children, &i); 394 device_for_each_child(&sba->dev, &lba, find_quicksilver);
390 while ((dev = next_device(&i))) {
391 struct parisc_device *padev = to_parisc_device(dev);
392 if (IS_QUICKSILVER(padev))
393 lba = padev;
394 }
395 klist_iter_exit(&i);
396 395
397 if (!lba) { 396 if (!lba) {
398 printk(KERN_INFO DRVPFX "No AGP devices found.\n"); 397 printk(KERN_INFO DRVPFX "No AGP devices found.\n");
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c
index 6e6eb445d374..c76bccf5354d 100644
--- a/drivers/char/hvcs.c
+++ b/drivers/char/hvcs.c
@@ -1139,15 +1139,6 @@ static int hvcs_open(struct tty_struct *tty, struct file *filp)
1139 hvcsd->tty = tty; 1139 hvcsd->tty = tty;
1140 tty->driver_data = hvcsd; 1140 tty->driver_data = hvcsd;
1141 1141
1142 /*
1143 * Set this driver to low latency so that we actually have a chance at
1144 * catching a throttled TTY after we flip_buffer_push. Otherwise the
1145 * flush_to_async may not execute until after the kernel_thread has
1146 * yielded and resumed the next flip_buffer_push resulting in data
1147 * loss.
1148 */
1149 tty->low_latency = 1;
1150
1151 memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN); 1142 memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN);
1152 1143
1153 /* 1144 /*
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 406f8742a260..2989056a9e39 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -810,7 +810,6 @@ static int hvsi_open(struct tty_struct *tty, struct file *filp)
810 hp = &hvsi_ports[line]; 810 hp = &hvsi_ports[line];
811 811
812 tty->driver_data = hp; 812 tty->driver_data = hp;
813 tty->low_latency = 1; /* avoid throttle/tty_flip_buffer_push race */
814 813
815 mb(); 814 mb();
816 if (hp->state == HVSI_FSP_DIED) 815 if (hp->state == HVSI_FSP_DIED)
diff --git a/drivers/char/scc.h b/drivers/char/scc.h
index 93998f5baff5..341b1142bea8 100644
--- a/drivers/char/scc.h
+++ b/drivers/char/scc.h
@@ -387,7 +387,7 @@ struct scc_port {
387/* The SCC needs 3.5 PCLK cycles recovery time between to register 387/* The SCC needs 3.5 PCLK cycles recovery time between to register
388 * accesses. PCLK runs with 8 MHz on an Atari, so this delay is 3.5 * 388 * accesses. PCLK runs with 8 MHz on an Atari, so this delay is 3.5 *
389 * 125 ns = 437.5 ns. This is too short for udelay(). 389 * 125 ns = 437.5 ns. This is too short for udelay().
390 * 10/16/95: A tstb mfp.par_dt_reg takes 600ns (sure?) and thus should be 390 * 10/16/95: A tstb st_mfp.par_dt_reg takes 600ns (sure?) and thus should be
391 * quite right 391 * quite right
392 */ 392 */
393 393
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index f146e90404fa..518f2a25d91e 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1746,9 +1746,10 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
1746 sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc); 1746 sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc);
1747 break; 1747 break;
1748 case SXIO_DO_RAMTEST: 1748 case SXIO_DO_RAMTEST:
1749 if (sx_initialized) /* Already initialized: better not ramtest the board. */ 1749 if (sx_initialized) { /* Already initialized: better not ramtest the board. */
1750 rc = -EPERM; 1750 rc = -EPERM;
1751 break; 1751 break;
1752 }
1752 if (IS_SX_BOARD(board)) { 1753 if (IS_SX_BOARD(board)) {
1753 rc = do_memtest(board, 0, 0x7000); 1754 rc = do_memtest(board, 0, 0x7000);
1754 if (!rc) 1755 if (!rc)
@@ -1788,7 +1789,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
1788 nbytes - i : SX_CHUNK_SIZE)) { 1789 nbytes - i : SX_CHUNK_SIZE)) {
1789 kfree(tmp); 1790 kfree(tmp);
1790 rc = -EFAULT; 1791 rc = -EFAULT;
1791 break; 1792 goto out;
1792 } 1793 }
1793 memcpy_toio(board->base2 + offset + i, tmp, 1794 memcpy_toio(board->base2 + offset + i, tmp,
1794 (i + SX_CHUNK_SIZE > nbytes) ? 1795 (i + SX_CHUNK_SIZE > nbytes) ?
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index b55cb67435bd..d6daf3c507d3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -754,11 +754,6 @@ static struct kobj_type ktype_cpufreq = {
754 .release = cpufreq_sysfs_release, 754 .release = cpufreq_sysfs_release,
755}; 755};
756 756
757static struct kobj_type ktype_empty_cpufreq = {
758 .sysfs_ops = &sysfs_ops,
759 .release = cpufreq_sysfs_release,
760};
761
762 757
763/** 758/**
764 * cpufreq_add_dev - add a CPU device 759 * cpufreq_add_dev - add a CPU device
@@ -892,36 +887,26 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
892 memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); 887 memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
893 888
894 /* prepare interface data */ 889 /* prepare interface data */
895 if (!cpufreq_driver->hide_interface) { 890 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj,
896 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, 891 "cpufreq");
897 &sys_dev->kobj, "cpufreq"); 892 if (ret)
893 goto err_out_driver_exit;
894
895 /* set up files for this cpu device */
896 drv_attr = cpufreq_driver->attr;
897 while ((drv_attr) && (*drv_attr)) {
898 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
898 if (ret) 899 if (ret)
899 goto err_out_driver_exit; 900 goto err_out_driver_exit;
900 901 drv_attr++;
901 /* set up files for this cpu device */ 902 }
902 drv_attr = cpufreq_driver->attr; 903 if (cpufreq_driver->get) {
903 while ((drv_attr) && (*drv_attr)) { 904 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
904 ret = sysfs_create_file(&policy->kobj, 905 if (ret)
905 &((*drv_attr)->attr)); 906 goto err_out_driver_exit;
906 if (ret) 907 }
907 goto err_out_driver_exit; 908 if (cpufreq_driver->target) {
908 drv_attr++; 909 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
909 }
910 if (cpufreq_driver->get) {
911 ret = sysfs_create_file(&policy->kobj,
912 &cpuinfo_cur_freq.attr);
913 if (ret)
914 goto err_out_driver_exit;
915 }
916 if (cpufreq_driver->target) {
917 ret = sysfs_create_file(&policy->kobj,
918 &scaling_cur_freq.attr);
919 if (ret)
920 goto err_out_driver_exit;
921 }
922 } else {
923 ret = kobject_init_and_add(&policy->kobj, &ktype_empty_cpufreq,
924 &sys_dev->kobj, "cpufreq");
925 if (ret) 910 if (ret)
926 goto err_out_driver_exit; 911 goto err_out_driver_exit;
927 } 912 }
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 2d637e0fbc03..d9e751be8c5f 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -457,10 +457,12 @@ static int init_ixp_crypto(void)
457 if (!ctx_pool) { 457 if (!ctx_pool) {
458 goto err; 458 goto err;
459 } 459 }
460 ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0); 460 ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0,
461 "ixp_crypto:out", NULL);
461 if (ret) 462 if (ret)
462 goto err; 463 goto err;
463 ret = qmgr_request_queue(RECV_QID, NPE_QLEN, 0, 0); 464 ret = qmgr_request_queue(RECV_QID, NPE_QLEN, 0, 0,
465 "ixp_crypto:in", NULL);
464 if (ret) { 466 if (ret) {
465 qmgr_release_queue(SEND_QID); 467 qmgr_release_queue(SEND_QID);
466 goto err; 468 goto err;
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 856b3cc25583..3f0fdd18255d 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -489,4 +489,4 @@ MODULE_DESCRIPTION("VIA PadLock AES algorithm support");
489MODULE_LICENSE("GPL"); 489MODULE_LICENSE("GPL");
490MODULE_AUTHOR("Michal Ludvig"); 490MODULE_AUTHOR("Michal Ludvig");
491 491
492MODULE_ALIAS("aes"); 492MODULE_ALIAS("aes-all");
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
index a7fbadebf623..a2c8e8514b63 100644
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -304,7 +304,7 @@ MODULE_DESCRIPTION("VIA PadLock SHA1/SHA256 algorithms support.");
304MODULE_LICENSE("GPL"); 304MODULE_LICENSE("GPL");
305MODULE_AUTHOR("Michal Ludvig"); 305MODULE_AUTHOR("Michal Ludvig");
306 306
307MODULE_ALIAS("sha1"); 307MODULE_ALIAS("sha1-all");
308MODULE_ALIAS("sha256"); 308MODULE_ALIAS("sha256-all");
309MODULE_ALIAS("sha1-padlock"); 309MODULE_ALIAS("sha1-padlock");
310MODULE_ALIAS("sha256-padlock"); 310MODULE_ALIAS("sha256-padlock");
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index 33bd75347518..25b743abfb59 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved. 2 * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free 5 * under the terms of the GNU General Public License as published by the Free
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index a58993011edb..280a9d263eb3 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -518,6 +518,7 @@ struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v
518 dma_chan_name(chan), err); 518 dma_chan_name(chan), err);
519 else 519 else
520 break; 520 break;
521 chan->private = NULL;
521 chan = NULL; 522 chan = NULL;
522 } 523 }
523 } 524 }
@@ -536,6 +537,7 @@ void dma_release_channel(struct dma_chan *chan)
536 WARN_ONCE(chan->client_count != 1, 537 WARN_ONCE(chan->client_count != 1,
537 "chan reference count %d != 1\n", chan->client_count); 538 "chan reference count %d != 1\n", chan->client_count);
538 dma_chan_put(chan); 539 dma_chan_put(chan);
540 chan->private = NULL;
539 mutex_unlock(&dma_list_mutex); 541 mutex_unlock(&dma_list_mutex);
540} 542}
541EXPORT_SYMBOL_GPL(dma_release_channel); 543EXPORT_SYMBOL_GPL(dma_release_channel);
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 732fa1ec36ab..e190d8b30700 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -430,13 +430,15 @@ late_initcall(dmatest_init);
430static void __exit dmatest_exit(void) 430static void __exit dmatest_exit(void)
431{ 431{
432 struct dmatest_chan *dtc, *_dtc; 432 struct dmatest_chan *dtc, *_dtc;
433 struct dma_chan *chan;
433 434
434 list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) { 435 list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) {
435 list_del(&dtc->node); 436 list_del(&dtc->node);
437 chan = dtc->chan;
436 dmatest_cleanup_channel(dtc); 438 dmatest_cleanup_channel(dtc);
437 pr_debug("dmatest: dropped channel %s\n", 439 pr_debug("dmatest: dropped channel %s\n",
438 dma_chan_name(dtc->chan)); 440 dma_chan_name(chan));
439 dma_release_channel(dtc->chan); 441 dma_release_channel(chan);
440 } 442 }
441} 443}
442module_exit(dmatest_exit); 444module_exit(dmatest_exit);
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 6b702cc46b3d..a97c07eef7ec 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -560,7 +560,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
560 unsigned long flags) 560 unsigned long flags)
561{ 561{
562 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 562 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
563 struct dw_dma_slave *dws = dwc->dws; 563 struct dw_dma_slave *dws = chan->private;
564 struct dw_desc *prev; 564 struct dw_desc *prev;
565 struct dw_desc *first; 565 struct dw_desc *first;
566 u32 ctllo; 566 u32 ctllo;
@@ -790,7 +790,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
790 cfghi = DWC_CFGH_FIFO_MODE; 790 cfghi = DWC_CFGH_FIFO_MODE;
791 cfglo = 0; 791 cfglo = 0;
792 792
793 dws = dwc->dws; 793 dws = chan->private;
794 if (dws) { 794 if (dws) {
795 /* 795 /*
796 * We need controller-specific data to set up slave 796 * We need controller-specific data to set up slave
@@ -866,7 +866,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
866 spin_lock_bh(&dwc->lock); 866 spin_lock_bh(&dwc->lock);
867 list_splice_init(&dwc->free_list, &list); 867 list_splice_init(&dwc->free_list, &list);
868 dwc->descs_allocated = 0; 868 dwc->descs_allocated = 0;
869 dwc->dws = NULL;
870 869
871 /* Disable interrupts */ 870 /* Disable interrupts */
872 channel_clear_bit(dw, MASK.XFER, dwc->mask); 871 channel_clear_bit(dw, MASK.XFER, dwc->mask);
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 00fdd187bb0c..b252b202c5cf 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -139,8 +139,6 @@ struct dw_dma_chan {
139 struct list_head queue; 139 struct list_head queue;
140 struct list_head free_list; 140 struct list_head free_list;
141 141
142 struct dw_dma_slave *dws;
143
144 unsigned int descs_allocated; 142 unsigned int descs_allocated;
145}; 143};
146 144
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 70126a606239..86d6da47f558 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -158,7 +158,8 @@ static void dma_start(struct fsl_dma_chan *fsl_chan)
158 158
159static void dma_halt(struct fsl_dma_chan *fsl_chan) 159static void dma_halt(struct fsl_dma_chan *fsl_chan)
160{ 160{
161 int i = 0; 161 int i;
162
162 DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, 163 DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
163 DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) | FSL_DMA_MR_CA, 164 DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) | FSL_DMA_MR_CA,
164 32); 165 32);
@@ -166,8 +167,11 @@ static void dma_halt(struct fsl_dma_chan *fsl_chan)
166 DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) & ~(FSL_DMA_MR_CS 167 DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) & ~(FSL_DMA_MR_CS
167 | FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA), 32); 168 | FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA), 32);
168 169
169 while (!dma_is_idle(fsl_chan) && (i++ < 100)) 170 for (i = 0; i < 100; i++) {
171 if (dma_is_idle(fsl_chan))
172 break;
170 udelay(10); 173 udelay(10);
174 }
171 if (i >= 100 && !dma_is_idle(fsl_chan)) 175 if (i >= 100 && !dma_is_idle(fsl_chan))
172 dev_err(fsl_chan->dev, "DMA halt timeout!\n"); 176 dev_err(fsl_chan->dev, "DMA halt timeout!\n");
173} 177}
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c
index 4105d6575b64..ed83dd9df192 100644
--- a/drivers/dma/ioat.c
+++ b/drivers/dma/ioat.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Intel I/OAT DMA Linux driver 2 * Intel I/OAT DMA Linux driver
3 * Copyright(c) 2007 Intel Corporation. 3 * Copyright(c) 2007 - 2009 Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c
index 6cf622da0286..c012a1e15043 100644
--- a/drivers/dma/ioat_dca.c
+++ b/drivers/dma/ioat_dca.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Intel I/OAT DMA Linux driver 2 * Intel I/OAT DMA Linux driver
3 * Copyright(c) 2007 Intel Corporation. 3 * Copyright(c) 2007 - 2009 Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -49,6 +49,23 @@
49 49
50#define DCA_TAG_MAP_MASK 0xDF 50#define DCA_TAG_MAP_MASK 0xDF
51 51
52/* expected tag map bytes for I/OAT ver.2 */
53#define DCA2_TAG_MAP_BYTE0 0x80
54#define DCA2_TAG_MAP_BYTE1 0x0
55#define DCA2_TAG_MAP_BYTE2 0x81
56#define DCA2_TAG_MAP_BYTE3 0x82
57#define DCA2_TAG_MAP_BYTE4 0x82
58
59/* verify if tag map matches expected values */
60static inline int dca2_tag_map_valid(u8 *tag_map)
61{
62 return ((tag_map[0] == DCA2_TAG_MAP_BYTE0) &&
63 (tag_map[1] == DCA2_TAG_MAP_BYTE1) &&
64 (tag_map[2] == DCA2_TAG_MAP_BYTE2) &&
65 (tag_map[3] == DCA2_TAG_MAP_BYTE3) &&
66 (tag_map[4] == DCA2_TAG_MAP_BYTE4));
67}
68
52/* 69/*
53 * "Legacy" DCA systems do not implement the DCA register set in the 70 * "Legacy" DCA systems do not implement the DCA register set in the
54 * I/OAT device. Software needs direct support for their tag mappings. 71 * I/OAT device. Software needs direct support for their tag mappings.
@@ -452,6 +469,13 @@ struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase)
452 ioatdca->tag_map[i] = 0; 469 ioatdca->tag_map[i] = 0;
453 } 470 }
454 471
472 if (!dca2_tag_map_valid(ioatdca->tag_map)) {
473 dev_err(&pdev->dev, "APICID_TAG_MAP set incorrectly by BIOS, "
474 "disabling DCA\n");
475 free_dca_provider(dca);
476 return NULL;
477 }
478
455 err = register_dca_provider(dca, &pdev->dev); 479 err = register_dca_provider(dca, &pdev->dev);
456 if (err) { 480 if (err) {
457 free_dca_provider(dca); 481 free_dca_provider(dca);
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index b3759c4b6536..5905cd36bcd2 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Intel I/OAT DMA Linux driver 2 * Intel I/OAT DMA Linux driver
3 * Copyright(c) 2004 - 2007 Intel Corporation. 3 * Copyright(c) 2004 - 2009 Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -189,11 +189,13 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device)
189 ioat_chan->xfercap = xfercap; 189 ioat_chan->xfercap = xfercap;
190 ioat_chan->desccount = 0; 190 ioat_chan->desccount = 0;
191 INIT_DELAYED_WORK(&ioat_chan->work, ioat_dma_chan_reset_part2); 191 INIT_DELAYED_WORK(&ioat_chan->work, ioat_dma_chan_reset_part2);
192 if (ioat_chan->device->version != IOAT_VER_1_2) { 192 if (ioat_chan->device->version == IOAT_VER_2_0)
193 writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE 193 writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE |
194 | IOAT_DMA_DCA_ANY_CPU, 194 IOAT_DMA_DCA_ANY_CPU,
195 ioat_chan->reg_base + IOAT_DCACTRL_OFFSET); 195 ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
196 } 196 else if (ioat_chan->device->version == IOAT_VER_3_0)
197 writel(IOAT_DMA_DCA_ANY_CPU,
198 ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
197 spin_lock_init(&ioat_chan->cleanup_lock); 199 spin_lock_init(&ioat_chan->cleanup_lock);
198 spin_lock_init(&ioat_chan->desc_lock); 200 spin_lock_init(&ioat_chan->desc_lock);
199 INIT_LIST_HEAD(&ioat_chan->free_desc); 201 INIT_LIST_HEAD(&ioat_chan->free_desc);
@@ -1169,9 +1171,8 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
1169 * up if the client is done with the descriptor 1171 * up if the client is done with the descriptor
1170 */ 1172 */
1171 if (async_tx_test_ack(&desc->async_tx)) { 1173 if (async_tx_test_ack(&desc->async_tx)) {
1172 list_del(&desc->node); 1174 list_move_tail(&desc->node,
1173 list_add_tail(&desc->node, 1175 &ioat_chan->free_desc);
1174 &ioat_chan->free_desc);
1175 } else 1176 } else
1176 desc->async_tx.cookie = 0; 1177 desc->async_tx.cookie = 0;
1177 } else { 1178 } else {
@@ -1362,6 +1363,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1362 dma_cookie_t cookie; 1363 dma_cookie_t cookie;
1363 int err = 0; 1364 int err = 0;
1364 struct completion cmp; 1365 struct completion cmp;
1366 unsigned long tmo;
1365 1367
1366 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); 1368 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
1367 if (!src) 1369 if (!src)
@@ -1413,9 +1415,10 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1413 } 1415 }
1414 device->common.device_issue_pending(dma_chan); 1416 device->common.device_issue_pending(dma_chan);
1415 1417
1416 wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); 1418 tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
1417 1419
1418 if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) 1420 if (tmo == 0 ||
1421 device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL)
1419 != DMA_SUCCESS) { 1422 != DMA_SUCCESS) {
1420 dev_err(&device->pdev->dev, 1423 dev_err(&device->pdev->dev,
1421 "Self-test copy timed out, disabling\n"); 1424 "Self-test copy timed out, disabling\n");
@@ -1657,6 +1660,13 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
1657 " %d channels, device version 0x%02x, driver version %s\n", 1660 " %d channels, device version 0x%02x, driver version %s\n",
1658 device->common.chancnt, device->version, IOAT_DMA_VERSION); 1661 device->common.chancnt, device->version, IOAT_DMA_VERSION);
1659 1662
1663 if (!device->common.chancnt) {
1664 dev_err(&device->pdev->dev,
1665 "Intel(R) I/OAT DMA Engine problem found: "
1666 "zero channels detected\n");
1667 goto err_setup_interrupts;
1668 }
1669
1660 err = ioat_dma_setup_interrupts(device); 1670 err = ioat_dma_setup_interrupts(device);
1661 if (err) 1671 if (err)
1662 goto err_setup_interrupts; 1672 goto err_setup_interrupts;
@@ -1696,6 +1706,9 @@ void ioat_dma_remove(struct ioatdma_device *device)
1696 struct dma_chan *chan, *_chan; 1706 struct dma_chan *chan, *_chan;
1697 struct ioat_dma_chan *ioat_chan; 1707 struct ioat_dma_chan *ioat_chan;
1698 1708
1709 if (device->version != IOAT_VER_3_0)
1710 cancel_delayed_work(&device->work);
1711
1699 ioat_dma_remove_interrupts(device); 1712 ioat_dma_remove_interrupts(device);
1700 1713
1701 dma_async_device_unregister(&device->common); 1714 dma_async_device_unregister(&device->common);
@@ -1707,10 +1720,6 @@ void ioat_dma_remove(struct ioatdma_device *device)
1707 pci_release_regions(device->pdev); 1720 pci_release_regions(device->pdev);
1708 pci_disable_device(device->pdev); 1721 pci_disable_device(device->pdev);
1709 1722
1710 if (device->version != IOAT_VER_3_0) {
1711 cancel_delayed_work(&device->work);
1712 }
1713
1714 list_for_each_entry_safe(chan, _chan, 1723 list_for_each_entry_safe(chan, _chan,
1715 &device->common.channels, device_node) { 1724 &device->common.channels, device_node) {
1716 ioat_chan = to_ioat_chan(chan); 1725 ioat_chan = to_ioat_chan(chan);
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index a3306d0e1372..a52ff4bd4601 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. 2 * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free 5 * under the terms of the GNU General Public License as published by the Free
@@ -29,7 +29,7 @@
29#include <linux/pci_ids.h> 29#include <linux/pci_ids.h>
30#include <net/tcp.h> 30#include <net/tcp.h>
31 31
32#define IOAT_DMA_VERSION "3.30" 32#define IOAT_DMA_VERSION "3.64"
33 33
34enum ioat_interrupt { 34enum ioat_interrupt {
35 none = 0, 35 none = 0,
@@ -135,12 +135,14 @@ static inline void ioat_set_tcp_copy_break(struct ioatdma_device *dev)
135 #ifdef CONFIG_NET_DMA 135 #ifdef CONFIG_NET_DMA
136 switch (dev->version) { 136 switch (dev->version) {
137 case IOAT_VER_1_2: 137 case IOAT_VER_1_2:
138 case IOAT_VER_3_0:
139 sysctl_tcp_dma_copybreak = 4096; 138 sysctl_tcp_dma_copybreak = 4096;
140 break; 139 break;
141 case IOAT_VER_2_0: 140 case IOAT_VER_2_0:
142 sysctl_tcp_dma_copybreak = 2048; 141 sysctl_tcp_dma_copybreak = 2048;
143 break; 142 break;
143 case IOAT_VER_3_0:
144 sysctl_tcp_dma_copybreak = 262144;
145 break;
144 } 146 }
145 #endif 147 #endif
146} 148}
diff --git a/drivers/dma/ioatdma_hw.h b/drivers/dma/ioatdma_hw.h
index f1ae2c776f74..afa57eef86c9 100644
--- a/drivers/dma/ioatdma_hw.h
+++ b/drivers/dma/ioatdma_hw.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. 2 * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free 5 * under the terms of the GNU General Public License as published by the Free
diff --git a/drivers/dma/ioatdma_registers.h b/drivers/dma/ioatdma_registers.h
index 827cb503cac6..49bc277424f8 100644
--- a/drivers/dma/ioatdma_registers.h
+++ b/drivers/dma/ioatdma_registers.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. 2 * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free 5 * under the terms of the GNU General Public License as published by the Free
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index ea5440dd10dc..16adbe61cfb2 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -928,19 +928,19 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device)
928 928
929 for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { 929 for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
930 xor_srcs[src_idx] = alloc_page(GFP_KERNEL); 930 xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
931 if (!xor_srcs[src_idx]) 931 if (!xor_srcs[src_idx]) {
932 while (src_idx--) { 932 while (src_idx--)
933 __free_page(xor_srcs[src_idx]); 933 __free_page(xor_srcs[src_idx]);
934 return -ENOMEM; 934 return -ENOMEM;
935 } 935 }
936 } 936 }
937 937
938 dest = alloc_page(GFP_KERNEL); 938 dest = alloc_page(GFP_KERNEL);
939 if (!dest) 939 if (!dest) {
940 while (src_idx--) { 940 while (src_idx--)
941 __free_page(xor_srcs[src_idx]); 941 __free_page(xor_srcs[src_idx]);
942 return -ENOMEM; 942 return -ENOMEM;
943 } 943 }
944 944
945 /* Fill in src buffers */ 945 /* Fill in src buffers */
946 for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { 946 for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
@@ -1401,7 +1401,7 @@ MODULE_ALIAS("platform:iop-adma");
1401 1401
1402static struct platform_driver iop_adma_driver = { 1402static struct platform_driver iop_adma_driver = {
1403 .probe = iop_adma_probe, 1403 .probe = iop_adma_probe,
1404 .remove = iop_adma_remove, 1404 .remove = __devexit_p(iop_adma_remove),
1405 .driver = { 1405 .driver = {
1406 .owner = THIS_MODULE, 1406 .owner = THIS_MODULE,
1407 .name = "iop-adma", 1407 .name = "iop-adma",
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index 1f154d08e98f..ae50a9d1a4e6 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -729,7 +729,7 @@ static int ipu_init_channel_buffer(struct idmac_channel *ichan,
729 729
730 ichan->status = IPU_CHANNEL_READY; 730 ichan->status = IPU_CHANNEL_READY;
731 731
732 spin_unlock_irqrestore(ipu->lock, flags); 732 spin_unlock_irqrestore(&ipu->lock, flags);
733 733
734 return 0; 734 return 0;
735} 735}
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index d35cbd1ff0b3..cb7f26fb9f18 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1019,19 +1019,19 @@ mv_xor_xor_self_test(struct mv_xor_device *device)
1019 1019
1020 for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) { 1020 for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
1021 xor_srcs[src_idx] = alloc_page(GFP_KERNEL); 1021 xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
1022 if (!xor_srcs[src_idx]) 1022 if (!xor_srcs[src_idx]) {
1023 while (src_idx--) { 1023 while (src_idx--)
1024 __free_page(xor_srcs[src_idx]); 1024 __free_page(xor_srcs[src_idx]);
1025 return -ENOMEM; 1025 return -ENOMEM;
1026 } 1026 }
1027 } 1027 }
1028 1028
1029 dest = alloc_page(GFP_KERNEL); 1029 dest = alloc_page(GFP_KERNEL);
1030 if (!dest) 1030 if (!dest) {
1031 while (src_idx--) { 1031 while (src_idx--)
1032 __free_page(xor_srcs[src_idx]); 1032 __free_page(xor_srcs[src_idx]);
1033 return -ENOMEM; 1033 return -ENOMEM;
1034 } 1034 }
1035 1035
1036 /* Fill in src buffers */ 1036 /* Fill in src buffers */
1037 for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) { 1037 for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
@@ -1287,7 +1287,7 @@ mv_xor_conf_mbus_windows(struct mv_xor_shared_private *msp,
1287 1287
1288static struct platform_driver mv_xor_driver = { 1288static struct platform_driver mv_xor_driver = {
1289 .probe = mv_xor_probe, 1289 .probe = mv_xor_probe,
1290 .remove = mv_xor_remove, 1290 .remove = __devexit_p(mv_xor_remove),
1291 .driver = { 1291 .driver = {
1292 .owner = THIS_MODULE, 1292 .owner = THIS_MODULE,
1293 .name = MV_XOR_NAME, 1293 .name = MV_XOR_NAME,
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 261b9aa3f248..05aa2d406ac6 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/firmware/memmap.c 2 * linux/drivers/firmware/memmap.c
3 * Copyright (C) 2008 SUSE LINUX Products GmbH 3 * Copyright (C) 2008 SUSE LINUX Products GmbH
4 * by Bernhard Walle <bwalle@suse.de> 4 * by Bernhard Walle <bernhard.walle@gmx.de>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License v2.0 as published by 7 * it under the terms of the GNU General Public License v2.0 as published by
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4be3acbaaf9a..3a22eb9be378 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -80,18 +80,17 @@ config DRM_I915
80 XFree86 4.4 and above. If unsure, build this and i830 as modules and 80 XFree86 4.4 and above. If unsure, build this and i830 as modules and
81 the X server will load the correct one. 81 the X server will load the correct one.
82 82
83endchoice
84
85config DRM_I915_KMS 83config DRM_I915_KMS
86 bool "Enable modesetting on intel by default" 84 bool "Enable modesetting on intel by default"
87 depends on DRM_I915 85 depends on DRM_I915
88 help 86 help
89 Choose this option if you want kernel modesetting enabled by default, 87 Choose this option if you want kernel modesetting enabled by default,
90 and you have a new enough userspace to support this. Running old 88 and you have a new enough userspace to support this. Running old
91 userspaces with this enabled will cause pain. Note that this causes 89 userspaces with this enabled will cause pain. Note that this causes
92 the driver to bind to PCI devices, which precludes loading things 90 the driver to bind to PCI devices, which precludes loading things
93 like intelfb. 91 like intelfb.
94 92
93endchoice
95 94
96config DRM_MGA 95config DRM_MGA
97 tristate "Matrox g200/g400" 96 tristate "Matrox g200/g400"
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 72c667f9bee1..12715d3c078d 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -420,7 +420,7 @@ int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map)
420 dev->sigdata.lock = NULL; 420 dev->sigdata.lock = NULL;
421 master->lock.hw_lock = NULL; /* SHM removed */ 421 master->lock.hw_lock = NULL; /* SHM removed */
422 master->lock.file_priv = NULL; 422 master->lock.file_priv = NULL;
423 wake_up_interruptible(&master->lock.lock_queue); 423 wake_up_interruptible_all(&master->lock.lock_queue);
424 } 424 }
425 break; 425 break;
426 case _DRM_AGP: 426 case _DRM_AGP:
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index bfce0992fefb..94a768871734 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1741,9 +1741,8 @@ out:
1741 * RETURNS: 1741 * RETURNS:
1742 * Zero on success, errno on failure. 1742 * Zero on success, errno on failure.
1743 */ 1743 */
1744void drm_fb_release(struct file *filp) 1744void drm_fb_release(struct drm_file *priv)
1745{ 1745{
1746 struct drm_file *priv = filp->private_data;
1747 struct drm_device *dev = priv->minor->dev; 1746 struct drm_device *dev = priv->minor->dev;
1748 struct drm_framebuffer *fb, *tfb; 1747 struct drm_framebuffer *fb, *tfb;
1749 1748
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 964c5eb1fada..1c3a8c557140 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -452,6 +452,59 @@ static void drm_setup_crtcs(struct drm_device *dev)
452 kfree(modes); 452 kfree(modes);
453 kfree(enabled); 453 kfree(enabled);
454} 454}
455
456/**
457 * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
458 * @encoder: encoder to test
459 * @crtc: crtc to test
460 *
461 * Return false if @encoder can't be driven by @crtc, true otherwise.
462 */
463static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
464 struct drm_crtc *crtc)
465{
466 struct drm_device *dev;
467 struct drm_crtc *tmp;
468 int crtc_mask = 1;
469
470 WARN(!crtc, "checking null crtc?");
471
472 dev = crtc->dev;
473
474 list_for_each_entry(tmp, &dev->mode_config.crtc_list, head) {
475 if (tmp == crtc)
476 break;
477 crtc_mask <<= 1;
478 }
479
480 if (encoder->possible_crtcs & crtc_mask)
481 return true;
482 return false;
483}
484
485/*
486 * Check the CRTC we're going to map each output to vs. its current
487 * CRTC. If they don't match, we have to disable the output and the CRTC
488 * since the driver will have to re-route things.
489 */
490static void
491drm_crtc_prepare_encoders(struct drm_device *dev)
492{
493 struct drm_encoder_helper_funcs *encoder_funcs;
494 struct drm_encoder *encoder;
495
496 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
497 encoder_funcs = encoder->helper_private;
498 /* Disable unused encoders */
499 if (encoder->crtc == NULL)
500 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
501 /* Disable encoders whose CRTC is about to change */
502 if (encoder_funcs->get_crtc &&
503 encoder->crtc != (*encoder_funcs->get_crtc)(encoder))
504 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
505 }
506}
507
455/** 508/**
456 * drm_crtc_set_mode - set a mode 509 * drm_crtc_set_mode - set a mode
457 * @crtc: CRTC to program 510 * @crtc: CRTC to program
@@ -512,8 +565,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
512 if (drm_mode_equal(&saved_mode, &crtc->mode)) { 565 if (drm_mode_equal(&saved_mode, &crtc->mode)) {
513 if (saved_x != crtc->x || saved_y != crtc->y || 566 if (saved_x != crtc->x || saved_y != crtc->y ||
514 depth_changed || bpp_changed) { 567 depth_changed || bpp_changed) {
515 crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, 568 ret = !crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y,
516 old_fb); 569 old_fb);
517 goto done; 570 goto done;
518 } 571 }
519 } 572 }
@@ -547,12 +600,16 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
547 encoder_funcs->prepare(encoder); 600 encoder_funcs->prepare(encoder);
548 } 601 }
549 602
603 drm_crtc_prepare_encoders(dev);
604
550 crtc_funcs->prepare(crtc); 605 crtc_funcs->prepare(crtc);
551 606
552 /* Set up the DPLL and any encoders state that needs to adjust or depend 607 /* Set up the DPLL and any encoders state that needs to adjust or depend
553 * on the DPLL. 608 * on the DPLL.
554 */ 609 */
555 crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb); 610 ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb);
611 if (!ret)
612 goto done;
556 613
557 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 614 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
558 615
@@ -615,7 +672,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
615 struct drm_device *dev; 672 struct drm_device *dev;
616 struct drm_crtc **save_crtcs, *new_crtc; 673 struct drm_crtc **save_crtcs, *new_crtc;
617 struct drm_encoder **save_encoders, *new_encoder; 674 struct drm_encoder **save_encoders, *new_encoder;
618 struct drm_framebuffer *old_fb; 675 struct drm_framebuffer *old_fb = NULL;
619 bool save_enabled; 676 bool save_enabled;
620 bool mode_changed = false; 677 bool mode_changed = false;
621 bool fb_changed = false; 678 bool fb_changed = false;
@@ -666,9 +723,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
666 * and then just flip_or_move it */ 723 * and then just flip_or_move it */
667 if (set->crtc->fb != set->fb) { 724 if (set->crtc->fb != set->fb) {
668 /* If we have no fb then treat it as a full mode set */ 725 /* If we have no fb then treat it as a full mode set */
669 if (set->crtc->fb == NULL) 726 if (set->crtc->fb == NULL) {
727 DRM_DEBUG("crtc has no fb, full mode set\n");
670 mode_changed = true; 728 mode_changed = true;
671 else if ((set->fb->bits_per_pixel != 729 } else if ((set->fb->bits_per_pixel !=
672 set->crtc->fb->bits_per_pixel) || 730 set->crtc->fb->bits_per_pixel) ||
673 set->fb->depth != set->crtc->fb->depth) 731 set->fb->depth != set->crtc->fb->depth)
674 fb_changed = true; 732 fb_changed = true;
@@ -680,7 +738,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
680 fb_changed = true; 738 fb_changed = true;
681 739
682 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { 740 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
683 DRM_DEBUG("modes are different\n"); 741 DRM_DEBUG("modes are different, full mode set\n");
684 drm_mode_debug_printmodeline(&set->crtc->mode); 742 drm_mode_debug_printmodeline(&set->crtc->mode);
685 drm_mode_debug_printmodeline(set->mode); 743 drm_mode_debug_printmodeline(set->mode);
686 mode_changed = true; 744 mode_changed = true;
@@ -706,6 +764,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
706 } 764 }
707 765
708 if (new_encoder != connector->encoder) { 766 if (new_encoder != connector->encoder) {
767 DRM_DEBUG("encoder changed, full mode switch\n");
709 mode_changed = true; 768 mode_changed = true;
710 connector->encoder = new_encoder; 769 connector->encoder = new_encoder;
711 } 770 }
@@ -732,10 +791,20 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
732 if (set->connectors[ro] == connector) 791 if (set->connectors[ro] == connector)
733 new_crtc = set->crtc; 792 new_crtc = set->crtc;
734 } 793 }
794
795 /* Make sure the new CRTC will work with the encoder */
796 if (new_crtc &&
797 !drm_encoder_crtc_ok(connector->encoder, new_crtc)) {
798 ret = -EINVAL;
799 goto fail_set_mode;
800 }
735 if (new_crtc != connector->encoder->crtc) { 801 if (new_crtc != connector->encoder->crtc) {
802 DRM_DEBUG("crtc changed, full mode switch\n");
736 mode_changed = true; 803 mode_changed = true;
737 connector->encoder->crtc = new_crtc; 804 connector->encoder->crtc = new_crtc;
738 } 805 }
806 DRM_DEBUG("setting connector %d crtc to %p\n",
807 connector->base.id, new_crtc);
739 } 808 }
740 809
741 /* mode_set_base is not a required function */ 810 /* mode_set_base is not a required function */
@@ -752,6 +821,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
752 if (!drm_crtc_helper_set_mode(set->crtc, set->mode, 821 if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
753 set->x, set->y, 822 set->x, set->y,
754 old_fb)) { 823 old_fb)) {
824 DRM_ERROR("failed to set mode on crtc %p\n",
825 set->crtc);
755 ret = -EINVAL; 826 ret = -EINVAL;
756 goto fail_set_mode; 827 goto fail_set_mode;
757 } 828 }
@@ -765,7 +836,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
765 old_fb = set->crtc->fb; 836 old_fb = set->crtc->fb;
766 if (set->crtc->fb != set->fb) 837 if (set->crtc->fb != set->fb)
767 set->crtc->fb = set->fb; 838 set->crtc->fb = set->fb;
768 crtc_funcs->mode_set_base(set->crtc, set->x, set->y, old_fb); 839 ret = crtc_funcs->mode_set_base(set->crtc,
840 set->x, set->y, old_fb);
841 if (ret != 0)
842 goto fail_set_mode;
769 } 843 }
770 844
771 kfree(save_encoders); 845 kfree(save_encoders);
@@ -774,9 +848,14 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
774 848
775fail_set_mode: 849fail_set_mode:
776 set->crtc->enabled = save_enabled; 850 set->crtc->enabled = save_enabled;
851 set->crtc->fb = old_fb;
777 count = 0; 852 count = 0;
778 list_for_each_entry(connector, &dev->mode_config.connector_list, head) 853 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
854 if (!connector->encoder)
855 continue;
856
779 connector->encoder->crtc = save_crtcs[count++]; 857 connector->encoder->crtc = save_crtcs[count++];
858 }
780fail_no_encoder: 859fail_no_encoder:
781 kfree(save_crtcs); 860 kfree(save_crtcs);
782 count = 0; 861 count = 0;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5a4d3244758a..a839a28d8ee6 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -125,7 +125,7 @@ static bool edid_is_valid(struct edid *edid)
125 DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); 125 DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version);
126 goto bad; 126 goto bad;
127 } 127 }
128 if (edid->revision <= 0 || edid->revision > 3) { 128 if (edid->revision > 3) {
129 DRM_ERROR("EDID has minor version %d, which is not between 0-3\n", edid->revision); 129 DRM_ERROR("EDID has minor version %d, which is not between 0-3\n", edid->revision);
130 goto bad; 130 goto bad;
131 } 131 }
@@ -320,10 +320,10 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
320 mode->htotal = mode->hdisplay + ((pt->hblank_hi << 8) | pt->hblank_lo); 320 mode->htotal = mode->hdisplay + ((pt->hblank_hi << 8) | pt->hblank_lo);
321 321
322 mode->vdisplay = (pt->vactive_hi << 8) | pt->vactive_lo; 322 mode->vdisplay = (pt->vactive_hi << 8) | pt->vactive_lo;
323 mode->vsync_start = mode->vdisplay + ((pt->vsync_offset_hi << 8) | 323 mode->vsync_start = mode->vdisplay + ((pt->vsync_offset_hi << 4) |
324 pt->vsync_offset_lo); 324 pt->vsync_offset_lo);
325 mode->vsync_end = mode->vsync_start + 325 mode->vsync_end = mode->vsync_start +
326 ((pt->vsync_pulse_width_hi << 8) | 326 ((pt->vsync_pulse_width_hi << 4) |
327 pt->vsync_pulse_width_lo); 327 pt->vsync_pulse_width_lo);
328 mode->vtotal = mode->vdisplay + ((pt->vblank_hi << 8) | pt->vblank_lo); 328 mode->vtotal = mode->vdisplay + ((pt->vblank_hi << 8) | pt->vblank_lo);
329 329
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index b06a53715853..f52663ebe016 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -457,6 +457,9 @@ int drm_release(struct inode *inode, struct file *filp)
457 if (dev->driver->driver_features & DRIVER_GEM) 457 if (dev->driver->driver_features & DRIVER_GEM)
458 drm_gem_release(dev, file_priv); 458 drm_gem_release(dev, file_priv);
459 459
460 if (dev->driver->driver_features & DRIVER_MODESET)
461 drm_fb_release(file_priv);
462
460 mutex_lock(&dev->ctxlist_mutex); 463 mutex_lock(&dev->ctxlist_mutex);
461 if (!list_empty(&dev->ctxlist)) { 464 if (!list_empty(&dev->ctxlist)) {
462 struct drm_ctx_list *pos, *n; 465 struct drm_ctx_list *pos, *n;
@@ -481,6 +484,7 @@ int drm_release(struct inode *inode, struct file *filp)
481 mutex_lock(&dev->struct_mutex); 484 mutex_lock(&dev->struct_mutex);
482 485
483 if (file_priv->is_master) { 486 if (file_priv->is_master) {
487 struct drm_master *master = file_priv->master;
484 struct drm_file *temp; 488 struct drm_file *temp;
485 list_for_each_entry(temp, &dev->filelist, lhead) { 489 list_for_each_entry(temp, &dev->filelist, lhead) {
486 if ((temp->master == file_priv->master) && 490 if ((temp->master == file_priv->master) &&
@@ -488,6 +492,19 @@ int drm_release(struct inode *inode, struct file *filp)
488 temp->authenticated = 0; 492 temp->authenticated = 0;
489 } 493 }
490 494
495 /**
496 * Since the master is disappearing, so is the
497 * possibility to lock.
498 */
499
500 if (master->lock.hw_lock) {
501 if (dev->sigdata.lock == master->lock.hw_lock)
502 dev->sigdata.lock = NULL;
503 master->lock.hw_lock = NULL;
504 master->lock.file_priv = NULL;
505 wake_up_interruptible_all(&master->lock.lock_queue);
506 }
507
491 if (file_priv->minor->master == file_priv->master) { 508 if (file_priv->minor->master == file_priv->master) {
492 /* drop the reference held my the minor */ 509 /* drop the reference held my the minor */
493 drm_master_put(&file_priv->minor->master); 510 drm_master_put(&file_priv->minor->master);
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 6915fb82d0b0..88d3368ffddd 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -104,8 +104,8 @@ drm_gem_init(struct drm_device *dev)
104 104
105 if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START, 105 if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START,
106 DRM_FILE_PAGE_OFFSET_SIZE)) { 106 DRM_FILE_PAGE_OFFSET_SIZE)) {
107 drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM);
108 drm_ht_remove(&mm->offset_hash); 107 drm_ht_remove(&mm->offset_hash);
108 drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM);
109 return -ENOMEM; 109 return -ENOMEM;
110 } 110 }
111 111
@@ -295,35 +295,37 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
295 return -EBADF; 295 return -EBADF;
296 296
297again: 297again:
298 if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) 298 if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) {
299 return -ENOMEM; 299 ret = -ENOMEM;
300 goto err;
301 }
300 302
301 spin_lock(&dev->object_name_lock); 303 spin_lock(&dev->object_name_lock);
302 if (obj->name) { 304 if (!obj->name) {
303 args->name = obj->name; 305 ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
306 &obj->name);
307 args->name = (uint64_t) obj->name;
304 spin_unlock(&dev->object_name_lock); 308 spin_unlock(&dev->object_name_lock);
305 return 0;
306 }
307 ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
308 &obj->name);
309 spin_unlock(&dev->object_name_lock);
310 if (ret == -EAGAIN)
311 goto again;
312 309
313 if (ret != 0) { 310 if (ret == -EAGAIN)
314 mutex_lock(&dev->struct_mutex); 311 goto again;
315 drm_gem_object_unreference(obj);
316 mutex_unlock(&dev->struct_mutex);
317 return ret;
318 }
319 312
320 /* 313 if (ret != 0)
321 * Leave the reference from the lookup around as the 314 goto err;
322 * name table now holds one
323 */
324 args->name = (uint64_t) obj->name;
325 315
326 return 0; 316 /* Allocate a reference for the name table. */
317 drm_gem_object_reference(obj);
318 } else {
319 args->name = (uint64_t) obj->name;
320 spin_unlock(&dev->object_name_lock);
321 ret = 0;
322 }
323
324err:
325 mutex_lock(&dev->struct_mutex);
326 drm_gem_object_unreference(obj);
327 mutex_unlock(&dev->struct_mutex);
328 return ret;
327} 329}
328 330
329/** 331/**
@@ -448,6 +450,7 @@ drm_gem_object_handle_free(struct kref *kref)
448 spin_lock(&dev->object_name_lock); 450 spin_lock(&dev->object_name_lock);
449 if (obj->name) { 451 if (obj->name) {
450 idr_remove(&dev->object_name_idr, obj->name); 452 idr_remove(&dev->object_name_idr, obj->name);
453 obj->name = 0;
451 spin_unlock(&dev->object_name_lock); 454 spin_unlock(&dev->object_name_lock);
452 /* 455 /*
453 * The object name held a reference to this object, drop 456 * The object name held a reference to this object, drop
@@ -460,6 +463,26 @@ drm_gem_object_handle_free(struct kref *kref)
460} 463}
461EXPORT_SYMBOL(drm_gem_object_handle_free); 464EXPORT_SYMBOL(drm_gem_object_handle_free);
462 465
466void drm_gem_vm_open(struct vm_area_struct *vma)
467{
468 struct drm_gem_object *obj = vma->vm_private_data;
469
470 drm_gem_object_reference(obj);
471}
472EXPORT_SYMBOL(drm_gem_vm_open);
473
474void drm_gem_vm_close(struct vm_area_struct *vma)
475{
476 struct drm_gem_object *obj = vma->vm_private_data;
477 struct drm_device *dev = obj->dev;
478
479 mutex_lock(&dev->struct_mutex);
480 drm_gem_object_unreference(obj);
481 mutex_unlock(&dev->struct_mutex);
482}
483EXPORT_SYMBOL(drm_gem_vm_close);
484
485
463/** 486/**
464 * drm_gem_mmap - memory map routine for GEM objects 487 * drm_gem_mmap - memory map routine for GEM objects
465 * @filp: DRM file pointer 488 * @filp: DRM file pointer
@@ -521,6 +544,14 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
521#endif 544#endif
522 vma->vm_page_prot = __pgprot(prot); 545 vma->vm_page_prot = __pgprot(prot);
523 546
547 /* Take a ref for this mapping of the object, so that the fault
548 * handler can dereference the mmap offset's pointer to the object.
549 * This reference is cleaned up by the corresponding vm_close
550 * (which should happen whether the vma was created by this call, or
551 * by a vm_open due to mremap or partial unmap or whatever).
552 */
553 drm_gem_object_reference(obj);
554
524 vma->vm_file = filp; /* Needed for drm_vm_open() */ 555 vma->vm_file = filp; /* Needed for drm_vm_open() */
525 drm_vm_open_locked(vma); 556 drm_vm_open_locked(vma);
526 557
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 3795dbc0f50c..93e677a481f5 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -435,6 +435,8 @@ EXPORT_SYMBOL(drm_vblank_get);
435 */ 435 */
436void drm_vblank_put(struct drm_device *dev, int crtc) 436void drm_vblank_put(struct drm_device *dev, int crtc)
437{ 437{
438 BUG_ON (atomic_read (&dev->vblank_refcount[crtc]) == 0);
439
438 /* Last user schedules interrupt disable */ 440 /* Last user schedules interrupt disable */
439 if (atomic_dec_and_test(&dev->vblank_refcount[crtc])) 441 if (atomic_dec_and_test(&dev->vblank_refcount[crtc]))
440 mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ); 442 mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ);
@@ -460,8 +462,9 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
460 * so that interrupts remain enabled in the interim. 462 * so that interrupts remain enabled in the interim.
461 */ 463 */
462 if (!dev->vblank_inmodeset[crtc]) { 464 if (!dev->vblank_inmodeset[crtc]) {
463 dev->vblank_inmodeset[crtc] = 1; 465 dev->vblank_inmodeset[crtc] = 0x1;
464 drm_vblank_get(dev, crtc); 466 if (drm_vblank_get(dev, crtc) == 0)
467 dev->vblank_inmodeset[crtc] |= 0x2;
465 } 468 }
466} 469}
467EXPORT_SYMBOL(drm_vblank_pre_modeset); 470EXPORT_SYMBOL(drm_vblank_pre_modeset);
@@ -473,9 +476,12 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)
473 if (dev->vblank_inmodeset[crtc]) { 476 if (dev->vblank_inmodeset[crtc]) {
474 spin_lock_irqsave(&dev->vbl_lock, irqflags); 477 spin_lock_irqsave(&dev->vbl_lock, irqflags);
475 dev->vblank_disable_allowed = 1; 478 dev->vblank_disable_allowed = 1;
476 dev->vblank_inmodeset[crtc] = 0;
477 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 479 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
478 drm_vblank_put(dev, crtc); 480
481 if (dev->vblank_inmodeset[crtc] & 0x2)
482 drm_vblank_put(dev, crtc);
483
484 dev->vblank_inmodeset[crtc] = 0;
479 } 485 }
480} 486}
481EXPORT_SYMBOL(drm_vblank_post_modeset); 487EXPORT_SYMBOL(drm_vblank_post_modeset);
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 46e7b28f0707..e2f70a516c34 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -80,6 +80,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
80 __set_current_state(TASK_INTERRUPTIBLE); 80 __set_current_state(TASK_INTERRUPTIBLE);
81 if (!master->lock.hw_lock) { 81 if (!master->lock.hw_lock) {
82 /* Device has been unregistered */ 82 /* Device has been unregistered */
83 send_sig(SIGTERM, current, 0);
83 ret = -EINTR; 84 ret = -EINTR;
84 break; 85 break;
85 } 86 }
@@ -93,7 +94,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
93 /* Contention */ 94 /* Contention */
94 schedule(); 95 schedule();
95 if (signal_pending(current)) { 96 if (signal_pending(current)) {
96 ret = -ERESTARTSYS; 97 ret = -EINTR;
97 break; 98 break;
98 } 99 }
99 } 100 }
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 46bb923b097c..7c8b15b22bf2 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -146,14 +146,6 @@ static void drm_master_destroy(struct kref *kref)
146 146
147 drm_ht_remove(&master->magiclist); 147 drm_ht_remove(&master->magiclist);
148 148
149 if (master->lock.hw_lock) {
150 if (dev->sigdata.lock == master->lock.hw_lock)
151 dev->sigdata.lock = NULL;
152 master->lock.hw_lock = NULL;
153 master->lock.file_priv = NULL;
154 wake_up_interruptible(&master->lock.lock_queue);
155 }
156
157 drm_free(master, sizeof(*master), DRM_MEM_DRIVER); 149 drm_free(master, sizeof(*master), DRM_MEM_DRIVER);
158} 150}
159 151
@@ -176,7 +168,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
176 file_priv->minor->master != file_priv->master) { 168 file_priv->minor->master != file_priv->master) {
177 mutex_lock(&dev->struct_mutex); 169 mutex_lock(&dev->struct_mutex);
178 file_priv->minor->master = drm_master_get(file_priv->master); 170 file_priv->minor->master = drm_master_get(file_priv->master);
179 mutex_lock(&dev->struct_mutex); 171 mutex_unlock(&dev->struct_mutex);
180 } 172 }
181 173
182 return 0; 174 return 0;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 81f1cff56fd5..6d21b9e48b89 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -202,7 +202,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
202 dev_priv->ring.map.flags = 0; 202 dev_priv->ring.map.flags = 0;
203 dev_priv->ring.map.mtrr = 0; 203 dev_priv->ring.map.mtrr = 0;
204 204
205 drm_core_ioremap(&dev_priv->ring.map, dev); 205 drm_core_ioremap_wc(&dev_priv->ring.map, dev);
206 206
207 if (dev_priv->ring.map.handle == NULL) { 207 if (dev_priv->ring.map.handle == NULL) {
208 i915_dma_cleanup(dev); 208 i915_dma_cleanup(dev);
@@ -811,7 +811,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
811 dev_priv->hws_map.flags = 0; 811 dev_priv->hws_map.flags = 0;
812 dev_priv->hws_map.mtrr = 0; 812 dev_priv->hws_map.mtrr = 0;
813 813
814 drm_core_ioremap(&dev_priv->hws_map, dev); 814 drm_core_ioremap_wc(&dev_priv->hws_map, dev);
815 if (dev_priv->hws_map.handle == NULL) { 815 if (dev_priv->hws_map.handle == NULL) {
816 i915_dma_cleanup(dev); 816 i915_dma_cleanup(dev);
817 dev_priv->status_gfx_addr = 0; 817 dev_priv->status_gfx_addr = 0;
@@ -1090,6 +1090,11 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1090 dev_priv->mm.gtt_mapping = 1090 dev_priv->mm.gtt_mapping =
1091 io_mapping_create_wc(dev->agp->base, 1091 io_mapping_create_wc(dev->agp->base,
1092 dev->agp->agp_info.aper_size * 1024*1024); 1092 dev->agp->agp_info.aper_size * 1024*1024);
1093 if (dev_priv->mm.gtt_mapping == NULL) {
1094 ret = -EIO;
1095 goto out_rmmap;
1096 }
1097
1093 /* Set up a WC MTRR for non-PAT systems. This is more common than 1098 /* Set up a WC MTRR for non-PAT systems. This is more common than
1094 * one would think, because the kernel disables PAT on first 1099 * one would think, because the kernel disables PAT on first
1095 * generation Core chips because WC PAT gets overridden by a UC 1100 * generation Core chips because WC PAT gets overridden by a UC
@@ -1100,7 +1105,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1100 1024 * 1024, 1105 1024 * 1024,
1101 MTRR_TYPE_WRCOMB, 1); 1106 MTRR_TYPE_WRCOMB, 1);
1102 if (dev_priv->mm.gtt_mtrr < 0) { 1107 if (dev_priv->mm.gtt_mtrr < 0) {
1103 DRM_INFO("MTRR allocation failed\n. Graphics " 1108 DRM_INFO("MTRR allocation failed. Graphics "
1104 "performance may suffer.\n"); 1109 "performance may suffer.\n");
1105 } 1110 }
1106 1111
@@ -1122,7 +1127,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1122 if (!I915_NEED_GFX_HWS(dev)) { 1127 if (!I915_NEED_GFX_HWS(dev)) {
1123 ret = i915_init_phys_hws(dev); 1128 ret = i915_init_phys_hws(dev);
1124 if (ret != 0) 1129 if (ret != 0)
1125 goto out_rmmap; 1130 goto out_iomapfree;
1126 } 1131 }
1127 1132
1128 /* On the 945G/GM, the chipset reports the MSI capability on the 1133 /* On the 945G/GM, the chipset reports the MSI capability on the
@@ -1161,6 +1166,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1161 1166
1162 return 0; 1167 return 0;
1163 1168
1169out_iomapfree:
1170 io_mapping_free(dev_priv->mm.gtt_mapping);
1164out_rmmap: 1171out_rmmap:
1165 iounmap(dev_priv->regs); 1172 iounmap(dev_priv->regs);
1166free_priv: 1173free_priv:
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index aac12ee31a46..b293ef0bae71 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -27,6 +27,7 @@
27 * 27 *
28 */ 28 */
29 29
30#include <linux/device.h>
30#include "drmP.h" 31#include "drmP.h"
31#include "drm.h" 32#include "drm.h"
32#include "i915_drm.h" 33#include "i915_drm.h"
@@ -66,6 +67,14 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
66 67
67 i915_save_state(dev); 68 i915_save_state(dev);
68 69
70 /* If KMS is active, we do the leavevt stuff here */
71 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
72 if (i915_gem_idle(dev))
73 dev_err(&dev->pdev->dev,
74 "GEM idle failed, resume may fail\n");
75 drm_irq_uninstall(dev);
76 }
77
69 intel_opregion_free(dev); 78 intel_opregion_free(dev);
70 79
71 if (state.event == PM_EVENT_SUSPEND) { 80 if (state.event == PM_EVENT_SUSPEND) {
@@ -79,6 +88,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
79 88
80static int i915_resume(struct drm_device *dev) 89static int i915_resume(struct drm_device *dev)
81{ 90{
91 struct drm_i915_private *dev_priv = dev->dev_private;
92 int ret = 0;
93
82 pci_set_power_state(dev->pdev, PCI_D0); 94 pci_set_power_state(dev->pdev, PCI_D0);
83 pci_restore_state(dev->pdev); 95 pci_restore_state(dev->pdev);
84 if (pci_enable_device(dev->pdev)) 96 if (pci_enable_device(dev->pdev))
@@ -89,11 +101,26 @@ static int i915_resume(struct drm_device *dev)
89 101
90 intel_opregion_init(dev); 102 intel_opregion_init(dev);
91 103
92 return 0; 104 /* KMS EnterVT equivalent */
105 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
106 mutex_lock(&dev->struct_mutex);
107 dev_priv->mm.suspended = 0;
108
109 ret = i915_gem_init_ringbuffer(dev);
110 if (ret != 0)
111 ret = -1;
112 mutex_unlock(&dev->struct_mutex);
113
114 drm_irq_install(dev);
115 }
116
117 return ret;
93} 118}
94 119
95static struct vm_operations_struct i915_gem_vm_ops = { 120static struct vm_operations_struct i915_gem_vm_ops = {
96 .fault = i915_gem_fault, 121 .fault = i915_gem_fault,
122 .open = drm_gem_vm_open,
123 .close = drm_gem_vm_close,
97}; 124};
98 125
99static struct drm_driver driver = { 126static struct drm_driver driver = {
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7325363164f8..d6cc9861e0a1 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -184,6 +184,8 @@ typedef struct drm_i915_private {
184 unsigned int lvds_dither:1; 184 unsigned int lvds_dither:1;
185 unsigned int lvds_vbt:1; 185 unsigned int lvds_vbt:1;
186 unsigned int int_crt_support:1; 186 unsigned int int_crt_support:1;
187 unsigned int lvds_use_ssc:1;
188 int lvds_ssc_freq;
187 189
188 struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ 190 struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */
189 int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ 191 int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
@@ -277,7 +279,6 @@ typedef struct drm_i915_private {
277 u8 saveAR_INDEX; 279 u8 saveAR_INDEX;
278 u8 saveAR[21]; 280 u8 saveAR[21];
279 u8 saveDACMASK; 281 u8 saveDACMASK;
280 u8 saveDACDATA[256*3]; /* 256 3-byte colors */
281 u8 saveCR[37]; 282 u8 saveCR[37];
282 283
283 struct { 284 struct {
@@ -455,6 +456,12 @@ struct drm_i915_gem_object {
455 456
456 /** for phy allocated objects */ 457 /** for phy allocated objects */
457 struct drm_i915_gem_phys_object *phys_obj; 458 struct drm_i915_gem_phys_object *phys_obj;
459
460 /**
461 * Used for checking the object doesn't appear more than once
462 * in an execbuffer object list.
463 */
464 int in_execbuffer;
458}; 465};
459 466
460/** 467/**
@@ -616,6 +623,7 @@ int i915_gem_init_ringbuffer(struct drm_device *dev);
616void i915_gem_cleanup_ringbuffer(struct drm_device *dev); 623void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
617int i915_gem_do_init(struct drm_device *dev, unsigned long start, 624int i915_gem_do_init(struct drm_device *dev, unsigned long start,
618 unsigned long end); 625 unsigned long end);
626int i915_gem_idle(struct drm_device *dev);
619int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); 627int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
620int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, 628int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
621 int write); 629 int write);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 818576654092..37427e4016cb 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -34,10 +34,6 @@
34 34
35#define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT)) 35#define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
36 36
37static void
38i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
39 uint32_t read_domains,
40 uint32_t write_domain);
41static void i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj); 37static void i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj);
42static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj); 38static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj);
43static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj); 39static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj);
@@ -607,8 +603,6 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
607 case -EAGAIN: 603 case -EAGAIN:
608 return VM_FAULT_OOM; 604 return VM_FAULT_OOM;
609 case -EFAULT: 605 case -EFAULT:
610 case -EBUSY:
611 DRM_ERROR("can't insert pfn?? fault or busy...\n");
612 return VM_FAULT_SIGBUS; 606 return VM_FAULT_SIGBUS;
613 default: 607 default:
614 return VM_FAULT_NOPAGE; 608 return VM_FAULT_NOPAGE;
@@ -684,6 +678,30 @@ out_free_list:
684 return ret; 678 return ret;
685} 679}
686 680
681static void
682i915_gem_free_mmap_offset(struct drm_gem_object *obj)
683{
684 struct drm_device *dev = obj->dev;
685 struct drm_i915_gem_object *obj_priv = obj->driver_private;
686 struct drm_gem_mm *mm = dev->mm_private;
687 struct drm_map_list *list;
688
689 list = &obj->map_list;
690 drm_ht_remove_item(&mm->offset_hash, &list->hash);
691
692 if (list->file_offset_node) {
693 drm_mm_put_block(list->file_offset_node);
694 list->file_offset_node = NULL;
695 }
696
697 if (list->map) {
698 drm_free(list->map, sizeof(struct drm_map), DRM_MEM_DRIVER);
699 list->map = NULL;
700 }
701
702 obj_priv->mmap_offset = 0;
703}
704
687/** 705/**
688 * i915_gem_get_gtt_alignment - return required GTT alignment for an object 706 * i915_gem_get_gtt_alignment - return required GTT alignment for an object
689 * @obj: object to check 707 * @obj: object to check
@@ -758,8 +776,11 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
758 776
759 if (!obj_priv->mmap_offset) { 777 if (!obj_priv->mmap_offset) {
760 ret = i915_gem_create_mmap_offset(obj); 778 ret = i915_gem_create_mmap_offset(obj);
761 if (ret) 779 if (ret) {
780 drm_gem_object_unreference(obj);
781 mutex_unlock(&dev->struct_mutex);
762 return ret; 782 return ret;
783 }
763 } 784 }
764 785
765 args->offset = obj_priv->mmap_offset; 786 args->offset = obj_priv->mmap_offset;
@@ -1030,6 +1051,9 @@ i915_gem_retire_requests(struct drm_device *dev)
1030 drm_i915_private_t *dev_priv = dev->dev_private; 1051 drm_i915_private_t *dev_priv = dev->dev_private;
1031 uint32_t seqno; 1052 uint32_t seqno;
1032 1053
1054 if (!dev_priv->hw_status_page)
1055 return;
1056
1033 seqno = i915_get_gem_seqno(dev); 1057 seqno = i915_get_gem_seqno(dev);
1034 1058
1035 while (!list_empty(&dev_priv->mm.request_list)) { 1059 while (!list_empty(&dev_priv->mm.request_list)) {
@@ -1452,7 +1476,7 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
1452 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1476 struct drm_i915_gem_object *obj_priv = obj->driver_private;
1453 int regnum = obj_priv->fence_reg; 1477 int regnum = obj_priv->fence_reg;
1454 int tile_width; 1478 int tile_width;
1455 uint32_t val; 1479 uint32_t fence_reg, val;
1456 uint32_t pitch_val; 1480 uint32_t pitch_val;
1457 1481
1458 if ((obj_priv->gtt_offset & ~I915_FENCE_START_MASK) || 1482 if ((obj_priv->gtt_offset & ~I915_FENCE_START_MASK) ||
@@ -1479,7 +1503,11 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
1479 val |= pitch_val << I830_FENCE_PITCH_SHIFT; 1503 val |= pitch_val << I830_FENCE_PITCH_SHIFT;
1480 val |= I830_FENCE_REG_VALID; 1504 val |= I830_FENCE_REG_VALID;
1481 1505
1482 I915_WRITE(FENCE_REG_830_0 + (regnum * 4), val); 1506 if (regnum < 8)
1507 fence_reg = FENCE_REG_830_0 + (regnum * 4);
1508 else
1509 fence_reg = FENCE_REG_945_8 + ((regnum - 8) * 4);
1510 I915_WRITE(fence_reg, val);
1483} 1511}
1484 1512
1485static void i830_write_fence_reg(struct drm_i915_fence_reg *reg) 1513static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
@@ -1533,7 +1561,8 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj, bool write)
1533 struct drm_i915_private *dev_priv = dev->dev_private; 1561 struct drm_i915_private *dev_priv = dev->dev_private;
1534 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1562 struct drm_i915_gem_object *obj_priv = obj->driver_private;
1535 struct drm_i915_fence_reg *reg = NULL; 1563 struct drm_i915_fence_reg *reg = NULL;
1536 int i, ret; 1564 struct drm_i915_gem_object *old_obj_priv = NULL;
1565 int i, ret, avail;
1537 1566
1538 switch (obj_priv->tiling_mode) { 1567 switch (obj_priv->tiling_mode) {
1539 case I915_TILING_NONE: 1568 case I915_TILING_NONE:
@@ -1556,25 +1585,46 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj, bool write)
1556 } 1585 }
1557 1586
1558 /* First try to find a free reg */ 1587 /* First try to find a free reg */
1588try_again:
1589 avail = 0;
1559 for (i = dev_priv->fence_reg_start; i < dev_priv->num_fence_regs; i++) { 1590 for (i = dev_priv->fence_reg_start; i < dev_priv->num_fence_regs; i++) {
1560 reg = &dev_priv->fence_regs[i]; 1591 reg = &dev_priv->fence_regs[i];
1561 if (!reg->obj) 1592 if (!reg->obj)
1562 break; 1593 break;
1594
1595 old_obj_priv = reg->obj->driver_private;
1596 if (!old_obj_priv->pin_count)
1597 avail++;
1563 } 1598 }
1564 1599
1565 /* None available, try to steal one or wait for a user to finish */ 1600 /* None available, try to steal one or wait for a user to finish */
1566 if (i == dev_priv->num_fence_regs) { 1601 if (i == dev_priv->num_fence_regs) {
1567 struct drm_i915_gem_object *old_obj_priv = NULL; 1602 uint32_t seqno = dev_priv->mm.next_gem_seqno;
1568 loff_t offset; 1603 loff_t offset;
1569 1604
1570try_again: 1605 if (avail == 0)
1571 /* Could try to use LRU here instead... */ 1606 return -ENOMEM;
1607
1572 for (i = dev_priv->fence_reg_start; 1608 for (i = dev_priv->fence_reg_start;
1573 i < dev_priv->num_fence_regs; i++) { 1609 i < dev_priv->num_fence_regs; i++) {
1610 uint32_t this_seqno;
1611
1574 reg = &dev_priv->fence_regs[i]; 1612 reg = &dev_priv->fence_regs[i];
1575 old_obj_priv = reg->obj->driver_private; 1613 old_obj_priv = reg->obj->driver_private;
1576 if (!old_obj_priv->pin_count) 1614
1615 if (old_obj_priv->pin_count)
1616 continue;
1617
1618 /* i915 uses fences for GPU access to tiled buffers */
1619 if (IS_I965G(dev) || !old_obj_priv->active)
1577 break; 1620 break;
1621
1622 /* find the seqno of the first available fence */
1623 this_seqno = old_obj_priv->last_rendering_seqno;
1624 if (this_seqno != 0 &&
1625 reg->obj->write_domain == 0 &&
1626 i915_seqno_passed(seqno, this_seqno))
1627 seqno = this_seqno;
1578 } 1628 }
1579 1629
1580 /* 1630 /*
@@ -1582,15 +1632,25 @@ try_again:
1582 * objects to finish before trying again. 1632 * objects to finish before trying again.
1583 */ 1633 */
1584 if (i == dev_priv->num_fence_regs) { 1634 if (i == dev_priv->num_fence_regs) {
1585 ret = i915_gem_object_set_to_gtt_domain(reg->obj, 0); 1635 if (seqno == dev_priv->mm.next_gem_seqno) {
1586 if (ret) { 1636 i915_gem_flush(dev,
1587 WARN(ret != -ERESTARTSYS, 1637 I915_GEM_GPU_DOMAINS,
1588 "switch to GTT domain failed: %d\n", ret); 1638 I915_GEM_GPU_DOMAINS);
1589 return ret; 1639 seqno = i915_add_request(dev,
1640 I915_GEM_GPU_DOMAINS);
1641 if (seqno == 0)
1642 return -ENOMEM;
1590 } 1643 }
1644
1645 ret = i915_wait_request(dev, seqno);
1646 if (ret)
1647 return ret;
1591 goto try_again; 1648 goto try_again;
1592 } 1649 }
1593 1650
1651 BUG_ON(old_obj_priv->active ||
1652 (reg->obj->write_domain & I915_GEM_GPU_DOMAINS));
1653
1594 /* 1654 /*
1595 * Zap this virtual mapping so we can set up a fence again 1655 * Zap this virtual mapping so we can set up a fence again
1596 * for this object next time we need it. 1656 * for this object next time we need it.
@@ -1631,8 +1691,17 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj)
1631 1691
1632 if (IS_I965G(dev)) 1692 if (IS_I965G(dev))
1633 I915_WRITE64(FENCE_REG_965_0 + (obj_priv->fence_reg * 8), 0); 1693 I915_WRITE64(FENCE_REG_965_0 + (obj_priv->fence_reg * 8), 0);
1634 else 1694 else {
1635 I915_WRITE(FENCE_REG_830_0 + (obj_priv->fence_reg * 4), 0); 1695 uint32_t fence_reg;
1696
1697 if (obj_priv->fence_reg < 8)
1698 fence_reg = FENCE_REG_830_0 + obj_priv->fence_reg * 4;
1699 else
1700 fence_reg = FENCE_REG_945_8 + (obj_priv->fence_reg -
1701 8) * 4;
1702
1703 I915_WRITE(fence_reg, 0);
1704 }
1636 1705
1637 dev_priv->fence_regs[obj_priv->fence_reg].obj = NULL; 1706 dev_priv->fence_regs[obj_priv->fence_reg].obj = NULL;
1638 obj_priv->fence_reg = I915_FENCE_REG_NONE; 1707 obj_priv->fence_reg = I915_FENCE_REG_NONE;
@@ -1996,30 +2065,28 @@ i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, int write)
1996 * drm_agp_chipset_flush 2065 * drm_agp_chipset_flush
1997 */ 2066 */
1998static void 2067static void
1999i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj, 2068i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
2000 uint32_t read_domains,
2001 uint32_t write_domain)
2002{ 2069{
2003 struct drm_device *dev = obj->dev; 2070 struct drm_device *dev = obj->dev;
2004 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2071 struct drm_i915_gem_object *obj_priv = obj->driver_private;
2005 uint32_t invalidate_domains = 0; 2072 uint32_t invalidate_domains = 0;
2006 uint32_t flush_domains = 0; 2073 uint32_t flush_domains = 0;
2007 2074
2008 BUG_ON(read_domains & I915_GEM_DOMAIN_CPU); 2075 BUG_ON(obj->pending_read_domains & I915_GEM_DOMAIN_CPU);
2009 BUG_ON(write_domain == I915_GEM_DOMAIN_CPU); 2076 BUG_ON(obj->pending_write_domain == I915_GEM_DOMAIN_CPU);
2010 2077
2011#if WATCH_BUF 2078#if WATCH_BUF
2012 DRM_INFO("%s: object %p read %08x -> %08x write %08x -> %08x\n", 2079 DRM_INFO("%s: object %p read %08x -> %08x write %08x -> %08x\n",
2013 __func__, obj, 2080 __func__, obj,
2014 obj->read_domains, read_domains, 2081 obj->read_domains, obj->pending_read_domains,
2015 obj->write_domain, write_domain); 2082 obj->write_domain, obj->pending_write_domain);
2016#endif 2083#endif
2017 /* 2084 /*
2018 * If the object isn't moving to a new write domain, 2085 * If the object isn't moving to a new write domain,
2019 * let the object stay in multiple read domains 2086 * let the object stay in multiple read domains
2020 */ 2087 */
2021 if (write_domain == 0) 2088 if (obj->pending_write_domain == 0)
2022 read_domains |= obj->read_domains; 2089 obj->pending_read_domains |= obj->read_domains;
2023 else 2090 else
2024 obj_priv->dirty = 1; 2091 obj_priv->dirty = 1;
2025 2092
@@ -2029,15 +2096,17 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
2029 * any read domains which differ from the old 2096 * any read domains which differ from the old
2030 * write domain 2097 * write domain
2031 */ 2098 */
2032 if (obj->write_domain && obj->write_domain != read_domains) { 2099 if (obj->write_domain &&
2100 obj->write_domain != obj->pending_read_domains) {
2033 flush_domains |= obj->write_domain; 2101 flush_domains |= obj->write_domain;
2034 invalidate_domains |= read_domains & ~obj->write_domain; 2102 invalidate_domains |=
2103 obj->pending_read_domains & ~obj->write_domain;
2035 } 2104 }
2036 /* 2105 /*
2037 * Invalidate any read caches which may have 2106 * Invalidate any read caches which may have
2038 * stale data. That is, any new read domains. 2107 * stale data. That is, any new read domains.
2039 */ 2108 */
2040 invalidate_domains |= read_domains & ~obj->read_domains; 2109 invalidate_domains |= obj->pending_read_domains & ~obj->read_domains;
2041 if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU) { 2110 if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU) {
2042#if WATCH_BUF 2111#if WATCH_BUF
2043 DRM_INFO("%s: CPU domain flush %08x invalidate %08x\n", 2112 DRM_INFO("%s: CPU domain flush %08x invalidate %08x\n",
@@ -2046,9 +2115,15 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
2046 i915_gem_clflush_object(obj); 2115 i915_gem_clflush_object(obj);
2047 } 2116 }
2048 2117
2049 if ((write_domain | flush_domains) != 0) 2118 /* The actual obj->write_domain will be updated with
2050 obj->write_domain = write_domain; 2119 * pending_write_domain after we emit the accumulated flush for all
2051 obj->read_domains = read_domains; 2120 * of our domain changes in execbuffers (which clears objects'
2121 * write_domains). So if we have a current write domain that we
2122 * aren't changing, set pending_write_domain to that.
2123 */
2124 if (flush_domains == 0 && obj->pending_write_domain == 0)
2125 obj->pending_write_domain = obj->write_domain;
2126 obj->read_domains = obj->pending_read_domains;
2052 2127
2053 dev->invalidate_domains |= invalidate_domains; 2128 dev->invalidate_domains |= invalidate_domains;
2054 dev->flush_domains |= flush_domains; 2129 dev->flush_domains |= flush_domains;
@@ -2251,6 +2326,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
2251 (int) reloc.offset, 2326 (int) reloc.offset,
2252 reloc.read_domains, 2327 reloc.read_domains,
2253 reloc.write_domain); 2328 reloc.write_domain);
2329 drm_gem_object_unreference(target_obj);
2330 i915_gem_object_unpin(obj);
2254 return -EINVAL; 2331 return -EINVAL;
2255 } 2332 }
2256 2333
@@ -2437,6 +2514,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
2437 struct drm_i915_gem_exec_object *exec_list = NULL; 2514 struct drm_i915_gem_exec_object *exec_list = NULL;
2438 struct drm_gem_object **object_list = NULL; 2515 struct drm_gem_object **object_list = NULL;
2439 struct drm_gem_object *batch_obj; 2516 struct drm_gem_object *batch_obj;
2517 struct drm_i915_gem_object *obj_priv;
2440 int ret, i, pinned = 0; 2518 int ret, i, pinned = 0;
2441 uint64_t exec_offset; 2519 uint64_t exec_offset;
2442 uint32_t seqno, flush_domains; 2520 uint32_t seqno, flush_domains;
@@ -2480,13 +2558,15 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
2480 if (dev_priv->mm.wedged) { 2558 if (dev_priv->mm.wedged) {
2481 DRM_ERROR("Execbuf while wedged\n"); 2559 DRM_ERROR("Execbuf while wedged\n");
2482 mutex_unlock(&dev->struct_mutex); 2560 mutex_unlock(&dev->struct_mutex);
2483 return -EIO; 2561 ret = -EIO;
2562 goto pre_mutex_err;
2484 } 2563 }
2485 2564
2486 if (dev_priv->mm.suspended) { 2565 if (dev_priv->mm.suspended) {
2487 DRM_ERROR("Execbuf while VT-switched.\n"); 2566 DRM_ERROR("Execbuf while VT-switched.\n");
2488 mutex_unlock(&dev->struct_mutex); 2567 mutex_unlock(&dev->struct_mutex);
2489 return -EBUSY; 2568 ret = -EBUSY;
2569 goto pre_mutex_err;
2490 } 2570 }
2491 2571
2492 /* Look up object handles */ 2572 /* Look up object handles */
@@ -2499,6 +2579,15 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
2499 ret = -EBADF; 2579 ret = -EBADF;
2500 goto err; 2580 goto err;
2501 } 2581 }
2582
2583 obj_priv = object_list[i]->driver_private;
2584 if (obj_priv->in_execbuffer) {
2585 DRM_ERROR("Object %p appears more than once in object list\n",
2586 object_list[i]);
2587 ret = -EBADF;
2588 goto err;
2589 }
2590 obj_priv->in_execbuffer = true;
2502 } 2591 }
2503 2592
2504 /* Pin and relocate */ 2593 /* Pin and relocate */
@@ -2554,9 +2643,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
2554 struct drm_gem_object *obj = object_list[i]; 2643 struct drm_gem_object *obj = object_list[i];
2555 2644
2556 /* Compute new gpu domains and update invalidate/flush */ 2645 /* Compute new gpu domains and update invalidate/flush */
2557 i915_gem_object_set_to_gpu_domain(obj, 2646 i915_gem_object_set_to_gpu_domain(obj);
2558 obj->pending_read_domains,
2559 obj->pending_write_domain);
2560 } 2647 }
2561 2648
2562 i915_verify_inactive(dev, __FILE__, __LINE__); 2649 i915_verify_inactive(dev, __FILE__, __LINE__);
@@ -2575,6 +2662,12 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
2575 (void)i915_add_request(dev, dev->flush_domains); 2662 (void)i915_add_request(dev, dev->flush_domains);
2576 } 2663 }
2577 2664
2665 for (i = 0; i < args->buffer_count; i++) {
2666 struct drm_gem_object *obj = object_list[i];
2667
2668 obj->write_domain = obj->pending_write_domain;
2669 }
2670
2578 i915_verify_inactive(dev, __FILE__, __LINE__); 2671 i915_verify_inactive(dev, __FILE__, __LINE__);
2579 2672
2580#if WATCH_COHERENCY 2673#if WATCH_COHERENCY
@@ -2632,24 +2725,32 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
2632 2725
2633 i915_verify_inactive(dev, __FILE__, __LINE__); 2726 i915_verify_inactive(dev, __FILE__, __LINE__);
2634 2727
2635 /* Copy the new buffer offsets back to the user's exec list. */
2636 ret = copy_to_user((struct drm_i915_relocation_entry __user *)
2637 (uintptr_t) args->buffers_ptr,
2638 exec_list,
2639 sizeof(*exec_list) * args->buffer_count);
2640 if (ret)
2641 DRM_ERROR("failed to copy %d exec entries "
2642 "back to user (%d)\n",
2643 args->buffer_count, ret);
2644err: 2728err:
2645 for (i = 0; i < pinned; i++) 2729 for (i = 0; i < pinned; i++)
2646 i915_gem_object_unpin(object_list[i]); 2730 i915_gem_object_unpin(object_list[i]);
2647 2731
2648 for (i = 0; i < args->buffer_count; i++) 2732 for (i = 0; i < args->buffer_count; i++) {
2733 if (object_list[i]) {
2734 obj_priv = object_list[i]->driver_private;
2735 obj_priv->in_execbuffer = false;
2736 }
2649 drm_gem_object_unreference(object_list[i]); 2737 drm_gem_object_unreference(object_list[i]);
2738 }
2650 2739
2651 mutex_unlock(&dev->struct_mutex); 2740 mutex_unlock(&dev->struct_mutex);
2652 2741
2742 if (!ret) {
2743 /* Copy the new buffer offsets back to the user's exec list. */
2744 ret = copy_to_user((struct drm_i915_relocation_entry __user *)
2745 (uintptr_t) args->buffers_ptr,
2746 exec_list,
2747 sizeof(*exec_list) * args->buffer_count);
2748 if (ret)
2749 DRM_ERROR("failed to copy %d exec entries "
2750 "back to user (%d)\n",
2751 args->buffer_count, ret);
2752 }
2753
2653pre_mutex_err: 2754pre_mutex_err:
2654 drm_free(object_list, sizeof(*object_list) * args->buffer_count, 2755 drm_free(object_list, sizeof(*object_list) * args->buffer_count,
2655 DRM_MEM_DRIVER); 2756 DRM_MEM_DRIVER);
@@ -2671,17 +2772,24 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
2671 ret = i915_gem_object_bind_to_gtt(obj, alignment); 2772 ret = i915_gem_object_bind_to_gtt(obj, alignment);
2672 if (ret != 0) { 2773 if (ret != 0) {
2673 if (ret != -EBUSY && ret != -ERESTARTSYS) 2774 if (ret != -EBUSY && ret != -ERESTARTSYS)
2674 DRM_ERROR("Failure to bind: %d", ret); 2775 DRM_ERROR("Failure to bind: %d\n", ret);
2776 return ret;
2777 }
2778 }
2779 /*
2780 * Pre-965 chips need a fence register set up in order to
2781 * properly handle tiled surfaces.
2782 */
2783 if (!IS_I965G(dev) &&
2784 obj_priv->fence_reg == I915_FENCE_REG_NONE &&
2785 obj_priv->tiling_mode != I915_TILING_NONE) {
2786 ret = i915_gem_object_get_fence_reg(obj, true);
2787 if (ret != 0) {
2788 if (ret != -EBUSY && ret != -ERESTARTSYS)
2789 DRM_ERROR("Failure to install fence: %d\n",
2790 ret);
2675 return ret; 2791 return ret;
2676 } 2792 }
2677 /*
2678 * Pre-965 chips need a fence register set up in order to
2679 * properly handle tiled surfaces.
2680 */
2681 if (!IS_I965G(dev) &&
2682 obj_priv->fence_reg == I915_FENCE_REG_NONE &&
2683 obj_priv->tiling_mode != I915_TILING_NONE)
2684 i915_gem_object_get_fence_reg(obj, true);
2685 } 2793 }
2686 obj_priv->pin_count++; 2794 obj_priv->pin_count++;
2687 2795
@@ -2753,6 +2861,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
2753 if (obj_priv->pin_filp != NULL && obj_priv->pin_filp != file_priv) { 2861 if (obj_priv->pin_filp != NULL && obj_priv->pin_filp != file_priv) {
2754 DRM_ERROR("Already pinned in i915_gem_pin_ioctl(): %d\n", 2862 DRM_ERROR("Already pinned in i915_gem_pin_ioctl(): %d\n",
2755 args->handle); 2863 args->handle);
2864 drm_gem_object_unreference(obj);
2756 mutex_unlock(&dev->struct_mutex); 2865 mutex_unlock(&dev->struct_mutex);
2757 return -EINVAL; 2866 return -EINVAL;
2758 } 2867 }
@@ -2833,6 +2942,13 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
2833 return -EBADF; 2942 return -EBADF;
2834 } 2943 }
2835 2944
2945 /* Update the active list for the hardware's current position.
2946 * Otherwise this only updates on a delayed timer or when irqs are
2947 * actually unmasked, and our working set ends up being larger than
2948 * required.
2949 */
2950 i915_gem_retire_requests(dev);
2951
2836 obj_priv = obj->driver_private; 2952 obj_priv = obj->driver_private;
2837 /* Don't count being on the flushing list against the object being 2953 /* Don't count being on the flushing list against the object being
2838 * done. Otherwise, a buffer left on the flushing list but not getting 2954 * done. Otherwise, a buffer left on the flushing list but not getting
@@ -2885,9 +3001,6 @@ int i915_gem_init_object(struct drm_gem_object *obj)
2885void i915_gem_free_object(struct drm_gem_object *obj) 3001void i915_gem_free_object(struct drm_gem_object *obj)
2886{ 3002{
2887 struct drm_device *dev = obj->dev; 3003 struct drm_device *dev = obj->dev;
2888 struct drm_gem_mm *mm = dev->mm_private;
2889 struct drm_map_list *list;
2890 struct drm_map *map;
2891 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3004 struct drm_i915_gem_object *obj_priv = obj->driver_private;
2892 3005
2893 while (obj_priv->pin_count > 0) 3006 while (obj_priv->pin_count > 0)
@@ -2898,19 +3011,7 @@ void i915_gem_free_object(struct drm_gem_object *obj)
2898 3011
2899 i915_gem_object_unbind(obj); 3012 i915_gem_object_unbind(obj);
2900 3013
2901 list = &obj->map_list; 3014 i915_gem_free_mmap_offset(obj);
2902 drm_ht_remove_item(&mm->offset_hash, &list->hash);
2903
2904 if (list->file_offset_node) {
2905 drm_mm_put_block(list->file_offset_node);
2906 list->file_offset_node = NULL;
2907 }
2908
2909 map = list->map;
2910 if (map) {
2911 drm_free(map, sizeof(*map), DRM_MEM_DRIVER);
2912 list->map = NULL;
2913 }
2914 3015
2915 drm_free(obj_priv->page_cpu_valid, 1, DRM_MEM_DRIVER); 3016 drm_free(obj_priv->page_cpu_valid, 1, DRM_MEM_DRIVER);
2916 drm_free(obj->driver_private, 1, DRM_MEM_DRIVER); 3017 drm_free(obj->driver_private, 1, DRM_MEM_DRIVER);
@@ -2949,7 +3050,7 @@ i915_gem_evict_from_list(struct drm_device *dev, struct list_head *head)
2949 return 0; 3050 return 0;
2950} 3051}
2951 3052
2952static int 3053int
2953i915_gem_idle(struct drm_device *dev) 3054i915_gem_idle(struct drm_device *dev)
2954{ 3055{
2955 drm_i915_private_t *dev_priv = dev->dev_private; 3056 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -3095,6 +3196,7 @@ i915_gem_init_hws(struct drm_device *dev)
3095 if (dev_priv->hw_status_page == NULL) { 3196 if (dev_priv->hw_status_page == NULL) {
3096 DRM_ERROR("Failed to map status page.\n"); 3197 DRM_ERROR("Failed to map status page.\n");
3097 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); 3198 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
3199 i915_gem_object_unpin(obj);
3098 drm_gem_object_unreference(obj); 3200 drm_gem_object_unreference(obj);
3099 return -EINVAL; 3201 return -EINVAL;
3100 } 3202 }
@@ -3107,6 +3209,31 @@ i915_gem_init_hws(struct drm_device *dev)
3107 return 0; 3209 return 0;
3108} 3210}
3109 3211
3212static void
3213i915_gem_cleanup_hws(struct drm_device *dev)
3214{
3215 drm_i915_private_t *dev_priv = dev->dev_private;
3216 struct drm_gem_object *obj;
3217 struct drm_i915_gem_object *obj_priv;
3218
3219 if (dev_priv->hws_obj == NULL)
3220 return;
3221
3222 obj = dev_priv->hws_obj;
3223 obj_priv = obj->driver_private;
3224
3225 kunmap(obj_priv->page_list[0]);
3226 i915_gem_object_unpin(obj);
3227 drm_gem_object_unreference(obj);
3228 dev_priv->hws_obj = NULL;
3229
3230 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
3231 dev_priv->hw_status_page = NULL;
3232
3233 /* Write high address into HWS_PGA when disabling. */
3234 I915_WRITE(HWS_PGA, 0x1ffff000);
3235}
3236
3110int 3237int
3111i915_gem_init_ringbuffer(struct drm_device *dev) 3238i915_gem_init_ringbuffer(struct drm_device *dev)
3112{ 3239{
@@ -3124,6 +3251,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
3124 obj = drm_gem_object_alloc(dev, 128 * 1024); 3251 obj = drm_gem_object_alloc(dev, 128 * 1024);
3125 if (obj == NULL) { 3252 if (obj == NULL) {
3126 DRM_ERROR("Failed to allocate ringbuffer\n"); 3253 DRM_ERROR("Failed to allocate ringbuffer\n");
3254 i915_gem_cleanup_hws(dev);
3127 return -ENOMEM; 3255 return -ENOMEM;
3128 } 3256 }
3129 obj_priv = obj->driver_private; 3257 obj_priv = obj->driver_private;
@@ -3131,6 +3259,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
3131 ret = i915_gem_object_pin(obj, 4096); 3259 ret = i915_gem_object_pin(obj, 4096);
3132 if (ret != 0) { 3260 if (ret != 0) {
3133 drm_gem_object_unreference(obj); 3261 drm_gem_object_unreference(obj);
3262 i915_gem_cleanup_hws(dev);
3134 return ret; 3263 return ret;
3135 } 3264 }
3136 3265
@@ -3148,7 +3277,9 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
3148 if (ring->map.handle == NULL) { 3277 if (ring->map.handle == NULL) {
3149 DRM_ERROR("Failed to map ringbuffer.\n"); 3278 DRM_ERROR("Failed to map ringbuffer.\n");
3150 memset(&dev_priv->ring, 0, sizeof(dev_priv->ring)); 3279 memset(&dev_priv->ring, 0, sizeof(dev_priv->ring));
3280 i915_gem_object_unpin(obj);
3151 drm_gem_object_unreference(obj); 3281 drm_gem_object_unreference(obj);
3282 i915_gem_cleanup_hws(dev);
3152 return -EINVAL; 3283 return -EINVAL;
3153 } 3284 }
3154 ring->ring_obj = obj; 3285 ring->ring_obj = obj;
@@ -3228,20 +3359,7 @@ i915_gem_cleanup_ringbuffer(struct drm_device *dev)
3228 dev_priv->ring.ring_obj = NULL; 3359 dev_priv->ring.ring_obj = NULL;
3229 memset(&dev_priv->ring, 0, sizeof(dev_priv->ring)); 3360 memset(&dev_priv->ring, 0, sizeof(dev_priv->ring));
3230 3361
3231 if (dev_priv->hws_obj != NULL) { 3362 i915_gem_cleanup_hws(dev);
3232 struct drm_gem_object *obj = dev_priv->hws_obj;
3233 struct drm_i915_gem_object *obj_priv = obj->driver_private;
3234
3235 kunmap(obj_priv->page_list[0]);
3236 i915_gem_object_unpin(obj);
3237 drm_gem_object_unreference(obj);
3238 dev_priv->hws_obj = NULL;
3239 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
3240 dev_priv->hw_status_page = NULL;
3241
3242 /* Write high address into HWS_PGA when disabling. */
3243 I915_WRITE(HWS_PGA, 0x1ffff000);
3244 }
3245} 3363}
3246 3364
3247int 3365int
@@ -3497,7 +3615,7 @@ i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
3497 user_data = (char __user *) (uintptr_t) args->data_ptr; 3615 user_data = (char __user *) (uintptr_t) args->data_ptr;
3498 obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset; 3616 obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset;
3499 3617
3500 DRM_ERROR("obj_addr %p, %lld\n", obj_addr, args->size); 3618 DRM_DEBUG("obj_addr %p, %lld\n", obj_addr, args->size);
3501 ret = copy_from_user(obj_addr, user_data, args->size); 3619 ret = copy_from_user(obj_addr, user_data, args->size);
3502 if (ret) 3620 if (ret)
3503 return -EFAULT; 3621 return -EFAULT;
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index fa1685cba840..7fb4191ef934 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -299,9 +299,8 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
299 } 299 }
300 obj_priv->stride = args->stride; 300 obj_priv->stride = args->stride;
301 301
302 mutex_unlock(&dev->struct_mutex);
303
304 drm_gem_object_unreference(obj); 302 drm_gem_object_unreference(obj);
303 mutex_unlock(&dev->struct_mutex);
305 304
306 return 0; 305 return 0;
307} 306}
@@ -340,9 +339,8 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
340 DRM_ERROR("unknown tiling mode\n"); 339 DRM_ERROR("unknown tiling mode\n");
341 } 340 }
342 341
343 mutex_unlock(&dev->struct_mutex);
344
345 drm_gem_object_unreference(obj); 342 drm_gem_object_unreference(obj);
343 mutex_unlock(&dev->struct_mutex);
346 344
347 return 0; 345 return 0;
348} 346}
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 548ff2c66431..87b6b603469e 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -383,12 +383,13 @@ int i915_irq_emit(struct drm_device *dev, void *data,
383 drm_i915_irq_emit_t *emit = data; 383 drm_i915_irq_emit_t *emit = data;
384 int result; 384 int result;
385 385
386 RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
387
388 if (!dev_priv) { 386 if (!dev_priv) {
389 DRM_ERROR("called with no initialization\n"); 387 DRM_ERROR("called with no initialization\n");
390 return -EINVAL; 388 return -EINVAL;
391 } 389 }
390
391 RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
392
392 mutex_lock(&dev->struct_mutex); 393 mutex_lock(&dev->struct_mutex);
393 result = i915_emit_irq(dev); 394 result = i915_emit_irq(dev);
394 mutex_unlock(&dev->struct_mutex); 395 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 9d6539a868b3..90600d899413 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -184,6 +184,7 @@
184 * Fence registers 184 * Fence registers
185 */ 185 */
186#define FENCE_REG_830_0 0x2000 186#define FENCE_REG_830_0 0x2000
187#define FENCE_REG_945_8 0x3000
187#define I830_FENCE_START_MASK 0x07f80000 188#define I830_FENCE_START_MASK 0x07f80000
188#define I830_FENCE_TILING_Y_SHIFT 12 189#define I830_FENCE_TILING_Y_SHIFT 12
189#define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8) 190#define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 5d84027ee8f3..d669cc2b42c0 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -119,11 +119,6 @@ static void i915_save_vga(struct drm_device *dev)
119 119
120 /* VGA color palette registers */ 120 /* VGA color palette registers */
121 dev_priv->saveDACMASK = I915_READ8(VGA_DACMASK); 121 dev_priv->saveDACMASK = I915_READ8(VGA_DACMASK);
122 /* DACCRX automatically increments during read */
123 I915_WRITE8(VGA_DACRX, 0);
124 /* Read 3 bytes of color data from each index */
125 for (i = 0; i < 256 * 3; i++)
126 dev_priv->saveDACDATA[i] = I915_READ8(VGA_DACDATA);
127 122
128 /* MSR bits */ 123 /* MSR bits */
129 dev_priv->saveMSR = I915_READ8(VGA_MSR_READ); 124 dev_priv->saveMSR = I915_READ8(VGA_MSR_READ);
@@ -225,12 +220,6 @@ static void i915_restore_vga(struct drm_device *dev)
225 220
226 /* VGA color palette registers */ 221 /* VGA color palette registers */
227 I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); 222 I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK);
228 /* DACCRX automatically increments during read */
229 I915_WRITE8(VGA_DACWX, 0);
230 /* Read 3 bytes of color data from each index */
231 for (i = 0; i < 256 * 3; i++)
232 I915_WRITE8(VGA_DACDATA, dev_priv->saveDACDATA[i]);
233
234} 223}
235 224
236int i915_save_state(struct drm_device *dev) 225int i915_save_state(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 4ca82a025525..fc28e2bbd542 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -111,6 +111,12 @@ parse_panel_data(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
111 panel_fixed_mode->clock = dvo_timing->clock * 10; 111 panel_fixed_mode->clock = dvo_timing->clock * 10;
112 panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED; 112 panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED;
113 113
114 /* Some VBTs have bogus h/vtotal values */
115 if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal)
116 panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1;
117 if (panel_fixed_mode->vsync_end > panel_fixed_mode->vtotal)
118 panel_fixed_mode->vtotal = panel_fixed_mode->vsync_end + 1;
119
114 drm_mode_set_name(panel_fixed_mode); 120 drm_mode_set_name(panel_fixed_mode);
115 121
116 dev_priv->vbt_mode = panel_fixed_mode; 122 dev_priv->vbt_mode = panel_fixed_mode;
@@ -135,6 +141,14 @@ parse_general_features(struct drm_i915_private *dev_priv,
135 if (general) { 141 if (general) {
136 dev_priv->int_tv_support = general->int_tv_support; 142 dev_priv->int_tv_support = general->int_tv_support;
137 dev_priv->int_crt_support = general->int_crt_support; 143 dev_priv->int_crt_support = general->int_crt_support;
144 dev_priv->lvds_use_ssc = general->enable_ssc;
145
146 if (dev_priv->lvds_use_ssc) {
147 if (IS_I855(dev_priv->dev))
148 dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48;
149 else
150 dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96;
151 }
138 } 152 }
139} 153}
140 154
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bbdd72909a11..a2834276cb38 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -90,12 +90,12 @@ typedef struct {
90#define I9XX_DOT_MAX 400000 90#define I9XX_DOT_MAX 400000
91#define I9XX_VCO_MIN 1400000 91#define I9XX_VCO_MIN 1400000
92#define I9XX_VCO_MAX 2800000 92#define I9XX_VCO_MAX 2800000
93#define I9XX_N_MIN 3 93#define I9XX_N_MIN 1
94#define I9XX_N_MAX 8 94#define I9XX_N_MAX 6
95#define I9XX_M_MIN 70 95#define I9XX_M_MIN 70
96#define I9XX_M_MAX 120 96#define I9XX_M_MAX 120
97#define I9XX_M1_MIN 10 97#define I9XX_M1_MIN 10
98#define I9XX_M1_MAX 20 98#define I9XX_M1_MAX 22
99#define I9XX_M2_MIN 5 99#define I9XX_M2_MIN 5
100#define I9XX_M2_MAX 9 100#define I9XX_M2_MAX 9
101#define I9XX_P_SDVO_DAC_MIN 5 101#define I9XX_P_SDVO_DAC_MIN 5
@@ -189,9 +189,7 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
189 return limit; 189 return limit;
190} 190}
191 191
192/** Derive the pixel clock for the given refclk and divisors for 8xx chips. */ 192static void intel_clock(int refclk, intel_clock_t *clock)
193
194static void i8xx_clock(int refclk, intel_clock_t *clock)
195{ 193{
196 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2); 194 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
197 clock->p = clock->p1 * clock->p2; 195 clock->p = clock->p1 * clock->p2;
@@ -199,25 +197,6 @@ static void i8xx_clock(int refclk, intel_clock_t *clock)
199 clock->dot = clock->vco / clock->p; 197 clock->dot = clock->vco / clock->p;
200} 198}
201 199
202/** Derive the pixel clock for the given refclk and divisors for 9xx chips. */
203
204static void i9xx_clock(int refclk, intel_clock_t *clock)
205{
206 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
207 clock->p = clock->p1 * clock->p2;
208 clock->vco = refclk * clock->m / (clock->n + 2);
209 clock->dot = clock->vco / clock->p;
210}
211
212static void intel_clock(struct drm_device *dev, int refclk,
213 intel_clock_t *clock)
214{
215 if (IS_I9XX(dev))
216 i9xx_clock (refclk, clock);
217 else
218 i8xx_clock (refclk, clock);
219}
220
221/** 200/**
222 * Returns whether any output on the specified pipe is of the specified type 201 * Returns whether any output on the specified pipe is of the specified type
223 */ 202 */
@@ -238,7 +217,7 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
238 return false; 217 return false;
239} 218}
240 219
241#define INTELPllInvalid(s) { /* ErrorF (s) */; return false; } 220#define INTELPllInvalid(s) do { /* DRM_DEBUG(s); */ return false; } while (0)
242/** 221/**
243 * Returns whether the given set of divisors are valid for a given refclk with 222 * Returns whether the given set of divisors are valid for a given refclk with
244 * the given connectors. 223 * the given connectors.
@@ -318,7 +297,7 @@ static bool intel_find_best_PLL(struct drm_crtc *crtc, int target,
318 clock.p1 <= limit->p1.max; clock.p1++) { 297 clock.p1 <= limit->p1.max; clock.p1++) {
319 int this_err; 298 int this_err;
320 299
321 intel_clock(dev, refclk, &clock); 300 intel_clock(refclk, &clock);
322 301
323 if (!intel_PLL_is_valid(crtc, &clock)) 302 if (!intel_PLL_is_valid(crtc, &clock))
324 continue; 303 continue;
@@ -343,7 +322,7 @@ intel_wait_for_vblank(struct drm_device *dev)
343 udelay(20000); 322 udelay(20000);
344} 323}
345 324
346static void 325static int
347intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, 326intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
348 struct drm_framebuffer *old_fb) 327 struct drm_framebuffer *old_fb)
349{ 328{
@@ -361,11 +340,21 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
361 int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; 340 int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE;
362 int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; 341 int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
363 u32 dspcntr, alignment; 342 u32 dspcntr, alignment;
343 int ret;
364 344
365 /* no fb bound */ 345 /* no fb bound */
366 if (!crtc->fb) { 346 if (!crtc->fb) {
367 DRM_DEBUG("No FB bound\n"); 347 DRM_DEBUG("No FB bound\n");
368 return; 348 return 0;
349 }
350
351 switch (pipe) {
352 case 0:
353 case 1:
354 break;
355 default:
356 DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
357 return -EINVAL;
369 } 358 }
370 359
371 intel_fb = to_intel_framebuffer(crtc->fb); 360 intel_fb = to_intel_framebuffer(crtc->fb);
@@ -377,28 +366,30 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
377 alignment = 64 * 1024; 366 alignment = 64 * 1024;
378 break; 367 break;
379 case I915_TILING_X: 368 case I915_TILING_X:
380 if (IS_I9XX(dev)) 369 /* pin() will align the object as required by fence */
381 alignment = 1024 * 1024; 370 alignment = 0;
382 else
383 alignment = 512 * 1024;
384 break; 371 break;
385 case I915_TILING_Y: 372 case I915_TILING_Y:
386 /* FIXME: Is this true? */ 373 /* FIXME: Is this true? */
387 DRM_ERROR("Y tiled not allowed for scan out buffers\n"); 374 DRM_ERROR("Y tiled not allowed for scan out buffers\n");
388 return; 375 return -EINVAL;
389 default: 376 default:
390 BUG(); 377 BUG();
391 } 378 }
392 379
393 if (i915_gem_object_pin(intel_fb->obj, alignment)) 380 mutex_lock(&dev->struct_mutex);
394 return; 381 ret = i915_gem_object_pin(intel_fb->obj, alignment);
395 382 if (ret != 0) {
396 i915_gem_object_set_to_gtt_domain(intel_fb->obj, 1); 383 mutex_unlock(&dev->struct_mutex);
397 384 return ret;
398 Start = obj_priv->gtt_offset; 385 }
399 Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
400 386
401 I915_WRITE(dspstride, crtc->fb->pitch); 387 ret = i915_gem_object_set_to_gtt_domain(intel_fb->obj, 1);
388 if (ret != 0) {
389 i915_gem_object_unpin(intel_fb->obj);
390 mutex_unlock(&dev->struct_mutex);
391 return ret;
392 }
402 393
403 dspcntr = I915_READ(dspcntr_reg); 394 dspcntr = I915_READ(dspcntr_reg);
404 /* Mask out pixel format bits in case we change it */ 395 /* Mask out pixel format bits in case we change it */
@@ -419,11 +410,17 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
419 break; 410 break;
420 default: 411 default:
421 DRM_ERROR("Unknown color depth\n"); 412 DRM_ERROR("Unknown color depth\n");
422 return; 413 i915_gem_object_unpin(intel_fb->obj);
414 mutex_unlock(&dev->struct_mutex);
415 return -EINVAL;
423 } 416 }
424 I915_WRITE(dspcntr_reg, dspcntr); 417 I915_WRITE(dspcntr_reg, dspcntr);
425 418
419 Start = obj_priv->gtt_offset;
420 Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
421
426 DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y); 422 DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
423 I915_WRITE(dspstride, crtc->fb->pitch);
427 if (IS_I965G(dev)) { 424 if (IS_I965G(dev)) {
428 I915_WRITE(dspbase, Offset); 425 I915_WRITE(dspbase, Offset);
429 I915_READ(dspbase); 426 I915_READ(dspbase);
@@ -440,27 +437,24 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
440 intel_fb = to_intel_framebuffer(old_fb); 437 intel_fb = to_intel_framebuffer(old_fb);
441 i915_gem_object_unpin(intel_fb->obj); 438 i915_gem_object_unpin(intel_fb->obj);
442 } 439 }
440 mutex_unlock(&dev->struct_mutex);
443 441
444 if (!dev->primary->master) 442 if (!dev->primary->master)
445 return; 443 return 0;
446 444
447 master_priv = dev->primary->master->driver_priv; 445 master_priv = dev->primary->master->driver_priv;
448 if (!master_priv->sarea_priv) 446 if (!master_priv->sarea_priv)
449 return; 447 return 0;
450 448
451 switch (pipe) { 449 if (pipe) {
452 case 0:
453 master_priv->sarea_priv->pipeA_x = x;
454 master_priv->sarea_priv->pipeA_y = y;
455 break;
456 case 1:
457 master_priv->sarea_priv->pipeB_x = x; 450 master_priv->sarea_priv->pipeB_x = x;
458 master_priv->sarea_priv->pipeB_y = y; 451 master_priv->sarea_priv->pipeB_y = y;
459 break; 452 } else {
460 default: 453 master_priv->sarea_priv->pipeA_x = x;
461 DRM_ERROR("Can't update pipe %d in SAREA\n", pipe); 454 master_priv->sarea_priv->pipeA_y = y;
462 break;
463 } 455 }
456
457 return 0;
464} 458}
465 459
466 460
@@ -708,11 +702,11 @@ static int intel_panel_fitter_pipe (struct drm_device *dev)
708 return 1; 702 return 1;
709} 703}
710 704
711static void intel_crtc_mode_set(struct drm_crtc *crtc, 705static int intel_crtc_mode_set(struct drm_crtc *crtc,
712 struct drm_display_mode *mode, 706 struct drm_display_mode *mode,
713 struct drm_display_mode *adjusted_mode, 707 struct drm_display_mode *adjusted_mode,
714 int x, int y, 708 int x, int y,
715 struct drm_framebuffer *old_fb) 709 struct drm_framebuffer *old_fb)
716{ 710{
717 struct drm_device *dev = crtc->dev; 711 struct drm_device *dev = crtc->dev;
718 struct drm_i915_private *dev_priv = dev->dev_private; 712 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -732,13 +726,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
732 int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE; 726 int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE;
733 int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS; 727 int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS;
734 int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC; 728 int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC;
735 int refclk; 729 int refclk, num_outputs = 0;
736 intel_clock_t clock; 730 intel_clock_t clock;
737 u32 dpll = 0, fp = 0, dspcntr, pipeconf; 731 u32 dpll = 0, fp = 0, dspcntr, pipeconf;
738 bool ok, is_sdvo = false, is_dvo = false; 732 bool ok, is_sdvo = false, is_dvo = false;
739 bool is_crt = false, is_lvds = false, is_tv = false; 733 bool is_crt = false, is_lvds = false, is_tv = false;
740 struct drm_mode_config *mode_config = &dev->mode_config; 734 struct drm_mode_config *mode_config = &dev->mode_config;
741 struct drm_connector *connector; 735 struct drm_connector *connector;
736 int ret;
742 737
743 drm_vblank_pre_modeset(dev, pipe); 738 drm_vblank_pre_modeset(dev, pipe);
744 739
@@ -768,9 +763,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
768 is_crt = true; 763 is_crt = true;
769 break; 764 break;
770 } 765 }
766
767 num_outputs++;
771 } 768 }
772 769
773 if (IS_I9XX(dev)) { 770 if (is_lvds && dev_priv->lvds_use_ssc && num_outputs < 2) {
771 refclk = dev_priv->lvds_ssc_freq * 1000;
772 DRM_DEBUG("using SSC reference clock of %d MHz\n", refclk / 1000);
773 } else if (IS_I9XX(dev)) {
774 refclk = 96000; 774 refclk = 96000;
775 } else { 775 } else {
776 refclk = 48000; 776 refclk = 48000;
@@ -779,7 +779,7 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
779 ok = intel_find_best_PLL(crtc, adjusted_mode->clock, refclk, &clock); 779 ok = intel_find_best_PLL(crtc, adjusted_mode->clock, refclk, &clock);
780 if (!ok) { 780 if (!ok) {
781 DRM_ERROR("Couldn't find PLL settings for mode!\n"); 781 DRM_ERROR("Couldn't find PLL settings for mode!\n");
782 return; 782 return -EINVAL;
783 } 783 }
784 784
785 fp = clock.n << 16 | clock.m1 << 8 | clock.m2; 785 fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
@@ -829,11 +829,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
829 } 829 }
830 } 830 }
831 831
832 if (is_tv) { 832 if (is_sdvo && is_tv)
833 dpll |= PLL_REF_INPUT_TVCLKINBC;
834 else if (is_tv)
833 /* XXX: just matching BIOS for now */ 835 /* XXX: just matching BIOS for now */
834/* dpll |= PLL_REF_INPUT_TVCLKINBC; */ 836 /* dpll |= PLL_REF_INPUT_TVCLKINBC; */
835 dpll |= 3; 837 dpll |= 3;
836 } 838 else if (is_lvds && dev_priv->lvds_use_ssc && num_outputs < 2)
839 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN;
837 else 840 else
838 dpll |= PLL_REF_INPUT_DREFCLK; 841 dpll |= PLL_REF_INPUT_DREFCLK;
839 842
@@ -950,9 +953,13 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
950 I915_WRITE(dspcntr_reg, dspcntr); 953 I915_WRITE(dspcntr_reg, dspcntr);
951 954
952 /* Flush the plane changes */ 955 /* Flush the plane changes */
953 intel_pipe_set_base(crtc, x, y, old_fb); 956 ret = intel_pipe_set_base(crtc, x, y, old_fb);
957 if (ret != 0)
958 return ret;
954 959
955 drm_vblank_post_modeset(dev, pipe); 960 drm_vblank_post_modeset(dev, pipe);
961
962 return 0;
956} 963}
957 964
958/** Loads the palette/gamma unit for the CRTC with the prepared values */ 965/** Loads the palette/gamma unit for the CRTC with the prepared values */
@@ -1001,6 +1008,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1001 temp = CURSOR_MODE_DISABLE; 1008 temp = CURSOR_MODE_DISABLE;
1002 addr = 0; 1009 addr = 0;
1003 bo = NULL; 1010 bo = NULL;
1011 mutex_lock(&dev->struct_mutex);
1004 goto finish; 1012 goto finish;
1005 } 1013 }
1006 1014
@@ -1023,18 +1031,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1023 } 1031 }
1024 1032
1025 /* we only need to pin inside GTT if cursor is non-phy */ 1033 /* we only need to pin inside GTT if cursor is non-phy */
1034 mutex_lock(&dev->struct_mutex);
1026 if (!dev_priv->cursor_needs_physical) { 1035 if (!dev_priv->cursor_needs_physical) {
1027 ret = i915_gem_object_pin(bo, PAGE_SIZE); 1036 ret = i915_gem_object_pin(bo, PAGE_SIZE);
1028 if (ret) { 1037 if (ret) {
1029 DRM_ERROR("failed to pin cursor bo\n"); 1038 DRM_ERROR("failed to pin cursor bo\n");
1030 goto fail; 1039 goto fail_locked;
1031 } 1040 }
1032 addr = obj_priv->gtt_offset; 1041 addr = obj_priv->gtt_offset;
1033 } else { 1042 } else {
1034 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); 1043 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
1035 if (ret) { 1044 if (ret) {
1036 DRM_ERROR("failed to attach phys object\n"); 1045 DRM_ERROR("failed to attach phys object\n");
1037 goto fail; 1046 goto fail_locked;
1038 } 1047 }
1039 addr = obj_priv->phys_obj->handle->busaddr; 1048 addr = obj_priv->phys_obj->handle->busaddr;
1040 } 1049 }
@@ -1054,10 +1063,9 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1054 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); 1063 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
1055 } else 1064 } else
1056 i915_gem_object_unpin(intel_crtc->cursor_bo); 1065 i915_gem_object_unpin(intel_crtc->cursor_bo);
1057 mutex_lock(&dev->struct_mutex);
1058 drm_gem_object_unreference(intel_crtc->cursor_bo); 1066 drm_gem_object_unreference(intel_crtc->cursor_bo);
1059 mutex_unlock(&dev->struct_mutex);
1060 } 1067 }
1068 mutex_unlock(&dev->struct_mutex);
1061 1069
1062 intel_crtc->cursor_addr = addr; 1070 intel_crtc->cursor_addr = addr;
1063 intel_crtc->cursor_bo = bo; 1071 intel_crtc->cursor_bo = bo;
@@ -1065,6 +1073,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1065 return 0; 1073 return 0;
1066fail: 1074fail:
1067 mutex_lock(&dev->struct_mutex); 1075 mutex_lock(&dev->struct_mutex);
1076fail_locked:
1068 drm_gem_object_unreference(bo); 1077 drm_gem_object_unreference(bo);
1069 mutex_unlock(&dev->struct_mutex); 1078 mutex_unlock(&dev->struct_mutex);
1070 return ret; 1079 return ret;
@@ -1292,7 +1301,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
1292 } 1301 }
1293 1302
1294 /* XXX: Handle the 100Mhz refclk */ 1303 /* XXX: Handle the 100Mhz refclk */
1295 i9xx_clock(96000, &clock); 1304 intel_clock(96000, &clock);
1296 } else { 1305 } else {
1297 bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN); 1306 bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN);
1298 1307
@@ -1304,9 +1313,9 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
1304 if ((dpll & PLL_REF_INPUT_MASK) == 1313 if ((dpll & PLL_REF_INPUT_MASK) ==
1305 PLLB_REF_INPUT_SPREADSPECTRUMIN) { 1314 PLLB_REF_INPUT_SPREADSPECTRUMIN) {
1306 /* XXX: might not be 66MHz */ 1315 /* XXX: might not be 66MHz */
1307 i8xx_clock(66000, &clock); 1316 intel_clock(66000, &clock);
1308 } else 1317 } else
1309 i8xx_clock(48000, &clock); 1318 intel_clock(48000, &clock);
1310 } else { 1319 } else {
1311 if (dpll & PLL_P1_DIVIDE_BY_TWO) 1320 if (dpll & PLL_P1_DIVIDE_BY_TWO)
1312 clock.p1 = 2; 1321 clock.p1 = 2;
@@ -1319,7 +1328,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
1319 else 1328 else
1320 clock.p2 = 2; 1329 clock.p2 = 2;
1321 1330
1322 i8xx_clock(48000, &clock); 1331 intel_clock(48000, &clock);
1323 } 1332 }
1324 } 1333 }
1325 1334
@@ -1598,7 +1607,9 @@ intel_user_framebuffer_create(struct drm_device *dev,
1598 1607
1599 ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj); 1608 ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj);
1600 if (ret) { 1609 if (ret) {
1610 mutex_lock(&dev->struct_mutex);
1601 drm_gem_object_unreference(obj); 1611 drm_gem_object_unreference(obj);
1612 mutex_unlock(&dev->struct_mutex);
1602 return NULL; 1613 return NULL;
1603 } 1614 }
1604 1615
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index afd1217b8a02..b7f0ebe9f810 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -473,7 +473,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
473 ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo); 473 ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo);
474 if (ret) { 474 if (ret) {
475 DRM_ERROR("failed to allocate fb.\n"); 475 DRM_ERROR("failed to allocate fb.\n");
476 goto out_unref; 476 goto out_unpin;
477 } 477 }
478 478
479 list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list); 479 list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list);
@@ -484,7 +484,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
484 info = framebuffer_alloc(sizeof(struct intelfb_par), device); 484 info = framebuffer_alloc(sizeof(struct intelfb_par), device);
485 if (!info) { 485 if (!info) {
486 ret = -ENOMEM; 486 ret = -ENOMEM;
487 goto out_unref; 487 goto out_unpin;
488 } 488 }
489 489
490 par = info->par; 490 par = info->par;
@@ -513,7 +513,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
513 size); 513 size);
514 if (!info->screen_base) { 514 if (!info->screen_base) {
515 ret = -ENOSPC; 515 ret = -ENOSPC;
516 goto out_unref; 516 goto out_unpin;
517 } 517 }
518 info->screen_size = size; 518 info->screen_size = size;
519 519
@@ -608,6 +608,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
608 mutex_unlock(&dev->struct_mutex); 608 mutex_unlock(&dev->struct_mutex);
609 return 0; 609 return 0;
610 610
611out_unpin:
612 i915_gem_object_unpin(fbo);
611out_unref: 613out_unref:
612 drm_gem_object_unreference(fbo); 614 drm_gem_object_unreference(fbo);
613 mutex_unlock(&dev->struct_mutex); 615 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 6d4f91265354..0d211af98854 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -481,8 +481,6 @@ void intel_lvds_init(struct drm_device *dev)
481 if (dev_priv->panel_fixed_mode) { 481 if (dev_priv->panel_fixed_mode) {
482 dev_priv->panel_fixed_mode->type |= 482 dev_priv->panel_fixed_mode->type |=
483 DRM_MODE_TYPE_PREFERRED; 483 DRM_MODE_TYPE_PREFERRED;
484 drm_mode_probed_add(connector,
485 dev_priv->panel_fixed_mode);
486 goto out; 484 goto out;
487 } 485 }
488 } 486 }
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index a30508b639ba..fbe6f3931b1b 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -193,7 +193,7 @@ static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr,
193 193
194#define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd} 194#define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd}
195/** Mapping of command numbers to names, for debug output */ 195/** Mapping of command numbers to names, for debug output */
196const static struct _sdvo_cmd_name { 196static const struct _sdvo_cmd_name {
197 u8 cmd; 197 u8 cmd;
198 char *name; 198 char *name;
199} sdvo_cmd_names[] = { 199} sdvo_cmd_names[] = {
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index fbb35dc56f5c..56485d67369b 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -411,7 +411,7 @@ struct tv_mode {
411 * These values account for -1s required. 411 * These values account for -1s required.
412 */ 412 */
413 413
414const static struct tv_mode tv_modes[] = { 414static const struct tv_mode tv_modes[] = {
415 { 415 {
416 .name = "NTSC-M", 416 .name = "NTSC-M",
417 .clock = 107520, 417 .clock = 107520,
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index df4cf97e5d97..92965dbb3c14 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -557,8 +557,10 @@ static int radeon_do_engine_reset(struct drm_device * dev)
557} 557}
558 558
559static void radeon_cp_init_ring_buffer(struct drm_device * dev, 559static void radeon_cp_init_ring_buffer(struct drm_device * dev,
560 drm_radeon_private_t * dev_priv) 560 drm_radeon_private_t *dev_priv,
561 struct drm_file *file_priv)
561{ 562{
563 struct drm_radeon_master_private *master_priv;
562 u32 ring_start, cur_read_ptr; 564 u32 ring_start, cur_read_ptr;
563 u32 tmp; 565 u32 tmp;
564 566
@@ -677,6 +679,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
677 dev_priv->scratch[2] = 0; 679 dev_priv->scratch[2] = 0;
678 RADEON_WRITE(RADEON_LAST_CLEAR_REG, 0); 680 RADEON_WRITE(RADEON_LAST_CLEAR_REG, 0);
679 681
682 /* reset sarea copies of these */
683 master_priv = file_priv->master->driver_priv;
684 if (master_priv->sarea_priv) {
685 master_priv->sarea_priv->last_frame = 0;
686 master_priv->sarea_priv->last_dispatch = 0;
687 master_priv->sarea_priv->last_clear = 0;
688 }
689
680 radeon_do_wait_for_idle(dev_priv); 690 radeon_do_wait_for_idle(dev_priv);
681 691
682 /* Sync everything up */ 692 /* Sync everything up */
@@ -1215,7 +1225,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
1215 } 1225 }
1216 1226
1217 radeon_cp_load_microcode(dev_priv); 1227 radeon_cp_load_microcode(dev_priv);
1218 radeon_cp_init_ring_buffer(dev, dev_priv); 1228 radeon_cp_init_ring_buffer(dev, dev_priv, file_priv);
1219 1229
1220 dev_priv->last_buf = 0; 1230 dev_priv->last_buf = 0;
1221 1231
@@ -1281,7 +1291,7 @@ static int radeon_do_cleanup_cp(struct drm_device * dev)
1281 * 1291 *
1282 * Charl P. Botha <http://cpbotha.net> 1292 * Charl P. Botha <http://cpbotha.net>
1283 */ 1293 */
1284static int radeon_do_resume_cp(struct drm_device * dev) 1294static int radeon_do_resume_cp(struct drm_device *dev, struct drm_file *file_priv)
1285{ 1295{
1286 drm_radeon_private_t *dev_priv = dev->dev_private; 1296 drm_radeon_private_t *dev_priv = dev->dev_private;
1287 1297
@@ -1304,7 +1314,7 @@ static int radeon_do_resume_cp(struct drm_device * dev)
1304 } 1314 }
1305 1315
1306 radeon_cp_load_microcode(dev_priv); 1316 radeon_cp_load_microcode(dev_priv);
1307 radeon_cp_init_ring_buffer(dev, dev_priv); 1317 radeon_cp_init_ring_buffer(dev, dev_priv, file_priv);
1308 1318
1309 radeon_do_engine_reset(dev); 1319 radeon_do_engine_reset(dev);
1310 radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); 1320 radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
@@ -1479,8 +1489,7 @@ int radeon_cp_idle(struct drm_device *dev, void *data, struct drm_file *file_pri
1479 */ 1489 */
1480int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv) 1490int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv)
1481{ 1491{
1482 1492 return radeon_do_resume_cp(dev, file_priv);
1483 return radeon_do_resume_cp(dev);
1484} 1493}
1485 1494
1486int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) 1495int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 6cad69ed21c5..1cc967448f4d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1300,7 +1300,13 @@ static const struct hid_device_id hid_blacklist[] = {
1300 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1300 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1301 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1302 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1303 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
1305 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
1306 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
1303 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1307 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
1308 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
1309 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
1304 1310
1305 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1311 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
1306 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 1312 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
@@ -1605,6 +1611,7 @@ static const struct hid_device_id hid_ignore_list[] = {
1605 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, 1611 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) },
1606 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, 1612 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) },
1607 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, 1613 { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) },
1614 { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) },
1608 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, 1615 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) },
1609 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, 1616 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) },
1610 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, 1617 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) },
@@ -1612,10 +1619,6 @@ static const struct hid_device_id hid_ignore_list[] = {
1612 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) }, 1619 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) },
1613 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, 1620 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
1614 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, 1621 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
1615 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
1616 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
1617 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
1618 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
1619 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, 1622 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
1620 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, 1623 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
1621 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 1624 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
@@ -1626,8 +1629,6 @@ static const struct hid_device_id hid_ignore_list[] = {
1626 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, 1629 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) },
1627 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, 1630 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) },
1628 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, 1631 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
1629 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
1630 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
1631 { } 1632 { }
1632}; 1633};
1633 1634
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e899f510ebeb..88511970508d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -348,6 +348,9 @@
348#define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 348#define USB_VENDOR_ID_PLAYDOTCOM 0x0b43
349#define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 349#define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003
350 350
351#define USB_VENDOR_ID_POWERCOM 0x0d9f
352#define USB_DEVICE_ID_POWERCOM_UPS 0x0002
353
351#define USB_VENDOR_ID_SAITEK 0x06a3 354#define USB_VENDOR_ID_SAITEK 0x06a3
352#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 355#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
353 356
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 732449628971..02b19db5442e 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -267,8 +267,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
267 default: 267 default:
268 { 268 {
269 struct hid_device *hid = dev->hid; 269 struct hid_device *hid = dev->hid;
270 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) 270 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) {
271 return -EINVAL; 271 ret = -EINVAL;
272 break;
273 }
272 274
273 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { 275 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
274 int len; 276 int len;
@@ -277,8 +279,9 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
277 len = strlen(hid->name) + 1; 279 len = strlen(hid->name) + 1;
278 if (len > _IOC_SIZE(cmd)) 280 if (len > _IOC_SIZE(cmd))
279 len = _IOC_SIZE(cmd); 281 len = _IOC_SIZE(cmd);
280 return copy_to_user(user_arg, hid->name, len) ? 282 ret = copy_to_user(user_arg, hid->name, len) ?
281 -EFAULT : len; 283 -EFAULT : len;
284 break;
282 } 285 }
283 286
284 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { 287 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
@@ -288,12 +291,13 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
288 len = strlen(hid->phys) + 1; 291 len = strlen(hid->phys) + 1;
289 if (len > _IOC_SIZE(cmd)) 292 if (len > _IOC_SIZE(cmd))
290 len = _IOC_SIZE(cmd); 293 len = _IOC_SIZE(cmd);
291 return copy_to_user(user_arg, hid->phys, len) ? 294 ret = copy_to_user(user_arg, hid->phys, len) ?
292 -EFAULT : len; 295 -EFAULT : len;
296 break;
293 } 297 }
294 } 298 }
295 299
296 ret = -ENOTTY; 300 ret = -ENOTTY;
297 } 301 }
298 unlock_kernel(); 302 unlock_kernel();
299 return ret; 303 return ret;
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index b84bf066879b..b4eea0292c1a 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -543,8 +543,8 @@ config SENSORS_LM90
543 help 543 help
544 If you say yes here you get support for National Semiconductor LM90, 544 If you say yes here you get support for National Semiconductor LM90,
545 LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, and Maxim 545 LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, and Maxim
546 MAX6646, MAX6647, MAX6649, MAX6657, MAX6658, MAX6659, MAX6680 and 546 MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,
547 MAX6681 sensor chips. 547 MAX6680, MAX6681 and MAX6692 sensor chips.
548 548
549 This driver can also be built as a module. If so, the module 549 This driver can also be built as a module. If so, the module
550 will be called lm90. 550 will be called lm90.
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index e52b38806d03..ad2b3431b725 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -760,8 +760,11 @@ static int abituguru3_read_increment_offset(struct abituguru3_data *data,
760 760
761 for (i = 0; i < offset_count; i++) 761 for (i = 0; i < offset_count; i++)
762 if ((x = abituguru3_read(data, bank, offset + i, count, 762 if ((x = abituguru3_read(data, bank, offset + i, count,
763 buf + i * count)) != count) 763 buf + i * count)) != count) {
764 return i * count + (i && (x < 0)) ? 0 : x; 764 if (x < 0)
765 return x;
766 return i * count + x;
767 }
765 768
766 return i * count; 769 return i * count;
767} 770}
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 609cafff86bc..5f81ddf71508 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1872,7 +1872,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
1872 1872
1873 devid = superio_inw(sioaddr, SIO_REG_MANID); 1873 devid = superio_inw(sioaddr, SIO_REG_MANID);
1874 if (devid != SIO_FINTEK_ID) { 1874 if (devid != SIO_FINTEK_ID) {
1875 printk(KERN_INFO DRVNAME ": Not a Fintek device\n"); 1875 pr_debug(DRVNAME ": Not a Fintek device\n");
1876 goto exit; 1876 goto exit;
1877 } 1877 }
1878 1878
@@ -1932,7 +1932,7 @@ static int __init f71882fg_device_add(unsigned short address,
1932 res.name = f71882fg_pdev->name; 1932 res.name = f71882fg_pdev->name;
1933 err = acpi_check_resource_conflict(&res); 1933 err = acpi_check_resource_conflict(&res);
1934 if (err) 1934 if (err)
1935 return err; 1935 goto exit_device_put;
1936 1936
1937 err = platform_device_add_resources(f71882fg_pdev, &res, 1); 1937 err = platform_device_add_resources(f71882fg_pdev, &res, 1);
1938 if (err) { 1938 if (err) {
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 1692de369969..18a1ba888165 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -617,7 +617,7 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
617static int f75375_probe(struct i2c_client *client, 617static int f75375_probe(struct i2c_client *client,
618 const struct i2c_device_id *id) 618 const struct i2c_device_id *id)
619{ 619{
620 struct f75375_data *data = i2c_get_clientdata(client); 620 struct f75375_data *data;
621 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; 621 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data;
622 int err; 622 int err;
623 623
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index abf4dfc8ec22..29c83b5b9697 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -166,6 +166,18 @@ static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3};
166 }, \ 166 }, \
167 .driver_data = &lis3lv02d_axis_##_axis \ 167 .driver_data = &lis3lv02d_axis_##_axis \
168} 168}
169
170#define AXIS_DMI_MATCH2(_ident, _class1, _name1, \
171 _class2, _name2, \
172 _axis) { \
173 .ident = _ident, \
174 .callback = lis3lv02d_dmi_matched, \
175 .matches = { \
176 DMI_MATCH(DMI_##_class1, _name1), \
177 DMI_MATCH(DMI_##_class2, _name2), \
178 }, \
179 .driver_data = &lis3lv02d_axis_##_axis \
180}
169static struct dmi_system_id lis3lv02d_dmi_ids[] = { 181static struct dmi_system_id lis3lv02d_dmi_ids[] = {
170 /* product names are truncated to match all kinds of a same model */ 182 /* product names are truncated to match all kinds of a same model */
171 AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted), 183 AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted),
@@ -179,6 +191,16 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
179 AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), 191 AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
180 AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), 192 AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
181 AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), 193 AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
194 /* Intel-based HP Pavilion dv5 */
195 AXIS_DMI_MATCH2("HPDV5_I",
196 PRODUCT_NAME, "HP Pavilion dv5",
197 BOARD_NAME, "3603",
198 x_inverted),
199 /* AMD-based HP Pavilion dv5 */
200 AXIS_DMI_MATCH2("HPDV5_A",
201 PRODUCT_NAME, "HP Pavilion dv5",
202 BOARD_NAME, "3600",
203 y_inverted),
182 { NULL, } 204 { NULL, }
183/* Laptop models without axis info (yet): 205/* Laptop models without axis info (yet):
184 * "NC6910" "HP Compaq 6910" 206 * "NC6910" "HP Compaq 6910"
@@ -213,9 +235,49 @@ static struct delayed_led_classdev hpled_led = {
213 .set_brightness = hpled_set, 235 .set_brightness = hpled_set,
214}; 236};
215 237
238static acpi_status
239lis3lv02d_get_resource(struct acpi_resource *resource, void *context)
240{
241 if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
242 struct acpi_resource_extended_irq *irq;
243 u32 *device_irq = context;
244
245 irq = &resource->data.extended_irq;
246 *device_irq = irq->interrupts[0];
247 }
248
249 return AE_OK;
250}
251
252static void lis3lv02d_enum_resources(struct acpi_device *device)
253{
254 acpi_status status;
255
256 status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
257 lis3lv02d_get_resource, &adev.irq);
258 if (ACPI_FAILURE(status))
259 printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n");
260}
261
262static s16 lis3lv02d_read_16(acpi_handle handle, int reg)
263{
264 u8 lo, hi;
265
266 adev.read(handle, reg - 1, &lo);
267 adev.read(handle, reg, &hi);
268 /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
269 return (s16)((hi << 8) | lo);
270}
271
272static s16 lis3lv02d_read_8(acpi_handle handle, int reg)
273{
274 s8 lo;
275 adev.read(handle, reg, &lo);
276 return lo;
277}
278
216static int lis3lv02d_add(struct acpi_device *device) 279static int lis3lv02d_add(struct acpi_device *device)
217{ 280{
218 u8 val;
219 int ret; 281 int ret;
220 282
221 if (!device) 283 if (!device)
@@ -229,10 +291,22 @@ static int lis3lv02d_add(struct acpi_device *device)
229 strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); 291 strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);
230 device->driver_data = &adev; 292 device->driver_data = &adev;
231 293
232 lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val); 294 lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami);
233 if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) { 295 switch (adev.whoami) {
296 case LIS_DOUBLE_ID:
297 printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n");
298 adev.read_data = lis3lv02d_read_16;
299 adev.mdps_max_val = 2048;
300 break;
301 case LIS_SINGLE_ID:
302 printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n");
303 adev.read_data = lis3lv02d_read_8;
304 adev.mdps_max_val = 128;
305 break;
306 default:
234 printk(KERN_ERR DRIVER_NAME 307 printk(KERN_ERR DRIVER_NAME
235 ": Accelerometer chip not LIS3LV02D{L,Q}\n"); 308 ": unknown sensor type 0x%X\n", adev.whoami);
309 return -EINVAL;
236 } 310 }
237 311
238 /* If possible use a "standard" axes order */ 312 /* If possible use a "standard" axes order */
@@ -247,6 +321,9 @@ static int lis3lv02d_add(struct acpi_device *device)
247 if (ret) 321 if (ret)
248 return ret; 322 return ret;
249 323
324 /* obtain IRQ number of our device from ACPI */
325 lis3lv02d_enum_resources(adev.device);
326
250 ret = lis3lv02d_init_device(&adev); 327 ret = lis3lv02d_init_device(&adev);
251 if (ret) { 328 if (ret) {
252 flush_work(&hpled_led.work); 329 flush_work(&hpled_led.work);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 95a99c590da2..9157247fed8e 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -213,7 +213,7 @@ static inline u16 FAN16_TO_REG(long rpm)
213 213
214#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\ 214#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\
215 ((val)+500)/1000),-128,127)) 215 ((val)+500)/1000),-128,127))
216#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000) 216#define TEMP_FROM_REG(val) ((val) * 1000)
217 217
218#define PWM_TO_REG(val) ((val) >> 1) 218#define PWM_TO_REG(val) ((val) >> 1)
219#define PWM_FROM_REG(val) (((val)&0x7f) << 1) 219#define PWM_FROM_REG(val) (((val)&0x7f) << 1)
@@ -267,9 +267,9 @@ struct it87_data {
267 u8 has_fan; /* Bitfield, fans enabled */ 267 u8 has_fan; /* Bitfield, fans enabled */
268 u16 fan[5]; /* Register values, possibly combined */ 268 u16 fan[5]; /* Register values, possibly combined */
269 u16 fan_min[5]; /* Register values, possibly combined */ 269 u16 fan_min[5]; /* Register values, possibly combined */
270 u8 temp[3]; /* Register value */ 270 s8 temp[3]; /* Register value */
271 u8 temp_high[3]; /* Register value */ 271 s8 temp_high[3]; /* Register value */
272 u8 temp_low[3]; /* Register value */ 272 s8 temp_low[3]; /* Register value */
273 u8 sensor; /* Register value */ 273 u8 sensor; /* Register value */
274 u8 fan_div[3]; /* Register encoding, shifted right */ 274 u8 fan_div[3]; /* Register encoding, shifted right */
275 u8 vid; /* Register encoding, combined */ 275 u8 vid; /* Register encoding, combined */
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index 219d2d0d5a62..8bb2158f0453 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.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
@@ -35,6 +35,7 @@
35#include <linux/poll.h> 35#include <linux/poll.h>
36#include <linux/freezer.h> 36#include <linux/freezer.h>
37#include <linux/uaccess.h> 37#include <linux/uaccess.h>
38#include <linux/miscdevice.h>
38#include <acpi/acpi_drivers.h> 39#include <acpi/acpi_drivers.h>
39#include <asm/atomic.h> 40#include <asm/atomic.h>
40#include "lis3lv02d.h" 41#include "lis3lv02d.h"
@@ -52,24 +53,14 @@
52 * joystick. 53 * joystick.
53 */ 54 */
54 55
55/* Maximum value our axis may get for the input device (signed 12 bits) */ 56struct acpi_lis3lv02d adev = {
56#define MDPS_MAX_VAL 2048 57 .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait),
58};
57 59
58struct acpi_lis3lv02d adev;
59EXPORT_SYMBOL_GPL(adev); 60EXPORT_SYMBOL_GPL(adev);
60 61
61static int lis3lv02d_add_fs(struct acpi_device *device); 62static int lis3lv02d_add_fs(struct acpi_device *device);
62 63
63static s16 lis3lv02d_read_16(acpi_handle handle, int reg)
64{
65 u8 lo, hi;
66
67 adev.read(handle, reg, &lo);
68 adev.read(handle, reg + 1, &hi);
69 /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
70 return (s16)((hi << 8) | lo);
71}
72
73/** 64/**
74 * lis3lv02d_get_axis - For the given axis, give the value converted 65 * lis3lv02d_get_axis - For the given axis, give the value converted
75 * @axis: 1,2,3 - can also be negative 66 * @axis: 1,2,3 - can also be negative
@@ -98,9 +89,9 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z)
98{ 89{
99 int position[3]; 90 int position[3];
100 91
101 position[0] = lis3lv02d_read_16(handle, OUTX_L); 92 position[0] = adev.read_data(handle, OUTX);
102 position[1] = lis3lv02d_read_16(handle, OUTY_L); 93 position[1] = adev.read_data(handle, OUTY);
103 position[2] = lis3lv02d_read_16(handle, OUTZ_L); 94 position[2] = adev.read_data(handle, OUTZ);
104 95
105 *x = lis3lv02d_get_axis(adev.ac.x, position); 96 *x = lis3lv02d_get_axis(adev.ac.x, position);
106 *y = lis3lv02d_get_axis(adev.ac.y, position); 97 *y = lis3lv02d_get_axis(adev.ac.y, position);
@@ -110,26 +101,13 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z)
110void lis3lv02d_poweroff(acpi_handle handle) 101void lis3lv02d_poweroff(acpi_handle handle)
111{ 102{
112 adev.is_on = 0; 103 adev.is_on = 0;
113 /* disable X,Y,Z axis and power down */
114 adev.write(handle, CTRL_REG1, 0x00);
115} 104}
116EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); 105EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);
117 106
118void lis3lv02d_poweron(acpi_handle handle) 107void lis3lv02d_poweron(acpi_handle handle)
119{ 108{
120 u8 val;
121
122 adev.is_on = 1; 109 adev.is_on = 1;
123 adev.init(handle); 110 adev.init(handle);
124 adev.write(handle, FF_WU_CFG, 0);
125 /*
126 * BDU: LSB and MSB values are not updated until both have been read.
127 * So the value read will always be correct.
128 * IEN: Interrupt for free-fall and DD, not for data-ready.
129 */
130 adev.read(handle, CTRL_REG2, &val);
131 val |= CTRL2_BDU | CTRL2_IEN;
132 adev.write(handle, CTRL_REG2, val);
133} 111}
134EXPORT_SYMBOL_GPL(lis3lv02d_poweron); 112EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
135 113
@@ -162,6 +140,140 @@ static void lis3lv02d_decrease_use(struct acpi_lis3lv02d *dev)
162 mutex_unlock(&dev->lock); 140 mutex_unlock(&dev->lock);
163} 141}
164 142
143static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
144{
145 /*
146 * Be careful: on some HP laptops the bios force DD when on battery and
147 * the lid is closed. This leads to interrupts as soon as a little move
148 * is done.
149 */
150 atomic_inc(&adev.count);
151
152 wake_up_interruptible(&adev.misc_wait);
153 kill_fasync(&adev.async_queue, SIGIO, POLL_IN);
154 return IRQ_HANDLED;
155}
156
157static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
158{
159 int ret;
160
161 if (test_and_set_bit(0, &adev.misc_opened))
162 return -EBUSY; /* already open */
163
164 atomic_set(&adev.count, 0);
165
166 /*
167 * The sensor can generate interrupts for free-fall and direction
168 * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep
169 * the things simple and _fast_ we activate it only for free-fall, so
170 * no need to read register (very slow with ACPI). For the same reason,
171 * we forbid shared interrupts.
172 *
173 * IRQF_TRIGGER_RISING seems pointless on HP laptops because the
174 * io-apic is not configurable (and generates a warning) but I keep it
175 * in case of support for other hardware.
176 */
177 ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING,
178 DRIVER_NAME, &adev);
179
180 if (ret) {
181 clear_bit(0, &adev.misc_opened);
182 printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq);
183 return -EBUSY;
184 }
185 lis3lv02d_increase_use(&adev);
186 printk("lis3: registered interrupt %d\n", adev.irq);
187 return 0;
188}
189
190static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
191{
192 fasync_helper(-1, file, 0, &adev.async_queue);
193 lis3lv02d_decrease_use(&adev);
194 free_irq(adev.irq, &adev);
195 clear_bit(0, &adev.misc_opened); /* release the device */
196 return 0;
197}
198
199static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
200 size_t count, loff_t *pos)
201{
202 DECLARE_WAITQUEUE(wait, current);
203 u32 data;
204 unsigned char byte_data;
205 ssize_t retval = 1;
206
207 if (count < 1)
208 return -EINVAL;
209
210 add_wait_queue(&adev.misc_wait, &wait);
211 while (true) {
212 set_current_state(TASK_INTERRUPTIBLE);
213 data = atomic_xchg(&adev.count, 0);
214 if (data)
215 break;
216
217 if (file->f_flags & O_NONBLOCK) {
218 retval = -EAGAIN;
219 goto out;
220 }
221
222 if (signal_pending(current)) {
223 retval = -ERESTARTSYS;
224 goto out;
225 }
226
227 schedule();
228 }
229
230 if (data < 255)
231 byte_data = data;
232 else
233 byte_data = 255;
234
235 /* make sure we are not going into copy_to_user() with
236 * TASK_INTERRUPTIBLE state */
237 set_current_state(TASK_RUNNING);
238 if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
239 retval = -EFAULT;
240
241out:
242 __set_current_state(TASK_RUNNING);
243 remove_wait_queue(&adev.misc_wait, &wait);
244
245 return retval;
246}
247
248static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
249{
250 poll_wait(file, &adev.misc_wait, wait);
251 if (atomic_read(&adev.count))
252 return POLLIN | POLLRDNORM;
253 return 0;
254}
255
256static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)
257{
258 return fasync_helper(fd, file, on, &adev.async_queue);
259}
260
261static const struct file_operations lis3lv02d_misc_fops = {
262 .owner = THIS_MODULE,
263 .llseek = no_llseek,
264 .read = lis3lv02d_misc_read,
265 .open = lis3lv02d_misc_open,
266 .release = lis3lv02d_misc_release,
267 .poll = lis3lv02d_misc_poll,
268 .fasync = lis3lv02d_misc_fasync,
269};
270
271static struct miscdevice lis3lv02d_misc_device = {
272 .minor = MISC_DYNAMIC_MINOR,
273 .name = "freefall",
274 .fops = &lis3lv02d_misc_fops,
275};
276
165/** 277/**
166 * lis3lv02d_joystick_kthread - Kthread polling function 278 * lis3lv02d_joystick_kthread - Kthread polling function
167 * @data: unused - here to conform to threadfn prototype 279 * @data: unused - here to conform to threadfn prototype
@@ -203,7 +315,6 @@ static void lis3lv02d_joystick_close(struct input_dev *input)
203 lis3lv02d_decrease_use(&adev); 315 lis3lv02d_decrease_use(&adev);
204} 316}
205 317
206
207static inline void lis3lv02d_calibrate_joystick(void) 318static inline void lis3lv02d_calibrate_joystick(void)
208{ 319{
209 lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); 320 lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib);
@@ -231,9 +342,9 @@ int lis3lv02d_joystick_enable(void)
231 adev.idev->close = lis3lv02d_joystick_close; 342 adev.idev->close = lis3lv02d_joystick_close;
232 343
233 set_bit(EV_ABS, adev.idev->evbit); 344 set_bit(EV_ABS, adev.idev->evbit);
234 input_set_abs_params(adev.idev, ABS_X, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); 345 input_set_abs_params(adev.idev, ABS_X, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);
235 input_set_abs_params(adev.idev, ABS_Y, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); 346 input_set_abs_params(adev.idev, ABS_Y, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);
236 input_set_abs_params(adev.idev, ABS_Z, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); 347 input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);
237 348
238 err = input_register_device(adev.idev); 349 err = input_register_device(adev.idev);
239 if (err) { 350 if (err) {
@@ -250,6 +361,7 @@ void lis3lv02d_joystick_disable(void)
250 if (!adev.idev) 361 if (!adev.idev)
251 return; 362 return;
252 363
364 misc_deregister(&lis3lv02d_misc_device);
253 input_unregister_device(adev.idev); 365 input_unregister_device(adev.idev);
254 adev.idev = NULL; 366 adev.idev = NULL;
255} 367}
@@ -268,6 +380,19 @@ int lis3lv02d_init_device(struct acpi_lis3lv02d *dev)
268 if (lis3lv02d_joystick_enable()) 380 if (lis3lv02d_joystick_enable())
269 printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n"); 381 printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");
270 382
383 printk("lis3_init_device: irq %d\n", dev->irq);
384
385 /* if we did not get an IRQ from ACPI - we have nothing more to do */
386 if (!dev->irq) {
387 printk(KERN_ERR DRIVER_NAME
388 ": No IRQ in ACPI. Disabling /dev/freefall\n");
389 goto out;
390 }
391
392 printk("lis3: registering device\n");
393 if (misc_register(&lis3lv02d_misc_device))
394 printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
395out:
271 lis3lv02d_decrease_use(dev); 396 lis3lv02d_decrease_use(dev);
272 return 0; 397 return 0;
273} 398}
@@ -351,6 +476,6 @@ int lis3lv02d_remove_fs(void)
351EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); 476EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
352 477
353MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver"); 478MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver");
354MODULE_AUTHOR("Yan Burman and Eric Piel"); 479MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
355MODULE_LICENSE("GPL"); 480MODULE_LICENSE("GPL");
356 481
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h
index 223f1c0763bb..75972bf372ff 100644
--- a/drivers/hwmon/lis3lv02d.h
+++ b/drivers/hwmon/lis3lv02d.h
@@ -22,12 +22,15 @@
22/* 22/*
23 * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to 23 * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to
24 * be connected via SPI. There exists also several similar chips (such as LIS302DL or 24 * be connected via SPI. There exists also several similar chips (such as LIS302DL or
25 * LIS3L02DQ) but not in the HP laptops and they have slightly different registers. 25 * LIS3L02DQ) and they have slightly different registers, but we can provide a
26 * common interface for all of them.
26 * They can also be connected via I²C. 27 * They can also be connected via I²C.
27 */ 28 */
28 29
29#define LIS3LV02DL_ID 0x3A /* Also the LIS3LV02DQ */ 30/* 2-byte registers */
30#define LIS302DL_ID 0x3B /* Also the LIS202DL! */ 31#define LIS_DOUBLE_ID 0x3A /* LIS3LV02D[LQ] */
32/* 1-byte registers */
33#define LIS_SINGLE_ID 0x3B /* LIS[32]02DL and others */
31 34
32enum lis3lv02d_reg { 35enum lis3lv02d_reg {
33 WHO_AM_I = 0x0F, 36 WHO_AM_I = 0x0F,
@@ -44,10 +47,13 @@ enum lis3lv02d_reg {
44 STATUS_REG = 0x27, 47 STATUS_REG = 0x27,
45 OUTX_L = 0x28, 48 OUTX_L = 0x28,
46 OUTX_H = 0x29, 49 OUTX_H = 0x29,
50 OUTX = 0x29,
47 OUTY_L = 0x2A, 51 OUTY_L = 0x2A,
48 OUTY_H = 0x2B, 52 OUTY_H = 0x2B,
53 OUTY = 0x2B,
49 OUTZ_L = 0x2C, 54 OUTZ_L = 0x2C,
50 OUTZ_H = 0x2D, 55 OUTZ_H = 0x2D,
56 OUTZ = 0x2D,
51 FF_WU_CFG = 0x30, 57 FF_WU_CFG = 0x30,
52 FF_WU_SRC = 0x31, 58 FF_WU_SRC = 0x31,
53 FF_WU_ACK = 0x32, 59 FF_WU_ACK = 0x32,
@@ -159,6 +165,10 @@ struct acpi_lis3lv02d {
159 acpi_status (*write) (acpi_handle handle, int reg, u8 val); 165 acpi_status (*write) (acpi_handle handle, int reg, u8 val);
160 acpi_status (*read) (acpi_handle handle, int reg, u8 *ret); 166 acpi_status (*read) (acpi_handle handle, int reg, u8 *ret);
161 167
168 u8 whoami; /* 3Ah: 2-byte registries, 3Bh: 1-byte registries */
169 s16 (*read_data) (acpi_handle handle, int reg);
170 int mdps_max_val;
171
162 struct input_dev *idev; /* input device */ 172 struct input_dev *idev; /* input device */
163 struct task_struct *kthread; /* kthread for input */ 173 struct task_struct *kthread; /* kthread for input */
164 struct mutex lock; 174 struct mutex lock;
@@ -170,6 +180,11 @@ struct acpi_lis3lv02d {
170 unsigned char is_on; /* whether the device is on or off */ 180 unsigned char is_on; /* whether the device is on or off */
171 unsigned char usage; /* usage counter */ 181 unsigned char usage; /* usage counter */
172 struct axis_conversion ac; /* hw -> logical axis */ 182 struct axis_conversion ac; /* hw -> logical axis */
183
184 u32 irq; /* IRQ number */
185 struct fasync_struct *async_queue; /* queue for the misc device */
186 wait_queue_head_t misc_wait; /* Wait queue for the misc device */
187 unsigned long misc_opened; /* bit0: whether the device is open */
173}; 188};
174 189
175int lis3lv02d_init_device(struct acpi_lis3lv02d *dev); 190int lis3lv02d_init_device(struct acpi_lis3lv02d *dev);
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index cfc1ee90f5a3..b251d8674b41 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -72,6 +72,7 @@ I2C_CLIENT_INSMOD_7(lm85b, lm85c, adm1027, adt7463, adt7468, emc6d100,
72#define LM85_COMPANY_SMSC 0x5c 72#define LM85_COMPANY_SMSC 0x5c
73#define LM85_VERSTEP_VMASK 0xf0 73#define LM85_VERSTEP_VMASK 0xf0
74#define LM85_VERSTEP_GENERIC 0x60 74#define LM85_VERSTEP_GENERIC 0x60
75#define LM85_VERSTEP_GENERIC2 0x70
75#define LM85_VERSTEP_LM85C 0x60 76#define LM85_VERSTEP_LM85C 0x60
76#define LM85_VERSTEP_LM85B 0x62 77#define LM85_VERSTEP_LM85B 0x62
77#define LM85_VERSTEP_ADM1027 0x60 78#define LM85_VERSTEP_ADM1027 0x60
@@ -334,6 +335,7 @@ static struct lm85_data *lm85_update_device(struct device *dev);
334static const struct i2c_device_id lm85_id[] = { 335static const struct i2c_device_id lm85_id[] = {
335 { "adm1027", adm1027 }, 336 { "adm1027", adm1027 },
336 { "adt7463", adt7463 }, 337 { "adt7463", adt7463 },
338 { "adt7468", adt7468 },
337 { "lm85", any_chip }, 339 { "lm85", any_chip },
338 { "lm85b", lm85b }, 340 { "lm85b", lm85b },
339 { "lm85c", lm85c }, 341 { "lm85c", lm85c },
@@ -408,7 +410,8 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr,
408 struct lm85_data *data = lm85_update_device(dev); 410 struct lm85_data *data = lm85_update_device(dev);
409 int vid; 411 int vid;
410 412
411 if (data->type == adt7463 && (data->vid & 0x80)) { 413 if ((data->type == adt7463 || data->type == adt7468) &&
414 (data->vid & 0x80)) {
412 /* 6-pin VID (VRM 10) */ 415 /* 6-pin VID (VRM 10) */
413 vid = vid_from_reg(data->vid & 0x3f, data->vrm); 416 vid = vid_from_reg(data->vid & 0x3f, data->vrm);
414 } else { 417 } else {
@@ -1153,7 +1156,8 @@ static int lm85_detect(struct i2c_client *client, int kind,
1153 address, company, verstep); 1156 address, company, verstep);
1154 1157
1155 /* All supported chips have the version in common */ 1158 /* All supported chips have the version in common */
1156 if ((verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC) { 1159 if ((verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC &&
1160 (verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC2) {
1157 dev_dbg(&adapter->dev, "Autodetection failed: " 1161 dev_dbg(&adapter->dev, "Autodetection failed: "
1158 "unsupported version\n"); 1162 "unsupported version\n");
1159 return -ENODEV; 1163 return -ENODEV;
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 96a701866726..1aff7575799d 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -32,10 +32,10 @@
32 * supported by this driver. These chips lack the remote temperature 32 * supported by this driver. These chips lack the remote temperature
33 * offset feature. 33 * offset feature.
34 * 34 *
35 * This driver also supports the MAX6646, MAX6647 and MAX6649 chips 35 * This driver also supports the MAX6646, MAX6647, MAX6648, MAX6649 and
36 * made by Maxim. These are again similar to the LM86, but they use 36 * MAX6692 chips made by Maxim. These are again similar to the LM86,
37 * unsigned temperature values and can report temperatures from 0 to 37 * but they use unsigned temperature values and can report temperatures
38 * 145 degrees. 38 * from 0 to 145 degrees.
39 * 39 *
40 * This driver also supports the MAX6680 and MAX6681, two other sensor 40 * This driver also supports the MAX6680 and MAX6681, two other sensor
41 * chips made by Maxim. These are quite similar to the other Maxim 41 * chips made by Maxim. These are quite similar to the other Maxim
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c
index b0ce37852281..73f77a9b8b18 100644
--- a/drivers/hwmon/vt1211.c
+++ b/drivers/hwmon/vt1211.c
@@ -1262,7 +1262,7 @@ static int __init vt1211_device_add(unsigned short address)
1262 res.name = pdev->name; 1262 res.name = pdev->name;
1263 err = acpi_check_resource_conflict(&res); 1263 err = acpi_check_resource_conflict(&res);
1264 if (err) 1264 if (err)
1265 goto EXIT; 1265 goto EXIT_DEV_PUT;
1266 1266
1267 err = platform_device_add_resources(pdev, &res, 1); 1267 err = platform_device_add_resources(pdev, &res, 1);
1268 if (err) { 1268 if (err) {
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index cb808d015361..feae743ba991 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -1548,7 +1548,7 @@ static int __init sensors_w83627ehf_init(void)
1548 1548
1549 err = acpi_check_resource_conflict(&res); 1549 err = acpi_check_resource_conflict(&res);
1550 if (err) 1550 if (err)
1551 goto exit; 1551 goto exit_device_put;
1552 1552
1553 err = platform_device_add_resources(pdev, &res, 1); 1553 err = platform_device_add_resources(pdev, &res, 1);
1554 if (err) { 1554 if (err) {
diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c
index 9fee3ca17344..9aefb5e5864d 100644
--- a/drivers/i2c/busses/i2c-acorn.c
+++ b/drivers/i2c/busses/i2c-acorn.c
@@ -79,10 +79,11 @@ static struct i2c_algo_bit_data ioc_data = {
79 .getsda = ioc_getsda, 79 .getsda = ioc_getsda,
80 .getscl = ioc_getscl, 80 .getscl = ioc_getscl,
81 .udelay = 80, 81 .udelay = 80,
82 .timeout = 100 82 .timeout = HZ,
83}; 83};
84 84
85static struct i2c_adapter ioc_ops = { 85static struct i2c_adapter ioc_ops = {
86 .nr = 0,
86 .algo_data = &ioc_data, 87 .algo_data = &ioc_data,
87}; 88};
88 89
@@ -90,7 +91,7 @@ static int __init i2c_ioc_init(void)
90{ 91{
91 force_ones = FORCE_ONES | SCL | SDA; 92 force_ones = FORCE_ONES | SCL | SDA;
92 93
93 return i2c_bit_add_bus(&ioc_ops); 94 return i2c_bit_add_numbered_bus(&ioc_ops);
94} 95}
95 96
96module_init(i2c_ioc_init); 97module_init(i2c_ioc_init);
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index edab51973bf5..a7c59908c457 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -72,7 +72,7 @@ static unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
72{ 72{
73 int timeout = 500; 73 int timeout = 500;
74 74
75 while (timeout-- && (inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF)) 75 while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout)
76 udelay(1); 76 udelay(1);
77 77
78 if (!timeout) { 78 if (!timeout) {
@@ -88,7 +88,7 @@ static unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
88{ 88{
89 int timeout = 500; 89 int timeout = 500;
90 90
91 while (timeout-- && (~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF)) 91 while ((~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF) && --timeout)
92 udelay(1); 92 udelay(1);
93 93
94 if (!timeout) { 94 if (!timeout) {
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
index 8e8467970481..c016f7a2c5fc 100644
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -114,7 +114,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev)
114 drv_data->algo_data.getsda = ixp2000_bit_getsda; 114 drv_data->algo_data.getsda = ixp2000_bit_getsda;
115 drv_data->algo_data.getscl = ixp2000_bit_getscl; 115 drv_data->algo_data.getscl = ixp2000_bit_getscl;
116 drv_data->algo_data.udelay = 6; 116 drv_data->algo_data.udelay = 6;
117 drv_data->algo_data.timeout = 100; 117 drv_data->algo_data.timeout = HZ;
118 118
119 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, 119 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
120 sizeof(drv_data->adapter.name)); 120 sizeof(drv_data->adapter.name));
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index eeda276f8f16..7f186bbcb99d 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -482,7 +482,7 @@ mv64xxx_i2c_map_regs(struct platform_device *pd,
482 return 0; 482 return 0;
483} 483}
484 484
485static void __devexit 485static void
486mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data) 486mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
487{ 487{
488 if (drv_data->reg_base) { 488 if (drv_data->reg_base) {
@@ -577,7 +577,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
577 577
578static struct platform_driver mv64xxx_i2c_driver = { 578static struct platform_driver mv64xxx_i2c_driver = {
579 .probe = mv64xxx_i2c_probe, 579 .probe = mv64xxx_i2c_probe,
580 .remove = mv64xxx_i2c_remove, 580 .remove = __devexit_p(mv64xxx_i2c_remove),
581 .driver = { 581 .driver = {
582 .owner = THIS_MODULE, 582 .owner = THIS_MODULE,
583 .name = MV64XXX_I2C_CTLR_NAME, 583 .name = MV64XXX_I2C_CTLR_NAME,
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 6af68146c342..bdb1f7510e91 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -644,7 +644,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
644 644
645 i2c_pxa_start_message(i2c); 645 i2c_pxa_start_message(i2c);
646 646
647 while (timeout-- && i2c->msg_num > 0) { 647 while (i2c->msg_num > 0 && --timeout) {
648 i2c_pxa_handler(0, i2c); 648 i2c_pxa_handler(0, i2c);
649 udelay(10); 649 udelay(10);
650 } 650 }
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
index 162b74a04886..42df0eca43d5 100644
--- a/drivers/i2c/busses/scx200_i2c.c
+++ b/drivers/i2c/busses/scx200_i2c.c
@@ -76,7 +76,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
76 .getsda = scx200_i2c_getsda, 76 .getsda = scx200_i2c_getsda,
77 .getscl = scx200_i2c_getscl, 77 .getscl = scx200_i2c_getscl,
78 .udelay = 10, 78 .udelay = 10,
79 .timeout = 100, 79 .timeout = HZ,
80}; 80};
81 81
82static struct i2c_adapter scx200_i2c_ops = { 82static struct i2c_adapter scx200_i2c_ops = {
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b1c9abe24c7b..e7d984866de0 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1831,7 +1831,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
1831 case I2C_SMBUS_QUICK: 1831 case I2C_SMBUS_QUICK:
1832 msg[0].len = 0; 1832 msg[0].len = 0;
1833 /* Special case: The read/write field is used as data */ 1833 /* Special case: The read/write field is used as data */
1834 msg[0].flags = flags | (read_write==I2C_SMBUS_READ)?I2C_M_RD:0; 1834 msg[0].flags = flags | (read_write == I2C_SMBUS_READ ?
1835 I2C_M_RD : 0);
1835 num = 1; 1836 num = 1;
1836 break; 1837 break;
1837 case I2C_SMBUS_BYTE: 1838 case I2C_SMBUS_BYTE:
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index c171988a9f51..7e13d2df9af3 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -35,6 +35,7 @@
35#include <linux/i2c.h> 35#include <linux/i2c.h>
36#include <linux/i2c-dev.h> 36#include <linux/i2c-dev.h>
37#include <linux/smp_lock.h> 37#include <linux/smp_lock.h>
38#include <linux/jiffies.h>
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39 40
40static struct i2c_driver i2cdev_driver; 41static struct i2c_driver i2cdev_driver;
@@ -422,7 +423,10 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
422 client->adapter->retries = arg; 423 client->adapter->retries = arg;
423 break; 424 break;
424 case I2C_TIMEOUT: 425 case I2C_TIMEOUT:
425 client->adapter->timeout = arg; 426 /* For historical reasons, user-space sets the timeout
427 * value in units of 10 ms.
428 */
429 client->adapter->timeout = msecs_to_jiffies(arg * 10);
426 break; 430 break;
427 default: 431 default:
428 /* NOTE: returning a fault code here could cause trouble 432 /* NOTE: returning a fault code here could cause trouble
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 3dad2299d9c5..5ea3bfad172a 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -46,7 +46,7 @@ menuconfig IDE
46 SMART parameters from disk drives. 46 SMART parameters from disk drives.
47 47
48 To compile this driver as a module, choose M here: the 48 To compile this driver as a module, choose M here: the
49 module will be called ide. 49 module will be called ide-core.ko.
50 50
51 For further information, please read <file:Documentation/ide/ide.txt>. 51 For further information, please read <file:Documentation/ide/ide.txt>.
52 52
@@ -721,6 +721,11 @@ config BLK_DEV_IDE_TX4939
721 depends on SOC_TX4939 721 depends on SOC_TX4939
722 select BLK_DEV_IDEDMA_SFF 722 select BLK_DEV_IDEDMA_SFF
723 723
724config BLK_DEV_IDE_AT91
725 tristate "Atmel AT91 (SAM9, CAP9, AT572D940HF) IDE support"
726 depends on ARM && ARCH_AT91 && !ARCH_AT91RM9200 && !ARCH_AT91X40
727 select IDE_TIMINGS
728
724config IDE_ARM 729config IDE_ARM
725 tristate "ARM IDE support" 730 tristate "ARM IDE support"
726 depends on ARM && (ARCH_RPC || ARCH_SHARK) 731 depends on ARM && (ARCH_RPC || ARCH_SHARK)
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index d0e3d7d5b467..1c326d94aa6d 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -116,3 +116,4 @@ obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o
116 116
117obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o 117obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o
118obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o 118obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o
119obj-$(CONFIG_BLK_DEV_IDE_AT91) += at91_ide.o
diff --git a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c
index 69660a431cd9..77267c859965 100644
--- a/drivers/ide/amd74xx.c
+++ b/drivers/ide/amd74xx.c
@@ -166,7 +166,7 @@ static unsigned int init_chipset_amd74xx(struct pci_dev *dev)
166 * Check for broken FIFO support. 166 * Check for broken FIFO support.
167 */ 167 */
168 if (dev->vendor == PCI_VENDOR_ID_AMD && 168 if (dev->vendor == PCI_VENDOR_ID_AMD &&
169 dev->vendor == PCI_DEVICE_ID_AMD_VIPER_7411) 169 dev->device == PCI_DEVICE_ID_AMD_VIPER_7411)
170 t &= 0x0f; 170 t &= 0x0f;
171 else 171 else
172 t |= 0xf0; 172 t |= 0xf0;
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
new file mode 100644
index 000000000000..1bb50f46388d
--- /dev/null
+++ b/drivers/ide/at91_ide.c
@@ -0,0 +1,467 @@
1/*
2 * IDE host driver for AT91 (SAM9, CAP9, AT572D940HF) Static Memory Controller
3 * with Compact Flash True IDE logic
4 *
5 * Copyright (c) 2008, 2009 Kelvatek Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23#include <linux/version.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/clk.h>
27#include <linux/err.h>
28#include <linux/ide.h>
29#include <linux/platform_device.h>
30
31#include <mach/board.h>
32#include <mach/gpio.h>
33#include <mach/at91sam9263.h>
34#include <mach/at91sam9_smc.h>
35#include <mach/at91sam9263_matrix.h>
36
37#define DRV_NAME "at91_ide"
38
39#define perr(fmt, args...) pr_err(DRV_NAME ": " fmt, ##args)
40#define pdbg(fmt, args...) pr_debug("%s " fmt, __func__, ##args)
41
42/*
43 * Access to IDE device is possible through EBI Static Memory Controller
44 * with Compact Flash logic. For details see EBI and SMC datasheet sections
45 * of any microcontroller from AT91SAM9 family.
46 *
47 * Within SMC chip select address space, lines A[23:21] distinguish Compact
48 * Flash modes (I/O, common memory, attribute memory, True IDE). IDE modes are:
49 * 0x00c0000 - True IDE
50 * 0x00e0000 - Alternate True IDE (Alt Status Register)
51 *
52 * On True IDE mode Task File and Data Register are mapped at the same address.
53 * To distinguish access between these two different bus data width is used:
54 * 8Bit for Task File, 16Bit for Data I/O.
55 *
56 * After initialization we do 8/16 bit flipping (changes in SMC MODE register)
57 * only inside IDE callback routines which are serialized by IDE layer,
58 * so no additional locking needed.
59 */
60
61#define TASK_FILE 0x00c00000
62#define ALT_MODE 0x00e00000
63#define REGS_SIZE 8
64
65#define enter_16bit(cs, mode) do { \
66 mode = at91_sys_read(AT91_SMC_MODE(cs)); \
67 at91_sys_write(AT91_SMC_MODE(cs), mode | AT91_SMC_DBW_16); \
68} while (0)
69
70#define leave_16bit(cs, mode) at91_sys_write(AT91_SMC_MODE(cs), mode);
71
72static void set_smc_timings(const u8 chipselect, const u16 cycle,
73 const u16 setup, const u16 pulse,
74 const u16 data_float, int use_iordy)
75{
76 unsigned long mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
77 AT91_SMC_BAT_SELECT;
78
79 /* disable or enable waiting for IORDY signal */
80 if (use_iordy)
81 mode |= AT91_SMC_EXNWMODE_READY;
82
83 /* add data float cycles if needed */
84 if (data_float)
85 mode |= AT91_SMC_TDF_(data_float);
86
87 at91_sys_write(AT91_SMC_MODE(chipselect), mode);
88
89 /* setup timings in SMC */
90 at91_sys_write(AT91_SMC_SETUP(chipselect), AT91_SMC_NWESETUP_(setup) |
91 AT91_SMC_NCS_WRSETUP_(0) |
92 AT91_SMC_NRDSETUP_(setup) |
93 AT91_SMC_NCS_RDSETUP_(0));
94 at91_sys_write(AT91_SMC_PULSE(chipselect), AT91_SMC_NWEPULSE_(pulse) |
95 AT91_SMC_NCS_WRPULSE_(cycle) |
96 AT91_SMC_NRDPULSE_(pulse) |
97 AT91_SMC_NCS_RDPULSE_(cycle));
98 at91_sys_write(AT91_SMC_CYCLE(chipselect), AT91_SMC_NWECYCLE_(cycle) |
99 AT91_SMC_NRDCYCLE_(cycle));
100}
101
102static unsigned int calc_mck_cycles(unsigned int ns, unsigned int mck_hz)
103{
104 u64 tmp = ns;
105
106 tmp *= mck_hz;
107 tmp += 1000*1000*1000 - 1; /* round up */
108 do_div(tmp, 1000*1000*1000);
109 return (unsigned int) tmp;
110}
111
112static void apply_timings(const u8 chipselect, const u8 pio,
113 const struct ide_timing *timing, int use_iordy)
114{
115 unsigned int t0, t1, t2, t6z;
116 unsigned int cycle, setup, pulse, data_float;
117 unsigned int mck_hz;
118 struct clk *mck;
119
120 /* see table 22 of Compact Flash standard 4.1 for the meaning,
121 * we do not stretch active (t2) time, so setup (t1) + hold time (th)
122 * assure at least minimal recovery (t2i) time */
123 t0 = timing->cyc8b;
124 t1 = timing->setup;
125 t2 = timing->act8b;
126 t6z = (pio < 5) ? 30 : 20;
127
128 pdbg("t0=%u t1=%u t2=%u t6z=%u\n", t0, t1, t2, t6z);
129
130 mck = clk_get(NULL, "mck");
131 BUG_ON(IS_ERR(mck));
132 mck_hz = clk_get_rate(mck);
133 pdbg("mck_hz=%u\n", mck_hz);
134
135 cycle = calc_mck_cycles(t0, mck_hz);
136 setup = calc_mck_cycles(t1, mck_hz);
137 pulse = calc_mck_cycles(t2, mck_hz);
138 data_float = calc_mck_cycles(t6z, mck_hz);
139
140 pdbg("cycle=%u setup=%u pulse=%u data_float=%u\n",
141 cycle, setup, pulse, data_float);
142
143 set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy);
144}
145
146static void at91_ide_input_data(ide_drive_t *drive, struct request *rq,
147 void *buf, unsigned int len)
148{
149 ide_hwif_t *hwif = drive->hwif;
150 struct ide_io_ports *io_ports = &hwif->io_ports;
151 u8 chipselect = hwif->select_data;
152 unsigned long mode;
153
154 pdbg("cs %u buf %p len %d\n", chipselect, buf, len);
155
156 len++;
157
158 enter_16bit(chipselect, mode);
159 __ide_mm_insw((void __iomem *) io_ports->data_addr, buf, len / 2);
160 leave_16bit(chipselect, mode);
161}
162
163static void at91_ide_output_data(ide_drive_t *drive, struct request *rq,
164 void *buf, unsigned int len)
165{
166 ide_hwif_t *hwif = drive->hwif;
167 struct ide_io_ports *io_ports = &hwif->io_ports;
168 u8 chipselect = hwif->select_data;
169 unsigned long mode;
170
171 pdbg("cs %u buf %p len %d\n", chipselect, buf, len);
172
173 enter_16bit(chipselect, mode);
174 __ide_mm_outsw((void __iomem *) io_ports->data_addr, buf, len / 2);
175 leave_16bit(chipselect, mode);
176}
177
178static u8 ide_mm_inb(unsigned long port)
179{
180 return readb((void __iomem *) port);
181}
182
183static void ide_mm_outb(u8 value, unsigned long port)
184{
185 writeb(value, (void __iomem *) port);
186}
187
188static void at91_ide_tf_load(ide_drive_t *drive, ide_task_t *task)
189{
190 ide_hwif_t *hwif = drive->hwif;
191 struct ide_io_ports *io_ports = &hwif->io_ports;
192 struct ide_taskfile *tf = &task->tf;
193 u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
194
195 if (task->tf_flags & IDE_TFLAG_FLAGGED)
196 HIHI = 0xFF;
197
198 if (task->tf_flags & IDE_TFLAG_OUT_DATA) {
199 u16 data = (tf->hob_data << 8) | tf->data;
200
201 at91_ide_output_data(drive, NULL, &data, 2);
202 }
203
204 if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
205 ide_mm_outb(tf->hob_feature, io_ports->feature_addr);
206 if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
207 ide_mm_outb(tf->hob_nsect, io_ports->nsect_addr);
208 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
209 ide_mm_outb(tf->hob_lbal, io_ports->lbal_addr);
210 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
211 ide_mm_outb(tf->hob_lbam, io_ports->lbam_addr);
212 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
213 ide_mm_outb(tf->hob_lbah, io_ports->lbah_addr);
214
215 if (task->tf_flags & IDE_TFLAG_OUT_FEATURE)
216 ide_mm_outb(tf->feature, io_ports->feature_addr);
217 if (task->tf_flags & IDE_TFLAG_OUT_NSECT)
218 ide_mm_outb(tf->nsect, io_ports->nsect_addr);
219 if (task->tf_flags & IDE_TFLAG_OUT_LBAL)
220 ide_mm_outb(tf->lbal, io_ports->lbal_addr);
221 if (task->tf_flags & IDE_TFLAG_OUT_LBAM)
222 ide_mm_outb(tf->lbam, io_ports->lbam_addr);
223 if (task->tf_flags & IDE_TFLAG_OUT_LBAH)
224 ide_mm_outb(tf->lbah, io_ports->lbah_addr);
225
226 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE)
227 ide_mm_outb((tf->device & HIHI) | drive->select, io_ports->device_addr);
228}
229
230static void at91_ide_tf_read(ide_drive_t *drive, ide_task_t *task)
231{
232 ide_hwif_t *hwif = drive->hwif;
233 struct ide_io_ports *io_ports = &hwif->io_ports;
234 struct ide_taskfile *tf = &task->tf;
235
236 if (task->tf_flags & IDE_TFLAG_IN_DATA) {
237 u16 data;
238
239 at91_ide_input_data(drive, NULL, &data, 2);
240 tf->data = data & 0xff;
241 tf->hob_data = (data >> 8) & 0xff;
242 }
243
244 /* be sure we're looking at the low order bits */
245 ide_mm_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr);
246
247 if (task->tf_flags & IDE_TFLAG_IN_FEATURE)
248 tf->feature = ide_mm_inb(io_ports->feature_addr);
249 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
250 tf->nsect = ide_mm_inb(io_ports->nsect_addr);
251 if (task->tf_flags & IDE_TFLAG_IN_LBAL)
252 tf->lbal = ide_mm_inb(io_ports->lbal_addr);
253 if (task->tf_flags & IDE_TFLAG_IN_LBAM)
254 tf->lbam = ide_mm_inb(io_ports->lbam_addr);
255 if (task->tf_flags & IDE_TFLAG_IN_LBAH)
256 tf->lbah = ide_mm_inb(io_ports->lbah_addr);
257 if (task->tf_flags & IDE_TFLAG_IN_DEVICE)
258 tf->device = ide_mm_inb(io_ports->device_addr);
259
260 if (task->tf_flags & IDE_TFLAG_LBA48) {
261 ide_mm_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr);
262
263 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
264 tf->hob_feature = ide_mm_inb(io_ports->feature_addr);
265 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
266 tf->hob_nsect = ide_mm_inb(io_ports->nsect_addr);
267 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
268 tf->hob_lbal = ide_mm_inb(io_ports->lbal_addr);
269 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
270 tf->hob_lbam = ide_mm_inb(io_ports->lbam_addr);
271 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
272 tf->hob_lbah = ide_mm_inb(io_ports->lbah_addr);
273 }
274}
275
276static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
277{
278 struct ide_timing *timing;
279 u8 chipselect = drive->hwif->select_data;
280 int use_iordy = 0;
281
282 pdbg("chipselect %u pio %u\n", chipselect, pio);
283
284 timing = ide_timing_find_mode(XFER_PIO_0 + pio);
285 BUG_ON(!timing);
286
287 if ((pio > 2 || ata_id_has_iordy(drive->id)) &&
288 !(ata_id_is_cfa(drive->id) && pio > 4))
289 use_iordy = 1;
290
291 apply_timings(chipselect, pio, timing, use_iordy);
292}
293
294static const struct ide_tp_ops at91_ide_tp_ops = {
295 .exec_command = ide_exec_command,
296 .read_status = ide_read_status,
297 .read_altstatus = ide_read_altstatus,
298 .set_irq = ide_set_irq,
299
300 .tf_load = at91_ide_tf_load,
301 .tf_read = at91_ide_tf_read,
302
303 .input_data = at91_ide_input_data,
304 .output_data = at91_ide_output_data,
305};
306
307static const struct ide_port_ops at91_ide_port_ops = {
308 .set_pio_mode = at91_ide_set_pio_mode,
309};
310
311static const struct ide_port_info at91_ide_port_info __initdata = {
312 .port_ops = &at91_ide_port_ops,
313 .tp_ops = &at91_ide_tp_ops,
314 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE |
315 IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS,
316 .pio_mask = ATA_PIO5,
317};
318
319/*
320 * If interrupt is delivered through GPIO, IRQ are triggered on falling
321 * and rising edge of signal. Whereas IDE device request interrupt on high
322 * level (rising edge in our case). This mean we have fake interrupts, so
323 * we need to check interrupt pin and exit instantly from ISR when line
324 * is on low level.
325 */
326
327irqreturn_t at91_irq_handler(int irq, void *dev_id)
328{
329 int ntries = 8;
330 int pin_val1, pin_val2;
331
332 /* additional deglitch, line can be noisy in badly designed PCB */
333 do {
334 pin_val1 = at91_get_gpio_value(irq);
335 pin_val2 = at91_get_gpio_value(irq);
336 } while (pin_val1 != pin_val2 && --ntries > 0);
337
338 if (pin_val1 == 0 || ntries <= 0)
339 return IRQ_HANDLED;
340
341 return ide_intr(irq, dev_id);
342}
343
344static int __init at91_ide_probe(struct platform_device *pdev)
345{
346 int ret;
347 hw_regs_t hw;
348 hw_regs_t *hws[] = { &hw, NULL, NULL, NULL };
349 struct ide_host *host;
350 struct resource *res;
351 unsigned long tf_base = 0, ctl_base = 0;
352 struct at91_cf_data *board = pdev->dev.platform_data;
353
354 if (!board)
355 return -ENODEV;
356
357 if (board->det_pin && at91_get_gpio_value(board->det_pin) != 0) {
358 perr("no device detected\n");
359 return -ENODEV;
360 }
361
362 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
363 if (!res) {
364 perr("can't get memory resource\n");
365 return -ENODEV;
366 }
367
368 if (!devm_request_mem_region(&pdev->dev, res->start + TASK_FILE,
369 REGS_SIZE, "ide") ||
370 !devm_request_mem_region(&pdev->dev, res->start + ALT_MODE,
371 REGS_SIZE, "alt")) {
372 perr("memory resources in use\n");
373 return -EBUSY;
374 }
375
376 pdbg("chipselect %u irq %u res %08lx\n", board->chipselect,
377 board->irq_pin, (unsigned long) res->start);
378
379 tf_base = (unsigned long) devm_ioremap(&pdev->dev, res->start + TASK_FILE,
380 REGS_SIZE);
381 ctl_base = (unsigned long) devm_ioremap(&pdev->dev, res->start + ALT_MODE,
382 REGS_SIZE);
383 if (!tf_base || !ctl_base) {
384 perr("can't map memory regions\n");
385 return -EBUSY;
386 }
387
388 memset(&hw, 0, sizeof(hw));
389
390 if (board->flags & AT91_IDE_SWAP_A0_A2) {
391 /* workaround for stupid hardware bug */
392 hw.io_ports.data_addr = tf_base + 0;
393 hw.io_ports.error_addr = tf_base + 4;
394 hw.io_ports.nsect_addr = tf_base + 2;
395 hw.io_ports.lbal_addr = tf_base + 6;
396 hw.io_ports.lbam_addr = tf_base + 1;
397 hw.io_ports.lbah_addr = tf_base + 5;
398 hw.io_ports.device_addr = tf_base + 3;
399 hw.io_ports.command_addr = tf_base + 7;
400 hw.io_ports.ctl_addr = ctl_base + 3;
401 } else
402 ide_std_init_ports(&hw, tf_base, ctl_base + 6);
403
404 hw.irq = board->irq_pin;
405 hw.chipset = ide_generic;
406 hw.dev = &pdev->dev;
407
408 host = ide_host_alloc(&at91_ide_port_info, hws);
409 if (!host) {
410 perr("failed to allocate ide host\n");
411 return -ENOMEM;
412 }
413
414 /* setup Static Memory Controller - PIO 0 as default */
415 apply_timings(board->chipselect, 0, ide_timing_find_mode(XFER_PIO_0), 0);
416
417 /* with GPIO interrupt we have to do quirks in handler */
418 if (board->irq_pin >= PIN_BASE)
419 host->irq_handler = at91_irq_handler;
420
421 host->ports[0]->select_data = board->chipselect;
422
423 ret = ide_host_register(host, &at91_ide_port_info, hws);
424 if (ret) {
425 perr("failed to register ide host\n");
426 goto err_free_host;
427 }
428 platform_set_drvdata(pdev, host);
429 return 0;
430
431err_free_host:
432 ide_host_free(host);
433 return ret;
434}
435
436static int __exit at91_ide_remove(struct platform_device *pdev)
437{
438 struct ide_host *host = platform_get_drvdata(pdev);
439
440 ide_host_remove(host);
441 return 0;
442}
443
444static struct platform_driver at91_ide_driver = {
445 .driver = {
446 .name = DRV_NAME,
447 .owner = THIS_MODULE,
448 },
449 .remove = __exit_p(at91_ide_remove),
450};
451
452static int __init at91_ide_init(void)
453{
454 return platform_driver_probe(&at91_ide_driver, at91_ide_probe);
455}
456
457static void __exit at91_ide_exit(void)
458{
459 platform_driver_unregister(&at91_ide_driver);
460}
461
462module_init(at91_ide_init);
463module_exit(at91_ide_exit);
464
465MODULE_LICENSE("GPL");
466MODULE_AUTHOR("Stanislaw Gruszka <stf_xl@wp.pl>");
467
diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c
index b2735d28f5cc..ecd1e62ca91a 100644
--- a/drivers/ide/atiixp.c
+++ b/drivers/ide/atiixp.c
@@ -52,7 +52,7 @@ static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio)
52{ 52{
53 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 53 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
54 unsigned long flags; 54 unsigned long flags;
55 int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; 55 int timing_shift = (drive->dn ^ 1) * 8;
56 u32 pio_timing_data; 56 u32 pio_timing_data;
57 u16 pio_mode_data; 57 u16 pio_mode_data;
58 58
@@ -85,7 +85,7 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
85{ 85{
86 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 86 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
87 unsigned long flags; 87 unsigned long flags;
88 int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; 88 int timing_shift = (drive->dn ^ 1) * 8;
89 u32 tmp32; 89 u32 tmp32;
90 u16 tmp16; 90 u16 tmp16;
91 u16 udma_ctl = 0; 91 u16 udma_ctl = 0;
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index e96c01260598..e9d042dba0e0 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -140,6 +140,12 @@ static void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk,
140 rq->cmd_flags |= REQ_PREEMPT; 140 rq->cmd_flags |= REQ_PREEMPT;
141 rq->buffer = (char *)pc; 141 rq->buffer = (char *)pc;
142 rq->rq_disk = disk; 142 rq->rq_disk = disk;
143
144 if (pc->req_xfer) {
145 rq->data = pc->buf;
146 rq->data_len = pc->req_xfer;
147 }
148
143 memcpy(rq->cmd, pc->c, 12); 149 memcpy(rq->cmd, pc->c, 12);
144 if (drive->media == ide_tape) 150 if (drive->media == ide_tape)
145 rq->cmd[13] = REQ_IDETAPE_PC1; 151 rq->cmd[13] = REQ_IDETAPE_PC1;
@@ -159,6 +165,12 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
159 rq = blk_get_request(drive->queue, READ, __GFP_WAIT); 165 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
160 rq->cmd_type = REQ_TYPE_SPECIAL; 166 rq->cmd_type = REQ_TYPE_SPECIAL;
161 rq->buffer = (char *)pc; 167 rq->buffer = (char *)pc;
168
169 if (pc->req_xfer) {
170 rq->data = pc->buf;
171 rq->data_len = pc->req_xfer;
172 }
173
162 memcpy(rq->cmd, pc->c, 12); 174 memcpy(rq->cmd, pc->c, 12);
163 if (drive->media == ide_tape) 175 if (drive->media == ide_tape)
164 rq->cmd[13] = REQ_IDETAPE_PC1; 176 rq->cmd[13] = REQ_IDETAPE_PC1;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0bfeb0c79d6e..ddfbea41d296 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -55,7 +55,7 @@
55 55
56static DEFINE_MUTEX(idecd_ref_mutex); 56static DEFINE_MUTEX(idecd_ref_mutex);
57 57
58static void ide_cd_release(struct kref *); 58static void ide_cd_release(struct device *);
59 59
60static struct cdrom_info *ide_cd_get(struct gendisk *disk) 60static struct cdrom_info *ide_cd_get(struct gendisk *disk)
61{ 61{
@@ -67,7 +67,7 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk)
67 if (ide_device_get(cd->drive)) 67 if (ide_device_get(cd->drive))
68 cd = NULL; 68 cd = NULL;
69 else 69 else
70 kref_get(&cd->kref); 70 get_device(&cd->dev);
71 71
72 } 72 }
73 mutex_unlock(&idecd_ref_mutex); 73 mutex_unlock(&idecd_ref_mutex);
@@ -79,7 +79,7 @@ static void ide_cd_put(struct cdrom_info *cd)
79 ide_drive_t *drive = cd->drive; 79 ide_drive_t *drive = cd->drive;
80 80
81 mutex_lock(&idecd_ref_mutex); 81 mutex_lock(&idecd_ref_mutex);
82 kref_put(&cd->kref, ide_cd_release); 82 put_device(&cd->dev);
83 ide_device_put(drive); 83 ide_device_put(drive);
84 mutex_unlock(&idecd_ref_mutex); 84 mutex_unlock(&idecd_ref_mutex);
85} 85}
@@ -194,6 +194,14 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
194 bio_sectors = max(bio_sectors(failed_command->bio), 4U); 194 bio_sectors = max(bio_sectors(failed_command->bio), 4U);
195 sector &= ~(bio_sectors - 1); 195 sector &= ~(bio_sectors - 1);
196 196
197 /*
198 * The SCSI specification allows for the value
199 * returned by READ CAPACITY to be up to 75 2K
200 * sectors past the last readable block.
201 * Therefore, if we hit a medium error within the
202 * last 75 2K sectors, we decrease the saved size
203 * value.
204 */
197 if (sector < get_capacity(info->disk) && 205 if (sector < get_capacity(info->disk) &&
198 drive->probed_capacity - sector < 4 * 75) 206 drive->probed_capacity - sector < 4 * 75)
199 set_capacity(info->disk, sector); 207 set_capacity(info->disk, sector);
@@ -1790,15 +1798,17 @@ static void ide_cd_remove(ide_drive_t *drive)
1790 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); 1798 ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
1791 1799
1792 ide_proc_unregister_driver(drive, info->driver); 1800 ide_proc_unregister_driver(drive, info->driver);
1793 1801 device_del(&info->dev);
1794 del_gendisk(info->disk); 1802 del_gendisk(info->disk);
1795 1803
1796 ide_cd_put(info); 1804 mutex_lock(&idecd_ref_mutex);
1805 put_device(&info->dev);
1806 mutex_unlock(&idecd_ref_mutex);
1797} 1807}
1798 1808
1799static void ide_cd_release(struct kref *kref) 1809static void ide_cd_release(struct device *dev)
1800{ 1810{
1801 struct cdrom_info *info = to_ide_drv(kref, cdrom_info); 1811 struct cdrom_info *info = to_ide_drv(dev, cdrom_info);
1802 struct cdrom_device_info *devinfo = &info->devinfo; 1812 struct cdrom_device_info *devinfo = &info->devinfo;
1803 ide_drive_t *drive = info->drive; 1813 ide_drive_t *drive = info->drive;
1804 struct gendisk *g = info->disk; 1814 struct gendisk *g = info->disk;
@@ -1997,7 +2007,12 @@ static int ide_cd_probe(ide_drive_t *drive)
1997 2007
1998 ide_init_disk(g, drive); 2008 ide_init_disk(g, drive);
1999 2009
2000 kref_init(&info->kref); 2010 info->dev.parent = &drive->gendev;
2011 info->dev.release = ide_cd_release;
2012 dev_set_name(&info->dev, dev_name(&drive->gendev));
2013
2014 if (device_register(&info->dev))
2015 goto out_free_disk;
2001 2016
2002 info->drive = drive; 2017 info->drive = drive;
2003 info->driver = &ide_cdrom_driver; 2018 info->driver = &ide_cdrom_driver;
@@ -2011,7 +2026,7 @@ static int ide_cd_probe(ide_drive_t *drive)
2011 g->driverfs_dev = &drive->gendev; 2026 g->driverfs_dev = &drive->gendev;
2012 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; 2027 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
2013 if (ide_cdrom_setup(drive)) { 2028 if (ide_cdrom_setup(drive)) {
2014 ide_cd_release(&info->kref); 2029 put_device(&info->dev);
2015 goto failed; 2030 goto failed;
2016 } 2031 }
2017 2032
@@ -2021,6 +2036,8 @@ static int ide_cd_probe(ide_drive_t *drive)
2021 add_disk(g); 2036 add_disk(g);
2022 return 0; 2037 return 0;
2023 2038
2039out_free_disk:
2040 put_disk(g);
2024out_free_cd: 2041out_free_cd:
2025 kfree(info); 2042 kfree(info);
2026failed: 2043failed:
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index ac40d6cb90a2..c878bfcf1116 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -80,7 +80,7 @@ struct cdrom_info {
80 ide_drive_t *drive; 80 ide_drive_t *drive;
81 struct ide_driver *driver; 81 struct ide_driver *driver;
82 struct gendisk *disk; 82 struct gendisk *disk;
83 struct kref kref; 83 struct device dev;
84 84
85 /* Buffer for table of contents. NULL if we haven't allocated 85 /* Buffer for table of contents. NULL if we haven't allocated
86 a TOC buffer for this device yet. */ 86 a TOC buffer for this device yet. */
diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c
index 1146f4204c6e..1f86dcbd2b1c 100644
--- a/drivers/ide/ide-disk_proc.c
+++ b/drivers/ide/ide-disk_proc.c
@@ -125,5 +125,5 @@ const struct ide_proc_devset ide_disk_settings[] = {
125 IDE_PROC_DEVSET(multcount, 0, 16), 125 IDE_PROC_DEVSET(multcount, 0, 16),
126 IDE_PROC_DEVSET(nowerr, 0, 1), 126 IDE_PROC_DEVSET(nowerr, 0, 1),
127 IDE_PROC_DEVSET(wcache, 0, 1), 127 IDE_PROC_DEVSET(wcache, 0, 1),
128 { 0 }, 128 { NULL },
129}; 129};
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 72ebab0bc755..059c90bb5ad2 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -128,6 +128,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
128{ 128{
129 ide_hwif_t *hwif = drive->hwif; 129 ide_hwif_t *hwif = drive->hwif;
130 struct scatterlist *sg = hwif->sg_table; 130 struct scatterlist *sg = hwif->sg_table;
131 int i;
131 132
132 ide_map_sg(drive, rq); 133 ide_map_sg(drive, rq);
133 134
@@ -136,8 +137,13 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
136 else 137 else
137 hwif->sg_dma_direction = DMA_TO_DEVICE; 138 hwif->sg_dma_direction = DMA_TO_DEVICE;
138 139
139 return dma_map_sg(hwif->dev, sg, hwif->sg_nents, 140 i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction);
140 hwif->sg_dma_direction); 141 if (i) {
142 hwif->orig_sg_nents = hwif->sg_nents;
143 hwif->sg_nents = i;
144 }
145
146 return i;
141} 147}
142EXPORT_SYMBOL_GPL(ide_build_sglist); 148EXPORT_SYMBOL_GPL(ide_build_sglist);
143 149
@@ -156,7 +162,7 @@ void ide_destroy_dmatable(ide_drive_t *drive)
156{ 162{
157 ide_hwif_t *hwif = drive->hwif; 163 ide_hwif_t *hwif = drive->hwif;
158 164
159 dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents, 165 dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents,
160 hwif->sg_dma_direction); 166 hwif->sg_dma_direction);
161} 167}
162EXPORT_SYMBOL_GPL(ide_destroy_dmatable); 168EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3eab1c6c9b31..317ec62c33d4 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -327,8 +327,10 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
327 return ide_stopped; 327 return ide_stopped;
328 } 328 }
329 329
330 ide_init_sg_cmd(drive, rq); 330 if (blk_fs_request(rq) || pc->req_xfer) {
331 ide_map_sg(drive, rq); 331 ide_init_sg_cmd(drive, rq);
332 ide_map_sg(drive, rq);
333 }
332 334
333 pc->sg = hwif->sg_table; 335 pc->sg = hwif->sg_table;
334 pc->sg_cnt = hwif->sg_nents; 336 pc->sg_cnt = hwif->sg_nents;
diff --git a/drivers/ide/ide-floppy_proc.c b/drivers/ide/ide-floppy_proc.c
index 3ec762cb60ab..fcd4d8153df5 100644
--- a/drivers/ide/ide-floppy_proc.c
+++ b/drivers/ide/ide-floppy_proc.c
@@ -29,5 +29,5 @@ const struct ide_proc_devset ide_floppy_settings[] = {
29 IDE_PROC_DEVSET(bios_head, 0, 255), 29 IDE_PROC_DEVSET(bios_head, 0, 255),
30 IDE_PROC_DEVSET(bios_sect, 0, 63), 30 IDE_PROC_DEVSET(bios_sect, 0, 63),
31 IDE_PROC_DEVSET(ticks, 0, 255), 31 IDE_PROC_DEVSET(ticks, 0, 255),
32 { 0 }, 32 { NULL },
33}; 33};
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 7857b209c6df..047109419902 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -25,7 +25,7 @@ module_param(debug_mask, ulong, 0644);
25 25
26static DEFINE_MUTEX(ide_disk_ref_mutex); 26static DEFINE_MUTEX(ide_disk_ref_mutex);
27 27
28static void ide_disk_release(struct kref *); 28static void ide_disk_release(struct device *);
29 29
30static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) 30static struct ide_disk_obj *ide_disk_get(struct gendisk *disk)
31{ 31{
@@ -37,7 +37,7 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk)
37 if (ide_device_get(idkp->drive)) 37 if (ide_device_get(idkp->drive))
38 idkp = NULL; 38 idkp = NULL;
39 else 39 else
40 kref_get(&idkp->kref); 40 get_device(&idkp->dev);
41 } 41 }
42 mutex_unlock(&ide_disk_ref_mutex); 42 mutex_unlock(&ide_disk_ref_mutex);
43 return idkp; 43 return idkp;
@@ -48,7 +48,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp)
48 ide_drive_t *drive = idkp->drive; 48 ide_drive_t *drive = idkp->drive;
49 49
50 mutex_lock(&ide_disk_ref_mutex); 50 mutex_lock(&ide_disk_ref_mutex);
51 kref_put(&idkp->kref, ide_disk_release); 51 put_device(&idkp->dev);
52 ide_device_put(drive); 52 ide_device_put(drive);
53 mutex_unlock(&ide_disk_ref_mutex); 53 mutex_unlock(&ide_disk_ref_mutex);
54} 54}
@@ -66,17 +66,18 @@ static void ide_gd_remove(ide_drive_t *drive)
66 struct gendisk *g = idkp->disk; 66 struct gendisk *g = idkp->disk;
67 67
68 ide_proc_unregister_driver(drive, idkp->driver); 68 ide_proc_unregister_driver(drive, idkp->driver);
69 69 device_del(&idkp->dev);
70 del_gendisk(g); 70 del_gendisk(g);
71
72 drive->disk_ops->flush(drive); 71 drive->disk_ops->flush(drive);
73 72
74 ide_disk_put(idkp); 73 mutex_lock(&ide_disk_ref_mutex);
74 put_device(&idkp->dev);
75 mutex_unlock(&ide_disk_ref_mutex);
75} 76}
76 77
77static void ide_disk_release(struct kref *kref) 78static void ide_disk_release(struct device *dev)
78{ 79{
79 struct ide_disk_obj *idkp = to_ide_drv(kref, ide_disk_obj); 80 struct ide_disk_obj *idkp = to_ide_drv(dev, ide_disk_obj);
80 ide_drive_t *drive = idkp->drive; 81 ide_drive_t *drive = idkp->drive;
81 struct gendisk *g = idkp->disk; 82 struct gendisk *g = idkp->disk;
82 83
@@ -348,7 +349,12 @@ static int ide_gd_probe(ide_drive_t *drive)
348 349
349 ide_init_disk(g, drive); 350 ide_init_disk(g, drive);
350 351
351 kref_init(&idkp->kref); 352 idkp->dev.parent = &drive->gendev;
353 idkp->dev.release = ide_disk_release;
354 dev_set_name(&idkp->dev, dev_name(&drive->gendev));
355
356 if (device_register(&idkp->dev))
357 goto out_free_disk;
352 358
353 idkp->drive = drive; 359 idkp->drive = drive;
354 idkp->driver = &ide_gd_driver; 360 idkp->driver = &ide_gd_driver;
@@ -373,6 +379,8 @@ static int ide_gd_probe(ide_drive_t *drive)
373 add_disk(g); 379 add_disk(g);
374 return 0; 380 return 0;
375 381
382out_free_disk:
383 put_disk(g);
376out_free_idkp: 384out_free_idkp:
377 kfree(idkp); 385 kfree(idkp);
378failed: 386failed:
diff --git a/drivers/ide/ide-gd.h b/drivers/ide/ide-gd.h
index a86779f0756b..b604bdd318a1 100644
--- a/drivers/ide/ide-gd.h
+++ b/drivers/ide/ide-gd.h
@@ -17,7 +17,7 @@ struct ide_disk_obj {
17 ide_drive_t *drive; 17 ide_drive_t *drive;
18 struct ide_driver *driver; 18 struct ide_driver *driver;
19 struct gendisk *disk; 19 struct gendisk *disk;
20 struct kref kref; 20 struct device dev;
21 unsigned int openers; /* protected by BKL for now */ 21 unsigned int openers; /* protected by BKL for now */
22 22
23 /* Last failed packet command */ 23 /* Last failed packet command */
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 9ee51adf567f..a9a6c208288a 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -908,7 +908,7 @@ void ide_timer_expiry (unsigned long data)
908 ide_drive_t *uninitialized_var(drive); 908 ide_drive_t *uninitialized_var(drive);
909 ide_handler_t *handler; 909 ide_handler_t *handler;
910 unsigned long flags; 910 unsigned long flags;
911 unsigned long wait = -1; 911 int wait = -1;
912 int plug_device = 0; 912 int plug_device = 0;
913 913
914 spin_lock_irqsave(&hwif->lock, flags); 914 spin_lock_irqsave(&hwif->lock, flags);
@@ -1162,6 +1162,7 @@ out_early:
1162 1162
1163 return irq_ret; 1163 return irq_ret;
1164} 1164}
1165EXPORT_SYMBOL_GPL(ide_intr);
1165 1166
1166/** 1167/**
1167 * ide_do_drive_cmd - issue IDE special command 1168 * ide_do_drive_cmd - issue IDE special command
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 753b92ebe0ae..b1892bd95c6f 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -315,6 +315,8 @@ void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf,
315 u8 io_32bit = drive->io_32bit; 315 u8 io_32bit = drive->io_32bit;
316 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 316 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
317 317
318 len++;
319
318 if (io_32bit) { 320 if (io_32bit) {
319 unsigned long uninitialized_var(flags); 321 unsigned long uninitialized_var(flags);
320 322
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index ce0818a993f6..ee8e3e7cad51 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -950,6 +950,7 @@ static int ide_port_setup_devices(ide_hwif_t *hwif)
950static int init_irq (ide_hwif_t *hwif) 950static int init_irq (ide_hwif_t *hwif)
951{ 951{
952 struct ide_io_ports *io_ports = &hwif->io_ports; 952 struct ide_io_ports *io_ports = &hwif->io_ports;
953 irq_handler_t irq_handler;
953 int sa = 0; 954 int sa = 0;
954 955
955 mutex_lock(&ide_cfg_mtx); 956 mutex_lock(&ide_cfg_mtx);
@@ -959,6 +960,10 @@ static int init_irq (ide_hwif_t *hwif)
959 hwif->timer.function = &ide_timer_expiry; 960 hwif->timer.function = &ide_timer_expiry;
960 hwif->timer.data = (unsigned long)hwif; 961 hwif->timer.data = (unsigned long)hwif;
961 962
963 irq_handler = hwif->host->irq_handler;
964 if (irq_handler == NULL)
965 irq_handler = ide_intr;
966
962#if defined(__mc68000__) 967#if defined(__mc68000__)
963 sa = IRQF_SHARED; 968 sa = IRQF_SHARED;
964#endif /* __mc68000__ */ 969#endif /* __mc68000__ */
@@ -969,7 +974,7 @@ static int init_irq (ide_hwif_t *hwif)
969 if (io_ports->ctl_addr) 974 if (io_ports->ctl_addr)
970 hwif->tp_ops->set_irq(hwif, 1); 975 hwif->tp_ops->set_irq(hwif, 1);
971 976
972 if (request_irq(hwif->irq, &ide_intr, sa, hwif->name, hwif)) 977 if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
973 goto out_up; 978 goto out_up;
974 979
975 if (!hwif->rqsize) { 980 if (!hwif->rqsize) {
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 1d8978b3314a..a7b9287ee0d4 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -231,7 +231,7 @@ static const struct ide_proc_devset ide_generic_settings[] = {
231 IDE_PROC_DEVSET(pio_mode, 0, 255), 231 IDE_PROC_DEVSET(pio_mode, 0, 255),
232 IDE_PROC_DEVSET(unmaskirq, 0, 1), 232 IDE_PROC_DEVSET(unmaskirq, 0, 1),
233 IDE_PROC_DEVSET(using_dma, 0, 1), 233 IDE_PROC_DEVSET(using_dma, 0, 1),
234 { 0 }, 234 { NULL },
235}; 235};
236 236
237static void proc_ide_settings_warn(void) 237static void proc_ide_settings_warn(void)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index d7ecd3c79757..4e6181c7bbda 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -169,7 +169,7 @@ typedef struct ide_tape_obj {
169 ide_drive_t *drive; 169 ide_drive_t *drive;
170 struct ide_driver *driver; 170 struct ide_driver *driver;
171 struct gendisk *disk; 171 struct gendisk *disk;
172 struct kref kref; 172 struct device dev;
173 173
174 /* 174 /*
175 * failed_pc points to the last failed packet command, or contains 175 * failed_pc points to the last failed packet command, or contains
@@ -267,7 +267,7 @@ static DEFINE_MUTEX(idetape_ref_mutex);
267 267
268static struct class *idetape_sysfs_class; 268static struct class *idetape_sysfs_class;
269 269
270static void ide_tape_release(struct kref *); 270static void ide_tape_release(struct device *);
271 271
272static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) 272static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
273{ 273{
@@ -279,7 +279,7 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
279 if (ide_device_get(tape->drive)) 279 if (ide_device_get(tape->drive))
280 tape = NULL; 280 tape = NULL;
281 else 281 else
282 kref_get(&tape->kref); 282 get_device(&tape->dev);
283 } 283 }
284 mutex_unlock(&idetape_ref_mutex); 284 mutex_unlock(&idetape_ref_mutex);
285 return tape; 285 return tape;
@@ -290,7 +290,7 @@ static void ide_tape_put(struct ide_tape_obj *tape)
290 ide_drive_t *drive = tape->drive; 290 ide_drive_t *drive = tape->drive;
291 291
292 mutex_lock(&idetape_ref_mutex); 292 mutex_lock(&idetape_ref_mutex);
293 kref_put(&tape->kref, ide_tape_release); 293 put_device(&tape->dev);
294 ide_device_put(drive); 294 ide_device_put(drive);
295 mutex_unlock(&idetape_ref_mutex); 295 mutex_unlock(&idetape_ref_mutex);
296} 296}
@@ -308,7 +308,7 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i)
308 mutex_lock(&idetape_ref_mutex); 308 mutex_lock(&idetape_ref_mutex);
309 tape = idetape_devs[i]; 309 tape = idetape_devs[i];
310 if (tape) 310 if (tape)
311 kref_get(&tape->kref); 311 get_device(&tape->dev);
312 mutex_unlock(&idetape_ref_mutex); 312 mutex_unlock(&idetape_ref_mutex);
313 return tape; 313 return tape;
314} 314}
@@ -2166,7 +2166,7 @@ static const struct ide_proc_devset idetape_settings[] = {
2166 __IDE_PROC_DEVSET(speed, 0, 0xffff, NULL, NULL), 2166 __IDE_PROC_DEVSET(speed, 0, 0xffff, NULL, NULL),
2167 __IDE_PROC_DEVSET(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 2167 __IDE_PROC_DEVSET(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX,
2168 mulf_tdsc, divf_tdsc), 2168 mulf_tdsc, divf_tdsc),
2169 { 0 }, 2169 { NULL },
2170}; 2170};
2171#endif 2171#endif
2172 2172
@@ -2256,15 +2256,17 @@ static void ide_tape_remove(ide_drive_t *drive)
2256 idetape_tape_t *tape = drive->driver_data; 2256 idetape_tape_t *tape = drive->driver_data;
2257 2257
2258 ide_proc_unregister_driver(drive, tape->driver); 2258 ide_proc_unregister_driver(drive, tape->driver);
2259 2259 device_del(&tape->dev);
2260 ide_unregister_region(tape->disk); 2260 ide_unregister_region(tape->disk);
2261 2261
2262 ide_tape_put(tape); 2262 mutex_lock(&idetape_ref_mutex);
2263 put_device(&tape->dev);
2264 mutex_unlock(&idetape_ref_mutex);
2263} 2265}
2264 2266
2265static void ide_tape_release(struct kref *kref) 2267static void ide_tape_release(struct device *dev)
2266{ 2268{
2267 struct ide_tape_obj *tape = to_ide_drv(kref, ide_tape_obj); 2269 struct ide_tape_obj *tape = to_ide_drv(dev, ide_tape_obj);
2268 ide_drive_t *drive = tape->drive; 2270 ide_drive_t *drive = tape->drive;
2269 struct gendisk *g = tape->disk; 2271 struct gendisk *g = tape->disk;
2270 2272
@@ -2407,7 +2409,12 @@ static int ide_tape_probe(ide_drive_t *drive)
2407 2409
2408 ide_init_disk(g, drive); 2410 ide_init_disk(g, drive);
2409 2411
2410 kref_init(&tape->kref); 2412 tape->dev.parent = &drive->gendev;
2413 tape->dev.release = ide_tape_release;
2414 dev_set_name(&tape->dev, dev_name(&drive->gendev));
2415
2416 if (device_register(&tape->dev))
2417 goto out_free_disk;
2411 2418
2412 tape->drive = drive; 2419 tape->drive = drive;
2413 tape->driver = &idetape_driver; 2420 tape->driver = &idetape_driver;
@@ -2436,6 +2443,8 @@ static int ide_tape_probe(ide_drive_t *drive)
2436 2443
2437 return 0; 2444 return 0;
2438 2445
2446out_free_disk:
2447 put_disk(g);
2439out_free_tape: 2448out_free_tape:
2440 kfree(tape); 2449 kfree(tape);
2441failed: 2450failed:
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 258805da15c3..0920e3b0c962 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -337,6 +337,7 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
337 int a, b, i, j = 1; 337 int a, b, i, j = 1;
338 unsigned int *dev_param_mask = (unsigned int *)kp->arg; 338 unsigned int *dev_param_mask = (unsigned int *)kp->arg;
339 339
340 /* controller . device (0 or 1) [ : 1 (set) | 0 (clear) ] */
340 if (sscanf(s, "%d.%d:%d", &a, &b, &j) != 3 && 341 if (sscanf(s, "%d.%d:%d", &a, &b, &j) != 3 &&
341 sscanf(s, "%d.%d", &a, &b) != 2) 342 sscanf(s, "%d.%d", &a, &b) != 2)
342 return -EINVAL; 343 return -EINVAL;
@@ -349,7 +350,7 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
349 if (j) 350 if (j)
350 *dev_param_mask |= (1 << i); 351 *dev_param_mask |= (1 << i);
351 else 352 else
352 *dev_param_mask &= (1 << i); 353 *dev_param_mask &= ~(1 << i);
353 354
354 return 0; 355 return 0;
355} 356}
@@ -392,6 +393,8 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp)
392{ 393{
393 int a, b, c = 0, h = 0, s = 0, i, j = 1; 394 int a, b, c = 0, h = 0, s = 0, i, j = 1;
394 395
396 /* controller . device (0 or 1) : Cylinders , Heads , Sectors */
397 /* controller . device (0 or 1) : 1 (use CHS) | 0 (ignore CHS) */
395 if (sscanf(str, "%d.%d:%d,%d,%d", &a, &b, &c, &h, &s) != 5 && 398 if (sscanf(str, "%d.%d:%d,%d,%d", &a, &b, &c, &h, &s) != 5 &&
396 sscanf(str, "%d.%d:%d", &a, &b, &j) != 3) 399 sscanf(str, "%d.%d:%d", &a, &b, &j) != 3)
397 return -EINVAL; 400 return -EINVAL;
@@ -407,7 +410,7 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp)
407 if (j) 410 if (j)
408 ide_disks |= (1 << i); 411 ide_disks |= (1 << i);
409 else 412 else
410 ide_disks &= (1 << i); 413 ide_disks &= ~(1 << i);
411 414
412 ide_disks_chs[i].cyl = c; 415 ide_disks_chs[i].cyl = c;
413 ide_disks_chs[i].head = h; 416 ide_disks_chs[i].head = h;
@@ -469,6 +472,8 @@ static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
469{ 472{
470 int i, j = 1; 473 int i, j = 1;
471 474
475 /* controller (ignore) */
476 /* controller : 1 (ignore) | 0 (use) */
472 if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1) 477 if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1)
473 return -EINVAL; 478 return -EINVAL;
474 479
@@ -478,7 +483,7 @@ static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
478 if (j) 483 if (j)
479 ide_ignore_cable |= (1 << i); 484 ide_ignore_cable |= (1 << i);
480 else 485 else
481 ide_ignore_cable &= (1 << i); 486 ide_ignore_cable &= ~(1 << i);
482 487
483 return 0; 488 return 0;
484} 489}
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index e1c4f5437396..13b8153112ed 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -5,9 +5,8 @@
5 * May be copied or modified under the terms of the GNU General Public License 5 * May be copied or modified under the terms of the GNU General Public License
6 * Based in part on the ITE vendor provided SCSI driver. 6 * Based in part on the ITE vendor provided SCSI driver.
7 * 7 *
8 * Documentation available from 8 * Documentation:
9 * http://www.ite.com.tw/pc/IT8212F_V04.pdf 9 * Datasheet is freely available, some other documents under NDA.
10 * Some other documents are NDA.
11 * 10 *
12 * The ITE8212 isn't exactly a standard IDE controller. It has two 11 * The ITE8212 isn't exactly a standard IDE controller. It has two
13 * modes. In pass through mode then it is an IDE controller. In its smart 12 * modes. In pass through mode then it is an IDE controller. In its smart
diff --git a/drivers/ieee1394/dma.h b/drivers/ieee1394/dma.h
index 2727bcd24194..467373cab8e5 100644
--- a/drivers/ieee1394/dma.h
+++ b/drivers/ieee1394/dma.h
@@ -12,6 +12,7 @@
12 12
13#include <asm/types.h> 13#include <asm/types.h>
14 14
15struct file;
15struct pci_dev; 16struct pci_dev;
16struct scatterlist; 17struct scatterlist;
17struct vm_area_struct; 18struct vm_area_struct;
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index 2beb8d94f7bd..872338003721 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -1275,7 +1275,7 @@ static void __exit ieee1394_cleanup(void)
1275 unregister_chrdev_region(IEEE1394_CORE_DEV, 256); 1275 unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
1276} 1276}
1277 1277
1278module_init(ieee1394_init); 1278fs_initcall(ieee1394_init);
1279module_exit(ieee1394_cleanup); 1279module_exit(ieee1394_cleanup);
1280 1280
1281/* Exported symbols */ 1281/* Exported symbols */
@@ -1314,6 +1314,7 @@ EXPORT_SYMBOL(hpsb_make_lock64packet);
1314EXPORT_SYMBOL(hpsb_make_phypacket); 1314EXPORT_SYMBOL(hpsb_make_phypacket);
1315EXPORT_SYMBOL(hpsb_read); 1315EXPORT_SYMBOL(hpsb_read);
1316EXPORT_SYMBOL(hpsb_write); 1316EXPORT_SYMBOL(hpsb_write);
1317EXPORT_SYMBOL(hpsb_lock);
1317EXPORT_SYMBOL(hpsb_packet_success); 1318EXPORT_SYMBOL(hpsb_packet_success);
1318 1319
1319/** highlevel.c **/ 1320/** highlevel.c **/
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c
index 10c3d9f8c038..675b3135d5f1 100644
--- a/drivers/ieee1394/ieee1394_transactions.c
+++ b/drivers/ieee1394/ieee1394_transactions.c
@@ -501,8 +501,6 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
501 if (length == 0) 501 if (length == 0)
502 return -EINVAL; 502 return -EINVAL;
503 503
504 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
505
506 packet = hpsb_make_readpacket(host, node, addr, length); 504 packet = hpsb_make_readpacket(host, node, addr, length);
507 505
508 if (!packet) { 506 if (!packet) {
@@ -550,8 +548,6 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
550 if (length == 0) 548 if (length == 0)
551 return -EINVAL; 549 return -EINVAL;
552 550
553 BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
554
555 packet = hpsb_make_writepacket(host, node, addr, buffer, length); 551 packet = hpsb_make_writepacket(host, node, addr, buffer, length);
556 552
557 if (!packet) 553 if (!packet)
@@ -570,3 +566,30 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
570 566
571 return retval; 567 return retval;
572} 568}
569
570int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
571 u64 addr, int extcode, quadlet_t *data, quadlet_t arg)
572{
573 struct hpsb_packet *packet;
574 int retval = 0;
575
576 packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg);
577 if (!packet)
578 return -ENOMEM;
579
580 packet->generation = generation;
581 retval = hpsb_send_packet_and_wait(packet);
582 if (retval < 0)
583 goto hpsb_lock_fail;
584
585 retval = hpsb_packet_success(packet);
586
587 if (retval == 0)
588 *data = packet->data[0];
589
590hpsb_lock_fail:
591 hpsb_free_tlabel(packet);
592 hpsb_free_packet(packet);
593
594 return retval;
595}
diff --git a/drivers/ieee1394/ieee1394_transactions.h b/drivers/ieee1394/ieee1394_transactions.h
index d2d5bc3546d7..20b693be14b2 100644
--- a/drivers/ieee1394/ieee1394_transactions.h
+++ b/drivers/ieee1394/ieee1394_transactions.h
@@ -30,6 +30,8 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
30 u64 addr, quadlet_t *buffer, size_t length); 30 u64 addr, quadlet_t *buffer, size_t length);
31int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, 31int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
32 u64 addr, quadlet_t *buffer, size_t length); 32 u64 addr, quadlet_t *buffer, size_t length);
33int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
34 u64 addr, int extcode, quadlet_t *data, quadlet_t arg);
33 35
34#ifdef HPSB_DEBUG_TLABELS 36#ifdef HPSB_DEBUG_TLABELS
35extern spinlock_t hpsb_tlabel_lock; 37extern spinlock_t hpsb_tlabel_lock;
diff --git a/drivers/ieee1394/iso.h b/drivers/ieee1394/iso.h
index b5de5f21ef78..c2089c093aa7 100644
--- a/drivers/ieee1394/iso.h
+++ b/drivers/ieee1394/iso.h
@@ -13,6 +13,7 @@
13#define IEEE1394_ISO_H 13#define IEEE1394_ISO_H
14 14
15#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
16#include <linux/wait.h>
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17#include <asm/types.h> 18#include <asm/types.h>
18 19
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 906c5a98d814..53aada5bbe1e 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -971,6 +971,9 @@ static struct unit_directory *nodemgr_process_unit_directory
971 ud->ud_kv = ud_kv; 971 ud->ud_kv = ud_kv;
972 ud->id = (*id)++; 972 ud->id = (*id)++;
973 973
974 /* inherit vendor_id from root directory if none exists in unit dir */
975 ud->vendor_id = ne->vendor_id;
976
974 csr1212_for_each_dir_entry(ne->csr, kv, ud_kv, dentry) { 977 csr1212_for_each_dir_entry(ne->csr, kv, ud_kv, dentry) {
975 switch (kv->key.id) { 978 switch (kv->key.id) {
976 case CSR1212_KV_ID_VENDOR: 979 case CSR1212_KV_ID_VENDOR:
@@ -1265,7 +1268,8 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr,
1265 csr1212_destroy_csr(csr); 1268 csr1212_destroy_csr(csr);
1266 } 1269 }
1267 1270
1268 /* Mark the node current */ 1271 /* Finally, mark the node current */
1272 smp_wmb();
1269 ne->generation = generation; 1273 ne->generation = generation;
1270 1274
1271 if (ne->in_limbo) { 1275 if (ne->in_limbo) {
@@ -1798,7 +1802,7 @@ void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet)
1798{ 1802{
1799 packet->host = ne->host; 1803 packet->host = ne->host;
1800 packet->generation = ne->generation; 1804 packet->generation = ne->generation;
1801 barrier(); 1805 smp_rmb();
1802 packet->node_id = ne->nodeid; 1806 packet->node_id = ne->nodeid;
1803} 1807}
1804 1808
@@ -1807,7 +1811,7 @@ int hpsb_node_write(struct node_entry *ne, u64 addr,
1807{ 1811{
1808 unsigned int generation = ne->generation; 1812 unsigned int generation = ne->generation;
1809 1813
1810 barrier(); 1814 smp_rmb();
1811 return hpsb_write(ne->host, ne->nodeid, generation, 1815 return hpsb_write(ne->host, ne->nodeid, generation,
1812 addr, buffer, length); 1816 addr, buffer, length);
1813} 1817}
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h
index 15ea09733e84..ee5acdbd114a 100644
--- a/drivers/ieee1394/nodemgr.h
+++ b/drivers/ieee1394/nodemgr.h
@@ -21,9 +21,11 @@
21#define _IEEE1394_NODEMGR_H 21#define _IEEE1394_NODEMGR_H
22 22
23#include <linux/device.h> 23#include <linux/device.h>
24#include <asm/system.h>
24#include <asm/types.h> 25#include <asm/types.h>
25 26
26#include "ieee1394_core.h" 27#include "ieee1394_core.h"
28#include "ieee1394_transactions.h"
27#include "ieee1394_types.h" 29#include "ieee1394_types.h"
28 30
29struct csr1212_csr; 31struct csr1212_csr;
@@ -154,6 +156,22 @@ static inline int hpsb_node_entry_valid(struct node_entry *ne)
154void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet); 156void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet);
155int hpsb_node_write(struct node_entry *ne, u64 addr, 157int hpsb_node_write(struct node_entry *ne, u64 addr,
156 quadlet_t *buffer, size_t length); 158 quadlet_t *buffer, size_t length);
159static inline int hpsb_node_read(struct node_entry *ne, u64 addr,
160 quadlet_t *buffer, size_t length)
161{
162 unsigned int g = ne->generation;
163
164 smp_rmb();
165 return hpsb_read(ne->host, ne->nodeid, g, addr, buffer, length);
166}
167static inline int hpsb_node_lock(struct node_entry *ne, u64 addr, int extcode,
168 quadlet_t *buffer, quadlet_t arg)
169{
170 unsigned int g = ne->generation;
171
172 smp_rmb();
173 return hpsb_lock(ne->host, ne->nodeid, g, addr, extcode, buffer, arg);
174}
157int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)); 175int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *));
158 176
159int init_ieee1394_nodemgr(void); 177int init_ieee1394_nodemgr(void);
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index a01b4488208b..4a65b96db2c8 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -2490,12 +2490,14 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
2490 int ret = 0; 2490 int ret = 0;
2491 struct nes_vnic *nesvnic; 2491 struct nes_vnic *nesvnic;
2492 struct nes_device *nesdev; 2492 struct nes_device *nesdev;
2493 struct nes_ib_device *nesibdev;
2493 2494
2494 nesvnic = to_nesvnic(nesqp->ibqp.device); 2495 nesvnic = to_nesvnic(nesqp->ibqp.device);
2495 if (!nesvnic) 2496 if (!nesvnic)
2496 return -EINVAL; 2497 return -EINVAL;
2497 2498
2498 nesdev = nesvnic->nesdev; 2499 nesdev = nesvnic->nesdev;
2500 nesibdev = nesvnic->nesibdev;
2499 2501
2500 nes_debug(NES_DBG_CM, "netdev refcnt = %u.\n", 2502 nes_debug(NES_DBG_CM, "netdev refcnt = %u.\n",
2501 atomic_read(&nesvnic->netdev->refcnt)); 2503 atomic_read(&nesvnic->netdev->refcnt));
@@ -2507,6 +2509,8 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
2507 } else { 2509 } else {
2508 /* Need to free the Last Streaming Mode Message */ 2510 /* Need to free the Last Streaming Mode Message */
2509 if (nesqp->ietf_frame) { 2511 if (nesqp->ietf_frame) {
2512 if (nesqp->lsmm_mr)
2513 nesibdev->ibdev.dereg_mr(nesqp->lsmm_mr);
2510 pci_free_consistent(nesdev->pcidev, 2514 pci_free_consistent(nesdev->pcidev,
2511 nesqp->private_data_len+sizeof(struct ietf_mpa_frame), 2515 nesqp->private_data_len+sizeof(struct ietf_mpa_frame),
2512 nesqp->ietf_frame, nesqp->ietf_frame_pbase); 2516 nesqp->ietf_frame, nesqp->ietf_frame_pbase);
@@ -2543,6 +2547,12 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2543 u32 crc_value; 2547 u32 crc_value;
2544 int ret; 2548 int ret;
2545 int passive_state; 2549 int passive_state;
2550 struct nes_ib_device *nesibdev;
2551 struct ib_mr *ibmr = NULL;
2552 struct ib_phys_buf ibphysbuf;
2553 struct nes_pd *nespd;
2554
2555
2546 2556
2547 ibqp = nes_get_qp(cm_id->device, conn_param->qpn); 2557 ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
2548 if (!ibqp) 2558 if (!ibqp)
@@ -2601,6 +2611,26 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2601 if (cm_id->remote_addr.sin_addr.s_addr != 2611 if (cm_id->remote_addr.sin_addr.s_addr !=
2602 cm_id->local_addr.sin_addr.s_addr) { 2612 cm_id->local_addr.sin_addr.s_addr) {
2603 u64temp = (unsigned long)nesqp; 2613 u64temp = (unsigned long)nesqp;
2614 nesibdev = nesvnic->nesibdev;
2615 nespd = nesqp->nespd;
2616 ibphysbuf.addr = nesqp->ietf_frame_pbase;
2617 ibphysbuf.size = conn_param->private_data_len +
2618 sizeof(struct ietf_mpa_frame);
2619 ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd,
2620 &ibphysbuf, 1,
2621 IB_ACCESS_LOCAL_WRITE,
2622 (u64 *)&nesqp->ietf_frame);
2623 if (!ibmr) {
2624 nes_debug(NES_DBG_CM, "Unable to register memory region"
2625 "for lSMM for cm_node = %p \n",
2626 cm_node);
2627 return -ENOMEM;
2628 }
2629
2630 ibmr->pd = &nespd->ibpd;
2631 ibmr->device = nespd->ibpd.device;
2632 nesqp->lsmm_mr = ibmr;
2633
2604 u64temp |= NES_SW_CONTEXT_ALIGN>>1; 2634 u64temp |= NES_SW_CONTEXT_ALIGN>>1;
2605 set_wqe_64bit_value(wqe->wqe_words, 2635 set_wqe_64bit_value(wqe->wqe_words,
2606 NES_IWARP_SQ_WQE_COMP_CTX_LOW_IDX, 2636 NES_IWARP_SQ_WQE_COMP_CTX_LOW_IDX,
@@ -2611,14 +2641,13 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2611 wqe->wqe_words[NES_IWARP_SQ_WQE_TOTAL_PAYLOAD_IDX] = 2641 wqe->wqe_words[NES_IWARP_SQ_WQE_TOTAL_PAYLOAD_IDX] =
2612 cpu_to_le32(conn_param->private_data_len + 2642 cpu_to_le32(conn_param->private_data_len +
2613 sizeof(struct ietf_mpa_frame)); 2643 sizeof(struct ietf_mpa_frame));
2614 wqe->wqe_words[NES_IWARP_SQ_WQE_FRAG0_LOW_IDX] = 2644 set_wqe_64bit_value(wqe->wqe_words,
2615 cpu_to_le32((u32)nesqp->ietf_frame_pbase); 2645 NES_IWARP_SQ_WQE_FRAG0_LOW_IDX,
2616 wqe->wqe_words[NES_IWARP_SQ_WQE_FRAG0_HIGH_IDX] = 2646 (u64)nesqp->ietf_frame);
2617 cpu_to_le32((u32)((u64)nesqp->ietf_frame_pbase >> 32));
2618 wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] = 2647 wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] =
2619 cpu_to_le32(conn_param->private_data_len + 2648 cpu_to_le32(conn_param->private_data_len +
2620 sizeof(struct ietf_mpa_frame)); 2649 sizeof(struct ietf_mpa_frame));
2621 wqe->wqe_words[NES_IWARP_SQ_WQE_STAG0_IDX] = 0; 2650 wqe->wqe_words[NES_IWARP_SQ_WQE_STAG0_IDX] = ibmr->lkey;
2622 2651
2623 nesqp->nesqp_context->ird_ord_sizes |= 2652 nesqp->nesqp_context->ird_ord_sizes |=
2624 cpu_to_le32(NES_QPCONTEXT_ORDIRD_LSMM_PRESENT | 2653 cpu_to_le32(NES_QPCONTEXT_ORDIRD_LSMM_PRESENT |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 4fdb72454f94..d93a6562817c 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1360,8 +1360,10 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1360 NES_QPCONTEXT_MISC_RQ_SIZE_SHIFT); 1360 NES_QPCONTEXT_MISC_RQ_SIZE_SHIFT);
1361 nesqp->nesqp_context->misc |= cpu_to_le32((u32)nesqp->hwqp.sq_encoded_size << 1361 nesqp->nesqp_context->misc |= cpu_to_le32((u32)nesqp->hwqp.sq_encoded_size <<
1362 NES_QPCONTEXT_MISC_SQ_SIZE_SHIFT); 1362 NES_QPCONTEXT_MISC_SQ_SIZE_SHIFT);
1363 if (!udata) {
1363 nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_PRIV_EN); 1364 nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_PRIV_EN);
1364 nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_FAST_REGISTER_EN); 1365 nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_FAST_REGISTER_EN);
1366 }
1365 nesqp->nesqp_context->cqs = cpu_to_le32(nesqp->nesscq->hw_cq.cq_number + 1367 nesqp->nesqp_context->cqs = cpu_to_le32(nesqp->nesscq->hw_cq.cq_number +
1366 ((u32)nesqp->nesrcq->hw_cq.cq_number << 16)); 1368 ((u32)nesqp->nesrcq->hw_cq.cq_number << 16));
1367 u64temp = (u64)nesqp->hwqp.sq_pbase; 1369 u64temp = (u64)nesqp->hwqp.sq_pbase;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.h b/drivers/infiniband/hw/nes/nes_verbs.h
index 6c6b4da5184f..ae0ca9bc83bd 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.h
+++ b/drivers/infiniband/hw/nes/nes_verbs.h
@@ -134,6 +134,7 @@ struct nes_qp {
134 struct ietf_mpa_frame *ietf_frame; 134 struct ietf_mpa_frame *ietf_frame;
135 dma_addr_t ietf_frame_pbase; 135 dma_addr_t ietf_frame_pbase;
136 wait_queue_head_t state_waitq; 136 wait_queue_head_t state_waitq;
137 struct ib_mr *lsmm_mr;
137 unsigned long socket; 138 unsigned long socket;
138 struct nes_hw_qp hwqp; 139 struct nes_hw_qp hwqp;
139 struct work_struct work; 140 struct work_struct work;
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index c3c8b9bc40ae..45470f18d7e9 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -839,7 +839,7 @@ static void atkbd_disconnect(struct serio *serio)
839 */ 839 */
840static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd) 840static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
841{ 841{
842 const unsigned int forced_release_keys[] = { 842 static const unsigned int forced_release_keys[] = {
843 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, 843 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93,
844 }; 844 };
845 int i; 845 int i;
@@ -856,7 +856,7 @@ static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
856 */ 856 */
857static void atkbd_hp_keymap_fixup(struct atkbd *atkbd) 857static void atkbd_hp_keymap_fixup(struct atkbd *atkbd)
858{ 858{
859 const unsigned int forced_release_keys[] = { 859 static const unsigned int forced_release_keys[] = {
860 0x94, 860 0x94,
861 }; 861 };
862 int i; 862 int i;
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 19284016e0f4..ee855c5202e8 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -209,8 +209,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev)
209 goto out; 209 goto out;
210 } 210 }
211 211
212 if (!pdata->debounce_time || !pdata->debounce_time > MAX_MULT || 212 if (!pdata->debounce_time || pdata->debounce_time > MAX_MULT ||
213 !pdata->coldrive_time || !pdata->coldrive_time > MAX_MULT) { 213 !pdata->coldrive_time || pdata->coldrive_time > MAX_MULT) {
214 printk(KERN_ERR DRV_NAME 214 printk(KERN_ERR DRV_NAME
215 ": Invalid Debounce/Columdrive Time from pdata\n"); 215 ": Invalid Debounce/Columdrive Time from pdata\n");
216 bfin_write_KPAD_MSEL(0xFF0); /* Default MSEL */ 216 bfin_write_KPAD_MSEL(0xFF0); /* Default MSEL */
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index c8ed065ea0cb..abb04c82c622 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -288,7 +288,7 @@ static int corgikbd_resume(struct platform_device *dev)
288#define corgikbd_resume NULL 288#define corgikbd_resume NULL
289#endif 289#endif
290 290
291static int __init corgikbd_probe(struct platform_device *pdev) 291static int __devinit corgikbd_probe(struct platform_device *pdev)
292{ 292{
293 struct corgikbd *corgikbd; 293 struct corgikbd *corgikbd;
294 struct input_dev *input_dev; 294 struct input_dev *input_dev;
@@ -368,7 +368,7 @@ static int __init corgikbd_probe(struct platform_device *pdev)
368 return err; 368 return err;
369} 369}
370 370
371static int corgikbd_remove(struct platform_device *pdev) 371static int __devexit corgikbd_remove(struct platform_device *pdev)
372{ 372{
373 int i; 373 int i;
374 struct corgikbd *corgikbd = platform_get_drvdata(pdev); 374 struct corgikbd *corgikbd = platform_get_drvdata(pdev);
@@ -388,7 +388,7 @@ static int corgikbd_remove(struct platform_device *pdev)
388 388
389static struct platform_driver corgikbd_driver = { 389static struct platform_driver corgikbd_driver = {
390 .probe = corgikbd_probe, 390 .probe = corgikbd_probe,
391 .remove = corgikbd_remove, 391 .remove = __devexit_p(corgikbd_remove),
392 .suspend = corgikbd_suspend, 392 .suspend = corgikbd_suspend,
393 .resume = corgikbd_resume, 393 .resume = corgikbd_resume,
394 .driver = { 394 .driver = {
@@ -397,7 +397,7 @@ static struct platform_driver corgikbd_driver = {
397 }, 397 },
398}; 398};
399 399
400static int __devinit corgikbd_init(void) 400static int __init corgikbd_init(void)
401{ 401{
402 return platform_driver_register(&corgikbd_driver); 402 return platform_driver_register(&corgikbd_driver);
403} 403}
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 3f3d1198cdb1..058fa8b02c21 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -279,7 +279,7 @@ static int omap_kp_resume(struct platform_device *dev)
279#define omap_kp_resume NULL 279#define omap_kp_resume NULL
280#endif 280#endif
281 281
282static int __init omap_kp_probe(struct platform_device *pdev) 282static int __devinit omap_kp_probe(struct platform_device *pdev)
283{ 283{
284 struct omap_kp *omap_kp; 284 struct omap_kp *omap_kp;
285 struct input_dev *input_dev; 285 struct input_dev *input_dev;
@@ -422,7 +422,7 @@ err1:
422 return -EINVAL; 422 return -EINVAL;
423} 423}
424 424
425static int omap_kp_remove(struct platform_device *pdev) 425static int __devexit omap_kp_remove(struct platform_device *pdev)
426{ 426{
427 struct omap_kp *omap_kp = platform_get_drvdata(pdev); 427 struct omap_kp *omap_kp = platform_get_drvdata(pdev);
428 428
@@ -454,7 +454,7 @@ static int omap_kp_remove(struct platform_device *pdev)
454 454
455static struct platform_driver omap_kp_driver = { 455static struct platform_driver omap_kp_driver = {
456 .probe = omap_kp_probe, 456 .probe = omap_kp_probe,
457 .remove = omap_kp_remove, 457 .remove = __devexit_p(omap_kp_remove),
458 .suspend = omap_kp_suspend, 458 .suspend = omap_kp_suspend,
459 .resume = omap_kp_resume, 459 .resume = omap_kp_resume,
460 .driver = { 460 .driver = {
@@ -463,7 +463,7 @@ static struct platform_driver omap_kp_driver = {
463 }, 463 },
464}; 464};
465 465
466static int __devinit omap_kp_init(void) 466static int __init omap_kp_init(void)
467{ 467{
468 printk(KERN_INFO "OMAP Keypad Driver\n"); 468 printk(KERN_INFO "OMAP Keypad Driver\n");
469 return platform_driver_register(&omap_kp_driver); 469 return platform_driver_register(&omap_kp_driver);
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index c48b76a46a58..9d1781a618e9 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -343,7 +343,7 @@ static int spitzkbd_resume(struct platform_device *dev)
343#define spitzkbd_resume NULL 343#define spitzkbd_resume NULL
344#endif 344#endif
345 345
346static int __init spitzkbd_probe(struct platform_device *dev) 346static int __devinit spitzkbd_probe(struct platform_device *dev)
347{ 347{
348 struct spitzkbd *spitzkbd; 348 struct spitzkbd *spitzkbd;
349 struct input_dev *input_dev; 349 struct input_dev *input_dev;
@@ -444,7 +444,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
444 return err; 444 return err;
445} 445}
446 446
447static int spitzkbd_remove(struct platform_device *dev) 447static int __devexit spitzkbd_remove(struct platform_device *dev)
448{ 448{
449 int i; 449 int i;
450 struct spitzkbd *spitzkbd = platform_get_drvdata(dev); 450 struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
@@ -470,7 +470,7 @@ static int spitzkbd_remove(struct platform_device *dev)
470 470
471static struct platform_driver spitzkbd_driver = { 471static struct platform_driver spitzkbd_driver = {
472 .probe = spitzkbd_probe, 472 .probe = spitzkbd_probe,
473 .remove = spitzkbd_remove, 473 .remove = __devexit_p(spitzkbd_remove),
474 .suspend = spitzkbd_suspend, 474 .suspend = spitzkbd_suspend,
475 .resume = spitzkbd_resume, 475 .resume = spitzkbd_resume,
476 .driver = { 476 .driver = {
@@ -479,7 +479,7 @@ static struct platform_driver spitzkbd_driver = {
479 }, 479 },
480}; 480};
481 481
482static int __devinit spitzkbd_init(void) 482static int __init spitzkbd_init(void)
483{ 483{
484 return platform_driver_register(&spitzkbd_driver); 484 return platform_driver_register(&spitzkbd_driver);
485} 485}
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 093c8c1bca74..9705f3a00a3d 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS
70config MOUSE_PS2_LIFEBOOK 70config MOUSE_PS2_LIFEBOOK
71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED 71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
72 default y 72 default y
73 depends on MOUSE_PS2 73 depends on MOUSE_PS2 && X86
74 help 74 help
75 Say Y here if you have a Fujitsu B-series Lifebook PS/2 75 Say Y here if you have a Fujitsu B-series Lifebook PS/2
76 TouchScreen connected to your system. 76 TouchScreen connected to your system.
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b9a25d57bc5e..6ab0eb1ada1c 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -542,7 +542,7 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
542 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || 542 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
543 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || 543 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
544 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { 544 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) {
545 pr_err("elantech.c: sending Elantech magic knock failed.\n"); 545 pr_debug("elantech.c: sending Elantech magic knock failed.\n");
546 return -1; 546 return -1;
547 } 547 }
548 548
@@ -551,8 +551,27 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
551 * set of magic numbers 551 * set of magic numbers
552 */ 552 */
553 if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) { 553 if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) {
554 pr_info("elantech.c: unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", 554 pr_debug("elantech.c: "
555 param[0], param[1], param[2]); 555 "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
556 param[0], param[1], param[2]);
557 return -1;
558 }
559
560 /*
561 * Query touchpad's firmware version and see if it reports known
562 * value to avoid mis-detection. Logitech mice are known to respond
563 * to Elantech magic knock and there might be more.
564 */
565 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
566 pr_debug("elantech.c: failed to query firmware version.\n");
567 return -1;
568 }
569
570 pr_debug("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
571 param[0], param[1], param[2]);
572
573 if (param[0] == 0 || param[1] != 0) {
574 pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
556 return -1; 575 return -1;
557 } 576 }
558 577
@@ -600,8 +619,7 @@ int elantech_init(struct psmouse *psmouse)
600 int i, error; 619 int i, error;
601 unsigned char param[3]; 620 unsigned char param[3];
602 621
603 etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); 622 psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);
604 psmouse->private = etd;
605 if (!etd) 623 if (!etd)
606 return -1; 624 return -1;
607 625
@@ -610,14 +628,12 @@ int elantech_init(struct psmouse *psmouse)
610 etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; 628 etd->parity[i] = etd->parity[i & (i - 1)] ^ 1;
611 629
612 /* 630 /*
613 * Find out what version hardware this is 631 * Do the version query again so we can store the result
614 */ 632 */
615 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { 633 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
616 pr_err("elantech.c: failed to query firmware version.\n"); 634 pr_err("elantech.c: failed to query firmware version.\n");
617 goto init_fail; 635 goto init_fail;
618 } 636 }
619 pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
620 param[0], param[1], param[2]);
621 etd->fw_version_maj = param[0]; 637 etd->fw_version_maj = param[0];
622 etd->fw_version_min = param[2]; 638 etd->fw_version_min = param[2];
623 639
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c
index d297accf9a7f..1e827ad0afbe 100644
--- a/drivers/input/mouse/pxa930_trkball.c
+++ b/drivers/input/mouse/pxa930_trkball.c
@@ -83,7 +83,7 @@ static int write_tbcr(struct pxa930_trkball *trkball, int v)
83 83
84 __raw_writel(v, trkball->mmio_base + TBCR); 84 __raw_writel(v, trkball->mmio_base + TBCR);
85 85
86 while (i--) { 86 while (--i) {
87 if (__raw_readl(trkball->mmio_base + TBCR) == v) 87 if (__raw_readl(trkball->mmio_base + TBCR) == v)
88 break; 88 break;
89 msleep(1); 89 msleep(1);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 865fc69e9bc3..f3e4f7b0240d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -182,11 +182,6 @@ static int synaptics_identify(struct psmouse *psmouse)
182 182
183static int synaptics_query_hardware(struct psmouse *psmouse) 183static int synaptics_query_hardware(struct psmouse *psmouse)
184{ 184{
185 int retries = 0;
186
187 while ((retries++ < 3) && psmouse_reset(psmouse))
188 /* empty */;
189
190 if (synaptics_identify(psmouse)) 185 if (synaptics_identify(psmouse))
191 return -1; 186 return -1;
192 if (synaptics_model_id(psmouse)) 187 if (synaptics_model_id(psmouse))
@@ -582,6 +577,8 @@ static int synaptics_reconnect(struct psmouse *psmouse)
582 struct synaptics_data *priv = psmouse->private; 577 struct synaptics_data *priv = psmouse->private;
583 struct synaptics_data old_priv = *priv; 578 struct synaptics_data old_priv = *priv;
584 579
580 psmouse_reset(psmouse);
581
585 if (synaptics_detect(psmouse, 0)) 582 if (synaptics_detect(psmouse, 0))
586 return -1; 583 return -1;
587 584
@@ -640,6 +637,8 @@ int synaptics_init(struct psmouse *psmouse)
640 if (!priv) 637 if (!priv)
641 return -1; 638 return -1;
642 639
640 psmouse_reset(psmouse);
641
643 if (synaptics_query_hardware(psmouse)) { 642 if (synaptics_query_hardware(psmouse)) {
644 printk(KERN_ERR "Unable to query Synaptics hardware.\n"); 643 printk(KERN_ERR "Unable to query Synaptics hardware.\n");
645 goto init_fail; 644 goto init_fail;
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c
index b10ffae7c39b..e29cdc13a199 100644
--- a/drivers/input/serio/ambakmi.c
+++ b/drivers/input/serio/ambakmi.c
@@ -57,7 +57,7 @@ static int amba_kmi_write(struct serio *io, unsigned char val)
57 struct amba_kmi_port *kmi = io->port_data; 57 struct amba_kmi_port *kmi = io->port_data;
58 unsigned int timeleft = 10000; /* timeout in 100ms */ 58 unsigned int timeleft = 10000; /* timeout in 100ms */
59 59
60 while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && timeleft--) 60 while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && --timeleft)
61 udelay(10); 61 udelay(10);
62 62
63 if (timeleft) 63 if (timeleft)
@@ -129,8 +129,8 @@ static int amba_kmi_probe(struct amba_device *dev, void *id)
129 io->write = amba_kmi_write; 129 io->write = amba_kmi_write;
130 io->open = amba_kmi_open; 130 io->open = amba_kmi_open;
131 io->close = amba_kmi_close; 131 io->close = amba_kmi_close;
132 strlcpy(io->name, dev->dev.bus_id, sizeof(io->name)); 132 strlcpy(io->name, dev_name(&dev->dev), sizeof(io->name));
133 strlcpy(io->phys, dev->dev.bus_id, sizeof(io->phys)); 133 strlcpy(io->phys, dev_name(&dev->dev), sizeof(io->phys));
134 io->port_data = kmi; 134 io->port_data = kmi;
135 io->dev.parent = &dev->dev; 135 io->dev.parent = &dev->dev;
136 136
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index adc3bd6e7f7b..bd0f92d9f40f 100644
--- a/drivers/input/serio/gscps2.c
+++ b/drivers/input/serio/gscps2.c
@@ -359,7 +359,7 @@ static int __init gscps2_probe(struct parisc_device *dev)
359 359
360 snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s", 360 snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s",
361 (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); 361 (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse");
362 strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); 362 strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys));
363 serio->id.type = SERIO_8042; 363 serio->id.type = SERIO_8042;
364 serio->write = gscps2_write; 364 serio->write = gscps2_write;
365 serio->open = gscps2_open; 365 serio->open = gscps2_open;
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
index 2ad88780a170..57953c0eb82f 100644
--- a/drivers/input/serio/sa1111ps2.c
+++ b/drivers/input/serio/sa1111ps2.c
@@ -246,8 +246,8 @@ static int __devinit ps2_probe(struct sa1111_dev *dev)
246 serio->write = ps2_write; 246 serio->write = ps2_write;
247 serio->open = ps2_open; 247 serio->open = ps2_open;
248 serio->close = ps2_close; 248 serio->close = ps2_close;
249 strlcpy(serio->name, dev->dev.bus_id, sizeof(serio->name)); 249 strlcpy(serio->name, dev_name(&dev->dev), sizeof(serio->name));
250 strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); 250 strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys));
251 serio->port_data = ps2if; 251 serio->port_data = ps2if;
252 serio->dev.parent = &dev->dev; 252 serio->dev.parent = &dev->dev;
253 ps2if->io = serio; 253 ps2if->io = serio;
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
index a89a6a8f05e6..055969e8be13 100644
--- a/drivers/input/touchscreen/atmel_tsadcc.c
+++ b/drivers/input/touchscreen/atmel_tsadcc.c
@@ -236,7 +236,7 @@ static int __devinit atmel_tsadcc_probe(struct platform_device *pdev)
236 ts_dev->bufferedmeasure = 0; 236 ts_dev->bufferedmeasure = 0;
237 237
238 snprintf(ts_dev->phys, sizeof(ts_dev->phys), 238 snprintf(ts_dev->phys, sizeof(ts_dev->phys),
239 "%s/input0", pdev->dev.bus_id); 239 "%s/input0", dev_name(&pdev->dev));
240 240
241 input_dev->name = "atmel touch screen controller"; 241 input_dev->name = "atmel touch screen controller";
242 input_dev->phys = ts_dev->phys; 242 input_dev->phys = ts_dev->phys;
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index 65202c9f63ff..3fb51b54fe61 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -268,7 +268,7 @@ static int corgits_resume(struct platform_device *dev)
268#define corgits_resume NULL 268#define corgits_resume NULL
269#endif 269#endif
270 270
271static int __init corgits_probe(struct platform_device *pdev) 271static int __devinit corgits_probe(struct platform_device *pdev)
272{ 272{
273 struct corgi_ts *corgi_ts; 273 struct corgi_ts *corgi_ts;
274 struct input_dev *input_dev; 274 struct input_dev *input_dev;
@@ -343,7 +343,7 @@ static int __init corgits_probe(struct platform_device *pdev)
343 return err; 343 return err;
344} 344}
345 345
346static int corgits_remove(struct platform_device *pdev) 346static int __devexit corgits_remove(struct platform_device *pdev)
347{ 347{
348 struct corgi_ts *corgi_ts = platform_get_drvdata(pdev); 348 struct corgi_ts *corgi_ts = platform_get_drvdata(pdev);
349 349
@@ -352,12 +352,13 @@ static int corgits_remove(struct platform_device *pdev)
352 corgi_ts->machinfo->put_hsync(); 352 corgi_ts->machinfo->put_hsync();
353 input_unregister_device(corgi_ts->input); 353 input_unregister_device(corgi_ts->input);
354 kfree(corgi_ts); 354 kfree(corgi_ts);
355
355 return 0; 356 return 0;
356} 357}
357 358
358static struct platform_driver corgits_driver = { 359static struct platform_driver corgits_driver = {
359 .probe = corgits_probe, 360 .probe = corgits_probe,
360 .remove = corgits_remove, 361 .remove = __devexit_p(corgits_remove),
361 .suspend = corgits_suspend, 362 .suspend = corgits_suspend,
362 .resume = corgits_resume, 363 .resume = corgits_resume,
363 .driver = { 364 .driver = {
@@ -366,7 +367,7 @@ static struct platform_driver corgits_driver = {
366 }, 367 },
367}; 368};
368 369
369static int __devinit corgits_init(void) 370static int __init corgits_init(void)
370{ 371{
371 return platform_driver_register(&corgits_driver); 372 return platform_driver_register(&corgits_driver);
372} 373}
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index b75dc2990574..4ab070246892 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -289,7 +289,8 @@ static int tsc2007_probe(struct i2c_client *client,
289 289
290 pdata->init_platform_hw(); 290 pdata->init_platform_hw();
291 291
292 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", client->dev.bus_id); 292 snprintf(ts->phys, sizeof(ts->phys),
293 "%s/input0", dev_name(&client->dev));
293 294
294 input_dev->name = "TSC2007 Touchscreen"; 295 input_dev->name = "TSC2007 Touchscreen";
295 input_dev->phys = ts->phys; 296 input_dev->phys = ts->phys;
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 5080b26ba160..fb7cb9bdfbd5 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -60,6 +60,10 @@ static int swap_xy;
60module_param(swap_xy, bool, 0644); 60module_param(swap_xy, bool, 0644);
61MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); 61MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
62 62
63static int hwcalib_xy;
64module_param(hwcalib_xy, bool, 0644);
65MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
66
63/* device specifc data/functions */ 67/* device specifc data/functions */
64struct usbtouch_usb; 68struct usbtouch_usb;
65struct usbtouch_device_info { 69struct usbtouch_device_info {
@@ -118,6 +122,7 @@ enum {
118 122
119#define USB_DEVICE_HID_CLASS(vend, prod) \ 123#define USB_DEVICE_HID_CLASS(vend, prod) \
120 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ 124 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \
125 | USB_DEVICE_ID_MATCH_INT_PROTOCOL \
121 | USB_DEVICE_ID_MATCH_DEVICE, \ 126 | USB_DEVICE_ID_MATCH_DEVICE, \
122 .idVendor = (vend), \ 127 .idVendor = (vend), \
123 .idProduct = (prod), \ 128 .idProduct = (prod), \
@@ -260,8 +265,13 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
260 265
261static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 266static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
262{ 267{
263 dev->x = (pkt[8] << 8) | pkt[7]; 268 if (hwcalib_xy) {
264 dev->y = (pkt[10] << 8) | pkt[9]; 269 dev->x = (pkt[4] << 8) | pkt[3];
270 dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]);
271 } else {
272 dev->x = (pkt[8] << 8) | pkt[7];
273 dev->y = (pkt[10] << 8) | pkt[9];
274 }
265 dev->touch = (pkt[2] & 0x40) ? 1 : 0; 275 dev->touch = (pkt[2] & 0x40) ? 1 : 0;
266 276
267 return 1; 277 return 1;
@@ -294,6 +304,12 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
294 return ret; 304 return ret;
295 } 305 }
296 306
307 /* Default min/max xy are the raw values, override if using hw-calib */
308 if (hwcalib_xy) {
309 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0);
310 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0);
311 }
312
297 return 0; 313 return 0;
298} 314}
299#endif 315#endif
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c
index 712220cef139..7f16d75d2d89 100644
--- a/drivers/isdn/sc/shmem.c
+++ b/drivers/isdn/sc/shmem.c
@@ -54,7 +54,7 @@ void memcpy_toshmem(int card, void *dest, const void *src, size_t n)
54 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); 54 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);
55 pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, 55 pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename,
56 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); 56 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80);
57 pr_debug("%s: copying %d bytes from %#lx to %#lx\n", 57 pr_debug("%s: copying %zu bytes from %#lx to %#lx\n",
58 sc_adapter[card]->devicename, n, 58 sc_adapter[card]->devicename, n,
59 (unsigned long) src, 59 (unsigned long) src,
60 sc_adapter[card]->rambase + ((unsigned long) dest %0x4000)); 60 sc_adapter[card]->rambase + ((unsigned long) dest %0x4000));
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index b4d44e571d76..8132533d71f9 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -212,6 +212,9 @@ static void lg_notify(struct virtqueue *vq)
212 hcall(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT, 0, 0); 212 hcall(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT, 0, 0);
213} 213}
214 214
215/* An extern declaration inside a C file is bad form. Don't do it. */
216extern void lguest_setup_irq(unsigned int irq);
217
215/* This routine finds the first virtqueue described in the configuration of 218/* This routine finds the first virtqueue described in the configuration of
216 * this device and sets it up. 219 * this device and sets it up.
217 * 220 *
@@ -266,6 +269,9 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
266 goto unmap; 269 goto unmap;
267 } 270 }
268 271
272 /* Make sure the interrupt is allocated. */
273 lguest_setup_irq(lvq->config.irq);
274
269 /* Tell the interrupt for this virtqueue to go to the virtio_ring 275 /* Tell the interrupt for this virtqueue to go to the virtio_ring
270 * interrupt handler. */ 276 * interrupt handler. */
271 /* FIXME: We used to have a flag for the Host to tell us we could use 277 /* FIXME: We used to have a flag for the Host to tell us we could use
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index a34338567a2a..f14813be4eff 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -328,7 +328,7 @@ static void dispatch_io(int rw, unsigned int num_regions,
328 struct dpages old_pages = *dp; 328 struct dpages old_pages = *dp;
329 329
330 if (sync) 330 if (sync)
331 rw |= (1 << BIO_RW_SYNC); 331 rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
332 332
333 /* 333 /*
334 * For multiple regions we need to be careful to rewind 334 * For multiple regions we need to be careful to rewind
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index 3073618269ea..0a225da21272 100644
--- a/drivers/md/dm-kcopyd.c
+++ b/drivers/md/dm-kcopyd.c
@@ -344,7 +344,7 @@ static int run_io_job(struct kcopyd_job *job)
344{ 344{
345 int r; 345 int r;
346 struct dm_io_request io_req = { 346 struct dm_io_request io_req = {
347 .bi_rw = job->rw | (1 << BIO_RW_SYNC), 347 .bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG),
348 .mem.type = DM_IO_PAGE_LIST, 348 .mem.type = DM_IO_PAGE_LIST,
349 .mem.ptr.pl = job->pages, 349 .mem.ptr.pl = job->pages,
350 .mem.offset = job->offset, 350 .mem.offset = job->offset,
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4495104f6c9f..a307f87eb90e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -214,12 +214,7 @@ static inline mddev_t *mddev_get(mddev_t *mddev)
214 return mddev; 214 return mddev;
215} 215}
216 216
217static void mddev_delayed_delete(struct work_struct *ws) 217static void mddev_delayed_delete(struct work_struct *ws);
218{
219 mddev_t *mddev = container_of(ws, mddev_t, del_work);
220 kobject_del(&mddev->kobj);
221 kobject_put(&mddev->kobj);
222}
223 218
224static void mddev_put(mddev_t *mddev) 219static void mddev_put(mddev_t *mddev)
225{ 220{
@@ -474,7 +469,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
474 * causes ENOTSUPP, we allocate a spare bio... 469 * causes ENOTSUPP, we allocate a spare bio...
475 */ 470 */
476 struct bio *bio = bio_alloc(GFP_NOIO, 1); 471 struct bio *bio = bio_alloc(GFP_NOIO, 1);
477 int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC); 472 int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG);
478 473
479 bio->bi_bdev = rdev->bdev; 474 bio->bi_bdev = rdev->bdev;
480 bio->bi_sector = sector; 475 bio->bi_sector = sector;
@@ -531,7 +526,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size,
531 struct completion event; 526 struct completion event;
532 int ret; 527 int ret;
533 528
534 rw |= (1 << BIO_RW_SYNC); 529 rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
535 530
536 bio->bi_bdev = bdev; 531 bio->bi_bdev = bdev;
537 bio->bi_sector = sector; 532 bio->bi_sector = sector;
@@ -3542,6 +3537,21 @@ static struct kobj_type md_ktype = {
3542 3537
3543int mdp_major = 0; 3538int mdp_major = 0;
3544 3539
3540static void mddev_delayed_delete(struct work_struct *ws)
3541{
3542 mddev_t *mddev = container_of(ws, mddev_t, del_work);
3543
3544 if (mddev->private == &md_redundancy_group) {
3545 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
3546 if (mddev->sysfs_action)
3547 sysfs_put(mddev->sysfs_action);
3548 mddev->sysfs_action = NULL;
3549 mddev->private = NULL;
3550 }
3551 kobject_del(&mddev->kobj);
3552 kobject_put(&mddev->kobj);
3553}
3554
3545static int md_alloc(dev_t dev, char *name) 3555static int md_alloc(dev_t dev, char *name)
3546{ 3556{
3547 static DEFINE_MUTEX(disks_mutex); 3557 static DEFINE_MUTEX(disks_mutex);
@@ -4033,13 +4043,9 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4033 mddev->queue->merge_bvec_fn = NULL; 4043 mddev->queue->merge_bvec_fn = NULL;
4034 mddev->queue->unplug_fn = NULL; 4044 mddev->queue->unplug_fn = NULL;
4035 mddev->queue->backing_dev_info.congested_fn = NULL; 4045 mddev->queue->backing_dev_info.congested_fn = NULL;
4036 if (mddev->pers->sync_request) {
4037 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
4038 if (mddev->sysfs_action)
4039 sysfs_put(mddev->sysfs_action);
4040 mddev->sysfs_action = NULL;
4041 }
4042 module_put(mddev->pers->owner); 4046 module_put(mddev->pers->owner);
4047 if (mddev->pers->sync_request)
4048 mddev->private = &md_redundancy_group;
4043 mddev->pers = NULL; 4049 mddev->pers = NULL;
4044 /* tell userspace to handle 'inactive' */ 4050 /* tell userspace to handle 'inactive' */
4045 sysfs_notify_dirent(mddev->sysfs_state); 4051 sysfs_notify_dirent(mddev->sysfs_state);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 01e3cffd03b8..e2466425d9ca 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1237,8 +1237,9 @@ static void end_sync_write(struct bio *bio, int error)
1237 update_head_pos(mirror, r1_bio); 1237 update_head_pos(mirror, r1_bio);
1238 1238
1239 if (atomic_dec_and_test(&r1_bio->remaining)) { 1239 if (atomic_dec_and_test(&r1_bio->remaining)) {
1240 md_done_sync(mddev, r1_bio->sectors, uptodate); 1240 sector_t s = r1_bio->sectors;
1241 put_buf(r1_bio); 1241 put_buf(r1_bio);
1242 md_done_sync(mddev, s, uptodate);
1242 } 1243 }
1243} 1244}
1244 1245
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 6736d6dff981..7301631abe04 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1236,6 +1236,7 @@ static void end_sync_read(struct bio *bio, int error)
1236 /* for reconstruct, we always reschedule after a read. 1236 /* for reconstruct, we always reschedule after a read.
1237 * for resync, only after all reads 1237 * for resync, only after all reads
1238 */ 1238 */
1239 rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev);
1239 if (test_bit(R10BIO_IsRecover, &r10_bio->state) || 1240 if (test_bit(R10BIO_IsRecover, &r10_bio->state) ||
1240 atomic_dec_and_test(&r10_bio->remaining)) { 1241 atomic_dec_and_test(&r10_bio->remaining)) {
1241 /* we have read all the blocks, 1242 /* we have read all the blocks,
@@ -1243,7 +1244,6 @@ static void end_sync_read(struct bio *bio, int error)
1243 */ 1244 */
1244 reschedule_retry(r10_bio); 1245 reschedule_retry(r10_bio);
1245 } 1246 }
1246 rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev);
1247} 1247}
1248 1248
1249static void end_sync_write(struct bio *bio, int error) 1249static void end_sync_write(struct bio *bio, int error)
@@ -1264,11 +1264,13 @@ static void end_sync_write(struct bio *bio, int error)
1264 1264
1265 update_head_pos(i, r10_bio); 1265 update_head_pos(i, r10_bio);
1266 1266
1267 rdev_dec_pending(conf->mirrors[d].rdev, mddev);
1267 while (atomic_dec_and_test(&r10_bio->remaining)) { 1268 while (atomic_dec_and_test(&r10_bio->remaining)) {
1268 if (r10_bio->master_bio == NULL) { 1269 if (r10_bio->master_bio == NULL) {
1269 /* the primary of several recovery bios */ 1270 /* the primary of several recovery bios */
1270 md_done_sync(mddev, r10_bio->sectors, 1); 1271 sector_t s = r10_bio->sectors;
1271 put_buf(r10_bio); 1272 put_buf(r10_bio);
1273 md_done_sync(mddev, s, 1);
1272 break; 1274 break;
1273 } else { 1275 } else {
1274 r10bio_t *r10_bio2 = (r10bio_t *)r10_bio->master_bio; 1276 r10bio_t *r10_bio2 = (r10bio_t *)r10_bio->master_bio;
@@ -1276,7 +1278,6 @@ static void end_sync_write(struct bio *bio, int error)
1276 r10_bio = r10_bio2; 1278 r10_bio = r10_bio2;
1277 } 1279 }
1278 } 1280 }
1279 rdev_dec_pending(conf->mirrors[d].rdev, mddev);
1280} 1281}
1281 1282
1282/* 1283/*
@@ -1749,8 +1750,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1749 if (!go_faster && conf->nr_waiting) 1750 if (!go_faster && conf->nr_waiting)
1750 msleep_interruptible(1000); 1751 msleep_interruptible(1000);
1751 1752
1752 bitmap_cond_end_sync(mddev->bitmap, sector_nr);
1753
1754 /* Again, very different code for resync and recovery. 1753 /* Again, very different code for resync and recovery.
1755 * Both must result in an r10bio with a list of bios that 1754 * Both must result in an r10bio with a list of bios that
1756 * have bi_end_io, bi_sector, bi_bdev set, 1755 * have bi_end_io, bi_sector, bi_bdev set,
@@ -1886,6 +1885,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1886 /* resync. Schedule a read for every block at this virt offset */ 1885 /* resync. Schedule a read for every block at this virt offset */
1887 int count = 0; 1886 int count = 0;
1888 1887
1888 bitmap_cond_end_sync(mddev->bitmap, sector_nr);
1889
1889 if (!bitmap_start_sync(mddev->bitmap, sector_nr, 1890 if (!bitmap_start_sync(mddev->bitmap, sector_nr,
1890 &sync_blocks, mddev->degraded) && 1891 &sync_blocks, mddev->degraded) &&
1891 !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { 1892 !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
@@ -2010,13 +2011,13 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
2010 /* There is nowhere to write, so all non-sync 2011 /* There is nowhere to write, so all non-sync
2011 * drives must be failed, so try the next chunk... 2012 * drives must be failed, so try the next chunk...
2012 */ 2013 */
2013 { 2014 if (sector_nr + max_sync < max_sector)
2014 sector_t sec = max_sector - sector_nr; 2015 max_sector = sector_nr + max_sync;
2015 sectors_skipped += sec; 2016
2017 sectors_skipped += (max_sector - sector_nr);
2016 chunks_skipped ++; 2018 chunks_skipped ++;
2017 sector_nr = max_sector; 2019 sector_nr = max_sector;
2018 goto skipped; 2020 goto skipped;
2019 }
2020} 2021}
2021 2022
2022static int run(mddev_t *mddev) 2023static int run(mddev_t *mddev)
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c
index de7adaf5fa5b..78412c9c424a 100644
--- a/drivers/media/common/tuners/tuner-simple.c
+++ b/drivers/media/common/tuners/tuner-simple.c
@@ -318,7 +318,6 @@ static int simple_std_setup(struct dvb_frontend *fe,
318 u8 *config, u8 *cb) 318 u8 *config, u8 *cb)
319{ 319{
320 struct tuner_simple_priv *priv = fe->tuner_priv; 320 struct tuner_simple_priv *priv = fe->tuner_priv;
321 u8 tuneraddr;
322 int rc; 321 int rc;
323 322
324 /* tv norm specific stuff for multi-norm tuners */ 323 /* tv norm specific stuff for multi-norm tuners */
@@ -387,6 +386,7 @@ static int simple_std_setup(struct dvb_frontend *fe,
387 386
388 case TUNER_PHILIPS_TUV1236D: 387 case TUNER_PHILIPS_TUV1236D:
389 { 388 {
389 struct tuner_i2c_props i2c = priv->i2c_props;
390 /* 0x40 -> ATSC antenna input 1 */ 390 /* 0x40 -> ATSC antenna input 1 */
391 /* 0x48 -> ATSC antenna input 2 */ 391 /* 0x48 -> ATSC antenna input 2 */
392 /* 0x00 -> NTSC antenna input 1 */ 392 /* 0x00 -> NTSC antenna input 1 */
@@ -398,17 +398,15 @@ static int simple_std_setup(struct dvb_frontend *fe,
398 buffer[1] = 0x04; 398 buffer[1] = 0x04;
399 } 399 }
400 /* set to the correct mode (analog or digital) */ 400 /* set to the correct mode (analog or digital) */
401 tuneraddr = priv->i2c_props.addr; 401 i2c.addr = 0x0a;
402 priv->i2c_props.addr = 0x0a; 402 rc = tuner_i2c_xfer_send(&i2c, &buffer[0], 2);
403 rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[0], 2);
404 if (2 != rc) 403 if (2 != rc)
405 tuner_warn("i2c i/o error: rc == %d " 404 tuner_warn("i2c i/o error: rc == %d "
406 "(should be 2)\n", rc); 405 "(should be 2)\n", rc);
407 rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[2], 2); 406 rc = tuner_i2c_xfer_send(&i2c, &buffer[2], 2);
408 if (2 != rc) 407 if (2 != rc)
409 tuner_warn("i2c i/o error: rc == %d " 408 tuner_warn("i2c i/o error: rc == %d "
410 "(should be 2)\n", rc); 409 "(should be 2)\n", rc);
411 priv->i2c_props.addr = tuneraddr;
412 break; 410 break;
413 } 411 }
414 } 412 }
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig
index 40ebde53b3ce..b0198691892a 100644
--- a/drivers/media/dvb/Kconfig
+++ b/drivers/media/dvb/Kconfig
@@ -51,6 +51,10 @@ comment "Supported SDMC DM1105 Adapters"
51 depends on DVB_CORE && PCI && I2C 51 depends on DVB_CORE && PCI && I2C
52source "drivers/media/dvb/dm1105/Kconfig" 52source "drivers/media/dvb/dm1105/Kconfig"
53 53
54comment "Supported FireWire (IEEE 1394) Adapters"
55 depends on DVB_CORE && IEEE1394
56source "drivers/media/dvb/firewire/Kconfig"
57
54comment "Supported DVB Frontends" 58comment "Supported DVB Frontends"
55 depends on DVB_CORE 59 depends on DVB_CORE
56source "drivers/media/dvb/frontends/Kconfig" 60source "drivers/media/dvb/frontends/Kconfig"
diff --git a/drivers/media/dvb/Makefile b/drivers/media/dvb/Makefile
index f91e9eb15e52..6092a5bb5a7d 100644
--- a/drivers/media/dvb/Makefile
+++ b/drivers/media/dvb/Makefile
@@ -3,3 +3,5 @@
3# 3#
4 4
5obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/ 5obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/
6
7obj-$(CONFIG_DVB_FIREDTV) += firewire/
diff --git a/drivers/media/dvb/b2c2/flexcop-hw-filter.c b/drivers/media/dvb/b2c2/flexcop-hw-filter.c
index b386cc66c6b3..451974ba32f3 100644
--- a/drivers/media/dvb/b2c2/flexcop-hw-filter.c
+++ b/drivers/media/dvb/b2c2/flexcop-hw-filter.c
@@ -192,6 +192,7 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d
192 192
193 return 0; 193 return 0;
194} 194}
195EXPORT_SYMBOL(flexcop_pid_feed_control);
195 196
196void flexcop_hw_filter_init(struct flexcop_device *fc) 197void flexcop_hw_filter_init(struct flexcop_device *fc)
197{ 198{
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
index 5b30dfc7846b..76e37fd96bb6 100644
--- a/drivers/media/dvb/b2c2/flexcop-pci.c
+++ b/drivers/media/dvb/b2c2/flexcop-pci.c
@@ -13,9 +13,9 @@ static int enable_pid_filtering = 1;
13module_param(enable_pid_filtering, int, 0444); 13module_param(enable_pid_filtering, int, 0444);
14MODULE_PARM_DESC(enable_pid_filtering, "enable hardware pid filtering: supported values: 0 (fullts), 1"); 14MODULE_PARM_DESC(enable_pid_filtering, "enable hardware pid filtering: supported values: 0 (fullts), 1");
15 15
16static int irq_chk_intv; 16static int irq_chk_intv = 100;
17module_param(irq_chk_intv, int, 0644); 17module_param(irq_chk_intv, int, 0644);
18MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently just debugging)."); 18MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ streaming watchdog.");
19 19
20#ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG 20#ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG
21#define dprintk(level,args...) \ 21#define dprintk(level,args...) \
@@ -34,7 +34,9 @@ MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently jus
34 34
35static int debug; 35static int debug;
36module_param(debug, int, 0644); 36module_param(debug, int, 0644);
37MODULE_PARM_DESC(debug, "set debug level (1=info,2=regs,4=TS,8=irqdma (|-able))." DEBSTATUS); 37MODULE_PARM_DESC(debug,
38 "set debug level (1=info,2=regs,4=TS,8=irqdma,16=check (|-able))."
39 DEBSTATUS);
38 40
39#define DRIVER_VERSION "0.1" 41#define DRIVER_VERSION "0.1"
40#define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver" 42#define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver"
@@ -58,6 +60,8 @@ struct flexcop_pci {
58 int active_dma1_addr; /* 0 = addr0 of dma1; 1 = addr1 of dma1 */ 60 int active_dma1_addr; /* 0 = addr0 of dma1; 1 = addr1 of dma1 */
59 u32 last_dma1_cur_pos; /* position of the pointer last time the timer/packet irq occured */ 61 u32 last_dma1_cur_pos; /* position of the pointer last time the timer/packet irq occured */
60 int count; 62 int count;
63 int count_prev;
64 int stream_problem;
61 65
62 spinlock_t irq_lock; 66 spinlock_t irq_lock;
63 67
@@ -103,18 +107,32 @@ static void flexcop_pci_irq_check_work(struct work_struct *work)
103 container_of(work, struct flexcop_pci, irq_check_work.work); 107 container_of(work, struct flexcop_pci, irq_check_work.work);
104 struct flexcop_device *fc = fc_pci->fc_dev; 108 struct flexcop_device *fc = fc_pci->fc_dev;
105 109
106 flexcop_ibi_value v = fc->read_ibi_reg(fc,sram_dest_reg_714); 110 if (fc->feedcount) {
107 111
108 flexcop_dump_reg(fc_pci->fc_dev,dma1_000,4); 112 if (fc_pci->count == fc_pci->count_prev) {
109 113 deb_chk("no IRQ since the last check\n");
110 if (v.sram_dest_reg_714.net_ovflow_error) 114 if (fc_pci->stream_problem++ == 3) {
111 deb_chk("sram net_ovflow_error\n"); 115 struct dvb_demux_feed *feed;
112 if (v.sram_dest_reg_714.media_ovflow_error) 116
113 deb_chk("sram media_ovflow_error\n"); 117 spin_lock_irq(&fc->demux.lock);
114 if (v.sram_dest_reg_714.cai_ovflow_error) 118 list_for_each_entry(feed, &fc->demux.feed_list,
115 deb_chk("sram cai_ovflow_error\n"); 119 list_head) {
116 if (v.sram_dest_reg_714.cai_ovflow_error) 120 flexcop_pid_feed_control(fc, feed, 0);
117 deb_chk("sram cai_ovflow_error\n"); 121 }
122
123 list_for_each_entry(feed, &fc->demux.feed_list,
124 list_head) {
125 flexcop_pid_feed_control(fc, feed, 1);
126 }
127 spin_unlock_irq(&fc->demux.lock);
128
129 fc_pci->stream_problem = 0;
130 }
131 } else {
132 fc_pci->stream_problem = 0;
133 fc_pci->count_prev = fc_pci->count;
134 }
135 }
118 136
119 schedule_delayed_work(&fc_pci->irq_check_work, 137 schedule_delayed_work(&fc_pci->irq_check_work,
120 msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv)); 138 msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv));
@@ -216,16 +234,12 @@ static int flexcop_pci_stream_control(struct flexcop_device *fc, int onoff)
216 flexcop_dma_control_timer_irq(fc,FC_DMA_1,1); 234 flexcop_dma_control_timer_irq(fc,FC_DMA_1,1);
217 deb_irq("IRQ enabled\n"); 235 deb_irq("IRQ enabled\n");
218 236
237 fc_pci->count_prev = fc_pci->count;
238
219// fc_pci->active_dma1_addr = 0; 239// fc_pci->active_dma1_addr = 0;
220// flexcop_dma_control_size_irq(fc,FC_DMA_1,1); 240// flexcop_dma_control_size_irq(fc,FC_DMA_1,1);
221 241
222 if (irq_chk_intv > 0)
223 schedule_delayed_work(&fc_pci->irq_check_work,
224 msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv));
225 } else { 242 } else {
226 if (irq_chk_intv > 0)
227 cancel_delayed_work(&fc_pci->irq_check_work);
228
229 flexcop_dma_control_timer_irq(fc,FC_DMA_1,0); 243 flexcop_dma_control_timer_irq(fc,FC_DMA_1,0);
230 deb_irq("IRQ disabled\n"); 244 deb_irq("IRQ disabled\n");
231 245
@@ -299,8 +313,6 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci)
299 IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0) 313 IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0)
300 goto err_pci_iounmap; 314 goto err_pci_iounmap;
301 315
302
303
304 fc_pci->init_state |= FC_PCI_INIT; 316 fc_pci->init_state |= FC_PCI_INIT;
305 return ret; 317 return ret;
306 318
@@ -375,6 +387,10 @@ static int flexcop_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
375 387
376 INIT_DELAYED_WORK(&fc_pci->irq_check_work, flexcop_pci_irq_check_work); 388 INIT_DELAYED_WORK(&fc_pci->irq_check_work, flexcop_pci_irq_check_work);
377 389
390 if (irq_chk_intv > 0)
391 schedule_delayed_work(&fc_pci->irq_check_work,
392 msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv));
393
378 return ret; 394 return ret;
379 395
380err_fc_exit: 396err_fc_exit:
@@ -393,6 +409,9 @@ static void flexcop_pci_remove(struct pci_dev *pdev)
393{ 409{
394 struct flexcop_pci *fc_pci = pci_get_drvdata(pdev); 410 struct flexcop_pci *fc_pci = pci_get_drvdata(pdev);
395 411
412 if (irq_chk_intv > 0)
413 cancel_delayed_work(&fc_pci->irq_check_work);
414
396 flexcop_pci_dma_exit(fc_pci); 415 flexcop_pci_dma_exit(fc_pci);
397 flexcop_device_exit(fc_pci->fc_dev); 416 flexcop_device_exit(fc_pci->fc_dev);
398 flexcop_pci_exit(fc_pci); 417 flexcop_pci_exit(fc_pci);
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c
index 676413a915b4..91068952b502 100644
--- a/drivers/media/dvb/b2c2/flexcop.c
+++ b/drivers/media/dvb/b2c2/flexcop.c
@@ -212,8 +212,7 @@ void flexcop_reset_block_300(struct flexcop_device *fc)
212 v210.sw_reset_210.Block_reset_enable = 0xb2; 212 v210.sw_reset_210.Block_reset_enable = 0xb2;
213 213
214 fc->write_ibi_reg(fc,sw_reset_210,v210); 214 fc->write_ibi_reg(fc,sw_reset_210,v210);
215 msleep(1); 215 udelay(1000);
216
217 fc->write_ibi_reg(fc,ctrl_208,v208_save); 216 fc->write_ibi_reg(fc,ctrl_208,v208_save);
218} 217}
219 218
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 29e8f1546ab6..fec1d77fa855 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -1683,7 +1683,7 @@ static int dst_tune_frontend(struct dvb_frontend* fe,
1683 1683
1684static int dst_get_tuning_algo(struct dvb_frontend *fe) 1684static int dst_get_tuning_algo(struct dvb_frontend *fe)
1685{ 1685{
1686 return dst_algo; 1686 return dst_algo ? DVBFE_ALGO_HW : DVBFE_ALGO_SW;
1687} 1687}
1688 1688
1689static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) 1689static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 0c733c66a441..069d847ba887 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -364,16 +364,15 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
364 enum dmx_success success) 364 enum dmx_success success)
365{ 365{
366 struct dmxdev_filter *dmxdevfilter = filter->priv; 366 struct dmxdev_filter *dmxdevfilter = filter->priv;
367 unsigned long flags;
368 int ret; 367 int ret;
369 368
370 if (dmxdevfilter->buffer.error) { 369 if (dmxdevfilter->buffer.error) {
371 wake_up(&dmxdevfilter->buffer.queue); 370 wake_up(&dmxdevfilter->buffer.queue);
372 return 0; 371 return 0;
373 } 372 }
374 spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); 373 spin_lock(&dmxdevfilter->dev->lock);
375 if (dmxdevfilter->state != DMXDEV_STATE_GO) { 374 if (dmxdevfilter->state != DMXDEV_STATE_GO) {
376 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 375 spin_unlock(&dmxdevfilter->dev->lock);
377 return 0; 376 return 0;
378 } 377 }
379 del_timer(&dmxdevfilter->timer); 378 del_timer(&dmxdevfilter->timer);
@@ -392,7 +391,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
392 } 391 }
393 if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) 392 if (dmxdevfilter->params.sec.flags & DMX_ONESHOT)
394 dmxdevfilter->state = DMXDEV_STATE_DONE; 393 dmxdevfilter->state = DMXDEV_STATE_DONE;
395 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 394 spin_unlock(&dmxdevfilter->dev->lock);
396 wake_up(&dmxdevfilter->buffer.queue); 395 wake_up(&dmxdevfilter->buffer.queue);
397 return 0; 396 return 0;
398} 397}
@@ -404,12 +403,11 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
404{ 403{
405 struct dmxdev_filter *dmxdevfilter = feed->priv; 404 struct dmxdev_filter *dmxdevfilter = feed->priv;
406 struct dvb_ringbuffer *buffer; 405 struct dvb_ringbuffer *buffer;
407 unsigned long flags;
408 int ret; 406 int ret;
409 407
410 spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); 408 spin_lock(&dmxdevfilter->dev->lock);
411 if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { 409 if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) {
412 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 410 spin_unlock(&dmxdevfilter->dev->lock);
413 return 0; 411 return 0;
414 } 412 }
415 413
@@ -419,7 +417,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
419 else 417 else
420 buffer = &dmxdevfilter->dev->dvr_buffer; 418 buffer = &dmxdevfilter->dev->dvr_buffer;
421 if (buffer->error) { 419 if (buffer->error) {
422 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 420 spin_unlock(&dmxdevfilter->dev->lock);
423 wake_up(&buffer->queue); 421 wake_up(&buffer->queue);
424 return 0; 422 return 0;
425 } 423 }
@@ -430,7 +428,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
430 dvb_ringbuffer_flush(buffer); 428 dvb_ringbuffer_flush(buffer);
431 buffer->error = ret; 429 buffer->error = ret;
432 } 430 }
433 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); 431 spin_unlock(&dmxdevfilter->dev->lock);
434 wake_up(&buffer->queue); 432 wake_up(&buffer->queue);
435 return 0; 433 return 0;
436} 434}
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c
index a2c1fd5d2f67..e2eca0b1fe7c 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -399,9 +399,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
399void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, 399void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
400 size_t count) 400 size_t count)
401{ 401{
402 unsigned long flags; 402 spin_lock(&demux->lock);
403
404 spin_lock_irqsave(&demux->lock, flags);
405 403
406 while (count--) { 404 while (count--) {
407 if (buf[0] == 0x47) 405 if (buf[0] == 0x47)
@@ -409,17 +407,16 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
409 buf += 188; 407 buf += 188;
410 } 408 }
411 409
412 spin_unlock_irqrestore(&demux->lock, flags); 410 spin_unlock(&demux->lock);
413} 411}
414 412
415EXPORT_SYMBOL(dvb_dmx_swfilter_packets); 413EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
416 414
417void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) 415void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
418{ 416{
419 unsigned long flags;
420 int p = 0, i, j; 417 int p = 0, i, j;
421 418
422 spin_lock_irqsave(&demux->lock, flags); 419 spin_lock(&demux->lock);
423 420
424 if (demux->tsbufp) { 421 if (demux->tsbufp) {
425 i = demux->tsbufp; 422 i = demux->tsbufp;
@@ -452,18 +449,17 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
452 } 449 }
453 450
454bailout: 451bailout:
455 spin_unlock_irqrestore(&demux->lock, flags); 452 spin_unlock(&demux->lock);
456} 453}
457 454
458EXPORT_SYMBOL(dvb_dmx_swfilter); 455EXPORT_SYMBOL(dvb_dmx_swfilter);
459 456
460void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) 457void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
461{ 458{
462 unsigned long flags;
463 int p = 0, i, j; 459 int p = 0, i, j;
464 u8 tmppack[188]; 460 u8 tmppack[188];
465 461
466 spin_lock_irqsave(&demux->lock, flags); 462 spin_lock(&demux->lock);
467 463
468 if (demux->tsbufp) { 464 if (demux->tsbufp) {
469 i = demux->tsbufp; 465 i = demux->tsbufp;
@@ -504,7 +500,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
504 } 500 }
505 501
506bailout: 502bailout:
507 spin_unlock_irqrestore(&demux->lock, flags); 503 spin_unlock(&demux->lock);
508} 504}
509 505
510EXPORT_SYMBOL(dvb_dmx_swfilter_204); 506EXPORT_SYMBOL(dvb_dmx_swfilter_204);
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 843407785083..8dcb3fbf7acd 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1290,9 +1290,6 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1290 dprintk("%s() Finalised property cache\n", __func__); 1290 dprintk("%s() Finalised property cache\n", __func__);
1291 dtv_property_cache_submit(fe); 1291 dtv_property_cache_submit(fe);
1292 1292
1293 /* Request the search algorithm to search */
1294 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;
1295
1296 r |= dvb_frontend_ioctl_legacy(inode, file, FE_SET_FRONTEND, 1293 r |= dvb_frontend_ioctl_legacy(inode, file, FE_SET_FRONTEND,
1297 &fepriv->parameters); 1294 &fepriv->parameters);
1298 break; 1295 break;
@@ -1717,6 +1714,10 @@ static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file,
1717 fepriv->min_delay = (dvb_override_tune_delay * HZ) / 1000; 1714 fepriv->min_delay = (dvb_override_tune_delay * HZ) / 1000;
1718 1715
1719 fepriv->state = FESTATE_RETUNE; 1716 fepriv->state = FESTATE_RETUNE;
1717
1718 /* Request the search algorithm to search */
1719 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;
1720
1720 dvb_frontend_wakeup(fe); 1721 dvb_frontend_wakeup(fe);
1721 dvb_frontend_add_event(fe, 0); 1722 dvb_frontend_add_event(fe, 0);
1722 fepriv->status = 0; 1723 fepriv->status = 0;
diff --git a/drivers/media/dvb/firewire/Kconfig b/drivers/media/dvb/firewire/Kconfig
new file mode 100644
index 000000000000..69028253e984
--- /dev/null
+++ b/drivers/media/dvb/firewire/Kconfig
@@ -0,0 +1,22 @@
1config DVB_FIREDTV
2 tristate "FireDTV and FloppyDTV"
3 depends on DVB_CORE && IEEE1394
4 help
5 Support for DVB receivers from Digital Everywhere
6 which are connected via IEEE 1394 (FireWire).
7
8 These devices don't have an MPEG decoder built in,
9 so you need an external software decoder to watch TV.
10
11 To compile this driver as a module, say M here:
12 the module will be called firedtv.
13
14if DVB_FIREDTV
15
16config DVB_FIREDTV_IEEE1394
17 def_bool IEEE1394
18
19config DVB_FIREDTV_INPUT
20 def_bool INPUT = y || (INPUT = m && DVB_FIREDTV = m)
21
22endif # DVB_FIREDTV
diff --git a/drivers/media/dvb/firewire/Makefile b/drivers/media/dvb/firewire/Makefile
new file mode 100644
index 000000000000..2034695ba194
--- /dev/null
+++ b/drivers/media/dvb/firewire/Makefile
@@ -0,0 +1,8 @@
1obj-$(CONFIG_DVB_FIREDTV) += firedtv.o
2
3firedtv-y := firedtv-avc.o firedtv-ci.o firedtv-dvb.o firedtv-fe.o
4firedtv-$(CONFIG_DVB_FIREDTV_IEEE1394) += firedtv-1394.o
5firedtv-$(CONFIG_DVB_FIREDTV_INPUT) += firedtv-rc.o
6
7ccflags-y += -Idrivers/media/dvb/dvb-core
8ccflags-$(CONFIG_DVB_FIREDTV_IEEE1394) += -Idrivers/ieee1394
diff --git a/drivers/media/dvb/firewire/firedtv-1394.c b/drivers/media/dvb/firewire/firedtv-1394.c
new file mode 100644
index 000000000000..4e207658c5d9
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-1394.c
@@ -0,0 +1,285 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2007-2008 Ben Backx <ben@bbackx.com>
6 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 */
13
14#include <linux/device.h>
15#include <linux/errno.h>
16#include <linux/kernel.h>
17#include <linux/list.h>
18#include <linux/spinlock.h>
19#include <linux/types.h>
20
21#include <dma.h>
22#include <csr1212.h>
23#include <highlevel.h>
24#include <hosts.h>
25#include <ieee1394.h>
26#include <iso.h>
27#include <nodemgr.h>
28
29#include "firedtv.h"
30
31static LIST_HEAD(node_list);
32static DEFINE_SPINLOCK(node_list_lock);
33
34#define FIREWIRE_HEADER_SIZE 4
35#define CIP_HEADER_SIZE 8
36
37static void rawiso_activity_cb(struct hpsb_iso *iso)
38{
39 struct firedtv *f, *fdtv = NULL;
40 unsigned int i, num, packet;
41 unsigned char *buf;
42 unsigned long flags;
43 int count;
44
45 spin_lock_irqsave(&node_list_lock, flags);
46 list_for_each_entry(f, &node_list, list)
47 if (f->backend_data == iso) {
48 fdtv = f;
49 break;
50 }
51 spin_unlock_irqrestore(&node_list_lock, flags);
52
53 packet = iso->first_packet;
54 num = hpsb_iso_n_ready(iso);
55
56 if (!fdtv) {
57 dev_err(fdtv->device, "received at unknown iso channel\n");
58 goto out;
59 }
60
61 for (i = 0; i < num; i++, packet = (packet + 1) % iso->buf_packets) {
62 buf = dma_region_i(&iso->data_buf, unsigned char,
63 iso->infos[packet].offset + CIP_HEADER_SIZE);
64 count = (iso->infos[packet].len - CIP_HEADER_SIZE) /
65 (188 + FIREWIRE_HEADER_SIZE);
66
67 /* ignore empty packet */
68 if (iso->infos[packet].len <= CIP_HEADER_SIZE)
69 continue;
70
71 while (count--) {
72 if (buf[FIREWIRE_HEADER_SIZE] == 0x47)
73 dvb_dmx_swfilter_packets(&fdtv->demux,
74 &buf[FIREWIRE_HEADER_SIZE], 1);
75 else
76 dev_err(fdtv->device,
77 "skipping invalid packet\n");
78 buf += 188 + FIREWIRE_HEADER_SIZE;
79 }
80 }
81out:
82 hpsb_iso_recv_release_packets(iso, num);
83}
84
85static inline struct node_entry *node_of(struct firedtv *fdtv)
86{
87 return container_of(fdtv->device, struct unit_directory, device)->ne;
88}
89
90static int node_lock(struct firedtv *fdtv, u64 addr, void *data, __be32 arg)
91{
92 return hpsb_node_lock(node_of(fdtv), addr, EXTCODE_COMPARE_SWAP, data,
93 (__force quadlet_t)arg);
94}
95
96static int node_read(struct firedtv *fdtv, u64 addr, void *data, size_t len)
97{
98 return hpsb_node_read(node_of(fdtv), addr, data, len);
99}
100
101static int node_write(struct firedtv *fdtv, u64 addr, void *data, size_t len)
102{
103 return hpsb_node_write(node_of(fdtv), addr, data, len);
104}
105
106#define FDTV_ISO_BUFFER_PACKETS 256
107#define FDTV_ISO_BUFFER_SIZE (FDTV_ISO_BUFFER_PACKETS * 200)
108
109static int start_iso(struct firedtv *fdtv)
110{
111 struct hpsb_iso *iso_handle;
112 int ret;
113
114 iso_handle = hpsb_iso_recv_init(node_of(fdtv)->host,
115 FDTV_ISO_BUFFER_SIZE, FDTV_ISO_BUFFER_PACKETS,
116 fdtv->isochannel, HPSB_ISO_DMA_DEFAULT,
117 -1, /* stat.config.irq_interval */
118 rawiso_activity_cb);
119 if (iso_handle == NULL) {
120 dev_err(fdtv->device, "cannot initialize iso receive\n");
121 return -ENOMEM;
122 }
123 fdtv->backend_data = iso_handle;
124
125 ret = hpsb_iso_recv_start(iso_handle, -1, -1, 0);
126 if (ret != 0) {
127 dev_err(fdtv->device, "cannot start iso receive\n");
128 hpsb_iso_shutdown(iso_handle);
129 fdtv->backend_data = NULL;
130 }
131 return ret;
132}
133
134static void stop_iso(struct firedtv *fdtv)
135{
136 struct hpsb_iso *iso_handle = fdtv->backend_data;
137
138 if (iso_handle != NULL) {
139 hpsb_iso_stop(iso_handle);
140 hpsb_iso_shutdown(iso_handle);
141 }
142 fdtv->backend_data = NULL;
143}
144
145static const struct firedtv_backend fdtv_1394_backend = {
146 .lock = node_lock,
147 .read = node_read,
148 .write = node_write,
149 .start_iso = start_iso,
150 .stop_iso = stop_iso,
151};
152
153static void fcp_request(struct hpsb_host *host, int nodeid, int direction,
154 int cts, u8 *data, size_t length)
155{
156 struct firedtv *f, *fdtv = NULL;
157 unsigned long flags;
158 int su;
159
160 if (length == 0 || (data[0] & 0xf0) != 0)
161 return;
162
163 su = data[1] & 0x7;
164
165 spin_lock_irqsave(&node_list_lock, flags);
166 list_for_each_entry(f, &node_list, list)
167 if (node_of(f)->host == host &&
168 node_of(f)->nodeid == nodeid &&
169 (f->subunit == su || (f->subunit == 0 && su == 0x7))) {
170 fdtv = f;
171 break;
172 }
173 spin_unlock_irqrestore(&node_list_lock, flags);
174
175 if (fdtv)
176 avc_recv(fdtv, data, length);
177}
178
179static int node_probe(struct device *dev)
180{
181 struct unit_directory *ud =
182 container_of(dev, struct unit_directory, device);
183 struct firedtv *fdtv;
184 int kv_len, err;
185 void *kv_str;
186
187 kv_len = (ud->model_name_kv->value.leaf.len - 2) * sizeof(quadlet_t);
188 kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv);
189
190 fdtv = fdtv_alloc(dev, &fdtv_1394_backend, kv_str, kv_len);
191 if (!fdtv)
192 return -ENOMEM;
193
194 /*
195 * Work around a bug in udev's path_id script: Use the fw-host's dev
196 * instead of the unit directory's dev as parent of the input device.
197 */
198 err = fdtv_register_rc(fdtv, dev->parent->parent);
199 if (err)
200 goto fail_free;
201
202 spin_lock_irq(&node_list_lock);
203 list_add_tail(&fdtv->list, &node_list);
204 spin_unlock_irq(&node_list_lock);
205
206 err = avc_identify_subunit(fdtv);
207 if (err)
208 goto fail;
209
210 err = fdtv_dvb_register(fdtv);
211 if (err)
212 goto fail;
213
214 avc_register_remote_control(fdtv);
215 return 0;
216fail:
217 spin_lock_irq(&node_list_lock);
218 list_del(&fdtv->list);
219 spin_unlock_irq(&node_list_lock);
220 fdtv_unregister_rc(fdtv);
221fail_free:
222 kfree(fdtv);
223 return err;
224}
225
226static int node_remove(struct device *dev)
227{
228 struct firedtv *fdtv = dev->driver_data;
229
230 fdtv_dvb_unregister(fdtv);
231
232 spin_lock_irq(&node_list_lock);
233 list_del(&fdtv->list);
234 spin_unlock_irq(&node_list_lock);
235
236 cancel_work_sync(&fdtv->remote_ctrl_work);
237 fdtv_unregister_rc(fdtv);
238
239 kfree(fdtv);
240 return 0;
241}
242
243static int node_update(struct unit_directory *ud)
244{
245 struct firedtv *fdtv = ud->device.driver_data;
246
247 if (fdtv->isochannel >= 0)
248 cmp_establish_pp_connection(fdtv, fdtv->subunit,
249 fdtv->isochannel);
250 return 0;
251}
252
253static struct hpsb_protocol_driver fdtv_driver = {
254 .name = "firedtv",
255 .update = node_update,
256 .driver = {
257 .probe = node_probe,
258 .remove = node_remove,
259 },
260};
261
262static struct hpsb_highlevel fdtv_highlevel = {
263 .name = "firedtv",
264 .fcp_request = fcp_request,
265};
266
267int __init fdtv_1394_init(struct ieee1394_device_id id_table[])
268{
269 int ret;
270
271 hpsb_register_highlevel(&fdtv_highlevel);
272 fdtv_driver.id_table = id_table;
273 ret = hpsb_register_protocol(&fdtv_driver);
274 if (ret) {
275 printk(KERN_ERR "firedtv: failed to register protocol\n");
276 hpsb_unregister_highlevel(&fdtv_highlevel);
277 }
278 return ret;
279}
280
281void __exit fdtv_1394_exit(void)
282{
283 hpsb_unregister_protocol(&fdtv_driver);
284 hpsb_unregister_highlevel(&fdtv_highlevel);
285}
diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c
new file mode 100644
index 000000000000..b55d9ccaf33e
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-avc.c
@@ -0,0 +1,1315 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Ben Backx <ben@bbackx.com>
6 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 */
13
14#include <linux/bug.h>
15#include <linux/crc32.h>
16#include <linux/delay.h>
17#include <linux/device.h>
18#include <linux/jiffies.h>
19#include <linux/kernel.h>
20#include <linux/moduleparam.h>
21#include <linux/mutex.h>
22#include <linux/string.h>
23#include <linux/stringify.h>
24#include <linux/wait.h>
25#include <linux/workqueue.h>
26
27#include "firedtv.h"
28
29#define FCP_COMMAND_REGISTER 0xfffff0000b00ULL
30
31#define AVC_CTYPE_CONTROL 0x0
32#define AVC_CTYPE_STATUS 0x1
33#define AVC_CTYPE_NOTIFY 0x3
34
35#define AVC_RESPONSE_ACCEPTED 0x9
36#define AVC_RESPONSE_STABLE 0xc
37#define AVC_RESPONSE_CHANGED 0xd
38#define AVC_RESPONSE_INTERIM 0xf
39
40#define AVC_SUBUNIT_TYPE_TUNER (0x05 << 3)
41#define AVC_SUBUNIT_TYPE_UNIT (0x1f << 3)
42
43#define AVC_OPCODE_VENDOR 0x00
44#define AVC_OPCODE_READ_DESCRIPTOR 0x09
45#define AVC_OPCODE_DSIT 0xc8
46#define AVC_OPCODE_DSD 0xcb
47
48#define DESCRIPTOR_TUNER_STATUS 0x80
49#define DESCRIPTOR_SUBUNIT_IDENTIFIER 0x00
50
51#define SFE_VENDOR_DE_COMPANYID_0 0x00 /* OUI of Digital Everywhere */
52#define SFE_VENDOR_DE_COMPANYID_1 0x12
53#define SFE_VENDOR_DE_COMPANYID_2 0x87
54
55#define SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL 0x0a
56#define SFE_VENDOR_OPCODE_LNB_CONTROL 0x52
57#define SFE_VENDOR_OPCODE_TUNE_QPSK 0x58 /* for DVB-S */
58
59#define SFE_VENDOR_OPCODE_GET_FIRMWARE_VERSION 0x00
60#define SFE_VENDOR_OPCODE_HOST2CA 0x56
61#define SFE_VENDOR_OPCODE_CA2HOST 0x57
62#define SFE_VENDOR_OPCODE_CISTATUS 0x59
63#define SFE_VENDOR_OPCODE_TUNE_QPSK2 0x60 /* for DVB-S2 */
64
65#define SFE_VENDOR_TAG_CA_RESET 0x00
66#define SFE_VENDOR_TAG_CA_APPLICATION_INFO 0x01
67#define SFE_VENDOR_TAG_CA_PMT 0x02
68#define SFE_VENDOR_TAG_CA_DATE_TIME 0x04
69#define SFE_VENDOR_TAG_CA_MMI 0x05
70#define SFE_VENDOR_TAG_CA_ENTER_MENU 0x07
71
72#define EN50221_LIST_MANAGEMENT_ONLY 0x03
73#define EN50221_TAG_APP_INFO 0x9f8021
74#define EN50221_TAG_CA_INFO 0x9f8031
75
76struct avc_command_frame {
77 int length;
78 u8 ctype;
79 u8 subunit;
80 u8 opcode;
81 u8 operand[509];
82};
83
84struct avc_response_frame {
85 int length;
86 u8 response;
87 u8 subunit;
88 u8 opcode;
89 u8 operand[509];
90};
91
92#define AVC_DEBUG_FCP_SUBACTIONS 1
93#define AVC_DEBUG_FCP_PAYLOADS 2
94
95static int avc_debug;
96module_param_named(debug, avc_debug, int, 0644);
97MODULE_PARM_DESC(debug, "Verbose logging (default = 0"
98 ", FCP subactions = " __stringify(AVC_DEBUG_FCP_SUBACTIONS)
99 ", FCP payloads = " __stringify(AVC_DEBUG_FCP_PAYLOADS)
100 ", or all = -1)");
101
102static const char *debug_fcp_ctype(unsigned int ctype)
103{
104 static const char *ctypes[] = {
105 [0x0] = "CONTROL", [0x1] = "STATUS",
106 [0x2] = "SPECIFIC INQUIRY", [0x3] = "NOTIFY",
107 [0x4] = "GENERAL INQUIRY", [0x8] = "NOT IMPLEMENTED",
108 [0x9] = "ACCEPTED", [0xa] = "REJECTED",
109 [0xb] = "IN TRANSITION", [0xc] = "IMPLEMENTED/STABLE",
110 [0xd] = "CHANGED", [0xf] = "INTERIM",
111 };
112 const char *ret = ctype < ARRAY_SIZE(ctypes) ? ctypes[ctype] : NULL;
113
114 return ret ? ret : "?";
115}
116
117static const char *debug_fcp_opcode(unsigned int opcode,
118 const u8 *data, size_t length)
119{
120 switch (opcode) {
121 case AVC_OPCODE_VENDOR: break;
122 case AVC_OPCODE_READ_DESCRIPTOR: return "ReadDescriptor";
123 case AVC_OPCODE_DSIT: return "DirectSelectInfo.Type";
124 case AVC_OPCODE_DSD: return "DirectSelectData";
125 default: return "?";
126 }
127
128 if (length < 7 ||
129 data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
130 data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
131 data[5] != SFE_VENDOR_DE_COMPANYID_2)
132 return "Vendor";
133
134 switch (data[6]) {
135 case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return "RegisterRC";
136 case SFE_VENDOR_OPCODE_LNB_CONTROL: return "LNBControl";
137 case SFE_VENDOR_OPCODE_TUNE_QPSK: return "TuneQPSK";
138 case SFE_VENDOR_OPCODE_HOST2CA: return "Host2CA";
139 case SFE_VENDOR_OPCODE_CA2HOST: return "CA2Host";
140 }
141 return "Vendor";
142}
143
144static void debug_fcp(const u8 *data, size_t length)
145{
146 unsigned int subunit_type, subunit_id, op;
147 const char *prefix = data[0] > 7 ? "FCP <- " : "FCP -> ";
148
149 if (avc_debug & AVC_DEBUG_FCP_SUBACTIONS) {
150 subunit_type = data[1] >> 3;
151 subunit_id = data[1] & 7;
152 op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2];
153 printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n",
154 prefix, subunit_type, subunit_id, length,
155 debug_fcp_ctype(data[0]),
156 debug_fcp_opcode(op, data, length));
157 }
158
159 if (avc_debug & AVC_DEBUG_FCP_PAYLOADS)
160 print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE, 16, 1,
161 data, length, false);
162}
163
164static int __avc_write(struct firedtv *fdtv,
165 const struct avc_command_frame *c, struct avc_response_frame *r)
166{
167 int err, retry;
168
169 if (r)
170 fdtv->avc_reply_received = false;
171
172 for (retry = 0; retry < 6; retry++) {
173 if (unlikely(avc_debug))
174 debug_fcp(&c->ctype, c->length);
175
176 err = fdtv->backend->write(fdtv, FCP_COMMAND_REGISTER,
177 (void *)&c->ctype, c->length);
178 if (err) {
179 fdtv->avc_reply_received = true;
180 dev_err(fdtv->device, "FCP command write failed\n");
181 return err;
182 }
183
184 if (!r)
185 return 0;
186
187 /*
188 * AV/C specs say that answers should be sent within 150 ms.
189 * Time out after 200 ms.
190 */
191 if (wait_event_timeout(fdtv->avc_wait,
192 fdtv->avc_reply_received,
193 msecs_to_jiffies(200)) != 0) {
194 r->length = fdtv->response_length;
195 memcpy(&r->response, fdtv->response, r->length);
196
197 return 0;
198 }
199 }
200 dev_err(fdtv->device, "FCP response timed out\n");
201 return -ETIMEDOUT;
202}
203
204static int avc_write(struct firedtv *fdtv,
205 const struct avc_command_frame *c, struct avc_response_frame *r)
206{
207 int ret;
208
209 if (mutex_lock_interruptible(&fdtv->avc_mutex))
210 return -EINTR;
211
212 ret = __avc_write(fdtv, c, r);
213
214 mutex_unlock(&fdtv->avc_mutex);
215 return ret;
216}
217
218int avc_recv(struct firedtv *fdtv, void *data, size_t length)
219{
220 struct avc_response_frame *r =
221 data - offsetof(struct avc_response_frame, response);
222
223 if (unlikely(avc_debug))
224 debug_fcp(data, length);
225
226 if (length >= 8 &&
227 r->operand[0] == SFE_VENDOR_DE_COMPANYID_0 &&
228 r->operand[1] == SFE_VENDOR_DE_COMPANYID_1 &&
229 r->operand[2] == SFE_VENDOR_DE_COMPANYID_2 &&
230 r->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL) {
231 if (r->response == AVC_RESPONSE_CHANGED) {
232 fdtv_handle_rc(fdtv,
233 r->operand[4] << 8 | r->operand[5]);
234 schedule_work(&fdtv->remote_ctrl_work);
235 } else if (r->response != AVC_RESPONSE_INTERIM) {
236 dev_info(fdtv->device,
237 "remote control result = %d\n", r->response);
238 }
239 return 0;
240 }
241
242 if (fdtv->avc_reply_received) {
243 dev_err(fdtv->device, "out-of-order AVC response, ignored\n");
244 return -EIO;
245 }
246
247 memcpy(fdtv->response, data, length);
248 fdtv->response_length = length;
249
250 fdtv->avc_reply_received = true;
251 wake_up(&fdtv->avc_wait);
252
253 return 0;
254}
255
256/*
257 * tuning command for setting the relative LNB frequency
258 * (not supported by the AVC standard)
259 */
260static void avc_tuner_tuneqpsk(struct firedtv *fdtv,
261 struct dvb_frontend_parameters *params,
262 struct avc_command_frame *c)
263{
264 c->opcode = AVC_OPCODE_VENDOR;
265
266 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
267 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
268 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
269 c->operand[3] = SFE_VENDOR_OPCODE_TUNE_QPSK;
270
271 c->operand[4] = (params->frequency >> 24) & 0xff;
272 c->operand[5] = (params->frequency >> 16) & 0xff;
273 c->operand[6] = (params->frequency >> 8) & 0xff;
274 c->operand[7] = params->frequency & 0xff;
275
276 c->operand[8] = ((params->u.qpsk.symbol_rate / 1000) >> 8) & 0xff;
277 c->operand[9] = (params->u.qpsk.symbol_rate / 1000) & 0xff;
278
279 switch (params->u.qpsk.fec_inner) {
280 case FEC_1_2: c->operand[10] = 0x1; break;
281 case FEC_2_3: c->operand[10] = 0x2; break;
282 case FEC_3_4: c->operand[10] = 0x3; break;
283 case FEC_5_6: c->operand[10] = 0x4; break;
284 case FEC_7_8: c->operand[10] = 0x5; break;
285 case FEC_4_5:
286 case FEC_8_9:
287 case FEC_AUTO:
288 default: c->operand[10] = 0x0;
289 }
290
291 if (fdtv->voltage == 0xff)
292 c->operand[11] = 0xff;
293 else if (fdtv->voltage == SEC_VOLTAGE_18) /* polarisation */
294 c->operand[11] = 0;
295 else
296 c->operand[11] = 1;
297
298 if (fdtv->tone == 0xff)
299 c->operand[12] = 0xff;
300 else if (fdtv->tone == SEC_TONE_ON) /* band */
301 c->operand[12] = 1;
302 else
303 c->operand[12] = 0;
304
305 if (fdtv->type == FIREDTV_DVB_S2) {
306 c->operand[13] = 0x1;
307 c->operand[14] = 0xff;
308 c->operand[15] = 0xff;
309 c->length = 20;
310 } else {
311 c->length = 16;
312 }
313}
314
315static void avc_tuner_dsd_dvb_c(struct dvb_frontend_parameters *params,
316 struct avc_command_frame *c)
317{
318 c->opcode = AVC_OPCODE_DSD;
319
320 c->operand[0] = 0; /* source plug */
321 c->operand[1] = 0xd2; /* subfunction replace */
322 c->operand[2] = 0x20; /* system id = DVB */
323 c->operand[3] = 0x00; /* antenna number */
324 c->operand[4] = 0x11; /* system_specific_multiplex selection_length */
325
326 /* multiplex_valid_flags, high byte */
327 c->operand[5] = 0 << 7 /* reserved */
328 | 0 << 6 /* Polarisation */
329 | 0 << 5 /* Orbital_Pos */
330 | 1 << 4 /* Frequency */
331 | 1 << 3 /* Symbol_Rate */
332 | 0 << 2 /* FEC_outer */
333 | (params->u.qam.fec_inner != FEC_AUTO ? 1 << 1 : 0)
334 | (params->u.qam.modulation != QAM_AUTO ? 1 << 0 : 0);
335
336 /* multiplex_valid_flags, low byte */
337 c->operand[6] = 0 << 7 /* NetworkID */
338 | 0 << 0 /* reserved */ ;
339
340 c->operand[7] = 0x00;
341 c->operand[8] = 0x00;
342 c->operand[9] = 0x00;
343 c->operand[10] = 0x00;
344
345 c->operand[11] = (((params->frequency / 4000) >> 16) & 0xff) | (2 << 6);
346 c->operand[12] = ((params->frequency / 4000) >> 8) & 0xff;
347 c->operand[13] = (params->frequency / 4000) & 0xff;
348 c->operand[14] = ((params->u.qpsk.symbol_rate / 1000) >> 12) & 0xff;
349 c->operand[15] = ((params->u.qpsk.symbol_rate / 1000) >> 4) & 0xff;
350 c->operand[16] = ((params->u.qpsk.symbol_rate / 1000) << 4) & 0xf0;
351 c->operand[17] = 0x00;
352
353 switch (params->u.qpsk.fec_inner) {
354 case FEC_1_2: c->operand[18] = 0x1; break;
355 case FEC_2_3: c->operand[18] = 0x2; break;
356 case FEC_3_4: c->operand[18] = 0x3; break;
357 case FEC_5_6: c->operand[18] = 0x4; break;
358 case FEC_7_8: c->operand[18] = 0x5; break;
359 case FEC_8_9: c->operand[18] = 0x6; break;
360 case FEC_4_5: c->operand[18] = 0x8; break;
361 case FEC_AUTO:
362 default: c->operand[18] = 0x0;
363 }
364
365 switch (params->u.qam.modulation) {
366 case QAM_16: c->operand[19] = 0x08; break;
367 case QAM_32: c->operand[19] = 0x10; break;
368 case QAM_64: c->operand[19] = 0x18; break;
369 case QAM_128: c->operand[19] = 0x20; break;
370 case QAM_256: c->operand[19] = 0x28; break;
371 case QAM_AUTO:
372 default: c->operand[19] = 0x00;
373 }
374
375 c->operand[20] = 0x00;
376 c->operand[21] = 0x00;
377 /* Nr_of_dsd_sel_specs = 0 -> no PIDs are transmitted */
378 c->operand[22] = 0x00;
379
380 c->length = 28;
381}
382
383static void avc_tuner_dsd_dvb_t(struct dvb_frontend_parameters *params,
384 struct avc_command_frame *c)
385{
386 struct dvb_ofdm_parameters *ofdm = &params->u.ofdm;
387
388 c->opcode = AVC_OPCODE_DSD;
389
390 c->operand[0] = 0; /* source plug */
391 c->operand[1] = 0xd2; /* subfunction replace */
392 c->operand[2] = 0x20; /* system id = DVB */
393 c->operand[3] = 0x00; /* antenna number */
394 c->operand[4] = 0x0c; /* system_specific_multiplex selection_length */
395
396 /* multiplex_valid_flags, high byte */
397 c->operand[5] =
398 0 << 7 /* reserved */
399 | 1 << 6 /* CenterFrequency */
400 | (ofdm->bandwidth != BANDWIDTH_AUTO ? 1 << 5 : 0)
401 | (ofdm->constellation != QAM_AUTO ? 1 << 4 : 0)
402 | (ofdm->hierarchy_information != HIERARCHY_AUTO ? 1 << 3 : 0)
403 | (ofdm->code_rate_HP != FEC_AUTO ? 1 << 2 : 0)
404 | (ofdm->code_rate_LP != FEC_AUTO ? 1 << 1 : 0)
405 | (ofdm->guard_interval != GUARD_INTERVAL_AUTO ? 1 << 0 : 0);
406
407 /* multiplex_valid_flags, low byte */
408 c->operand[6] =
409 0 << 7 /* NetworkID */
410 | (ofdm->transmission_mode != TRANSMISSION_MODE_AUTO ? 1 << 6 : 0)
411 | 0 << 5 /* OtherFrequencyFlag */
412 | 0 << 0 /* reserved */ ;
413
414 c->operand[7] = 0x0;
415 c->operand[8] = (params->frequency / 10) >> 24;
416 c->operand[9] = ((params->frequency / 10) >> 16) & 0xff;
417 c->operand[10] = ((params->frequency / 10) >> 8) & 0xff;
418 c->operand[11] = (params->frequency / 10) & 0xff;
419
420 switch (ofdm->bandwidth) {
421 case BANDWIDTH_7_MHZ: c->operand[12] = 0x20; break;
422 case BANDWIDTH_8_MHZ:
423 case BANDWIDTH_6_MHZ: /* not defined by AVC spec */
424 case BANDWIDTH_AUTO:
425 default: c->operand[12] = 0x00;
426 }
427
428 switch (ofdm->constellation) {
429 case QAM_16: c->operand[13] = 1 << 6; break;
430 case QAM_64: c->operand[13] = 2 << 6; break;
431 case QPSK:
432 default: c->operand[13] = 0x00;
433 }
434
435 switch (ofdm->hierarchy_information) {
436 case HIERARCHY_1: c->operand[13] |= 1 << 3; break;
437 case HIERARCHY_2: c->operand[13] |= 2 << 3; break;
438 case HIERARCHY_4: c->operand[13] |= 3 << 3; break;
439 case HIERARCHY_AUTO:
440 case HIERARCHY_NONE:
441 default: break;
442 }
443
444 switch (ofdm->code_rate_HP) {
445 case FEC_2_3: c->operand[13] |= 1; break;
446 case FEC_3_4: c->operand[13] |= 2; break;
447 case FEC_5_6: c->operand[13] |= 3; break;
448 case FEC_7_8: c->operand[13] |= 4; break;
449 case FEC_1_2:
450 default: break;
451 }
452
453 switch (ofdm->code_rate_LP) {
454 case FEC_2_3: c->operand[14] = 1 << 5; break;
455 case FEC_3_4: c->operand[14] = 2 << 5; break;
456 case FEC_5_6: c->operand[14] = 3 << 5; break;
457 case FEC_7_8: c->operand[14] = 4 << 5; break;
458 case FEC_1_2:
459 default: c->operand[14] = 0x00; break;
460 }
461
462 switch (ofdm->guard_interval) {
463 case GUARD_INTERVAL_1_16: c->operand[14] |= 1 << 3; break;
464 case GUARD_INTERVAL_1_8: c->operand[14] |= 2 << 3; break;
465 case GUARD_INTERVAL_1_4: c->operand[14] |= 3 << 3; break;
466 case GUARD_INTERVAL_1_32:
467 case GUARD_INTERVAL_AUTO:
468 default: break;
469 }
470
471 switch (ofdm->transmission_mode) {
472 case TRANSMISSION_MODE_8K: c->operand[14] |= 1 << 1; break;
473 case TRANSMISSION_MODE_2K:
474 case TRANSMISSION_MODE_AUTO:
475 default: break;
476 }
477
478 c->operand[15] = 0x00; /* network_ID[0] */
479 c->operand[16] = 0x00; /* network_ID[1] */
480 /* Nr_of_dsd_sel_specs = 0 -> no PIDs are transmitted */
481 c->operand[17] = 0x00;
482
483 c->length = 24;
484}
485
486int avc_tuner_dsd(struct firedtv *fdtv,
487 struct dvb_frontend_parameters *params)
488{
489 char buffer[sizeof(struct avc_command_frame)];
490 struct avc_command_frame *c = (void *)buffer;
491 struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
492
493 memset(c, 0, sizeof(*c));
494
495 c->ctype = AVC_CTYPE_CONTROL;
496 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
497
498 switch (fdtv->type) {
499 case FIREDTV_DVB_S:
500 case FIREDTV_DVB_S2: avc_tuner_tuneqpsk(fdtv, params, c); break;
501 case FIREDTV_DVB_C: avc_tuner_dsd_dvb_c(params, c); break;
502 case FIREDTV_DVB_T: avc_tuner_dsd_dvb_t(params, c); break;
503 default:
504 BUG();
505 }
506
507 if (avc_write(fdtv, c, r) < 0)
508 return -EIO;
509
510 msleep(500);
511#if 0
512 /* FIXME: */
513 /* u8 *status was an out-parameter of avc_tuner_dsd, unused by caller */
514 if (status)
515 *status = r->operand[2];
516#endif
517 return 0;
518}
519
520int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
521{
522 char buffer[sizeof(struct avc_command_frame)];
523 struct avc_command_frame *c = (void *)buffer;
524 struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
525 int pos, k;
526
527 if (pidc > 16 && pidc != 0xff)
528 return -EINVAL;
529
530 memset(c, 0, sizeof(*c));
531
532 c->ctype = AVC_CTYPE_CONTROL;
533 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
534 c->opcode = AVC_OPCODE_DSD;
535
536 c->operand[0] = 0; /* source plug */
537 c->operand[1] = 0xd2; /* subfunction replace */
538 c->operand[2] = 0x20; /* system id = DVB */
539 c->operand[3] = 0x00; /* antenna number */
540 c->operand[4] = 0x00; /* system_specific_multiplex selection_length */
541 c->operand[5] = pidc; /* Nr_of_dsd_sel_specs */
542
543 pos = 6;
544 if (pidc != 0xff)
545 for (k = 0; k < pidc; k++) {
546 c->operand[pos++] = 0x13; /* flowfunction relay */
547 c->operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */
548 c->operand[pos++] = (pid[k] >> 8) & 0x1f;
549 c->operand[pos++] = pid[k] & 0xff;
550 c->operand[pos++] = 0x00; /* tableID */
551 c->operand[pos++] = 0x00; /* filter_length */
552 }
553
554 c->length = ALIGN(3 + pos, 4);
555
556 if (avc_write(fdtv, c, r) < 0)
557 return -EIO;
558
559 msleep(50);
560 return 0;
561}
562
563int avc_tuner_get_ts(struct firedtv *fdtv)
564{
565 char buffer[sizeof(struct avc_command_frame)];
566 struct avc_command_frame *c = (void *)buffer;
567 struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
568 int sl;
569
570 memset(c, 0, sizeof(*c));
571
572 c->ctype = AVC_CTYPE_CONTROL;
573 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
574 c->opcode = AVC_OPCODE_DSIT;
575
576 sl = fdtv->type == FIREDTV_DVB_T ? 0x0c : 0x11;
577
578 c->operand[0] = 0; /* source plug */
579 c->operand[1] = 0xd2; /* subfunction replace */
580 c->operand[2] = 0xff; /* status */
581 c->operand[3] = 0x20; /* system id = DVB */
582 c->operand[4] = 0x00; /* antenna number */
583 c->operand[5] = 0x0; /* system_specific_search_flags */
584 c->operand[6] = sl; /* system_specific_multiplex selection_length */
585 c->operand[7] = 0x00; /* valid_flags [0] */
586 c->operand[8] = 0x00; /* valid_flags [1] */
587 c->operand[7 + sl] = 0x00; /* nr_of_dsit_sel_specs (always 0) */
588
589 c->length = fdtv->type == FIREDTV_DVB_T ? 24 : 28;
590
591 if (avc_write(fdtv, c, r) < 0)
592 return -EIO;
593
594 msleep(250);
595 return 0;
596}
597
598int avc_identify_subunit(struct firedtv *fdtv)
599{
600 char buffer[sizeof(struct avc_command_frame)];
601 struct avc_command_frame *c = (void *)buffer;
602 struct avc_response_frame *r = (void *)buffer;
603
604 memset(c, 0, sizeof(*c));
605
606 c->ctype = AVC_CTYPE_CONTROL;
607 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
608 c->opcode = AVC_OPCODE_READ_DESCRIPTOR;
609
610 c->operand[0] = DESCRIPTOR_SUBUNIT_IDENTIFIER;
611 c->operand[1] = 0xff;
612 c->operand[2] = 0x00;
613 c->operand[3] = 0x00; /* length highbyte */
614 c->operand[4] = 0x08; /* length lowbyte */
615 c->operand[5] = 0x00; /* offset highbyte */
616 c->operand[6] = 0x0d; /* offset lowbyte */
617
618 c->length = 12;
619
620 if (avc_write(fdtv, c, r) < 0)
621 return -EIO;
622
623 if ((r->response != AVC_RESPONSE_STABLE &&
624 r->response != AVC_RESPONSE_ACCEPTED) ||
625 (r->operand[3] << 8) + r->operand[4] != 8) {
626 dev_err(fdtv->device, "cannot read subunit identifier\n");
627 return -EINVAL;
628 }
629 return 0;
630}
631
632#define SIZEOF_ANTENNA_INPUT_INFO 22
633
634int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat)
635{
636 char buffer[sizeof(struct avc_command_frame)];
637 struct avc_command_frame *c = (void *)buffer;
638 struct avc_response_frame *r = (void *)buffer;
639 int length;
640
641 memset(c, 0, sizeof(*c));
642
643 c->ctype = AVC_CTYPE_CONTROL;
644 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
645 c->opcode = AVC_OPCODE_READ_DESCRIPTOR;
646
647 c->operand[0] = DESCRIPTOR_TUNER_STATUS;
648 c->operand[1] = 0xff; /* read_result_status */
649 c->operand[2] = 0x00; /* reserved */
650 c->operand[3] = 0; /* SIZEOF_ANTENNA_INPUT_INFO >> 8; */
651 c->operand[4] = 0; /* SIZEOF_ANTENNA_INPUT_INFO & 0xff; */
652 c->operand[5] = 0x00;
653 c->operand[6] = 0x00;
654
655 c->length = 12;
656
657 if (avc_write(fdtv, c, r) < 0)
658 return -EIO;
659
660 if (r->response != AVC_RESPONSE_STABLE &&
661 r->response != AVC_RESPONSE_ACCEPTED) {
662 dev_err(fdtv->device, "cannot read tuner status\n");
663 return -EINVAL;
664 }
665
666 length = r->operand[9];
667 if (r->operand[1] != 0x10 || length != SIZEOF_ANTENNA_INPUT_INFO) {
668 dev_err(fdtv->device, "got invalid tuner status\n");
669 return -EINVAL;
670 }
671
672 stat->active_system = r->operand[10];
673 stat->searching = r->operand[11] >> 7 & 1;
674 stat->moving = r->operand[11] >> 6 & 1;
675 stat->no_rf = r->operand[11] >> 5 & 1;
676 stat->input = r->operand[12] >> 7 & 1;
677 stat->selected_antenna = r->operand[12] & 0x7f;
678 stat->ber = r->operand[13] << 24 |
679 r->operand[14] << 16 |
680 r->operand[15] << 8 |
681 r->operand[16];
682 stat->signal_strength = r->operand[17];
683 stat->raster_frequency = r->operand[18] >> 6 & 2;
684 stat->rf_frequency = (r->operand[18] & 0x3f) << 16 |
685 r->operand[19] << 8 |
686 r->operand[20];
687 stat->man_dep_info_length = r->operand[21];
688 stat->front_end_error = r->operand[22] >> 4 & 1;
689 stat->antenna_error = r->operand[22] >> 3 & 1;
690 stat->front_end_power_status = r->operand[22] >> 1 & 1;
691 stat->power_supply = r->operand[22] & 1;
692 stat->carrier_noise_ratio = r->operand[23] << 8 |
693 r->operand[24];
694 stat->power_supply_voltage = r->operand[27];
695 stat->antenna_voltage = r->operand[28];
696 stat->firewire_bus_voltage = r->operand[29];
697 stat->ca_mmi = r->operand[30] & 1;
698 stat->ca_pmt_reply = r->operand[31] >> 7 & 1;
699 stat->ca_date_time_request = r->operand[31] >> 6 & 1;
700 stat->ca_application_info = r->operand[31] >> 5 & 1;
701 stat->ca_module_present_status = r->operand[31] >> 4 & 1;
702 stat->ca_dvb_flag = r->operand[31] >> 3 & 1;
703 stat->ca_error_flag = r->operand[31] >> 2 & 1;
704 stat->ca_initialization_status = r->operand[31] >> 1 & 1;
705
706 return 0;
707}
708
709int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
710 char conttone, char nrdiseq,
711 struct dvb_diseqc_master_cmd *diseqcmd)
712{
713 char buffer[sizeof(struct avc_command_frame)];
714 struct avc_command_frame *c = (void *)buffer;
715 struct avc_response_frame *r = (void *)buffer;
716 int i, j, k;
717
718 memset(c, 0, sizeof(*c));
719
720 c->ctype = AVC_CTYPE_CONTROL;
721 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
722 c->opcode = AVC_OPCODE_VENDOR;
723
724 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
725 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
726 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
727 c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL;
728
729 c->operand[4] = voltage;
730 c->operand[5] = nrdiseq;
731
732 i = 6;
733
734 for (j = 0; j < nrdiseq; j++) {
735 c->operand[i++] = diseqcmd[j].msg_len;
736
737 for (k = 0; k < diseqcmd[j].msg_len; k++)
738 c->operand[i++] = diseqcmd[j].msg[k];
739 }
740
741 c->operand[i++] = burst;
742 c->operand[i++] = conttone;
743
744 c->length = ALIGN(3 + i, 4);
745
746 if (avc_write(fdtv, c, r) < 0)
747 return -EIO;
748
749 if (r->response != AVC_RESPONSE_ACCEPTED) {
750 dev_err(fdtv->device, "LNB control failed\n");
751 return -EINVAL;
752 }
753
754 return 0;
755}
756
757int avc_register_remote_control(struct firedtv *fdtv)
758{
759 char buffer[sizeof(struct avc_command_frame)];
760 struct avc_command_frame *c = (void *)buffer;
761
762 memset(c, 0, sizeof(*c));
763
764 c->ctype = AVC_CTYPE_NOTIFY;
765 c->subunit = AVC_SUBUNIT_TYPE_UNIT | 7;
766 c->opcode = AVC_OPCODE_VENDOR;
767
768 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
769 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
770 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
771 c->operand[3] = SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL;
772
773 c->length = 8;
774
775 return avc_write(fdtv, c, NULL);
776}
777
778void avc_remote_ctrl_work(struct work_struct *work)
779{
780 struct firedtv *fdtv =
781 container_of(work, struct firedtv, remote_ctrl_work);
782
783 /* Should it be rescheduled in failure cases? */
784 avc_register_remote_control(fdtv);
785}
786
787#if 0 /* FIXME: unused */
788int avc_tuner_host2ca(struct firedtv *fdtv)
789{
790 char buffer[sizeof(struct avc_command_frame)];
791 struct avc_command_frame *c = (void *)buffer;
792 struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
793
794 memset(c, 0, sizeof(*c));
795
796 c->ctype = AVC_CTYPE_CONTROL;
797 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
798 c->opcode = AVC_OPCODE_VENDOR;
799
800 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
801 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
802 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
803 c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
804 c->operand[4] = 0; /* slot */
805 c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
806 c->operand[6] = 0; /* more/last */
807 c->operand[7] = 0; /* length */
808
809 c->length = 12;
810
811 if (avc_write(fdtv, c, r) < 0)
812 return -EIO;
813
814 return 0;
815}
816#endif
817
818static int get_ca_object_pos(struct avc_response_frame *r)
819{
820 int length = 1;
821
822 /* Check length of length field */
823 if (r->operand[7] & 0x80)
824 length = (r->operand[7] & 0x7f) + 1;
825 return length + 7;
826}
827
828static int get_ca_object_length(struct avc_response_frame *r)
829{
830#if 0 /* FIXME: unused */
831 int size = 0;
832 int i;
833
834 if (r->operand[7] & 0x80)
835 for (i = 0; i < (r->operand[7] & 0x7f); i++) {
836 size <<= 8;
837 size += r->operand[8 + i];
838 }
839#endif
840 return r->operand[7];
841}
842
843int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
844{
845 char buffer[sizeof(struct avc_command_frame)];
846 struct avc_command_frame *c = (void *)buffer;
847 struct avc_response_frame *r = (void *)buffer;
848 int pos;
849
850 memset(c, 0, sizeof(*c));
851
852 c->ctype = AVC_CTYPE_STATUS;
853 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
854 c->opcode = AVC_OPCODE_VENDOR;
855
856 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
857 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
858 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
859 c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
860 c->operand[4] = 0; /* slot */
861 c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
862
863 c->length = 12;
864
865 if (avc_write(fdtv, c, r) < 0)
866 return -EIO;
867
868 /* FIXME: check response code and validate response data */
869
870 pos = get_ca_object_pos(r);
871 app_info[0] = (EN50221_TAG_APP_INFO >> 16) & 0xff;
872 app_info[1] = (EN50221_TAG_APP_INFO >> 8) & 0xff;
873 app_info[2] = (EN50221_TAG_APP_INFO >> 0) & 0xff;
874 app_info[3] = 6 + r->operand[pos + 4];
875 app_info[4] = 0x01;
876 memcpy(&app_info[5], &r->operand[pos], 5 + r->operand[pos + 4]);
877 *len = app_info[3] + 4;
878
879 return 0;
880}
881
882int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
883{
884 char buffer[sizeof(struct avc_command_frame)];
885 struct avc_command_frame *c = (void *)buffer;
886 struct avc_response_frame *r = (void *)buffer;
887 int pos;
888
889 memset(c, 0, sizeof(*c));
890
891 c->ctype = AVC_CTYPE_STATUS;
892 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
893 c->opcode = AVC_OPCODE_VENDOR;
894
895 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
896 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
897 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
898 c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
899 c->operand[4] = 0; /* slot */
900 c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
901
902 c->length = 12;
903
904 if (avc_write(fdtv, c, r) < 0)
905 return -EIO;
906
907 pos = get_ca_object_pos(r);
908 app_info[0] = (EN50221_TAG_CA_INFO >> 16) & 0xff;
909 app_info[1] = (EN50221_TAG_CA_INFO >> 8) & 0xff;
910 app_info[2] = (EN50221_TAG_CA_INFO >> 0) & 0xff;
911 app_info[3] = 2;
912 app_info[4] = r->operand[pos + 0];
913 app_info[5] = r->operand[pos + 1];
914 *len = app_info[3] + 4;
915
916 return 0;
917}
918
919int avc_ca_reset(struct firedtv *fdtv)
920{
921 char buffer[sizeof(struct avc_command_frame)];
922 struct avc_command_frame *c = (void *)buffer;
923 struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
924
925 memset(c, 0, sizeof(*c));
926
927 c->ctype = AVC_CTYPE_CONTROL;
928 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
929 c->opcode = AVC_OPCODE_VENDOR;
930
931 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
932 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
933 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
934 c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
935 c->operand[4] = 0; /* slot */
936 c->operand[5] = SFE_VENDOR_TAG_CA_RESET; /* ca tag */
937 c->operand[6] = 0; /* more/last */
938 c->operand[7] = 1; /* length */
939 c->operand[8] = 0; /* force hardware reset */
940
941 c->length = 12;
942
943 if (avc_write(fdtv, c, r) < 0)
944 return -EIO;
945
946 return 0;
947}
948
949int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
950{
951 char buffer[sizeof(struct avc_command_frame)];
952 struct avc_command_frame *c = (void *)buffer;
953 struct avc_response_frame *r = (void *)buffer;
954 int list_management;
955 int program_info_length;
956 int pmt_cmd_id;
957 int read_pos;
958 int write_pos;
959 int es_info_length;
960 int crc32_csum;
961
962 memset(c, 0, sizeof(*c));
963
964 c->ctype = AVC_CTYPE_CONTROL;
965 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
966 c->opcode = AVC_OPCODE_VENDOR;
967
968 if (msg[0] != EN50221_LIST_MANAGEMENT_ONLY) {
969 dev_info(fdtv->device, "forcing list_management to ONLY\n");
970 msg[0] = EN50221_LIST_MANAGEMENT_ONLY;
971 }
972 /* We take the cmd_id from the programme level only! */
973 list_management = msg[0];
974 program_info_length = ((msg[4] & 0x0f) << 8) + msg[5];
975 if (program_info_length > 0)
976 program_info_length--; /* Remove pmt_cmd_id */
977 pmt_cmd_id = msg[6];
978
979 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
980 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
981 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
982 c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
983 c->operand[4] = 0; /* slot */
984 c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */
985 c->operand[6] = 0; /* more/last */
986 /* c->operand[7] = XXXprogram_info_length + 17; */ /* length */
987 c->operand[8] = list_management;
988 c->operand[9] = 0x01; /* pmt_cmd=OK_descramble */
989
990 /* TS program map table */
991
992 c->operand[10] = 0x02; /* Table id=2 */
993 c->operand[11] = 0x80; /* Section syntax + length */
994 /* c->operand[12] = XXXprogram_info_length + 12; */
995 c->operand[13] = msg[1]; /* Program number */
996 c->operand[14] = msg[2];
997 c->operand[15] = 0x01; /* Version number=0 + current/next=1 */
998 c->operand[16] = 0x00; /* Section number=0 */
999 c->operand[17] = 0x00; /* Last section number=0 */
1000 c->operand[18] = 0x1f; /* PCR_PID=1FFF */
1001 c->operand[19] = 0xff;
1002 c->operand[20] = (program_info_length >> 8); /* Program info length */
1003 c->operand[21] = (program_info_length & 0xff);
1004
1005 /* CA descriptors at programme level */
1006 read_pos = 6;
1007 write_pos = 22;
1008 if (program_info_length > 0) {
1009 pmt_cmd_id = msg[read_pos++];
1010 if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
1011 dev_err(fdtv->device,
1012 "invalid pmt_cmd_id %d\n", pmt_cmd_id);
1013
1014 memcpy(&c->operand[write_pos], &msg[read_pos],
1015 program_info_length);
1016 read_pos += program_info_length;
1017 write_pos += program_info_length;
1018 }
1019 while (read_pos < length) {
1020 c->operand[write_pos++] = msg[read_pos++];
1021 c->operand[write_pos++] = msg[read_pos++];
1022 c->operand[write_pos++] = msg[read_pos++];
1023 es_info_length =
1024 ((msg[read_pos] & 0x0f) << 8) + msg[read_pos + 1];
1025 read_pos += 2;
1026 if (es_info_length > 0)
1027 es_info_length--; /* Remove pmt_cmd_id */
1028 c->operand[write_pos++] = es_info_length >> 8;
1029 c->operand[write_pos++] = es_info_length & 0xff;
1030 if (es_info_length > 0) {
1031 pmt_cmd_id = msg[read_pos++];
1032 if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
1033 dev_err(fdtv->device, "invalid pmt_cmd_id %d "
1034 "at stream level\n", pmt_cmd_id);
1035
1036 memcpy(&c->operand[write_pos], &msg[read_pos],
1037 es_info_length);
1038 read_pos += es_info_length;
1039 write_pos += es_info_length;
1040 }
1041 }
1042
1043 /* CRC */
1044 c->operand[write_pos++] = 0x00;
1045 c->operand[write_pos++] = 0x00;
1046 c->operand[write_pos++] = 0x00;
1047 c->operand[write_pos++] = 0x00;
1048
1049 c->operand[7] = write_pos - 8;
1050 c->operand[12] = write_pos - 13;
1051
1052 crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1);
1053 c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff;
1054 c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff;
1055 c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff;
1056 c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff;
1057
1058 c->length = ALIGN(3 + write_pos, 4);
1059
1060 if (avc_write(fdtv, c, r) < 0)
1061 return -EIO;
1062
1063 if (r->response != AVC_RESPONSE_ACCEPTED) {
1064 dev_err(fdtv->device,
1065 "CA PMT failed with response 0x%x\n", r->response);
1066 return -EFAULT;
1067 }
1068
1069 return 0;
1070}
1071
1072int avc_ca_get_time_date(struct firedtv *fdtv, int *interval)
1073{
1074 char buffer[sizeof(struct avc_command_frame)];
1075 struct avc_command_frame *c = (void *)buffer;
1076 struct avc_response_frame *r = (void *)buffer;
1077
1078 memset(c, 0, sizeof(*c));
1079
1080 c->ctype = AVC_CTYPE_STATUS;
1081 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1082 c->opcode = AVC_OPCODE_VENDOR;
1083
1084 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
1085 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
1086 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
1087 c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
1088 c->operand[4] = 0; /* slot */
1089 c->operand[5] = SFE_VENDOR_TAG_CA_DATE_TIME; /* ca tag */
1090 c->operand[6] = 0; /* more/last */
1091 c->operand[7] = 0; /* length */
1092
1093 c->length = 12;
1094
1095 if (avc_write(fdtv, c, r) < 0)
1096 return -EIO;
1097
1098 /* FIXME: check response code and validate response data */
1099
1100 *interval = r->operand[get_ca_object_pos(r)];
1101
1102 return 0;
1103}
1104
1105int avc_ca_enter_menu(struct firedtv *fdtv)
1106{
1107 char buffer[sizeof(struct avc_command_frame)];
1108 struct avc_command_frame *c = (void *)buffer;
1109 struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
1110
1111 memset(c, 0, sizeof(*c));
1112
1113 c->ctype = AVC_CTYPE_STATUS;
1114 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1115 c->opcode = AVC_OPCODE_VENDOR;
1116
1117 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
1118 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
1119 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
1120 c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
1121 c->operand[4] = 0; /* slot */
1122 c->operand[5] = SFE_VENDOR_TAG_CA_ENTER_MENU;
1123 c->operand[6] = 0; /* more/last */
1124 c->operand[7] = 0; /* length */
1125
1126 c->length = 12;
1127
1128 if (avc_write(fdtv, c, r) < 0)
1129 return -EIO;
1130
1131 return 0;
1132}
1133
1134int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len)
1135{
1136 char buffer[sizeof(struct avc_command_frame)];
1137 struct avc_command_frame *c = (void *)buffer;
1138 struct avc_response_frame *r = (void *)buffer;
1139
1140 memset(c, 0, sizeof(*c));
1141
1142 c->ctype = AVC_CTYPE_STATUS;
1143 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1144 c->opcode = AVC_OPCODE_VENDOR;
1145
1146 c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
1147 c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
1148 c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
1149 c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
1150 c->operand[4] = 0; /* slot */
1151 c->operand[5] = SFE_VENDOR_TAG_CA_MMI;
1152 c->operand[6] = 0; /* more/last */
1153 c->operand[7] = 0; /* length */
1154
1155 c->length = 12;
1156
1157 if (avc_write(fdtv, c, r) < 0)
1158 return -EIO;
1159
1160 /* FIXME: check response code and validate response data */
1161
1162 *len = get_ca_object_length(r);
1163 memcpy(mmi_object, &r->operand[get_ca_object_pos(r)], *len);
1164
1165 return 0;
1166}
1167
1168#define CMP_OUTPUT_PLUG_CONTROL_REG_0 0xfffff0000904ULL
1169
1170static int cmp_read(struct firedtv *fdtv, void *buf, u64 addr, size_t len)
1171{
1172 int ret;
1173
1174 if (mutex_lock_interruptible(&fdtv->avc_mutex))
1175 return -EINTR;
1176
1177 ret = fdtv->backend->read(fdtv, addr, buf, len);
1178 if (ret < 0)
1179 dev_err(fdtv->device, "CMP: read I/O error\n");
1180
1181 mutex_unlock(&fdtv->avc_mutex);
1182 return ret;
1183}
1184
1185static int cmp_lock(struct firedtv *fdtv, void *data, u64 addr, __be32 arg)
1186{
1187 int ret;
1188
1189 if (mutex_lock_interruptible(&fdtv->avc_mutex))
1190 return -EINTR;
1191
1192 ret = fdtv->backend->lock(fdtv, addr, data, arg);
1193 if (ret < 0)
1194 dev_err(fdtv->device, "CMP: lock I/O error\n");
1195
1196 mutex_unlock(&fdtv->avc_mutex);
1197 return ret;
1198}
1199
1200static inline u32 get_opcr(__be32 opcr, u32 mask, u32 shift)
1201{
1202 return (be32_to_cpu(opcr) >> shift) & mask;
1203}
1204
1205static inline void set_opcr(__be32 *opcr, u32 value, u32 mask, u32 shift)
1206{
1207 *opcr &= ~cpu_to_be32(mask << shift);
1208 *opcr |= cpu_to_be32((value & mask) << shift);
1209}
1210
1211#define get_opcr_online(v) get_opcr((v), 0x1, 31)
1212#define get_opcr_p2p_connections(v) get_opcr((v), 0x3f, 24)
1213#define get_opcr_channel(v) get_opcr((v), 0x3f, 16)
1214
1215#define set_opcr_p2p_connections(p, v) set_opcr((p), (v), 0x3f, 24)
1216#define set_opcr_channel(p, v) set_opcr((p), (v), 0x3f, 16)
1217#define set_opcr_data_rate(p, v) set_opcr((p), (v), 0x3, 14)
1218#define set_opcr_overhead_id(p, v) set_opcr((p), (v), 0xf, 10)
1219
1220int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel)
1221{
1222 __be32 old_opcr, opcr;
1223 u64 opcr_address = CMP_OUTPUT_PLUG_CONTROL_REG_0 + (plug << 2);
1224 int attempts = 0;
1225 int ret;
1226
1227 ret = cmp_read(fdtv, &opcr, opcr_address, 4);
1228 if (ret < 0)
1229 return ret;
1230
1231repeat:
1232 if (!get_opcr_online(opcr)) {
1233 dev_err(fdtv->device, "CMP: output offline\n");
1234 return -EBUSY;
1235 }
1236
1237 old_opcr = opcr;
1238
1239 if (get_opcr_p2p_connections(opcr)) {
1240 if (get_opcr_channel(opcr) != channel) {
1241 dev_err(fdtv->device, "CMP: cannot change channel\n");
1242 return -EBUSY;
1243 }
1244 dev_info(fdtv->device, "CMP: overlaying connection\n");
1245
1246 /* We don't allocate isochronous resources. */
1247 } else {
1248 set_opcr_channel(&opcr, channel);
1249 set_opcr_data_rate(&opcr, 2); /* S400 */
1250
1251 /* FIXME: this is for the worst case - optimize */
1252 set_opcr_overhead_id(&opcr, 0);
1253
1254 /*
1255 * FIXME: allocate isochronous channel and bandwidth at IRM
1256 * fdtv->backend->alloc_resources(fdtv, channels_mask, bw);
1257 */
1258 }
1259
1260 set_opcr_p2p_connections(&opcr, get_opcr_p2p_connections(opcr) + 1);
1261
1262 ret = cmp_lock(fdtv, &opcr, opcr_address, old_opcr);
1263 if (ret < 0)
1264 return ret;
1265
1266 if (old_opcr != opcr) {
1267 /*
1268 * FIXME: if old_opcr.P2P_Connections > 0,
1269 * deallocate isochronous channel and bandwidth at IRM
1270 * if (...)
1271 * fdtv->backend->dealloc_resources(fdtv, channel, bw);
1272 */
1273
1274 if (++attempts < 6) /* arbitrary limit */
1275 goto repeat;
1276 return -EBUSY;
1277 }
1278
1279 return 0;
1280}
1281
1282void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel)
1283{
1284 __be32 old_opcr, opcr;
1285 u64 opcr_address = CMP_OUTPUT_PLUG_CONTROL_REG_0 + (plug << 2);
1286 int attempts = 0;
1287
1288 if (cmp_read(fdtv, &opcr, opcr_address, 4) < 0)
1289 return;
1290
1291repeat:
1292 if (!get_opcr_online(opcr) || !get_opcr_p2p_connections(opcr) ||
1293 get_opcr_channel(opcr) != channel) {
1294 dev_err(fdtv->device, "CMP: no connection to break\n");
1295 return;
1296 }
1297
1298 old_opcr = opcr;
1299 set_opcr_p2p_connections(&opcr, get_opcr_p2p_connections(opcr) - 1);
1300
1301 if (cmp_lock(fdtv, &opcr, opcr_address, old_opcr) < 0)
1302 return;
1303
1304 if (old_opcr != opcr) {
1305 /*
1306 * FIXME: if old_opcr.P2P_Connections == 1, i.e. we were last
1307 * owner, deallocate isochronous channel and bandwidth at IRM
1308 * if (...)
1309 * fdtv->backend->dealloc_resources(fdtv, channel, bw);
1310 */
1311
1312 if (++attempts < 6) /* arbitrary limit */
1313 goto repeat;
1314 }
1315}
diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/dvb/firewire/firedtv-ci.c
new file mode 100644
index 000000000000..eeb80d0ea3ff
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-ci.c
@@ -0,0 +1,260 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 */
12
13#include <linux/device.h>
14#include <linux/dvb/ca.h>
15#include <linux/fs.h>
16#include <linux/module.h>
17
18#include <dvbdev.h>
19
20#include "firedtv.h"
21
22#define EN50221_TAG_APP_INFO_ENQUIRY 0x9f8020
23#define EN50221_TAG_CA_INFO_ENQUIRY 0x9f8030
24#define EN50221_TAG_CA_PMT 0x9f8032
25#define EN50221_TAG_ENTER_MENU 0x9f8022
26
27static int fdtv_ca_ready(struct firedtv_tuner_status *stat)
28{
29 return stat->ca_initialization_status == 1 &&
30 stat->ca_error_flag == 0 &&
31 stat->ca_dvb_flag == 1 &&
32 stat->ca_module_present_status == 1;
33}
34
35static int fdtv_get_ca_flags(struct firedtv_tuner_status *stat)
36{
37 int flags = 0;
38
39 if (stat->ca_module_present_status == 1)
40 flags |= CA_CI_MODULE_PRESENT;
41 if (stat->ca_initialization_status == 1 &&
42 stat->ca_error_flag == 0 &&
43 stat->ca_dvb_flag == 1)
44 flags |= CA_CI_MODULE_READY;
45 return flags;
46}
47
48static int fdtv_ca_reset(struct firedtv *fdtv)
49{
50 return avc_ca_reset(fdtv) ? -EFAULT : 0;
51}
52
53static int fdtv_ca_get_caps(void *arg)
54{
55 struct ca_caps *cap = arg;
56
57 cap->slot_num = 1;
58 cap->slot_type = CA_CI;
59 cap->descr_num = 1;
60 cap->descr_type = CA_ECD;
61 return 0;
62}
63
64static int fdtv_ca_get_slot_info(struct firedtv *fdtv, void *arg)
65{
66 struct firedtv_tuner_status stat;
67 struct ca_slot_info *slot = arg;
68
69 if (avc_tuner_status(fdtv, &stat))
70 return -EFAULT;
71
72 if (slot->num != 0)
73 return -EFAULT;
74
75 slot->type = CA_CI;
76 slot->flags = fdtv_get_ca_flags(&stat);
77 return 0;
78}
79
80static int fdtv_ca_app_info(struct firedtv *fdtv, void *arg)
81{
82 struct ca_msg *reply = arg;
83
84 return avc_ca_app_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
85}
86
87static int fdtv_ca_info(struct firedtv *fdtv, void *arg)
88{
89 struct ca_msg *reply = arg;
90
91 return avc_ca_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
92}
93
94static int fdtv_ca_get_mmi(struct firedtv *fdtv, void *arg)
95{
96 struct ca_msg *reply = arg;
97
98 return avc_ca_get_mmi(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
99}
100
101static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg)
102{
103 struct firedtv_tuner_status stat;
104 int err;
105
106 switch (fdtv->ca_last_command) {
107 case EN50221_TAG_APP_INFO_ENQUIRY:
108 err = fdtv_ca_app_info(fdtv, arg);
109 break;
110 case EN50221_TAG_CA_INFO_ENQUIRY:
111 err = fdtv_ca_info(fdtv, arg);
112 break;
113 default:
114 if (avc_tuner_status(fdtv, &stat))
115 err = -EFAULT;
116 else if (stat.ca_mmi == 1)
117 err = fdtv_ca_get_mmi(fdtv, arg);
118 else {
119 dev_info(fdtv->device, "unhandled CA message 0x%08x\n",
120 fdtv->ca_last_command);
121 err = -EFAULT;
122 }
123 }
124 fdtv->ca_last_command = 0;
125 return err;
126}
127
128static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
129{
130 struct ca_msg *msg = arg;
131 int data_pos;
132 int data_length;
133 int i;
134
135 data_pos = 4;
136 if (msg->msg[3] & 0x80) {
137 data_length = 0;
138 for (i = 0; i < (msg->msg[3] & 0x7f); i++)
139 data_length = (data_length << 8) + msg->msg[data_pos++];
140 } else {
141 data_length = msg->msg[3];
142 }
143
144 return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length) ? -EFAULT : 0;
145}
146
147static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)
148{
149 struct ca_msg *msg = arg;
150 int err;
151
152 /* Do we need a semaphore for this? */
153 fdtv->ca_last_command =
154 (msg->msg[0] << 16) + (msg->msg[1] << 8) + msg->msg[2];
155 switch (fdtv->ca_last_command) {
156 case EN50221_TAG_CA_PMT:
157 err = fdtv_ca_pmt(fdtv, arg);
158 break;
159 case EN50221_TAG_APP_INFO_ENQUIRY:
160 /* handled in ca_get_msg */
161 err = 0;
162 break;
163 case EN50221_TAG_CA_INFO_ENQUIRY:
164 /* handled in ca_get_msg */
165 err = 0;
166 break;
167 case EN50221_TAG_ENTER_MENU:
168 err = avc_ca_enter_menu(fdtv);
169 break;
170 default:
171 dev_err(fdtv->device, "unhandled CA message 0x%08x\n",
172 fdtv->ca_last_command);
173 err = -EFAULT;
174 }
175 return err;
176}
177
178static int fdtv_ca_ioctl(struct inode *inode, struct file *file,
179 unsigned int cmd, void *arg)
180{
181 struct dvb_device *dvbdev = file->private_data;
182 struct firedtv *fdtv = dvbdev->priv;
183 struct firedtv_tuner_status stat;
184 int err;
185
186 switch (cmd) {
187 case CA_RESET:
188 err = fdtv_ca_reset(fdtv);
189 break;
190 case CA_GET_CAP:
191 err = fdtv_ca_get_caps(arg);
192 break;
193 case CA_GET_SLOT_INFO:
194 err = fdtv_ca_get_slot_info(fdtv, arg);
195 break;
196 case CA_GET_MSG:
197 err = fdtv_ca_get_msg(fdtv, arg);
198 break;
199 case CA_SEND_MSG:
200 err = fdtv_ca_send_msg(fdtv, arg);
201 break;
202 default:
203 dev_info(fdtv->device, "unhandled CA ioctl %u\n", cmd);
204 err = -EOPNOTSUPP;
205 }
206
207 /* FIXME Is this necessary? */
208 avc_tuner_status(fdtv, &stat);
209
210 return err;
211}
212
213static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait)
214{
215 return POLLIN;
216}
217
218static struct file_operations fdtv_ca_fops = {
219 .owner = THIS_MODULE,
220 .ioctl = dvb_generic_ioctl,
221 .open = dvb_generic_open,
222 .release = dvb_generic_release,
223 .poll = fdtv_ca_io_poll,
224};
225
226static struct dvb_device fdtv_ca = {
227 .users = 1,
228 .readers = 1,
229 .writers = 1,
230 .fops = &fdtv_ca_fops,
231 .kernel_ioctl = fdtv_ca_ioctl,
232};
233
234int fdtv_ca_register(struct firedtv *fdtv)
235{
236 struct firedtv_tuner_status stat;
237 int err;
238
239 if (avc_tuner_status(fdtv, &stat))
240 return -EINVAL;
241
242 if (!fdtv_ca_ready(&stat))
243 return -EFAULT;
244
245 err = dvb_register_device(&fdtv->adapter, &fdtv->cadev,
246 &fdtv_ca, fdtv, DVB_DEVICE_CA);
247
248 if (stat.ca_application_info == 0)
249 dev_err(fdtv->device, "CaApplicationInfo is not set\n");
250 if (stat.ca_date_time_request == 1)
251 avc_ca_get_time_date(fdtv, &fdtv->ca_time_interval);
252
253 return err;
254}
255
256void fdtv_ca_release(struct firedtv *fdtv)
257{
258 if (fdtv->cadev)
259 dvb_unregister_device(fdtv->cadev);
260}
diff --git a/drivers/media/dvb/firewire/firedtv-dvb.c b/drivers/media/dvb/firewire/firedtv-dvb.c
new file mode 100644
index 000000000000..9d308dd32a5c
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-dvb.c
@@ -0,0 +1,364 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 */
12
13#include <linux/bitops.h>
14#include <linux/device.h>
15#include <linux/errno.h>
16#include <linux/kernel.h>
17#include <linux/mod_devicetable.h>
18#include <linux/module.h>
19#include <linux/mutex.h>
20#include <linux/slab.h>
21#include <linux/string.h>
22#include <linux/types.h>
23#include <linux/wait.h>
24#include <linux/workqueue.h>
25
26#include <dmxdev.h>
27#include <dvb_demux.h>
28#include <dvbdev.h>
29#include <dvb_frontend.h>
30
31#include "firedtv.h"
32
33static int alloc_channel(struct firedtv *fdtv)
34{
35 int i;
36
37 for (i = 0; i < 16; i++)
38 if (!__test_and_set_bit(i, &fdtv->channel_active))
39 break;
40 return i;
41}
42
43static void collect_channels(struct firedtv *fdtv, int *pidc, u16 pid[])
44{
45 int i, n;
46
47 for (i = 0, n = 0; i < 16; i++)
48 if (test_bit(i, &fdtv->channel_active))
49 pid[n++] = fdtv->channel_pid[i];
50 *pidc = n;
51}
52
53static inline void dealloc_channel(struct firedtv *fdtv, int i)
54{
55 __clear_bit(i, &fdtv->channel_active);
56}
57
58int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed)
59{
60 struct firedtv *fdtv = dvbdmxfeed->demux->priv;
61 int pidc, c, ret;
62 u16 pids[16];
63
64 switch (dvbdmxfeed->type) {
65 case DMX_TYPE_TS:
66 case DMX_TYPE_SEC:
67 break;
68 default:
69 dev_err(fdtv->device, "can't start dmx feed: invalid type %u\n",
70 dvbdmxfeed->type);
71 return -EINVAL;
72 }
73
74 if (mutex_lock_interruptible(&fdtv->demux_mutex))
75 return -EINTR;
76
77 if (dvbdmxfeed->type == DMX_TYPE_TS) {
78 switch (dvbdmxfeed->pes_type) {
79 case DMX_TS_PES_VIDEO:
80 case DMX_TS_PES_AUDIO:
81 case DMX_TS_PES_TELETEXT:
82 case DMX_TS_PES_PCR:
83 case DMX_TS_PES_OTHER:
84 c = alloc_channel(fdtv);
85 break;
86 default:
87 dev_err(fdtv->device,
88 "can't start dmx feed: invalid pes type %u\n",
89 dvbdmxfeed->pes_type);
90 ret = -EINVAL;
91 goto out;
92 }
93 } else {
94 c = alloc_channel(fdtv);
95 }
96
97 if (c > 15) {
98 dev_err(fdtv->device, "can't start dmx feed: busy\n");
99 ret = -EBUSY;
100 goto out;
101 }
102
103 dvbdmxfeed->priv = (typeof(dvbdmxfeed->priv))(unsigned long)c;
104 fdtv->channel_pid[c] = dvbdmxfeed->pid;
105 collect_channels(fdtv, &pidc, pids);
106
107 if (dvbdmxfeed->pid == 8192) {
108 ret = avc_tuner_get_ts(fdtv);
109 if (ret) {
110 dealloc_channel(fdtv, c);
111 dev_err(fdtv->device, "can't get TS\n");
112 goto out;
113 }
114 } else {
115 ret = avc_tuner_set_pids(fdtv, pidc, pids);
116 if (ret) {
117 dealloc_channel(fdtv, c);
118 dev_err(fdtv->device, "can't set PIDs\n");
119 goto out;
120 }
121 }
122out:
123 mutex_unlock(&fdtv->demux_mutex);
124
125 return ret;
126}
127
128int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
129{
130 struct dvb_demux *demux = dvbdmxfeed->demux;
131 struct firedtv *fdtv = demux->priv;
132 int pidc, c, ret;
133 u16 pids[16];
134
135 if (dvbdmxfeed->type == DMX_TYPE_TS &&
136 !((dvbdmxfeed->ts_type & TS_PACKET) &&
137 (demux->dmx.frontend->source != DMX_MEMORY_FE))) {
138
139 if (dvbdmxfeed->ts_type & TS_DECODER) {
140 if (dvbdmxfeed->pes_type >= DMX_TS_PES_OTHER ||
141 !demux->pesfilter[dvbdmxfeed->pes_type])
142 return -EINVAL;
143
144 demux->pids[dvbdmxfeed->pes_type] |= 0x8000;
145 demux->pesfilter[dvbdmxfeed->pes_type] = NULL;
146 }
147
148 if (!(dvbdmxfeed->ts_type & TS_DECODER &&
149 dvbdmxfeed->pes_type < DMX_TS_PES_OTHER))
150 return 0;
151 }
152
153 if (mutex_lock_interruptible(&fdtv->demux_mutex))
154 return -EINTR;
155
156 c = (unsigned long)dvbdmxfeed->priv;
157 dealloc_channel(fdtv, c);
158 collect_channels(fdtv, &pidc, pids);
159
160 ret = avc_tuner_set_pids(fdtv, pidc, pids);
161
162 mutex_unlock(&fdtv->demux_mutex);
163
164 return ret;
165}
166
167DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
168
169int fdtv_dvb_register(struct firedtv *fdtv)
170{
171 int err;
172
173 err = dvb_register_adapter(&fdtv->adapter, fdtv_model_names[fdtv->type],
174 THIS_MODULE, fdtv->device, adapter_nr);
175 if (err < 0)
176 goto fail_log;
177
178 /*DMX_TS_FILTERING | DMX_SECTION_FILTERING*/
179 fdtv->demux.dmx.capabilities = 0;
180
181 fdtv->demux.priv = fdtv;
182 fdtv->demux.filternum = 16;
183 fdtv->demux.feednum = 16;
184 fdtv->demux.start_feed = fdtv_start_feed;
185 fdtv->demux.stop_feed = fdtv_stop_feed;
186 fdtv->demux.write_to_decoder = NULL;
187
188 err = dvb_dmx_init(&fdtv->demux);
189 if (err)
190 goto fail_unreg_adapter;
191
192 fdtv->dmxdev.filternum = 16;
193 fdtv->dmxdev.demux = &fdtv->demux.dmx;
194 fdtv->dmxdev.capabilities = 0;
195
196 err = dvb_dmxdev_init(&fdtv->dmxdev, &fdtv->adapter);
197 if (err)
198 goto fail_dmx_release;
199
200 fdtv->frontend.source = DMX_FRONTEND_0;
201
202 err = fdtv->demux.dmx.add_frontend(&fdtv->demux.dmx, &fdtv->frontend);
203 if (err)
204 goto fail_dmxdev_release;
205
206 err = fdtv->demux.dmx.connect_frontend(&fdtv->demux.dmx,
207 &fdtv->frontend);
208 if (err)
209 goto fail_rem_frontend;
210
211 dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx);
212
213 fdtv_frontend_init(fdtv);
214 err = dvb_register_frontend(&fdtv->adapter, &fdtv->fe);
215 if (err)
216 goto fail_net_release;
217
218 err = fdtv_ca_register(fdtv);
219 if (err)
220 dev_info(fdtv->device,
221 "Conditional Access Module not enabled\n");
222 return 0;
223
224fail_net_release:
225 dvb_net_release(&fdtv->dvbnet);
226 fdtv->demux.dmx.close(&fdtv->demux.dmx);
227fail_rem_frontend:
228 fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx, &fdtv->frontend);
229fail_dmxdev_release:
230 dvb_dmxdev_release(&fdtv->dmxdev);
231fail_dmx_release:
232 dvb_dmx_release(&fdtv->demux);
233fail_unreg_adapter:
234 dvb_unregister_adapter(&fdtv->adapter);
235fail_log:
236 dev_err(fdtv->device, "DVB initialization failed\n");
237 return err;
238}
239
240void fdtv_dvb_unregister(struct firedtv *fdtv)
241{
242 fdtv_ca_release(fdtv);
243 dvb_unregister_frontend(&fdtv->fe);
244 dvb_net_release(&fdtv->dvbnet);
245 fdtv->demux.dmx.close(&fdtv->demux.dmx);
246 fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx, &fdtv->frontend);
247 dvb_dmxdev_release(&fdtv->dmxdev);
248 dvb_dmx_release(&fdtv->demux);
249 dvb_unregister_adapter(&fdtv->adapter);
250}
251
252const char *fdtv_model_names[] = {
253 [FIREDTV_UNKNOWN] = "unknown type",
254 [FIREDTV_DVB_S] = "FireDTV S/CI",
255 [FIREDTV_DVB_C] = "FireDTV C/CI",
256 [FIREDTV_DVB_T] = "FireDTV T/CI",
257 [FIREDTV_DVB_S2] = "FireDTV S2 ",
258};
259
260struct firedtv *fdtv_alloc(struct device *dev,
261 const struct firedtv_backend *backend,
262 const char *name, size_t name_len)
263{
264 struct firedtv *fdtv;
265 int i;
266
267 fdtv = kzalloc(sizeof(*fdtv), GFP_KERNEL);
268 if (!fdtv)
269 return NULL;
270
271 dev->driver_data = fdtv;
272 fdtv->device = dev;
273 fdtv->isochannel = -1;
274 fdtv->voltage = 0xff;
275 fdtv->tone = 0xff;
276 fdtv->backend = backend;
277
278 mutex_init(&fdtv->avc_mutex);
279 init_waitqueue_head(&fdtv->avc_wait);
280 fdtv->avc_reply_received = true;
281 mutex_init(&fdtv->demux_mutex);
282 INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work);
283
284 for (i = ARRAY_SIZE(fdtv_model_names); --i; )
285 if (strlen(fdtv_model_names[i]) <= name_len &&
286 strncmp(name, fdtv_model_names[i], name_len) == 0)
287 break;
288 fdtv->type = i;
289
290 return fdtv;
291}
292
293#define MATCH_FLAGS (IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID | \
294 IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION)
295
296#define DIGITAL_EVERYWHERE_OUI 0x001287
297#define AVC_UNIT_SPEC_ID_ENTRY 0x00a02d
298#define AVC_SW_VERSION_ENTRY 0x010001
299
300static struct ieee1394_device_id fdtv_id_table[] = {
301 {
302 /* FloppyDTV S/CI and FloppyDTV S2 */
303 .match_flags = MATCH_FLAGS,
304 .vendor_id = DIGITAL_EVERYWHERE_OUI,
305 .model_id = 0x000024,
306 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
307 .version = AVC_SW_VERSION_ENTRY,
308 }, {
309 /* FloppyDTV T/CI */
310 .match_flags = MATCH_FLAGS,
311 .vendor_id = DIGITAL_EVERYWHERE_OUI,
312 .model_id = 0x000025,
313 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
314 .version = AVC_SW_VERSION_ENTRY,
315 }, {
316 /* FloppyDTV C/CI */
317 .match_flags = MATCH_FLAGS,
318 .vendor_id = DIGITAL_EVERYWHERE_OUI,
319 .model_id = 0x000026,
320 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
321 .version = AVC_SW_VERSION_ENTRY,
322 }, {
323 /* FireDTV S/CI and FloppyDTV S2 */
324 .match_flags = MATCH_FLAGS,
325 .vendor_id = DIGITAL_EVERYWHERE_OUI,
326 .model_id = 0x000034,
327 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
328 .version = AVC_SW_VERSION_ENTRY,
329 }, {
330 /* FireDTV T/CI */
331 .match_flags = MATCH_FLAGS,
332 .vendor_id = DIGITAL_EVERYWHERE_OUI,
333 .model_id = 0x000035,
334 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
335 .version = AVC_SW_VERSION_ENTRY,
336 }, {
337 /* FireDTV C/CI */
338 .match_flags = MATCH_FLAGS,
339 .vendor_id = DIGITAL_EVERYWHERE_OUI,
340 .model_id = 0x000036,
341 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
342 .version = AVC_SW_VERSION_ENTRY,
343 }, {}
344};
345MODULE_DEVICE_TABLE(ieee1394, fdtv_id_table);
346
347static int __init fdtv_init(void)
348{
349 return fdtv_1394_init(fdtv_id_table);
350}
351
352static void __exit fdtv_exit(void)
353{
354 fdtv_1394_exit();
355}
356
357module_init(fdtv_init);
358module_exit(fdtv_exit);
359
360MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>");
361MODULE_AUTHOR("Ben Backx <ben@bbackx.com>");
362MODULE_DESCRIPTION("FireDTV DVB Driver");
363MODULE_LICENSE("GPL");
364MODULE_SUPPORTED_DEVICE("FireDTV DVB");
diff --git a/drivers/media/dvb/firewire/firedtv-fe.c b/drivers/media/dvb/firewire/firedtv-fe.c
new file mode 100644
index 000000000000..7ba43630a25d
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-fe.c
@@ -0,0 +1,247 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 */
12
13#include <linux/device.h>
14#include <linux/errno.h>
15#include <linux/kernel.h>
16#include <linux/string.h>
17#include <linux/types.h>
18
19#include <dvb_frontend.h>
20
21#include "firedtv.h"
22
23static int fdtv_dvb_init(struct dvb_frontend *fe)
24{
25 struct firedtv *fdtv = fe->sec_priv;
26 int err;
27
28 /* FIXME - allocate free channel at IRM */
29 fdtv->isochannel = fdtv->adapter.num;
30
31 err = cmp_establish_pp_connection(fdtv, fdtv->subunit,
32 fdtv->isochannel);
33 if (err) {
34 dev_err(fdtv->device,
35 "could not establish point to point connection\n");
36 return err;
37 }
38
39 return fdtv->backend->start_iso(fdtv);
40}
41
42static int fdtv_sleep(struct dvb_frontend *fe)
43{
44 struct firedtv *fdtv = fe->sec_priv;
45
46 fdtv->backend->stop_iso(fdtv);
47 cmp_break_pp_connection(fdtv, fdtv->subunit, fdtv->isochannel);
48 fdtv->isochannel = -1;
49 return 0;
50}
51
52#define LNBCONTROL_DONTCARE 0xff
53
54static int fdtv_diseqc_send_master_cmd(struct dvb_frontend *fe,
55 struct dvb_diseqc_master_cmd *cmd)
56{
57 struct firedtv *fdtv = fe->sec_priv;
58
59 return avc_lnb_control(fdtv, LNBCONTROL_DONTCARE, LNBCONTROL_DONTCARE,
60 LNBCONTROL_DONTCARE, 1, cmd);
61}
62
63static int fdtv_diseqc_send_burst(struct dvb_frontend *fe,
64 fe_sec_mini_cmd_t minicmd)
65{
66 return 0;
67}
68
69static int fdtv_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
70{
71 struct firedtv *fdtv = fe->sec_priv;
72
73 fdtv->tone = tone;
74 return 0;
75}
76
77static int fdtv_set_voltage(struct dvb_frontend *fe,
78 fe_sec_voltage_t voltage)
79{
80 struct firedtv *fdtv = fe->sec_priv;
81
82 fdtv->voltage = voltage;
83 return 0;
84}
85
86static int fdtv_read_status(struct dvb_frontend *fe, fe_status_t *status)
87{
88 struct firedtv *fdtv = fe->sec_priv;
89 struct firedtv_tuner_status stat;
90
91 if (avc_tuner_status(fdtv, &stat))
92 return -EINVAL;
93
94 if (stat.no_rf)
95 *status = 0;
96 else
97 *status = FE_HAS_SIGNAL | FE_HAS_VITERBI | FE_HAS_SYNC |
98 FE_HAS_CARRIER | FE_HAS_LOCK;
99 return 0;
100}
101
102static int fdtv_read_ber(struct dvb_frontend *fe, u32 *ber)
103{
104 struct firedtv *fdtv = fe->sec_priv;
105 struct firedtv_tuner_status stat;
106
107 if (avc_tuner_status(fdtv, &stat))
108 return -EINVAL;
109
110 *ber = stat.ber;
111 return 0;
112}
113
114static int fdtv_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
115{
116 struct firedtv *fdtv = fe->sec_priv;
117 struct firedtv_tuner_status stat;
118
119 if (avc_tuner_status(fdtv, &stat))
120 return -EINVAL;
121
122 *strength = stat.signal_strength << 8;
123 return 0;
124}
125
126static int fdtv_read_snr(struct dvb_frontend *fe, u16 *snr)
127{
128 struct firedtv *fdtv = fe->sec_priv;
129 struct firedtv_tuner_status stat;
130
131 if (avc_tuner_status(fdtv, &stat))
132 return -EINVAL;
133
134 /* C/N[dB] = -10 * log10(snr / 65535) */
135 *snr = stat.carrier_noise_ratio * 257;
136 return 0;
137}
138
139static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
140{
141 return -EOPNOTSUPP;
142}
143
144#define ACCEPTED 0x9
145
146static int fdtv_set_frontend(struct dvb_frontend *fe,
147 struct dvb_frontend_parameters *params)
148{
149 struct firedtv *fdtv = fe->sec_priv;
150
151 /* FIXME: avc_tuner_dsd never returns ACCEPTED. Check status? */
152 if (avc_tuner_dsd(fdtv, params) != ACCEPTED)
153 return -EINVAL;
154 else
155 return 0; /* not sure of this... */
156}
157
158static int fdtv_get_frontend(struct dvb_frontend *fe,
159 struct dvb_frontend_parameters *params)
160{
161 return -EOPNOTSUPP;
162}
163
164void fdtv_frontend_init(struct firedtv *fdtv)
165{
166 struct dvb_frontend_ops *ops = &fdtv->fe.ops;
167 struct dvb_frontend_info *fi = &ops->info;
168
169 ops->init = fdtv_dvb_init;
170 ops->sleep = fdtv_sleep;
171
172 ops->set_frontend = fdtv_set_frontend;
173 ops->get_frontend = fdtv_get_frontend;
174
175 ops->read_status = fdtv_read_status;
176 ops->read_ber = fdtv_read_ber;
177 ops->read_signal_strength = fdtv_read_signal_strength;
178 ops->read_snr = fdtv_read_snr;
179 ops->read_ucblocks = fdtv_read_uncorrected_blocks;
180
181 ops->diseqc_send_master_cmd = fdtv_diseqc_send_master_cmd;
182 ops->diseqc_send_burst = fdtv_diseqc_send_burst;
183 ops->set_tone = fdtv_set_tone;
184 ops->set_voltage = fdtv_set_voltage;
185
186 switch (fdtv->type) {
187 case FIREDTV_DVB_S:
188 case FIREDTV_DVB_S2:
189 fi->type = FE_QPSK;
190
191 fi->frequency_min = 950000;
192 fi->frequency_max = 2150000;
193 fi->frequency_stepsize = 125;
194 fi->symbol_rate_min = 1000000;
195 fi->symbol_rate_max = 40000000;
196
197 fi->caps = FE_CAN_INVERSION_AUTO |
198 FE_CAN_FEC_1_2 |
199 FE_CAN_FEC_2_3 |
200 FE_CAN_FEC_3_4 |
201 FE_CAN_FEC_5_6 |
202 FE_CAN_FEC_7_8 |
203 FE_CAN_FEC_AUTO |
204 FE_CAN_QPSK;
205 break;
206
207 case FIREDTV_DVB_C:
208 fi->type = FE_QAM;
209
210 fi->frequency_min = 47000000;
211 fi->frequency_max = 866000000;
212 fi->frequency_stepsize = 62500;
213 fi->symbol_rate_min = 870000;
214 fi->symbol_rate_max = 6900000;
215
216 fi->caps = FE_CAN_INVERSION_AUTO |
217 FE_CAN_QAM_16 |
218 FE_CAN_QAM_32 |
219 FE_CAN_QAM_64 |
220 FE_CAN_QAM_128 |
221 FE_CAN_QAM_256 |
222 FE_CAN_QAM_AUTO;
223 break;
224
225 case FIREDTV_DVB_T:
226 fi->type = FE_OFDM;
227
228 fi->frequency_min = 49000000;
229 fi->frequency_max = 861000000;
230 fi->frequency_stepsize = 62500;
231
232 fi->caps = FE_CAN_INVERSION_AUTO |
233 FE_CAN_FEC_2_3 |
234 FE_CAN_TRANSMISSION_MODE_AUTO |
235 FE_CAN_GUARD_INTERVAL_AUTO |
236 FE_CAN_HIERARCHY_AUTO;
237 break;
238
239 default:
240 dev_err(fdtv->device, "no frontend for model type %d\n",
241 fdtv->type);
242 }
243 strcpy(fi->name, fdtv_model_names[fdtv->type]);
244
245 fdtv->fe.dvb = &fdtv->adapter;
246 fdtv->fe.sec_priv = fdtv;
247}
diff --git a/drivers/media/dvb/firewire/firedtv-rc.c b/drivers/media/dvb/firewire/firedtv-rc.c
new file mode 100644
index 000000000000..46a6324d7b73
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-rc.c
@@ -0,0 +1,190 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 */
11
12#include <linux/bitops.h>
13#include <linux/input.h>
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <linux/types.h>
17
18#include "firedtv.h"
19
20/* fixed table with older keycodes, geared towards MythTV */
21const static u16 oldtable[] = {
22
23 /* code from device: 0x4501...0x451f */
24
25 KEY_ESC,
26 KEY_F9,
27 KEY_1,
28 KEY_2,
29 KEY_3,
30 KEY_4,
31 KEY_5,
32 KEY_6,
33 KEY_7,
34 KEY_8,
35 KEY_9,
36 KEY_I,
37 KEY_0,
38 KEY_ENTER,
39 KEY_RED,
40 KEY_UP,
41 KEY_GREEN,
42 KEY_F10,
43 KEY_SPACE,
44 KEY_F11,
45 KEY_YELLOW,
46 KEY_DOWN,
47 KEY_BLUE,
48 KEY_Z,
49 KEY_P,
50 KEY_PAGEDOWN,
51 KEY_LEFT,
52 KEY_W,
53 KEY_RIGHT,
54 KEY_P,
55 KEY_M,
56
57 /* code from device: 0x4540...0x4542 */
58
59 KEY_R,
60 KEY_V,
61 KEY_C,
62};
63
64/* user-modifiable table for a remote as sold in 2008 */
65const static u16 keytable[] = {
66
67 /* code from device: 0x0300...0x031f */
68
69 [0x00] = KEY_POWER,
70 [0x01] = KEY_SLEEP,
71 [0x02] = KEY_STOP,
72 [0x03] = KEY_OK,
73 [0x04] = KEY_RIGHT,
74 [0x05] = KEY_1,
75 [0x06] = KEY_2,
76 [0x07] = KEY_3,
77 [0x08] = KEY_LEFT,
78 [0x09] = KEY_4,
79 [0x0a] = KEY_5,
80 [0x0b] = KEY_6,
81 [0x0c] = KEY_UP,
82 [0x0d] = KEY_7,
83 [0x0e] = KEY_8,
84 [0x0f] = KEY_9,
85 [0x10] = KEY_DOWN,
86 [0x11] = KEY_TITLE, /* "OSD" - fixme */
87 [0x12] = KEY_0,
88 [0x13] = KEY_F20, /* "16:9" - fixme */
89 [0x14] = KEY_SCREEN, /* "FULL" - fixme */
90 [0x15] = KEY_MUTE,
91 [0x16] = KEY_SUBTITLE,
92 [0x17] = KEY_RECORD,
93 [0x18] = KEY_TEXT,
94 [0x19] = KEY_AUDIO,
95 [0x1a] = KEY_RED,
96 [0x1b] = KEY_PREVIOUS,
97 [0x1c] = KEY_REWIND,
98 [0x1d] = KEY_PLAYPAUSE,
99 [0x1e] = KEY_NEXT,
100 [0x1f] = KEY_VOLUMEUP,
101
102 /* code from device: 0x0340...0x0354 */
103
104 [0x20] = KEY_CHANNELUP,
105 [0x21] = KEY_F21, /* "4:3" - fixme */
106 [0x22] = KEY_TV,
107 [0x23] = KEY_DVD,
108 [0x24] = KEY_VCR,
109 [0x25] = KEY_AUX,
110 [0x26] = KEY_GREEN,
111 [0x27] = KEY_YELLOW,
112 [0x28] = KEY_BLUE,
113 [0x29] = KEY_CHANNEL, /* "CH.LIST" */
114 [0x2a] = KEY_VENDOR, /* "CI" - fixme */
115 [0x2b] = KEY_VOLUMEDOWN,
116 [0x2c] = KEY_CHANNELDOWN,
117 [0x2d] = KEY_LAST,
118 [0x2e] = KEY_INFO,
119 [0x2f] = KEY_FORWARD,
120 [0x30] = KEY_LIST,
121 [0x31] = KEY_FAVORITES,
122 [0x32] = KEY_MENU,
123 [0x33] = KEY_EPG,
124 [0x34] = KEY_EXIT,
125};
126
127int fdtv_register_rc(struct firedtv *fdtv, struct device *dev)
128{
129 struct input_dev *idev;
130 int i, err;
131
132 idev = input_allocate_device();
133 if (!idev)
134 return -ENOMEM;
135
136 fdtv->remote_ctrl_dev = idev;
137 idev->name = "FireDTV remote control";
138 idev->dev.parent = dev;
139 idev->evbit[0] = BIT_MASK(EV_KEY);
140 idev->keycode = kmemdup(keytable, sizeof(keytable), GFP_KERNEL);
141 if (!idev->keycode) {
142 err = -ENOMEM;
143 goto fail;
144 }
145 idev->keycodesize = sizeof(keytable[0]);
146 idev->keycodemax = ARRAY_SIZE(keytable);
147
148 for (i = 0; i < ARRAY_SIZE(keytable); i++)
149 set_bit(keytable[i], idev->keybit);
150
151 err = input_register_device(idev);
152 if (err)
153 goto fail_free_keymap;
154
155 return 0;
156
157fail_free_keymap:
158 kfree(idev->keycode);
159fail:
160 input_free_device(idev);
161 return err;
162}
163
164void fdtv_unregister_rc(struct firedtv *fdtv)
165{
166 kfree(fdtv->remote_ctrl_dev->keycode);
167 input_unregister_device(fdtv->remote_ctrl_dev);
168}
169
170void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
171{
172 u16 *keycode = fdtv->remote_ctrl_dev->keycode;
173
174 if (code >= 0x0300 && code <= 0x031f)
175 code = keycode[code - 0x0300];
176 else if (code >= 0x0340 && code <= 0x0354)
177 code = keycode[code - 0x0320];
178 else if (code >= 0x4501 && code <= 0x451f)
179 code = oldtable[code - 0x4501];
180 else if (code >= 0x4540 && code <= 0x4542)
181 code = oldtable[code - 0x4521];
182 else {
183 printk(KERN_DEBUG "firedtv: invalid key code 0x%04x "
184 "from remote control\n", code);
185 return;
186 }
187
188 input_report_key(fdtv->remote_ctrl_dev, code, 1);
189 input_report_key(fdtv->remote_ctrl_dev, code, 0);
190}
diff --git a/drivers/media/dvb/firewire/firedtv.h b/drivers/media/dvb/firewire/firedtv.h
new file mode 100644
index 000000000000..d48530b81e61
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv.h
@@ -0,0 +1,182 @@
1/*
2 * FireDTV driver (formerly known as FireSAT)
3 *
4 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 */
12
13#ifndef _FIREDTV_H
14#define _FIREDTV_H
15
16#include <linux/dvb/dmx.h>
17#include <linux/dvb/frontend.h>
18#include <linux/list.h>
19#include <linux/mutex.h>
20#include <linux/spinlock_types.h>
21#include <linux/types.h>
22#include <linux/wait.h>
23#include <linux/workqueue.h>
24
25#include <demux.h>
26#include <dmxdev.h>
27#include <dvb_demux.h>
28#include <dvb_frontend.h>
29#include <dvb_net.h>
30#include <dvbdev.h>
31
32struct firedtv_tuner_status {
33 unsigned active_system:8;
34 unsigned searching:1;
35 unsigned moving:1;
36 unsigned no_rf:1;
37 unsigned input:1;
38 unsigned selected_antenna:7;
39 unsigned ber:32;
40 unsigned signal_strength:8;
41 unsigned raster_frequency:2;
42 unsigned rf_frequency:22;
43 unsigned man_dep_info_length:8;
44 unsigned front_end_error:1;
45 unsigned antenna_error:1;
46 unsigned front_end_power_status:1;
47 unsigned power_supply:1;
48 unsigned carrier_noise_ratio:16;
49 unsigned power_supply_voltage:8;
50 unsigned antenna_voltage:8;
51 unsigned firewire_bus_voltage:8;
52 unsigned ca_mmi:1;
53 unsigned ca_pmt_reply:1;
54 unsigned ca_date_time_request:1;
55 unsigned ca_application_info:1;
56 unsigned ca_module_present_status:1;
57 unsigned ca_dvb_flag:1;
58 unsigned ca_error_flag:1;
59 unsigned ca_initialization_status:1;
60};
61
62enum model_type {
63 FIREDTV_UNKNOWN = 0,
64 FIREDTV_DVB_S = 1,
65 FIREDTV_DVB_C = 2,
66 FIREDTV_DVB_T = 3,
67 FIREDTV_DVB_S2 = 4,
68};
69
70struct device;
71struct input_dev;
72struct firedtv;
73
74struct firedtv_backend {
75 int (*lock)(struct firedtv *fdtv, u64 addr, void *data, __be32 arg);
76 int (*read)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
77 int (*write)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
78 int (*start_iso)(struct firedtv *fdtv);
79 void (*stop_iso)(struct firedtv *fdtv);
80};
81
82struct firedtv {
83 struct device *device;
84 struct list_head list;
85
86 struct dvb_adapter adapter;
87 struct dmxdev dmxdev;
88 struct dvb_demux demux;
89 struct dmx_frontend frontend;
90 struct dvb_net dvbnet;
91 struct dvb_frontend fe;
92
93 struct dvb_device *cadev;
94 int ca_last_command;
95 int ca_time_interval;
96
97 struct mutex avc_mutex;
98 wait_queue_head_t avc_wait;
99 bool avc_reply_received;
100 struct work_struct remote_ctrl_work;
101 struct input_dev *remote_ctrl_dev;
102
103 enum model_type type;
104 char subunit;
105 char isochannel;
106 fe_sec_voltage_t voltage;
107 fe_sec_tone_mode_t tone;
108
109 const struct firedtv_backend *backend;
110 void *backend_data;
111
112 struct mutex demux_mutex;
113 unsigned long channel_active;
114 u16 channel_pid[16];
115
116 size_t response_length;
117 u8 response[512];
118};
119
120/* firedtv-1394.c */
121#ifdef CONFIG_DVB_FIREDTV_IEEE1394
122int fdtv_1394_init(struct ieee1394_device_id id_table[]);
123void fdtv_1394_exit(void);
124#else
125static inline int fdtv_1394_init(struct ieee1394_device_id it[]) { return 0; }
126static inline void fdtv_1394_exit(void) {}
127#endif
128
129/* firedtv-avc.c */
130int avc_recv(struct firedtv *fdtv, void *data, size_t length);
131int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
132struct dvb_frontend_parameters;
133int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params);
134int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
135int avc_tuner_get_ts(struct firedtv *fdtv);
136int avc_identify_subunit(struct firedtv *fdtv);
137struct dvb_diseqc_master_cmd;
138int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
139 char conttone, char nrdiseq,
140 struct dvb_diseqc_master_cmd *diseqcmd);
141void avc_remote_ctrl_work(struct work_struct *work);
142int avc_register_remote_control(struct firedtv *fdtv);
143int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
144int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
145int avc_ca_reset(struct firedtv *fdtv);
146int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
147int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
148int avc_ca_enter_menu(struct firedtv *fdtv);
149int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len);
150int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel);
151void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel);
152
153/* firedtv-ci.c */
154int fdtv_ca_register(struct firedtv *fdtv);
155void fdtv_ca_release(struct firedtv *fdtv);
156
157/* firedtv-dvb.c */
158int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
159int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
160int fdtv_dvb_register(struct firedtv *fdtv);
161void fdtv_dvb_unregister(struct firedtv *fdtv);
162struct firedtv *fdtv_alloc(struct device *dev,
163 const struct firedtv_backend *backend,
164 const char *name, size_t name_len);
165extern const char *fdtv_model_names[];
166
167/* firedtv-fe.c */
168void fdtv_frontend_init(struct firedtv *fdtv);
169
170/* firedtv-rc.c */
171#ifdef CONFIG_DVB_FIREDTV_INPUT
172int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
173void fdtv_unregister_rc(struct firedtv *fdtv);
174void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
175#else
176static inline int fdtv_register_rc(struct firedtv *fdtv,
177 struct device *dev) { return 0; }
178static inline void fdtv_unregister_rc(struct firedtv *fdtv) {}
179static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {}
180#endif
181
182#endif /* _FIREDTV_H */
diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c
index a67d1775a43c..2da55ec20392 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -156,7 +156,7 @@ static void stb0899_first_subrange(struct stb0899_state *state)
156 } 156 }
157 157
158 if (range > 0) 158 if (range > 0)
159 internal->sub_range = MIN(internal->srch_range, range); 159 internal->sub_range = min(internal->srch_range, range);
160 else 160 else
161 internal->sub_range = 0; 161 internal->sub_range = 0;
162 162
@@ -185,7 +185,7 @@ static enum stb0899_status stb0899_check_tmg(struct stb0899_state *state)
185 timing = stb0899_read_reg(state, STB0899_RTF); 185 timing = stb0899_read_reg(state, STB0899_RTF);
186 186
187 if (lock >= 42) { 187 if (lock >= 42) {
188 if ((lock > 48) && (ABS(timing) >= 110)) { 188 if ((lock > 48) && (abs(timing) >= 110)) {
189 internal->status = ANALOGCARRIER; 189 internal->status = ANALOGCARRIER;
190 dprintk(state->verbose, FE_DEBUG, 1, "-->ANALOG Carrier !"); 190 dprintk(state->verbose, FE_DEBUG, 1, "-->ANALOG Carrier !");
191 } else { 191 } else {
@@ -222,7 +222,7 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state)
222 index++; 222 index++;
223 derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ 223 derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */
224 224
225 if (ABS(derot_freq) > derot_limit) 225 if (abs(derot_freq) > derot_limit)
226 next_loop--; 226 next_loop--;
227 227
228 if (next_loop) { 228 if (next_loop) {
@@ -298,7 +298,7 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state)
298 last_derot_freq = derot_freq; 298 last_derot_freq = derot_freq;
299 derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ 299 derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */
300 300
301 if(ABS(derot_freq) > derot_limit) 301 if(abs(derot_freq) > derot_limit)
302 next_loop--; 302 next_loop--;
303 303
304 if (next_loop) { 304 if (next_loop) {
@@ -400,7 +400,7 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state)
400 if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { 400 if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) {
401 401
402 derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ 402 derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */
403 if (ABS(derot_freq) > derot_limit) 403 if (abs(derot_freq) > derot_limit)
404 next_loop--; 404 next_loop--;
405 405
406 if (next_loop) { 406 if (next_loop) {
@@ -467,7 +467,7 @@ static void next_sub_range(struct stb0899_state *state)
467 467
468 if (internal->sub_dir > 0) { 468 if (internal->sub_dir > 0) {
469 old_sub_range = internal->sub_range; 469 old_sub_range = internal->sub_range;
470 internal->sub_range = MIN((internal->srch_range / 2) - 470 internal->sub_range = min((internal->srch_range / 2) -
471 (internal->tuner_offst + internal->sub_range / 2), 471 (internal->tuner_offst + internal->sub_range / 2),
472 internal->sub_range); 472 internal->sub_range);
473 473
@@ -771,7 +771,7 @@ static long Log2Int(int number)
771 int i; 771 int i;
772 772
773 i = 0; 773 i = 0;
774 while ((1 << i) <= ABS(number)) 774 while ((1 << i) <= abs(number))
775 i++; 775 i++;
776 776
777 if (number == 0) 777 if (number == 0)
diff --git a/drivers/media/dvb/frontends/stb0899_drv.c b/drivers/media/dvb/frontends/stb0899_drv.c
index 10613acf18f5..a04c782fff8d 100644
--- a/drivers/media/dvb/frontends/stb0899_drv.c
+++ b/drivers/media/dvb/frontends/stb0899_drv.c
@@ -794,7 +794,7 @@ static int stb0899_send_diseqc_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t
794 reg = stb0899_read_reg(state, STB0899_DISCNTRL1); 794 reg = stb0899_read_reg(state, STB0899_DISCNTRL1);
795 old_state = reg; 795 old_state = reg;
796 /* set to burst mode */ 796 /* set to burst mode */
797 STB0899_SETFIELD_VAL(DISEQCMODE, reg, 0x02); 797 STB0899_SETFIELD_VAL(DISEQCMODE, reg, 0x03);
798 STB0899_SETFIELD_VAL(DISPRECHARGE, reg, 0x01); 798 STB0899_SETFIELD_VAL(DISPRECHARGE, reg, 0x01);
799 stb0899_write_reg(state, STB0899_DISCNTRL1, reg); 799 stb0899_write_reg(state, STB0899_DISCNTRL1, reg);
800 switch (burst) { 800 switch (burst) {
diff --git a/drivers/media/dvb/frontends/stb0899_priv.h b/drivers/media/dvb/frontends/stb0899_priv.h
index 24619e3689db..82395b912815 100644
--- a/drivers/media/dvb/frontends/stb0899_priv.h
+++ b/drivers/media/dvb/frontends/stb0899_priv.h
@@ -59,10 +59,6 @@
59#define MAKEWORD32(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) 59#define MAKEWORD32(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
60#define MAKEWORD16(a, b) (((a) << 8) | (b)) 60#define MAKEWORD16(a, b) (((a) << 8) | (b))
61 61
62#define MIN(x, y) ((x) <= (y) ? (x) : (y))
63#define MAX(x, y) ((x) >= (y) ? (x) : (y))
64#define ABS(x) ((x) >= 0 ? (x) : -(x))
65
66#define LSB(x) ((x & 0xff)) 62#define LSB(x) ((x & 0xff))
67#define MSB(y) ((y >> 8) & 0xff) 63#define MSB(y) ((y >> 8) & 0xff)
68 64
@@ -168,10 +164,10 @@ struct stb0899_internal {
168 u32 freq; /* Demod internal Frequency */ 164 u32 freq; /* Demod internal Frequency */
169 u32 srate; /* Demod internal Symbol rate */ 165 u32 srate; /* Demod internal Symbol rate */
170 enum stb0899_fec fecrate; /* Demod internal FEC rate */ 166 enum stb0899_fec fecrate; /* Demod internal FEC rate */
171 u32 srch_range; /* Demod internal Search Range */ 167 s32 srch_range; /* Demod internal Search Range */
172 u32 sub_range; /* Demod current sub range (Hz) */ 168 s32 sub_range; /* Demod current sub range (Hz) */
173 u32 tuner_step; /* Tuner step (Hz) */ 169 s32 tuner_step; /* Tuner step (Hz) */
174 u32 tuner_offst; /* Relative offset to carrier (Hz) */ 170 s32 tuner_offst; /* Relative offset to carrier (Hz) */
175 u32 tuner_bw; /* Current bandwidth of the tuner (Hz) */ 171 u32 tuner_bw; /* Current bandwidth of the tuner (Hz) */
176 172
177 s32 mclk; /* Masterclock Divider factor (binary) */ 173 s32 mclk; /* Masterclock Divider factor (binary) */
diff --git a/drivers/media/dvb/frontends/stb6100.c b/drivers/media/dvb/frontends/stb6100.c
index ff39275ab49c..1ed5a7db4c5e 100644
--- a/drivers/media/dvb/frontends/stb6100.c
+++ b/drivers/media/dvb/frontends/stb6100.c
@@ -427,11 +427,11 @@ static int stb6100_init(struct dvb_frontend *fe)
427 status->refclock = 27000000; /* Hz */ 427 status->refclock = 27000000; /* Hz */
428 status->iqsense = 1; 428 status->iqsense = 1;
429 status->bandwidth = 36000; /* kHz */ 429 status->bandwidth = 36000; /* kHz */
430 state->bandwidth = status->bandwidth * 1000; /* MHz */ 430 state->bandwidth = status->bandwidth * 1000; /* Hz */
431 state->reference = status->refclock / 1000; /* kHz */ 431 state->reference = status->refclock / 1000; /* kHz */
432 432
433 /* Set default bandwidth. */ 433 /* Set default bandwidth. */
434 return stb6100_set_bandwidth(fe, status->bandwidth); 434 return stb6100_set_bandwidth(fe, state->bandwidth);
435} 435}
436 436
437static int stb6100_get_state(struct dvb_frontend *fe, 437static int stb6100_get_state(struct dvb_frontend *fe,
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
index 170720b02815..b150ed306696 100644
--- a/drivers/media/dvb/frontends/zl10353.c
+++ b/drivers/media/dvb/frontends/zl10353.c
@@ -590,7 +590,7 @@ static int zl10353_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
590 struct zl10353_state *state = fe->demodulator_priv; 590 struct zl10353_state *state = fe->demodulator_priv;
591 u8 val = 0x0a; 591 u8 val = 0x0a;
592 592
593 if (state->config.no_tuner) { 593 if (state->config.disable_i2c_gate_ctrl) {
594 /* No tuner attached to the internal I2C bus */ 594 /* No tuner attached to the internal I2C bus */
595 /* If set enable I2C bridge, the main I2C bus stopped hardly */ 595 /* If set enable I2C bridge, the main I2C bus stopped hardly */
596 return 0; 596 return 0;
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h
index fdbb88ff75fe..2287bac46243 100644
--- a/drivers/media/dvb/frontends/zl10353.h
+++ b/drivers/media/dvb/frontends/zl10353.h
@@ -38,6 +38,9 @@ struct zl10353_config
38 38
39 /* set if parallel ts output is required */ 39 /* set if parallel ts output is required */
40 int parallel_ts; 40 int parallel_ts;
41
42 /* set if i2c_gate_ctrl disable is required */
43 u8 disable_i2c_gate_ctrl:1;
41}; 44};
42 45
43#if defined(CONFIG_DVB_ZL10353) || (defined(CONFIG_DVB_ZL10353_MODULE) && defined(MODULE)) 46#if defined(CONFIG_DVB_ZL10353) || (defined(CONFIG_DVB_ZL10353_MODULE) && defined(MODULE))
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c
index 67cbce82cb91..4dfed6aa2dbc 100644
--- a/drivers/media/radio/radio-si470x.c
+++ b/drivers/media/radio/radio-si470x.c
@@ -98,11 +98,16 @@
98 * - blacklisted KWorld radio in hid-core.c and hid-ids.h 98 * - blacklisted KWorld radio in hid-core.c and hid-ids.h
99 * 2008-12-03 Mark Lord <mlord@pobox.com> 99 * 2008-12-03 Mark Lord <mlord@pobox.com>
100 * - add support for DealExtreme USB Radio 100 * - add support for DealExtreme USB Radio
101 * 2009-01-31 Bob Ross <pigiron@gmx.com>
102 * - correction of stereo detection/setting
103 * - correction of signal strength indicator scaling
104 * 2009-01-31 Rick Bronson <rick@efn.org>
105 * Tobias Lorenz <tobias.lorenz@gmx.net>
106 * - add LED status output
101 * 107 *
102 * ToDo: 108 * ToDo:
103 * - add firmware download/update support 109 * - add firmware download/update support
104 * - RDS support: interrupt mode, instead of polling 110 * - RDS support: interrupt mode, instead of polling
105 * - add LED status output (check if that's not already done in firmware)
106 */ 111 */
107 112
108 113
@@ -882,6 +887,30 @@ static int si470x_rds_on(struct si470x_device *radio)
882 887
883 888
884/************************************************************************** 889/**************************************************************************
890 * General Driver Functions - LED_REPORT
891 **************************************************************************/
892
893/*
894 * si470x_set_led_state - sets the led state
895 */
896static int si470x_set_led_state(struct si470x_device *radio,
897 unsigned char led_state)
898{
899 unsigned char buf[LED_REPORT_SIZE];
900 int retval;
901
902 buf[0] = LED_REPORT;
903 buf[1] = LED_COMMAND;
904 buf[2] = led_state;
905
906 retval = si470x_set_report(radio, (void *) &buf, sizeof(buf));
907
908 return (retval < 0) ? -EINVAL : 0;
909}
910
911
912
913/**************************************************************************
885 * RDS Driver Functions 914 * RDS Driver Functions
886 **************************************************************************/ 915 **************************************************************************/
887 916
@@ -1385,20 +1414,22 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
1385 }; 1414 };
1386 1415
1387 /* stereo indicator == stereo (instead of mono) */ 1416 /* stereo indicator == stereo (instead of mono) */
1388 if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1) 1417 if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 0)
1389 tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
1390 else
1391 tuner->rxsubchans = V4L2_TUNER_SUB_MONO; 1418 tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
1419 else
1420 tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
1392 1421
1393 /* mono/stereo selector */ 1422 /* mono/stereo selector */
1394 if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1) 1423 if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0)
1395 tuner->audmode = V4L2_TUNER_MODE_MONO;
1396 else
1397 tuner->audmode = V4L2_TUNER_MODE_STEREO; 1424 tuner->audmode = V4L2_TUNER_MODE_STEREO;
1425 else
1426 tuner->audmode = V4L2_TUNER_MODE_MONO;
1398 1427
1399 /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ 1428 /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */
1400 tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI) 1429 /* measured in units of dbµV in 1 db increments (max at ~75 dbµV) */
1401 * 0x0101; 1430 tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI);
1431 /* the ideal factor is 0xffff/75 = 873,8 */
1432 tuner->signal = (tuner->signal * 873) + (8 * tuner->signal / 10);
1402 1433
1403 /* automatic frequency control: -1: freq to low, 1 freq to high */ 1434 /* automatic frequency control: -1: freq to low, 1 freq to high */
1404 /* AFCRL does only indicate that freq. differs, not if too low/high */ 1435 /* AFCRL does only indicate that freq. differs, not if too low/high */
@@ -1632,6 +1663,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
1632 /* set initial frequency */ 1663 /* set initial frequency */
1633 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ 1664 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
1634 1665
1666 /* set led to connect state */
1667 si470x_set_led_state(radio, BLINK_GREEN_LED);
1668
1635 /* rds buffer allocation */ 1669 /* rds buffer allocation */
1636 radio->buf_size = rds_buf * 3; 1670 radio->buf_size = rds_buf * 3;
1637 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); 1671 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
@@ -1715,6 +1749,9 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
1715 cancel_delayed_work_sync(&radio->work); 1749 cancel_delayed_work_sync(&radio->work);
1716 usb_set_intfdata(intf, NULL); 1750 usb_set_intfdata(intf, NULL);
1717 if (radio->users == 0) { 1751 if (radio->users == 0) {
1752 /* set led to disconnect state */
1753 si470x_set_led_state(radio, BLINK_ORANGE_LED);
1754
1718 video_unregister_device(radio->videodev); 1755 video_unregister_device(radio->videodev);
1719 kfree(radio->buffer); 1756 kfree(radio->buffer);
1720 kfree(radio); 1757 kfree(radio);
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 5d882a44e3ee..2ac738fa6a07 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -463,6 +463,8 @@ static int em28xx_audio_init(struct em28xx *dev)
463 pcm->info_flags = 0; 463 pcm->info_flags = 0;
464 pcm->private_data = dev; 464 pcm->private_data = dev;
465 strcpy(pcm->name, "Empia 28xx Capture"); 465 strcpy(pcm->name, "Empia 28xx Capture");
466
467 snd_card_set_dev(card, &dev->udev->dev);
466 strcpy(card->driver, "Empia Em28xx Audio"); 468 strcpy(card->driver, "Empia Em28xx Audio");
467 strcpy(card->shortname, "Em28xx Audio"); 469 strcpy(card->shortname, "Em28xx Audio");
468 strcpy(card->longname, "Empia Em28xx Audio"); 470 strcpy(card->longname, "Empia Em28xx Audio");
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 2ed24527ecd6..65e4901f4db7 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -422,6 +422,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
422 if (urb == NULL) 422 if (urb == NULL)
423 break; 423 break;
424 424
425 BUG_ON(!gspca_dev->dev);
425 gspca_dev->urb[i] = NULL; 426 gspca_dev->urb[i] = NULL;
426 if (!gspca_dev->present) 427 if (!gspca_dev->present)
427 usb_kill_urb(urb); 428 usb_kill_urb(urb);
@@ -1950,8 +1951,12 @@ void gspca_disconnect(struct usb_interface *intf)
1950{ 1951{
1951 struct gspca_dev *gspca_dev = usb_get_intfdata(intf); 1952 struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
1952 1953
1954 mutex_lock(&gspca_dev->usb_lock);
1953 gspca_dev->present = 0; 1955 gspca_dev->present = 0;
1956 mutex_unlock(&gspca_dev->usb_lock);
1954 1957
1958 destroy_urbs(gspca_dev);
1959 gspca_dev->dev = NULL;
1955 usb_set_intfdata(intf, NULL); 1960 usb_set_intfdata(intf, NULL);
1956 1961
1957 /* release the device */ 1962 /* release the device */
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index e564a61a72d7..48892b5715d5 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -102,7 +102,11 @@ int s5k4aa_probe(struct sd *sd)
102 } 102 }
103 103
104 /* Test some registers, but we don't know their exact meaning yet */ 104 /* Test some registers, but we don't know their exact meaning yet */
105 if (m5602_read_sensor(sd, 0x00, prod_id, sizeof(prod_id))) 105 if (m5602_read_sensor(sd, 0x00, prod_id, 2))
106 return -ENODEV;
107 if (m5602_read_sensor(sd, 0x02, prod_id+2, 2))
108 return -ENODEV;
109 if (m5602_read_sensor(sd, 0x04, prod_id+4, 2))
106 return -ENODEV; 110 return -ENODEV;
107 111
108 if (memcmp(prod_id, expected_prod_id, sizeof(prod_id))) 112 if (memcmp(prod_id, expected_prod_id, sizeof(prod_id)))
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index f6b3ef6e691b..c13bd2aa0bea 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -393,7 +393,7 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo
393 return 0; 393 return 0;
394 } 394 }
395 395
396 v4l2_subdev_call(itv->sd_video, video, s_fmt, fmt); 396 v4l2_subdev_call(itv->sd_video, video, g_fmt, fmt);
397 vbifmt->service_set = ivtv_get_service_set(vbifmt); 397 vbifmt->service_set = ivtv_get_service_set(vbifmt);
398 return 0; 398 return 0;
399} 399}
@@ -1748,6 +1748,18 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg)
1748 break; 1748 break;
1749 } 1749 }
1750 1750
1751 case IVTV_IOC_DMA_FRAME:
1752 case VIDEO_GET_PTS:
1753 case VIDEO_GET_FRAME_COUNT:
1754 case VIDEO_GET_EVENT:
1755 case VIDEO_PLAY:
1756 case VIDEO_STOP:
1757 case VIDEO_FREEZE:
1758 case VIDEO_CONTINUE:
1759 case VIDEO_COMMAND:
1760 case VIDEO_TRY_COMMAND:
1761 return ivtv_decoder_ioctls(file, cmd, (void *)arg);
1762
1751 default: 1763 default:
1752 return -EINVAL; 1764 return -EINVAL;
1753 } 1765 }
@@ -1790,18 +1802,6 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
1790 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); 1802 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
1791 return 0; 1803 return 0;
1792 1804
1793 case IVTV_IOC_DMA_FRAME:
1794 case VIDEO_GET_PTS:
1795 case VIDEO_GET_FRAME_COUNT:
1796 case VIDEO_GET_EVENT:
1797 case VIDEO_PLAY:
1798 case VIDEO_STOP:
1799 case VIDEO_FREEZE:
1800 case VIDEO_CONTINUE:
1801 case VIDEO_COMMAND:
1802 case VIDEO_TRY_COMMAND:
1803 return ivtv_decoder_ioctls(filp, cmd, (void *)arg);
1804
1805 default: 1805 default:
1806 break; 1806 break;
1807 } 1807 }
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index a1d6008efcbb..07c334f25aae 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -1155,23 +1155,23 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
1155{ 1155{
1156 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 1156 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
1157 struct pxa_camera_dev *pcdev = ici->priv; 1157 struct pxa_camera_dev *pcdev = ici->priv;
1158 const struct soc_camera_data_format *host_fmt, *cam_fmt = NULL; 1158 const struct soc_camera_data_format *cam_fmt = NULL;
1159 const struct soc_camera_format_xlate *xlate; 1159 const struct soc_camera_format_xlate *xlate = NULL;
1160 struct soc_camera_sense sense = { 1160 struct soc_camera_sense sense = {
1161 .master_clock = pcdev->mclk, 1161 .master_clock = pcdev->mclk,
1162 .pixel_clock_max = pcdev->ciclk / 4, 1162 .pixel_clock_max = pcdev->ciclk / 4,
1163 }; 1163 };
1164 int ret, buswidth; 1164 int ret;
1165 1165
1166 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1166 if (pixfmt) {
1167 if (!xlate) { 1167 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
1168 dev_warn(&ici->dev, "Format %x not found\n", pixfmt); 1168 if (!xlate) {
1169 return -EINVAL; 1169 dev_warn(&ici->dev, "Format %x not found\n", pixfmt);
1170 } 1170 return -EINVAL;
1171 }
1171 1172
1172 buswidth = xlate->buswidth; 1173 cam_fmt = xlate->cam_fmt;
1173 host_fmt = xlate->host_fmt; 1174 }
1174 cam_fmt = xlate->cam_fmt;
1175 1175
1176 /* If PCLK is used to latch data from the sensor, check sense */ 1176 /* If PCLK is used to latch data from the sensor, check sense */
1177 if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) 1177 if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN)
@@ -1201,8 +1201,8 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
1201 } 1201 }
1202 1202
1203 if (pixfmt && !ret) { 1203 if (pixfmt && !ret) {
1204 icd->buswidth = buswidth; 1204 icd->buswidth = xlate->buswidth;
1205 icd->current_fmt = host_fmt; 1205 icd->current_fmt = xlate->host_fmt;
1206 } 1206 }
1207 1207
1208 return ret; 1208 return ret;
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 0776ecf56d27..b5370b3e1a3d 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -860,6 +860,7 @@ static struct zl10353_config behold_h6_config = {
860 .demod_address = 0x1e>>1, 860 .demod_address = 0x1e>>1,
861 .no_tuner = 1, 861 .no_tuner = 1,
862 .parallel_ts = 1, 862 .parallel_ts = 1,
863 .disable_i2c_gate_ctrl = 1,
863}; 864};
864 865
865/* ================================================================== 866/* ==================================================================
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 9a2586b07a05..ddcb81d0b81a 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -603,21 +603,18 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
603 const struct soc_camera_format_xlate *xlate; 603 const struct soc_camera_format_xlate *xlate;
604 int ret; 604 int ret;
605 605
606 if (!pixfmt)
607 return icd->ops->set_fmt(icd, pixfmt, rect);
608
606 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 609 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
607 if (!xlate) { 610 if (!xlate) {
608 dev_warn(&ici->dev, "Format %x not found\n", pixfmt); 611 dev_warn(&ici->dev, "Format %x not found\n", pixfmt);
609 return -EINVAL; 612 return -EINVAL;
610 } 613 }
611 614
612 switch (pixfmt) { 615 ret = icd->ops->set_fmt(icd, xlate->cam_fmt->fourcc, rect);
613 case 0: /* Only geometry change */
614 ret = icd->ops->set_fmt(icd, pixfmt, rect);
615 break;
616 default:
617 ret = icd->ops->set_fmt(icd, xlate->cam_fmt->fourcc, rect);
618 }
619 616
620 if (pixfmt && !ret) { 617 if (!ret) {
621 icd->buswidth = xlate->buswidth; 618 icd->buswidth = xlate->buswidth;
622 icd->current_fmt = xlate->host_fmt; 619 icd->current_fmt = xlate->host_fmt;
623 pcdev->camera_fmt = xlate->cam_fmt; 620 pcdev->camera_fmt = xlate->cam_fmt;
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 5aeccb301cea..076ed5bf48b1 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -54,7 +54,7 @@ MODULE_LICENSE("GPL");
54/* ---------------------------------------------------------------------- */ 54/* ---------------------------------------------------------------------- */
55/* our structs */ 55/* our structs */
56 56
57#define MAXREGS 64 57#define MAXREGS 256
58 58
59struct CHIPSTATE; 59struct CHIPSTATE;
60typedef int (*getvalue)(int); 60typedef int (*getvalue)(int);
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c
index c1e4ae27c613..c705f248da88 100644
--- a/drivers/media/video/uvc/uvc_status.c
+++ b/drivers/media/video/uvc/uvc_status.c
@@ -46,8 +46,8 @@ static int uvc_input_init(struct uvc_device *dev)
46 usb_to_input_id(udev, &input->id); 46 usb_to_input_id(udev, &input->id);
47 input->dev.parent = &dev->intf->dev; 47 input->dev.parent = &dev->intf->dev;
48 48
49 set_bit(EV_KEY, input->evbit); 49 __set_bit(EV_KEY, input->evbit);
50 set_bit(BTN_0, input->keybit); 50 __set_bit(KEY_CAMERA, input->keybit);
51 51
52 if ((ret = input_register_device(input)) < 0) 52 if ((ret = input_register_device(input)) < 0)
53 goto error; 53 goto error;
@@ -70,8 +70,10 @@ static void uvc_input_cleanup(struct uvc_device *dev)
70static void uvc_input_report_key(struct uvc_device *dev, unsigned int code, 70static void uvc_input_report_key(struct uvc_device *dev, unsigned int code,
71 int value) 71 int value)
72{ 72{
73 if (dev->input) 73 if (dev->input) {
74 input_report_key(dev->input, code, value); 74 input_report_key(dev->input, code, value);
75 input_sync(dev->input);
76 }
75} 77}
76 78
77#else 79#else
@@ -96,7 +98,7 @@ static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len)
96 return; 98 return;
97 uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n", 99 uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n",
98 data[1], data[3] ? "pressed" : "released", len); 100 data[1], data[3] ? "pressed" : "released", len);
99 uvc_input_report_key(dev, BTN_0, data[3]); 101 uvc_input_report_key(dev, KEY_CAMERA, data[3]);
100 } else { 102 } else {
101 uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x " 103 uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x "
102 "len %d.\n", data[1], data[2], data[3], len); 104 "len %d.\n", data[1], data[2], data[3], len);
diff --git a/drivers/media/video/zoran/Kconfig b/drivers/media/video/zoran/Kconfig
index 4ea5fa71de89..8666e19f31a7 100644
--- a/drivers/media/video/zoran/Kconfig
+++ b/drivers/media/video/zoran/Kconfig
@@ -68,6 +68,7 @@ config VIDEO_ZORAN_AVS6EYES
68 tristate "AverMedia 6 Eyes support (EXPERIMENTAL)" 68 tristate "AverMedia 6 Eyes support (EXPERIMENTAL)"
69 depends on VIDEO_ZORAN_ZR36060 && EXPERIMENTAL && VIDEO_V4L1 69 depends on VIDEO_ZORAN_ZR36060 && EXPERIMENTAL && VIDEO_V4L1
70 select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO 70 select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO
71 select VIDEO_BT866 if VIDEO_HELPER_CHIPS_AUTO
71 select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO 72 select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO
72 help 73 help
73 Support for the AverMedia 6 Eyes video surveillance card. 74 Support for the AverMedia 6 Eyes video surveillance card.
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 96ac88317b8e..ea3aafbbda44 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -91,9 +91,9 @@ MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC \
91 controllers (default=0)"); 91 controllers (default=0)");
92 92
93static int mpt_msi_enable_sas; 93static int mpt_msi_enable_sas;
94module_param(mpt_msi_enable_sas, int, 1); 94module_param(mpt_msi_enable_sas, int, 0);
95MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS \ 95MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS \
96 controllers (default=1)"); 96 controllers (default=0)");
97 97
98 98
99static int mpt_channel_mapping; 99static int mpt_channel_mapping;
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
index 1a4d04664d6d..aa266e1f69b2 100644
--- a/drivers/mfd/htc-egpio.c
+++ b/drivers/mfd/htc-egpio.c
@@ -286,7 +286,7 @@ static int __init egpio_probe(struct platform_device *pdev)
286 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 286 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
287 if (!res) 287 if (!res)
288 goto fail; 288 goto fail;
289 ei->base_addr = ioremap_nocache(res->start, res->end - res->start); 289 ei->base_addr = ioremap_nocache(res->start, resource_size(res));
290 if (!ei->base_addr) 290 if (!ei->base_addr)
291 goto fail; 291 goto fail;
292 pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); 292 pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
@@ -307,7 +307,7 @@ static int __init egpio_probe(struct platform_device *pdev)
307 307
308 ei->nchips = pdata->num_chips; 308 ei->nchips = pdata->num_chips;
309 ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); 309 ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);
310 if (!ei) { 310 if (!ei->chip) {
311 ret = -ENOMEM; 311 ret = -ENOMEM;
312 goto fail; 312 goto fail;
313 } 313 }
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index ea9488e7ad6d..2e36057659e1 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -678,6 +678,7 @@ static int __devexit pcf50633_remove(struct i2c_client *client)
678 678
679static struct i2c_device_id pcf50633_id_table[] = { 679static struct i2c_device_id pcf50633_id_table[] = {
680 {"pcf50633", 0x73}, 680 {"pcf50633", 0x73},
681 {/* end of list */}
681}; 682};
682 683
683static struct i2c_driver pcf50633_driver = { 684static struct i2c_driver pcf50633_driver = {
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 0e5761f12634..4c7b7962f6b8 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1050,7 +1050,7 @@ static int __devinit sm501_gpio_register_chip(struct sm501_devdata *sm,
1050 return gpiochip_add(gchip); 1050 return gpiochip_add(gchip);
1051} 1051}
1052 1052
1053static int sm501_register_gpio(struct sm501_devdata *sm) 1053static int __devinit sm501_register_gpio(struct sm501_devdata *sm)
1054{ 1054{
1055 struct sm501_gpio *gpio = &sm->gpio; 1055 struct sm501_gpio *gpio = &sm->gpio;
1056 resource_size_t iobase = sm->io_res->start + SM501_GPIO; 1056 resource_size_t iobase = sm->io_res->start + SM501_GPIO;
@@ -1321,7 +1321,7 @@ static unsigned int sm501_mem_local[] = {
1321 * Common init code for an SM501 1321 * Common init code for an SM501
1322*/ 1322*/
1323 1323
1324static int sm501_init_dev(struct sm501_devdata *sm) 1324static int __devinit sm501_init_dev(struct sm501_devdata *sm)
1325{ 1325{
1326 struct sm501_initdata *idata; 1326 struct sm501_initdata *idata;
1327 struct sm501_platdata *pdata; 1327 struct sm501_platdata *pdata;
@@ -1397,7 +1397,7 @@ static int sm501_init_dev(struct sm501_devdata *sm)
1397 return 0; 1397 return 0;
1398} 1398}
1399 1399
1400static int sm501_plat_probe(struct platform_device *dev) 1400static int __devinit sm501_plat_probe(struct platform_device *dev)
1401{ 1401{
1402 struct sm501_devdata *sm; 1402 struct sm501_devdata *sm;
1403 int ret; 1403 int ret;
@@ -1586,8 +1586,8 @@ static struct sm501_platdata sm501_pci_platdata = {
1586 .gpio_base = -1, 1586 .gpio_base = -1,
1587}; 1587};
1588 1588
1589static int sm501_pci_probe(struct pci_dev *dev, 1589static int __devinit sm501_pci_probe(struct pci_dev *dev,
1590 const struct pci_device_id *id) 1590 const struct pci_device_id *id)
1591{ 1591{
1592 struct sm501_devdata *sm; 1592 struct sm501_devdata *sm;
1593 int err; 1593 int err;
@@ -1693,7 +1693,7 @@ static void sm501_dev_remove(struct sm501_devdata *sm)
1693 sm501_gpio_remove(sm); 1693 sm501_gpio_remove(sm);
1694} 1694}
1695 1695
1696static void sm501_pci_remove(struct pci_dev *dev) 1696static void __devexit sm501_pci_remove(struct pci_dev *dev)
1697{ 1697{
1698 struct sm501_devdata *sm = pci_get_drvdata(dev); 1698 struct sm501_devdata *sm = pci_get_drvdata(dev);
1699 1699
@@ -1727,16 +1727,16 @@ static struct pci_device_id sm501_pci_tbl[] = {
1727 1727
1728MODULE_DEVICE_TABLE(pci, sm501_pci_tbl); 1728MODULE_DEVICE_TABLE(pci, sm501_pci_tbl);
1729 1729
1730static struct pci_driver sm501_pci_drv = { 1730static struct pci_driver sm501_pci_driver = {
1731 .name = "sm501", 1731 .name = "sm501",
1732 .id_table = sm501_pci_tbl, 1732 .id_table = sm501_pci_tbl,
1733 .probe = sm501_pci_probe, 1733 .probe = sm501_pci_probe,
1734 .remove = sm501_pci_remove, 1734 .remove = __devexit_p(sm501_pci_remove),
1735}; 1735};
1736 1736
1737MODULE_ALIAS("platform:sm501"); 1737MODULE_ALIAS("platform:sm501");
1738 1738
1739static struct platform_driver sm501_plat_drv = { 1739static struct platform_driver sm501_plat_driver = {
1740 .driver = { 1740 .driver = {
1741 .name = "sm501", 1741 .name = "sm501",
1742 .owner = THIS_MODULE, 1742 .owner = THIS_MODULE,
@@ -1749,14 +1749,14 @@ static struct platform_driver sm501_plat_drv = {
1749 1749
1750static int __init sm501_base_init(void) 1750static int __init sm501_base_init(void)
1751{ 1751{
1752 platform_driver_register(&sm501_plat_drv); 1752 platform_driver_register(&sm501_plat_driver);
1753 return pci_register_driver(&sm501_pci_drv); 1753 return pci_register_driver(&sm501_pci_driver);
1754} 1754}
1755 1755
1756static void __exit sm501_base_exit(void) 1756static void __exit sm501_base_exit(void)
1757{ 1757{
1758 platform_driver_unregister(&sm501_plat_drv); 1758 platform_driver_unregister(&sm501_plat_driver);
1759 pci_unregister_driver(&sm501_pci_drv); 1759 pci_unregister_driver(&sm501_pci_driver);
1760} 1760}
1761 1761
1762module_init(sm501_base_init); 1762module_init(sm501_base_init);
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index e7ab0035d305..68826f1e36bc 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -38,7 +38,7 @@
38#include <linux/i2c.h> 38#include <linux/i2c.h>
39#include <linux/i2c/twl4030.h> 39#include <linux/i2c/twl4030.h>
40 40
41#ifdef CONFIG_ARM 41#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
42#include <mach/cpu.h> 42#include <mach/cpu.h>
43#endif 43#endif
44 44
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index f92595c8f165..b457a05b28d9 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref)
1111 do { 1111 do {
1112 schedule_timeout_interruptible(1); 1112 schedule_timeout_interruptible(1);
1113 reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); 1113 reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
1114 } while (tries-- && (reg & WM8350_AUXADC_POLL)); 1114 } while (--tries && (reg & WM8350_AUXADC_POLL));
1115 1115
1116 if (!tries) 1116 if (!tries)
1117 dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); 1117 dev_err(wm8350->dev, "adc chn %d read timeout\n", channel);
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350,
1297int wm8350_device_init(struct wm8350 *wm8350, int irq, 1297int wm8350_device_init(struct wm8350 *wm8350, int irq,
1298 struct wm8350_platform_data *pdata) 1298 struct wm8350_platform_data *pdata)
1299{ 1299{
1300 int ret = -EINVAL; 1300 int ret;
1301 u16 id1, id2, mask_rev; 1301 u16 id1, id2, mask_rev;
1302 u16 cust_id, mode, chip_rev; 1302 u16 cust_id, mode, chip_rev;
1303 1303
1304 /* get WM8350 revision and config mode */ 1304 /* get WM8350 revision and config mode */
1305 wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); 1305 ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
1306 wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); 1306 if (ret != 0) {
1307 wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev); 1307 dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
1308 goto err;
1309 }
1310
1311 ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
1312 if (ret != 0) {
1313 dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
1314 goto err;
1315 }
1316
1317 ret = wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev),
1318 &mask_rev);
1319 if (ret != 0) {
1320 dev_err(wm8350->dev, "Failed to read revision: %d\n", ret);
1321 goto err;
1322 }
1308 1323
1309 id1 = be16_to_cpu(id1); 1324 id1 = be16_to_cpu(id1);
1310 id2 = be16_to_cpu(id2); 1325 id2 = be16_to_cpu(id2);
@@ -1368,6 +1383,11 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
1368 wm8350->power.rev_g_coeff = 1; 1383 wm8350->power.rev_g_coeff = 1;
1369 break; 1384 break;
1370 1385
1386 case 1:
1387 dev_info(wm8350->dev, "WM8351 Rev B\n");
1388 wm8350->power.rev_g_coeff = 1;
1389 break;
1390
1371 default: 1391 default:
1372 dev_err(wm8350->dev, "Unknown WM8351 CHIP_REV\n"); 1392 dev_err(wm8350->dev, "Unknown WM8351 CHIP_REV\n");
1373 ret = -ENODEV; 1393 ret = -ENODEV;
@@ -1404,14 +1424,12 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
1404 return ret; 1424 return ret;
1405 } 1425 }
1406 1426
1407 if (pdata && pdata->init) { 1427 wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF);
1408 ret = pdata->init(wm8350); 1428 wm8350_reg_write(wm8350, WM8350_INT_STATUS_1_MASK, 0xFFFF);
1409 if (ret != 0) { 1429 wm8350_reg_write(wm8350, WM8350_INT_STATUS_2_MASK, 0xFFFF);
1410 dev_err(wm8350->dev, "Platform init() failed: %d\n", 1430 wm8350_reg_write(wm8350, WM8350_UNDER_VOLTAGE_INT_STATUS_MASK, 0xFFFF);
1411 ret); 1431 wm8350_reg_write(wm8350, WM8350_GPIO_INT_STATUS_MASK, 0xFFFF);
1412 goto err; 1432 wm8350_reg_write(wm8350, WM8350_COMPARATOR_INT_STATUS_MASK, 0xFFFF);
1413 }
1414 }
1415 1433
1416 mutex_init(&wm8350->auxadc_mutex); 1434 mutex_init(&wm8350->auxadc_mutex);
1417 mutex_init(&wm8350->irq_mutex); 1435 mutex_init(&wm8350->irq_mutex);
@@ -1430,6 +1448,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
1430 } 1448 }
1431 wm8350->chip_irq = irq; 1449 wm8350->chip_irq = irq;
1432 1450
1451 if (pdata && pdata->init) {
1452 ret = pdata->init(wm8350);
1453 if (ret != 0) {
1454 dev_err(wm8350->dev, "Platform init() failed: %d\n",
1455 ret);
1456 goto err;
1457 }
1458 }
1459
1433 wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0); 1460 wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
1434 1461
1435 wm8350_client_dev_register(wm8350, "wm8350-codec", 1462 wm8350_client_dev_register(wm8350, "wm8350-codec",
diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c
index 68887b817d17..9a4cc954cb7c 100644
--- a/drivers/mfd/wm8350-regmap.c
+++ b/drivers/mfd/wm8350-regmap.c
@@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
3188 { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */ 3188 { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */
3189 { 0x0000, 0x0000, 0x0000 }, /* R2 */ 3189 { 0x0000, 0x0000, 0x0000 }, /* R2 */
3190 { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */ 3190 { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */
3191 { 0xFCF7, 0xFCF7, 0xF800 }, /* R4 - System Control 2 */ 3191 { 0xFEF7, 0xFEF7, 0xF800 }, /* R4 - System Control 2 */
3192 { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */ 3192 { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */
3193 { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */ 3193 { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */
3194 { 0x0000, 0x0000, 0x0000 }, /* R7 */ 3194 { 0x0000, 0x0000, 0x0000 }, /* R7 */
diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
index f26667a7abf7..cf991850f01b 100644
--- a/drivers/misc/hpilo.c
+++ b/drivers/misc/hpilo.c
@@ -710,6 +710,7 @@ out:
710 710
711static struct pci_device_id ilo_devices[] = { 711static struct pci_device_id ilo_devices[] = {
712 { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB204) }, 712 { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB204) },
713 { PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3307) },
713 { } 714 { }
714}; 715};
715MODULE_DEVICE_TABLE(pci, ilo_devices); 716MODULE_DEVICE_TABLE(pci, ilo_devices);
@@ -758,7 +759,7 @@ static void __exit ilo_exit(void)
758 class_destroy(ilo_class); 759 class_destroy(ilo_class);
759} 760}
760 761
761MODULE_VERSION("0.06"); 762MODULE_VERSION("1.0");
762MODULE_ALIAS(ILO_NAME); 763MODULE_ALIAS(ILO_NAME);
763MODULE_DESCRIPTION(ILO_NAME); 764MODULE_DESCRIPTION(ILO_NAME);
764MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>"); 765MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>");
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 45b1f430685f..513eb09a638f 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -584,7 +584,7 @@ static int mmc_blk_probe(struct mmc_card *card)
584 if (err) 584 if (err)
585 goto out; 585 goto out;
586 586
587 string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2, 587 string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
588 cap_str, sizeof(cap_str)); 588 cap_str, sizeof(cap_str));
589 printk(KERN_INFO "%s: %s %s %s %s\n", 589 printk(KERN_INFO "%s: %s %s %s %s\n",
590 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), 590 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index b92b172074ee..b9f1e84897cc 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -494,7 +494,7 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
494 494
495 sg_init_one(&sg, test->buffer, 512); 495 sg_init_one(&sg, test->buffer, 512);
496 496
497 ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1); 497 ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
498 if (ret) 498 if (ret)
499 return ret; 499 return ret;
500 500
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 9c50e6f1c236..34ce2703d29a 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -248,12 +248,15 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
248 248
249 sg_init_one(&sg, data_buf, len); 249 sg_init_one(&sg, data_buf, len);
250 250
251 /* 251 if (opcode == MMC_SEND_CSD || opcode == MMC_SEND_CID) {
252 * The spec states that CSR and CID accesses have a timeout 252 /*
253 * of 64 clock cycles. 253 * The spec states that CSR and CID accesses have a timeout
254 */ 254 * of 64 clock cycles.
255 data.timeout_ns = 0; 255 */
256 data.timeout_clks = 64; 256 data.timeout_ns = 0;
257 data.timeout_clks = 64;
258 } else
259 mmc_set_data_timeout(&data, card);
257 260
258 mmc_wait_for_req(host, &mrq); 261 mmc_wait_for_req(host, &mrq);
259 262
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 76bfe16c09b1..2b1196e6142c 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1548,9 +1548,10 @@ static bool filter(struct dma_chan *chan, void *slave)
1548{ 1548{
1549 struct dw_dma_slave *dws = slave; 1549 struct dw_dma_slave *dws = slave;
1550 1550
1551 if (dws->dma_dev == chan->device->dev) 1551 if (dws->dma_dev == chan->device->dev) {
1552 chan->private = dws;
1552 return true; 1553 return true;
1553 else 1554 } else
1554 return false; 1555 return false;
1555} 1556}
1556#endif 1557#endif
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index db37490f67ec..a631c81dce12 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -55,6 +55,7 @@
55#define VS30 (1 << 25) 55#define VS30 (1 << 25)
56#define SDVS18 (0x5 << 9) 56#define SDVS18 (0x5 << 9)
57#define SDVS30 (0x6 << 9) 57#define SDVS30 (0x6 << 9)
58#define SDVS33 (0x7 << 9)
58#define SDVSCLR 0xFFFFF1FF 59#define SDVSCLR 0xFFFFF1FF
59#define SDVSDET 0x00000400 60#define SDVSDET 0x00000400
60#define AUTOIDLE 0x1 61#define AUTOIDLE 0x1
@@ -375,6 +376,32 @@ static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status)
375} 376}
376#endif /* CONFIG_MMC_DEBUG */ 377#endif /* CONFIG_MMC_DEBUG */
377 378
379/*
380 * MMC controller internal state machines reset
381 *
382 * Used to reset command or data internal state machines, using respectively
383 * SRC or SRD bit of SYSCTL register
384 * Can be called from interrupt context
385 */
386static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host,
387 unsigned long bit)
388{
389 unsigned long i = 0;
390 unsigned long limit = (loops_per_jiffy *
391 msecs_to_jiffies(MMC_TIMEOUT_MS));
392
393 OMAP_HSMMC_WRITE(host->base, SYSCTL,
394 OMAP_HSMMC_READ(host->base, SYSCTL) | bit);
395
396 while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) &&
397 (i++ < limit))
398 cpu_relax();
399
400 if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit)
401 dev_err(mmc_dev(host->mmc),
402 "Timeout waiting on controller reset in %s\n",
403 __func__);
404}
378 405
379/* 406/*
380 * MMC controller IRQ handler 407 * MMC controller IRQ handler
@@ -403,21 +430,17 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
403 (status & CMD_CRC)) { 430 (status & CMD_CRC)) {
404 if (host->cmd) { 431 if (host->cmd) {
405 if (status & CMD_TIMEOUT) { 432 if (status & CMD_TIMEOUT) {
406 OMAP_HSMMC_WRITE(host->base, SYSCTL, 433 mmc_omap_reset_controller_fsm(host, SRC);
407 OMAP_HSMMC_READ(host->base,
408 SYSCTL) | SRC);
409 while (OMAP_HSMMC_READ(host->base,
410 SYSCTL) & SRC)
411 ;
412
413 host->cmd->error = -ETIMEDOUT; 434 host->cmd->error = -ETIMEDOUT;
414 } else { 435 } else {
415 host->cmd->error = -EILSEQ; 436 host->cmd->error = -EILSEQ;
416 } 437 }
417 end_cmd = 1; 438 end_cmd = 1;
418 } 439 }
419 if (host->data) 440 if (host->data) {
420 mmc_dma_cleanup(host); 441 mmc_dma_cleanup(host);
442 mmc_omap_reset_controller_fsm(host, SRD);
443 }
421 } 444 }
422 if ((status & DATA_TIMEOUT) || 445 if ((status & DATA_TIMEOUT) ||
423 (status & DATA_CRC)) { 446 (status & DATA_CRC)) {
@@ -426,12 +449,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
426 mmc_dma_cleanup(host); 449 mmc_dma_cleanup(host);
427 else 450 else
428 host->data->error = -EILSEQ; 451 host->data->error = -EILSEQ;
429 OMAP_HSMMC_WRITE(host->base, SYSCTL, 452 mmc_omap_reset_controller_fsm(host, SRD);
430 OMAP_HSMMC_READ(host->base,
431 SYSCTL) | SRD);
432 while (OMAP_HSMMC_READ(host->base,
433 SYSCTL) & SRD)
434 ;
435 end_trans = 1; 453 end_trans = 1;
436 } 454 }
437 } 455 }
@@ -456,13 +474,20 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
456} 474}
457 475
458/* 476/*
459 * Switch MMC operating voltage 477 * Switch MMC interface voltage ... only relevant for MMC1.
478 *
479 * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver.
480 * The MMC2 transceiver controls are used instead of DAT4..DAT7.
481 * Some chips, like eMMC ones, use internal transceivers.
460 */ 482 */
461static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) 483static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
462{ 484{
463 u32 reg_val = 0; 485 u32 reg_val = 0;
464 int ret; 486 int ret;
465 487
488 if (host->id != OMAP_MMC1_DEVID)
489 return 0;
490
466 /* Disable the clocks */ 491 /* Disable the clocks */
467 clk_disable(host->fclk); 492 clk_disable(host->fclk);
468 clk_disable(host->iclk); 493 clk_disable(host->iclk);
@@ -485,19 +510,26 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
485 OMAP_HSMMC_WRITE(host->base, HCTL, 510 OMAP_HSMMC_WRITE(host->base, HCTL,
486 OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR); 511 OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR);
487 reg_val = OMAP_HSMMC_READ(host->base, HCTL); 512 reg_val = OMAP_HSMMC_READ(host->base, HCTL);
513
488 /* 514 /*
489 * If a MMC dual voltage card is detected, the set_ios fn calls 515 * If a MMC dual voltage card is detected, the set_ios fn calls
490 * this fn with VDD bit set for 1.8V. Upon card removal from the 516 * this fn with VDD bit set for 1.8V. Upon card removal from the
491 * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. 517 * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF.
492 * 518 *
493 * Only MMC1 supports 3.0V. MMC2 will not function if SDVS30 is 519 * Cope with a bit of slop in the range ... per data sheets:
494 * set in HCTL. 520 * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max,
521 * but recommended values are 1.71V to 1.89V
522 * - "3.0V" for vdds_mmc1/vdds_mmc1a can be up to 3.5V max,
523 * but recommended values are 2.7V to 3.3V
524 *
525 * Board setup code shouldn't permit anything very out-of-range.
526 * TWL4030-family VMMC1 and VSIM regulators are fine (avoiding the
527 * middle range) but VSIM can't power DAT4..DAT7 at more than 3V.
495 */ 528 */
496 if (host->id == OMAP_MMC1_DEVID && (((1 << vdd) == MMC_VDD_32_33) || 529 if ((1 << vdd) <= MMC_VDD_23_24)
497 ((1 << vdd) == MMC_VDD_33_34)))
498 reg_val |= SDVS30;
499 if ((1 << vdd) == MMC_VDD_165_195)
500 reg_val |= SDVS18; 530 reg_val |= SDVS18;
531 else
532 reg_val |= SDVS30;
501 533
502 OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); 534 OMAP_HSMMC_WRITE(host->base, HCTL, reg_val);
503 535
@@ -517,16 +549,15 @@ static void mmc_omap_detect(struct work_struct *work)
517{ 549{
518 struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, 550 struct mmc_omap_host *host = container_of(work, struct mmc_omap_host,
519 mmc_carddetect_work); 551 mmc_carddetect_work);
552 struct omap_mmc_slot_data *slot = &mmc_slot(host);
553
554 host->carddetect = slot->card_detect(slot->card_detect_irq);
520 555
521 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); 556 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");
522 if (host->carddetect) { 557 if (host->carddetect) {
523 mmc_detect_change(host->mmc, (HZ * 200) / 1000); 558 mmc_detect_change(host->mmc, (HZ * 200) / 1000);
524 } else { 559 } else {
525 OMAP_HSMMC_WRITE(host->base, SYSCTL, 560 mmc_omap_reset_controller_fsm(host, SRD);
526 OMAP_HSMMC_READ(host->base, SYSCTL) | SRD);
527 while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD)
528 ;
529
530 mmc_detect_change(host->mmc, (HZ * 50) / 1000); 561 mmc_detect_change(host->mmc, (HZ * 50) / 1000);
531 } 562 }
532} 563}
@@ -538,7 +569,6 @@ static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id)
538{ 569{
539 struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; 570 struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id;
540 571
541 host->carddetect = mmc_slot(host).card_detect(irq);
542 schedule_work(&host->mmc_carddetect_work); 572 schedule_work(&host->mmc_carddetect_work);
543 573
544 return IRQ_HANDLED; 574 return IRQ_HANDLED;
@@ -757,10 +787,14 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
757 case MMC_POWER_OFF: 787 case MMC_POWER_OFF:
758 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); 788 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0);
759 /* 789 /*
760 * Reset bus voltage to 3V if it got set to 1.8V earlier. 790 * Reset interface voltage to 3V if it's 1.8V now;
791 * only relevant on MMC-1, the others always use 1.8V.
792 *
761 * REVISIT: If we are able to detect cards after unplugging 793 * REVISIT: If we are able to detect cards after unplugging
762 * a 1.8V card, this code should not be needed. 794 * a 1.8V card, this code should not be needed.
763 */ 795 */
796 if (host->id != OMAP_MMC1_DEVID)
797 break;
764 if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { 798 if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
765 int vdd = fls(host->mmc->ocr_avail) - 1; 799 int vdd = fls(host->mmc->ocr_avail) - 1;
766 if (omap_mmc_switch_opcond(host, vdd) != 0) 800 if (omap_mmc_switch_opcond(host, vdd) != 0)
@@ -784,7 +818,9 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
784 } 818 }
785 819
786 if (host->id == OMAP_MMC1_DEVID) { 820 if (host->id == OMAP_MMC1_DEVID) {
787 /* Only MMC1 can operate at 3V/1.8V */ 821 /* Only MMC1 can interface at 3V without some flavor
822 * of external transceiver; but they all handle 1.8V.
823 */
788 if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) && 824 if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) &&
789 (ios->vdd == DUAL_VOLT_OCR_BIT)) { 825 (ios->vdd == DUAL_VOLT_OCR_BIT)) {
790 /* 826 /*
@@ -1137,7 +1173,9 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
1137 " level suspend\n"); 1173 " level suspend\n");
1138 } 1174 }
1139 1175
1140 if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { 1176 if (host->id == OMAP_MMC1_DEVID
1177 && !(OMAP_HSMMC_READ(host->base, HCTL)
1178 & SDVSDET)) {
1141 OMAP_HSMMC_WRITE(host->base, HCTL, 1179 OMAP_HSMMC_WRITE(host->base, HCTL,
1142 OMAP_HSMMC_READ(host->base, HCTL) 1180 OMAP_HSMMC_READ(host->base, HCTL)
1143 & SDVSCLR); 1181 & SDVSCLR);
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index 35a98eec7414..2db166b7096f 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -329,7 +329,7 @@ static void do_pio_write(struct s3cmci_host *host)
329 329
330 to_ptr = host->base + host->sdidata; 330 to_ptr = host->base + host->sdidata;
331 331
332 while ((fifo = fifo_free(host))) { 332 while ((fifo = fifo_free(host)) > 3) {
333 if (!host->pio_bytes) { 333 if (!host->pio_bytes) {
334 res = get_data_buffer(host, &host->pio_bytes, 334 res = get_data_buffer(host, &host->pio_bytes,
335 &host->pio_ptr); 335 &host->pio_ptr);
@@ -793,8 +793,7 @@ static void s3cmci_dma_setup(struct s3cmci_host *host,
793 host->mem->start + host->sdidata); 793 host->mem->start + host->sdidata);
794 794
795 if (!setup_ok) { 795 if (!setup_ok) {
796 s3c2410_dma_config(host->dma, 4, 796 s3c2410_dma_config(host->dma, 4, 0);
797 (S3C2410_DCON_HWTRIG | S3C2410_DCON_CH0_SDI));
798 s3c2410_dma_set_buffdone_fn(host->dma, 797 s3c2410_dma_set_buffdone_fn(host->dma,
799 s3cmci_dma_done_callback); 798 s3cmci_dma_done_callback);
800 s3c2410_dma_setflags(host->dma, S3C2410_DMAF_AUTOSTART); 799 s3c2410_dma_setflags(host->dma, S3C2410_DMAF_AUTOSTART);
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index f07255cb17ee..406da9a8d453 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -107,6 +107,7 @@ static const struct sdhci_pci_fixes sdhci_ene_714 = {
107 107
108static const struct sdhci_pci_fixes sdhci_cafe = { 108static const struct sdhci_pci_fixes sdhci_cafe = {
109 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER | 109 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
110 SDHCI_QUIRK_NO_BUSY_IRQ |
110 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL, 111 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
111}; 112};
112 113
@@ -144,8 +145,7 @@ static int jmicron_probe(struct sdhci_pci_chip *chip)
144 SDHCI_QUIRK_32BIT_DMA_SIZE | 145 SDHCI_QUIRK_32BIT_DMA_SIZE |
145 SDHCI_QUIRK_32BIT_ADMA_SIZE | 146 SDHCI_QUIRK_32BIT_ADMA_SIZE |
146 SDHCI_QUIRK_RESET_AFTER_REQUEST | 147 SDHCI_QUIRK_RESET_AFTER_REQUEST |
147 SDHCI_QUIRK_BROKEN_SMALL_PIO | 148 SDHCI_QUIRK_BROKEN_SMALL_PIO;
148 SDHCI_QUIRK_FORCE_HIGHSPEED;
149 } 149 }
150 150
151 /* 151 /*
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6b2d1f99af67..accb592764ed 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1291,8 +1291,11 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
1291 if (host->cmd->data) 1291 if (host->cmd->data)
1292 DBG("Cannot wait for busy signal when also " 1292 DBG("Cannot wait for busy signal when also "
1293 "doing a data transfer"); 1293 "doing a data transfer");
1294 else 1294 else if (!(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
1295 return; 1295 return;
1296
1297 /* The controller does not support the end-of-busy IRQ,
1298 * fall through and take the SDHCI_INT_RESPONSE */
1296 } 1299 }
1297 1300
1298 if (intmask & SDHCI_INT_RESPONSE) 1301 if (intmask & SDHCI_INT_RESPONSE)
@@ -1636,8 +1639,7 @@ int sdhci_add_host(struct sdhci_host *host)
1636 mmc->f_max = host->max_clk; 1639 mmc->f_max = host->max_clk;
1637 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; 1640 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
1638 1641
1639 if ((caps & SDHCI_CAN_DO_HISPD) || 1642 if (caps & SDHCI_CAN_DO_HISPD)
1640 (host->quirks & SDHCI_QUIRK_FORCE_HIGHSPEED))
1641 mmc->caps |= MMC_CAP_SD_HIGHSPEED; 1643 mmc->caps |= MMC_CAP_SD_HIGHSPEED;
1642 1644
1643 mmc->ocr_avail = 0; 1645 mmc->ocr_avail = 0;
@@ -1723,7 +1725,9 @@ int sdhci_add_host(struct sdhci_host *host)
1723#endif 1725#endif
1724 1726
1725#ifdef SDHCI_USE_LEDS_CLASS 1727#ifdef SDHCI_USE_LEDS_CLASS
1726 host->led.name = mmc_hostname(mmc); 1728 snprintf(host->led_name, sizeof(host->led_name),
1729 "%s::", mmc_hostname(mmc));
1730 host->led.name = host->led_name;
1727 host->led.brightness = LED_OFF; 1731 host->led.brightness = LED_OFF;
1728 host->led.default_trigger = mmc_hostname(mmc); 1732 host->led.default_trigger = mmc_hostname(mmc);
1729 host->led.brightness_set = sdhci_led_control; 1733 host->led.brightness_set = sdhci_led_control;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 3efba2363941..43c37c68d07a 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -208,8 +208,8 @@ struct sdhci_host {
208#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) 208#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)
209/* Controller has an issue with buffer bits for small transfers */ 209/* Controller has an issue with buffer bits for small transfers */
210#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) 210#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
211/* Controller supports high speed but doesn't have the caps bit set */ 211/* Controller does not provide transfer-complete interrupt when not busy */
212#define SDHCI_QUIRK_FORCE_HIGHSPEED (1<<14) 212#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14)
213 213
214 int irq; /* Device IRQ */ 214 int irq; /* Device IRQ */
215 void __iomem * ioaddr; /* Mapped address */ 215 void __iomem * ioaddr; /* Mapped address */
@@ -222,6 +222,7 @@ struct sdhci_host {
222 222
223#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 223#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
224 struct led_classdev led; /* LED control */ 224 struct led_classdev led; /* LED control */
225 char led_name[32];
225#endif 226#endif
226 227
227 spinlock_t lock; /* Mutex */ 228 spinlock_t lock; /* Mutex */
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c
index 821d0ed6bae3..c76d6e5f47ee 100644
--- a/drivers/mtd/chips/map_rom.c
+++ b/drivers/mtd/chips/map_rom.c
@@ -19,6 +19,7 @@ static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
19static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 19static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
20static void maprom_nop (struct mtd_info *); 20static void maprom_nop (struct mtd_info *);
21static struct mtd_info *map_rom_probe(struct map_info *map); 21static struct mtd_info *map_rom_probe(struct map_info *map);
22static int maprom_erase (struct mtd_info *mtd, struct erase_info *info);
22 23
23static struct mtd_chip_driver maprom_chipdrv = { 24static struct mtd_chip_driver maprom_chipdrv = {
24 .probe = map_rom_probe, 25 .probe = map_rom_probe,
@@ -42,6 +43,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
42 mtd->read = maprom_read; 43 mtd->read = maprom_read;
43 mtd->write = maprom_write; 44 mtd->write = maprom_write;
44 mtd->sync = maprom_nop; 45 mtd->sync = maprom_nop;
46 mtd->erase = maprom_erase;
45 mtd->flags = MTD_CAP_ROM; 47 mtd->flags = MTD_CAP_ROM;
46 mtd->erasesize = map->size; 48 mtd->erasesize = map->size;
47 mtd->writesize = 1; 49 mtd->writesize = 1;
@@ -71,6 +73,12 @@ static int maprom_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
71 return -EIO; 73 return -EIO;
72} 74}
73 75
76static int maprom_erase (struct mtd_info *mtd, struct erase_info *info)
77{
78 /* We do our best 8) */
79 return -EROFS;
80}
81
74static int __init map_rom_init(void) 82static int __init map_rom_init(void)
75{ 83{
76 register_mtd_chip_driver(&maprom_chipdrv); 84 register_mtd_chip_driver(&maprom_chipdrv);
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index d44f741ae229..6d9f810565c8 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -821,7 +821,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
821 if (!(info->flags & IS_POW2PS)) 821 if (!(info->flags & IS_POW2PS))
822 return info; 822 return info;
823 } 823 }
824 } 824 } else
825 return info;
825 } 826 }
826 } 827 }
827 828
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index a425d09f35a0..00248e81ecd5 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -267,22 +267,28 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength)
267 if (*(szlength) != '+') { 267 if (*(szlength) != '+') {
268 devlength = simple_strtoul(szlength, &buffer, 0); 268 devlength = simple_strtoul(szlength, &buffer, 0);
269 devlength = handle_unit(devlength, buffer) - devstart; 269 devlength = handle_unit(devlength, buffer) - devstart;
270 if (devlength < devstart)
271 goto err_out;
272
273 devlength -= devstart;
270 } else { 274 } else {
271 devlength = simple_strtoul(szlength + 1, &buffer, 0); 275 devlength = simple_strtoul(szlength + 1, &buffer, 0);
272 devlength = handle_unit(devlength, buffer); 276 devlength = handle_unit(devlength, buffer);
273 } 277 }
274 T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", 278 T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n",
275 devname, devstart, devlength); 279 devname, devstart, devlength);
276 if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) { 280 if (devlength % SLRAM_BLK_SZ != 0)
277 E("slram: Illegal start / length parameter.\n"); 281 goto err_out;
278 return(-EINVAL);
279 }
280 282
281 if ((devstart = register_device(devname, devstart, devlength))){ 283 if ((devstart = register_device(devname, devstart, devlength))){
282 unregister_devices(); 284 unregister_devices();
283 return((int)devstart); 285 return((int)devstart);
284 } 286 }
285 return(0); 287 return(0);
288
289err_out:
290 E("slram: Illegal length parameter.\n");
291 return(-EINVAL);
286} 292}
287 293
288#ifndef MODULE 294#ifndef MODULE
diff --git a/drivers/mtd/lpddr/Kconfig b/drivers/mtd/lpddr/Kconfig
index acd4ea9b2278..5a401d8047ab 100644
--- a/drivers/mtd/lpddr/Kconfig
+++ b/drivers/mtd/lpddr/Kconfig
@@ -12,6 +12,7 @@ config MTD_LPDDR
12 DDR memories, intended for battery-operated systems. 12 DDR memories, intended for battery-operated systems.
13 13
14config MTD_QINFO_PROBE 14config MTD_QINFO_PROBE
15 depends on MTD_LPDDR
15 tristate "Detect flash chips by QINFO probe" 16 tristate "Detect flash chips by QINFO probe"
16 help 17 help
17 Device Information for LPDDR chips is offered through the Overlay 18 Device Information for LPDDR chips is offered through the Overlay
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 0225cbbf22de..043d50fb6ef6 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -491,7 +491,7 @@ config MTD_PCMCIA_ANONYMOUS
491 491
492config MTD_BFIN_ASYNC 492config MTD_BFIN_ASYNC
493 tristate "Blackfin BF533-STAMP Flash Chip Support" 493 tristate "Blackfin BF533-STAMP Flash Chip Support"
494 depends on BFIN533_STAMP && MTD_CFI 494 depends on BFIN533_STAMP && MTD_CFI && MTD_COMPLEX_MAPPINGS
495 select MTD_PARTITIONS 495 select MTD_PARTITIONS
496 default y 496 default y
497 help 497 help
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
index 6fec86aaed7e..576611f605db 100644
--- a/drivers/mtd/maps/bfin-async-flash.c
+++ b/drivers/mtd/maps/bfin-async-flash.c
@@ -152,14 +152,18 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)
152 152
153 if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { 153 if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) {
154 pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); 154 pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin);
155 kfree(state);
155 return -EBUSY; 156 return -EBUSY;
156 } 157 }
157 gpio_direction_output(state->enet_flash_pin, 1); 158 gpio_direction_output(state->enet_flash_pin, 1);
158 159
159 pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); 160 pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8);
160 state->mtd = do_map_probe(memory->name, &state->map); 161 state->mtd = do_map_probe(memory->name, &state->map);
161 if (!state->mtd) 162 if (!state->mtd) {
163 gpio_free(state->enet_flash_pin);
164 kfree(state);
162 return -ENXIO; 165 return -ENXIO;
166 }
163 167
164#ifdef CONFIG_MTD_PARTITIONS 168#ifdef CONFIG_MTD_PARTITIONS
165 ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); 169 ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0);
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 5f7a245ed132..424f17d6ffd1 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -342,9 +342,9 @@ static struct pci_device_id ck804xrom_pci_tbl[] = {
342 { 0, } 342 { 0, }
343}; 343};
344 344
345#if 0
345MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); 346MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl);
346 347
347#if 0
348static struct pci_driver ck804xrom_driver = { 348static struct pci_driver ck804xrom_driver = {
349 .name = MOD_NAME, 349 .name = MOD_NAME,
350 .id_table = ck804xrom_pci_tbl, 350 .id_table = ck804xrom_pci_tbl,
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 87743661d48e..229718222db7 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -29,6 +29,7 @@ struct physmap_flash_info {
29 struct map_info map[MAX_RESOURCES]; 29 struct map_info map[MAX_RESOURCES];
30#ifdef CONFIG_MTD_PARTITIONS 30#ifdef CONFIG_MTD_PARTITIONS
31 int nr_parts; 31 int nr_parts;
32 struct mtd_partition *parts;
32#endif 33#endif
33}; 34};
34 35
@@ -45,25 +46,29 @@ static int physmap_flash_remove(struct platform_device *dev)
45 46
46 physmap_data = dev->dev.platform_data; 47 physmap_data = dev->dev.platform_data;
47 48
48#ifdef CONFIG_MTD_CONCAT 49 if (info->cmtd) {
49 if (info->cmtd != info->mtd[0]) { 50#ifdef CONFIG_MTD_PARTITIONS
51 if (info->nr_parts || physmap_data->nr_parts)
52 del_mtd_partitions(info->cmtd);
53 else
54 del_mtd_device(info->cmtd);
55#else
50 del_mtd_device(info->cmtd); 56 del_mtd_device(info->cmtd);
51 mtd_concat_destroy(info->cmtd); 57#endif
52 } 58 }
59#ifdef CONFIG_MTD_PARTITIONS
60 if (info->nr_parts)
61 kfree(info->parts);
53#endif 62#endif
54 63
55 for (i = 0; i < MAX_RESOURCES; i++) { 64#ifdef CONFIG_MTD_CONCAT
56 if (info->mtd[i] != NULL) { 65 if (info->cmtd != info->mtd[0])
57#ifdef CONFIG_MTD_PARTITIONS 66 mtd_concat_destroy(info->cmtd);
58 if (info->nr_parts || physmap_data->nr_parts)
59 del_mtd_partitions(info->mtd[i]);
60 else
61 del_mtd_device(info->mtd[i]);
62#else
63 del_mtd_device(info->mtd[i]);
64#endif 67#endif
68
69 for (i = 0; i < MAX_RESOURCES; i++) {
70 if (info->mtd[i] != NULL)
65 map_destroy(info->mtd[i]); 71 map_destroy(info->mtd[i]);
66 }
67 } 72 }
68 return 0; 73 return 0;
69} 74}
@@ -86,9 +91,6 @@ static int physmap_flash_probe(struct platform_device *dev)
86 int err = 0; 91 int err = 0;
87 int i; 92 int i;
88 int devices_found = 0; 93 int devices_found = 0;
89#ifdef CONFIG_MTD_PARTITIONS
90 struct mtd_partition *parts;
91#endif
92 94
93 physmap_data = dev->dev.platform_data; 95 physmap_data = dev->dev.platform_data;
94 if (physmap_data == NULL) 96 if (physmap_data == NULL)
@@ -167,10 +169,11 @@ static int physmap_flash_probe(struct platform_device *dev)
167 goto err_out; 169 goto err_out;
168 170
169#ifdef CONFIG_MTD_PARTITIONS 171#ifdef CONFIG_MTD_PARTITIONS
170 err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0); 172 err = parse_mtd_partitions(info->cmtd, part_probe_types,
173 &info->parts, 0);
171 if (err > 0) { 174 if (err > 0) {
172 add_mtd_partitions(info->cmtd, parts, err); 175 add_mtd_partitions(info->cmtd, info->parts, err);
173 kfree(parts); 176 info->nr_parts = err;
174 return 0; 177 return 0;
175 } 178 }
176 179
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index c98c1570a40b..47a33cec3793 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -139,7 +139,8 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
139 struct nand_chip *nand_chip = mtd->priv; 139 struct nand_chip *nand_chip = mtd->priv;
140 struct atmel_nand_host *host = nand_chip->priv; 140 struct atmel_nand_host *host = nand_chip->priv;
141 141
142 return gpio_get_value(host->board->rdy_pin); 142 return gpio_get_value(host->board->rdy_pin) ^
143 !!host->board->rdy_pin_active_low;
143} 144}
144 145
145/* 146/*
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 917cf8d3ae95..c2dfd3ea353d 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -149,7 +149,7 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
149 149
150static struct platform_driver orion_nand_driver = { 150static struct platform_driver orion_nand_driver = {
151 .probe = orion_nand_probe, 151 .probe = orion_nand_probe,
152 .remove = orion_nand_remove, 152 .remove = __devexit_p(orion_nand_remove),
153 .driver = { 153 .driver = {
154 .name = "orion_nand", 154 .name = "orion_nand",
155 .owner = THIS_MODULE, 155 .owner = THIS_MODULE,
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6bdfd47d679d..a2f185fd7072 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2342,6 +2342,17 @@ config ATL1E
2342 To compile this driver as a module, choose M here. The module 2342 To compile this driver as a module, choose M here. The module
2343 will be called atl1e. 2343 will be called atl1e.
2344 2344
2345config ATL1C
2346 tristate "Atheros L1C Gigabit Ethernet support (EXPERIMENTAL)"
2347 depends on PCI && EXPERIMENTAL
2348 select CRC32
2349 select MII
2350 help
2351 This driver supports the Atheros L1C gigabit ethernet adapter.
2352
2353 To compile this driver as a module, choose M here. The module
2354 will be called atl1c.
2355
2345config JME 2356config JME
2346 tristate "JMicron(R) PCI-Express Gigabit Ethernet support" 2357 tristate "JMicron(R) PCI-Express Gigabit Ethernet support"
2347 depends on PCI 2358 depends on PCI
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index a3c5c002f224..aca8492db654 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_BONDING) += bonding/
17obj-$(CONFIG_ATL1) += atlx/ 17obj-$(CONFIG_ATL1) += atlx/
18obj-$(CONFIG_ATL2) += atlx/ 18obj-$(CONFIG_ATL2) += atlx/
19obj-$(CONFIG_ATL1E) += atl1e/ 19obj-$(CONFIG_ATL1E) += atl1e/
20obj-$(CONFIG_ATL1C) += atl1c/
20obj-$(CONFIG_GIANFAR) += gianfar_driver.o 21obj-$(CONFIG_GIANFAR) += gianfar_driver.o
21obj-$(CONFIG_TEHUTI) += tehuti.o 22obj-$(CONFIG_TEHUTI) += tehuti.o
22obj-$(CONFIG_ENIC) += enic/ 23obj-$(CONFIG_ENIC) += enic/
diff --git a/drivers/net/arm/Makefile b/drivers/net/arm/Makefile
index c69c0cdba4a2..811a3ccd14c1 100644
--- a/drivers/net/arm/Makefile
+++ b/drivers/net/arm/Makefile
@@ -4,7 +4,7 @@
4# 4#
5 5
6obj-$(CONFIG_ARM_AM79C961A) += am79c961a.o 6obj-$(CONFIG_ARM_AM79C961A) += am79c961a.o
7obj-$(CONFIG_ARM_ETHERH) += etherh.o ../8390.o 7obj-$(CONFIG_ARM_ETHERH) += etherh.o
8obj-$(CONFIG_ARM_ETHER3) += ether3.o 8obj-$(CONFIG_ARM_ETHER3) += ether3.o
9obj-$(CONFIG_ARM_ETHER1) += ether1.o 9obj-$(CONFIG_ARM_ETHER1) += ether1.o
10obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o 10obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 54b52e5b1821..f52f668c49bf 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -641,15 +641,15 @@ static const struct net_device_ops etherh_netdev_ops = {
641 .ndo_open = etherh_open, 641 .ndo_open = etherh_open,
642 .ndo_stop = etherh_close, 642 .ndo_stop = etherh_close,
643 .ndo_set_config = etherh_set_config, 643 .ndo_set_config = etherh_set_config,
644 .ndo_start_xmit = ei_start_xmit, 644 .ndo_start_xmit = __ei_start_xmit,
645 .ndo_tx_timeout = ei_tx_timeout, 645 .ndo_tx_timeout = __ei_tx_timeout,
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_address = eth_mac_addr, 649 .ndo_set_mac_address = eth_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,
653#endif 653#endif
654}; 654};
655 655
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 1cf2f949c0b4..f3a127434897 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -560,7 +560,7 @@ ks8695_reset(struct ks8695_priv *ksp)
560 msleep(1); 560 msleep(1);
561 } 561 }
562 562
563 if (reset_timeout == 0) { 563 if (reset_timeout < 0) {
564 dev_crit(ksp->dev, 564 dev_crit(ksp->dev,
565 "Timeout waiting for DMA engines to reset\n"); 565 "Timeout waiting for DMA engines to reset\n");
566 /* And blithely carry on */ 566 /* And blithely carry on */
diff --git a/drivers/net/atl1c/Makefile b/drivers/net/atl1c/Makefile
new file mode 100644
index 000000000000..c37d966952ee
--- /dev/null
+++ b/drivers/net/atl1c/Makefile
@@ -0,0 +1,2 @@
1obj-$(CONFIG_ATL1C) += atl1c.o
2atl1c-objs := atl1c_main.o atl1c_hw.o atl1c_ethtool.o
diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
new file mode 100644
index 000000000000..ac11b84b8377
--- /dev/null
+++ b/drivers/net/atl1c/atl1c.h
@@ -0,0 +1,606 @@
1/*
2 * Copyright(c) 2008 - 2009 Atheros Corporation. All rights reserved.
3 *
4 * Derived from Intel e1000 driver
5 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#ifndef _ATL1C_H_
23#define _ATL1C_H_
24
25#include <linux/version.h>
26#include <linux/init.h>
27#include <linux/types.h>
28#include <linux/errno.h>
29#include <linux/module.h>
30#include <linux/pci.h>
31#include <linux/netdevice.h>
32#include <linux/etherdevice.h>
33#include <linux/skbuff.h>
34#include <linux/ioport.h>
35#include <linux/slab.h>
36#include <linux/list.h>
37#include <linux/delay.h>
38#include <linux/sched.h>
39#include <linux/in.h>
40#include <linux/ip.h>
41#include <linux/ipv6.h>
42#include <linux/udp.h>
43#include <linux/mii.h>
44#include <linux/io.h>
45#include <linux/vmalloc.h>
46#include <linux/pagemap.h>
47#include <linux/tcp.h>
48#include <linux/mii.h>
49#include <linux/ethtool.h>
50#include <linux/if_vlan.h>
51#include <linux/workqueue.h>
52#include <net/checksum.h>
53#include <net/ip6_checksum.h>
54
55#include "atl1c_hw.h"
56
57/* Wake Up Filter Control */
58#define AT_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
59#define AT_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
60#define AT_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
61#define AT_WUFC_MC 0x00000008 /* Multicast Wakeup Enable */
62#define AT_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
63
64#define AT_VLAN_TO_TAG(_vlan, _tag) \
65 _tag = ((((_vlan) >> 8) & 0xFF) |\
66 (((_vlan) & 0xFF) << 8))
67
68#define AT_TAG_TO_VLAN(_tag, _vlan) \
69 _vlan = ((((_tag) >> 8) & 0xFF) |\
70 (((_tag) & 0xFF) << 8))
71
72#define SPEED_0 0xffff
73#define HALF_DUPLEX 1
74#define FULL_DUPLEX 2
75
76#define AT_RX_BUF_SIZE (ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN)
77#define MAX_JUMBO_FRAME_SIZE (9*1024)
78#define MAX_TX_OFFLOAD_THRESH (9*1024)
79
80#define AT_MAX_RECEIVE_QUEUE 4
81#define AT_DEF_RECEIVE_QUEUE 1
82#define AT_MAX_TRANSMIT_QUEUE 2
83
84#define AT_DMA_HI_ADDR_MASK 0xffffffff00000000ULL
85#define AT_DMA_LO_ADDR_MASK 0x00000000ffffffffULL
86
87#define AT_TX_WATCHDOG (5 * HZ)
88#define AT_MAX_INT_WORK 5
89#define AT_TWSI_EEPROM_TIMEOUT 100
90#define AT_HW_MAX_IDLE_DELAY 10
91#define AT_SUSPEND_LINK_TIMEOUT 28
92
93#define AT_ASPM_L0S_TIMER 6
94#define AT_ASPM_L1_TIMER 12
95
96#define ATL1C_PCIE_L0S_L1_DISABLE 0x01
97#define ATL1C_PCIE_PHY_RESET 0x02
98
99#define ATL1C_ASPM_L0s_ENABLE 0x0001
100#define ATL1C_ASPM_L1_ENABLE 0x0002
101
102#define AT_REGS_LEN (75 * sizeof(u32))
103#define AT_EEPROM_LEN 512
104
105#define ATL1C_GET_DESC(R, i, type) (&(((type *)((R)->desc))[i]))
106#define ATL1C_RFD_DESC(R, i) ATL1C_GET_DESC(R, i, struct atl1c_rx_free_desc)
107#define ATL1C_TPD_DESC(R, i) ATL1C_GET_DESC(R, i, struct atl1c_tpd_desc)
108#define ATL1C_RRD_DESC(R, i) ATL1C_GET_DESC(R, i, struct atl1c_recv_ret_status)
109
110/* tpd word 1 bit 0:7 General Checksum task offload */
111#define TPD_L4HDR_OFFSET_MASK 0x00FF
112#define TPD_L4HDR_OFFSET_SHIFT 0
113
114/* tpd word 1 bit 0:7 Large Send task offload (IPv4/IPV6) */
115#define TPD_TCPHDR_OFFSET_MASK 0x00FF
116#define TPD_TCPHDR_OFFSET_SHIFT 0
117
118/* tpd word 1 bit 0:7 Custom Checksum task offload */
119#define TPD_PLOADOFFSET_MASK 0x00FF
120#define TPD_PLOADOFFSET_SHIFT 0
121
122/* tpd word 1 bit 8:17 */
123#define TPD_CCSUM_EN_MASK 0x0001
124#define TPD_CCSUM_EN_SHIFT 8
125#define TPD_IP_CSUM_MASK 0x0001
126#define TPD_IP_CSUM_SHIFT 9
127#define TPD_TCP_CSUM_MASK 0x0001
128#define TPD_TCP_CSUM_SHIFT 10
129#define TPD_UDP_CSUM_MASK 0x0001
130#define TPD_UDP_CSUM_SHIFT 11
131#define TPD_LSO_EN_MASK 0x0001 /* TCP Large Send Offload */
132#define TPD_LSO_EN_SHIFT 12
133#define TPD_LSO_VER_MASK 0x0001
134#define TPD_LSO_VER_SHIFT 13 /* 0 : ipv4; 1 : ipv4/ipv6 */
135#define TPD_CON_VTAG_MASK 0x0001
136#define TPD_CON_VTAG_SHIFT 14
137#define TPD_INS_VTAG_MASK 0x0001
138#define TPD_INS_VTAG_SHIFT 15
139#define TPD_IPV4_PACKET_MASK 0x0001 /* valid when LSO VER is 1 */
140#define TPD_IPV4_PACKET_SHIFT 16
141#define TPD_ETH_TYPE_MASK 0x0001
142#define TPD_ETH_TYPE_SHIFT 17 /* 0 : 802.3 frame; 1 : Ethernet */
143
144/* tpd word 18:25 Custom Checksum task offload */
145#define TPD_CCSUM_OFFSET_MASK 0x00FF
146#define TPD_CCSUM_OFFSET_SHIFT 18
147#define TPD_CCSUM_EPAD_MASK 0x0001
148#define TPD_CCSUM_EPAD_SHIFT 30
149
150/* tpd word 18:30 Large Send task offload (IPv4/IPV6) */
151#define TPD_MSS_MASK 0x1FFF
152#define TPD_MSS_SHIFT 18
153
154#define TPD_EOP_MASK 0x0001
155#define TPD_EOP_SHIFT 31
156
157struct atl1c_tpd_desc {
158 __le16 buffer_len; /* include 4-byte CRC */
159 __le16 vlan_tag;
160 __le32 word1;
161 __le64 buffer_addr;
162};
163
164struct atl1c_tpd_ext_desc {
165 u32 reservd_0;
166 __le32 word1;
167 __le32 pkt_len;
168 u32 reservd_1;
169};
170/* rrs word 0 bit 0:31 */
171#define RRS_RX_CSUM_MASK 0xFFFF
172#define RRS_RX_CSUM_SHIFT 0
173#define RRS_RX_RFD_CNT_MASK 0x000F
174#define RRS_RX_RFD_CNT_SHIFT 16
175#define RRS_RX_RFD_INDEX_MASK 0x0FFF
176#define RRS_RX_RFD_INDEX_SHIFT 20
177
178/* rrs flag bit 0:16 */
179#define RRS_HEAD_LEN_MASK 0x00FF
180#define RRS_HEAD_LEN_SHIFT 0
181#define RRS_HDS_TYPE_MASK 0x0003
182#define RRS_HDS_TYPE_SHIFT 8
183#define RRS_CPU_NUM_MASK 0x0003
184#define RRS_CPU_NUM_SHIFT 10
185#define RRS_HASH_FLG_MASK 0x000F
186#define RRS_HASH_FLG_SHIFT 12
187
188#define RRS_HDS_TYPE_HEAD 1
189#define RRS_HDS_TYPE_DATA 2
190
191#define RRS_IS_NO_HDS_TYPE(flag) \
192 (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == 0)
193
194#define RRS_IS_HDS_HEAD(flag) \
195 (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
196 RRS_HDS_TYPE_HEAD)
197
198#define RRS_IS_HDS_DATA(flag) \
199 (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
200 RRS_HDS_TYPE_DATA)
201
202/* rrs word 3 bit 0:31 */
203#define RRS_PKT_SIZE_MASK 0x3FFF
204#define RRS_PKT_SIZE_SHIFT 0
205#define RRS_ERR_L4_CSUM_MASK 0x0001
206#define RRS_ERR_L4_CSUM_SHIFT 14
207#define RRS_ERR_IP_CSUM_MASK 0x0001
208#define RRS_ERR_IP_CSUM_SHIFT 15
209#define RRS_VLAN_INS_MASK 0x0001
210#define RRS_VLAN_INS_SHIFT 16
211#define RRS_PROT_ID_MASK 0x0007
212#define RRS_PROT_ID_SHIFT 17
213#define RRS_RX_ERR_SUM_MASK 0x0001
214#define RRS_RX_ERR_SUM_SHIFT 20
215#define RRS_RX_ERR_CRC_MASK 0x0001
216#define RRS_RX_ERR_CRC_SHIFT 21
217#define RRS_RX_ERR_FAE_MASK 0x0001
218#define RRS_RX_ERR_FAE_SHIFT 22
219#define RRS_RX_ERR_TRUNC_MASK 0x0001
220#define RRS_RX_ERR_TRUNC_SHIFT 23
221#define RRS_RX_ERR_RUNC_MASK 0x0001
222#define RRS_RX_ERR_RUNC_SHIFT 24
223#define RRS_RX_ERR_ICMP_MASK 0x0001
224#define RRS_RX_ERR_ICMP_SHIFT 25
225#define RRS_PACKET_BCAST_MASK 0x0001
226#define RRS_PACKET_BCAST_SHIFT 26
227#define RRS_PACKET_MCAST_MASK 0x0001
228#define RRS_PACKET_MCAST_SHIFT 27
229#define RRS_PACKET_TYPE_MASK 0x0001
230#define RRS_PACKET_TYPE_SHIFT 28
231#define RRS_FIFO_FULL_MASK 0x0001
232#define RRS_FIFO_FULL_SHIFT 29
233#define RRS_802_3_LEN_ERR_MASK 0x0001
234#define RRS_802_3_LEN_ERR_SHIFT 30
235#define RRS_RXD_UPDATED_MASK 0x0001
236#define RRS_RXD_UPDATED_SHIFT 31
237
238#define RRS_ERR_L4_CSUM 0x00004000
239#define RRS_ERR_IP_CSUM 0x00008000
240#define RRS_VLAN_INS 0x00010000
241#define RRS_RX_ERR_SUM 0x00100000
242#define RRS_RX_ERR_CRC 0x00200000
243#define RRS_802_3_LEN_ERR 0x40000000
244#define RRS_RXD_UPDATED 0x80000000
245
246#define RRS_PACKET_TYPE_802_3 1
247#define RRS_PACKET_TYPE_ETH 0
248#define RRS_PACKET_IS_ETH(word) \
249 (((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK == \
250 RRS_PACKET_TYPE_ETH)
251#define RRS_RXD_IS_VALID(word) \
252 ((((word) >> RRS_RXD_UPDATED_SHIFT) & RRS_RXD_UPDATED_MASK) == 1)
253
254#define RRS_PACKET_PROT_IS_IPV4_ONLY(word) \
255 ((((word) >> RRS_PROT_ID_SHIFT) & RRS_PROT_ID_MASK) == 1)
256#define RRS_PACKET_PROT_IS_IPV6_ONLY(word) \
257 ((((word) >> RRS_PROT_ID_SHIFT) & RRS_PROT_ID_MASK) == 6)
258
259struct atl1c_recv_ret_status {
260 __le32 word0;
261 __le32 rss_hash;
262 __le16 vlan_tag;
263 __le16 flag;
264 __le32 word3;
265};
266
267/* RFD desciptor */
268struct atl1c_rx_free_desc {
269 __le64 buffer_addr;
270};
271
272/* DMA Order Settings */
273enum atl1c_dma_order {
274 atl1c_dma_ord_in = 1,
275 atl1c_dma_ord_enh = 2,
276 atl1c_dma_ord_out = 4
277};
278
279enum atl1c_dma_rcb {
280 atl1c_rcb_64 = 0,
281 atl1c_rcb_128 = 1
282};
283
284enum atl1c_mac_speed {
285 atl1c_mac_speed_0 = 0,
286 atl1c_mac_speed_10_100 = 1,
287 atl1c_mac_speed_1000 = 2
288};
289
290enum atl1c_dma_req_block {
291 atl1c_dma_req_128 = 0,
292 atl1c_dma_req_256 = 1,
293 atl1c_dma_req_512 = 2,
294 atl1c_dma_req_1024 = 3,
295 atl1c_dma_req_2048 = 4,
296 atl1c_dma_req_4096 = 5
297};
298
299enum atl1c_rss_mode {
300 atl1c_rss_mode_disable = 0,
301 atl1c_rss_sig_que = 1,
302 atl1c_rss_mul_que_sig_int = 2,
303 atl1c_rss_mul_que_mul_int = 4,
304};
305
306enum atl1c_rss_type {
307 atl1c_rss_disable = 0,
308 atl1c_rss_ipv4 = 1,
309 atl1c_rss_ipv4_tcp = 2,
310 atl1c_rss_ipv6 = 4,
311 atl1c_rss_ipv6_tcp = 8
312};
313
314enum atl1c_nic_type {
315 athr_l1c = 0,
316 athr_l2c = 1,
317};
318
319enum atl1c_trans_queue {
320 atl1c_trans_normal = 0,
321 atl1c_trans_high = 1
322};
323
324struct atl1c_hw_stats {
325 /* rx */
326 unsigned long rx_ok; /* The number of good packet received. */
327 unsigned long rx_bcast; /* The number of good broadcast packet received. */
328 unsigned long rx_mcast; /* The number of good multicast packet received. */
329 unsigned long rx_pause; /* The number of Pause packet received. */
330 unsigned long rx_ctrl; /* The number of Control packet received other than Pause frame. */
331 unsigned long rx_fcs_err; /* The number of packets with bad FCS. */
332 unsigned long rx_len_err; /* The number of packets with mismatch of length field and actual size. */
333 unsigned long rx_byte_cnt; /* The number of bytes of good packet received. FCS is NOT included. */
334 unsigned long rx_runt; /* The number of packets received that are less than 64 byte long and with good FCS. */
335 unsigned long rx_frag; /* The number of packets received that are less than 64 byte long and with bad FCS. */
336 unsigned long rx_sz_64; /* The number of good and bad packets received that are 64 byte long. */
337 unsigned long rx_sz_65_127; /* The number of good and bad packets received that are between 65 and 127-byte long. */
338 unsigned long rx_sz_128_255; /* The number of good and bad packets received that are between 128 and 255-byte long. */
339 unsigned long rx_sz_256_511; /* The number of good and bad packets received that are between 256 and 511-byte long. */
340 unsigned long rx_sz_512_1023; /* The number of good and bad packets received that are between 512 and 1023-byte long. */
341 unsigned long rx_sz_1024_1518; /* The number of good and bad packets received that are between 1024 and 1518-byte long. */
342 unsigned long rx_sz_1519_max; /* The number of good and bad packets received that are between 1519-byte and MTU. */
343 unsigned long rx_sz_ov; /* The number of good and bad packets received that are more than MTU size truncated by Selene. */
344 unsigned long rx_rxf_ov; /* The number of frame dropped due to occurrence of RX FIFO overflow. */
345 unsigned long rx_rrd_ov; /* The number of frame dropped due to occurrence of RRD overflow. */
346 unsigned long rx_align_err; /* Alignment Error */
347 unsigned long rx_bcast_byte_cnt; /* The byte count of broadcast packet received, excluding FCS. */
348 unsigned long rx_mcast_byte_cnt; /* The byte count of multicast packet received, excluding FCS. */
349 unsigned long rx_err_addr; /* The number of packets dropped due to address filtering. */
350
351 /* tx */
352 unsigned long tx_ok; /* The number of good packet transmitted. */
353 unsigned long tx_bcast; /* The number of good broadcast packet transmitted. */
354 unsigned long tx_mcast; /* The number of good multicast packet transmitted. */
355 unsigned long tx_pause; /* The number of Pause packet transmitted. */
356 unsigned long tx_exc_defer; /* The number of packets transmitted with excessive deferral. */
357 unsigned long tx_ctrl; /* The number of packets transmitted is a control frame, excluding Pause frame. */
358 unsigned long tx_defer; /* The number of packets transmitted that is deferred. */
359 unsigned long tx_byte_cnt; /* The number of bytes of data transmitted. FCS is NOT included. */
360 unsigned long tx_sz_64; /* The number of good and bad packets transmitted that are 64 byte long. */
361 unsigned long tx_sz_65_127; /* The number of good and bad packets transmitted that are between 65 and 127-byte long. */
362 unsigned long tx_sz_128_255; /* The number of good and bad packets transmitted that are between 128 and 255-byte long. */
363 unsigned long tx_sz_256_511; /* The number of good and bad packets transmitted that are between 256 and 511-byte long. */
364 unsigned long tx_sz_512_1023; /* The number of good and bad packets transmitted that are between 512 and 1023-byte long. */
365 unsigned long tx_sz_1024_1518; /* The number of good and bad packets transmitted that are between 1024 and 1518-byte long. */
366 unsigned long tx_sz_1519_max; /* The number of good and bad packets transmitted that are between 1519-byte and MTU. */
367 unsigned long tx_1_col; /* The number of packets subsequently transmitted successfully with a single prior collision. */
368 unsigned long tx_2_col; /* The number of packets subsequently transmitted successfully with multiple prior collisions. */
369 unsigned long tx_late_col; /* The number of packets transmitted with late collisions. */
370 unsigned long tx_abort_col; /* The number of transmit packets aborted due to excessive collisions. */
371 unsigned long tx_underrun; /* The number of transmit packets aborted due to transmit FIFO underrun, or TRD FIFO underrun */
372 unsigned long tx_rd_eop; /* The number of times that read beyond the EOP into the next frame area when TRD was not written timely */
373 unsigned long tx_len_err; /* The number of transmit packets with length field does NOT match the actual frame size. */
374 unsigned long tx_trunc; /* The number of transmit packets truncated due to size exceeding MTU. */
375 unsigned long tx_bcast_byte; /* The byte count of broadcast packet transmitted, excluding FCS. */
376 unsigned long tx_mcast_byte; /* The byte count of multicast packet transmitted, excluding FCS. */
377};
378
379struct atl1c_hw {
380 u8 __iomem *hw_addr; /* inner register address */
381 struct atl1c_adapter *adapter;
382 enum atl1c_nic_type nic_type;
383 enum atl1c_dma_order dma_order;
384 enum atl1c_dma_rcb rcb_value;
385 enum atl1c_dma_req_block dmar_block;
386 enum atl1c_dma_req_block dmaw_block;
387
388 u16 device_id;
389 u16 vendor_id;
390 u16 subsystem_id;
391 u16 subsystem_vendor_id;
392 u8 revision_id;
393
394 u32 intr_mask;
395 u8 dmaw_dly_cnt;
396 u8 dmar_dly_cnt;
397
398 u8 preamble_len;
399 u16 max_frame_size;
400 u16 min_frame_size;
401
402 enum atl1c_mac_speed mac_speed;
403 bool mac_duplex;
404 bool hibernate;
405 u16 media_type;
406#define MEDIA_TYPE_AUTO_SENSOR 0
407#define MEDIA_TYPE_100M_FULL 1
408#define MEDIA_TYPE_100M_HALF 2
409#define MEDIA_TYPE_10M_FULL 3
410#define MEDIA_TYPE_10M_HALF 4
411
412 u16 autoneg_advertised;
413 u16 mii_autoneg_adv_reg;
414 u16 mii_1000t_ctrl_reg;
415
416 u16 tx_imt; /* TX Interrupt Moderator timer ( 2us resolution) */
417 u16 rx_imt; /* RX Interrupt Moderator timer ( 2us resolution) */
418 u16 ict; /* Interrupt Clear timer (2us resolution) */
419 u16 ctrl_flags;
420#define ATL1C_INTR_CLEAR_ON_READ 0x0001
421#define ATL1C_INTR_MODRT_ENABLE 0x0002
422#define ATL1C_CMB_ENABLE 0x0004
423#define ATL1C_SMB_ENABLE 0x0010
424#define ATL1C_TXQ_MODE_ENHANCE 0x0020
425#define ATL1C_RX_IPV6_CHKSUM 0x0040
426#define ATL1C_ASPM_L0S_SUPPORT 0x0080
427#define ATL1C_ASPM_L1_SUPPORT 0x0100
428#define ATL1C_ASPM_CTRL_MON 0x0200
429#define ATL1C_HIB_DISABLE 0x0400
430#define ATL1C_LINK_CAP_1000M 0x0800
431#define ATL1C_FPGA_VERSION 0x8000
432 u16 cmb_tpd;
433 u16 cmb_rrd;
434 u16 cmb_rx_timer; /* 2us resolution */
435 u16 cmb_tx_timer;
436 u32 smb_timer;
437
438 u16 rrd_thresh; /* Threshold of number of RRD produced to trigger
439 interrupt request */
440 u16 tpd_thresh;
441 u8 tpd_burst; /* Number of TPD to prefetch in cache-aligned burst. */
442 u8 rfd_burst;
443 enum atl1c_rss_type rss_type;
444 enum atl1c_rss_mode rss_mode;
445 u8 rss_hash_bits;
446 u32 base_cpu;
447 u32 indirect_tab;
448 u8 mac_addr[ETH_ALEN];
449 u8 perm_mac_addr[ETH_ALEN];
450
451 bool phy_configured;
452 bool re_autoneg;
453 bool emi_ca;
454};
455
456/*
457 * atl1c_ring_header represents a single, contiguous block of DMA space
458 * mapped for the three descriptor rings (tpd, rfd, rrd) and the two
459 * message blocks (cmb, smb) described below
460 */
461struct atl1c_ring_header {
462 void *desc; /* virtual address */
463 dma_addr_t dma; /* physical address*/
464 unsigned int size; /* length in bytes */
465};
466
467/*
468 * atl1c_buffer is wrapper around a pointer to a socket buffer
469 * so a DMA handle can be stored along with the skb
470 */
471struct atl1c_buffer {
472 struct sk_buff *skb; /* socket buffer */
473 u16 length; /* rx buffer length */
474 u16 state; /* state of buffer */
475#define ATL1_BUFFER_FREE 0
476#define ATL1_BUFFER_BUSY 1
477 dma_addr_t dma;
478};
479
480/* transimit packet descriptor (tpd) ring */
481struct atl1c_tpd_ring {
482 void *desc; /* descriptor ring virtual address */
483 dma_addr_t dma; /* descriptor ring physical address */
484 u16 size; /* descriptor ring length in bytes */
485 u16 count; /* number of descriptors in the ring */
486 u16 next_to_use; /* this is protectd by adapter->tx_lock */
487 atomic_t next_to_clean;
488 struct atl1c_buffer *buffer_info;
489};
490
491/* receive free descriptor (rfd) ring */
492struct atl1c_rfd_ring {
493 void *desc; /* descriptor ring virtual address */
494 dma_addr_t dma; /* descriptor ring physical address */
495 u16 size; /* descriptor ring length in bytes */
496 u16 count; /* number of descriptors in the ring */
497 u16 next_to_use;
498 u16 next_to_clean;
499 struct atl1c_buffer *buffer_info;
500};
501
502/* receive return desciptor (rrd) ring */
503struct atl1c_rrd_ring {
504 void *desc; /* descriptor ring virtual address */
505 dma_addr_t dma; /* descriptor ring physical address */
506 u16 size; /* descriptor ring length in bytes */
507 u16 count; /* number of descriptors in the ring */
508 u16 next_to_use;
509 u16 next_to_clean;
510};
511
512struct atl1c_cmb {
513 void *cmb;
514 dma_addr_t dma;
515};
516
517struct atl1c_smb {
518 void *smb;
519 dma_addr_t dma;
520};
521
522/* board specific private data structure */
523struct atl1c_adapter {
524 struct net_device *netdev;
525 struct pci_dev *pdev;
526 struct vlan_group *vlgrp;
527 struct napi_struct napi;
528 struct atl1c_hw hw;
529 struct atl1c_hw_stats hw_stats;
530 struct net_device_stats net_stats;
531 struct mii_if_info mii; /* MII interface info */
532 u16 rx_buffer_len;
533
534 unsigned long flags;
535#define __AT_TESTING 0x0001
536#define __AT_RESETTING 0x0002
537#define __AT_DOWN 0x0003
538 u32 msg_enable;
539
540 bool have_msi;
541 u32 wol;
542 u16 link_speed;
543 u16 link_duplex;
544
545 spinlock_t mdio_lock;
546 spinlock_t tx_lock;
547 atomic_t irq_sem;
548
549 struct work_struct reset_task;
550 struct work_struct link_chg_task;
551 struct timer_list watchdog_timer;
552 struct timer_list phy_config_timer;
553
554 /* All Descriptor memory */
555 struct atl1c_ring_header ring_header;
556 struct atl1c_tpd_ring tpd_ring[AT_MAX_TRANSMIT_QUEUE];
557 struct atl1c_rfd_ring rfd_ring[AT_MAX_RECEIVE_QUEUE];
558 struct atl1c_rrd_ring rrd_ring[AT_MAX_RECEIVE_QUEUE];
559 struct atl1c_cmb cmb;
560 struct atl1c_smb smb;
561 int num_rx_queues;
562 u32 bd_number; /* board number;*/
563};
564
565#define AT_WRITE_REG(a, reg, value) ( \
566 writel((value), ((a)->hw_addr + reg)))
567
568#define AT_WRITE_FLUSH(a) (\
569 readl((a)->hw_addr))
570
571#define AT_READ_REG(a, reg, pdata) do { \
572 if (unlikely((a)->hibernate)) { \
573 readl((a)->hw_addr + reg); \
574 *(u32 *)pdata = readl((a)->hw_addr + reg); \
575 } else { \
576 *(u32 *)pdata = readl((a)->hw_addr + reg); \
577 } \
578 } while (0)
579
580#define AT_WRITE_REGB(a, reg, value) (\
581 writeb((value), ((a)->hw_addr + reg)))
582
583#define AT_READ_REGB(a, reg) (\
584 readb((a)->hw_addr + reg))
585
586#define AT_WRITE_REGW(a, reg, value) (\
587 writew((value), ((a)->hw_addr + reg)))
588
589#define AT_READ_REGW(a, reg) (\
590 readw((a)->hw_addr + reg))
591
592#define AT_WRITE_REG_ARRAY(a, reg, offset, value) ( \
593 writel((value), (((a)->hw_addr + reg) + ((offset) << 2))))
594
595#define AT_READ_REG_ARRAY(a, reg, offset) ( \
596 readl(((a)->hw_addr + reg) + ((offset) << 2)))
597
598extern char atl1c_driver_name[];
599extern char atl1c_driver_version[];
600
601extern int atl1c_up(struct atl1c_adapter *adapter);
602extern void atl1c_down(struct atl1c_adapter *adapter);
603extern void atl1c_reinit_locked(struct atl1c_adapter *adapter);
604extern s32 atl1c_reset_hw(struct atl1c_hw *hw);
605extern void atl1c_set_ethtool_ops(struct net_device *netdev);
606#endif /* _ATL1C_H_ */
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
new file mode 100644
index 000000000000..45c5b7332cd3
--- /dev/null
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -0,0 +1,317 @@
1/*
2 * Copyright(c) 2009 - 2009 Atheros Corporation. All rights reserved.
3 *
4 * Derived from Intel e1000 driver
5 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 */
22
23#include <linux/netdevice.h>
24#include <linux/ethtool.h>
25
26#include "atl1c.h"
27
28static int atl1c_get_settings(struct net_device *netdev,
29 struct ethtool_cmd *ecmd)
30{
31 struct atl1c_adapter *adapter = netdev_priv(netdev);
32 struct atl1c_hw *hw = &adapter->hw;
33
34 ecmd->supported = (SUPPORTED_10baseT_Half |
35 SUPPORTED_10baseT_Full |
36 SUPPORTED_100baseT_Half |
37 SUPPORTED_100baseT_Full |
38 SUPPORTED_Autoneg |
39 SUPPORTED_TP);
40 if (hw->ctrl_flags & ATL1C_LINK_CAP_1000M)
41 ecmd->supported |= SUPPORTED_1000baseT_Full;
42
43 ecmd->advertising = ADVERTISED_TP;
44
45 ecmd->advertising |= hw->autoneg_advertised;
46
47 ecmd->port = PORT_TP;
48 ecmd->phy_address = 0;
49 ecmd->transceiver = XCVR_INTERNAL;
50
51 if (adapter->link_speed != SPEED_0) {
52 ecmd->speed = adapter->link_speed;
53 if (adapter->link_duplex == FULL_DUPLEX)
54 ecmd->duplex = DUPLEX_FULL;
55 else
56 ecmd->duplex = DUPLEX_HALF;
57 } else {
58 ecmd->speed = -1;
59 ecmd->duplex = -1;
60 }
61
62 ecmd->autoneg = AUTONEG_ENABLE;
63 return 0;
64}
65
66static int atl1c_set_settings(struct net_device *netdev,
67 struct ethtool_cmd *ecmd)
68{
69 struct atl1c_adapter *adapter = netdev_priv(netdev);
70 struct atl1c_hw *hw = &adapter->hw;
71 u16 autoneg_advertised;
72
73 while (test_and_set_bit(__AT_RESETTING, &adapter->flags))
74 msleep(1);
75
76 if (ecmd->autoneg == AUTONEG_ENABLE) {
77 autoneg_advertised = ADVERTISED_Autoneg;
78 } else {
79 if (ecmd->speed == SPEED_1000) {
80 if (ecmd->duplex != DUPLEX_FULL) {
81 if (netif_msg_link(adapter))
82 dev_warn(&adapter->pdev->dev,
83 "1000M half is invalid\n");
84 clear_bit(__AT_RESETTING, &adapter->flags);
85 return -EINVAL;
86 }
87 autoneg_advertised = ADVERTISED_1000baseT_Full;
88 } else if (ecmd->speed == SPEED_100) {
89 if (ecmd->duplex == DUPLEX_FULL)
90 autoneg_advertised = ADVERTISED_100baseT_Full;
91 else
92 autoneg_advertised = ADVERTISED_100baseT_Half;
93 } else {
94 if (ecmd->duplex == DUPLEX_FULL)
95 autoneg_advertised = ADVERTISED_10baseT_Full;
96 else
97 autoneg_advertised = ADVERTISED_10baseT_Half;
98 }
99 }
100
101 if (hw->autoneg_advertised != autoneg_advertised) {
102 hw->autoneg_advertised = autoneg_advertised;
103 if (atl1c_restart_autoneg(hw) != 0) {
104 if (netif_msg_link(adapter))
105 dev_warn(&adapter->pdev->dev,
106 "ethtool speed/duplex setting failed\n");
107 clear_bit(__AT_RESETTING, &adapter->flags);
108 return -EINVAL;
109 }
110 }
111 clear_bit(__AT_RESETTING, &adapter->flags);
112 return 0;
113}
114
115static u32 atl1c_get_tx_csum(struct net_device *netdev)
116{
117 return (netdev->features & NETIF_F_HW_CSUM) != 0;
118}
119
120static u32 atl1c_get_msglevel(struct net_device *netdev)
121{
122 struct atl1c_adapter *adapter = netdev_priv(netdev);
123 return adapter->msg_enable;
124}
125
126static void atl1c_set_msglevel(struct net_device *netdev, u32 data)
127{
128 struct atl1c_adapter *adapter = netdev_priv(netdev);
129 adapter->msg_enable = data;
130}
131
132static int atl1c_get_regs_len(struct net_device *netdev)
133{
134 return AT_REGS_LEN;
135}
136
137static void atl1c_get_regs(struct net_device *netdev,
138 struct ethtool_regs *regs, void *p)
139{
140 struct atl1c_adapter *adapter = netdev_priv(netdev);
141 struct atl1c_hw *hw = &adapter->hw;
142 u32 *regs_buff = p;
143 u16 phy_data;
144
145 memset(p, 0, AT_REGS_LEN);
146
147 regs->version = 0;
148 AT_READ_REG(hw, REG_VPD_CAP, p++);
149 AT_READ_REG(hw, REG_PM_CTRL, p++);
150 AT_READ_REG(hw, REG_MAC_HALF_DUPLX_CTRL, p++);
151 AT_READ_REG(hw, REG_TWSI_CTRL, p++);
152 AT_READ_REG(hw, REG_PCIE_DEV_MISC_CTRL, p++);
153 AT_READ_REG(hw, REG_MASTER_CTRL, p++);
154 AT_READ_REG(hw, REG_MANUAL_TIMER_INIT, p++);
155 AT_READ_REG(hw, REG_IRQ_MODRT_TIMER_INIT, p++);
156 AT_READ_REG(hw, REG_GPHY_CTRL, p++);
157 AT_READ_REG(hw, REG_LINK_CTRL, p++);
158 AT_READ_REG(hw, REG_IDLE_STATUS, p++);
159 AT_READ_REG(hw, REG_MDIO_CTRL, p++);
160 AT_READ_REG(hw, REG_SERDES_LOCK, p++);
161 AT_READ_REG(hw, REG_MAC_CTRL, p++);
162 AT_READ_REG(hw, REG_MAC_IPG_IFG, p++);
163 AT_READ_REG(hw, REG_MAC_STA_ADDR, p++);
164 AT_READ_REG(hw, REG_MAC_STA_ADDR+4, p++);
165 AT_READ_REG(hw, REG_RX_HASH_TABLE, p++);
166 AT_READ_REG(hw, REG_RX_HASH_TABLE+4, p++);
167 AT_READ_REG(hw, REG_RXQ_CTRL, p++);
168 AT_READ_REG(hw, REG_TXQ_CTRL, p++);
169 AT_READ_REG(hw, REG_MTU, p++);
170 AT_READ_REG(hw, REG_WOL_CTRL, p++);
171
172 atl1c_read_phy_reg(hw, MII_BMCR, &phy_data);
173 regs_buff[73] = (u32) phy_data;
174 atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
175 regs_buff[74] = (u32) phy_data;
176}
177
178static int atl1c_get_eeprom_len(struct net_device *netdev)
179{
180 struct atl1c_adapter *adapter = netdev_priv(netdev);
181
182 if (atl1c_check_eeprom_exist(&adapter->hw))
183 return AT_EEPROM_LEN;
184 else
185 return 0;
186}
187
188static int atl1c_get_eeprom(struct net_device *netdev,
189 struct ethtool_eeprom *eeprom, u8 *bytes)
190{
191 struct atl1c_adapter *adapter = netdev_priv(netdev);
192 struct atl1c_hw *hw = &adapter->hw;
193 u32 *eeprom_buff;
194 int first_dword, last_dword;
195 int ret_val = 0;
196 int i;
197
198 if (eeprom->len == 0)
199 return -EINVAL;
200
201 if (!atl1c_check_eeprom_exist(hw)) /* not exist */
202 return -EINVAL;
203
204 eeprom->magic = adapter->pdev->vendor |
205 (adapter->pdev->device << 16);
206
207 first_dword = eeprom->offset >> 2;
208 last_dword = (eeprom->offset + eeprom->len - 1) >> 2;
209
210 eeprom_buff = kmalloc(sizeof(u32) *
211 (last_dword - first_dword + 1), GFP_KERNEL);
212 if (eeprom_buff == NULL)
213 return -ENOMEM;
214
215 for (i = first_dword; i < last_dword; i++) {
216 if (!atl1c_read_eeprom(hw, i * 4, &(eeprom_buff[i-first_dword]))) {
217 kfree(eeprom_buff);
218 return -EIO;
219 }
220 }
221
222 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
223 eeprom->len);
224 kfree(eeprom_buff);
225
226 return ret_val;
227 return 0;
228}
229
230static void atl1c_get_drvinfo(struct net_device *netdev,
231 struct ethtool_drvinfo *drvinfo)
232{
233 struct atl1c_adapter *adapter = netdev_priv(netdev);
234
235 strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver));
236 strncpy(drvinfo->version, atl1c_driver_version,
237 sizeof(drvinfo->version));
238 strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
239 strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
240 sizeof(drvinfo->bus_info));
241 drvinfo->n_stats = 0;
242 drvinfo->testinfo_len = 0;
243 drvinfo->regdump_len = atl1c_get_regs_len(netdev);
244 drvinfo->eedump_len = atl1c_get_eeprom_len(netdev);
245}
246
247static void atl1c_get_wol(struct net_device *netdev,
248 struct ethtool_wolinfo *wol)
249{
250 struct atl1c_adapter *adapter = netdev_priv(netdev);
251
252 wol->supported = WAKE_MAGIC | WAKE_PHY;
253 wol->wolopts = 0;
254
255 if (adapter->wol & AT_WUFC_EX)
256 wol->wolopts |= WAKE_UCAST;
257 if (adapter->wol & AT_WUFC_MC)
258 wol->wolopts |= WAKE_MCAST;
259 if (adapter->wol & AT_WUFC_BC)
260 wol->wolopts |= WAKE_BCAST;
261 if (adapter->wol & AT_WUFC_MAG)
262 wol->wolopts |= WAKE_MAGIC;
263 if (adapter->wol & AT_WUFC_LNKC)
264 wol->wolopts |= WAKE_PHY;
265
266 return;
267}
268
269static int atl1c_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
270{
271 struct atl1c_adapter *adapter = netdev_priv(netdev);
272
273 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE |
274 WAKE_MCAST | WAKE_BCAST | WAKE_MCAST))
275 return -EOPNOTSUPP;
276 /* these settings will always override what we currently have */
277 adapter->wol = 0;
278
279 if (wol->wolopts & WAKE_MAGIC)
280 adapter->wol |= AT_WUFC_MAG;
281 if (wol->wolopts & WAKE_PHY)
282 adapter->wol |= AT_WUFC_LNKC;
283
284 return 0;
285}
286
287static int atl1c_nway_reset(struct net_device *netdev)
288{
289 struct atl1c_adapter *adapter = netdev_priv(netdev);
290 if (netif_running(netdev))
291 atl1c_reinit_locked(adapter);
292 return 0;
293}
294
295static struct ethtool_ops atl1c_ethtool_ops = {
296 .get_settings = atl1c_get_settings,
297 .set_settings = atl1c_set_settings,
298 .get_drvinfo = atl1c_get_drvinfo,
299 .get_regs_len = atl1c_get_regs_len,
300 .get_regs = atl1c_get_regs,
301 .get_wol = atl1c_get_wol,
302 .set_wol = atl1c_set_wol,
303 .get_msglevel = atl1c_get_msglevel,
304 .set_msglevel = atl1c_set_msglevel,
305 .nway_reset = atl1c_nway_reset,
306 .get_link = ethtool_op_get_link,
307 .get_eeprom_len = atl1c_get_eeprom_len,
308 .get_eeprom = atl1c_get_eeprom,
309 .get_tx_csum = atl1c_get_tx_csum,
310 .get_sg = ethtool_op_get_sg,
311 .set_sg = ethtool_op_set_sg,
312};
313
314void atl1c_set_ethtool_ops(struct net_device *netdev)
315{
316 SET_ETHTOOL_OPS(netdev, &atl1c_ethtool_ops);
317}
diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c
new file mode 100644
index 000000000000..3e69b940b8f7
--- /dev/null
+++ b/drivers/net/atl1c/atl1c_hw.c
@@ -0,0 +1,527 @@
1/*
2 * Copyright(c) 2007 Atheros Corporation. All rights reserved.
3 *
4 * Derived from Intel e1000 driver
5 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21#include <linux/pci.h>
22#include <linux/delay.h>
23#include <linux/mii.h>
24#include <linux/crc32.h>
25
26#include "atl1c.h"
27
28/*
29 * check_eeprom_exist
30 * return 1 if eeprom exist
31 */
32int atl1c_check_eeprom_exist(struct atl1c_hw *hw)
33{
34 u32 data;
35
36 AT_READ_REG(hw, REG_TWSI_DEBUG, &data);
37 if (data & TWSI_DEBUG_DEV_EXIST)
38 return 1;
39
40 return 0;
41}
42
43void atl1c_hw_set_mac_addr(struct atl1c_hw *hw)
44{
45 u32 value;
46 /*
47 * 00-0B-6A-F6-00-DC
48 * 0: 6AF600DC 1: 000B
49 * low dword
50 */
51 value = (((u32)hw->mac_addr[2]) << 24) |
52 (((u32)hw->mac_addr[3]) << 16) |
53 (((u32)hw->mac_addr[4]) << 8) |
54 (((u32)hw->mac_addr[5])) ;
55 AT_WRITE_REG_ARRAY(hw, REG_MAC_STA_ADDR, 0, value);
56 /* hight dword */
57 value = (((u32)hw->mac_addr[0]) << 8) |
58 (((u32)hw->mac_addr[1])) ;
59 AT_WRITE_REG_ARRAY(hw, REG_MAC_STA_ADDR, 1, value);
60}
61
62/*
63 * atl1c_get_permanent_address
64 * return 0 if get valid mac address,
65 */
66static int atl1c_get_permanent_address(struct atl1c_hw *hw)
67{
68 u32 addr[2];
69 u32 i;
70 u32 otp_ctrl_data;
71 u32 twsi_ctrl_data;
72 u8 eth_addr[ETH_ALEN];
73
74 /* init */
75 addr[0] = addr[1] = 0;
76 AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data);
77 if (atl1c_check_eeprom_exist(hw)) {
78 /* Enable OTP CLK */
79 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) {
80 otp_ctrl_data |= OTP_CTRL_CLK_EN;
81 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
82 AT_WRITE_FLUSH(hw);
83 msleep(1);
84 }
85
86 AT_READ_REG(hw, REG_TWSI_CTRL, &twsi_ctrl_data);
87 twsi_ctrl_data |= TWSI_CTRL_SW_LDSTART;
88 AT_WRITE_REG(hw, REG_TWSI_CTRL, twsi_ctrl_data);
89 for (i = 0; i < AT_TWSI_EEPROM_TIMEOUT; i++) {
90 msleep(10);
91 AT_READ_REG(hw, REG_TWSI_CTRL, &twsi_ctrl_data);
92 if ((twsi_ctrl_data & TWSI_CTRL_SW_LDSTART) == 0)
93 break;
94 }
95 if (i >= AT_TWSI_EEPROM_TIMEOUT)
96 return -1;
97 }
98 /* Disable OTP_CLK */
99 if (otp_ctrl_data & OTP_CTRL_CLK_EN) {
100 otp_ctrl_data &= ~OTP_CTRL_CLK_EN;
101 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
102 AT_WRITE_FLUSH(hw);
103 msleep(1);
104 }
105
106 /* maybe MAC-address is from BIOS */
107 AT_READ_REG(hw, REG_MAC_STA_ADDR, &addr[0]);
108 AT_READ_REG(hw, REG_MAC_STA_ADDR + 4, &addr[1]);
109 *(u32 *) &eth_addr[2] = swab32(addr[0]);
110 *(u16 *) &eth_addr[0] = swab16(*(u16 *)&addr[1]);
111
112 if (is_valid_ether_addr(eth_addr)) {
113 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
114 return 0;
115 }
116
117 return -1;
118}
119
120bool atl1c_read_eeprom(struct atl1c_hw *hw, u32 offset, u32 *p_value)
121{
122 int i;
123 int ret = false;
124 u32 otp_ctrl_data;
125 u32 control;
126 u32 data;
127
128 if (offset & 3)
129 return ret; /* address do not align */
130
131 AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data);
132 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN))
133 AT_WRITE_REG(hw, REG_OTP_CTRL,
134 (otp_ctrl_data | OTP_CTRL_CLK_EN));
135
136 AT_WRITE_REG(hw, REG_EEPROM_DATA_LO, 0);
137 control = (offset & EEPROM_CTRL_ADDR_MASK) << EEPROM_CTRL_ADDR_SHIFT;
138 AT_WRITE_REG(hw, REG_EEPROM_CTRL, control);
139
140 for (i = 0; i < 10; i++) {
141 udelay(100);
142 AT_READ_REG(hw, REG_EEPROM_CTRL, &control);
143 if (control & EEPROM_CTRL_RW)
144 break;
145 }
146 if (control & EEPROM_CTRL_RW) {
147 AT_READ_REG(hw, REG_EEPROM_CTRL, &data);
148 AT_READ_REG(hw, REG_EEPROM_DATA_LO, p_value);
149 data = data & 0xFFFF;
150 *p_value = swab32((data << 16) | (*p_value >> 16));
151 ret = true;
152 }
153 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN))
154 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
155
156 return ret;
157}
158/*
159 * Reads the adapter's MAC address from the EEPROM
160 *
161 * hw - Struct containing variables accessed by shared code
162 */
163int atl1c_read_mac_addr(struct atl1c_hw *hw)
164{
165 int err = 0;
166
167 err = atl1c_get_permanent_address(hw);
168 if (err)
169 random_ether_addr(hw->perm_mac_addr);
170
171 memcpy(hw->mac_addr, hw->perm_mac_addr, sizeof(hw->perm_mac_addr));
172 return 0;
173}
174
175/*
176 * atl1c_hash_mc_addr
177 * purpose
178 * set hash value for a multicast address
179 * hash calcu processing :
180 * 1. calcu 32bit CRC for multicast address
181 * 2. reverse crc with MSB to LSB
182 */
183u32 atl1c_hash_mc_addr(struct atl1c_hw *hw, u8 *mc_addr)
184{
185 u32 crc32;
186 u32 value = 0;
187 int i;
188
189 crc32 = ether_crc_le(6, mc_addr);
190 for (i = 0; i < 32; i++)
191 value |= (((crc32 >> i) & 1) << (31 - i));
192
193 return value;
194}
195
196/*
197 * Sets the bit in the multicast table corresponding to the hash value.
198 * hw - Struct containing variables accessed by shared code
199 * hash_value - Multicast address hash value
200 */
201void atl1c_hash_set(struct atl1c_hw *hw, u32 hash_value)
202{
203 u32 hash_bit, hash_reg;
204 u32 mta;
205
206 /*
207 * The HASH Table is a register array of 2 32-bit registers.
208 * It is treated like an array of 64 bits. We want to set
209 * bit BitArray[hash_value]. So we figure out what register
210 * the bit is in, read it, OR in the new bit, then write
211 * back the new value. The register is determined by the
212 * upper bit of the hash value and the bit within that
213 * register are determined by the lower 5 bits of the value.
214 */
215 hash_reg = (hash_value >> 31) & 0x1;
216 hash_bit = (hash_value >> 26) & 0x1F;
217
218 mta = AT_READ_REG_ARRAY(hw, REG_RX_HASH_TABLE, hash_reg);
219
220 mta |= (1 << hash_bit);
221
222 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, hash_reg, mta);
223}
224
225/*
226 * Reads the value from a PHY register
227 * hw - Struct containing variables accessed by shared code
228 * reg_addr - address of the PHY register to read
229 */
230int atl1c_read_phy_reg(struct atl1c_hw *hw, u16 reg_addr, u16 *phy_data)
231{
232 u32 val;
233 int i;
234
235 val = ((u32)(reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT |
236 MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW |
237 MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT;
238
239 AT_WRITE_REG(hw, REG_MDIO_CTRL, val);
240
241 for (i = 0; i < MDIO_WAIT_TIMES; i++) {
242 udelay(2);
243 AT_READ_REG(hw, REG_MDIO_CTRL, &val);
244 if (!(val & (MDIO_START | MDIO_BUSY)))
245 break;
246 }
247 if (!(val & (MDIO_START | MDIO_BUSY))) {
248 *phy_data = (u16)val;
249 return 0;
250 }
251
252 return -1;
253}
254
255/*
256 * Writes a value to a PHY register
257 * hw - Struct containing variables accessed by shared code
258 * reg_addr - address of the PHY register to write
259 * data - data to write to the PHY
260 */
261int atl1c_write_phy_reg(struct atl1c_hw *hw, u32 reg_addr, u16 phy_data)
262{
263 int i;
264 u32 val;
265
266 val = ((u32)(phy_data & MDIO_DATA_MASK)) << MDIO_DATA_SHIFT |
267 (reg_addr & MDIO_REG_ADDR_MASK) << MDIO_REG_ADDR_SHIFT |
268 MDIO_SUP_PREAMBLE | MDIO_START |
269 MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT;
270
271 AT_WRITE_REG(hw, REG_MDIO_CTRL, val);
272
273 for (i = 0; i < MDIO_WAIT_TIMES; i++) {
274 udelay(2);
275 AT_READ_REG(hw, REG_MDIO_CTRL, &val);
276 if (!(val & (MDIO_START | MDIO_BUSY)))
277 break;
278 }
279
280 if (!(val & (MDIO_START | MDIO_BUSY)))
281 return 0;
282
283 return -1;
284}
285
286/*
287 * Configures PHY autoneg and flow control advertisement settings
288 *
289 * hw - Struct containing variables accessed by shared code
290 */
291static int atl1c_phy_setup_adv(struct atl1c_hw *hw)
292{
293 u16 mii_adv_data = ADVERTISE_DEFAULT_CAP & ~ADVERTISE_SPEED_MASK;
294 u16 mii_giga_ctrl_data = GIGA_CR_1000T_DEFAULT_CAP &
295 ~GIGA_CR_1000T_SPEED_MASK;
296
297 if (hw->autoneg_advertised & ADVERTISED_10baseT_Half)
298 mii_adv_data |= ADVERTISE_10HALF;
299 if (hw->autoneg_advertised & ADVERTISED_10baseT_Full)
300 mii_adv_data |= ADVERTISE_10FULL;
301 if (hw->autoneg_advertised & ADVERTISED_100baseT_Half)
302 mii_adv_data |= ADVERTISE_100HALF;
303 if (hw->autoneg_advertised & ADVERTISED_100baseT_Full)
304 mii_adv_data |= ADVERTISE_100FULL;
305
306 if (hw->autoneg_advertised & ADVERTISED_Autoneg)
307 mii_adv_data |= ADVERTISE_10HALF | ADVERTISE_10FULL |
308 ADVERTISE_100HALF | ADVERTISE_100FULL;
309
310 if (hw->ctrl_flags & ATL1C_LINK_CAP_1000M) {
311 if (hw->autoneg_advertised & ADVERTISED_1000baseT_Half)
312 mii_giga_ctrl_data |= ADVERTISE_1000HALF;
313 if (hw->autoneg_advertised & ADVERTISED_1000baseT_Full)
314 mii_giga_ctrl_data |= ADVERTISE_1000FULL;
315 if (hw->autoneg_advertised & ADVERTISED_Autoneg)
316 mii_giga_ctrl_data |= ADVERTISE_1000HALF |
317 ADVERTISE_1000FULL;
318 }
319
320 if (atl1c_write_phy_reg(hw, MII_ADVERTISE, mii_adv_data) != 0 ||
321 atl1c_write_phy_reg(hw, MII_GIGA_CR, mii_giga_ctrl_data) != 0)
322 return -1;
323 return 0;
324}
325
326void atl1c_phy_disable(struct atl1c_hw *hw)
327{
328 AT_WRITE_REGW(hw, REG_GPHY_CTRL,
329 GPHY_CTRL_PW_WOL_DIS | GPHY_CTRL_EXT_RESET);
330}
331
332static void atl1c_phy_magic_data(struct atl1c_hw *hw)
333{
334 u16 data;
335
336 data = ANA_LOOP_SEL_10BT | ANA_EN_MASK_TB | ANA_EN_10BT_IDLE |
337 ((1 & ANA_INTERVAL_SEL_TIMER_MASK) <<
338 ANA_INTERVAL_SEL_TIMER_SHIFT);
339
340 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_18);
341 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
342
343 data = (2 & ANA_SERDES_CDR_BW_MASK) | ANA_MS_PAD_DBG |
344 ANA_SERDES_EN_DEEM | ANA_SERDES_SEL_HSP | ANA_SERDES_EN_PLL |
345 ANA_SERDES_EN_LCKDT;
346
347 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_5);
348 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
349
350 data = (44 & ANA_LONG_CABLE_TH_100_MASK) |
351 ((33 & ANA_SHORT_CABLE_TH_100_MASK) <<
352 ANA_SHORT_CABLE_TH_100_SHIFT) | ANA_BP_BAD_LINK_ACCUM |
353 ANA_BP_SMALL_BW;
354
355 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_54);
356 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
357
358 data = (11 & ANA_IECHO_ADJ_MASK) | ((11 & ANA_IECHO_ADJ_MASK) <<
359 ANA_IECHO_ADJ_2_SHIFT) | ((8 & ANA_IECHO_ADJ_MASK) <<
360 ANA_IECHO_ADJ_1_SHIFT) | ((8 & ANA_IECHO_ADJ_MASK) <<
361 ANA_IECHO_ADJ_0_SHIFT);
362
363 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_4);
364 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
365
366 data = ANA_RESTART_CAL | ((7 & ANA_MANUL_SWICH_ON_MASK) <<
367 ANA_MANUL_SWICH_ON_SHIFT) | ANA_MAN_ENABLE |
368 ANA_SEL_HSP | ANA_EN_HB | ANA_OEN_125M;
369
370 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_0);
371 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
372
373 if (hw->ctrl_flags & ATL1C_HIB_DISABLE) {
374 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_41);
375 if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &data) != 0)
376 return;
377 data &= ~ANA_TOP_PS_EN;
378 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
379
380 atl1c_write_phy_reg(hw, MII_DBG_ADDR, MII_ANA_CTRL_11);
381 if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &data) != 0)
382 return;
383 data &= ~ANA_PS_HIB_EN;
384 atl1c_write_phy_reg(hw, MII_DBG_DATA, data);
385 }
386}
387
388int atl1c_phy_reset(struct atl1c_hw *hw)
389{
390 struct atl1c_adapter *adapter = hw->adapter;
391 struct pci_dev *pdev = adapter->pdev;
392 u32 phy_ctrl_data = GPHY_CTRL_DEFAULT;
393 u32 mii_ier_data = IER_LINK_UP | IER_LINK_DOWN;
394 int err;
395
396 if (hw->ctrl_flags & ATL1C_HIB_DISABLE)
397 phy_ctrl_data &= ~GPHY_CTRL_HIB_EN;
398
399 AT_WRITE_REG(hw, REG_GPHY_CTRL, phy_ctrl_data);
400 AT_WRITE_FLUSH(hw);
401 msleep(40);
402 phy_ctrl_data |= GPHY_CTRL_EXT_RESET;
403 AT_WRITE_REG(hw, REG_GPHY_CTRL, phy_ctrl_data);
404 AT_WRITE_FLUSH(hw);
405 msleep(10);
406
407 /*Enable PHY LinkChange Interrupt */
408 err = atl1c_write_phy_reg(hw, MII_IER, mii_ier_data);
409 if (err) {
410 if (netif_msg_hw(adapter))
411 dev_err(&pdev->dev,
412 "Error enable PHY linkChange Interrupt\n");
413 return err;
414 }
415 if (!(hw->ctrl_flags & ATL1C_FPGA_VERSION))
416 atl1c_phy_magic_data(hw);
417 return 0;
418}
419
420int atl1c_phy_init(struct atl1c_hw *hw)
421{
422 struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter;
423 struct pci_dev *pdev = adapter->pdev;
424 int ret_val;
425 u16 mii_bmcr_data = BMCR_RESET;
426 u16 phy_id1, phy_id2;
427
428 if ((atl1c_read_phy_reg(hw, MII_PHYSID1, &phy_id1) != 0) ||
429 (atl1c_read_phy_reg(hw, MII_PHYSID2, &phy_id2) != 0)) {
430 if (netif_msg_link(adapter))
431 dev_err(&pdev->dev, "Error get phy ID\n");
432 return -1;
433 }
434 switch (hw->media_type) {
435 case MEDIA_TYPE_AUTO_SENSOR:
436 ret_val = atl1c_phy_setup_adv(hw);
437 if (ret_val) {
438 if (netif_msg_link(adapter))
439 dev_err(&pdev->dev,
440 "Error Setting up Auto-Negotiation\n");
441 return ret_val;
442 }
443 mii_bmcr_data |= BMCR_AUTO_NEG_EN | BMCR_RESTART_AUTO_NEG;
444 break;
445 case MEDIA_TYPE_100M_FULL:
446 mii_bmcr_data |= BMCR_SPEED_100 | BMCR_FULL_DUPLEX;
447 break;
448 case MEDIA_TYPE_100M_HALF:
449 mii_bmcr_data |= BMCR_SPEED_100;
450 break;
451 case MEDIA_TYPE_10M_FULL:
452 mii_bmcr_data |= BMCR_SPEED_10 | BMCR_FULL_DUPLEX;
453 break;
454 case MEDIA_TYPE_10M_HALF:
455 mii_bmcr_data |= BMCR_SPEED_10;
456 break;
457 default:
458 if (netif_msg_link(adapter))
459 dev_err(&pdev->dev, "Wrong Media type %d\n",
460 hw->media_type);
461 return -1;
462 break;
463 }
464
465 ret_val = atl1c_write_phy_reg(hw, MII_BMCR, mii_bmcr_data);
466 if (ret_val)
467 return ret_val;
468 hw->phy_configured = true;
469
470 return 0;
471}
472
473/*
474 * Detects the current speed and duplex settings of the hardware.
475 *
476 * hw - Struct containing variables accessed by shared code
477 * speed - Speed of the connection
478 * duplex - Duplex setting of the connection
479 */
480int atl1c_get_speed_and_duplex(struct atl1c_hw *hw, u16 *speed, u16 *duplex)
481{
482 int err;
483 u16 phy_data;
484
485 /* Read PHY Specific Status Register (17) */
486 err = atl1c_read_phy_reg(hw, MII_GIGA_PSSR, &phy_data);
487 if (err)
488 return err;
489
490 if (!(phy_data & GIGA_PSSR_SPD_DPLX_RESOLVED))
491 return -1;
492
493 switch (phy_data & GIGA_PSSR_SPEED) {
494 case GIGA_PSSR_1000MBS:
495 *speed = SPEED_1000;
496 break;
497 case GIGA_PSSR_100MBS:
498 *speed = SPEED_100;
499 break;
500 case GIGA_PSSR_10MBS:
501 *speed = SPEED_10;
502 break;
503 default:
504 return -1;
505 break;
506 }
507
508 if (phy_data & GIGA_PSSR_DPLX)
509 *duplex = FULL_DUPLEX;
510 else
511 *duplex = HALF_DUPLEX;
512
513 return 0;
514}
515
516int atl1c_restart_autoneg(struct atl1c_hw *hw)
517{
518 int err = 0;
519 u16 mii_bmcr_data = BMCR_RESET;
520
521 err = atl1c_phy_setup_adv(hw);
522 if (err)
523 return err;
524 mii_bmcr_data |= BMCR_AUTO_NEG_EN | BMCR_RESTART_AUTO_NEG;
525
526 return atl1c_write_phy_reg(hw, MII_BMCR, mii_bmcr_data);
527}
diff --git a/drivers/net/atl1c/atl1c_hw.h b/drivers/net/atl1c/atl1c_hw.h
new file mode 100644
index 000000000000..c2c738df5c63
--- /dev/null
+++ b/drivers/net/atl1c/atl1c_hw.h
@@ -0,0 +1,859 @@
1/*
2 * Copyright(c) 2008 - 2009 Atheros Corporation. All rights reserved.
3 *
4 * Derived from Intel e1000 driver
5 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#ifndef _ATL1C_HW_H_
23#define _ATL1C_HW_H_
24
25#include <linux/types.h>
26#include <linux/mii.h>
27
28struct atl1c_adapter;
29struct atl1c_hw;
30
31/* function prototype */
32void atl1c_phy_disable(struct atl1c_hw *hw);
33void atl1c_hw_set_mac_addr(struct atl1c_hw *hw);
34int atl1c_phy_reset(struct atl1c_hw *hw);
35int atl1c_read_mac_addr(struct atl1c_hw *hw);
36int atl1c_get_speed_and_duplex(struct atl1c_hw *hw, u16 *speed, u16 *duplex);
37u32 atl1c_hash_mc_addr(struct atl1c_hw *hw, u8 *mc_addr);
38void atl1c_hash_set(struct atl1c_hw *hw, u32 hash_value);
39int atl1c_read_phy_reg(struct atl1c_hw *hw, u16 reg_addr, u16 *phy_data);
40int atl1c_write_phy_reg(struct atl1c_hw *hw, u32 reg_addr, u16 phy_data);
41bool atl1c_read_eeprom(struct atl1c_hw *hw, u32 offset, u32 *p_value);
42int atl1c_phy_init(struct atl1c_hw *hw);
43int atl1c_check_eeprom_exist(struct atl1c_hw *hw);
44int atl1c_restart_autoneg(struct atl1c_hw *hw);
45
46/* register definition */
47#define REG_DEVICE_CAP 0x5C
48#define DEVICE_CAP_MAX_PAYLOAD_MASK 0x7
49#define DEVICE_CAP_MAX_PAYLOAD_SHIFT 0
50
51#define REG_DEVICE_CTRL 0x60
52#define DEVICE_CTRL_MAX_PAYLOAD_MASK 0x7
53#define DEVICE_CTRL_MAX_PAYLOAD_SHIFT 5
54#define DEVICE_CTRL_MAX_RREQ_SZ_MASK 0x7
55#define DEVICE_CTRL_MAX_RREQ_SZ_SHIFT 12
56
57#define REG_LINK_CTRL 0x68
58#define LINK_CTRL_L0S_EN 0x01
59#define LINK_CTRL_L1_EN 0x02
60
61#define REG_VPD_CAP 0x6C
62#define VPD_CAP_ID_MASK 0xff
63#define VPD_CAP_ID_SHIFT 0
64#define VPD_CAP_NEXT_PTR_MASK 0xFF
65#define VPD_CAP_NEXT_PTR_SHIFT 8
66#define VPD_CAP_VPD_ADDR_MASK 0x7FFF
67#define VPD_CAP_VPD_ADDR_SHIFT 16
68#define VPD_CAP_VPD_FLAG 0x80000000
69
70#define REG_VPD_DATA 0x70
71
72#define REG_PCIE_UC_SEVERITY 0x10C
73#define PCIE_UC_SERVRITY_TRN 0x00000001
74#define PCIE_UC_SERVRITY_DLP 0x00000010
75#define PCIE_UC_SERVRITY_PSN_TLP 0x00001000
76#define PCIE_UC_SERVRITY_FCP 0x00002000
77#define PCIE_UC_SERVRITY_CPL_TO 0x00004000
78#define PCIE_UC_SERVRITY_CA 0x00008000
79#define PCIE_UC_SERVRITY_UC 0x00010000
80#define PCIE_UC_SERVRITY_ROV 0x00020000
81#define PCIE_UC_SERVRITY_MLFP 0x00040000
82#define PCIE_UC_SERVRITY_ECRC 0x00080000
83#define PCIE_UC_SERVRITY_UR 0x00100000
84
85#define REG_DEV_SERIALNUM_CTRL 0x200
86#define REG_DEV_MAC_SEL_MASK 0x0 /* 0:EUI; 1:MAC */
87#define REG_DEV_MAC_SEL_SHIFT 0
88#define REG_DEV_SERIAL_NUM_EN_MASK 0x1
89#define REG_DEV_SERIAL_NUM_EN_SHIFT 1
90
91#define REG_TWSI_CTRL 0x218
92#define TWSI_CTRL_LD_OFFSET_MASK 0xFF
93#define TWSI_CTRL_LD_OFFSET_SHIFT 0
94#define TWSI_CTRL_LD_SLV_ADDR_MASK 0x7
95#define TWSI_CTRL_LD_SLV_ADDR_SHIFT 8
96#define TWSI_CTRL_SW_LDSTART 0x800
97#define TWSI_CTRL_HW_LDSTART 0x1000
98#define TWSI_CTRL_SMB_SLV_ADDR_MASK 0x7F
99#define TWSI_CTRL_SMB_SLV_ADDR_SHIFT 15
100#define TWSI_CTRL_LD_EXIST 0x400000
101#define TWSI_CTRL_READ_FREQ_SEL_MASK 0x3
102#define TWSI_CTRL_READ_FREQ_SEL_SHIFT 23
103#define TWSI_CTRL_FREQ_SEL_100K 0
104#define TWSI_CTRL_FREQ_SEL_200K 1
105#define TWSI_CTRL_FREQ_SEL_300K 2
106#define TWSI_CTRL_FREQ_SEL_400K 3
107#define TWSI_CTRL_SMB_SLV_ADDR
108#define TWSI_CTRL_WRITE_FREQ_SEL_MASK 0x3
109#define TWSI_CTRL_WRITE_FREQ_SEL_SHIFT 24
110
111
112#define REG_PCIE_DEV_MISC_CTRL 0x21C
113#define PCIE_DEV_MISC_EXT_PIPE 0x2
114#define PCIE_DEV_MISC_RETRY_BUFDIS 0x1
115#define PCIE_DEV_MISC_SPIROM_EXIST 0x4
116#define PCIE_DEV_MISC_SERDES_ENDIAN 0x8
117#define PCIE_DEV_MISC_SERDES_SEL_DIN 0x10
118
119#define REG_PCIE_PHYMISC 0x1000
120#define PCIE_PHYMISC_FORCE_RCV_DET 0x4
121
122#define REG_TWSI_DEBUG 0x1108
123#define TWSI_DEBUG_DEV_EXIST 0x20000000
124
125#define REG_EEPROM_CTRL 0x12C0
126#define EEPROM_CTRL_DATA_HI_MASK 0xFFFF
127#define EEPROM_CTRL_DATA_HI_SHIFT 0
128#define EEPROM_CTRL_ADDR_MASK 0x3FF
129#define EEPROM_CTRL_ADDR_SHIFT 16
130#define EEPROM_CTRL_ACK 0x40000000
131#define EEPROM_CTRL_RW 0x80000000
132
133#define REG_EEPROM_DATA_LO 0x12C4
134
135#define REG_OTP_CTRL 0x12F0
136#define OTP_CTRL_CLK_EN 0x0002
137
138#define REG_PM_CTRL 0x12F8
139#define PM_CTRL_SDES_EN 0x00000001
140#define PM_CTRL_RBER_EN 0x00000002
141#define PM_CTRL_CLK_REQ_EN 0x00000004
142#define PM_CTRL_ASPM_L1_EN 0x00000008
143#define PM_CTRL_SERDES_L1_EN 0x00000010
144#define PM_CTRL_SERDES_PLL_L1_EN 0x00000020
145#define PM_CTRL_SERDES_PD_EX_L1 0x00000040
146#define PM_CTRL_SERDES_BUDS_RX_L1_EN 0x00000080
147#define PM_CTRL_L0S_ENTRY_TIMER_MASK 0xF
148#define PM_CTRL_L0S_ENTRY_TIMER_SHIFT 8
149#define PM_CTRL_ASPM_L0S_EN 0x00001000
150#define PM_CTRL_CLK_SWH_L1 0x00002000
151#define PM_CTRL_CLK_PWM_VER1_1 0x00004000
152#define PM_CTRL_PCIE_RECV 0x00008000
153#define PM_CTRL_L1_ENTRY_TIMER_MASK 0xF
154#define PM_CTRL_L1_ENTRY_TIMER_SHIFT 16
155#define PM_CTRL_PM_REQ_TIMER_MASK 0xF
156#define PM_CTRL_PM_REQ_TIMER_SHIFT 20
157#define PM_CTRL_LCKDET_TIMER_MASK 0x3F
158#define PM_CTRL_LCKDET_TIMER_SHIFT 24
159#define PM_CTRL_MAC_ASPM_CHK 0x40000000
160#define PM_CTRL_HOTRST 0x80000000
161
162/* Selene Master Control Register */
163#define REG_MASTER_CTRL 0x1400
164#define MASTER_CTRL_SOFT_RST 0x1
165#define MASTER_CTRL_TEST_MODE_MASK 0x3
166#define MASTER_CTRL_TEST_MODE_SHIFT 2
167#define MASTER_CTRL_BERT_START 0x10
168#define MASTER_CTRL_MTIMER_EN 0x100
169#define MASTER_CTRL_MANUAL_INT 0x200
170#define MASTER_CTRL_TX_ITIMER_EN 0x400
171#define MASTER_CTRL_RX_ITIMER_EN 0x800
172#define MASTER_CTRL_CLK_SEL_DIS 0x1000
173#define MASTER_CTRL_CLK_SWH_MODE 0x2000
174#define MASTER_CTRL_INT_RDCLR 0x4000
175#define MASTER_CTRL_REV_NUM_SHIFT 16
176#define MASTER_CTRL_REV_NUM_MASK 0xff
177#define MASTER_CTRL_DEV_ID_SHIFT 24
178#define MASTER_CTRL_DEV_ID_MASK 0x7f
179#define MASTER_CTRL_OTP_SEL 0x80000000
180
181/* Timer Initial Value Register */
182#define REG_MANUAL_TIMER_INIT 0x1404
183
184/* IRQ ModeratorTimer Initial Value Register */
185#define REG_IRQ_MODRT_TIMER_INIT 0x1408
186#define IRQ_MODRT_TIMER_MASK 0xffff
187#define IRQ_MODRT_TX_TIMER_SHIFT 0
188#define IRQ_MODRT_RX_TIMER_SHIFT 16
189
190#define REG_GPHY_CTRL 0x140C
191#define GPHY_CTRL_EXT_RESET 0x1
192#define GPHY_CTRL_RTL_MODE 0x2
193#define GPHY_CTRL_LED_MODE 0x4
194#define GPHY_CTRL_ANEG_NOW 0x8
195#define GPHY_CTRL_REV_ANEG 0x10
196#define GPHY_CTRL_GATE_25M_EN 0x20
197#define GPHY_CTRL_LPW_EXIT 0x40
198#define GPHY_CTRL_PHY_IDDQ 0x80
199#define GPHY_CTRL_PHY_IDDQ_DIS 0x100
200#define GPHY_CTRL_GIGA_DIS 0x200
201#define GPHY_CTRL_HIB_EN 0x400
202#define GPHY_CTRL_HIB_PULSE 0x800
203#define GPHY_CTRL_SEL_ANA_RST 0x1000
204#define GPHY_CTRL_PHY_PLL_ON 0x2000
205#define GPHY_CTRL_PWDOWN_HW 0x4000
206#define GPHY_CTRL_PHY_PLL_BYPASS 0x8000
207
208#define GPHY_CTRL_DEFAULT ( \
209 GPHY_CTRL_SEL_ANA_RST |\
210 GPHY_CTRL_HIB_PULSE |\
211 GPHY_CTRL_HIB_EN)
212
213#define GPHY_CTRL_PW_WOL_DIS ( \
214 GPHY_CTRL_SEL_ANA_RST |\
215 GPHY_CTRL_HIB_PULSE |\
216 GPHY_CTRL_HIB_EN |\
217 GPHY_CTRL_PWDOWN_HW |\
218 GPHY_CTRL_PHY_IDDQ)
219
220/* Block IDLE Status Register */
221#define REG_IDLE_STATUS 0x1410
222#define IDLE_STATUS_MASK 0x00FF
223#define IDLE_STATUS_RXMAC_NO_IDLE 0x1
224#define IDLE_STATUS_TXMAC_NO_IDLE 0x2
225#define IDLE_STATUS_RXQ_NO_IDLE 0x4
226#define IDLE_STATUS_TXQ_NO_IDLE 0x8
227#define IDLE_STATUS_DMAR_NO_IDLE 0x10
228#define IDLE_STATUS_DMAW_NO_IDLE 0x20
229#define IDLE_STATUS_SMB_NO_IDLE 0x40
230#define IDLE_STATUS_CMB_NO_IDLE 0x80
231
232/* MDIO Control Register */
233#define REG_MDIO_CTRL 0x1414
234#define MDIO_DATA_MASK 0xffff /* On MDIO write, the 16-bit
235 * control data to write to PHY
236 * MII management register */
237#define MDIO_DATA_SHIFT 0 /* On MDIO read, the 16-bit
238 * status data that was read
239 * from the PHY MII management register */
240#define MDIO_REG_ADDR_MASK 0x1f /* MDIO register address */
241#define MDIO_REG_ADDR_SHIFT 16
242#define MDIO_RW 0x200000 /* 1: read, 0: write */
243#define MDIO_SUP_PREAMBLE 0x400000 /* Suppress preamble */
244#define MDIO_START 0x800000 /* Write 1 to initiate the MDIO
245 * master. And this bit is self
246 * cleared after one cycle */
247#define MDIO_CLK_SEL_SHIFT 24
248#define MDIO_CLK_25_4 0
249#define MDIO_CLK_25_6 2
250#define MDIO_CLK_25_8 3
251#define MDIO_CLK_25_10 4
252#define MDIO_CLK_25_14 5
253#define MDIO_CLK_25_20 6
254#define MDIO_CLK_25_28 7
255#define MDIO_BUSY 0x8000000
256#define MDIO_AP_EN 0x10000000
257#define MDIO_WAIT_TIMES 10
258
259/* MII PHY Status Register */
260#define REG_PHY_STATUS 0x1418
261#define PHY_GENERAL_STATUS_MASK 0xFFFF
262#define PHY_STATUS_RECV_ENABLE 0x0001
263#define PHY_OE_PWSP_STATUS_MASK 0x07FF
264#define PHY_OE_PWSP_STATUS_SHIFT 16
265#define PHY_STATUS_LPW_STATE 0x80000000
266/* BIST Control and Status Register0 (for the Packet Memory) */
267#define REG_BIST0_CTRL 0x141c
268#define BIST0_NOW 0x1
269#define BIST0_SRAM_FAIL 0x2 /* 1: The SRAM failure is
270 * un-repairable because
271 * it has address decoder
272 * failure or more than 1 cell
273 * stuck-to-x failure */
274#define BIST0_FUSE_FLAG 0x4
275
276/* BIST Control and Status Register1(for the retry buffer of PCI Express) */
277#define REG_BIST1_CTRL 0x1420
278#define BIST1_NOW 0x1
279#define BIST1_SRAM_FAIL 0x2
280#define BIST1_FUSE_FLAG 0x4
281
282/* SerDes Lock Detect Control and Status Register */
283#define REG_SERDES_LOCK 0x1424
284#define SERDES_LOCK_DETECT 0x1 /* SerDes lock detected. This signal
285 * comes from Analog SerDes */
286#define SERDES_LOCK_DETECT_EN 0x2 /* 1: Enable SerDes Lock detect function */
287
288/* MAC Control Register */
289#define REG_MAC_CTRL 0x1480
290#define MAC_CTRL_TX_EN 0x1
291#define MAC_CTRL_RX_EN 0x2
292#define MAC_CTRL_TX_FLOW 0x4
293#define MAC_CTRL_RX_FLOW 0x8
294#define MAC_CTRL_LOOPBACK 0x10
295#define MAC_CTRL_DUPLX 0x20
296#define MAC_CTRL_ADD_CRC 0x40
297#define MAC_CTRL_PAD 0x80
298#define MAC_CTRL_LENCHK 0x100
299#define MAC_CTRL_HUGE_EN 0x200
300#define MAC_CTRL_PRMLEN_SHIFT 10
301#define MAC_CTRL_PRMLEN_MASK 0xf
302#define MAC_CTRL_RMV_VLAN 0x4000
303#define MAC_CTRL_PROMIS_EN 0x8000
304#define MAC_CTRL_TX_PAUSE 0x10000
305#define MAC_CTRL_SCNT 0x20000
306#define MAC_CTRL_SRST_TX 0x40000
307#define MAC_CTRL_TX_SIMURST 0x80000
308#define MAC_CTRL_SPEED_SHIFT 20
309#define MAC_CTRL_SPEED_MASK 0x3
310#define MAC_CTRL_DBG_TX_BKPRESURE 0x400000
311#define MAC_CTRL_TX_HUGE 0x800000
312#define MAC_CTRL_RX_CHKSUM_EN 0x1000000
313#define MAC_CTRL_MC_ALL_EN 0x2000000
314#define MAC_CTRL_BC_EN 0x4000000
315#define MAC_CTRL_DBG 0x8000000
316#define MAC_CTRL_SINGLE_PAUSE_EN 0x10000000
317
318/* MAC IPG/IFG Control Register */
319#define REG_MAC_IPG_IFG 0x1484
320#define MAC_IPG_IFG_IPGT_SHIFT 0 /* Desired back to back
321 * inter-packet gap. The
322 * default is 96-bit time */
323#define MAC_IPG_IFG_IPGT_MASK 0x7f
324#define MAC_IPG_IFG_MIFG_SHIFT 8 /* Minimum number of IFG to
325 * enforce in between RX frames */
326#define MAC_IPG_IFG_MIFG_MASK 0xff /* Frame gap below such IFP is dropped */
327#define MAC_IPG_IFG_IPGR1_SHIFT 16 /* 64bit Carrier-Sense window */
328#define MAC_IPG_IFG_IPGR1_MASK 0x7f
329#define MAC_IPG_IFG_IPGR2_SHIFT 24 /* 96-bit IPG window */
330#define MAC_IPG_IFG_IPGR2_MASK 0x7f
331
332/* MAC STATION ADDRESS */
333#define REG_MAC_STA_ADDR 0x1488
334
335/* Hash table for multicast address */
336#define REG_RX_HASH_TABLE 0x1490
337
338/* MAC Half-Duplex Control Register */
339#define REG_MAC_HALF_DUPLX_CTRL 0x1498
340#define MAC_HALF_DUPLX_CTRL_LCOL_SHIFT 0 /* Collision Window */
341#define MAC_HALF_DUPLX_CTRL_LCOL_MASK 0x3ff
342#define MAC_HALF_DUPLX_CTRL_RETRY_SHIFT 12
343#define MAC_HALF_DUPLX_CTRL_RETRY_MASK 0xf
344#define MAC_HALF_DUPLX_CTRL_EXC_DEF_EN 0x10000
345#define MAC_HALF_DUPLX_CTRL_NO_BACK_C 0x20000
346#define MAC_HALF_DUPLX_CTRL_NO_BACK_P 0x40000 /* No back-off on backpressure,
347 * immediately start the
348 * transmission after back pressure */
349#define MAC_HALF_DUPLX_CTRL_ABEBE 0x80000 /* 1: Alternative Binary Exponential Back-off Enabled */
350#define MAC_HALF_DUPLX_CTRL_ABEBT_SHIFT 20 /* Maximum binary exponential number */
351#define MAC_HALF_DUPLX_CTRL_ABEBT_MASK 0xf
352#define MAC_HALF_DUPLX_CTRL_JAMIPG_SHIFT 24 /* IPG to start JAM for collision based flow control in half-duplex */
353#define MAC_HALF_DUPLX_CTRL_JAMIPG_MASK 0xf /* mode. In unit of 8-bit time */
354
355/* Maximum Frame Length Control Register */
356#define REG_MTU 0x149c
357
358/* Wake-On-Lan control register */
359#define REG_WOL_CTRL 0x14a0
360#define WOL_PATTERN_EN 0x00000001
361#define WOL_PATTERN_PME_EN 0x00000002
362#define WOL_MAGIC_EN 0x00000004
363#define WOL_MAGIC_PME_EN 0x00000008
364#define WOL_LINK_CHG_EN 0x00000010
365#define WOL_LINK_CHG_PME_EN 0x00000020
366#define WOL_PATTERN_ST 0x00000100
367#define WOL_MAGIC_ST 0x00000200
368#define WOL_LINKCHG_ST 0x00000400
369#define WOL_CLK_SWITCH_EN 0x00008000
370#define WOL_PT0_EN 0x00010000
371#define WOL_PT1_EN 0x00020000
372#define WOL_PT2_EN 0x00040000
373#define WOL_PT3_EN 0x00080000
374#define WOL_PT4_EN 0x00100000
375#define WOL_PT5_EN 0x00200000
376#define WOL_PT6_EN 0x00400000
377
378/* WOL Length ( 2 DWORD ) */
379#define REG_WOL_PATTERN_LEN 0x14a4
380#define WOL_PT_LEN_MASK 0x7f
381#define WOL_PT0_LEN_SHIFT 0
382#define WOL_PT1_LEN_SHIFT 8
383#define WOL_PT2_LEN_SHIFT 16
384#define WOL_PT3_LEN_SHIFT 24
385#define WOL_PT4_LEN_SHIFT 0
386#define WOL_PT5_LEN_SHIFT 8
387#define WOL_PT6_LEN_SHIFT 16
388
389/* Internal SRAM Partition Register */
390#define RFDX_HEAD_ADDR_MASK 0x03FF
391#define RFDX_HARD_ADDR_SHIFT 0
392#define RFDX_TAIL_ADDR_MASK 0x03FF
393#define RFDX_TAIL_ADDR_SHIFT 16
394
395#define REG_SRAM_RFD0_INFO 0x1500
396#define REG_SRAM_RFD1_INFO 0x1504
397#define REG_SRAM_RFD2_INFO 0x1508
398#define REG_SRAM_RFD3_INFO 0x150C
399
400#define REG_RFD_NIC_LEN 0x1510 /* In 8-bytes */
401#define RFD_NIC_LEN_MASK 0x03FF
402
403#define REG_SRAM_TRD_ADDR 0x1518
404#define TPD_HEAD_ADDR_MASK 0x03FF
405#define TPD_HEAD_ADDR_SHIFT 0
406#define TPD_TAIL_ADDR_MASK 0x03FF
407#define TPD_TAIL_ADDR_SHIFT 16
408
409#define REG_SRAM_TRD_LEN 0x151C /* In 8-bytes */
410#define TPD_NIC_LEN_MASK 0x03FF
411
412#define REG_SRAM_RXF_ADDR 0x1520
413#define REG_SRAM_RXF_LEN 0x1524
414#define REG_SRAM_TXF_ADDR 0x1528
415#define REG_SRAM_TXF_LEN 0x152C
416#define REG_SRAM_TCPH_ADDR 0x1530
417#define REG_SRAM_PKTH_ADDR 0x1532
418
419/*
420 * Load Ptr Register
421 * Software sets this bit after the initialization of the head and tail */
422#define REG_LOAD_PTR 0x1534
423
424/*
425 * addresses of all descriptors, as well as the following descriptor
426 * control register, which triggers each function block to load the head
427 * pointer to prepare for the operation. This bit is then self-cleared
428 * after one cycle.
429 */
430#define REG_RX_BASE_ADDR_HI 0x1540
431#define REG_TX_BASE_ADDR_HI 0x1544
432#define REG_SMB_BASE_ADDR_HI 0x1548
433#define REG_SMB_BASE_ADDR_LO 0x154C
434#define REG_RFD0_HEAD_ADDR_LO 0x1550
435#define REG_RFD1_HEAD_ADDR_LO 0x1554
436#define REG_RFD2_HEAD_ADDR_LO 0x1558
437#define REG_RFD3_HEAD_ADDR_LO 0x155C
438#define REG_RFD_RING_SIZE 0x1560
439#define RFD_RING_SIZE_MASK 0x0FFF
440#define REG_RX_BUF_SIZE 0x1564
441#define RX_BUF_SIZE_MASK 0xFFFF
442#define REG_RRD0_HEAD_ADDR_LO 0x1568
443#define REG_RRD1_HEAD_ADDR_LO 0x156C
444#define REG_RRD2_HEAD_ADDR_LO 0x1570
445#define REG_RRD3_HEAD_ADDR_LO 0x1574
446#define REG_RRD_RING_SIZE 0x1578
447#define RRD_RING_SIZE_MASK 0x0FFF
448#define REG_HTPD_HEAD_ADDR_LO 0x157C
449#define REG_NTPD_HEAD_ADDR_LO 0x1580
450#define REG_TPD_RING_SIZE 0x1584
451#define TPD_RING_SIZE_MASK 0xFFFF
452#define REG_CMB_BASE_ADDR_LO 0x1588
453
454/* RSS about */
455#define REG_RSS_KEY0 0x14B0
456#define REG_RSS_KEY1 0x14B4
457#define REG_RSS_KEY2 0x14B8
458#define REG_RSS_KEY3 0x14BC
459#define REG_RSS_KEY4 0x14C0
460#define REG_RSS_KEY5 0x14C4
461#define REG_RSS_KEY6 0x14C8
462#define REG_RSS_KEY7 0x14CC
463#define REG_RSS_KEY8 0x14D0
464#define REG_RSS_KEY9 0x14D4
465#define REG_IDT_TABLE0 0x14E0
466#define REG_IDT_TABLE1 0x14E4
467#define REG_IDT_TABLE2 0x14E8
468#define REG_IDT_TABLE3 0x14EC
469#define REG_IDT_TABLE4 0x14F0
470#define REG_IDT_TABLE5 0x14F4
471#define REG_IDT_TABLE6 0x14F8
472#define REG_IDT_TABLE7 0x14FC
473#define REG_IDT_TABLE REG_IDT_TABLE0
474#define REG_RSS_HASH_VALUE 0x15B0
475#define REG_RSS_HASH_FLAG 0x15B4
476#define REG_BASE_CPU_NUMBER 0x15B8
477
478/* TXQ Control Register */
479#define REG_TXQ_CTRL 0x1590
480#define TXQ_NUM_TPD_BURST_MASK 0xF
481#define TXQ_NUM_TPD_BURST_SHIFT 0
482#define TXQ_CTRL_IP_OPTION_EN 0x10
483#define TXQ_CTRL_EN 0x20
484#define TXQ_CTRL_ENH_MODE 0x40
485#define TXQ_CTRL_LS_8023_EN 0x80
486#define TXQ_TXF_BURST_NUM_SHIFT 16
487#define TXQ_TXF_BURST_NUM_MASK 0xFFFF
488
489/* Jumbo packet Threshold for task offload */
490#define REG_TX_TSO_OFFLOAD_THRESH 0x1594 /* In 8-bytes */
491#define TX_TSO_OFFLOAD_THRESH_MASK 0x07FF
492
493#define REG_TXF_WATER_MARK 0x1598 /* In 8-bytes */
494#define TXF_WATER_MARK_MASK 0x0FFF
495#define TXF_LOW_WATER_MARK_SHIFT 0
496#define TXF_HIGH_WATER_MARK_SHIFT 16
497#define TXQ_CTRL_BURST_MODE_EN 0x80000000
498
499#define REG_THRUPUT_MON_CTRL 0x159C
500#define THRUPUT_MON_RATE_MASK 0x3
501#define THRUPUT_MON_RATE_SHIFT 0
502#define THRUPUT_MON_EN 0x80
503
504/* RXQ Control Register */
505#define REG_RXQ_CTRL 0x15A0
506#define ASPM_THRUPUT_LIMIT_MASK 0x3
507#define ASPM_THRUPUT_LIMIT_SHIFT 0
508#define ASPM_THRUPUT_LIMIT_NO 0x00
509#define ASPM_THRUPUT_LIMIT_1M 0x01
510#define ASPM_THRUPUT_LIMIT_10M 0x02
511#define ASPM_THRUPUT_LIMIT_100M 0x04
512#define RXQ1_CTRL_EN 0x10
513#define RXQ2_CTRL_EN 0x20
514#define RXQ3_CTRL_EN 0x40
515#define IPV6_CHKSUM_CTRL_EN 0x80
516#define RSS_HASH_BITS_MASK 0x00FF
517#define RSS_HASH_BITS_SHIFT 8
518#define RSS_HASH_IPV4 0x10000
519#define RSS_HASH_IPV4_TCP 0x20000
520#define RSS_HASH_IPV6 0x40000
521#define RSS_HASH_IPV6_TCP 0x80000
522#define RXQ_RFD_BURST_NUM_MASK 0x003F
523#define RXQ_RFD_BURST_NUM_SHIFT 20
524#define RSS_MODE_MASK 0x0003
525#define RSS_MODE_SHIFT 26
526#define RSS_NIP_QUEUE_SEL_MASK 0x1
527#define RSS_NIP_QUEUE_SEL_SHIFT 28
528#define RRS_HASH_CTRL_EN 0x20000000
529#define RX_CUT_THRU_EN 0x40000000
530#define RXQ_CTRL_EN 0x80000000
531
532#define REG_RFD_FREE_THRESH 0x15A4
533#define RFD_FREE_THRESH_MASK 0x003F
534#define RFD_FREE_HI_THRESH_SHIFT 0
535#define RFD_FREE_LO_THRESH_SHIFT 6
536
537/* RXF flow control register */
538#define REG_RXQ_RXF_PAUSE_THRESH 0x15A8
539#define RXQ_RXF_PAUSE_TH_HI_SHIFT 0
540#define RXQ_RXF_PAUSE_TH_HI_MASK 0x0FFF
541#define RXQ_RXF_PAUSE_TH_LO_SHIFT 16
542#define RXQ_RXF_PAUSE_TH_LO_MASK 0x0FFF
543
544#define REG_RXD_DMA_CTRL 0x15AC
545#define RXD_DMA_THRESH_MASK 0x0FFF /* In 8-bytes */
546#define RXD_DMA_THRESH_SHIFT 0
547#define RXD_DMA_DOWN_TIMER_MASK 0xFFFF
548#define RXD_DMA_DOWN_TIMER_SHIFT 16
549
550/* DMA Engine Control Register */
551#define REG_DMA_CTRL 0x15C0
552#define DMA_CTRL_DMAR_IN_ORDER 0x1
553#define DMA_CTRL_DMAR_ENH_ORDER 0x2
554#define DMA_CTRL_DMAR_OUT_ORDER 0x4
555#define DMA_CTRL_RCB_VALUE 0x8
556#define DMA_CTRL_DMAR_BURST_LEN_MASK 0x0007
557#define DMA_CTRL_DMAR_BURST_LEN_SHIFT 4
558#define DMA_CTRL_DMAW_BURST_LEN_MASK 0x0007
559#define DMA_CTRL_DMAW_BURST_LEN_SHIFT 7
560#define DMA_CTRL_DMAR_REQ_PRI 0x400
561#define DMA_CTRL_DMAR_DLY_CNT_MASK 0x001F
562#define DMA_CTRL_DMAR_DLY_CNT_SHIFT 11
563#define DMA_CTRL_DMAW_DLY_CNT_MASK 0x000F
564#define DMA_CTRL_DMAW_DLY_CNT_SHIFT 16
565#define DMA_CTRL_CMB_EN 0x100000
566#define DMA_CTRL_SMB_EN 0x200000
567#define DMA_CTRL_CMB_NOW 0x400000
568#define MAC_CTRL_SMB_DIS 0x1000000
569#define DMA_CTRL_SMB_NOW 0x80000000
570
571/* CMB/SMB Control Register */
572#define REG_SMB_STAT_TIMER 0x15C4 /* 2us resolution */
573#define SMB_STAT_TIMER_MASK 0xFFFFFF
574#define REG_CMB_TPD_THRESH 0x15C8
575#define CMB_TPD_THRESH_MASK 0xFFFF
576#define REG_CMB_TX_TIMER 0x15CC /* 2us resolution */
577#define CMB_TX_TIMER_MASK 0xFFFF
578
579/* Mail box */
580#define MB_RFDX_PROD_IDX_MASK 0xFFFF
581#define REG_MB_RFD0_PROD_IDX 0x15E0
582#define REG_MB_RFD1_PROD_IDX 0x15E4
583#define REG_MB_RFD2_PROD_IDX 0x15E8
584#define REG_MB_RFD3_PROD_IDX 0x15EC
585
586#define MB_PRIO_PROD_IDX_MASK 0xFFFF
587#define REG_MB_PRIO_PROD_IDX 0x15F0
588#define MB_HTPD_PROD_IDX_SHIFT 0
589#define MB_NTPD_PROD_IDX_SHIFT 16
590
591#define MB_PRIO_CONS_IDX_MASK 0xFFFF
592#define REG_MB_PRIO_CONS_IDX 0x15F4
593#define MB_HTPD_CONS_IDX_SHIFT 0
594#define MB_NTPD_CONS_IDX_SHIFT 16
595
596#define REG_MB_RFD01_CONS_IDX 0x15F8
597#define MB_RFD0_CONS_IDX_MASK 0x0000FFFF
598#define MB_RFD1_CONS_IDX_MASK 0xFFFF0000
599#define REG_MB_RFD23_CONS_IDX 0x15FC
600#define MB_RFD2_CONS_IDX_MASK 0x0000FFFF
601#define MB_RFD3_CONS_IDX_MASK 0xFFFF0000
602
603/* Interrupt Status Register */
604#define REG_ISR 0x1600
605#define ISR_SMB 0x00000001
606#define ISR_TIMER 0x00000002
607/*
608 * Software manual interrupt, for debug. Set when SW_MAN_INT_EN is set
609 * in Table 51 Selene Master Control Register (Offset 0x1400).
610 */
611#define ISR_MANUAL 0x00000004
612#define ISR_HW_RXF_OV 0x00000008 /* RXF overflow interrupt */
613#define ISR_RFD0_UR 0x00000010 /* RFD0 under run */
614#define ISR_RFD1_UR 0x00000020
615#define ISR_RFD2_UR 0x00000040
616#define ISR_RFD3_UR 0x00000080
617#define ISR_TXF_UR 0x00000100
618#define ISR_DMAR_TO_RST 0x00000200
619#define ISR_DMAW_TO_RST 0x00000400
620#define ISR_TX_CREDIT 0x00000800
621#define ISR_GPHY 0x00001000
622/* GPHY low power state interrupt */
623#define ISR_GPHY_LPW 0x00002000
624#define ISR_TXQ_TO_RST 0x00004000
625#define ISR_TX_PKT 0x00008000
626#define ISR_RX_PKT_0 0x00010000
627#define ISR_RX_PKT_1 0x00020000
628#define ISR_RX_PKT_2 0x00040000
629#define ISR_RX_PKT_3 0x00080000
630#define ISR_MAC_RX 0x00100000
631#define ISR_MAC_TX 0x00200000
632#define ISR_UR_DETECTED 0x00400000
633#define ISR_FERR_DETECTED 0x00800000
634#define ISR_NFERR_DETECTED 0x01000000
635#define ISR_CERR_DETECTED 0x02000000
636#define ISR_PHY_LINKDOWN 0x04000000
637#define ISR_DIS_INT 0x80000000
638
639/* Interrupt Mask Register */
640#define REG_IMR 0x1604
641
642#define IMR_NORMAL_MASK (\
643 ISR_MANUAL |\
644 ISR_HW_RXF_OV |\
645 ISR_RFD0_UR |\
646 ISR_TXF_UR |\
647 ISR_DMAR_TO_RST |\
648 ISR_TXQ_TO_RST |\
649 ISR_DMAW_TO_RST |\
650 ISR_GPHY |\
651 ISR_TX_PKT |\
652 ISR_RX_PKT_0 |\
653 ISR_GPHY_LPW |\
654 ISR_PHY_LINKDOWN)
655
656#define ISR_RX_PKT (\
657 ISR_RX_PKT_0 |\
658 ISR_RX_PKT_1 |\
659 ISR_RX_PKT_2 |\
660 ISR_RX_PKT_3)
661
662#define ISR_OVER (\
663 ISR_RFD0_UR |\
664 ISR_RFD1_UR |\
665 ISR_RFD2_UR |\
666 ISR_RFD3_UR |\
667 ISR_HW_RXF_OV |\
668 ISR_TXF_UR)
669
670#define ISR_ERROR (\
671 ISR_DMAR_TO_RST |\
672 ISR_TXQ_TO_RST |\
673 ISR_DMAW_TO_RST |\
674 ISR_PHY_LINKDOWN)
675
676#define REG_INT_RETRIG_TIMER 0x1608
677#define INT_RETRIG_TIMER_MASK 0xFFFF
678
679#define REG_HDS_CTRL 0x160C
680#define HDS_CTRL_EN 0x0001
681#define HDS_CTRL_BACKFILLSIZE_SHIFT 8
682#define HDS_CTRL_BACKFILLSIZE_MASK 0x0FFF
683#define HDS_CTRL_MAX_HDRSIZE_SHIFT 20
684#define HDS_CTRL_MAC_HDRSIZE_MASK 0x0FFF
685
686#define REG_MAC_RX_STATUS_BIN 0x1700
687#define REG_MAC_RX_STATUS_END 0x175c
688#define REG_MAC_TX_STATUS_BIN 0x1760
689#define REG_MAC_TX_STATUS_END 0x17c0
690
691/* DEBUG ADDR */
692#define REG_DEBUG_DATA0 0x1900
693#define REG_DEBUG_DATA1 0x1904
694
695/* PHY Control Register */
696#define MII_BMCR 0x00
697#define BMCR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */
698#define BMCR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */
699#define BMCR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */
700#define BMCR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */
701#define BMCR_ISOLATE 0x0400 /* Isolate PHY from MII */
702#define BMCR_POWER_DOWN 0x0800 /* Power down */
703#define BMCR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */
704#define BMCR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */
705#define BMCR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */
706#define BMCR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */
707#define BMCR_SPEED_MASK 0x2040
708#define BMCR_SPEED_1000 0x0040
709#define BMCR_SPEED_100 0x2000
710#define BMCR_SPEED_10 0x0000
711
712/* PHY Status Register */
713#define MII_BMSR 0x01
714#define BMMSR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */
715#define BMSR_JABBER_DETECT 0x0002 /* Jabber Detected */
716#define BMSR_LINK_STATUS 0x0004 /* Link Status 1 = link */
717#define BMSR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */
718#define BMSR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */
719#define BMSR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */
720#define BMSR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */
721#define BMSR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */
722#define BMSR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */
723#define BMSR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */
724#define BMSR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */
725#define BMSR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */
726#define BMSR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */
727#define BMMII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */
728#define BMMII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */
729
730#define MII_PHYSID1 0x02
731#define MII_PHYSID2 0x03
732
733/* Autoneg Advertisement Register */
734#define MII_ADVERTISE 0x04
735#define ADVERTISE_SPEED_MASK 0x01E0
736#define ADVERTISE_DEFAULT_CAP 0x0DE0
737
738/* 1000BASE-T Control Register */
739#define MII_GIGA_CR 0x09
740#define GIGA_CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port 0=DTE device */
741
742#define GIGA_CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master 0=Configure PHY as Slave */
743#define GIGA_CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value 0=Automatic Master/Slave config */
744#define GIGA_CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */
745#define GIGA_CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */
746#define GIGA_CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */
747#define GIGA_CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */
748#define GIGA_CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */
749#define GIGA_CR_1000T_SPEED_MASK 0x0300
750#define GIGA_CR_1000T_DEFAULT_CAP 0x0300
751
752/* PHY Specific Status Register */
753#define MII_GIGA_PSSR 0x11
754#define GIGA_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */
755#define GIGA_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */
756#define GIGA_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */
757#define GIGA_PSSR_10MBS 0x0000 /* 00=10Mbs */
758#define GIGA_PSSR_100MBS 0x4000 /* 01=100Mbs */
759#define GIGA_PSSR_1000MBS 0x8000 /* 10=1000Mbs */
760
761/* PHY Interrupt Enable Register */
762#define MII_IER 0x12
763#define IER_LINK_UP 0x0400
764#define IER_LINK_DOWN 0x0800
765
766/* PHY Interrupt Status Register */
767#define MII_ISR 0x13
768#define ISR_LINK_UP 0x0400
769#define ISR_LINK_DOWN 0x0800
770
771/* Cable-Detect-Test Control Register */
772#define MII_CDTC 0x16
773#define CDTC_EN_OFF 0 /* sc */
774#define CDTC_EN_BITS 1
775#define CDTC_PAIR_OFF 8
776#define CDTC_PAIR_BIT 2
777
778/* Cable-Detect-Test Status Register */
779#define MII_CDTS 0x1C
780#define CDTS_STATUS_OFF 8
781#define CDTS_STATUS_BITS 2
782#define CDTS_STATUS_NORMAL 0
783#define CDTS_STATUS_SHORT 1
784#define CDTS_STATUS_OPEN 2
785#define CDTS_STATUS_INVALID 3
786
787#define MII_DBG_ADDR 0x1D
788#define MII_DBG_DATA 0x1E
789
790#define MII_ANA_CTRL_0 0x0
791#define ANA_RESTART_CAL 0x0001
792#define ANA_MANUL_SWICH_ON_SHIFT 0x1
793#define ANA_MANUL_SWICH_ON_MASK 0xF
794#define ANA_MAN_ENABLE 0x0020
795#define ANA_SEL_HSP 0x0040
796#define ANA_EN_HB 0x0080
797#define ANA_EN_HBIAS 0x0100
798#define ANA_OEN_125M 0x0200
799#define ANA_EN_LCKDT 0x0400
800#define ANA_LCKDT_PHY 0x0800
801#define ANA_AFE_MODE 0x1000
802#define ANA_VCO_SLOW 0x2000
803#define ANA_VCO_FAST 0x4000
804#define ANA_SEL_CLK125M_DSP 0x8000
805
806#define MII_ANA_CTRL_4 0x4
807#define ANA_IECHO_ADJ_MASK 0xF
808#define ANA_IECHO_ADJ_3_SHIFT 0
809#define ANA_IECHO_ADJ_2_SHIFT 4
810#define ANA_IECHO_ADJ_1_SHIFT 8
811#define ANA_IECHO_ADJ_0_SHIFT 12
812
813#define MII_ANA_CTRL_5 0x5
814#define ANA_SERDES_CDR_BW_SHIFT 0
815#define ANA_SERDES_CDR_BW_MASK 0x3
816#define ANA_MS_PAD_DBG 0x0004
817#define ANA_SPEEDUP_DBG 0x0008
818#define ANA_SERDES_TH_LOS_SHIFT 4
819#define ANA_SERDES_TH_LOS_MASK 0x3
820#define ANA_SERDES_EN_DEEM 0x0040
821#define ANA_SERDES_TXELECIDLE 0x0080
822#define ANA_SERDES_BEACON 0x0100
823#define ANA_SERDES_HALFTXDR 0x0200
824#define ANA_SERDES_SEL_HSP 0x0400
825#define ANA_SERDES_EN_PLL 0x0800
826#define ANA_SERDES_EN 0x1000
827#define ANA_SERDES_EN_LCKDT 0x2000
828
829#define MII_ANA_CTRL_11 0xB
830#define ANA_PS_HIB_EN 0x8000
831
832#define MII_ANA_CTRL_18 0x12
833#define ANA_TEST_MODE_10BT_01SHIFT 0
834#define ANA_TEST_MODE_10BT_01MASK 0x3
835#define ANA_LOOP_SEL_10BT 0x0004
836#define ANA_RGMII_MODE_SW 0x0008
837#define ANA_EN_LONGECABLE 0x0010
838#define ANA_TEST_MODE_10BT_2 0x0020
839#define ANA_EN_10BT_IDLE 0x0400
840#define ANA_EN_MASK_TB 0x0800
841#define ANA_TRIGGER_SEL_TIMER_SHIFT 12
842#define ANA_TRIGGER_SEL_TIMER_MASK 0x3
843#define ANA_INTERVAL_SEL_TIMER_SHIFT 14
844#define ANA_INTERVAL_SEL_TIMER_MASK 0x3
845
846#define MII_ANA_CTRL_41 0x29
847#define ANA_TOP_PS_EN 0x8000
848
849#define MII_ANA_CTRL_54 0x36
850#define ANA_LONG_CABLE_TH_100_SHIFT 0
851#define ANA_LONG_CABLE_TH_100_MASK 0x3F
852#define ANA_DESERVED 0x0040
853#define ANA_EN_LIT_CH 0x0080
854#define ANA_SHORT_CABLE_TH_100_SHIFT 8
855#define ANA_SHORT_CABLE_TH_100_MASK 0x3F
856#define ANA_BP_BAD_LINK_ACCUM 0x4000
857#define ANA_BP_SMALL_BW 0x8000
858
859#endif /*_ATL1C_HW_H_*/
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
new file mode 100644
index 000000000000..deb7b53167ee
--- /dev/null
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -0,0 +1,2797 @@
1/*
2 * Copyright(c) 2008 - 2009 Atheros Corporation. All rights reserved.
3 *
4 * Derived from Intel e1000 driver
5 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#include "atl1c.h"
23
24#define ATL1C_DRV_VERSION "1.0.0.1-NAPI"
25char atl1c_driver_name[] = "atl1c";
26char atl1c_driver_version[] = ATL1C_DRV_VERSION;
27#define PCI_DEVICE_ID_ATTANSIC_L2C 0x1062
28#define PCI_DEVICE_ID_ATTANSIC_L1C 0x1063
29/*
30 * atl1c_pci_tbl - PCI Device ID Table
31 *
32 * Wildcard entries (PCI_ANY_ID) should come last
33 * Last entry must be all 0s
34 *
35 * { Vendor ID, Device ID, SubVendor ID, SubDevice ID,
36 * Class, Class Mask, private data (not used) }
37 */
38static struct pci_device_id atl1c_pci_tbl[] = {
39 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1C)},
40 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2C)},
41 /* required last entry */
42 { 0 }
43};
44MODULE_DEVICE_TABLE(pci, atl1c_pci_tbl);
45
46MODULE_AUTHOR("Jie Yang <jie.yang@atheros.com>");
47MODULE_DESCRIPTION("Atheros 1000M Ethernet Network Driver");
48MODULE_LICENSE("GPL");
49MODULE_VERSION(ATL1C_DRV_VERSION);
50
51static int atl1c_stop_mac(struct atl1c_hw *hw);
52static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw);
53static void atl1c_enable_tx_ctrl(struct atl1c_hw *hw);
54static void atl1c_disable_l0s_l1(struct atl1c_hw *hw);
55static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup);
56static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter);
57static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que,
58 int *work_done, int work_to_do);
59
60static const u16 atl1c_pay_load_size[] = {
61 128, 256, 512, 1024, 2048, 4096,
62};
63
64static const u16 atl1c_rfd_prod_idx_regs[AT_MAX_RECEIVE_QUEUE] =
65{
66 REG_MB_RFD0_PROD_IDX,
67 REG_MB_RFD1_PROD_IDX,
68 REG_MB_RFD2_PROD_IDX,
69 REG_MB_RFD3_PROD_IDX
70};
71
72static const u16 atl1c_rfd_addr_lo_regs[AT_MAX_RECEIVE_QUEUE] =
73{
74 REG_RFD0_HEAD_ADDR_LO,
75 REG_RFD1_HEAD_ADDR_LO,
76 REG_RFD2_HEAD_ADDR_LO,
77 REG_RFD3_HEAD_ADDR_LO
78};
79
80static const u16 atl1c_rrd_addr_lo_regs[AT_MAX_RECEIVE_QUEUE] =
81{
82 REG_RRD0_HEAD_ADDR_LO,
83 REG_RRD1_HEAD_ADDR_LO,
84 REG_RRD2_HEAD_ADDR_LO,
85 REG_RRD3_HEAD_ADDR_LO
86};
87
88static const u32 atl1c_default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
89 NETIF_MSG_LINK | NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP;
90
91/*
92 * atl1c_init_pcie - init PCIE module
93 */
94static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag)
95{
96 u32 data;
97 u32 pci_cmd;
98 struct pci_dev *pdev = hw->adapter->pdev;
99
100 AT_READ_REG(hw, PCI_COMMAND, &pci_cmd);
101 pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
102 pci_cmd |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
103 PCI_COMMAND_IO);
104 AT_WRITE_REG(hw, PCI_COMMAND, pci_cmd);
105
106 /*
107 * Clear any PowerSaveing Settings
108 */
109 pci_enable_wake(pdev, PCI_D3hot, 0);
110 pci_enable_wake(pdev, PCI_D3cold, 0);
111
112 /*
113 * Mask some pcie error bits
114 */
115 AT_READ_REG(hw, REG_PCIE_UC_SEVERITY, &data);
116 data &= ~PCIE_UC_SERVRITY_DLP;
117 data &= ~PCIE_UC_SERVRITY_FCP;
118 AT_WRITE_REG(hw, REG_PCIE_UC_SEVERITY, data);
119
120 if (flag & ATL1C_PCIE_L0S_L1_DISABLE)
121 atl1c_disable_l0s_l1(hw);
122 if (flag & ATL1C_PCIE_PHY_RESET)
123 AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT);
124 else
125 AT_WRITE_REG(hw, REG_GPHY_CTRL,
126 GPHY_CTRL_DEFAULT | GPHY_CTRL_EXT_RESET);
127
128 msleep(1);
129}
130
131/*
132 * atl1c_irq_enable - Enable default interrupt generation settings
133 * @adapter: board private structure
134 */
135static inline void atl1c_irq_enable(struct atl1c_adapter *adapter)
136{
137 if (likely(atomic_dec_and_test(&adapter->irq_sem))) {
138 AT_WRITE_REG(&adapter->hw, REG_ISR, 0x7FFFFFFF);
139 AT_WRITE_REG(&adapter->hw, REG_IMR, adapter->hw.intr_mask);
140 AT_WRITE_FLUSH(&adapter->hw);
141 }
142}
143
144/*
145 * atl1c_irq_disable - Mask off interrupt generation on the NIC
146 * @adapter: board private structure
147 */
148static inline void atl1c_irq_disable(struct atl1c_adapter *adapter)
149{
150 atomic_inc(&adapter->irq_sem);
151 AT_WRITE_REG(&adapter->hw, REG_IMR, 0);
152 AT_WRITE_FLUSH(&adapter->hw);
153 synchronize_irq(adapter->pdev->irq);
154}
155
156/*
157 * atl1c_irq_reset - reset interrupt confiure on the NIC
158 * @adapter: board private structure
159 */
160static inline void atl1c_irq_reset(struct atl1c_adapter *adapter)
161{
162 atomic_set(&adapter->irq_sem, 1);
163 atl1c_irq_enable(adapter);
164}
165
166/*
167 * atl1c_phy_config - Timer Call-back
168 * @data: pointer to netdev cast into an unsigned long
169 */
170static void atl1c_phy_config(unsigned long data)
171{
172 struct atl1c_adapter *adapter = (struct atl1c_adapter *) data;
173 struct atl1c_hw *hw = &adapter->hw;
174 unsigned long flags;
175
176 spin_lock_irqsave(&adapter->mdio_lock, flags);
177 atl1c_restart_autoneg(hw);
178 spin_unlock_irqrestore(&adapter->mdio_lock, flags);
179}
180
181void atl1c_reinit_locked(struct atl1c_adapter *adapter)
182{
183
184 WARN_ON(in_interrupt());
185 atl1c_down(adapter);
186 atl1c_up(adapter);
187 clear_bit(__AT_RESETTING, &adapter->flags);
188}
189
190static void atl1c_reset_task(struct work_struct *work)
191{
192 struct atl1c_adapter *adapter;
193 struct net_device *netdev;
194
195 adapter = container_of(work, struct atl1c_adapter, reset_task);
196 netdev = adapter->netdev;
197
198 netif_device_detach(netdev);
199 atl1c_down(adapter);
200 atl1c_up(adapter);
201 netif_device_attach(netdev);
202}
203
204static void atl1c_check_link_status(struct atl1c_adapter *adapter)
205{
206 struct atl1c_hw *hw = &adapter->hw;
207 struct net_device *netdev = adapter->netdev;
208 struct pci_dev *pdev = adapter->pdev;
209 int err;
210 unsigned long flags;
211 u16 speed, duplex, phy_data;
212
213 spin_lock_irqsave(&adapter->mdio_lock, flags);
214 /* MII_BMSR must read twise */
215 atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
216 atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
217 spin_unlock_irqrestore(&adapter->mdio_lock, flags);
218
219 if ((phy_data & BMSR_LSTATUS) == 0) {
220 /* link down */
221 if (netif_carrier_ok(netdev)) {
222 hw->hibernate = true;
223 atl1c_set_aspm(hw, false);
224 if (atl1c_stop_mac(hw) != 0)
225 if (netif_msg_hw(adapter))
226 dev_warn(&pdev->dev,
227 "stop mac failed\n");
228 }
229 netif_carrier_off(netdev);
230 } else {
231 /* Link Up */
232 hw->hibernate = false;
233 spin_lock_irqsave(&adapter->mdio_lock, flags);
234 err = atl1c_get_speed_and_duplex(hw, &speed, &duplex);
235 spin_unlock_irqrestore(&adapter->mdio_lock, flags);
236 if (unlikely(err))
237 return;
238 /* link result is our setting */
239 if (adapter->link_speed != speed ||
240 adapter->link_duplex != duplex) {
241 adapter->link_speed = speed;
242 adapter->link_duplex = duplex;
243 atl1c_enable_tx_ctrl(hw);
244 atl1c_enable_rx_ctrl(hw);
245 atl1c_setup_mac_ctrl(adapter);
246 atl1c_set_aspm(hw, true);
247 if (netif_msg_link(adapter))
248 dev_info(&pdev->dev,
249 "%s: %s NIC Link is Up<%d Mbps %s>\n",
250 atl1c_driver_name, netdev->name,
251 adapter->link_speed,
252 adapter->link_duplex == FULL_DUPLEX ?
253 "Full Duplex" : "Half Duplex");
254 }
255 if (!netif_carrier_ok(netdev))
256 netif_carrier_on(netdev);
257 }
258}
259
260/*
261 * atl1c_link_chg_task - deal with link change event Out of interrupt context
262 * @netdev: network interface device structure
263 */
264static void atl1c_link_chg_task(struct work_struct *work)
265{
266 struct atl1c_adapter *adapter;
267
268 adapter = container_of(work, struct atl1c_adapter, link_chg_task);
269 atl1c_check_link_status(adapter);
270}
271
272static void atl1c_link_chg_event(struct atl1c_adapter *adapter)
273{
274 struct net_device *netdev = adapter->netdev;
275 struct pci_dev *pdev = adapter->pdev;
276 u16 phy_data;
277 u16 link_up;
278
279 spin_lock(&adapter->mdio_lock);
280 atl1c_read_phy_reg(&adapter->hw, MII_BMSR, &phy_data);
281 atl1c_read_phy_reg(&adapter->hw, MII_BMSR, &phy_data);
282 spin_unlock(&adapter->mdio_lock);
283 link_up = phy_data & BMSR_LSTATUS;
284 /* notify upper layer link down ASAP */
285 if (!link_up) {
286 if (netif_carrier_ok(netdev)) {
287 /* old link state: Up */
288 netif_carrier_off(netdev);
289 if (netif_msg_link(adapter))
290 dev_info(&pdev->dev,
291 "%s: %s NIC Link is Down\n",
292 atl1c_driver_name, netdev->name);
293 adapter->link_speed = SPEED_0;
294 }
295 }
296 schedule_work(&adapter->link_chg_task);
297}
298
299static void atl1c_del_timer(struct atl1c_adapter *adapter)
300{
301 del_timer_sync(&adapter->phy_config_timer);
302}
303
304static void atl1c_cancel_work(struct atl1c_adapter *adapter)
305{
306 cancel_work_sync(&adapter->reset_task);
307 cancel_work_sync(&adapter->link_chg_task);
308}
309
310/*
311 * atl1c_tx_timeout - Respond to a Tx Hang
312 * @netdev: network interface device structure
313 */
314static void atl1c_tx_timeout(struct net_device *netdev)
315{
316 struct atl1c_adapter *adapter = netdev_priv(netdev);
317
318 /* Do the reset outside of interrupt context */
319 schedule_work(&adapter->reset_task);
320}
321
322/*
323 * atl1c_set_multi - Multicast and Promiscuous mode set
324 * @netdev: network interface device structure
325 *
326 * The set_multi entry point is called whenever the multicast address
327 * list or the network interface flags are updated. This routine is
328 * responsible for configuring the hardware for proper multicast,
329 * promiscuous mode, and all-multi behavior.
330 */
331static void atl1c_set_multi(struct net_device *netdev)
332{
333 struct atl1c_adapter *adapter = netdev_priv(netdev);
334 struct atl1c_hw *hw = &adapter->hw;
335 struct dev_mc_list *mc_ptr;
336 u32 mac_ctrl_data;
337 u32 hash_value;
338
339 /* Check for Promiscuous and All Multicast modes */
340 AT_READ_REG(hw, REG_MAC_CTRL, &mac_ctrl_data);
341
342 if (netdev->flags & IFF_PROMISC) {
343 mac_ctrl_data |= MAC_CTRL_PROMIS_EN;
344 } else if (netdev->flags & IFF_ALLMULTI) {
345 mac_ctrl_data |= MAC_CTRL_MC_ALL_EN;
346 mac_ctrl_data &= ~MAC_CTRL_PROMIS_EN;
347 } else {
348 mac_ctrl_data &= ~(MAC_CTRL_PROMIS_EN | MAC_CTRL_MC_ALL_EN);
349 }
350
351 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
352
353 /* clear the old settings from the multicast hash table */
354 AT_WRITE_REG(hw, REG_RX_HASH_TABLE, 0);
355 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
356
357 /* comoute mc addresses' hash value ,and put it into hash table */
358 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) {
359 hash_value = atl1c_hash_mc_addr(hw, mc_ptr->dmi_addr);
360 atl1c_hash_set(hw, hash_value);
361 }
362}
363
364static void atl1c_vlan_rx_register(struct net_device *netdev,
365 struct vlan_group *grp)
366{
367 struct atl1c_adapter *adapter = netdev_priv(netdev);
368 struct pci_dev *pdev = adapter->pdev;
369 u32 mac_ctrl_data = 0;
370
371 if (netif_msg_pktdata(adapter))
372 dev_dbg(&pdev->dev, "atl1c_vlan_rx_register\n");
373
374 atl1c_irq_disable(adapter);
375
376 adapter->vlgrp = grp;
377 AT_READ_REG(&adapter->hw, REG_MAC_CTRL, &mac_ctrl_data);
378
379 if (grp) {
380 /* enable VLAN tag insert/strip */
381 mac_ctrl_data |= MAC_CTRL_RMV_VLAN;
382 } else {
383 /* disable VLAN tag insert/strip */
384 mac_ctrl_data &= ~MAC_CTRL_RMV_VLAN;
385 }
386
387 AT_WRITE_REG(&adapter->hw, REG_MAC_CTRL, mac_ctrl_data);
388 atl1c_irq_enable(adapter);
389}
390
391static void atl1c_restore_vlan(struct atl1c_adapter *adapter)
392{
393 struct pci_dev *pdev = adapter->pdev;
394
395 if (netif_msg_pktdata(adapter))
396 dev_dbg(&pdev->dev, "atl1c_restore_vlan !");
397 atl1c_vlan_rx_register(adapter->netdev, adapter->vlgrp);
398}
399/*
400 * atl1c_set_mac - Change the Ethernet Address of the NIC
401 * @netdev: network interface device structure
402 * @p: pointer to an address structure
403 *
404 * Returns 0 on success, negative on failure
405 */
406static int atl1c_set_mac_addr(struct net_device *netdev, void *p)
407{
408 struct atl1c_adapter *adapter = netdev_priv(netdev);
409 struct sockaddr *addr = p;
410
411 if (!is_valid_ether_addr(addr->sa_data))
412 return -EADDRNOTAVAIL;
413
414 if (netif_running(netdev))
415 return -EBUSY;
416
417 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
418 memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
419
420 atl1c_hw_set_mac_addr(&adapter->hw);
421
422 return 0;
423}
424
425static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter,
426 struct net_device *dev)
427{
428 int mtu = dev->mtu;
429
430 adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ?
431 roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
432}
433/*
434 * atl1c_change_mtu - Change the Maximum Transfer Unit
435 * @netdev: network interface device structure
436 * @new_mtu: new value for maximum frame size
437 *
438 * Returns 0 on success, negative on failure
439 */
440static int atl1c_change_mtu(struct net_device *netdev, int new_mtu)
441{
442 struct atl1c_adapter *adapter = netdev_priv(netdev);
443 int old_mtu = netdev->mtu;
444 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
445
446 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
447 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
448 if (netif_msg_link(adapter))
449 dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
450 return -EINVAL;
451 }
452 /* set MTU */
453 if (old_mtu != new_mtu && netif_running(netdev)) {
454 while (test_and_set_bit(__AT_RESETTING, &adapter->flags))
455 msleep(1);
456 netdev->mtu = new_mtu;
457 adapter->hw.max_frame_size = new_mtu;
458 atl1c_set_rxbufsize(adapter, netdev);
459 atl1c_down(adapter);
460 atl1c_up(adapter);
461 clear_bit(__AT_RESETTING, &adapter->flags);
462 if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) {
463 u32 phy_data;
464
465 AT_READ_REG(&adapter->hw, 0x1414, &phy_data);
466 phy_data |= 0x10000000;
467 AT_WRITE_REG(&adapter->hw, 0x1414, phy_data);
468 }
469
470 }
471 return 0;
472}
473
474/*
475 * caller should hold mdio_lock
476 */
477static int atl1c_mdio_read(struct net_device *netdev, int phy_id, int reg_num)
478{
479 struct atl1c_adapter *adapter = netdev_priv(netdev);
480 u16 result;
481
482 atl1c_read_phy_reg(&adapter->hw, reg_num & MDIO_REG_ADDR_MASK, &result);
483 return result;
484}
485
486static void atl1c_mdio_write(struct net_device *netdev, int phy_id,
487 int reg_num, int val)
488{
489 struct atl1c_adapter *adapter = netdev_priv(netdev);
490
491 atl1c_write_phy_reg(&adapter->hw, reg_num & MDIO_REG_ADDR_MASK, val);
492}
493
494/*
495 * atl1c_mii_ioctl -
496 * @netdev:
497 * @ifreq:
498 * @cmd:
499 */
500static int atl1c_mii_ioctl(struct net_device *netdev,
501 struct ifreq *ifr, int cmd)
502{
503 struct atl1c_adapter *adapter = netdev_priv(netdev);
504 struct pci_dev *pdev = adapter->pdev;
505 struct mii_ioctl_data *data = if_mii(ifr);
506 unsigned long flags;
507 int retval = 0;
508
509 if (!netif_running(netdev))
510 return -EINVAL;
511
512 spin_lock_irqsave(&adapter->mdio_lock, flags);
513 switch (cmd) {
514 case SIOCGMIIPHY:
515 data->phy_id = 0;
516 break;
517
518 case SIOCGMIIREG:
519 if (!capable(CAP_NET_ADMIN)) {
520 retval = -EPERM;
521 goto out;
522 }
523 if (atl1c_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
524 &data->val_out)) {
525 retval = -EIO;
526 goto out;
527 }
528 break;
529
530 case SIOCSMIIREG:
531 if (!capable(CAP_NET_ADMIN)) {
532 retval = -EPERM;
533 goto out;
534 }
535 if (data->reg_num & ~(0x1F)) {
536 retval = -EFAULT;
537 goto out;
538 }
539
540 dev_dbg(&pdev->dev, "<atl1c_mii_ioctl> write %x %x",
541 data->reg_num, data->val_in);
542 if (atl1c_write_phy_reg(&adapter->hw,
543 data->reg_num, data->val_in)) {
544 retval = -EIO;
545 goto out;
546 }
547 break;
548
549 default:
550 retval = -EOPNOTSUPP;
551 break;
552 }
553out:
554 spin_unlock_irqrestore(&adapter->mdio_lock, flags);
555 return retval;
556}
557
558/*
559 * atl1c_ioctl -
560 * @netdev:
561 * @ifreq:
562 * @cmd:
563 */
564static int atl1c_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
565{
566 switch (cmd) {
567 case SIOCGMIIPHY:
568 case SIOCGMIIREG:
569 case SIOCSMIIREG:
570 return atl1c_mii_ioctl(netdev, ifr, cmd);
571 default:
572 return -EOPNOTSUPP;
573 }
574}
575
576/*
577 * atl1c_alloc_queues - Allocate memory for all rings
578 * @adapter: board private structure to initialize
579 *
580 */
581static int __devinit atl1c_alloc_queues(struct atl1c_adapter *adapter)
582{
583 return 0;
584}
585
586static void atl1c_set_mac_type(struct atl1c_hw *hw)
587{
588 switch (hw->device_id) {
589 case PCI_DEVICE_ID_ATTANSIC_L2C:
590 hw->nic_type = athr_l2c;
591 break;
592
593 case PCI_DEVICE_ID_ATTANSIC_L1C:
594 hw->nic_type = athr_l1c;
595 break;
596
597 default:
598 break;
599 }
600}
601
602static int atl1c_setup_mac_funcs(struct atl1c_hw *hw)
603{
604 u32 phy_status_data;
605 u32 link_ctrl_data;
606
607 atl1c_set_mac_type(hw);
608 AT_READ_REG(hw, REG_PHY_STATUS, &phy_status_data);
609 AT_READ_REG(hw, REG_LINK_CTRL, &link_ctrl_data);
610
611 hw->ctrl_flags = ATL1C_INTR_CLEAR_ON_READ |
612 ATL1C_INTR_MODRT_ENABLE |
613 ATL1C_RX_IPV6_CHKSUM |
614 ATL1C_TXQ_MODE_ENHANCE;
615 if (link_ctrl_data & LINK_CTRL_L0S_EN)
616 hw->ctrl_flags |= ATL1C_ASPM_L0S_SUPPORT;
617 if (link_ctrl_data & LINK_CTRL_L1_EN)
618 hw->ctrl_flags |= ATL1C_ASPM_L1_SUPPORT;
619
620 if (hw->nic_type == athr_l1c) {
621 hw->ctrl_flags |= ATL1C_ASPM_CTRL_MON;
622 hw->ctrl_flags |= ATL1C_LINK_CAP_1000M;
623 }
624 return 0;
625}
626/*
627 * atl1c_sw_init - Initialize general software structures (struct atl1c_adapter)
628 * @adapter: board private structure to initialize
629 *
630 * atl1c_sw_init initializes the Adapter private data structure.
631 * Fields are initialized based on PCI device information and
632 * OS network device settings (MTU size).
633 */
634static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
635{
636 struct atl1c_hw *hw = &adapter->hw;
637 struct pci_dev *pdev = adapter->pdev;
638
639 adapter->wol = 0;
640 adapter->link_speed = SPEED_0;
641 adapter->link_duplex = FULL_DUPLEX;
642 adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE;
643 adapter->tpd_ring[0].count = 1024;
644 adapter->rfd_ring[0].count = 512;
645
646 hw->vendor_id = pdev->vendor;
647 hw->device_id = pdev->device;
648 hw->subsystem_vendor_id = pdev->subsystem_vendor;
649 hw->subsystem_id = pdev->subsystem_device;
650
651 /* before link up, we assume hibernate is true */
652 hw->hibernate = true;
653 hw->media_type = MEDIA_TYPE_AUTO_SENSOR;
654 if (atl1c_setup_mac_funcs(hw) != 0) {
655 dev_err(&pdev->dev, "set mac function pointers failed\n");
656 return -1;
657 }
658 hw->intr_mask = IMR_NORMAL_MASK;
659 hw->phy_configured = false;
660 hw->preamble_len = 7;
661 hw->max_frame_size = adapter->netdev->mtu;
662 if (adapter->num_rx_queues < 2) {
663 hw->rss_type = atl1c_rss_disable;
664 hw->rss_mode = atl1c_rss_mode_disable;
665 } else {
666 hw->rss_type = atl1c_rss_ipv4;
667 hw->rss_mode = atl1c_rss_mul_que_mul_int;
668 hw->rss_hash_bits = 16;
669 }
670 hw->autoneg_advertised = ADVERTISED_Autoneg;
671 hw->indirect_tab = 0xE4E4E4E4;
672 hw->base_cpu = 0;
673
674 hw->ict = 50000; /* 100ms */
675 hw->smb_timer = 200000; /* 400ms */
676 hw->cmb_tpd = 4;
677 hw->cmb_tx_timer = 1; /* 2 us */
678 hw->rx_imt = 200;
679 hw->tx_imt = 1000;
680
681 hw->tpd_burst = 5;
682 hw->rfd_burst = 8;
683 hw->dma_order = atl1c_dma_ord_out;
684 hw->dmar_block = atl1c_dma_req_1024;
685 hw->dmaw_block = atl1c_dma_req_1024;
686 hw->dmar_dly_cnt = 15;
687 hw->dmaw_dly_cnt = 4;
688
689 if (atl1c_alloc_queues(adapter)) {
690 dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
691 return -ENOMEM;
692 }
693 /* TODO */
694 atl1c_set_rxbufsize(adapter, adapter->netdev);
695 atomic_set(&adapter->irq_sem, 1);
696 spin_lock_init(&adapter->mdio_lock);
697 spin_lock_init(&adapter->tx_lock);
698 set_bit(__AT_DOWN, &adapter->flags);
699
700 return 0;
701}
702
703/*
704 * atl1c_clean_tx_ring - Free Tx-skb
705 * @adapter: board private structure
706 */
707static void atl1c_clean_tx_ring(struct atl1c_adapter *adapter,
708 enum atl1c_trans_queue type)
709{
710 struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type];
711 struct atl1c_buffer *buffer_info;
712 struct pci_dev *pdev = adapter->pdev;
713 u16 index, ring_count;
714
715 ring_count = tpd_ring->count;
716 for (index = 0; index < ring_count; index++) {
717 buffer_info = &tpd_ring->buffer_info[index];
718 if (buffer_info->state == ATL1_BUFFER_FREE)
719 continue;
720 if (buffer_info->dma)
721 pci_unmap_single(pdev, buffer_info->dma,
722 buffer_info->length,
723 PCI_DMA_TODEVICE);
724 if (buffer_info->skb)
725 dev_kfree_skb(buffer_info->skb);
726 buffer_info->dma = 0;
727 buffer_info->skb = NULL;
728 buffer_info->state = ATL1_BUFFER_FREE;
729 }
730
731 /* Zero out Tx-buffers */
732 memset(tpd_ring->desc, 0, sizeof(struct atl1c_tpd_desc) *
733 ring_count);
734 atomic_set(&tpd_ring->next_to_clean, 0);
735 tpd_ring->next_to_use = 0;
736}
737
738/*
739 * atl1c_clean_rx_ring - Free rx-reservation skbs
740 * @adapter: board private structure
741 */
742static void atl1c_clean_rx_ring(struct atl1c_adapter *adapter)
743{
744 struct atl1c_rfd_ring *rfd_ring = adapter->rfd_ring;
745 struct atl1c_rrd_ring *rrd_ring = adapter->rrd_ring;
746 struct atl1c_buffer *buffer_info;
747 struct pci_dev *pdev = adapter->pdev;
748 int i, j;
749
750 for (i = 0; i < adapter->num_rx_queues; i++) {
751 for (j = 0; j < rfd_ring[i].count; j++) {
752 buffer_info = &rfd_ring[i].buffer_info[j];
753 if (buffer_info->state == ATL1_BUFFER_FREE)
754 continue;
755 if (buffer_info->dma)
756 pci_unmap_single(pdev, buffer_info->dma,
757 buffer_info->length,
758 PCI_DMA_FROMDEVICE);
759 if (buffer_info->skb)
760 dev_kfree_skb(buffer_info->skb);
761 buffer_info->state = ATL1_BUFFER_FREE;
762 buffer_info->skb = NULL;
763 }
764 /* zero out the descriptor ring */
765 memset(rfd_ring[i].desc, 0, rfd_ring[i].size);
766 rfd_ring[i].next_to_clean = 0;
767 rfd_ring[i].next_to_use = 0;
768 rrd_ring[i].next_to_use = 0;
769 rrd_ring[i].next_to_clean = 0;
770 }
771}
772
773/*
774 * Read / Write Ptr Initialize:
775 */
776static void atl1c_init_ring_ptrs(struct atl1c_adapter *adapter)
777{
778 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring;
779 struct atl1c_rfd_ring *rfd_ring = adapter->rfd_ring;
780 struct atl1c_rrd_ring *rrd_ring = adapter->rrd_ring;
781 struct atl1c_buffer *buffer_info;
782 int i, j;
783
784 for (i = 0; i < AT_MAX_TRANSMIT_QUEUE; i++) {
785 tpd_ring[i].next_to_use = 0;
786 atomic_set(&tpd_ring[i].next_to_clean, 0);
787 buffer_info = tpd_ring[i].buffer_info;
788 for (j = 0; j < tpd_ring->count; j++)
789 buffer_info[i].state = ATL1_BUFFER_FREE;
790 }
791 for (i = 0; i < adapter->num_rx_queues; i++) {
792 rfd_ring[i].next_to_use = 0;
793 rfd_ring[i].next_to_clean = 0;
794 rrd_ring[i].next_to_use = 0;
795 rrd_ring[i].next_to_clean = 0;
796 for (j = 0; j < rfd_ring[i].count; j++) {
797 buffer_info = &rfd_ring[i].buffer_info[j];
798 buffer_info->state = ATL1_BUFFER_FREE;
799 }
800 }
801}
802
803/*
804 * atl1c_free_ring_resources - Free Tx / RX descriptor Resources
805 * @adapter: board private structure
806 *
807 * Free all transmit software resources
808 */
809static void atl1c_free_ring_resources(struct atl1c_adapter *adapter)
810{
811 struct pci_dev *pdev = adapter->pdev;
812
813 pci_free_consistent(pdev, adapter->ring_header.size,
814 adapter->ring_header.desc,
815 adapter->ring_header.dma);
816 adapter->ring_header.desc = NULL;
817
818 /* Note: just free tdp_ring.buffer_info,
819 * it contain rfd_ring.buffer_info, do not double free */
820 if (adapter->tpd_ring[0].buffer_info) {
821 kfree(adapter->tpd_ring[0].buffer_info);
822 adapter->tpd_ring[0].buffer_info = NULL;
823 }
824}
825
826/*
827 * atl1c_setup_mem_resources - allocate Tx / RX descriptor resources
828 * @adapter: board private structure
829 *
830 * Return 0 on success, negative on failure
831 */
832static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
833{
834 struct pci_dev *pdev = adapter->pdev;
835 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring;
836 struct atl1c_rfd_ring *rfd_ring = adapter->rfd_ring;
837 struct atl1c_rrd_ring *rrd_ring = adapter->rrd_ring;
838 struct atl1c_ring_header *ring_header = &adapter->ring_header;
839 int num_rx_queues = adapter->num_rx_queues;
840 int size;
841 int i;
842 int count = 0;
843 int rx_desc_count = 0;
844 u32 offset = 0;
845
846 rrd_ring[0].count = rfd_ring[0].count;
847 for (i = 1; i < AT_MAX_TRANSMIT_QUEUE; i++)
848 tpd_ring[i].count = tpd_ring[0].count;
849
850 for (i = 1; i < adapter->num_rx_queues; i++)
851 rfd_ring[i].count = rrd_ring[i].count = rfd_ring[0].count;
852
853 /* 2 tpd queue, one high priority queue,
854 * another normal priority queue */
855 size = sizeof(struct atl1c_buffer) * (tpd_ring->count * 2 +
856 rfd_ring->count * num_rx_queues);
857 tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL);
858 if (unlikely(!tpd_ring->buffer_info)) {
859 dev_err(&pdev->dev, "kzalloc failed, size = %d\n",
860 size);
861 goto err_nomem;
862 }
863 for (i = 0; i < AT_MAX_TRANSMIT_QUEUE; i++) {
864 tpd_ring[i].buffer_info =
865 (struct atl1c_buffer *) (tpd_ring->buffer_info + count);
866 count += tpd_ring[i].count;
867 }
868
869 for (i = 0; i < num_rx_queues; i++) {
870 rfd_ring[i].buffer_info =
871 (struct atl1c_buffer *) (tpd_ring->buffer_info + count);
872 count += rfd_ring[i].count;
873 rx_desc_count += rfd_ring[i].count;
874 }
875 /*
876 * real ring DMA buffer
877 * each ring/block may need up to 8 bytes for alignment, hence the
878 * additional bytes tacked onto the end.
879 */
880 ring_header->size = size =
881 sizeof(struct atl1c_tpd_desc) * tpd_ring->count * 2 +
882 sizeof(struct atl1c_rx_free_desc) * rx_desc_count +
883 sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
884 sizeof(struct atl1c_hw_stats) +
885 8 * 4 + 8 * 2 * num_rx_queues;
886
887 ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
888 &ring_header->dma);
889 if (unlikely(!ring_header->desc)) {
890 dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
891 goto err_nomem;
892 }
893 memset(ring_header->desc, 0, ring_header->size);
894 /* init TPD ring */
895
896 tpd_ring[0].dma = roundup(ring_header->dma, 8);
897 offset = tpd_ring[0].dma - ring_header->dma;
898 for (i = 0; i < AT_MAX_TRANSMIT_QUEUE; i++) {
899 tpd_ring[i].dma = ring_header->dma + offset;
900 tpd_ring[i].desc = (u8 *) ring_header->desc + offset;
901 tpd_ring[i].size =
902 sizeof(struct atl1c_tpd_desc) * tpd_ring[i].count;
903 offset += roundup(tpd_ring[i].size, 8);
904 }
905 /* init RFD ring */
906 for (i = 0; i < num_rx_queues; i++) {
907 rfd_ring[i].dma = ring_header->dma + offset;
908 rfd_ring[i].desc = (u8 *) ring_header->desc + offset;
909 rfd_ring[i].size = sizeof(struct atl1c_rx_free_desc) *
910 rfd_ring[i].count;
911 offset += roundup(rfd_ring[i].size, 8);
912 }
913
914 /* init RRD ring */
915 for (i = 0; i < num_rx_queues; i++) {
916 rrd_ring[i].dma = ring_header->dma + offset;
917 rrd_ring[i].desc = (u8 *) ring_header->desc + offset;
918 rrd_ring[i].size = sizeof(struct atl1c_recv_ret_status) *
919 rrd_ring[i].count;
920 offset += roundup(rrd_ring[i].size, 8);
921 }
922
923 adapter->smb.dma = ring_header->dma + offset;
924 adapter->smb.smb = (u8 *)ring_header->desc + offset;
925 return 0;
926
927err_nomem:
928 kfree(tpd_ring->buffer_info);
929 return -ENOMEM;
930}
931
932static void atl1c_configure_des_ring(struct atl1c_adapter *adapter)
933{
934 struct atl1c_hw *hw = &adapter->hw;
935 struct atl1c_rfd_ring *rfd_ring = (struct atl1c_rfd_ring *)
936 adapter->rfd_ring;
937 struct atl1c_rrd_ring *rrd_ring = (struct atl1c_rrd_ring *)
938 adapter->rrd_ring;
939 struct atl1c_tpd_ring *tpd_ring = (struct atl1c_tpd_ring *)
940 adapter->tpd_ring;
941 struct atl1c_cmb *cmb = (struct atl1c_cmb *) &adapter->cmb;
942 struct atl1c_smb *smb = (struct atl1c_smb *) &adapter->smb;
943 int i;
944
945 /* TPD */
946 AT_WRITE_REG(hw, REG_TX_BASE_ADDR_HI,
947 (u32)((tpd_ring[atl1c_trans_normal].dma &
948 AT_DMA_HI_ADDR_MASK) >> 32));
949 /* just enable normal priority TX queue */
950 AT_WRITE_REG(hw, REG_NTPD_HEAD_ADDR_LO,
951 (u32)(tpd_ring[atl1c_trans_normal].dma &
952 AT_DMA_LO_ADDR_MASK));
953 AT_WRITE_REG(hw, REG_HTPD_HEAD_ADDR_LO,
954 (u32)(tpd_ring[atl1c_trans_high].dma &
955 AT_DMA_LO_ADDR_MASK));
956 AT_WRITE_REG(hw, REG_TPD_RING_SIZE,
957 (u32)(tpd_ring[0].count & TPD_RING_SIZE_MASK));
958
959
960 /* RFD */
961 AT_WRITE_REG(hw, REG_RX_BASE_ADDR_HI,
962 (u32)((rfd_ring[0].dma & AT_DMA_HI_ADDR_MASK) >> 32));
963 for (i = 0; i < adapter->num_rx_queues; i++)
964 AT_WRITE_REG(hw, atl1c_rfd_addr_lo_regs[i],
965 (u32)(rfd_ring[i].dma & AT_DMA_LO_ADDR_MASK));
966
967 AT_WRITE_REG(hw, REG_RFD_RING_SIZE,
968 rfd_ring[0].count & RFD_RING_SIZE_MASK);
969 AT_WRITE_REG(hw, REG_RX_BUF_SIZE,
970 adapter->rx_buffer_len & RX_BUF_SIZE_MASK);
971
972 /* RRD */
973 for (i = 0; i < adapter->num_rx_queues; i++)
974 AT_WRITE_REG(hw, atl1c_rrd_addr_lo_regs[i],
975 (u32)(rrd_ring[i].dma & AT_DMA_LO_ADDR_MASK));
976 AT_WRITE_REG(hw, REG_RRD_RING_SIZE,
977 (rrd_ring[0].count & RRD_RING_SIZE_MASK));
978
979 /* CMB */
980 AT_WRITE_REG(hw, REG_CMB_BASE_ADDR_LO, cmb->dma & AT_DMA_LO_ADDR_MASK);
981
982 /* SMB */
983 AT_WRITE_REG(hw, REG_SMB_BASE_ADDR_HI,
984 (u32)((smb->dma & AT_DMA_HI_ADDR_MASK) >> 32));
985 AT_WRITE_REG(hw, REG_SMB_BASE_ADDR_LO,
986 (u32)(smb->dma & AT_DMA_LO_ADDR_MASK));
987 /* Load all of base address above */
988 AT_WRITE_REG(hw, REG_LOAD_PTR, 1);
989}
990
991static void atl1c_configure_tx(struct atl1c_adapter *adapter)
992{
993 struct atl1c_hw *hw = &adapter->hw;
994 u32 dev_ctrl_data;
995 u32 max_pay_load;
996 u16 tx_offload_thresh;
997 u32 txq_ctrl_data;
998 u32 extra_size = 0; /* Jumbo frame threshold in QWORD unit */
999
1000 extra_size = ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
1001 tx_offload_thresh = MAX_TX_OFFLOAD_THRESH;
1002 AT_WRITE_REG(hw, REG_TX_TSO_OFFLOAD_THRESH,
1003 (tx_offload_thresh >> 3) & TX_TSO_OFFLOAD_THRESH_MASK);
1004 AT_READ_REG(hw, REG_DEVICE_CTRL, &dev_ctrl_data);
1005 max_pay_load = (dev_ctrl_data >> DEVICE_CTRL_MAX_PAYLOAD_SHIFT) &
1006 DEVICE_CTRL_MAX_PAYLOAD_MASK;
1007 hw->dmaw_block = min(max_pay_load, hw->dmaw_block);
1008 max_pay_load = (dev_ctrl_data >> DEVICE_CTRL_MAX_RREQ_SZ_SHIFT) &
1009 DEVICE_CTRL_MAX_RREQ_SZ_MASK;
1010 hw->dmar_block = min(max_pay_load, hw->dmar_block);
1011
1012 txq_ctrl_data = (hw->tpd_burst & TXQ_NUM_TPD_BURST_MASK) <<
1013 TXQ_NUM_TPD_BURST_SHIFT;
1014 if (hw->ctrl_flags & ATL1C_TXQ_MODE_ENHANCE)
1015 txq_ctrl_data |= TXQ_CTRL_ENH_MODE;
1016 txq_ctrl_data |= (atl1c_pay_load_size[hw->dmar_block] &
1017 TXQ_TXF_BURST_NUM_MASK) << TXQ_TXF_BURST_NUM_SHIFT;
1018
1019 AT_WRITE_REG(hw, REG_TXQ_CTRL, txq_ctrl_data);
1020}
1021
1022static void atl1c_configure_rx(struct atl1c_adapter *adapter)
1023{
1024 struct atl1c_hw *hw = &adapter->hw;
1025 u32 rxq_ctrl_data;
1026
1027 rxq_ctrl_data = (hw->rfd_burst & RXQ_RFD_BURST_NUM_MASK) <<
1028 RXQ_RFD_BURST_NUM_SHIFT;
1029
1030 if (hw->ctrl_flags & ATL1C_RX_IPV6_CHKSUM)
1031 rxq_ctrl_data |= IPV6_CHKSUM_CTRL_EN;
1032 if (hw->rss_type == atl1c_rss_ipv4)
1033 rxq_ctrl_data |= RSS_HASH_IPV4;
1034 if (hw->rss_type == atl1c_rss_ipv4_tcp)
1035 rxq_ctrl_data |= RSS_HASH_IPV4_TCP;
1036 if (hw->rss_type == atl1c_rss_ipv6)
1037 rxq_ctrl_data |= RSS_HASH_IPV6;
1038 if (hw->rss_type == atl1c_rss_ipv6_tcp)
1039 rxq_ctrl_data |= RSS_HASH_IPV6_TCP;
1040 if (hw->rss_type != atl1c_rss_disable)
1041 rxq_ctrl_data |= RRS_HASH_CTRL_EN;
1042
1043 rxq_ctrl_data |= (hw->rss_mode & RSS_MODE_MASK) <<
1044 RSS_MODE_SHIFT;
1045 rxq_ctrl_data |= (hw->rss_hash_bits & RSS_HASH_BITS_MASK) <<
1046 RSS_HASH_BITS_SHIFT;
1047 if (hw->ctrl_flags & ATL1C_ASPM_CTRL_MON)
1048 rxq_ctrl_data |= (ASPM_THRUPUT_LIMIT_100M &
1049 ASPM_THRUPUT_LIMIT_MASK) << ASPM_THRUPUT_LIMIT_SHIFT;
1050
1051 AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data);
1052}
1053
1054static void atl1c_configure_rss(struct atl1c_adapter *adapter)
1055{
1056 struct atl1c_hw *hw = &adapter->hw;
1057
1058 AT_WRITE_REG(hw, REG_IDT_TABLE, hw->indirect_tab);
1059 AT_WRITE_REG(hw, REG_BASE_CPU_NUMBER, hw->base_cpu);
1060}
1061
1062static void atl1c_configure_dma(struct atl1c_adapter *adapter)
1063{
1064 struct atl1c_hw *hw = &adapter->hw;
1065 u32 dma_ctrl_data;
1066
1067 dma_ctrl_data = DMA_CTRL_DMAR_REQ_PRI;
1068 if (hw->ctrl_flags & ATL1C_CMB_ENABLE)
1069 dma_ctrl_data |= DMA_CTRL_CMB_EN;
1070 if (hw->ctrl_flags & ATL1C_SMB_ENABLE)
1071 dma_ctrl_data |= DMA_CTRL_SMB_EN;
1072 else
1073 dma_ctrl_data |= MAC_CTRL_SMB_DIS;
1074
1075 switch (hw->dma_order) {
1076 case atl1c_dma_ord_in:
1077 dma_ctrl_data |= DMA_CTRL_DMAR_IN_ORDER;
1078 break;
1079 case atl1c_dma_ord_enh:
1080 dma_ctrl_data |= DMA_CTRL_DMAR_ENH_ORDER;
1081 break;
1082 case atl1c_dma_ord_out:
1083 dma_ctrl_data |= DMA_CTRL_DMAR_OUT_ORDER;
1084 break;
1085 default:
1086 break;
1087 }
1088
1089 dma_ctrl_data |= (((u32)hw->dmar_block) & DMA_CTRL_DMAR_BURST_LEN_MASK)
1090 << DMA_CTRL_DMAR_BURST_LEN_SHIFT;
1091 dma_ctrl_data |= (((u32)hw->dmaw_block) & DMA_CTRL_DMAW_BURST_LEN_MASK)
1092 << DMA_CTRL_DMAW_BURST_LEN_SHIFT;
1093 dma_ctrl_data |= (((u32)hw->dmar_dly_cnt) & DMA_CTRL_DMAR_DLY_CNT_MASK)
1094 << DMA_CTRL_DMAR_DLY_CNT_SHIFT;
1095 dma_ctrl_data |= (((u32)hw->dmaw_dly_cnt) & DMA_CTRL_DMAW_DLY_CNT_MASK)
1096 << DMA_CTRL_DMAW_DLY_CNT_SHIFT;
1097
1098 AT_WRITE_REG(hw, REG_DMA_CTRL, dma_ctrl_data);
1099}
1100
1101/*
1102 * Stop the mac, transmit and receive units
1103 * hw - Struct containing variables accessed by shared code
1104 * return : 0 or idle status (if error)
1105 */
1106static int atl1c_stop_mac(struct atl1c_hw *hw)
1107{
1108 u32 data;
1109 int timeout;
1110
1111 AT_READ_REG(hw, REG_RXQ_CTRL, &data);
1112 data &= ~(RXQ1_CTRL_EN | RXQ2_CTRL_EN |
1113 RXQ3_CTRL_EN | RXQ_CTRL_EN);
1114 AT_WRITE_REG(hw, REG_RXQ_CTRL, data);
1115
1116 AT_READ_REG(hw, REG_TXQ_CTRL, &data);
1117 data &= ~TXQ_CTRL_EN;
1118 AT_WRITE_REG(hw, REG_TWSI_CTRL, data);
1119
1120 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
1121 AT_READ_REG(hw, REG_IDLE_STATUS, &data);
1122 if ((data & (IDLE_STATUS_RXQ_NO_IDLE |
1123 IDLE_STATUS_TXQ_NO_IDLE)) == 0)
1124 break;
1125 msleep(1);
1126 }
1127
1128 AT_READ_REG(hw, REG_MAC_CTRL, &data);
1129 data &= ~(MAC_CTRL_TX_EN | MAC_CTRL_RX_EN);
1130 AT_WRITE_REG(hw, REG_MAC_CTRL, data);
1131
1132 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
1133 AT_READ_REG(hw, REG_IDLE_STATUS, &data);
1134 if ((data & IDLE_STATUS_MASK) == 0)
1135 return 0;
1136 msleep(1);
1137 }
1138 return data;
1139}
1140
1141static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw)
1142{
1143 u32 data;
1144
1145 AT_READ_REG(hw, REG_RXQ_CTRL, &data);
1146 switch (hw->adapter->num_rx_queues) {
1147 case 4:
1148 data |= (RXQ3_CTRL_EN | RXQ2_CTRL_EN | RXQ1_CTRL_EN);
1149 break;
1150 case 3:
1151 data |= (RXQ2_CTRL_EN | RXQ1_CTRL_EN);
1152 break;
1153 case 2:
1154 data |= RXQ1_CTRL_EN;
1155 break;
1156 default:
1157 break;
1158 }
1159 data |= RXQ_CTRL_EN;
1160 AT_WRITE_REG(hw, REG_RXQ_CTRL, data);
1161}
1162
1163static void atl1c_enable_tx_ctrl(struct atl1c_hw *hw)
1164{
1165 u32 data;
1166
1167 AT_READ_REG(hw, REG_TXQ_CTRL, &data);
1168 data |= TXQ_CTRL_EN;
1169 AT_WRITE_REG(hw, REG_TXQ_CTRL, data);
1170}
1171
1172/*
1173 * Reset the transmit and receive units; mask and clear all interrupts.
1174 * hw - Struct containing variables accessed by shared code
1175 * return : 0 or idle status (if error)
1176 */
1177static int atl1c_reset_mac(struct atl1c_hw *hw)
1178{
1179 struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter;
1180 struct pci_dev *pdev = adapter->pdev;
1181 u32 idle_status_data = 0;
1182 int timeout = 0;
1183 int ret;
1184
1185 AT_WRITE_REG(hw, REG_IMR, 0);
1186 AT_WRITE_REG(hw, REG_ISR, ISR_DIS_INT);
1187
1188 ret = atl1c_stop_mac(hw);
1189 if (ret)
1190 return ret;
1191 /*
1192 * Issue Soft Reset to the MAC. This will reset the chip's
1193 * transmit, receive, DMA. It will not effect
1194 * the current PCI configuration. The global reset bit is self-
1195 * clearing, and should clear within a microsecond.
1196 */
1197 AT_WRITE_REGW(hw, REG_MASTER_CTRL, MASTER_CTRL_SOFT_RST);
1198 AT_WRITE_FLUSH(hw);
1199 msleep(10);
1200 /* Wait at least 10ms for All module to be Idle */
1201 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
1202 AT_READ_REG(hw, REG_IDLE_STATUS, &idle_status_data);
1203 if ((idle_status_data & IDLE_STATUS_MASK) == 0)
1204 break;
1205 msleep(1);
1206 }
1207 if (timeout >= AT_HW_MAX_IDLE_DELAY) {
1208 dev_err(&pdev->dev,
1209 "MAC state machine cann't be idle since"
1210 " disabled for 10ms second\n");
1211 return -1;
1212 }
1213 return 0;
1214}
1215
1216static void atl1c_disable_l0s_l1(struct atl1c_hw *hw)
1217{
1218 u32 pm_ctrl_data;
1219
1220 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
1221 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
1222 PM_CTRL_L1_ENTRY_TIMER_SHIFT);
1223 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
1224 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1225 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1226 pm_ctrl_data &= ~PM_CTRL_MAC_ASPM_CHK;
1227 pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
1228
1229 pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
1230 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
1231 pm_ctrl_data |= PM_CTRL_SERDES_L1_EN;
1232 AT_WRITE_REG(hw, REG_PM_CTRL, pm_ctrl_data);
1233}
1234
1235/*
1236 * Set ASPM state.
1237 * Enable/disable L0s/L1 depend on link state.
1238 */
1239static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
1240{
1241 u32 pm_ctrl_data;
1242
1243 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
1244
1245 pm_ctrl_data &= PM_CTRL_SERDES_PD_EX_L1;
1246 pm_ctrl_data |= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
1247 pm_ctrl_data |= ~PM_CTRL_SERDES_L1_EN;
1248 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
1249 PM_CTRL_L1_ENTRY_TIMER_SHIFT);
1250
1251 pm_ctrl_data |= PM_CTRL_MAC_ASPM_CHK;
1252
1253 if (linkup) {
1254 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
1255 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
1256
1257 if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT) {
1258 pm_ctrl_data |= AT_ASPM_L1_TIMER <<
1259 PM_CTRL_L1_ENTRY_TIMER_SHIFT;
1260 pm_ctrl_data |= PM_CTRL_ASPM_L1_EN;
1261 } else
1262 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1263
1264 if (hw->ctrl_flags & ATL1C_ASPM_L0S_SUPPORT)
1265 pm_ctrl_data |= PM_CTRL_ASPM_L0S_EN;
1266 else
1267 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1268
1269 } else {
1270 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1271 pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
1272
1273 pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
1274
1275 if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT)
1276 pm_ctrl_data |= PM_CTRL_ASPM_L1_EN;
1277 else
1278 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1279 }
1280
1281 AT_WRITE_REG(hw, REG_PM_CTRL, pm_ctrl_data);
1282}
1283
1284static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter)
1285{
1286 struct atl1c_hw *hw = &adapter->hw;
1287 struct net_device *netdev = adapter->netdev;
1288 u32 mac_ctrl_data;
1289
1290 mac_ctrl_data = MAC_CTRL_TX_EN | MAC_CTRL_RX_EN;
1291 mac_ctrl_data |= (MAC_CTRL_TX_FLOW | MAC_CTRL_RX_FLOW);
1292
1293 if (adapter->link_duplex == FULL_DUPLEX) {
1294 hw->mac_duplex = true;
1295 mac_ctrl_data |= MAC_CTRL_DUPLX;
1296 }
1297
1298 if (adapter->link_speed == SPEED_1000)
1299 hw->mac_speed = atl1c_mac_speed_1000;
1300 else
1301 hw->mac_speed = atl1c_mac_speed_10_100;
1302
1303 mac_ctrl_data |= (hw->mac_speed & MAC_CTRL_SPEED_MASK) <<
1304 MAC_CTRL_SPEED_SHIFT;
1305
1306 mac_ctrl_data |= (MAC_CTRL_ADD_CRC | MAC_CTRL_PAD);
1307 mac_ctrl_data |= ((hw->preamble_len & MAC_CTRL_PRMLEN_MASK) <<
1308 MAC_CTRL_PRMLEN_SHIFT);
1309
1310 if (adapter->vlgrp)
1311 mac_ctrl_data |= MAC_CTRL_RMV_VLAN;
1312
1313 mac_ctrl_data |= MAC_CTRL_BC_EN;
1314 if (netdev->flags & IFF_PROMISC)
1315 mac_ctrl_data |= MAC_CTRL_PROMIS_EN;
1316 if (netdev->flags & IFF_ALLMULTI)
1317 mac_ctrl_data |= MAC_CTRL_MC_ALL_EN;
1318
1319 mac_ctrl_data |= MAC_CTRL_SINGLE_PAUSE_EN;
1320 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
1321}
1322
1323/*
1324 * atl1c_configure - Configure Transmit&Receive Unit after Reset
1325 * @adapter: board private structure
1326 *
1327 * Configure the Tx /Rx unit of the MAC after a reset.
1328 */
1329static int atl1c_configure(struct atl1c_adapter *adapter)
1330{
1331 struct atl1c_hw *hw = &adapter->hw;
1332 u32 master_ctrl_data = 0;
1333 u32 intr_modrt_data;
1334
1335 /* clear interrupt status */
1336 AT_WRITE_REG(hw, REG_ISR, 0xFFFFFFFF);
1337 /* Clear any WOL status */
1338 AT_WRITE_REG(hw, REG_WOL_CTRL, 0);
1339 /* set Interrupt Clear Timer
1340 * HW will enable self to assert interrupt event to system after
1341 * waiting x-time for software to notify it accept interrupt.
1342 */
1343 AT_WRITE_REG(hw, REG_INT_RETRIG_TIMER,
1344 hw->ict & INT_RETRIG_TIMER_MASK);
1345
1346 atl1c_configure_des_ring(adapter);
1347
1348 if (hw->ctrl_flags & ATL1C_INTR_MODRT_ENABLE) {
1349 intr_modrt_data = (hw->tx_imt & IRQ_MODRT_TIMER_MASK) <<
1350 IRQ_MODRT_TX_TIMER_SHIFT;
1351 intr_modrt_data |= (hw->rx_imt & IRQ_MODRT_TIMER_MASK) <<
1352 IRQ_MODRT_RX_TIMER_SHIFT;
1353 AT_WRITE_REG(hw, REG_IRQ_MODRT_TIMER_INIT, intr_modrt_data);
1354 master_ctrl_data |=
1355 MASTER_CTRL_TX_ITIMER_EN | MASTER_CTRL_RX_ITIMER_EN;
1356 }
1357
1358 if (hw->ctrl_flags & ATL1C_INTR_CLEAR_ON_READ)
1359 master_ctrl_data |= MASTER_CTRL_INT_RDCLR;
1360
1361 AT_WRITE_REG(hw, REG_MASTER_CTRL, master_ctrl_data);
1362
1363 if (hw->ctrl_flags & ATL1C_CMB_ENABLE) {
1364 AT_WRITE_REG(hw, REG_CMB_TPD_THRESH,
1365 hw->cmb_tpd & CMB_TPD_THRESH_MASK);
1366 AT_WRITE_REG(hw, REG_CMB_TX_TIMER,
1367 hw->cmb_tx_timer & CMB_TX_TIMER_MASK);
1368 }
1369
1370 if (hw->ctrl_flags & ATL1C_SMB_ENABLE)
1371 AT_WRITE_REG(hw, REG_SMB_STAT_TIMER,
1372 hw->smb_timer & SMB_STAT_TIMER_MASK);
1373 /* set MTU */
1374 AT_WRITE_REG(hw, REG_MTU, hw->max_frame_size + ETH_HLEN +
1375 VLAN_HLEN + ETH_FCS_LEN);
1376 /* HDS, disable */
1377 AT_WRITE_REG(hw, REG_HDS_CTRL, 0);
1378
1379 atl1c_configure_tx(adapter);
1380 atl1c_configure_rx(adapter);
1381 atl1c_configure_rss(adapter);
1382 atl1c_configure_dma(adapter);
1383
1384 return 0;
1385}
1386
1387static void atl1c_update_hw_stats(struct atl1c_adapter *adapter)
1388{
1389 u16 hw_reg_addr = 0;
1390 unsigned long *stats_item = NULL;
1391 u32 data;
1392
1393 /* update rx status */
1394 hw_reg_addr = REG_MAC_RX_STATUS_BIN;
1395 stats_item = &adapter->hw_stats.rx_ok;
1396 while (hw_reg_addr <= REG_MAC_RX_STATUS_END) {
1397 AT_READ_REG(&adapter->hw, hw_reg_addr, &data);
1398 *stats_item += data;
1399 stats_item++;
1400 hw_reg_addr += 4;
1401 }
1402/* update tx status */
1403 hw_reg_addr = REG_MAC_TX_STATUS_BIN;
1404 stats_item = &adapter->hw_stats.tx_ok;
1405 while (hw_reg_addr <= REG_MAC_TX_STATUS_END) {
1406 AT_READ_REG(&adapter->hw, hw_reg_addr, &data);
1407 *stats_item += data;
1408 stats_item++;
1409 hw_reg_addr += 4;
1410 }
1411}
1412
1413/*
1414 * atl1c_get_stats - Get System Network Statistics
1415 * @netdev: network interface device structure
1416 *
1417 * Returns the address of the device statistics structure.
1418 * The statistics are actually updated from the timer callback.
1419 */
1420static struct net_device_stats *atl1c_get_stats(struct net_device *netdev)
1421{
1422 struct atl1c_adapter *adapter = netdev_priv(netdev);
1423 struct atl1c_hw_stats *hw_stats = &adapter->hw_stats;
1424 struct net_device_stats *net_stats = &adapter->net_stats;
1425
1426 atl1c_update_hw_stats(adapter);
1427 net_stats->rx_packets = hw_stats->rx_ok;
1428 net_stats->tx_packets = hw_stats->tx_ok;
1429 net_stats->rx_bytes = hw_stats->rx_byte_cnt;
1430 net_stats->tx_bytes = hw_stats->tx_byte_cnt;
1431 net_stats->multicast = hw_stats->rx_mcast;
1432 net_stats->collisions = hw_stats->tx_1_col +
1433 hw_stats->tx_2_col * 2 +
1434 hw_stats->tx_late_col + hw_stats->tx_abort_col;
1435 net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
1436 hw_stats->rx_len_err + hw_stats->rx_sz_ov +
1437 hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
1438 net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
1439 net_stats->rx_length_errors = hw_stats->rx_len_err;
1440 net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
1441 net_stats->rx_frame_errors = hw_stats->rx_align_err;
1442 net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
1443
1444 net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
1445
1446 net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
1447 hw_stats->tx_underrun + hw_stats->tx_trunc;
1448 net_stats->tx_fifo_errors = hw_stats->tx_underrun;
1449 net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
1450 net_stats->tx_window_errors = hw_stats->tx_late_col;
1451
1452 return &adapter->net_stats;
1453}
1454
1455static inline void atl1c_clear_phy_int(struct atl1c_adapter *adapter)
1456{
1457 u16 phy_data;
1458
1459 spin_lock(&adapter->mdio_lock);
1460 atl1c_read_phy_reg(&adapter->hw, MII_ISR, &phy_data);
1461 spin_unlock(&adapter->mdio_lock);
1462}
1463
1464static bool atl1c_clean_tx_irq(struct atl1c_adapter *adapter,
1465 enum atl1c_trans_queue type)
1466{
1467 struct atl1c_tpd_ring *tpd_ring = (struct atl1c_tpd_ring *)
1468 &adapter->tpd_ring[type];
1469 struct atl1c_buffer *buffer_info;
1470 u16 next_to_clean = atomic_read(&tpd_ring->next_to_clean);
1471 u16 hw_next_to_clean;
1472 u16 shift;
1473 u32 data;
1474
1475 if (type == atl1c_trans_high)
1476 shift = MB_HTPD_CONS_IDX_SHIFT;
1477 else
1478 shift = MB_NTPD_CONS_IDX_SHIFT;
1479
1480 AT_READ_REG(&adapter->hw, REG_MB_PRIO_CONS_IDX, &data);
1481 hw_next_to_clean = (data >> shift) & MB_PRIO_PROD_IDX_MASK;
1482
1483 while (next_to_clean != hw_next_to_clean) {
1484 buffer_info = &tpd_ring->buffer_info[next_to_clean];
1485 if (buffer_info->state == ATL1_BUFFER_BUSY) {
1486 pci_unmap_page(adapter->pdev, buffer_info->dma,
1487 buffer_info->length, PCI_DMA_TODEVICE);
1488 buffer_info->dma = 0;
1489 if (buffer_info->skb) {
1490 dev_kfree_skb_irq(buffer_info->skb);
1491 buffer_info->skb = NULL;
1492 }
1493 buffer_info->state = ATL1_BUFFER_FREE;
1494 }
1495 if (++next_to_clean == tpd_ring->count)
1496 next_to_clean = 0;
1497 atomic_set(&tpd_ring->next_to_clean, next_to_clean);
1498 }
1499
1500 if (netif_queue_stopped(adapter->netdev) &&
1501 netif_carrier_ok(adapter->netdev)) {
1502 netif_wake_queue(adapter->netdev);
1503 }
1504
1505 return true;
1506}
1507
1508/*
1509 * atl1c_intr - Interrupt Handler
1510 * @irq: interrupt number
1511 * @data: pointer to a network interface device structure
1512 * @pt_regs: CPU registers structure
1513 */
1514static irqreturn_t atl1c_intr(int irq, void *data)
1515{
1516 struct net_device *netdev = data;
1517 struct atl1c_adapter *adapter = netdev_priv(netdev);
1518 struct pci_dev *pdev = adapter->pdev;
1519 struct atl1c_hw *hw = &adapter->hw;
1520 int max_ints = AT_MAX_INT_WORK;
1521 int handled = IRQ_NONE;
1522 u32 status;
1523 u32 reg_data;
1524
1525 do {
1526 AT_READ_REG(hw, REG_ISR, &reg_data);
1527 status = reg_data & hw->intr_mask;
1528
1529 if (status == 0 || (status & ISR_DIS_INT) != 0) {
1530 if (max_ints != AT_MAX_INT_WORK)
1531 handled = IRQ_HANDLED;
1532 break;
1533 }
1534 /* link event */
1535 if (status & ISR_GPHY)
1536 atl1c_clear_phy_int(adapter);
1537 /* Ack ISR */
1538 AT_WRITE_REG(hw, REG_ISR, status | ISR_DIS_INT);
1539 if (status & ISR_RX_PKT) {
1540 if (likely(napi_schedule_prep(&adapter->napi))) {
1541 hw->intr_mask &= ~ISR_RX_PKT;
1542 AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
1543 __napi_schedule(&adapter->napi);
1544 }
1545 }
1546 if (status & ISR_TX_PKT)
1547 atl1c_clean_tx_irq(adapter, atl1c_trans_normal);
1548
1549 handled = IRQ_HANDLED;
1550 /* check if PCIE PHY Link down */
1551 if (status & ISR_ERROR) {
1552 if (netif_msg_hw(adapter))
1553 dev_err(&pdev->dev,
1554 "atl1c hardware error (status = 0x%x)\n",
1555 status & ISR_ERROR);
1556 /* reset MAC */
1557 hw->intr_mask &= ~ISR_ERROR;
1558 AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
1559 schedule_work(&adapter->reset_task);
1560 break;
1561 }
1562
1563 if (status & ISR_OVER)
1564 if (netif_msg_intr(adapter))
1565 dev_warn(&pdev->dev,
1566 "TX/RX over flow (status = 0x%x)\n",
1567 status & ISR_OVER);
1568
1569 /* link event */
1570 if (status & (ISR_GPHY | ISR_MANUAL)) {
1571 adapter->net_stats.tx_carrier_errors++;
1572 atl1c_link_chg_event(adapter);
1573 break;
1574 }
1575
1576 } while (--max_ints > 0);
1577 /* re-enable Interrupt*/
1578 AT_WRITE_REG(&adapter->hw, REG_ISR, 0);
1579 return handled;
1580}
1581
1582static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter,
1583 struct sk_buff *skb, struct atl1c_recv_ret_status *prrs)
1584{
1585 /*
1586 * The pid field in RRS in not correct sometimes, so we
1587 * cannot figure out if the packet is fragmented or not,
1588 * so we tell the KERNEL CHECKSUM_NONE
1589 */
1590 skb->ip_summed = CHECKSUM_NONE;
1591}
1592
1593static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, const int ringid)
1594{
1595 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring[ringid];
1596 struct pci_dev *pdev = adapter->pdev;
1597 struct atl1c_buffer *buffer_info, *next_info;
1598 struct sk_buff *skb;
1599 void *vir_addr = NULL;
1600 u16 num_alloc = 0;
1601 u16 rfd_next_to_use, next_next;
1602 struct atl1c_rx_free_desc *rfd_desc;
1603
1604 next_next = rfd_next_to_use = rfd_ring->next_to_use;
1605 if (++next_next == rfd_ring->count)
1606 next_next = 0;
1607 buffer_info = &rfd_ring->buffer_info[rfd_next_to_use];
1608 next_info = &rfd_ring->buffer_info[next_next];
1609
1610 while (next_info->state == ATL1_BUFFER_FREE) {
1611 rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use);
1612
1613 skb = dev_alloc_skb(adapter->rx_buffer_len);
1614 if (unlikely(!skb)) {
1615 if (netif_msg_rx_err(adapter))
1616 dev_warn(&pdev->dev, "alloc rx buffer failed\n");
1617 break;
1618 }
1619
1620 /*
1621 * Make buffer alignment 2 beyond a 16 byte boundary
1622 * this will result in a 16 byte aligned IP header after
1623 * the 14 byte MAC header is removed
1624 */
1625 vir_addr = skb->data;
1626 buffer_info->state = ATL1_BUFFER_BUSY;
1627 buffer_info->skb = skb;
1628 buffer_info->length = adapter->rx_buffer_len;
1629 buffer_info->dma = pci_map_single(pdev, vir_addr,
1630 buffer_info->length,
1631 PCI_DMA_FROMDEVICE);
1632 rfd_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
1633 rfd_next_to_use = next_next;
1634 if (++next_next == rfd_ring->count)
1635 next_next = 0;
1636 buffer_info = &rfd_ring->buffer_info[rfd_next_to_use];
1637 next_info = &rfd_ring->buffer_info[next_next];
1638 num_alloc++;
1639 }
1640
1641 if (num_alloc) {
1642 /* TODO: update mailbox here */
1643 wmb();
1644 rfd_ring->next_to_use = rfd_next_to_use;
1645 AT_WRITE_REG(&adapter->hw, atl1c_rfd_prod_idx_regs[ringid],
1646 rfd_ring->next_to_use & MB_RFDX_PROD_IDX_MASK);
1647 }
1648
1649 return num_alloc;
1650}
1651
1652static void atl1c_clean_rrd(struct atl1c_rrd_ring *rrd_ring,
1653 struct atl1c_recv_ret_status *rrs, u16 num)
1654{
1655 u16 i;
1656 /* the relationship between rrd and rfd is one map one */
1657 for (i = 0; i < num; i++, rrs = ATL1C_RRD_DESC(rrd_ring,
1658 rrd_ring->next_to_clean)) {
1659 rrs->word3 &= ~RRS_RXD_UPDATED;
1660 if (++rrd_ring->next_to_clean == rrd_ring->count)
1661 rrd_ring->next_to_clean = 0;
1662 }
1663}
1664
1665static void atl1c_clean_rfd(struct atl1c_rfd_ring *rfd_ring,
1666 struct atl1c_recv_ret_status *rrs, u16 num)
1667{
1668 u16 i;
1669 u16 rfd_index;
1670 struct atl1c_buffer *buffer_info = rfd_ring->buffer_info;
1671
1672 rfd_index = (rrs->word0 >> RRS_RX_RFD_INDEX_SHIFT) &
1673 RRS_RX_RFD_INDEX_MASK;
1674 for (i = 0; i < num; i++) {
1675 buffer_info[rfd_index].skb = NULL;
1676 buffer_info[rfd_index].state = ATL1_BUFFER_FREE;
1677 if (++rfd_index == rfd_ring->count)
1678 rfd_index = 0;
1679 }
1680 rfd_ring->next_to_clean = rfd_index;
1681}
1682
1683static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que,
1684 int *work_done, int work_to_do)
1685{
1686 u16 rfd_num, rfd_index;
1687 u16 count = 0;
1688 u16 length;
1689 struct pci_dev *pdev = adapter->pdev;
1690 struct net_device *netdev = adapter->netdev;
1691 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring[que];
1692 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring[que];
1693 struct sk_buff *skb;
1694 struct atl1c_recv_ret_status *rrs;
1695 struct atl1c_buffer *buffer_info;
1696
1697 while (1) {
1698 if (*work_done >= work_to_do)
1699 break;
1700 rrs = ATL1C_RRD_DESC(rrd_ring, rrd_ring->next_to_clean);
1701 if (likely(RRS_RXD_IS_VALID(rrs->word3))) {
1702 rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) &
1703 RRS_RX_RFD_CNT_MASK;
1704 if (unlikely(rfd_num) != 1)
1705 /* TODO support mul rfd*/
1706 if (netif_msg_rx_err(adapter))
1707 dev_warn(&pdev->dev,
1708 "Multi rfd not support yet!\n");
1709 goto rrs_checked;
1710 } else {
1711 break;
1712 }
1713rrs_checked:
1714 atl1c_clean_rrd(rrd_ring, rrs, rfd_num);
1715 if (rrs->word3 & (RRS_RX_ERR_SUM | RRS_802_3_LEN_ERR)) {
1716 atl1c_clean_rfd(rfd_ring, rrs, rfd_num);
1717 if (netif_msg_rx_err(adapter))
1718 dev_warn(&pdev->dev,
1719 "wrong packet! rrs word3 is %x\n",
1720 rrs->word3);
1721 continue;
1722 }
1723
1724 length = le16_to_cpu((rrs->word3 >> RRS_PKT_SIZE_SHIFT) &
1725 RRS_PKT_SIZE_MASK);
1726 /* Good Receive */
1727 if (likely(rfd_num == 1)) {
1728 rfd_index = (rrs->word0 >> RRS_RX_RFD_INDEX_SHIFT) &
1729 RRS_RX_RFD_INDEX_MASK;
1730 buffer_info = &rfd_ring->buffer_info[rfd_index];
1731 pci_unmap_single(pdev, buffer_info->dma,
1732 buffer_info->length, PCI_DMA_FROMDEVICE);
1733 skb = buffer_info->skb;
1734 } else {
1735 /* TODO */
1736 if (netif_msg_rx_err(adapter))
1737 dev_warn(&pdev->dev,
1738 "Multi rfd not support yet!\n");
1739 break;
1740 }
1741 atl1c_clean_rfd(rfd_ring, rrs, rfd_num);
1742 skb_put(skb, length - ETH_FCS_LEN);
1743 skb->protocol = eth_type_trans(skb, netdev);
1744 skb->dev = netdev;
1745 atl1c_rx_checksum(adapter, skb, rrs);
1746 if (unlikely(adapter->vlgrp) && rrs->word3 & RRS_VLAN_INS) {
1747 u16 vlan;
1748
1749 AT_TAG_TO_VLAN(rrs->vlan_tag, vlan);
1750 vlan = le16_to_cpu(vlan);
1751 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, vlan);
1752 } else
1753 netif_receive_skb(skb);
1754
1755 netdev->last_rx = jiffies;
1756 (*work_done)++;
1757 count++;
1758 }
1759 if (count)
1760 atl1c_alloc_rx_buffer(adapter, que);
1761}
1762
1763/*
1764 * atl1c_clean - NAPI Rx polling callback
1765 * @adapter: board private structure
1766 */
1767static int atl1c_clean(struct napi_struct *napi, int budget)
1768{
1769 struct atl1c_adapter *adapter =
1770 container_of(napi, struct atl1c_adapter, napi);
1771 int work_done = 0;
1772
1773 /* Keep link state information with original netdev */
1774 if (!netif_carrier_ok(adapter->netdev))
1775 goto quit_polling;
1776 /* just enable one RXQ */
1777 atl1c_clean_rx_irq(adapter, 0, &work_done, budget);
1778
1779 if (work_done < budget) {
1780quit_polling:
1781 napi_complete(napi);
1782 adapter->hw.intr_mask |= ISR_RX_PKT;
1783 AT_WRITE_REG(&adapter->hw, REG_IMR, adapter->hw.intr_mask);
1784 }
1785 return work_done;
1786}
1787
1788#ifdef CONFIG_NET_POLL_CONTROLLER
1789
1790/*
1791 * Polling 'interrupt' - used by things like netconsole to send skbs
1792 * without having to re-enable interrupts. It's not called while
1793 * the interrupt routine is executing.
1794 */
1795static void atl1c_netpoll(struct net_device *netdev)
1796{
1797 struct atl1c_adapter *adapter = netdev_priv(netdev);
1798
1799 disable_irq(adapter->pdev->irq);
1800 atl1c_intr(adapter->pdev->irq, netdev);
1801 enable_irq(adapter->pdev->irq);
1802}
1803#endif
1804
1805static inline u16 atl1c_tpd_avail(struct atl1c_adapter *adapter, enum atl1c_trans_queue type)
1806{
1807 struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type];
1808 u16 next_to_use = 0;
1809 u16 next_to_clean = 0;
1810
1811 next_to_clean = atomic_read(&tpd_ring->next_to_clean);
1812 next_to_use = tpd_ring->next_to_use;
1813
1814 return (u16)(next_to_clean > next_to_use) ?
1815 (next_to_clean - next_to_use - 1) :
1816 (tpd_ring->count + next_to_clean - next_to_use - 1);
1817}
1818
1819/*
1820 * get next usable tpd
1821 * Note: should call atl1c_tdp_avail to make sure
1822 * there is enough tpd to use
1823 */
1824static struct atl1c_tpd_desc *atl1c_get_tpd(struct atl1c_adapter *adapter,
1825 enum atl1c_trans_queue type)
1826{
1827 struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type];
1828 struct atl1c_tpd_desc *tpd_desc;
1829 u16 next_to_use = 0;
1830
1831 next_to_use = tpd_ring->next_to_use;
1832 if (++tpd_ring->next_to_use == tpd_ring->count)
1833 tpd_ring->next_to_use = 0;
1834 tpd_desc = ATL1C_TPD_DESC(tpd_ring, next_to_use);
1835 memset(tpd_desc, 0, sizeof(struct atl1c_tpd_desc));
1836 return tpd_desc;
1837}
1838
1839static struct atl1c_buffer *
1840atl1c_get_tx_buffer(struct atl1c_adapter *adapter, struct atl1c_tpd_desc *tpd)
1841{
1842 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring;
1843
1844 return &tpd_ring->buffer_info[tpd -
1845 (struct atl1c_tpd_desc *)tpd_ring->desc];
1846}
1847
1848/* Calculate the transmit packet descript needed*/
1849static u16 atl1c_cal_tpd_req(const struct sk_buff *skb)
1850{
1851 u16 tpd_req;
1852 u16 proto_hdr_len = 0;
1853
1854 tpd_req = skb_shinfo(skb)->nr_frags + 1;
1855
1856 if (skb_is_gso(skb)) {
1857 proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
1858 if (proto_hdr_len < skb_headlen(skb))
1859 tpd_req++;
1860 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
1861 tpd_req++;
1862 }
1863 return tpd_req;
1864}
1865
1866static int atl1c_tso_csum(struct atl1c_adapter *adapter,
1867 struct sk_buff *skb,
1868 struct atl1c_tpd_desc **tpd,
1869 enum atl1c_trans_queue type)
1870{
1871 struct pci_dev *pdev = adapter->pdev;
1872 u8 hdr_len;
1873 u32 real_len;
1874 unsigned short offload_type;
1875 int err;
1876
1877 if (skb_is_gso(skb)) {
1878 if (skb_header_cloned(skb)) {
1879 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
1880 if (unlikely(err))
1881 return -1;
1882 }
1883 offload_type = skb_shinfo(skb)->gso_type;
1884
1885 if (offload_type & SKB_GSO_TCPV4) {
1886 real_len = (((unsigned char *)ip_hdr(skb) - skb->data)
1887 + ntohs(ip_hdr(skb)->tot_len));
1888
1889 if (real_len < skb->len)
1890 pskb_trim(skb, real_len);
1891
1892 hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
1893 if (unlikely(skb->len == hdr_len)) {
1894 /* only xsum need */
1895 if (netif_msg_tx_queued(adapter))
1896 dev_warn(&pdev->dev,
1897 "IPV4 tso with zero data??\n");
1898 goto check_sum;
1899 } else {
1900 ip_hdr(skb)->check = 0;
1901 tcp_hdr(skb)->check = ~csum_tcpudp_magic(
1902 ip_hdr(skb)->saddr,
1903 ip_hdr(skb)->daddr,
1904 0, IPPROTO_TCP, 0);
1905 (*tpd)->word1 |= 1 << TPD_IPV4_PACKET_SHIFT;
1906 }
1907 }
1908
1909 if (offload_type & SKB_GSO_TCPV6) {
1910 struct atl1c_tpd_ext_desc *etpd =
1911 *(struct atl1c_tpd_ext_desc **)(tpd);
1912
1913 memset(etpd, 0, sizeof(struct atl1c_tpd_ext_desc));
1914 *tpd = atl1c_get_tpd(adapter, type);
1915 ipv6_hdr(skb)->payload_len = 0;
1916 /* check payload == 0 byte ? */
1917 hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
1918 if (unlikely(skb->len == hdr_len)) {
1919 /* only xsum need */
1920 if (netif_msg_tx_queued(adapter))
1921 dev_warn(&pdev->dev,
1922 "IPV6 tso with zero data??\n");
1923 goto check_sum;
1924 } else
1925 tcp_hdr(skb)->check = ~csum_ipv6_magic(
1926 &ipv6_hdr(skb)->saddr,
1927 &ipv6_hdr(skb)->daddr,
1928 0, IPPROTO_TCP, 0);
1929 etpd->word1 |= 1 << TPD_LSO_EN_SHIFT;
1930 etpd->word1 |= 1 << TPD_LSO_VER_SHIFT;
1931 etpd->pkt_len = cpu_to_le32(skb->len);
1932 (*tpd)->word1 |= 1 << TPD_LSO_VER_SHIFT;
1933 }
1934
1935 (*tpd)->word1 |= 1 << TPD_LSO_EN_SHIFT;
1936 (*tpd)->word1 |= (skb_transport_offset(skb) & TPD_TCPHDR_OFFSET_MASK) <<
1937 TPD_TCPHDR_OFFSET_SHIFT;
1938 (*tpd)->word1 |= (skb_shinfo(skb)->gso_size & TPD_MSS_MASK) <<
1939 TPD_MSS_SHIFT;
1940 return 0;
1941 }
1942
1943check_sum:
1944 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1945 u8 css, cso;
1946 cso = skb_transport_offset(skb);
1947
1948 if (unlikely(cso & 0x1)) {
1949 if (netif_msg_tx_err(adapter))
1950 dev_err(&adapter->pdev->dev,
1951 "payload offset should not an event number\n");
1952 return -1;
1953 } else {
1954 css = cso + skb->csum_offset;
1955
1956 (*tpd)->word1 |= ((cso >> 1) & TPD_PLOADOFFSET_MASK) <<
1957 TPD_PLOADOFFSET_SHIFT;
1958 (*tpd)->word1 |= ((css >> 1) & TPD_CCSUM_OFFSET_MASK) <<
1959 TPD_CCSUM_OFFSET_SHIFT;
1960 (*tpd)->word1 |= 1 << TPD_CCSUM_EN_SHIFT;
1961 }
1962 }
1963 return 0;
1964}
1965
1966static void atl1c_tx_map(struct atl1c_adapter *adapter,
1967 struct sk_buff *skb, struct atl1c_tpd_desc *tpd,
1968 enum atl1c_trans_queue type)
1969{
1970 struct atl1c_tpd_desc *use_tpd = NULL;
1971 struct atl1c_buffer *buffer_info = NULL;
1972 u16 buf_len = skb_headlen(skb);
1973 u16 map_len = 0;
1974 u16 mapped_len = 0;
1975 u16 hdr_len = 0;
1976 u16 nr_frags;
1977 u16 f;
1978 int tso;
1979
1980 nr_frags = skb_shinfo(skb)->nr_frags;
1981 tso = (tpd->word1 >> TPD_LSO_EN_SHIFT) & TPD_LSO_EN_MASK;
1982 if (tso) {
1983 /* TSO */
1984 map_len = hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
1985 use_tpd = tpd;
1986
1987 buffer_info = atl1c_get_tx_buffer(adapter, use_tpd);
1988 buffer_info->length = map_len;
1989 buffer_info->dma = pci_map_single(adapter->pdev,
1990 skb->data, hdr_len, PCI_DMA_TODEVICE);
1991 buffer_info->state = ATL1_BUFFER_BUSY;
1992 mapped_len += map_len;
1993 use_tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
1994 use_tpd->buffer_len = cpu_to_le16(buffer_info->length);
1995 }
1996
1997 if (mapped_len < buf_len) {
1998 /* mapped_len == 0, means we should use the first tpd,
1999 which is given by caller */
2000 if (mapped_len == 0)
2001 use_tpd = tpd;
2002 else {
2003 use_tpd = atl1c_get_tpd(adapter, type);
2004 memcpy(use_tpd, tpd, sizeof(struct atl1c_tpd_desc));
2005 use_tpd = atl1c_get_tpd(adapter, type);
2006 memcpy(use_tpd, tpd, sizeof(struct atl1c_tpd_desc));
2007 }
2008 buffer_info = atl1c_get_tx_buffer(adapter, use_tpd);
2009 buffer_info->length = buf_len - mapped_len;
2010 buffer_info->dma =
2011 pci_map_single(adapter->pdev, skb->data + mapped_len,
2012 buffer_info->length, PCI_DMA_TODEVICE);
2013 buffer_info->state = ATL1_BUFFER_BUSY;
2014
2015 use_tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
2016 use_tpd->buffer_len = cpu_to_le16(buffer_info->length);
2017 }
2018
2019 for (f = 0; f < nr_frags; f++) {
2020 struct skb_frag_struct *frag;
2021
2022 frag = &skb_shinfo(skb)->frags[f];
2023
2024 use_tpd = atl1c_get_tpd(adapter, type);
2025 memcpy(use_tpd, tpd, sizeof(struct atl1c_tpd_desc));
2026
2027 buffer_info = atl1c_get_tx_buffer(adapter, use_tpd);
2028 buffer_info->length = frag->size;
2029 buffer_info->dma =
2030 pci_map_page(adapter->pdev, frag->page,
2031 frag->page_offset,
2032 buffer_info->length,
2033 PCI_DMA_TODEVICE);
2034 buffer_info->state = ATL1_BUFFER_BUSY;
2035
2036 use_tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
2037 use_tpd->buffer_len = cpu_to_le16(buffer_info->length);
2038 }
2039
2040 /* The last tpd */
2041 use_tpd->word1 |= 1 << TPD_EOP_SHIFT;
2042 /* The last buffer info contain the skb address,
2043 so it will be free after unmap */
2044 buffer_info->skb = skb;
2045}
2046
2047static void atl1c_tx_queue(struct atl1c_adapter *adapter, struct sk_buff *skb,
2048 struct atl1c_tpd_desc *tpd, enum atl1c_trans_queue type)
2049{
2050 struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type];
2051 u32 prod_data;
2052
2053 AT_READ_REG(&adapter->hw, REG_MB_PRIO_PROD_IDX, &prod_data);
2054 switch (type) {
2055 case atl1c_trans_high:
2056 prod_data &= 0xFFFF0000;
2057 prod_data |= tpd_ring->next_to_use & 0xFFFF;
2058 break;
2059 case atl1c_trans_normal:
2060 prod_data &= 0x0000FFFF;
2061 prod_data |= (tpd_ring->next_to_use & 0xFFFF) << 16;
2062 break;
2063 default:
2064 break;
2065 }
2066 wmb();
2067 AT_WRITE_REG(&adapter->hw, REG_MB_PRIO_PROD_IDX, prod_data);
2068}
2069
2070static int atl1c_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2071{
2072 struct atl1c_adapter *adapter = netdev_priv(netdev);
2073 unsigned long flags;
2074 u16 tpd_req = 1;
2075 struct atl1c_tpd_desc *tpd;
2076 enum atl1c_trans_queue type = atl1c_trans_normal;
2077
2078 if (test_bit(__AT_DOWN, &adapter->flags)) {
2079 dev_kfree_skb_any(skb);
2080 return NETDEV_TX_OK;
2081 }
2082
2083 tpd_req = atl1c_cal_tpd_req(skb);
2084 if (!spin_trylock_irqsave(&adapter->tx_lock, flags)) {
2085 if (netif_msg_pktdata(adapter))
2086 dev_info(&adapter->pdev->dev, "tx locked\n");
2087 return NETDEV_TX_LOCKED;
2088 }
2089 if (skb->mark == 0x01)
2090 type = atl1c_trans_high;
2091 else
2092 type = atl1c_trans_normal;
2093
2094 if (atl1c_tpd_avail(adapter, type) < tpd_req) {
2095 /* no enough descriptor, just stop queue */
2096 netif_stop_queue(netdev);
2097 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2098 return NETDEV_TX_BUSY;
2099 }
2100
2101 tpd = atl1c_get_tpd(adapter, type);
2102
2103 /* do TSO and check sum */
2104 if (atl1c_tso_csum(adapter, skb, &tpd, type) != 0) {
2105 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2106 dev_kfree_skb_any(skb);
2107 return NETDEV_TX_OK;
2108 }
2109
2110 if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
2111 u16 vlan = vlan_tx_tag_get(skb);
2112 __le16 tag;
2113
2114 vlan = cpu_to_le16(vlan);
2115 AT_VLAN_TO_TAG(vlan, tag);
2116 tpd->word1 |= 1 << TPD_INS_VTAG_SHIFT;
2117 tpd->vlan_tag = tag;
2118 }
2119
2120 if (skb_network_offset(skb) != ETH_HLEN)
2121 tpd->word1 |= 1 << TPD_ETH_TYPE_SHIFT; /* Ethernet frame */
2122
2123 atl1c_tx_map(adapter, skb, tpd, type);
2124 atl1c_tx_queue(adapter, skb, tpd, type);
2125
2126 netdev->trans_start = jiffies;
2127 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2128 return NETDEV_TX_OK;
2129}
2130
2131static void atl1c_free_irq(struct atl1c_adapter *adapter)
2132{
2133 struct net_device *netdev = adapter->netdev;
2134
2135 free_irq(adapter->pdev->irq, netdev);
2136
2137 if (adapter->have_msi)
2138 pci_disable_msi(adapter->pdev);
2139}
2140
2141static int atl1c_request_irq(struct atl1c_adapter *adapter)
2142{
2143 struct pci_dev *pdev = adapter->pdev;
2144 struct net_device *netdev = adapter->netdev;
2145 int flags = 0;
2146 int err = 0;
2147
2148 adapter->have_msi = true;
2149 err = pci_enable_msi(adapter->pdev);
2150 if (err) {
2151 if (netif_msg_ifup(adapter))
2152 dev_err(&pdev->dev,
2153 "Unable to allocate MSI interrupt Error: %d\n",
2154 err);
2155 adapter->have_msi = false;
2156 } else
2157 netdev->irq = pdev->irq;
2158
2159 if (!adapter->have_msi)
2160 flags |= IRQF_SHARED;
2161 err = request_irq(adapter->pdev->irq, &atl1c_intr, flags,
2162 netdev->name, netdev);
2163 if (err) {
2164 if (netif_msg_ifup(adapter))
2165 dev_err(&pdev->dev,
2166 "Unable to allocate interrupt Error: %d\n",
2167 err);
2168 if (adapter->have_msi)
2169 pci_disable_msi(adapter->pdev);
2170 return err;
2171 }
2172 if (netif_msg_ifup(adapter))
2173 dev_dbg(&pdev->dev, "atl1c_request_irq OK\n");
2174 return err;
2175}
2176
2177int atl1c_up(struct atl1c_adapter *adapter)
2178{
2179 struct net_device *netdev = adapter->netdev;
2180 int num;
2181 int err;
2182 int i;
2183
2184 netif_carrier_off(netdev);
2185 atl1c_init_ring_ptrs(adapter);
2186 atl1c_set_multi(netdev);
2187 atl1c_restore_vlan(adapter);
2188
2189 for (i = 0; i < adapter->num_rx_queues; i++) {
2190 num = atl1c_alloc_rx_buffer(adapter, i);
2191 if (unlikely(num == 0)) {
2192 err = -ENOMEM;
2193 goto err_alloc_rx;
2194 }
2195 }
2196
2197 if (atl1c_configure(adapter)) {
2198 err = -EIO;
2199 goto err_up;
2200 }
2201
2202 err = atl1c_request_irq(adapter);
2203 if (unlikely(err))
2204 goto err_up;
2205
2206 clear_bit(__AT_DOWN, &adapter->flags);
2207 napi_enable(&adapter->napi);
2208 atl1c_irq_enable(adapter);
2209 atl1c_check_link_status(adapter);
2210 netif_start_queue(netdev);
2211 return err;
2212
2213err_up:
2214err_alloc_rx:
2215 atl1c_clean_rx_ring(adapter);
2216 return err;
2217}
2218
2219void atl1c_down(struct atl1c_adapter *adapter)
2220{
2221 struct net_device *netdev = adapter->netdev;
2222
2223 atl1c_del_timer(adapter);
2224 atl1c_cancel_work(adapter);
2225
2226 /* signal that we're down so the interrupt handler does not
2227 * reschedule our watchdog timer */
2228 set_bit(__AT_DOWN, &adapter->flags);
2229 netif_carrier_off(netdev);
2230 napi_disable(&adapter->napi);
2231 atl1c_irq_disable(adapter);
2232 atl1c_free_irq(adapter);
2233 AT_WRITE_REG(&adapter->hw, REG_ISR, ISR_DIS_INT);
2234 /* reset MAC to disable all RX/TX */
2235 atl1c_reset_mac(&adapter->hw);
2236 msleep(1);
2237
2238 adapter->link_speed = SPEED_0;
2239 adapter->link_duplex = -1;
2240 atl1c_clean_tx_ring(adapter, atl1c_trans_normal);
2241 atl1c_clean_tx_ring(adapter, atl1c_trans_high);
2242 atl1c_clean_rx_ring(adapter);
2243}
2244
2245/*
2246 * atl1c_open - Called when a network interface is made active
2247 * @netdev: network interface device structure
2248 *
2249 * Returns 0 on success, negative value on failure
2250 *
2251 * The open entry point is called when a network interface is made
2252 * active by the system (IFF_UP). At this point all resources needed
2253 * for transmit and receive operations are allocated, the interrupt
2254 * handler is registered with the OS, the watchdog timer is started,
2255 * and the stack is notified that the interface is ready.
2256 */
2257static int atl1c_open(struct net_device *netdev)
2258{
2259 struct atl1c_adapter *adapter = netdev_priv(netdev);
2260 int err;
2261
2262 /* disallow open during test */
2263 if (test_bit(__AT_TESTING, &adapter->flags))
2264 return -EBUSY;
2265
2266 /* allocate rx/tx dma buffer & descriptors */
2267 err = atl1c_setup_ring_resources(adapter);
2268 if (unlikely(err))
2269 return err;
2270
2271 err = atl1c_up(adapter);
2272 if (unlikely(err))
2273 goto err_up;
2274
2275 if (adapter->hw.ctrl_flags & ATL1C_FPGA_VERSION) {
2276 u32 phy_data;
2277
2278 AT_READ_REG(&adapter->hw, REG_MDIO_CTRL, &phy_data);
2279 phy_data |= MDIO_AP_EN;
2280 AT_WRITE_REG(&adapter->hw, REG_MDIO_CTRL, phy_data);
2281 }
2282 return 0;
2283
2284err_up:
2285 atl1c_free_irq(adapter);
2286 atl1c_free_ring_resources(adapter);
2287 atl1c_reset_mac(&adapter->hw);
2288 return err;
2289}
2290
2291/*
2292 * atl1c_close - Disables a network interface
2293 * @netdev: network interface device structure
2294 *
2295 * Returns 0, this is not allowed to fail
2296 *
2297 * The close entry point is called when an interface is de-activated
2298 * by the OS. The hardware is still under the drivers control, but
2299 * needs to be disabled. A global MAC reset is issued to stop the
2300 * hardware, and all transmit and receive resources are freed.
2301 */
2302static int atl1c_close(struct net_device *netdev)
2303{
2304 struct atl1c_adapter *adapter = netdev_priv(netdev);
2305
2306 WARN_ON(test_bit(__AT_RESETTING, &adapter->flags));
2307 atl1c_down(adapter);
2308 atl1c_free_ring_resources(adapter);
2309 return 0;
2310}
2311
2312static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
2313{
2314 struct net_device *netdev = pci_get_drvdata(pdev);
2315 struct atl1c_adapter *adapter = netdev_priv(netdev);
2316 struct atl1c_hw *hw = &adapter->hw;
2317 u32 ctrl;
2318 u32 mac_ctrl_data;
2319 u32 master_ctrl_data;
2320 u32 wol_ctrl_data;
2321 u16 mii_bmsr_data;
2322 u16 save_autoneg_advertised;
2323 u16 mii_intr_status_data;
2324 u32 wufc = adapter->wol;
2325 u32 i;
2326 int retval = 0;
2327
2328 if (netif_running(netdev)) {
2329 WARN_ON(test_bit(__AT_RESETTING, &adapter->flags));
2330 atl1c_down(adapter);
2331 }
2332 netif_device_detach(netdev);
2333 atl1c_disable_l0s_l1(hw);
2334 retval = pci_save_state(pdev);
2335 if (retval)
2336 return retval;
2337 if (wufc) {
2338 AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
2339 master_ctrl_data &= ~MASTER_CTRL_CLK_SEL_DIS;
2340
2341 /* get link status */
2342 atl1c_read_phy_reg(hw, MII_BMSR, (u16 *)&mii_bmsr_data);
2343 atl1c_read_phy_reg(hw, MII_BMSR, (u16 *)&mii_bmsr_data);
2344 save_autoneg_advertised = hw->autoneg_advertised;
2345 hw->autoneg_advertised = ADVERTISED_10baseT_Half;
2346 if (atl1c_restart_autoneg(hw) != 0)
2347 if (netif_msg_link(adapter))
2348 dev_warn(&pdev->dev, "phy autoneg failed\n");
2349 hw->phy_configured = false; /* re-init PHY when resume */
2350 hw->autoneg_advertised = save_autoneg_advertised;
2351 /* turn on magic packet wol */
2352 if (wufc & AT_WUFC_MAG)
2353 wol_ctrl_data = WOL_MAGIC_EN | WOL_MAGIC_PME_EN;
2354
2355 if (wufc & AT_WUFC_LNKC) {
2356 for (i = 0; i < AT_SUSPEND_LINK_TIMEOUT; i++) {
2357 msleep(100);
2358 atl1c_read_phy_reg(hw, MII_BMSR,
2359 (u16 *)&mii_bmsr_data);
2360 if (mii_bmsr_data & BMSR_LSTATUS)
2361 break;
2362 }
2363 if ((mii_bmsr_data & BMSR_LSTATUS) == 0)
2364 if (netif_msg_link(adapter))
2365 dev_warn(&pdev->dev,
2366 "%s: Link may change"
2367 "when suspend\n",
2368 atl1c_driver_name);
2369 wol_ctrl_data |= WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN;
2370 /* only link up can wake up */
2371 if (atl1c_write_phy_reg(hw, MII_IER, IER_LINK_UP) != 0) {
2372 if (netif_msg_link(adapter))
2373 dev_err(&pdev->dev,
2374 "%s: read write phy "
2375 "register failed.\n",
2376 atl1c_driver_name);
2377 goto wol_dis;
2378 }
2379 }
2380 /* clear phy interrupt */
2381 atl1c_read_phy_reg(hw, MII_ISR, &mii_intr_status_data);
2382 /* Config MAC Ctrl register */
2383 mac_ctrl_data = MAC_CTRL_RX_EN;
2384 /* set to 10/100M halt duplex */
2385 mac_ctrl_data |= atl1c_mac_speed_10_100 << MAC_CTRL_SPEED_SHIFT;
2386 mac_ctrl_data |= (((u32)adapter->hw.preamble_len &
2387 MAC_CTRL_PRMLEN_MASK) <<
2388 MAC_CTRL_PRMLEN_SHIFT);
2389
2390 if (adapter->vlgrp)
2391 mac_ctrl_data |= MAC_CTRL_RMV_VLAN;
2392
2393 /* magic packet maybe Broadcast&multicast&Unicast frame */
2394 if (wufc & AT_WUFC_MAG)
2395 mac_ctrl_data |= MAC_CTRL_BC_EN;
2396
2397 if (netif_msg_hw(adapter))
2398 dev_dbg(&pdev->dev,
2399 "%s: suspend MAC=0x%x\n",
2400 atl1c_driver_name, mac_ctrl_data);
2401 AT_WRITE_REG(hw, REG_MASTER_CTRL, master_ctrl_data);
2402 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data);
2403 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
2404
2405 /* pcie patch */
2406 AT_READ_REG(hw, REG_PCIE_PHYMISC, &ctrl);
2407 ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
2408 AT_WRITE_REG(hw, REG_PCIE_PHYMISC, ctrl);
2409
2410 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
2411 goto suspend_exit;
2412 }
2413wol_dis:
2414
2415 /* WOL disabled */
2416 AT_WRITE_REG(hw, REG_WOL_CTRL, 0);
2417
2418 /* pcie patch */
2419 AT_READ_REG(hw, REG_PCIE_PHYMISC, &ctrl);
2420 ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
2421 AT_WRITE_REG(hw, REG_PCIE_PHYMISC, ctrl);
2422
2423 atl1c_phy_disable(hw);
2424 hw->phy_configured = false; /* re-init PHY when resume */
2425
2426 pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
2427suspend_exit:
2428
2429 pci_disable_device(pdev);
2430 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2431
2432 return 0;
2433}
2434
2435static int atl1c_resume(struct pci_dev *pdev)
2436{
2437 struct net_device *netdev = pci_get_drvdata(pdev);
2438 struct atl1c_adapter *adapter = netdev_priv(netdev);
2439
2440 pci_set_power_state(pdev, PCI_D0);
2441 pci_restore_state(pdev);
2442 pci_enable_wake(pdev, PCI_D3hot, 0);
2443 pci_enable_wake(pdev, PCI_D3cold, 0);
2444
2445 AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0);
2446
2447 atl1c_phy_reset(&adapter->hw);
2448 atl1c_reset_mac(&adapter->hw);
2449 netif_device_attach(netdev);
2450 if (netif_running(netdev))
2451 atl1c_up(adapter);
2452
2453 return 0;
2454}
2455
2456static void atl1c_shutdown(struct pci_dev *pdev)
2457{
2458 atl1c_suspend(pdev, PMSG_SUSPEND);
2459}
2460
2461static const struct net_device_ops atl1c_netdev_ops = {
2462 .ndo_open = atl1c_open,
2463 .ndo_stop = atl1c_close,
2464 .ndo_validate_addr = eth_validate_addr,
2465 .ndo_start_xmit = atl1c_xmit_frame,
2466 .ndo_set_mac_address = atl1c_set_mac_addr,
2467 .ndo_set_multicast_list = atl1c_set_multi,
2468 .ndo_change_mtu = atl1c_change_mtu,
2469 .ndo_do_ioctl = atl1c_ioctl,
2470 .ndo_tx_timeout = atl1c_tx_timeout,
2471 .ndo_get_stats = atl1c_get_stats,
2472 .ndo_vlan_rx_register = atl1c_vlan_rx_register,
2473#ifdef CONFIG_NET_POLL_CONTROLLER
2474 .ndo_poll_controller = atl1c_netpoll,
2475#endif
2476};
2477
2478static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
2479{
2480 SET_NETDEV_DEV(netdev, &pdev->dev);
2481 pci_set_drvdata(pdev, netdev);
2482
2483 netdev->irq = pdev->irq;
2484 netdev->netdev_ops = &atl1c_netdev_ops;
2485 netdev->watchdog_timeo = AT_TX_WATCHDOG;
2486 atl1c_set_ethtool_ops(netdev);
2487
2488 /* TODO: add when ready */
2489 netdev->features = NETIF_F_SG |
2490 NETIF_F_HW_CSUM |
2491 NETIF_F_HW_VLAN_TX |
2492 NETIF_F_HW_VLAN_RX |
2493 NETIF_F_TSO |
2494 NETIF_F_TSO6;
2495 return 0;
2496}
2497
2498/*
2499 * atl1c_probe - Device Initialization Routine
2500 * @pdev: PCI device information struct
2501 * @ent: entry in atl1c_pci_tbl
2502 *
2503 * Returns 0 on success, negative on failure
2504 *
2505 * atl1c_probe initializes an adapter identified by a pci_dev structure.
2506 * The OS initialization, configuring of the adapter private structure,
2507 * and a hardware reset occur.
2508 */
2509static int __devinit atl1c_probe(struct pci_dev *pdev,
2510 const struct pci_device_id *ent)
2511{
2512 struct net_device *netdev;
2513 struct atl1c_adapter *adapter;
2514 static int cards_found;
2515
2516 int err = 0;
2517
2518 /* enable device (incl. PCI PM wakeup and hotplug setup) */
2519 err = pci_enable_device_mem(pdev);
2520 if (err) {
2521 dev_err(&pdev->dev, "cannot enable PCI device\n");
2522 return err;
2523 }
2524
2525 /*
2526 * The atl1c chip can DMA to 64-bit addresses, but it uses a single
2527 * shared register for the high 32 bits, so only a single, aligned,
2528 * 4 GB physical address range can be used at a time.
2529 *
2530 * Supporting 64-bit DMA on this hardware is more trouble than it's
2531 * worth. It is far easier to limit to 32-bit DMA than update
2532 * various kernel subsystems to support the mechanics required by a
2533 * fixed-high-32-bit system.
2534 */
2535 if ((pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) ||
2536 (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) != 0)) {
2537 dev_err(&pdev->dev, "No usable DMA configuration,aborting\n");
2538 goto err_dma;
2539 }
2540
2541 err = pci_request_regions(pdev, atl1c_driver_name);
2542 if (err) {
2543 dev_err(&pdev->dev, "cannot obtain PCI resources\n");
2544 goto err_pci_reg;
2545 }
2546
2547 pci_set_master(pdev);
2548
2549 netdev = alloc_etherdev(sizeof(struct atl1c_adapter));
2550 if (netdev == NULL) {
2551 err = -ENOMEM;
2552 dev_err(&pdev->dev, "etherdev alloc failed\n");
2553 goto err_alloc_etherdev;
2554 }
2555
2556 err = atl1c_init_netdev(netdev, pdev);
2557 if (err) {
2558 dev_err(&pdev->dev, "init netdevice failed\n");
2559 goto err_init_netdev;
2560 }
2561 adapter = netdev_priv(netdev);
2562 adapter->bd_number = cards_found;
2563 adapter->netdev = netdev;
2564 adapter->pdev = pdev;
2565 adapter->hw.adapter = adapter;
2566 adapter->msg_enable = netif_msg_init(-1, atl1c_default_msg);
2567 adapter->hw.hw_addr = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
2568 if (!adapter->hw.hw_addr) {
2569 err = -EIO;
2570 dev_err(&pdev->dev, "cannot map device registers\n");
2571 goto err_ioremap;
2572 }
2573 netdev->base_addr = (unsigned long)adapter->hw.hw_addr;
2574
2575 /* init mii data */
2576 adapter->mii.dev = netdev;
2577 adapter->mii.mdio_read = atl1c_mdio_read;
2578 adapter->mii.mdio_write = atl1c_mdio_write;
2579 adapter->mii.phy_id_mask = 0x1f;
2580 adapter->mii.reg_num_mask = MDIO_REG_ADDR_MASK;
2581 netif_napi_add(netdev, &adapter->napi, atl1c_clean, 64);
2582 setup_timer(&adapter->phy_config_timer, atl1c_phy_config,
2583 (unsigned long)adapter);
2584 /* setup the private structure */
2585 err = atl1c_sw_init(adapter);
2586 if (err) {
2587 dev_err(&pdev->dev, "net device private data init failed\n");
2588 goto err_sw_init;
2589 }
2590 atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE |
2591 ATL1C_PCIE_PHY_RESET);
2592
2593 /* Init GPHY as early as possible due to power saving issue */
2594 atl1c_phy_reset(&adapter->hw);
2595
2596 err = atl1c_reset_mac(&adapter->hw);
2597 if (err) {
2598 err = -EIO;
2599 goto err_reset;
2600 }
2601
2602 device_init_wakeup(&pdev->dev, 1);
2603 /* reset the controller to
2604 * put the device in a known good starting state */
2605 err = atl1c_phy_init(&adapter->hw);
2606 if (err) {
2607 err = -EIO;
2608 goto err_reset;
2609 }
2610 if (atl1c_read_mac_addr(&adapter->hw) != 0) {
2611 err = -EIO;
2612 dev_err(&pdev->dev, "get mac address failed\n");
2613 goto err_eeprom;
2614 }
2615 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
2616 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
2617 if (netif_msg_probe(adapter))
2618 dev_dbg(&pdev->dev,
2619 "mac address : %02x-%02x-%02x-%02x-%02x-%02x\n",
2620 adapter->hw.mac_addr[0], adapter->hw.mac_addr[1],
2621 adapter->hw.mac_addr[2], adapter->hw.mac_addr[3],
2622 adapter->hw.mac_addr[4], adapter->hw.mac_addr[5]);
2623
2624 atl1c_hw_set_mac_addr(&adapter->hw);
2625 INIT_WORK(&adapter->reset_task, atl1c_reset_task);
2626 INIT_WORK(&adapter->link_chg_task, atl1c_link_chg_task);
2627 err = register_netdev(netdev);
2628 if (err) {
2629 dev_err(&pdev->dev, "register netdevice failed\n");
2630 goto err_register;
2631 }
2632
2633 if (netif_msg_probe(adapter))
2634 dev_info(&pdev->dev, "version %s\n", ATL1C_DRV_VERSION);
2635 cards_found++;
2636 return 0;
2637
2638err_reset:
2639err_register:
2640err_sw_init:
2641err_eeprom:
2642 iounmap(adapter->hw.hw_addr);
2643err_init_netdev:
2644err_ioremap:
2645 free_netdev(netdev);
2646err_alloc_etherdev:
2647 pci_release_regions(pdev);
2648err_pci_reg:
2649err_dma:
2650 pci_disable_device(pdev);
2651 return err;
2652}
2653
2654/*
2655 * atl1c_remove - Device Removal Routine
2656 * @pdev: PCI device information struct
2657 *
2658 * atl1c_remove is called by the PCI subsystem to alert the driver
2659 * that it should release a PCI device. The could be caused by a
2660 * Hot-Plug event, or because the driver is going to be removed from
2661 * memory.
2662 */
2663static void __devexit atl1c_remove(struct pci_dev *pdev)
2664{
2665 struct net_device *netdev = pci_get_drvdata(pdev);
2666 struct atl1c_adapter *adapter = netdev_priv(netdev);
2667
2668 unregister_netdev(netdev);
2669 atl1c_phy_disable(&adapter->hw);
2670
2671 iounmap(adapter->hw.hw_addr);
2672
2673 pci_release_regions(pdev);
2674 pci_disable_device(pdev);
2675 free_netdev(netdev);
2676}
2677
2678/*
2679 * atl1c_io_error_detected - called when PCI error is detected
2680 * @pdev: Pointer to PCI device
2681 * @state: The current pci connection state
2682 *
2683 * This function is called after a PCI bus error affecting
2684 * this device has been detected.
2685 */
2686static pci_ers_result_t atl1c_io_error_detected(struct pci_dev *pdev,
2687 pci_channel_state_t state)
2688{
2689 struct net_device *netdev = pci_get_drvdata(pdev);
2690 struct atl1c_adapter *adapter = netdev_priv(netdev);
2691
2692 netif_device_detach(netdev);
2693
2694 if (netif_running(netdev))
2695 atl1c_down(adapter);
2696
2697 pci_disable_device(pdev);
2698
2699 /* Request a slot slot reset. */
2700 return PCI_ERS_RESULT_NEED_RESET;
2701}
2702
2703/*
2704 * atl1c_io_slot_reset - called after the pci bus has been reset.
2705 * @pdev: Pointer to PCI device
2706 *
2707 * Restart the card from scratch, as if from a cold-boot. Implementation
2708 * resembles the first-half of the e1000_resume routine.
2709 */
2710static pci_ers_result_t atl1c_io_slot_reset(struct pci_dev *pdev)
2711{
2712 struct net_device *netdev = pci_get_drvdata(pdev);
2713 struct atl1c_adapter *adapter = netdev_priv(netdev);
2714
2715 if (pci_enable_device(pdev)) {
2716 if (netif_msg_hw(adapter))
2717 dev_err(&pdev->dev,
2718 "Cannot re-enable PCI device after reset\n");
2719 return PCI_ERS_RESULT_DISCONNECT;
2720 }
2721 pci_set_master(pdev);
2722
2723 pci_enable_wake(pdev, PCI_D3hot, 0);
2724 pci_enable_wake(pdev, PCI_D3cold, 0);
2725
2726 atl1c_reset_mac(&adapter->hw);
2727
2728 return PCI_ERS_RESULT_RECOVERED;
2729}
2730
2731/*
2732 * atl1c_io_resume - called when traffic can start flowing again.
2733 * @pdev: Pointer to PCI device
2734 *
2735 * This callback is called when the error recovery driver tells us that
2736 * its OK to resume normal operation. Implementation resembles the
2737 * second-half of the atl1c_resume routine.
2738 */
2739static void atl1c_io_resume(struct pci_dev *pdev)
2740{
2741 struct net_device *netdev = pci_get_drvdata(pdev);
2742 struct atl1c_adapter *adapter = netdev_priv(netdev);
2743
2744 if (netif_running(netdev)) {
2745 if (atl1c_up(adapter)) {
2746 if (netif_msg_hw(adapter))
2747 dev_err(&pdev->dev,
2748 "Cannot bring device back up after reset\n");
2749 return;
2750 }
2751 }
2752
2753 netif_device_attach(netdev);
2754}
2755
2756static struct pci_error_handlers atl1c_err_handler = {
2757 .error_detected = atl1c_io_error_detected,
2758 .slot_reset = atl1c_io_slot_reset,
2759 .resume = atl1c_io_resume,
2760};
2761
2762static struct pci_driver atl1c_driver = {
2763 .name = atl1c_driver_name,
2764 .id_table = atl1c_pci_tbl,
2765 .probe = atl1c_probe,
2766 .remove = __devexit_p(atl1c_remove),
2767 /* Power Managment Hooks */
2768 .suspend = atl1c_suspend,
2769 .resume = atl1c_resume,
2770 .shutdown = atl1c_shutdown,
2771 .err_handler = &atl1c_err_handler
2772};
2773
2774/*
2775 * atl1c_init_module - Driver Registration Routine
2776 *
2777 * atl1c_init_module is the first routine called when the driver is
2778 * loaded. All it does is register with the PCI subsystem.
2779 */
2780static int __init atl1c_init_module(void)
2781{
2782 return pci_register_driver(&atl1c_driver);
2783}
2784
2785/*
2786 * atl1c_exit_module - Driver Exit Cleanup Routine
2787 *
2788 * atl1c_exit_module is called just before the driver is removed
2789 * from memory.
2790 */
2791static void __exit atl1c_exit_module(void)
2792{
2793 pci_unregister_driver(&atl1c_driver);
2794}
2795
2796module_init(atl1c_init_module);
2797module_exit(atl1c_exit_module);
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index c38512ebcea6..dc5f051005fa 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1264,8 +1264,14 @@ static void b44_clear_stats(struct b44 *bp)
1264static void b44_chip_reset(struct b44 *bp, int reset_kind) 1264static void b44_chip_reset(struct b44 *bp, int reset_kind)
1265{ 1265{
1266 struct ssb_device *sdev = bp->sdev; 1266 struct ssb_device *sdev = bp->sdev;
1267 bool was_enabled;
1267 1268
1268 if (ssb_device_is_enabled(bp->sdev)) { 1269 was_enabled = ssb_device_is_enabled(bp->sdev);
1270
1271 ssb_device_enable(bp->sdev, 0);
1272 ssb_pcicore_dev_irqvecs_enable(&sdev->bus->pcicore, sdev);
1273
1274 if (was_enabled) {
1269 bw32(bp, B44_RCV_LAZY, 0); 1275 bw32(bp, B44_RCV_LAZY, 0);
1270 bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE); 1276 bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
1271 b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1); 1277 b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1);
@@ -1277,10 +1283,8 @@ static void b44_chip_reset(struct b44 *bp, int reset_kind)
1277 } 1283 }
1278 bw32(bp, B44_DMARX_CTRL, 0); 1284 bw32(bp, B44_DMARX_CTRL, 0);
1279 bp->rx_prod = bp->rx_cons = 0; 1285 bp->rx_prod = bp->rx_cons = 0;
1280 } else 1286 }
1281 ssb_pcicore_dev_irqvecs_enable(&sdev->bus->pcicore, sdev);
1282 1287
1283 ssb_device_enable(bp->sdev, 0);
1284 b44_clear_stats(bp); 1288 b44_clear_stats(bp);
1285 1289
1286 /* 1290 /*
@@ -2236,6 +2240,7 @@ static void __devexit b44_remove_one(struct ssb_device *sdev)
2236 struct net_device *dev = ssb_get_drvdata(sdev); 2240 struct net_device *dev = ssb_get_drvdata(sdev);
2237 2241
2238 unregister_netdev(dev); 2242 unregister_netdev(dev);
2243 ssb_device_disable(sdev, 0);
2239 ssb_bus_may_powerdown(sdev->bus); 2244 ssb_bus_may_powerdown(sdev->bus);
2240 free_netdev(dev); 2245 free_netdev(dev);
2241 ssb_pcihost_set_power_state(sdev, PCI_D3hot); 2246 ssb_pcihost_set_power_state(sdev, PCI_D3hot);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9fb388388fb7..e0578fe8c0db 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4113,7 +4113,7 @@ static int bond_neigh_setup(struct net_device *dev, struct neigh_parms *parms)
4113 const struct net_device_ops *slave_ops 4113 const struct net_device_ops *slave_ops
4114 = slave->dev->netdev_ops; 4114 = slave->dev->netdev_ops;
4115 if (slave_ops->ndo_neigh_setup) 4115 if (slave_ops->ndo_neigh_setup)
4116 return slave_ops->ndo_neigh_setup(dev, parms); 4116 return slave_ops->ndo_neigh_setup(slave->dev, parms);
4117 } 4117 }
4118 return 0; 4118 return 0;
4119} 4119}
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 0089746b8d02..bab8a934c33d 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -90,6 +90,7 @@ static const struct pci_device_id cxgb3_pci_tbl[] = {
90 CH_DEVICE(0x30, 2), /* T3B10 */ 90 CH_DEVICE(0x30, 2), /* T3B10 */
91 CH_DEVICE(0x31, 3), /* T3B20 */ 91 CH_DEVICE(0x31, 3), /* T3B20 */
92 CH_DEVICE(0x32, 1), /* T3B02 */ 92 CH_DEVICE(0x32, 1), /* T3B02 */
93 CH_DEVICE(0x35, 6), /* T3C20-derived T3C10 */
93 {0,} 94 {0,}
94}; 95};
95 96
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 2d1433077a8e..ac2a974dfe37 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -512,6 +512,13 @@ static const struct adapter_info t3_adap_info[] = {
512 F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 512 F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
513 { S_GPIO9, S_GPIO3 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, 513 { S_GPIO9, S_GPIO3 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
514 &mi1_mdio_ext_ops, "Chelsio T320"}, 514 &mi1_mdio_ext_ops, "Chelsio T320"},
515 {},
516 {},
517 {1, 0,
518 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN |
519 F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
520 { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
521 &mi1_mdio_ext_ops, "Chelsio T310" },
515}; 522};
516 523
517/* 524/*
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 5b910cf63740..b8251e827059 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -6011,9 +6011,20 @@ static void nv_shutdown(struct pci_dev *pdev)
6011 if (netif_running(dev)) 6011 if (netif_running(dev))
6012 nv_close(dev); 6012 nv_close(dev);
6013 6013
6014 nv_restore_mac_addr(pdev); 6014 /*
6015 * Restore the MAC so a kernel started by kexec won't get confused.
6016 * If we really go for poweroff, we must not restore the MAC,
6017 * otherwise the MAC for WOL will be reversed at least on some boards.
6018 */
6019 if (system_state != SYSTEM_POWER_OFF) {
6020 nv_restore_mac_addr(pdev);
6021 }
6015 6022
6016 pci_disable_device(pdev); 6023 pci_disable_device(pdev);
6024 /*
6025 * Apparently it is not possible to reinitialise from D3 hot,
6026 * only put the device into D3 if we really go for poweroff.
6027 */
6017 if (system_state == SYSTEM_POWER_OFF) { 6028 if (system_state == SYSTEM_POWER_OFF) {
6018 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled)) 6029 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled))
6019 pci_enable_wake(pdev, PCI_D3hot, np->wolenabled); 6030 pci_enable_wake(pdev, PCI_D3hot, np->wolenabled);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 9b12a13a640f..9831b3f408aa 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1284,7 +1284,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
1284 spin_lock_irqsave(&priv->txlock, flags); 1284 spin_lock_irqsave(&priv->txlock, flags);
1285 1285
1286 /* check if there is space to queue this packet */ 1286 /* check if there is space to queue this packet */
1287 if (nr_frags > priv->num_txbdfree) { 1287 if ((nr_frags+1) > priv->num_txbdfree) {
1288 /* no space, stop the queue */ 1288 /* no space, stop the queue */
1289 netif_stop_queue(dev); 1289 netif_stop_queue(dev);
1290 dev->stats.tx_fifo_errors++; 1290 dev->stats.tx_fifo_errors++;
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index 5e070f446635..0486cbe01adb 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -467,7 +467,7 @@ init_module(void)
467 if (this_dev != 0) break; /* only autoprobe 1st one */ 467 if (this_dev != 0) break; /* only autoprobe 1st one */
468 printk(KERN_NOTICE "hp-plus.c: Presently autoprobing (not recommended) for a single card.\n"); 468 printk(KERN_NOTICE "hp-plus.c: Presently autoprobing (not recommended) for a single card.\n");
469 } 469 }
470 dev = alloc_ei_netdev(); 470 dev = alloc_eip_netdev();
471 if (!dev) 471 if (!dev)
472 break; 472 break;
473 dev->irq = irq[this_dev]; 473 dev->irq = irq[this_dev];
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 08b34051c646..a6e1a35a13cb 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -957,13 +957,14 @@ jme_process_receive(struct jme_adapter *jme, int limit)
957 goto out_inc; 957 goto out_inc;
958 958
959 i = atomic_read(&rxring->next_to_clean); 959 i = atomic_read(&rxring->next_to_clean);
960 while (limit-- > 0) { 960 while (limit > 0) {
961 rxdesc = rxring->desc; 961 rxdesc = rxring->desc;
962 rxdesc += i; 962 rxdesc += i;
963 963
964 if ((rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) || 964 if ((rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) ||
965 !(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL)) 965 !(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL))
966 goto out; 966 goto out;
967 --limit;
967 968
968 desccnt = rxdesc->descwb.desccnt & RXWBDCNT_DCNT; 969 desccnt = rxdesc->descwb.desccnt & RXWBDCNT_DCNT;
969 970
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 5f31bbb614af..13f11f402a99 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1175,7 +1175,7 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1175{ 1175{
1176 struct mib_counters *p = &mp->mib_counters; 1176 struct mib_counters *p = &mp->mib_counters;
1177 1177
1178 spin_lock(&mp->mib_counters_lock); 1178 spin_lock_bh(&mp->mib_counters_lock);
1179 p->good_octets_received += mib_read(mp, 0x00); 1179 p->good_octets_received += mib_read(mp, 0x00);
1180 p->good_octets_received += (u64)mib_read(mp, 0x04) << 32; 1180 p->good_octets_received += (u64)mib_read(mp, 0x04) << 32;
1181 p->bad_octets_received += mib_read(mp, 0x08); 1181 p->bad_octets_received += mib_read(mp, 0x08);
@@ -1208,7 +1208,7 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1208 p->bad_crc_event += mib_read(mp, 0x74); 1208 p->bad_crc_event += mib_read(mp, 0x74);
1209 p->collision += mib_read(mp, 0x78); 1209 p->collision += mib_read(mp, 0x78);
1210 p->late_collision += mib_read(mp, 0x7c); 1210 p->late_collision += mib_read(mp, 0x7c);
1211 spin_unlock(&mp->mib_counters_lock); 1211 spin_unlock_bh(&mp->mib_counters_lock);
1212 1212
1213 mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ); 1213 mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ);
1214} 1214}
@@ -1575,7 +1575,7 @@ oom:
1575 return; 1575 return;
1576 } 1576 }
1577 1577
1578 mc_spec = kmalloc(0x200, GFP_KERNEL); 1578 mc_spec = kmalloc(0x200, GFP_ATOMIC);
1579 if (mc_spec == NULL) 1579 if (mc_spec == NULL)
1580 goto oom; 1580 goto oom;
1581 mc_other = mc_spec + (0x100 >> 2); 1581 mc_other = mc_spec + (0x100 >> 2);
@@ -2216,8 +2216,6 @@ static int mv643xx_eth_stop(struct net_device *dev)
2216 wrlp(mp, INT_MASK, 0x00000000); 2216 wrlp(mp, INT_MASK, 0x00000000);
2217 rdlp(mp, INT_MASK); 2217 rdlp(mp, INT_MASK);
2218 2218
2219 del_timer_sync(&mp->mib_counters_timer);
2220
2221 napi_disable(&mp->napi); 2219 napi_disable(&mp->napi);
2222 2220
2223 del_timer_sync(&mp->rx_oom); 2221 del_timer_sync(&mp->rx_oom);
@@ -2229,6 +2227,7 @@ static int mv643xx_eth_stop(struct net_device *dev)
2229 port_reset(mp); 2227 port_reset(mp);
2230 mv643xx_eth_get_stats(dev); 2228 mv643xx_eth_get_stats(dev);
2231 mib_counters_update(mp); 2229 mib_counters_update(mp);
2230 del_timer_sync(&mp->mib_counters_timer);
2232 2231
2233 skb_queue_purge(&mp->rx_recycle); 2232 skb_queue_purge(&mp->rx_recycle);
2234 2233
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 9f33e442f403..13087782ac40 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -588,7 +588,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
588 adapter->pci_mem_read = netxen_nic_pci_mem_read_2M; 588 adapter->pci_mem_read = netxen_nic_pci_mem_read_2M;
589 adapter->pci_mem_write = netxen_nic_pci_mem_write_2M; 589 adapter->pci_mem_write = netxen_nic_pci_mem_write_2M;
590 590
591 mem_ptr0 = ioremap(mem_base, mem_len); 591 mem_ptr0 = pci_ioremap_bar(pdev, 0);
592 if (mem_ptr0 == NULL) {
593 dev_err(&pdev->dev, "failed to map PCI bar 0\n");
594 return -EIO;
595 }
596
592 pci_len0 = mem_len; 597 pci_len0 = mem_len;
593 first_page_group_start = 0; 598 first_page_group_start = 0;
594 first_page_group_end = 0; 599 first_page_group_end = 0;
@@ -795,9 +800,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
795 * See if the firmware gave us a virtual-physical port mapping. 800 * See if the firmware gave us a virtual-physical port mapping.
796 */ 801 */
797 adapter->physical_port = adapter->portnum; 802 adapter->physical_port = adapter->portnum;
798 i = adapter->pci_read_normalize(adapter, CRB_V2P(adapter->portnum)); 803 if (adapter->fw_major < 4) {
799 if (i != 0x55555555) 804 i = adapter->pci_read_normalize(adapter,
800 adapter->physical_port = i; 805 CRB_V2P(adapter->portnum));
806 if (i != 0x55555555)
807 adapter->physical_port = i;
808 }
801 809
802 adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED); 810 adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED);
803 811
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index e5cb6b1f0ebd..2404a838b1fe 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -1035,7 +1035,8 @@ static int el3_rx(struct net_device *dev, int worklimit)
1035 DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", 1035 DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
1036 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); 1036 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
1037 while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && 1037 while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
1038 (--worklimit >= 0)) { 1038 worklimit > 0) {
1039 worklimit--;
1039 if (rx_status & 0x4000) { /* Error, update stats. */ 1040 if (rx_status & 0x4000) { /* Error, update stats. */
1040 short error = rx_status & 0x3800; 1041 short error = rx_status & 0x3800;
1041 dev->stats.rx_errors++; 1042 dev->stats.rx_errors++;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 73ecc657999d..1e01b8a6dbf3 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -857,7 +857,8 @@ static int el3_rx(struct net_device *dev)
857 DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", 857 DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
858 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); 858 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
859 while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && 859 while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
860 (--worklimit >= 0)) { 860 worklimit > 0) {
861 worklimit--;
861 if (rx_status & 0x4000) { /* Error, update stats. */ 862 if (rx_status & 0x4000) { /* Error, update stats. */
862 short error = rx_status & 0x3800; 863 short error = rx_status & 0x3800;
863 dev->stats.rx_errors++; 864 dev->stats.rx_errors++;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 0771eb6fc6eb..b3473401c83a 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -81,9 +81,9 @@ static const int multicast_filter_limit = 32;
81#define RTL8169_TX_TIMEOUT (6*HZ) 81#define RTL8169_TX_TIMEOUT (6*HZ)
82#define RTL8169_PHY_TIMEOUT (10*HZ) 82#define RTL8169_PHY_TIMEOUT (10*HZ)
83 83
84#define RTL_EEPROM_SIG cpu_to_le32(0x8129) 84#define RTL_EEPROM_SIG 0x8129
85#define RTL_EEPROM_SIG_MASK cpu_to_le32(0xffff)
86#define RTL_EEPROM_SIG_ADDR 0x0000 85#define RTL_EEPROM_SIG_ADDR 0x0000
86#define RTL_EEPROM_MAC_ADDR 0x0007
87 87
88/* write/read MMIO register */ 88/* write/read MMIO register */
89#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) 89#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
@@ -293,6 +293,11 @@ enum rtl_register_content {
293 /* Cfg9346Bits */ 293 /* Cfg9346Bits */
294 Cfg9346_Lock = 0x00, 294 Cfg9346_Lock = 0x00,
295 Cfg9346_Unlock = 0xc0, 295 Cfg9346_Unlock = 0xc0,
296 Cfg9346_Program = 0x80, /* Programming mode */
297 Cfg9346_EECS = 0x08, /* Chip select */
298 Cfg9346_EESK = 0x04, /* Serial data clock */
299 Cfg9346_EEDI = 0x02, /* Data input */
300 Cfg9346_EEDO = 0x01, /* Data output */
296 301
297 /* rx_mode_bits */ 302 /* rx_mode_bits */
298 AcceptErr = 0x20, 303 AcceptErr = 0x20,
@@ -305,6 +310,7 @@ enum rtl_register_content {
305 /* RxConfigBits */ 310 /* RxConfigBits */
306 RxCfgFIFOShift = 13, 311 RxCfgFIFOShift = 13,
307 RxCfgDMAShift = 8, 312 RxCfgDMAShift = 8,
313 RxCfg9356SEL = 6, /* EEPROM type: 0 = 9346, 1 = 9356 */
308 314
309 /* TxConfigBits */ 315 /* TxConfigBits */
310 TxInterFrameGapShift = 24, 316 TxInterFrameGapShift = 24,
@@ -1963,6 +1969,108 @@ static const struct net_device_ops rtl8169_netdev_ops = {
1963 1969
1964}; 1970};
1965 1971
1972/* Delay between EEPROM clock transitions. Force out buffered PCI writes. */
1973#define RTL_EEPROM_DELAY() RTL_R8(Cfg9346)
1974#define RTL_EEPROM_READ_CMD 6
1975
1976/* read 16bit word stored in EEPROM. EEPROM is addressed by words. */
1977static u16 rtl_eeprom_read(void __iomem *ioaddr, int addr)
1978{
1979 u16 result = 0;
1980 int cmd, cmd_len, i;
1981
1982 /* check for EEPROM address size (in bits) */
1983 if (RTL_R32(RxConfig) & (1 << RxCfg9356SEL)) {
1984 /* EEPROM is 93C56 */
1985 cmd_len = 3 + 8; /* 3 bits for command id and 8 for address */
1986 cmd = (RTL_EEPROM_READ_CMD << 8) | (addr & 0xff);
1987 } else {
1988 /* EEPROM is 93C46 */
1989 cmd_len = 3 + 6; /* 3 bits for command id and 6 for address */
1990 cmd = (RTL_EEPROM_READ_CMD << 6) | (addr & 0x3f);
1991 }
1992
1993 /* enter programming mode */
1994 RTL_W8(Cfg9346, Cfg9346_Program | Cfg9346_EECS);
1995 RTL_EEPROM_DELAY();
1996
1997 /* write command and requested address */
1998 while (cmd_len--) {
1999 u8 x = Cfg9346_Program | Cfg9346_EECS;
2000
2001 x |= (cmd & (1 << cmd_len)) ? Cfg9346_EEDI : 0;
2002
2003 /* write a bit */
2004 RTL_W8(Cfg9346, x);
2005 RTL_EEPROM_DELAY();
2006
2007 /* raise clock */
2008 RTL_W8(Cfg9346, x | Cfg9346_EESK);
2009 RTL_EEPROM_DELAY();
2010 }
2011
2012 /* lower clock */
2013 RTL_W8(Cfg9346, Cfg9346_Program | Cfg9346_EECS);
2014 RTL_EEPROM_DELAY();
2015
2016 /* read back 16bit value */
2017 for (i = 16; i > 0; i--) {
2018 /* raise clock */
2019 RTL_W8(Cfg9346, Cfg9346_Program | Cfg9346_EECS | Cfg9346_EESK);
2020 RTL_EEPROM_DELAY();
2021
2022 result <<= 1;
2023 result |= (RTL_R8(Cfg9346) & Cfg9346_EEDO) ? 1 : 0;
2024
2025 /* lower clock */
2026 RTL_W8(Cfg9346, Cfg9346_Program | Cfg9346_EECS);
2027 RTL_EEPROM_DELAY();
2028 }
2029
2030 RTL_W8(Cfg9346, Cfg9346_Program);
2031 /* leave programming mode */
2032 RTL_W8(Cfg9346, Cfg9346_Lock);
2033
2034 return result;
2035}
2036
2037static void rtl_init_mac_address(struct rtl8169_private *tp,
2038 void __iomem *ioaddr)
2039{
2040 struct pci_dev *pdev = tp->pci_dev;
2041 u16 x;
2042 u8 mac[8];
2043
2044 /* read EEPROM signature */
2045 x = rtl_eeprom_read(ioaddr, RTL_EEPROM_SIG_ADDR);
2046
2047 if (x != RTL_EEPROM_SIG) {
2048 dev_info(&pdev->dev, "Missing EEPROM signature: %04x\n", x);
2049 return;
2050 }
2051
2052 /* read MAC address */
2053 x = rtl_eeprom_read(ioaddr, RTL_EEPROM_MAC_ADDR);
2054 mac[0] = x & 0xff;
2055 mac[1] = x >> 8;
2056 x = rtl_eeprom_read(ioaddr, RTL_EEPROM_MAC_ADDR + 1);
2057 mac[2] = x & 0xff;
2058 mac[3] = x >> 8;
2059 x = rtl_eeprom_read(ioaddr, RTL_EEPROM_MAC_ADDR + 2);
2060 mac[4] = x & 0xff;
2061 mac[5] = x >> 8;
2062
2063 if (netif_msg_probe(tp)) {
2064 DECLARE_MAC_BUF(buf);
2065
2066 dev_info(&pdev->dev, "MAC address found in EEPROM: %s\n",
2067 print_mac(buf, mac));
2068 }
2069
2070 if (is_valid_ether_addr(mac))
2071 rtl_rar_set(tp, mac);
2072}
2073
1966static int __devinit 2074static int __devinit
1967rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2075rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1968{ 2076{
@@ -2141,6 +2249,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2141 2249
2142 tp->mmio_addr = ioaddr; 2250 tp->mmio_addr = ioaddr;
2143 2251
2252 rtl_init_mac_address(tp, ioaddr);
2253
2144 /* Get MAC address */ 2254 /* Get MAC address */
2145 for (i = 0; i < MAC_ADDR_LEN; i++) 2255 for (i = 0; i < MAC_ADDR_LEN; i++)
2146 dev->dev_addr[i] = RTL_R8(MAC0 + i); 2256 dev->dev_addr[i] = RTL_R8(MAC0 + i);
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 870b4c33f108..a45952e72018 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -42,6 +42,16 @@
42 #define SMC_USE_16BIT 0 42 #define SMC_USE_16BIT 0
43 #define SMC_USE_32BIT 1 43 #define SMC_USE_32BIT 1
44 #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW 44 #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW
45#elif defined(CONFIG_ARCH_OMAP34XX)
46 #define SMC_USE_16BIT 0
47 #define SMC_USE_32BIT 1
48 #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW
49 #define SMC_MEM_RESERVED 1
50#elif defined(CONFIG_ARCH_OMAP24XX)
51 #define SMC_USE_16BIT 0
52 #define SMC_USE_32BIT 1
53 #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW
54 #define SMC_MEM_RESERVED 1
45#else 55#else
46/* 56/*
47 * Default configuration 57 * Default configuration
@@ -675,6 +685,7 @@ smc_pxa_dma_outsl(struct smc911x_local *lp, u_long physaddr,
675#define CHIP_9116 0x0116 685#define CHIP_9116 0x0116
676#define CHIP_9117 0x0117 686#define CHIP_9117 0x0117
677#define CHIP_9118 0x0118 687#define CHIP_9118 0x0118
688#define CHIP_9211 0x9211
678#define CHIP_9215 0x115A 689#define CHIP_9215 0x115A
679#define CHIP_9217 0x117A 690#define CHIP_9217 0x117A
680#define CHIP_9218 0x118A 691#define CHIP_9218 0x118A
@@ -689,6 +700,7 @@ static const struct chip_id chip_ids[] = {
689 { CHIP_9116, "LAN9116" }, 700 { CHIP_9116, "LAN9116" },
690 { CHIP_9117, "LAN9117" }, 701 { CHIP_9117, "LAN9117" },
691 { CHIP_9118, "LAN9118" }, 702 { CHIP_9118, "LAN9118" },
703 { CHIP_9211, "LAN9211" },
692 { CHIP_9215, "LAN9215" }, 704 { CHIP_9215, "LAN9215" },
693 { CHIP_9217, "LAN9217" }, 705 { CHIP_9217, "LAN9217" },
694 { CHIP_9218, "LAN9218" }, 706 { CHIP_9218, "LAN9218" },
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 783c1a7b869e..9a78daec2fe9 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -1624,7 +1624,7 @@ static int smsc911x_eeprom_send_cmd(struct smsc911x_data *pdata, u32 op)
1624 do { 1624 do {
1625 msleep(1); 1625 msleep(1);
1626 e2cmd = smsc911x_reg_read(pdata, E2P_CMD); 1626 e2cmd = smsc911x_reg_read(pdata, E2P_CMD);
1627 } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (timeout--)); 1627 } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (--timeout));
1628 1628
1629 if (!timeout) { 1629 if (!timeout) {
1630 SMSC_TRACE(DRV, "TIMED OUT"); 1630 SMSC_TRACE(DRV, "TIMED OUT");
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index a1e4b3895b33..4e15ae068b3f 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -341,7 +341,7 @@ static int smsc9420_eeprom_send_cmd(struct smsc9420_pdata *pd, u32 op)
341 do { 341 do {
342 msleep(1); 342 msleep(1);
343 e2cmd = smsc9420_reg_read(pd, E2P_CMD); 343 e2cmd = smsc9420_reg_read(pd, E2P_CMD);
344 } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (timeout--)); 344 } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (--timeout));
345 345
346 if (!timeout) { 346 if (!timeout) {
347 smsc_info(HW, "TIMED OUT"); 347 smsc_info(HW, "TIMED OUT");
@@ -413,6 +413,7 @@ static int smsc9420_ethtool_get_eeprom(struct net_device *dev,
413 } 413 }
414 414
415 memcpy(data, &eeprom_data[eeprom->offset], len); 415 memcpy(data, &eeprom_data[eeprom->offset], len);
416 eeprom->magic = SMSC9420_EEPROM_MAGIC;
416 eeprom->len = len; 417 eeprom->len = len;
417 return 0; 418 return 0;
418} 419}
@@ -423,6 +424,9 @@ static int smsc9420_ethtool_set_eeprom(struct net_device *dev,
423 struct smsc9420_pdata *pd = netdev_priv(dev); 424 struct smsc9420_pdata *pd = netdev_priv(dev);
424 int ret; 425 int ret;
425 426
427 if (eeprom->magic != SMSC9420_EEPROM_MAGIC)
428 return -EINVAL;
429
426 smsc9420_eeprom_enable_access(pd); 430 smsc9420_eeprom_enable_access(pd);
427 smsc9420_eeprom_send_cmd(pd, E2P_CMD_EPC_CMD_EWEN_); 431 smsc9420_eeprom_send_cmd(pd, E2P_CMD_EPC_CMD_EWEN_);
428 ret = smsc9420_eeprom_write_location(pd, eeprom->offset, *data); 432 ret = smsc9420_eeprom_write_location(pd, eeprom->offset, *data);
diff --git a/drivers/net/smsc9420.h b/drivers/net/smsc9420.h
index 69c351f93f86..e441402f77a2 100644
--- a/drivers/net/smsc9420.h
+++ b/drivers/net/smsc9420.h
@@ -44,6 +44,7 @@
44#define LAN_REGISTER_EXTENT (0x400) 44#define LAN_REGISTER_EXTENT (0x400)
45 45
46#define SMSC9420_EEPROM_SIZE ((u32)11) 46#define SMSC9420_EEPROM_SIZE ((u32)11)
47#define SMSC9420_EEPROM_MAGIC (0x9420)
47 48
48#define PKT_BUF_SZ (VLAN_ETH_FRAME_LEN + NET_IP_ALIGN + 4) 49#define PKT_BUF_SZ (VLAN_ETH_FRAME_LEN + NET_IP_ALIGN + 4)
49 50
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index feaf0e0577d7..43695b76606f 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -909,7 +909,7 @@ static void check_duplex(struct net_device *dev)
909 printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d " 909 printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d "
910 "negotiated capability %4.4x.\n", dev->name, 910 "negotiated capability %4.4x.\n", dev->name,
911 duplex ? "full" : "half", np->phys[0], negotiated); 911 duplex ? "full" : "half", np->phys[0], negotiated);
912 iowrite16(ioread16(ioaddr + MACCtrl0) | duplex ? 0x20 : 0, ioaddr + MACCtrl0); 912 iowrite16(ioread16(ioaddr + MACCtrl0) | (duplex ? 0x20 : 0), ioaddr + MACCtrl0);
913 } 913 }
914} 914}
915 915
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 491876341068..0fcb7503363d 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1157,7 +1157,7 @@ static void gem_pcs_reset(struct gem *gp)
1157 if (limit-- <= 0) 1157 if (limit-- <= 0)
1158 break; 1158 break;
1159 } 1159 }
1160 if (limit <= 0) 1160 if (limit < 0)
1161 printk(KERN_WARNING "%s: PCS reset bit would not clear.\n", 1161 printk(KERN_WARNING "%s: PCS reset bit would not clear.\n",
1162 gp->dev->name); 1162 gp->dev->name);
1163} 1163}
@@ -1229,7 +1229,7 @@ static void gem_reset(struct gem *gp)
1229 break; 1229 break;
1230 } while (val & (GREG_SWRST_TXRST | GREG_SWRST_RXRST)); 1230 } while (val & (GREG_SWRST_TXRST | GREG_SWRST_RXRST));
1231 1231
1232 if (limit <= 0) 1232 if (limit < 0)
1233 printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name); 1233 printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name);
1234 1234
1235 if (gp->phy_type == phy_serialink || gp->phy_type == phy_serdes) 1235 if (gp->phy_type == phy_serialink || gp->phy_type == phy_serdes)
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index d4fb4acdbebd..4e9bd380a5c2 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2649,8 +2649,6 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
2649 int err = -ENODEV; 2649 int err = -ENODEV;
2650 2650
2651 sbus_dp = to_of_device(op->dev.parent)->node; 2651 sbus_dp = to_of_device(op->dev.parent)->node;
2652 if (is_qfe)
2653 sbus_dp = to_of_device(op->dev.parent->parent)->node;
2654 2652
2655 /* We can match PCI devices too, do not accept those here. */ 2653 /* We can match PCI devices too, do not accept those here. */
2656 if (strcmp(sbus_dp->name, "sbus")) 2654 if (strcmp(sbus_dp->name, "sbus"))
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 281373281756..16c528db7251 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -343,7 +343,7 @@ static void lance_init_ring_dvma(struct net_device *dev)
343 ib->phys_addr [5] = dev->dev_addr [4]; 343 ib->phys_addr [5] = dev->dev_addr [4];
344 344
345 /* Setup the Tx ring entries */ 345 /* Setup the Tx ring entries */
346 for (i = 0; i <= TX_RING_SIZE; i++) { 346 for (i = 0; i < TX_RING_SIZE; i++) {
347 leptr = LANCE_ADDR(aib + libbuff_offset(tx_buf, i)); 347 leptr = LANCE_ADDR(aib + libbuff_offset(tx_buf, i));
348 ib->btx_ring [i].tmd0 = leptr; 348 ib->btx_ring [i].tmd0 = leptr;
349 ib->btx_ring [i].tmd1_hadr = leptr >> 16; 349 ib->btx_ring [i].tmd1_hadr = leptr >> 16;
@@ -399,7 +399,7 @@ static void lance_init_ring_pio(struct net_device *dev)
399 sbus_writeb(dev->dev_addr[4], &ib->phys_addr[5]); 399 sbus_writeb(dev->dev_addr[4], &ib->phys_addr[5]);
400 400
401 /* Setup the Tx ring entries */ 401 /* Setup the Tx ring entries */
402 for (i = 0; i <= TX_RING_SIZE; i++) { 402 for (i = 0; i < TX_RING_SIZE; i++) {
403 leptr = libbuff_offset(tx_buf, i); 403 leptr = libbuff_offset(tx_buf, i);
404 sbus_writew(leptr, &ib->btx_ring [i].tmd0); 404 sbus_writew(leptr, &ib->btx_ring [i].tmd0);
405 sbus_writeb(leptr >> 16,&ib->btx_ring [i].tmd1_hadr); 405 sbus_writeb(leptr >> 16,&ib->btx_ring [i].tmd1_hadr);
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4595962fb8e1..dabdf59f8016 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1473,7 +1473,8 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable)
1473{ 1473{
1474 u32 reg; 1474 u32 reg;
1475 1475
1476 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 1476 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ||
1477 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
1477 return; 1478 return;
1478 1479
1479 reg = MII_TG3_MISC_SHDW_WREN | 1480 reg = MII_TG3_MISC_SHDW_WREN |
@@ -2237,8 +2238,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2237 phyid = phydev->drv->phy_id & phydev->drv->phy_id_mask; 2238 phyid = phydev->drv->phy_id & phydev->drv->phy_id_mask;
2238 if (phyid != TG3_PHY_ID_BCMAC131) { 2239 if (phyid != TG3_PHY_ID_BCMAC131) {
2239 phyid &= TG3_PHY_OUI_MASK; 2240 phyid &= TG3_PHY_OUI_MASK;
2240 if (phyid == TG3_PHY_OUI_1 && 2241 if (phyid == TG3_PHY_OUI_1 ||
2241 phyid == TG3_PHY_OUI_2 && 2242 phyid == TG3_PHY_OUI_2 ||
2242 phyid == TG3_PHY_OUI_3) 2243 phyid == TG3_PHY_OUI_3)
2243 do_low_power = true; 2244 do_low_power = true;
2244 } 2245 }
diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c
index 5f601773c260..e2150b3c83d9 100644
--- a/drivers/net/tokenring/tmspci.c
+++ b/drivers/net/tokenring/tmspci.c
@@ -121,11 +121,6 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
121 goto err_out_trdev; 121 goto err_out_trdev;
122 } 122 }
123 123
124 ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
125 dev->name, dev);
126 if (ret)
127 goto err_out_region;
128
129 dev->base_addr = pci_ioaddr; 124 dev->base_addr = pci_ioaddr;
130 dev->irq = pci_irq_line; 125 dev->irq = pci_irq_line;
131 dev->dma = 0; 126 dev->dma = 0;
@@ -142,7 +137,7 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
142 ret = tmsdev_init(dev, &pdev->dev); 137 ret = tmsdev_init(dev, &pdev->dev);
143 if (ret) { 138 if (ret) {
144 printk("%s: unable to get memory for dev->priv.\n", dev->name); 139 printk("%s: unable to get memory for dev->priv.\n", dev->name);
145 goto err_out_irq; 140 goto err_out_region;
146 } 141 }
147 142
148 tp = netdev_priv(dev); 143 tp = netdev_priv(dev);
@@ -157,6 +152,11 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
157 152
158 tp->tmspriv = cardinfo; 153 tp->tmspriv = cardinfo;
159 154
155 ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
156 dev->name, dev);
157 if (ret)
158 goto err_out_tmsdev;
159
160 dev->open = tms380tr_open; 160 dev->open = tms380tr_open;
161 dev->stop = tms380tr_close; 161 dev->stop = tms380tr_close;
162 pci_set_drvdata(pdev, dev); 162 pci_set_drvdata(pdev, dev);
@@ -164,15 +164,15 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
164 164
165 ret = register_netdev(dev); 165 ret = register_netdev(dev);
166 if (ret) 166 if (ret)
167 goto err_out_tmsdev; 167 goto err_out_irq;
168 168
169 return 0; 169 return 0;
170 170
171err_out_irq:
172 free_irq(pdev->irq, dev);
171err_out_tmsdev: 173err_out_tmsdev:
172 pci_set_drvdata(pdev, NULL); 174 pci_set_drvdata(pdev, NULL);
173 tmsdev_term(dev); 175 tmsdev_term(dev);
174err_out_irq:
175 free_irq(pdev->irq, dev);
176err_out_region: 176err_out_region:
177 release_region(pci_ioaddr, TMS_PCI_IO_EXTENT); 177 release_region(pci_ioaddr, TMS_PCI_IO_EXTENT);
178err_out_trdev: 178err_out_trdev:
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 54635911305c..0ada4edd56eb 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -107,7 +107,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
107static int uec_mdio_reset(struct mii_bus *bus) 107static int uec_mdio_reset(struct mii_bus *bus)
108{ 108{
109 struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv; 109 struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
110 unsigned int timeout = PHY_INIT_TIMEOUT; 110 int timeout = PHY_INIT_TIMEOUT;
111 111
112 mutex_lock(&bus->mdio_lock); 112 mutex_lock(&bus->mdio_lock);
113 113
@@ -123,7 +123,7 @@ static int uec_mdio_reset(struct mii_bus *bus)
123 123
124 mutex_unlock(&bus->mdio_lock); 124 mutex_unlock(&bus->mdio_lock);
125 125
126 if (timeout <= 0) { 126 if (timeout < 0) {
127 printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name); 127 printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name);
128 return -EBUSY; 128 return -EBUSY;
129 } 129 }
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index e009481c606c..396f821b5ff0 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1451,6 +1451,14 @@ static const struct usb_device_id products [] = {
1451 // Cables-to-Go USB Ethernet Adapter 1451 // Cables-to-Go USB Ethernet Adapter
1452 USB_DEVICE(0x0b95, 0x772a), 1452 USB_DEVICE(0x0b95, 0x772a),
1453 .driver_info = (unsigned long) &ax88772_info, 1453 .driver_info = (unsigned long) &ax88772_info,
1454}, {
1455 // ABOCOM for pci
1456 USB_DEVICE(0x14ea, 0xab11),
1457 .driver_info = (unsigned long) &ax88178_info,
1458}, {
1459 // ASIX 88772a
1460 USB_DEVICE(0x0db0, 0xa877),
1461 .driver_info = (unsigned long) &ax88772_info,
1454}, 1462},
1455 { }, // END 1463 { }, // END
1456}; 1464};
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 0e061dfea78d..55e8ecc3a9e5 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -559,6 +559,11 @@ static const struct usb_device_id products [] = {
559 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, 559 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
560 USB_CDC_PROTO_NONE), 560 USB_CDC_PROTO_NONE),
561 .driver_info = (unsigned long) &cdc_info, 561 .driver_info = (unsigned long) &cdc_info,
562}, {
563 /* Ericsson F3507g */
564 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
565 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
566 .driver_info = (unsigned long) &cdc_info,
562}, 567},
563 { }, // END 568 { }, // END
564}; 569};
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 5b67bbf1987e..81682c6defa0 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -635,6 +635,10 @@ static const struct usb_device_id products[] = {
635 USB_DEVICE(0x0a47, 0x9601), /* Hirose USB-100 */ 635 USB_DEVICE(0x0a47, 0x9601), /* Hirose USB-100 */
636 .driver_info = (unsigned long)&dm9601_info, 636 .driver_info = (unsigned long)&dm9601_info,
637 }, 637 },
638 {
639 USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */
640 .driver_info = (unsigned long)&dm9601_info,
641 },
638 {}, // END 642 {}, // END
639}; 643};
640 644
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index aa3149078888..c32284ff3f54 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -723,8 +723,8 @@ u32 usbnet_get_link (struct net_device *net)
723 if (dev->mii.mdio_read) 723 if (dev->mii.mdio_read)
724 return mii_link_ok(&dev->mii); 724 return mii_link_ok(&dev->mii);
725 725
726 /* Otherwise, say we're up (to avoid breaking scripts) */ 726 /* Otherwise, dtrt for drivers calling netif_carrier_{on,off} */
727 return 1; 727 return ethtool_op_get_link(net);
728} 728}
729EXPORT_SYMBOL_GPL(usbnet_get_link); 729EXPORT_SYMBOL_GPL(usbnet_get_link);
730 730
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index e24f7b3ace4b..04882c8f9bf1 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -341,6 +341,11 @@ static const struct usb_device_id products [] = {
341 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM, 341 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
342 USB_CDC_PROTO_NONE), 342 USB_CDC_PROTO_NONE),
343 .driver_info = (unsigned long) &bogus_mdlm_info, 343 .driver_info = (unsigned long) &bogus_mdlm_info,
344}, {
345 /* Motorola MOTOMAGX phones */
346 USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM,
347 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
348 .driver_info = (unsigned long) &bogus_mdlm_info,
344}, 349},
345 350
346/* Olympus has some models with a Zaurus-compatible option. 351/* Olympus has some models with a Zaurus-compatible option.
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 852d0e7c4e62..124fe75b8a8a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -239,6 +239,16 @@ static int veth_open(struct net_device *dev)
239 return 0; 239 return 0;
240} 240}
241 241
242static int veth_close(struct net_device *dev)
243{
244 struct veth_priv *priv = netdev_priv(dev);
245
246 netif_carrier_off(dev);
247 netif_carrier_off(priv->peer);
248
249 return 0;
250}
251
242static int veth_dev_init(struct net_device *dev) 252static int veth_dev_init(struct net_device *dev)
243{ 253{
244 struct veth_net_stats *stats; 254 struct veth_net_stats *stats;
@@ -263,10 +273,12 @@ static void veth_dev_free(struct net_device *dev)
263} 273}
264 274
265static const struct net_device_ops veth_netdev_ops = { 275static const struct net_device_ops veth_netdev_ops = {
266 .ndo_init = veth_dev_init, 276 .ndo_init = veth_dev_init,
267 .ndo_open = veth_open, 277 .ndo_open = veth_open,
268 .ndo_start_xmit = veth_xmit, 278 .ndo_stop = veth_close,
269 .ndo_get_stats = veth_get_stats, 279 .ndo_start_xmit = veth_xmit,
280 .ndo_get_stats = veth_get_stats,
281 .ndo_set_mac_address = eth_mac_addr,
270}; 282};
271 283
272static void veth_setup(struct net_device *dev) 284static void veth_setup(struct net_device *dev)
@@ -279,44 +291,6 @@ static void veth_setup(struct net_device *dev)
279 dev->destructor = veth_dev_free; 291 dev->destructor = veth_dev_free;
280} 292}
281 293
282static void veth_change_state(struct net_device *dev)
283{
284 struct net_device *peer;
285 struct veth_priv *priv;
286
287 priv = netdev_priv(dev);
288 peer = priv->peer;
289
290 if (netif_carrier_ok(peer)) {
291 if (!netif_carrier_ok(dev))
292 netif_carrier_on(dev);
293 } else {
294 if (netif_carrier_ok(dev))
295 netif_carrier_off(dev);
296 }
297}
298
299static int veth_device_event(struct notifier_block *unused,
300 unsigned long event, void *ptr)
301{
302 struct net_device *dev = ptr;
303
304 if (dev->netdev_ops->ndo_open != veth_open)
305 goto out;
306
307 switch (event) {
308 case NETDEV_CHANGE:
309 veth_change_state(dev);
310 break;
311 }
312out:
313 return NOTIFY_DONE;
314}
315
316static struct notifier_block veth_notifier_block __read_mostly = {
317 .notifier_call = veth_device_event,
318};
319
320/* 294/*
321 * netlink interface 295 * netlink interface
322 */ 296 */
@@ -467,14 +441,12 @@ static struct rtnl_link_ops veth_link_ops = {
467 441
468static __init int veth_init(void) 442static __init int veth_init(void)
469{ 443{
470 register_netdevice_notifier(&veth_notifier_block);
471 return rtnl_link_register(&veth_link_ops); 444 return rtnl_link_register(&veth_link_ops);
472} 445}
473 446
474static __exit void veth_exit(void) 447static __exit void veth_exit(void)
475{ 448{
476 rtnl_link_unregister(&veth_link_ops); 449 rtnl_link_unregister(&veth_link_ops);
477 unregister_netdevice_notifier(&veth_notifier_block);
478} 450}
479 451
480module_init(veth_init); 452module_init(veth_init);
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h
index 067c871cc226..3b9d27ea2950 100644
--- a/drivers/net/wimax/i2400m/i2400m.h
+++ b/drivers/net/wimax/i2400m/i2400m.h
@@ -157,7 +157,7 @@ enum {
157 157
158 158
159/* Firmware version we request when pulling the fw image file */ 159/* Firmware version we request when pulling the fw image file */
160#define I2400M_FW_VERSION "1.3" 160#define I2400M_FW_VERSION "1.4"
161 161
162 162
163/** 163/**
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 727f067aca4f..0e80990d8e84 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -1538,6 +1538,7 @@ bad2:
1538bad: 1538bad:
1539 if (ah) 1539 if (ah)
1540 ath9k_hw_detach(ah); 1540 ath9k_hw_detach(ah);
1541 ath9k_exit_debug(sc);
1541 1542
1542 return error; 1543 return error;
1543} 1544}
@@ -1545,7 +1546,7 @@ bad:
1545static int ath_attach(u16 devid, struct ath_softc *sc) 1546static int ath_attach(u16 devid, struct ath_softc *sc)
1546{ 1547{
1547 struct ieee80211_hw *hw = sc->hw; 1548 struct ieee80211_hw *hw = sc->hw;
1548 int error = 0; 1549 int error = 0, i;
1549 1550
1550 DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n"); 1551 DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n");
1551 1552
@@ -1589,11 +1590,11 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
1589 /* initialize tx/rx engine */ 1590 /* initialize tx/rx engine */
1590 error = ath_tx_init(sc, ATH_TXBUF); 1591 error = ath_tx_init(sc, ATH_TXBUF);
1591 if (error != 0) 1592 if (error != 0)
1592 goto detach; 1593 goto error_attach;
1593 1594
1594 error = ath_rx_init(sc, ATH_RXBUF); 1595 error = ath_rx_init(sc, ATH_RXBUF);
1595 if (error != 0) 1596 if (error != 0)
1596 goto detach; 1597 goto error_attach;
1597 1598
1598#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) 1599#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1599 /* Initialze h/w Rfkill */ 1600 /* Initialze h/w Rfkill */
@@ -1601,8 +1602,9 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
1601 INIT_DELAYED_WORK(&sc->rf_kill.rfkill_poll, ath_rfkill_poll); 1602 INIT_DELAYED_WORK(&sc->rf_kill.rfkill_poll, ath_rfkill_poll);
1602 1603
1603 /* Initialize s/w rfkill */ 1604 /* Initialize s/w rfkill */
1604 if (ath_init_sw_rfkill(sc)) 1605 error = ath_init_sw_rfkill(sc);
1605 goto detach; 1606 if (error)
1607 goto error_attach;
1606#endif 1608#endif
1607 1609
1608 error = ieee80211_register_hw(hw); 1610 error = ieee80211_register_hw(hw);
@@ -1611,8 +1613,16 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
1611 ath_init_leds(sc); 1613 ath_init_leds(sc);
1612 1614
1613 return 0; 1615 return 0;
1614detach: 1616
1615 ath_detach(sc); 1617error_attach:
1618 /* cleanup tx queues */
1619 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
1620 if (ATH_TXQ_SETUP(sc, i))
1621 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
1622
1623 ath9k_hw_detach(sc->sc_ah);
1624 ath9k_exit_debug(sc);
1625
1616 return error; 1626 return error;
1617} 1627}
1618 1628
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 36bafeb353ce..129e2d330abb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3868,7 +3868,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3868 } 3868 }
3869 err = iwl_eeprom_check_version(priv); 3869 err = iwl_eeprom_check_version(priv);
3870 if (err) 3870 if (err)
3871 goto out_iounmap; 3871 goto out_free_eeprom;
3872 3872
3873 /* extract MAC Address */ 3873 /* extract MAC Address */
3874 iwl_eeprom_get_mac(priv, priv->mac_addr); 3874 iwl_eeprom_get_mac(priv, priv->mac_addr);
@@ -3945,6 +3945,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3945 return 0; 3945 return 0;
3946 3946
3947 out_remove_sysfs: 3947 out_remove_sysfs:
3948 destroy_workqueue(priv->workqueue);
3949 priv->workqueue = NULL;
3948 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 3950 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
3949 out_uninit_drv: 3951 out_uninit_drv:
3950 iwl_uninit_drv(priv); 3952 iwl_uninit_drv(priv);
@@ -3953,8 +3955,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3953 out_iounmap: 3955 out_iounmap:
3954 pci_iounmap(pdev, priv->hw_base); 3956 pci_iounmap(pdev, priv->hw_base);
3955 out_pci_release_regions: 3957 out_pci_release_regions:
3956 pci_release_regions(pdev);
3957 pci_set_drvdata(pdev, NULL); 3958 pci_set_drvdata(pdev, NULL);
3959 pci_release_regions(pdev);
3958 out_pci_disable_device: 3960 out_pci_disable_device:
3959 pci_disable_device(pdev); 3961 pci_disable_device(pdev);
3960 out_ieee80211_free_hw: 3962 out_ieee80211_free_hw:
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index b0ee86c62685..ab13ff22a8c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -148,7 +148,7 @@ static void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
148 pci_unmap_single(dev, 148 pci_unmap_single(dev,
149 pci_unmap_addr(&txq->cmd[index]->meta, mapping), 149 pci_unmap_addr(&txq->cmd[index]->meta, mapping),
150 pci_unmap_len(&txq->cmd[index]->meta, len), 150 pci_unmap_len(&txq->cmd[index]->meta, len),
151 PCI_DMA_TODEVICE); 151 PCI_DMA_BIDIRECTIONAL);
152 152
153 /* Unmap chunks, if any. */ 153 /* Unmap chunks, if any. */
154 for (i = 1; i < num_tbs; i++) { 154 for (i = 1; i < num_tbs; i++) {
@@ -964,7 +964,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
964 * within command buffer array. */ 964 * within command buffer array. */
965 txcmd_phys = pci_map_single(priv->pci_dev, 965 txcmd_phys = pci_map_single(priv->pci_dev,
966 out_cmd, sizeof(struct iwl_cmd), 966 out_cmd, sizeof(struct iwl_cmd),
967 PCI_DMA_TODEVICE); 967 PCI_DMA_BIDIRECTIONAL);
968 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); 968 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
969 pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); 969 pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd));
970 /* Add buffer containing Tx command and MAC(!) header to TFD's 970 /* Add buffer containing Tx command and MAC(!) header to TFD's
@@ -1115,7 +1115,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1115 IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); 1115 IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
1116 1116
1117 phys_addr = pci_map_single(priv->pci_dev, out_cmd, 1117 phys_addr = pci_map_single(priv->pci_dev, out_cmd,
1118 len, PCI_DMA_TODEVICE); 1118 len, PCI_DMA_BIDIRECTIONAL);
1119 pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr); 1119 pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
1120 pci_unmap_len_set(&out_cmd->meta, len, len); 1120 pci_unmap_len_set(&out_cmd->meta, len, len);
1121 phys_addr += offsetof(struct iwl_cmd, hdr); 1121 phys_addr += offsetof(struct iwl_cmd, hdr);
@@ -1212,7 +1212,7 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id,
1212 pci_unmap_single(priv->pci_dev, 1212 pci_unmap_single(priv->pci_dev,
1213 pci_unmap_addr(&txq->cmd[cmd_idx]->meta, mapping), 1213 pci_unmap_addr(&txq->cmd[cmd_idx]->meta, mapping),
1214 pci_unmap_len(&txq->cmd[cmd_idx]->meta, len), 1214 pci_unmap_len(&txq->cmd[cmd_idx]->meta, len),
1215 PCI_DMA_TODEVICE); 1215 PCI_DMA_BIDIRECTIONAL);
1216 1216
1217 for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; 1217 for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx;
1218 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1218 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 93be74a1f139..57dd34e256d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -7911,7 +7911,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7911 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 7911 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
7912 if (err < 0) { 7912 if (err < 0) {
7913 IWL_DEBUG_INFO("Failed to init the card\n"); 7913 IWL_DEBUG_INFO("Failed to init the card\n");
7914 goto out_remove_sysfs; 7914 goto out_iounmap;
7915 } 7915 }
7916 7916
7917 /*********************** 7917 /***********************
@@ -7921,7 +7921,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7921 err = iwl3945_eeprom_init(priv); 7921 err = iwl3945_eeprom_init(priv);
7922 if (err) { 7922 if (err) {
7923 IWL_ERROR("Unable to init EEPROM\n"); 7923 IWL_ERROR("Unable to init EEPROM\n");
7924 goto out_remove_sysfs; 7924 goto out_iounmap;
7925 } 7925 }
7926 /* MAC Address location in EEPROM same for 3945/4965 */ 7926 /* MAC Address location in EEPROM same for 3945/4965 */
7927 get_eeprom_mac(priv, priv->mac_addr); 7927 get_eeprom_mac(priv, priv->mac_addr);
@@ -7975,7 +7975,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7975 err = iwl3945_init_channel_map(priv); 7975 err = iwl3945_init_channel_map(priv);
7976 if (err) { 7976 if (err) {
7977 IWL_ERROR("initializing regulatory failed: %d\n", err); 7977 IWL_ERROR("initializing regulatory failed: %d\n", err);
7978 goto out_release_irq; 7978 goto out_unset_hw_setting;
7979 } 7979 }
7980 7980
7981 err = iwl3945_init_geos(priv); 7981 err = iwl3945_init_geos(priv);
@@ -8045,25 +8045,22 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8045 return 0; 8045 return 0;
8046 8046
8047 out_remove_sysfs: 8047 out_remove_sysfs:
8048 destroy_workqueue(priv->workqueue);
8049 priv->workqueue = NULL;
8048 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 8050 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8049 out_free_geos: 8051 out_free_geos:
8050 iwl3945_free_geos(priv); 8052 iwl3945_free_geos(priv);
8051 out_free_channel_map: 8053 out_free_channel_map:
8052 iwl3945_free_channel_map(priv); 8054 iwl3945_free_channel_map(priv);
8053 8055 out_unset_hw_setting:
8054
8055 out_release_irq:
8056 destroy_workqueue(priv->workqueue);
8057 priv->workqueue = NULL;
8058 iwl3945_unset_hw_setting(priv); 8056 iwl3945_unset_hw_setting(priv);
8059
8060 out_iounmap: 8057 out_iounmap:
8061 pci_iounmap(pdev, priv->hw_base); 8058 pci_iounmap(pdev, priv->hw_base);
8062 out_pci_release_regions: 8059 out_pci_release_regions:
8063 pci_release_regions(pdev); 8060 pci_release_regions(pdev);
8064 out_pci_disable_device: 8061 out_pci_disable_device:
8065 pci_disable_device(pdev);
8066 pci_set_drvdata(pdev, NULL); 8062 pci_set_drvdata(pdev, NULL);
8063 pci_disable_device(pdev);
8067 out_ieee80211_free_hw: 8064 out_ieee80211_free_hw:
8068 ieee80211_free_hw(priv->hw); 8065 ieee80211_free_hw(priv->hw);
8069 out: 8066 out:
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 61d2f50470c8..b118a35ec605 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -23,7 +23,7 @@ static const char * mesh_stat_strings[]= {
23static void lbs_ethtool_get_drvinfo(struct net_device *dev, 23static void lbs_ethtool_get_drvinfo(struct net_device *dev,
24 struct ethtool_drvinfo *info) 24 struct ethtool_drvinfo *info)
25{ 25{
26 struct lbs_private *priv = netdev_priv(dev); 26 struct lbs_private *priv = dev->ml_priv;
27 27
28 snprintf(info->fw_version, 32, "%u.%u.%u.p%u", 28 snprintf(info->fw_version, 32, "%u.%u.%u.p%u",
29 priv->fwrelease >> 24 & 0xff, 29 priv->fwrelease >> 24 & 0xff,
@@ -47,7 +47,7 @@ static int lbs_ethtool_get_eeprom_len(struct net_device *dev)
47static int lbs_ethtool_get_eeprom(struct net_device *dev, 47static int lbs_ethtool_get_eeprom(struct net_device *dev,
48 struct ethtool_eeprom *eeprom, u8 * bytes) 48 struct ethtool_eeprom *eeprom, u8 * bytes)
49{ 49{
50 struct lbs_private *priv = netdev_priv(dev); 50 struct lbs_private *priv = dev->ml_priv;
51 struct cmd_ds_802_11_eeprom_access cmd; 51 struct cmd_ds_802_11_eeprom_access cmd;
52 int ret; 52 int ret;
53 53
@@ -76,7 +76,7 @@ out:
76static void lbs_ethtool_get_stats(struct net_device *dev, 76static void lbs_ethtool_get_stats(struct net_device *dev,
77 struct ethtool_stats *stats, uint64_t *data) 77 struct ethtool_stats *stats, uint64_t *data)
78{ 78{
79 struct lbs_private *priv = netdev_priv(dev); 79 struct lbs_private *priv = dev->ml_priv;
80 struct cmd_ds_mesh_access mesh_access; 80 struct cmd_ds_mesh_access mesh_access;
81 int ret; 81 int ret;
82 82
@@ -113,7 +113,7 @@ static void lbs_ethtool_get_stats(struct net_device *dev,
113 113
114static int lbs_ethtool_get_sset_count(struct net_device *dev, int sset) 114static int lbs_ethtool_get_sset_count(struct net_device *dev, int sset)
115{ 115{
116 struct lbs_private *priv = netdev_priv(dev); 116 struct lbs_private *priv = dev->ml_priv;
117 117
118 if (sset == ETH_SS_STATS && dev == priv->mesh_dev) 118 if (sset == ETH_SS_STATS && dev == priv->mesh_dev)
119 return MESH_STATS_NUM; 119 return MESH_STATS_NUM;
@@ -143,7 +143,7 @@ static void lbs_ethtool_get_strings(struct net_device *dev,
143static void lbs_ethtool_get_wol(struct net_device *dev, 143static void lbs_ethtool_get_wol(struct net_device *dev,
144 struct ethtool_wolinfo *wol) 144 struct ethtool_wolinfo *wol)
145{ 145{
146 struct lbs_private *priv = netdev_priv(dev); 146 struct lbs_private *priv = dev->ml_priv;
147 147
148 if (priv->wol_criteria == 0xffffffff) { 148 if (priv->wol_criteria == 0xffffffff) {
149 /* Interface driver didn't configure wake */ 149 /* Interface driver didn't configure wake */
@@ -166,7 +166,7 @@ static void lbs_ethtool_get_wol(struct net_device *dev,
166static int lbs_ethtool_set_wol(struct net_device *dev, 166static int lbs_ethtool_set_wol(struct net_device *dev,
167 struct ethtool_wolinfo *wol) 167 struct ethtool_wolinfo *wol)
168{ 168{
169 struct lbs_private *priv = netdev_priv(dev); 169 struct lbs_private *priv = dev->ml_priv;
170 uint32_t criteria = 0; 170 uint32_t criteria = 0;
171 171
172 if (priv->wol_criteria == 0xffffffff && wol->wolopts) 172 if (priv->wol_criteria == 0xffffffff && wol->wolopts)
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 2fc637ad85c7..ea3dc038be76 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -59,7 +59,7 @@ static int if_usb_reset_device(struct if_usb_card *cardp);
59static ssize_t if_usb_firmware_set(struct device *dev, 59static ssize_t if_usb_firmware_set(struct device *dev,
60 struct device_attribute *attr, const char *buf, size_t count) 60 struct device_attribute *attr, const char *buf, size_t count)
61{ 61{
62 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 62 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
63 struct if_usb_card *cardp = priv->card; 63 struct if_usb_card *cardp = priv->card;
64 char fwname[FIRMWARE_NAME_MAX]; 64 char fwname[FIRMWARE_NAME_MAX];
65 int ret; 65 int ret;
@@ -86,7 +86,7 @@ static DEVICE_ATTR(lbs_flash_fw, 0200, NULL, if_usb_firmware_set);
86static ssize_t if_usb_boot2_set(struct device *dev, 86static ssize_t if_usb_boot2_set(struct device *dev,
87 struct device_attribute *attr, const char *buf, size_t count) 87 struct device_attribute *attr, const char *buf, size_t count)
88{ 88{
89 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 89 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
90 struct if_usb_card *cardp = priv->card; 90 struct if_usb_card *cardp = priv->card;
91 char fwname[FIRMWARE_NAME_MAX]; 91 char fwname[FIRMWARE_NAME_MAX];
92 int ret; 92 int ret;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 4e0007d20030..f76623e0ff9a 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -222,7 +222,7 @@ u8 lbs_data_rate_to_fw_index(u32 rate)
222static ssize_t lbs_anycast_get(struct device *dev, 222static ssize_t lbs_anycast_get(struct device *dev,
223 struct device_attribute *attr, char * buf) 223 struct device_attribute *attr, char * buf)
224{ 224{
225 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 225 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
226 struct cmd_ds_mesh_access mesh_access; 226 struct cmd_ds_mesh_access mesh_access;
227 int ret; 227 int ret;
228 228
@@ -241,7 +241,7 @@ static ssize_t lbs_anycast_get(struct device *dev,
241static ssize_t lbs_anycast_set(struct device *dev, 241static ssize_t lbs_anycast_set(struct device *dev,
242 struct device_attribute *attr, const char * buf, size_t count) 242 struct device_attribute *attr, const char * buf, size_t count)
243{ 243{
244 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 244 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
245 struct cmd_ds_mesh_access mesh_access; 245 struct cmd_ds_mesh_access mesh_access;
246 uint32_t datum; 246 uint32_t datum;
247 int ret; 247 int ret;
@@ -263,7 +263,7 @@ static ssize_t lbs_anycast_set(struct device *dev,
263static ssize_t lbs_prb_rsp_limit_get(struct device *dev, 263static ssize_t lbs_prb_rsp_limit_get(struct device *dev,
264 struct device_attribute *attr, char *buf) 264 struct device_attribute *attr, char *buf)
265{ 265{
266 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 266 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
267 struct cmd_ds_mesh_access mesh_access; 267 struct cmd_ds_mesh_access mesh_access;
268 int ret; 268 int ret;
269 u32 retry_limit; 269 u32 retry_limit;
@@ -286,7 +286,7 @@ static ssize_t lbs_prb_rsp_limit_get(struct device *dev,
286static ssize_t lbs_prb_rsp_limit_set(struct device *dev, 286static ssize_t lbs_prb_rsp_limit_set(struct device *dev,
287 struct device_attribute *attr, const char *buf, size_t count) 287 struct device_attribute *attr, const char *buf, size_t count)
288{ 288{
289 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 289 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
290 struct cmd_ds_mesh_access mesh_access; 290 struct cmd_ds_mesh_access mesh_access;
291 int ret; 291 int ret;
292 unsigned long retry_limit; 292 unsigned long retry_limit;
@@ -321,7 +321,7 @@ static void lbs_remove_mesh(struct lbs_private *priv);
321static ssize_t lbs_rtap_get(struct device *dev, 321static ssize_t lbs_rtap_get(struct device *dev,
322 struct device_attribute *attr, char * buf) 322 struct device_attribute *attr, char * buf)
323{ 323{
324 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 324 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
325 return snprintf(buf, 5, "0x%X\n", priv->monitormode); 325 return snprintf(buf, 5, "0x%X\n", priv->monitormode);
326} 326}
327 327
@@ -332,7 +332,7 @@ static ssize_t lbs_rtap_set(struct device *dev,
332 struct device_attribute *attr, const char * buf, size_t count) 332 struct device_attribute *attr, const char * buf, size_t count)
333{ 333{
334 int monitor_mode; 334 int monitor_mode;
335 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 335 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
336 336
337 sscanf(buf, "%x", &monitor_mode); 337 sscanf(buf, "%x", &monitor_mode);
338 if (monitor_mode) { 338 if (monitor_mode) {
@@ -383,7 +383,7 @@ static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, lbs_rtap_set );
383static ssize_t lbs_mesh_get(struct device *dev, 383static ssize_t lbs_mesh_get(struct device *dev,
384 struct device_attribute *attr, char * buf) 384 struct device_attribute *attr, char * buf)
385{ 385{
386 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 386 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
387 return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev); 387 return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev);
388} 388}
389 389
@@ -393,7 +393,7 @@ static ssize_t lbs_mesh_get(struct device *dev,
393static ssize_t lbs_mesh_set(struct device *dev, 393static ssize_t lbs_mesh_set(struct device *dev,
394 struct device_attribute *attr, const char * buf, size_t count) 394 struct device_attribute *attr, const char * buf, size_t count)
395{ 395{
396 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 396 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
397 int enable; 397 int enable;
398 int ret, action = CMD_ACT_MESH_CONFIG_STOP; 398 int ret, action = CMD_ACT_MESH_CONFIG_STOP;
399 399
@@ -452,7 +452,7 @@ static struct attribute_group lbs_mesh_attr_group = {
452 */ 452 */
453static int lbs_dev_open(struct net_device *dev) 453static int lbs_dev_open(struct net_device *dev)
454{ 454{
455 struct lbs_private *priv = netdev_priv(dev) ; 455 struct lbs_private *priv = dev->ml_priv;
456 int ret = 0; 456 int ret = 0;
457 457
458 lbs_deb_enter(LBS_DEB_NET); 458 lbs_deb_enter(LBS_DEB_NET);
@@ -521,7 +521,7 @@ static int lbs_mesh_stop(struct net_device *dev)
521 */ 521 */
522static int lbs_eth_stop(struct net_device *dev) 522static int lbs_eth_stop(struct net_device *dev)
523{ 523{
524 struct lbs_private *priv = netdev_priv(dev); 524 struct lbs_private *priv = dev->ml_priv;
525 525
526 lbs_deb_enter(LBS_DEB_NET); 526 lbs_deb_enter(LBS_DEB_NET);
527 527
@@ -538,7 +538,7 @@ static int lbs_eth_stop(struct net_device *dev)
538 538
539static void lbs_tx_timeout(struct net_device *dev) 539static void lbs_tx_timeout(struct net_device *dev)
540{ 540{
541 struct lbs_private *priv = netdev_priv(dev); 541 struct lbs_private *priv = dev->ml_priv;
542 542
543 lbs_deb_enter(LBS_DEB_TX); 543 lbs_deb_enter(LBS_DEB_TX);
544 544
@@ -590,7 +590,7 @@ EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
590 */ 590 */
591static struct net_device_stats *lbs_get_stats(struct net_device *dev) 591static struct net_device_stats *lbs_get_stats(struct net_device *dev)
592{ 592{
593 struct lbs_private *priv = netdev_priv(dev); 593 struct lbs_private *priv = dev->ml_priv;
594 594
595 lbs_deb_enter(LBS_DEB_NET); 595 lbs_deb_enter(LBS_DEB_NET);
596 return &priv->stats; 596 return &priv->stats;
@@ -599,7 +599,7 @@ static struct net_device_stats *lbs_get_stats(struct net_device *dev)
599static int lbs_set_mac_address(struct net_device *dev, void *addr) 599static int lbs_set_mac_address(struct net_device *dev, void *addr)
600{ 600{
601 int ret = 0; 601 int ret = 0;
602 struct lbs_private *priv = netdev_priv(dev); 602 struct lbs_private *priv = dev->ml_priv;
603 struct sockaddr *phwaddr = addr; 603 struct sockaddr *phwaddr = addr;
604 struct cmd_ds_802_11_mac_address cmd; 604 struct cmd_ds_802_11_mac_address cmd;
605 605
@@ -732,7 +732,7 @@ static void lbs_set_mcast_worker(struct work_struct *work)
732 732
733static void lbs_set_multicast_list(struct net_device *dev) 733static void lbs_set_multicast_list(struct net_device *dev)
734{ 734{
735 struct lbs_private *priv = netdev_priv(dev); 735 struct lbs_private *priv = dev->ml_priv;
736 736
737 schedule_work(&priv->mcast_work); 737 schedule_work(&priv->mcast_work);
738} 738}
@@ -748,7 +748,7 @@ static void lbs_set_multicast_list(struct net_device *dev)
748static int lbs_thread(void *data) 748static int lbs_thread(void *data)
749{ 749{
750 struct net_device *dev = data; 750 struct net_device *dev = data;
751 struct lbs_private *priv = netdev_priv(dev); 751 struct lbs_private *priv = dev->ml_priv;
752 wait_queue_t wait; 752 wait_queue_t wait;
753 753
754 lbs_deb_enter(LBS_DEB_THREAD); 754 lbs_deb_enter(LBS_DEB_THREAD);
@@ -1184,6 +1184,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1184 goto done; 1184 goto done;
1185 } 1185 }
1186 priv = netdev_priv(dev); 1186 priv = netdev_priv(dev);
1187 dev->ml_priv = priv;
1187 1188
1188 if (lbs_init_adapter(priv)) { 1189 if (lbs_init_adapter(priv)) {
1189 lbs_pr_err("failed to initialize adapter structure.\n"); 1190 lbs_pr_err("failed to initialize adapter structure.\n");
diff --git a/drivers/net/wireless/libertas/persistcfg.c b/drivers/net/wireless/libertas/persistcfg.c
index d42b7a5a1b3f..18fe29faf99b 100644
--- a/drivers/net/wireless/libertas/persistcfg.c
+++ b/drivers/net/wireless/libertas/persistcfg.c
@@ -18,7 +18,7 @@
18static int mesh_get_default_parameters(struct device *dev, 18static int mesh_get_default_parameters(struct device *dev,
19 struct mrvl_mesh_defaults *defs) 19 struct mrvl_mesh_defaults *defs)
20{ 20{
21 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 21 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
22 struct cmd_ds_mesh_config cmd; 22 struct cmd_ds_mesh_config cmd;
23 int ret; 23 int ret;
24 24
@@ -57,7 +57,7 @@ static ssize_t bootflag_get(struct device *dev,
57static ssize_t bootflag_set(struct device *dev, struct device_attribute *attr, 57static ssize_t bootflag_set(struct device *dev, struct device_attribute *attr,
58 const char *buf, size_t count) 58 const char *buf, size_t count)
59{ 59{
60 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 60 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
61 struct cmd_ds_mesh_config cmd; 61 struct cmd_ds_mesh_config cmd;
62 uint32_t datum; 62 uint32_t datum;
63 int ret; 63 int ret;
@@ -100,7 +100,7 @@ static ssize_t boottime_get(struct device *dev,
100static ssize_t boottime_set(struct device *dev, 100static ssize_t boottime_set(struct device *dev,
101 struct device_attribute *attr, const char *buf, size_t count) 101 struct device_attribute *attr, const char *buf, size_t count)
102{ 102{
103 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 103 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
104 struct cmd_ds_mesh_config cmd; 104 struct cmd_ds_mesh_config cmd;
105 uint32_t datum; 105 uint32_t datum;
106 int ret; 106 int ret;
@@ -152,7 +152,7 @@ static ssize_t channel_get(struct device *dev,
152static ssize_t channel_set(struct device *dev, struct device_attribute *attr, 152static ssize_t channel_set(struct device *dev, struct device_attribute *attr,
153 const char *buf, size_t count) 153 const char *buf, size_t count)
154{ 154{
155 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 155 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
156 struct cmd_ds_mesh_config cmd; 156 struct cmd_ds_mesh_config cmd;
157 uint32_t datum; 157 uint32_t datum;
158 int ret; 158 int ret;
@@ -210,7 +210,7 @@ static ssize_t mesh_id_set(struct device *dev, struct device_attribute *attr,
210 struct cmd_ds_mesh_config cmd; 210 struct cmd_ds_mesh_config cmd;
211 struct mrvl_mesh_defaults defs; 211 struct mrvl_mesh_defaults defs;
212 struct mrvl_meshie *ie; 212 struct mrvl_meshie *ie;
213 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 213 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
214 int len; 214 int len;
215 int ret; 215 int ret;
216 216
@@ -269,7 +269,7 @@ static ssize_t protocol_id_set(struct device *dev,
269 struct cmd_ds_mesh_config cmd; 269 struct cmd_ds_mesh_config cmd;
270 struct mrvl_mesh_defaults defs; 270 struct mrvl_mesh_defaults defs;
271 struct mrvl_meshie *ie; 271 struct mrvl_meshie *ie;
272 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 272 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
273 uint32_t datum; 273 uint32_t datum;
274 int ret; 274 int ret;
275 275
@@ -323,7 +323,7 @@ static ssize_t metric_id_set(struct device *dev, struct device_attribute *attr,
323 struct cmd_ds_mesh_config cmd; 323 struct cmd_ds_mesh_config cmd;
324 struct mrvl_mesh_defaults defs; 324 struct mrvl_mesh_defaults defs;
325 struct mrvl_meshie *ie; 325 struct mrvl_meshie *ie;
326 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 326 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
327 uint32_t datum; 327 uint32_t datum;
328 int ret; 328 int ret;
329 329
@@ -377,7 +377,7 @@ static ssize_t capability_set(struct device *dev, struct device_attribute *attr,
377 struct cmd_ds_mesh_config cmd; 377 struct cmd_ds_mesh_config cmd;
378 struct mrvl_mesh_defaults defs; 378 struct mrvl_mesh_defaults defs;
379 struct mrvl_meshie *ie; 379 struct mrvl_meshie *ie;
380 struct lbs_private *priv = netdev_priv(to_net_dev(dev)); 380 struct lbs_private *priv = to_net_dev(dev)->ml_priv;
381 uint32_t datum; 381 uint32_t datum;
382 int ret; 382 int ret;
383 383
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 57f6c12cda20..9014950f4328 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -945,7 +945,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
945 union iwreq_data *wrqu, char *extra) 945 union iwreq_data *wrqu, char *extra)
946{ 946{
947 DECLARE_SSID_BUF(ssid); 947 DECLARE_SSID_BUF(ssid);
948 struct lbs_private *priv = netdev_priv(dev); 948 struct lbs_private *priv = dev->ml_priv;
949 int ret = 0; 949 int ret = 0;
950 950
951 lbs_deb_enter(LBS_DEB_WEXT); 951 lbs_deb_enter(LBS_DEB_WEXT);
@@ -1008,7 +1008,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
1008 struct iw_point *dwrq, char *extra) 1008 struct iw_point *dwrq, char *extra)
1009{ 1009{
1010#define SCAN_ITEM_SIZE 128 1010#define SCAN_ITEM_SIZE 128
1011 struct lbs_private *priv = netdev_priv(dev); 1011 struct lbs_private *priv = dev->ml_priv;
1012 int err = 0; 1012 int err = 0;
1013 char *ev = extra; 1013 char *ev = extra;
1014 char *stop = ev + dwrq->length; 1014 char *stop = ev + dwrq->length;
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index dac462641170..68bec31ae03b 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -60,7 +60,7 @@ static u32 convert_radiotap_rate_to_mv(u8 rate)
60int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 60int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
61{ 61{
62 unsigned long flags; 62 unsigned long flags;
63 struct lbs_private *priv = netdev_priv(dev); 63 struct lbs_private *priv = dev->ml_priv;
64 struct txpd *txpd; 64 struct txpd *txpd;
65 char *p802x_hdr; 65 char *p802x_hdr;
66 uint16_t pkt_len; 66 uint16_t pkt_len;
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index c6102e08179e..f16d136ab4bb 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -163,7 +163,7 @@ static int lbs_get_name(struct net_device *dev, struct iw_request_info *info,
163static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, 163static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,
164 struct iw_freq *fwrq, char *extra) 164 struct iw_freq *fwrq, char *extra)
165{ 165{
166 struct lbs_private *priv = netdev_priv(dev); 166 struct lbs_private *priv = dev->ml_priv;
167 struct chan_freq_power *cfp; 167 struct chan_freq_power *cfp;
168 168
169 lbs_deb_enter(LBS_DEB_WEXT); 169 lbs_deb_enter(LBS_DEB_WEXT);
@@ -189,7 +189,7 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,
189static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, 189static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info,
190 struct sockaddr *awrq, char *extra) 190 struct sockaddr *awrq, char *extra)
191{ 191{
192 struct lbs_private *priv = netdev_priv(dev); 192 struct lbs_private *priv = dev->ml_priv;
193 193
194 lbs_deb_enter(LBS_DEB_WEXT); 194 lbs_deb_enter(LBS_DEB_WEXT);
195 195
@@ -207,7 +207,7 @@ static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info,
207static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, 207static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info,
208 struct iw_point *dwrq, char *extra) 208 struct iw_point *dwrq, char *extra)
209{ 209{
210 struct lbs_private *priv = netdev_priv(dev); 210 struct lbs_private *priv = dev->ml_priv;
211 211
212 lbs_deb_enter(LBS_DEB_WEXT); 212 lbs_deb_enter(LBS_DEB_WEXT);
213 213
@@ -231,7 +231,7 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info,
231static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, 231static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info,
232 struct iw_point *dwrq, char *extra) 232 struct iw_point *dwrq, char *extra)
233{ 233{
234 struct lbs_private *priv = netdev_priv(dev); 234 struct lbs_private *priv = dev->ml_priv;
235 235
236 lbs_deb_enter(LBS_DEB_WEXT); 236 lbs_deb_enter(LBS_DEB_WEXT);
237 237
@@ -248,7 +248,7 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info,
248static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, 248static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
249 struct iw_point *dwrq, char *extra) 249 struct iw_point *dwrq, char *extra)
250{ 250{
251 struct lbs_private *priv = netdev_priv(dev); 251 struct lbs_private *priv = dev->ml_priv;
252 252
253 lbs_deb_enter(LBS_DEB_WEXT); 253 lbs_deb_enter(LBS_DEB_WEXT);
254 254
@@ -273,7 +273,7 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
273 struct iw_param *vwrq, char *extra) 273 struct iw_param *vwrq, char *extra)
274{ 274{
275 int ret = 0; 275 int ret = 0;
276 struct lbs_private *priv = netdev_priv(dev); 276 struct lbs_private *priv = dev->ml_priv;
277 u32 val = vwrq->value; 277 u32 val = vwrq->value;
278 278
279 lbs_deb_enter(LBS_DEB_WEXT); 279 lbs_deb_enter(LBS_DEB_WEXT);
@@ -293,7 +293,7 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
293static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, 293static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info,
294 struct iw_param *vwrq, char *extra) 294 struct iw_param *vwrq, char *extra)
295{ 295{
296 struct lbs_private *priv = netdev_priv(dev); 296 struct lbs_private *priv = dev->ml_priv;
297 int ret = 0; 297 int ret = 0;
298 u16 val = 0; 298 u16 val = 0;
299 299
@@ -315,7 +315,7 @@ out:
315static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, 315static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,
316 struct iw_param *vwrq, char *extra) 316 struct iw_param *vwrq, char *extra)
317{ 317{
318 struct lbs_private *priv = netdev_priv(dev); 318 struct lbs_private *priv = dev->ml_priv;
319 int ret = 0; 319 int ret = 0;
320 u32 val = vwrq->value; 320 u32 val = vwrq->value;
321 321
@@ -336,7 +336,7 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,
336static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, 336static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info,
337 struct iw_param *vwrq, char *extra) 337 struct iw_param *vwrq, char *extra)
338{ 338{
339 struct lbs_private *priv = netdev_priv(dev); 339 struct lbs_private *priv = dev->ml_priv;
340 int ret = 0; 340 int ret = 0;
341 u16 val = 0; 341 u16 val = 0;
342 342
@@ -359,7 +359,7 @@ out:
359static int lbs_get_mode(struct net_device *dev, 359static int lbs_get_mode(struct net_device *dev,
360 struct iw_request_info *info, u32 * uwrq, char *extra) 360 struct iw_request_info *info, u32 * uwrq, char *extra)
361{ 361{
362 struct lbs_private *priv = netdev_priv(dev); 362 struct lbs_private *priv = dev->ml_priv;
363 363
364 lbs_deb_enter(LBS_DEB_WEXT); 364 lbs_deb_enter(LBS_DEB_WEXT);
365 365
@@ -385,7 +385,7 @@ static int lbs_get_txpow(struct net_device *dev,
385 struct iw_request_info *info, 385 struct iw_request_info *info,
386 struct iw_param *vwrq, char *extra) 386 struct iw_param *vwrq, char *extra)
387{ 387{
388 struct lbs_private *priv = netdev_priv(dev); 388 struct lbs_private *priv = dev->ml_priv;
389 s16 curlevel = 0; 389 s16 curlevel = 0;
390 int ret = 0; 390 int ret = 0;
391 391
@@ -418,7 +418,7 @@ out:
418static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, 418static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info,
419 struct iw_param *vwrq, char *extra) 419 struct iw_param *vwrq, char *extra)
420{ 420{
421 struct lbs_private *priv = netdev_priv(dev); 421 struct lbs_private *priv = dev->ml_priv;
422 int ret = 0; 422 int ret = 0;
423 u16 slimit = 0, llimit = 0; 423 u16 slimit = 0, llimit = 0;
424 424
@@ -466,7 +466,7 @@ out:
466static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, 466static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info,
467 struct iw_param *vwrq, char *extra) 467 struct iw_param *vwrq, char *extra)
468{ 468{
469 struct lbs_private *priv = netdev_priv(dev); 469 struct lbs_private *priv = dev->ml_priv;
470 int ret = 0; 470 int ret = 0;
471 u16 val = 0; 471 u16 val = 0;
472 472
@@ -542,7 +542,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
542 struct iw_point *dwrq, char *extra) 542 struct iw_point *dwrq, char *extra)
543{ 543{
544 int i, j; 544 int i, j;
545 struct lbs_private *priv = netdev_priv(dev); 545 struct lbs_private *priv = dev->ml_priv;
546 struct iw_range *range = (struct iw_range *)extra; 546 struct iw_range *range = (struct iw_range *)extra;
547 struct chan_freq_power *cfp; 547 struct chan_freq_power *cfp;
548 u8 rates[MAX_RATES + 1]; 548 u8 rates[MAX_RATES + 1];
@@ -708,7 +708,7 @@ out:
708static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, 708static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
709 struct iw_param *vwrq, char *extra) 709 struct iw_param *vwrq, char *extra)
710{ 710{
711 struct lbs_private *priv = netdev_priv(dev); 711 struct lbs_private *priv = dev->ml_priv;
712 712
713 lbs_deb_enter(LBS_DEB_WEXT); 713 lbs_deb_enter(LBS_DEB_WEXT);
714 714
@@ -758,7 +758,7 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
758static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, 758static int lbs_get_power(struct net_device *dev, struct iw_request_info *info,
759 struct iw_param *vwrq, char *extra) 759 struct iw_param *vwrq, char *extra)
760{ 760{
761 struct lbs_private *priv = netdev_priv(dev); 761 struct lbs_private *priv = dev->ml_priv;
762 762
763 lbs_deb_enter(LBS_DEB_WEXT); 763 lbs_deb_enter(LBS_DEB_WEXT);
764 764
@@ -781,7 +781,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
781 EXCELLENT = 95, 781 EXCELLENT = 95,
782 PERFECT = 100 782 PERFECT = 100
783 }; 783 };
784 struct lbs_private *priv = netdev_priv(dev); 784 struct lbs_private *priv = dev->ml_priv;
785 u32 rssi_qual; 785 u32 rssi_qual;
786 u32 tx_qual; 786 u32 tx_qual;
787 u32 quality = 0; 787 u32 quality = 0;
@@ -886,7 +886,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info,
886 struct iw_freq *fwrq, char *extra) 886 struct iw_freq *fwrq, char *extra)
887{ 887{
888 int ret = -EINVAL; 888 int ret = -EINVAL;
889 struct lbs_private *priv = netdev_priv(dev); 889 struct lbs_private *priv = dev->ml_priv;
890 struct chan_freq_power *cfp; 890 struct chan_freq_power *cfp;
891 struct assoc_request * assoc_req; 891 struct assoc_request * assoc_req;
892 892
@@ -943,7 +943,7 @@ static int lbs_mesh_set_freq(struct net_device *dev,
943 struct iw_request_info *info, 943 struct iw_request_info *info,
944 struct iw_freq *fwrq, char *extra) 944 struct iw_freq *fwrq, char *extra)
945{ 945{
946 struct lbs_private *priv = netdev_priv(dev); 946 struct lbs_private *priv = dev->ml_priv;
947 struct chan_freq_power *cfp; 947 struct chan_freq_power *cfp;
948 int ret = -EINVAL; 948 int ret = -EINVAL;
949 949
@@ -994,7 +994,7 @@ out:
994static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, 994static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
995 struct iw_param *vwrq, char *extra) 995 struct iw_param *vwrq, char *extra)
996{ 996{
997 struct lbs_private *priv = netdev_priv(dev); 997 struct lbs_private *priv = dev->ml_priv;
998 u8 new_rate = 0; 998 u8 new_rate = 0;
999 int ret = -EINVAL; 999 int ret = -EINVAL;
1000 u8 rates[MAX_RATES + 1]; 1000 u8 rates[MAX_RATES + 1];
@@ -1054,7 +1054,7 @@ out:
1054static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, 1054static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info,
1055 struct iw_param *vwrq, char *extra) 1055 struct iw_param *vwrq, char *extra)
1056{ 1056{
1057 struct lbs_private *priv = netdev_priv(dev); 1057 struct lbs_private *priv = dev->ml_priv;
1058 1058
1059 lbs_deb_enter(LBS_DEB_WEXT); 1059 lbs_deb_enter(LBS_DEB_WEXT);
1060 1060
@@ -1079,7 +1079,7 @@ static int lbs_set_mode(struct net_device *dev,
1079 struct iw_request_info *info, u32 * uwrq, char *extra) 1079 struct iw_request_info *info, u32 * uwrq, char *extra)
1080{ 1080{
1081 int ret = 0; 1081 int ret = 0;
1082 struct lbs_private *priv = netdev_priv(dev); 1082 struct lbs_private *priv = dev->ml_priv;
1083 struct assoc_request * assoc_req; 1083 struct assoc_request * assoc_req;
1084 1084
1085 lbs_deb_enter(LBS_DEB_WEXT); 1085 lbs_deb_enter(LBS_DEB_WEXT);
@@ -1124,7 +1124,7 @@ static int lbs_get_encode(struct net_device *dev,
1124 struct iw_request_info *info, 1124 struct iw_request_info *info,
1125 struct iw_point *dwrq, u8 * extra) 1125 struct iw_point *dwrq, u8 * extra)
1126{ 1126{
1127 struct lbs_private *priv = netdev_priv(dev); 1127 struct lbs_private *priv = dev->ml_priv;
1128 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; 1128 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1129 1129
1130 lbs_deb_enter(LBS_DEB_WEXT); 1130 lbs_deb_enter(LBS_DEB_WEXT);
@@ -1319,7 +1319,7 @@ static int lbs_set_encode(struct net_device *dev,
1319 struct iw_point *dwrq, char *extra) 1319 struct iw_point *dwrq, char *extra)
1320{ 1320{
1321 int ret = 0; 1321 int ret = 0;
1322 struct lbs_private *priv = netdev_priv(dev); 1322 struct lbs_private *priv = dev->ml_priv;
1323 struct assoc_request * assoc_req; 1323 struct assoc_request * assoc_req;
1324 u16 is_default = 0, index = 0, set_tx_key = 0; 1324 u16 is_default = 0, index = 0, set_tx_key = 0;
1325 1325
@@ -1395,7 +1395,7 @@ static int lbs_get_encodeext(struct net_device *dev,
1395 char *extra) 1395 char *extra)
1396{ 1396{
1397 int ret = -EINVAL; 1397 int ret = -EINVAL;
1398 struct lbs_private *priv = netdev_priv(dev); 1398 struct lbs_private *priv = dev->ml_priv;
1399 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1399 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1400 int index, max_key_len; 1400 int index, max_key_len;
1401 1401
@@ -1501,7 +1501,7 @@ static int lbs_set_encodeext(struct net_device *dev,
1501 char *extra) 1501 char *extra)
1502{ 1502{
1503 int ret = 0; 1503 int ret = 0;
1504 struct lbs_private *priv = netdev_priv(dev); 1504 struct lbs_private *priv = dev->ml_priv;
1505 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1505 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1506 int alg = ext->alg; 1506 int alg = ext->alg;
1507 struct assoc_request * assoc_req; 1507 struct assoc_request * assoc_req;
@@ -1639,7 +1639,7 @@ static int lbs_set_genie(struct net_device *dev,
1639 struct iw_point *dwrq, 1639 struct iw_point *dwrq,
1640 char *extra) 1640 char *extra)
1641{ 1641{
1642 struct lbs_private *priv = netdev_priv(dev); 1642 struct lbs_private *priv = dev->ml_priv;
1643 int ret = 0; 1643 int ret = 0;
1644 struct assoc_request * assoc_req; 1644 struct assoc_request * assoc_req;
1645 1645
@@ -1685,7 +1685,7 @@ static int lbs_get_genie(struct net_device *dev,
1685 char *extra) 1685 char *extra)
1686{ 1686{
1687 int ret = 0; 1687 int ret = 0;
1688 struct lbs_private *priv = netdev_priv(dev); 1688 struct lbs_private *priv = dev->ml_priv;
1689 1689
1690 lbs_deb_enter(LBS_DEB_WEXT); 1690 lbs_deb_enter(LBS_DEB_WEXT);
1691 1691
@@ -1713,7 +1713,7 @@ static int lbs_set_auth(struct net_device *dev,
1713 struct iw_param *dwrq, 1713 struct iw_param *dwrq,
1714 char *extra) 1714 char *extra)
1715{ 1715{
1716 struct lbs_private *priv = netdev_priv(dev); 1716 struct lbs_private *priv = dev->ml_priv;
1717 struct assoc_request * assoc_req; 1717 struct assoc_request * assoc_req;
1718 int ret = 0; 1718 int ret = 0;
1719 int updated = 0; 1719 int updated = 0;
@@ -1816,7 +1816,7 @@ static int lbs_get_auth(struct net_device *dev,
1816 char *extra) 1816 char *extra)
1817{ 1817{
1818 int ret = 0; 1818 int ret = 0;
1819 struct lbs_private *priv = netdev_priv(dev); 1819 struct lbs_private *priv = dev->ml_priv;
1820 1820
1821 lbs_deb_enter(LBS_DEB_WEXT); 1821 lbs_deb_enter(LBS_DEB_WEXT);
1822 1822
@@ -1857,7 +1857,7 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
1857 struct iw_param *vwrq, char *extra) 1857 struct iw_param *vwrq, char *extra)
1858{ 1858{
1859 int ret = 0; 1859 int ret = 0;
1860 struct lbs_private *priv = netdev_priv(dev); 1860 struct lbs_private *priv = dev->ml_priv;
1861 s16 dbm = (s16) vwrq->value; 1861 s16 dbm = (s16) vwrq->value;
1862 1862
1863 lbs_deb_enter(LBS_DEB_WEXT); 1863 lbs_deb_enter(LBS_DEB_WEXT);
@@ -1936,7 +1936,7 @@ out:
1936static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, 1936static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
1937 struct iw_point *dwrq, char *extra) 1937 struct iw_point *dwrq, char *extra)
1938{ 1938{
1939 struct lbs_private *priv = netdev_priv(dev); 1939 struct lbs_private *priv = dev->ml_priv;
1940 1940
1941 lbs_deb_enter(LBS_DEB_WEXT); 1941 lbs_deb_enter(LBS_DEB_WEXT);
1942 1942
@@ -1971,7 +1971,7 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
1971static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, 1971static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
1972 struct iw_point *dwrq, char *extra) 1972 struct iw_point *dwrq, char *extra)
1973{ 1973{
1974 struct lbs_private *priv = netdev_priv(dev); 1974 struct lbs_private *priv = dev->ml_priv;
1975 int ret = 0; 1975 int ret = 0;
1976 u8 ssid[IW_ESSID_MAX_SIZE]; 1976 u8 ssid[IW_ESSID_MAX_SIZE];
1977 u8 ssid_len = 0; 1977 u8 ssid_len = 0;
@@ -2040,7 +2040,7 @@ static int lbs_mesh_get_essid(struct net_device *dev,
2040 struct iw_request_info *info, 2040 struct iw_request_info *info,
2041 struct iw_point *dwrq, char *extra) 2041 struct iw_point *dwrq, char *extra)
2042{ 2042{
2043 struct lbs_private *priv = netdev_priv(dev); 2043 struct lbs_private *priv = dev->ml_priv;
2044 2044
2045 lbs_deb_enter(LBS_DEB_WEXT); 2045 lbs_deb_enter(LBS_DEB_WEXT);
2046 2046
@@ -2058,7 +2058,7 @@ static int lbs_mesh_set_essid(struct net_device *dev,
2058 struct iw_request_info *info, 2058 struct iw_request_info *info,
2059 struct iw_point *dwrq, char *extra) 2059 struct iw_point *dwrq, char *extra)
2060{ 2060{
2061 struct lbs_private *priv = netdev_priv(dev); 2061 struct lbs_private *priv = dev->ml_priv;
2062 int ret = 0; 2062 int ret = 0;
2063 2063
2064 lbs_deb_enter(LBS_DEB_WEXT); 2064 lbs_deb_enter(LBS_DEB_WEXT);
@@ -2102,7 +2102,7 @@ static int lbs_mesh_set_essid(struct net_device *dev,
2102static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, 2102static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info,
2103 struct sockaddr *awrq, char *extra) 2103 struct sockaddr *awrq, char *extra)
2104{ 2104{
2105 struct lbs_private *priv = netdev_priv(dev); 2105 struct lbs_private *priv = dev->ml_priv;
2106 struct assoc_request * assoc_req; 2106 struct assoc_request * assoc_req;
2107 int ret = 0; 2107 int ret = 0;
2108 2108
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
index 45a04faa7818..067d1a9c728b 100644
--- a/drivers/net/wireless/orinoco/orinoco.c
+++ b/drivers/net/wireless/orinoco/orinoco.c
@@ -3157,8 +3157,20 @@ static int orinoco_pm_notifier(struct notifier_block *notifier,
3157 3157
3158 return NOTIFY_DONE; 3158 return NOTIFY_DONE;
3159} 3159}
3160
3161static void orinoco_register_pm_notifier(struct orinoco_private *priv)
3162{
3163 priv->pm_notifier.notifier_call = orinoco_pm_notifier;
3164 register_pm_notifier(&priv->pm_notifier);
3165}
3166
3167static void orinoco_unregister_pm_notifier(struct orinoco_private *priv)
3168{
3169 unregister_pm_notifier(&priv->pm_notifier);
3170}
3160#else /* !PM_SLEEP || HERMES_CACHE_FW_ON_INIT */ 3171#else /* !PM_SLEEP || HERMES_CACHE_FW_ON_INIT */
3161#define orinoco_pm_notifier NULL 3172#define orinoco_register_pm_notifier(priv) do { } while(0)
3173#define orinoco_unregister_pm_notifier(priv) do { } while(0)
3162#endif 3174#endif
3163 3175
3164/********************************************************************/ 3176/********************************************************************/
@@ -3648,8 +3660,7 @@ struct net_device
3648 priv->cached_fw = NULL; 3660 priv->cached_fw = NULL;
3649 3661
3650 /* Register PM notifiers */ 3662 /* Register PM notifiers */
3651 priv->pm_notifier.notifier_call = orinoco_pm_notifier; 3663 orinoco_register_pm_notifier(priv);
3652 register_pm_notifier(&priv->pm_notifier);
3653 3664
3654 return dev; 3665 return dev;
3655} 3666}
@@ -3673,7 +3684,7 @@ void free_orinocodev(struct net_device *dev)
3673 kfree(rx_data); 3684 kfree(rx_data);
3674 } 3685 }
3675 3686
3676 unregister_pm_notifier(&priv->pm_notifier); 3687 orinoco_unregister_pm_notifier(priv);
3677 orinoco_uncache_fw(priv); 3688 orinoco_uncache_fw(priv);
3678 3689
3679 priv->wpa_ie_len = 0; 3690 priv->wpa_ie_len = 0;
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 34561e6e816b..f170106bf0ae 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -710,10 +710,11 @@ static struct sk_buff *p54_find_tx_entry(struct ieee80211_hw *dev,
710 __le32 req_id) 710 __le32 req_id)
711{ 711{
712 struct p54_common *priv = dev->priv; 712 struct p54_common *priv = dev->priv;
713 struct sk_buff *entry = priv->tx_queue.next; 713 struct sk_buff *entry;
714 unsigned long flags; 714 unsigned long flags;
715 715
716 spin_lock_irqsave(&priv->tx_queue.lock, flags); 716 spin_lock_irqsave(&priv->tx_queue.lock, flags);
717 entry = priv->tx_queue.next;
717 while (entry != (struct sk_buff *)&priv->tx_queue) { 718 while (entry != (struct sk_buff *)&priv->tx_queue) {
718 struct p54_hdr *hdr = (struct p54_hdr *) entry->data; 719 struct p54_hdr *hdr = (struct p54_hdr *) entry->data;
719 720
@@ -732,7 +733,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
732 struct p54_common *priv = dev->priv; 733 struct p54_common *priv = dev->priv;
733 struct p54_hdr *hdr = (struct p54_hdr *) skb->data; 734 struct p54_hdr *hdr = (struct p54_hdr *) skb->data;
734 struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data; 735 struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data;
735 struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; 736 struct sk_buff *entry;
736 u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom; 737 u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom;
737 struct memrecord *range = NULL; 738 struct memrecord *range = NULL;
738 u32 freed = 0; 739 u32 freed = 0;
@@ -741,6 +742,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
741 int count, idx; 742 int count, idx;
742 743
743 spin_lock_irqsave(&priv->tx_queue.lock, flags); 744 spin_lock_irqsave(&priv->tx_queue.lock, flags);
745 entry = (struct sk_buff *) priv->tx_queue.next;
744 while (entry != (struct sk_buff *)&priv->tx_queue) { 746 while (entry != (struct sk_buff *)&priv->tx_queue) {
745 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 747 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
746 struct p54_hdr *entry_hdr; 748 struct p54_hdr *entry_hdr;
@@ -976,7 +978,7 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
976 struct p54_hdr *data, u32 len) 978 struct p54_hdr *data, u32 len)
977{ 979{
978 struct p54_common *priv = dev->priv; 980 struct p54_common *priv = dev->priv;
979 struct sk_buff *entry = priv->tx_queue.next; 981 struct sk_buff *entry;
980 struct sk_buff *target_skb = NULL; 982 struct sk_buff *target_skb = NULL;
981 struct ieee80211_tx_info *info; 983 struct ieee80211_tx_info *info;
982 struct memrecord *range; 984 struct memrecord *range;
@@ -1014,6 +1016,7 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
1014 } 1016 }
1015 } 1017 }
1016 1018
1019 entry = priv->tx_queue.next;
1017 while (left--) { 1020 while (left--) {
1018 u32 hole_size; 1021 u32 hole_size;
1019 info = IEEE80211_SKB_CB(entry); 1022 info = IEEE80211_SKB_CB(entry);
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index af6b5847be5c..3e2ac2bbb12f 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1952,6 +1952,8 @@ static struct usb_device_id rt2500usb_device_table[] = {
1952 { USB_DEVICE(0x13b1, 0x000d), USB_DEVICE_DATA(&rt2500usb_ops) }, 1952 { USB_DEVICE(0x13b1, 0x000d), USB_DEVICE_DATA(&rt2500usb_ops) },
1953 { USB_DEVICE(0x13b1, 0x0011), USB_DEVICE_DATA(&rt2500usb_ops) }, 1953 { USB_DEVICE(0x13b1, 0x0011), USB_DEVICE_DATA(&rt2500usb_ops) },
1954 { USB_DEVICE(0x13b1, 0x001a), USB_DEVICE_DATA(&rt2500usb_ops) }, 1954 { USB_DEVICE(0x13b1, 0x001a), USB_DEVICE_DATA(&rt2500usb_ops) },
1955 /* CNet */
1956 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt2500usb_ops) },
1955 /* Conceptronic */ 1957 /* Conceptronic */
1956 { USB_DEVICE(0x14b2, 0x3c02), USB_DEVICE_DATA(&rt2500usb_ops) }, 1958 { USB_DEVICE(0x14b2, 0x3c02), USB_DEVICE_DATA(&rt2500usb_ops) },
1957 /* D-LINK */ 1959 /* D-LINK */
@@ -1976,14 +1978,20 @@ static struct usb_device_id rt2500usb_device_table[] = {
1976 { USB_DEVICE(0x148f, 0x2570), USB_DEVICE_DATA(&rt2500usb_ops) }, 1978 { USB_DEVICE(0x148f, 0x2570), USB_DEVICE_DATA(&rt2500usb_ops) },
1977 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt2500usb_ops) }, 1979 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt2500usb_ops) },
1978 { USB_DEVICE(0x148f, 0x9020), USB_DEVICE_DATA(&rt2500usb_ops) }, 1980 { USB_DEVICE(0x148f, 0x9020), USB_DEVICE_DATA(&rt2500usb_ops) },
1981 /* Sagem */
1982 { USB_DEVICE(0x079b, 0x004b), USB_DEVICE_DATA(&rt2500usb_ops) },
1979 /* Siemens */ 1983 /* Siemens */
1980 { USB_DEVICE(0x0681, 0x3c06), USB_DEVICE_DATA(&rt2500usb_ops) }, 1984 { USB_DEVICE(0x0681, 0x3c06), USB_DEVICE_DATA(&rt2500usb_ops) },
1981 /* SMC */ 1985 /* SMC */
1982 { USB_DEVICE(0x0707, 0xee13), USB_DEVICE_DATA(&rt2500usb_ops) }, 1986 { USB_DEVICE(0x0707, 0xee13), USB_DEVICE_DATA(&rt2500usb_ops) },
1983 /* Spairon */ 1987 /* Spairon */
1984 { USB_DEVICE(0x114b, 0x0110), USB_DEVICE_DATA(&rt2500usb_ops) }, 1988 { USB_DEVICE(0x114b, 0x0110), USB_DEVICE_DATA(&rt2500usb_ops) },
1989 /* SURECOM */
1990 { USB_DEVICE(0x0769, 0x11f3), USB_DEVICE_DATA(&rt2500usb_ops) },
1985 /* Trust */ 1991 /* Trust */
1986 { USB_DEVICE(0x0eb0, 0x9020), USB_DEVICE_DATA(&rt2500usb_ops) }, 1992 { USB_DEVICE(0x0eb0, 0x9020), USB_DEVICE_DATA(&rt2500usb_ops) },
1993 /* VTech */
1994 { USB_DEVICE(0x0f88, 0x3012), USB_DEVICE_DATA(&rt2500usb_ops) },
1987 /* Zinwell */ 1995 /* Zinwell */
1988 { USB_DEVICE(0x5a57, 0x0260), USB_DEVICE_DATA(&rt2500usb_ops) }, 1996 { USB_DEVICE(0x5a57, 0x0260), USB_DEVICE_DATA(&rt2500usb_ops) },
1989 { 0, } 1997 { 0, }
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 96a8d69f8790..cefee1b26cd8 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2281,7 +2281,18 @@ static const struct rt2x00_ops rt73usb_ops = {
2281 */ 2281 */
2282static struct usb_device_id rt73usb_device_table[] = { 2282static struct usb_device_id rt73usb_device_table[] = {
2283 /* AboCom */ 2283 /* AboCom */
2284 { USB_DEVICE(0x07b8, 0xb21b), USB_DEVICE_DATA(&rt73usb_ops) },
2285 { USB_DEVICE(0x07b8, 0xb21c), USB_DEVICE_DATA(&rt73usb_ops) },
2284 { USB_DEVICE(0x07b8, 0xb21d), USB_DEVICE_DATA(&rt73usb_ops) }, 2286 { USB_DEVICE(0x07b8, 0xb21d), USB_DEVICE_DATA(&rt73usb_ops) },
2287 { USB_DEVICE(0x07b8, 0xb21e), USB_DEVICE_DATA(&rt73usb_ops) },
2288 { USB_DEVICE(0x07b8, 0xb21f), USB_DEVICE_DATA(&rt73usb_ops) },
2289 /* AL */
2290 { USB_DEVICE(0x14b2, 0x3c10), USB_DEVICE_DATA(&rt73usb_ops) },
2291 /* Amigo */
2292 { USB_DEVICE(0x148f, 0x9021), USB_DEVICE_DATA(&rt73usb_ops) },
2293 { USB_DEVICE(0x0eb0, 0x9021), USB_DEVICE_DATA(&rt73usb_ops) },
2294 /* AMIT */
2295 { USB_DEVICE(0x18c5, 0x0002), USB_DEVICE_DATA(&rt73usb_ops) },
2285 /* Askey */ 2296 /* Askey */
2286 { USB_DEVICE(0x1690, 0x0722), USB_DEVICE_DATA(&rt73usb_ops) }, 2297 { USB_DEVICE(0x1690, 0x0722), USB_DEVICE_DATA(&rt73usb_ops) },
2287 /* ASUS */ 2298 /* ASUS */
@@ -2294,7 +2305,9 @@ static struct usb_device_id rt73usb_device_table[] = {
2294 { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) }, 2305 { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) },
2295 /* Billionton */ 2306 /* Billionton */
2296 { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) }, 2307 { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) },
2308 { USB_DEVICE(0x08dd, 0x0120), USB_DEVICE_DATA(&rt73usb_ops) },
2297 /* Buffalo */ 2309 /* Buffalo */
2310 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) },
2298 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2311 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
2299 /* CNet */ 2312 /* CNet */
2300 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2313 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
@@ -2308,6 +2321,11 @@ static struct usb_device_id rt73usb_device_table[] = {
2308 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, 2321 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
2309 { USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) }, 2322 { USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) },
2310 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) }, 2323 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
2324 /* Edimax */
2325 { USB_DEVICE(0x7392, 0x7318), USB_DEVICE_DATA(&rt73usb_ops) },
2326 { USB_DEVICE(0x7392, 0x7618), USB_DEVICE_DATA(&rt73usb_ops) },
2327 /* EnGenius */
2328 { USB_DEVICE(0x1740, 0x3701), USB_DEVICE_DATA(&rt73usb_ops) },
2311 /* Gemtek */ 2329 /* Gemtek */
2312 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, 2330 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
2313 /* Gigabyte */ 2331 /* Gigabyte */
@@ -2328,22 +2346,34 @@ static struct usb_device_id rt73usb_device_table[] = {
2328 { USB_DEVICE(0x0db0, 0xa861), USB_DEVICE_DATA(&rt73usb_ops) }, 2346 { USB_DEVICE(0x0db0, 0xa861), USB_DEVICE_DATA(&rt73usb_ops) },
2329 { USB_DEVICE(0x0db0, 0xa874), USB_DEVICE_DATA(&rt73usb_ops) }, 2347 { USB_DEVICE(0x0db0, 0xa874), USB_DEVICE_DATA(&rt73usb_ops) },
2330 /* Ralink */ 2348 /* Ralink */
2349 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) },
2331 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, 2350 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) },
2332 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, 2351 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) },
2333 /* Qcom */ 2352 /* Qcom */
2334 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, 2353 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) },
2335 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, 2354 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) },
2336 { USB_DEVICE(0x18e8, 0x6238), USB_DEVICE_DATA(&rt73usb_ops) }, 2355 { USB_DEVICE(0x18e8, 0x6238), USB_DEVICE_DATA(&rt73usb_ops) },
2356 /* Samsung */
2357 { USB_DEVICE(0x04e8, 0x4471), USB_DEVICE_DATA(&rt73usb_ops) },
2337 /* Senao */ 2358 /* Senao */
2338 { USB_DEVICE(0x1740, 0x7100), USB_DEVICE_DATA(&rt73usb_ops) }, 2359 { USB_DEVICE(0x1740, 0x7100), USB_DEVICE_DATA(&rt73usb_ops) },
2339 /* Sitecom */ 2360 /* Sitecom */
2340 { USB_DEVICE(0x0df6, 0x9712), USB_DEVICE_DATA(&rt73usb_ops) }, 2361 { USB_DEVICE(0x0df6, 0x0024), USB_DEVICE_DATA(&rt73usb_ops) },
2362 { USB_DEVICE(0x0df6, 0x0027), USB_DEVICE_DATA(&rt73usb_ops) },
2363 { USB_DEVICE(0x0df6, 0x002f), USB_DEVICE_DATA(&rt73usb_ops) },
2341 { USB_DEVICE(0x0df6, 0x90ac), USB_DEVICE_DATA(&rt73usb_ops) }, 2364 { USB_DEVICE(0x0df6, 0x90ac), USB_DEVICE_DATA(&rt73usb_ops) },
2365 { USB_DEVICE(0x0df6, 0x9712), USB_DEVICE_DATA(&rt73usb_ops) },
2342 /* Surecom */ 2366 /* Surecom */
2343 { USB_DEVICE(0x0769, 0x31f3), USB_DEVICE_DATA(&rt73usb_ops) }, 2367 { USB_DEVICE(0x0769, 0x31f3), USB_DEVICE_DATA(&rt73usb_ops) },
2368 /* Philips */
2369 { USB_DEVICE(0x0471, 0x200a), USB_DEVICE_DATA(&rt73usb_ops) },
2344 /* Planex */ 2370 /* Planex */
2345 { USB_DEVICE(0x2019, 0xab01), USB_DEVICE_DATA(&rt73usb_ops) }, 2371 { USB_DEVICE(0x2019, 0xab01), USB_DEVICE_DATA(&rt73usb_ops) },
2346 { USB_DEVICE(0x2019, 0xab50), USB_DEVICE_DATA(&rt73usb_ops) }, 2372 { USB_DEVICE(0x2019, 0xab50), USB_DEVICE_DATA(&rt73usb_ops) },
2373 /* Zcom */
2374 { USB_DEVICE(0x0cde, 0x001c), USB_DEVICE_DATA(&rt73usb_ops) },
2375 /* ZyXEL */
2376 { USB_DEVICE(0x0586, 0x3415), USB_DEVICE_DATA(&rt73usb_ops) },
2347 { 0, } 2377 { 0, }
2348}; 2378};
2349 2379
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 22bc07ef2f37..f4747a1134ba 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -48,6 +48,10 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
48 {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B}, 48 {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B},
49 {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B}, 49 {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B},
50 {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B}, 50 {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B},
51 /* Surecom */
52 {USB_DEVICE(0x0769, 0x11F2), .driver_info = DEVICE_RTL8187},
53 /* Logitech */
54 {USB_DEVICE(0x0789, 0x010C), .driver_info = DEVICE_RTL8187},
51 /* Netgear */ 55 /* Netgear */
52 {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187}, 56 {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187},
53 {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187}, 57 {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187},
@@ -57,8 +61,16 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
57 /* Sitecom */ 61 /* Sitecom */
58 {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187}, 62 {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
59 {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B}, 63 {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
64 /* Sphairon Access Systems GmbH */
65 {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
66 /* Dick Smith Electronics */
67 {USB_DEVICE(0x1371, 0x9401), .driver_info = DEVICE_RTL8187},
60 /* Abocom */ 68 /* Abocom */
61 {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187}, 69 {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
70 /* Qcom */
71 {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187},
72 /* AirLive */
73 {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187},
62 {} 74 {}
63}; 75};
64 76
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index d539d9df88e7..bb5a1c9597cb 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -479,7 +479,7 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr)
479 res = &dino_dev->hba.lmmio_space; 479 res = &dino_dev->hba.lmmio_space;
480 res->flags = IORESOURCE_MEM; 480 res->flags = IORESOURCE_MEM;
481 size = scnprintf(name, sizeof(name), "Dino LMMIO (%s)", 481 size = scnprintf(name, sizeof(name), "Dino LMMIO (%s)",
482 bus->bridge->bus_id); 482 dev_name(bus->bridge));
483 res->name = kmalloc(size+1, GFP_KERNEL); 483 res->name = kmalloc(size+1, GFP_KERNEL);
484 if(res->name) 484 if(res->name)
485 strcpy((char *)res->name, name); 485 strcpy((char *)res->name, name);
@@ -493,7 +493,7 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr)
493 struct list_head *ln, *tmp_ln; 493 struct list_head *ln, *tmp_ln;
494 494
495 printk(KERN_ERR "Dino: cannot attach bus %s\n", 495 printk(KERN_ERR "Dino: cannot attach bus %s\n",
496 bus->bridge->bus_id); 496 dev_name(bus->bridge));
497 /* kill the bus, we can't do anything with it */ 497 /* kill the bus, we can't do anything with it */
498 list_for_each_safe(ln, tmp_ln, &bus->devices) { 498 list_for_each_safe(ln, tmp_ln, &bus->devices) {
499 struct pci_dev *dev = pci_dev_b(ln); 499 struct pci_dev *dev = pci_dev_b(ln);
@@ -587,7 +587,7 @@ dino_fixup_bus(struct pci_bus *bus)
587 bus->resource[i+1] = &res[i]; 587 bus->resource[i+1] = &res[i];
588 } 588 }
589 589
590 } else if(bus->self) { 590 } else if (bus->parent) {
591 int i; 591 int i;
592 592
593 pci_read_bridge_bases(bus); 593 pci_read_bridge_bases(bus);
@@ -611,12 +611,12 @@ dino_fixup_bus(struct pci_bus *bus)
611 } 611 }
612 612
613 DBG("DEBUG %s assigning %d [0x%lx,0x%lx]\n", 613 DBG("DEBUG %s assigning %d [0x%lx,0x%lx]\n",
614 bus->self->dev.bus_id, i, 614 dev_name(&bus->self->dev), i,
615 bus->self->resource[i].start, 615 bus->self->resource[i].start,
616 bus->self->resource[i].end); 616 bus->self->resource[i].end);
617 pci_assign_resource(bus->self, i); 617 pci_assign_resource(bus->self, i);
618 DBG("DEBUG %s after assign %d [0x%lx,0x%lx]\n", 618 DBG("DEBUG %s after assign %d [0x%lx,0x%lx]\n",
619 bus->self->dev.bus_id, i, 619 dev_name(&bus->self->dev), i,
620 bus->self->resource[i].start, 620 bus->self->resource[i].start,
621 bus->self->resource[i].end); 621 bus->self->resource[i].end);
622 } 622 }
@@ -1026,7 +1026,8 @@ static int __init dino_probe(struct parisc_device *dev)
1026 dino_current_bus = bus->subordinate + 1; 1026 dino_current_bus = bus->subordinate + 1;
1027 pci_bus_assign_resources(bus); 1027 pci_bus_assign_resources(bus);
1028 } else { 1028 } else {
1029 printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n", dev->dev.bus_id, dino_current_bus); 1029 printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n",
1030 dev_name(&dev->dev), dino_current_bus);
1030 /* increment the bus number in case of duplicates */ 1031 /* increment the bus number in case of duplicates */
1031 dino_current_bus++; 1032 dino_current_bus++;
1032 } 1033 }
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index e76db9e4d504..d33632917696 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -186,29 +186,34 @@ void gsc_asic_assign_irq(struct gsc_asic *asic, int local_irq, int *irqp)
186 *irqp = irq; 186 *irqp = irq;
187} 187}
188 188
189static struct device *next_device(struct klist_iter *i) 189struct gsc_fixup_struct {
190 void (*choose_irq)(struct parisc_device *, void *);
191 void *ctrl;
192};
193
194static int gsc_fixup_irqs_callback(struct device *dev, void *data)
190{ 195{
191 struct klist_node * n = klist_next(i); 196 struct parisc_device *padev = to_parisc_device(dev);
192 return n ? container_of(n, struct device, knode_parent) : NULL; 197 struct gsc_fixup_struct *gf = data;
198
199 /* work-around for 715/64 and others which have parent
200 at path [5] and children at path [5/0/x] */
201 if (padev->id.hw_type == HPHW_FAULTY)
202 gsc_fixup_irqs(padev, gf->ctrl, gf->choose_irq);
203 gf->choose_irq(padev, gf->ctrl);
204
205 return 0;
193} 206}
194 207
195void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl, 208void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl,
196 void (*choose_irq)(struct parisc_device *, void *)) 209 void (*choose_irq)(struct parisc_device *, void *))
197{ 210{
198 struct device *dev; 211 struct gsc_fixup_struct data = {
199 struct klist_iter i; 212 .choose_irq = choose_irq,
200 213 .ctrl = ctrl,
201 klist_iter_init(&parent->dev.klist_children, &i); 214 };
202 while ((dev = next_device(&i))) { 215
203 struct parisc_device *padev = to_parisc_device(dev); 216 device_for_each_child(&parent->dev, &data, gsc_fixup_irqs_callback);
204
205 /* work-around for 715/64 and others which have parent
206 at path [5] and children at path [5/0/x] */
207 if (padev->id.hw_type == HPHW_FAULTY)
208 return gsc_fixup_irqs(padev, ctrl, choose_irq);
209 choose_irq(padev, ctrl);
210 }
211 klist_iter_exit(&i);
212} 217}
213 218
214int gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic) 219int gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic)
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 0797659ee016..501aaf1f253f 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -487,7 +487,7 @@ iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev)
487 } 487 }
488 488
489 /* Check if pcidev behind a PPB */ 489 /* Check if pcidev behind a PPB */
490 if (NULL != pcidev->bus->self) { 490 if (pcidev->bus->parent) {
491 /* Convert pcidev INTR_PIN into something we 491 /* Convert pcidev INTR_PIN into something we
492 ** can lookup in the IRT. 492 ** can lookup in the IRT.
493 */ 493 */
@@ -523,10 +523,9 @@ iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev)
523#endif /* PCI_BRIDGE_FUNCS */ 523#endif /* PCI_BRIDGE_FUNCS */
524 524
525 /* 525 /*
526 ** Locate the host slot the PPB nearest the Host bus 526 * Locate the host slot of the PPB.
527 ** adapter. 527 */
528 */ 528 while (p->parent->parent)
529 while (NULL != p->parent->self)
530 p = p->parent; 529 p = p->parent;
531 530
532 intr_slot = PCI_SLOT(p->self->devfn); 531 intr_slot = PCI_SLOT(p->self->devfn);
@@ -709,11 +708,14 @@ static void iosapic_set_affinity_irq(unsigned int irq,
709 struct vector_info *vi = iosapic_get_vector(irq); 708 struct vector_info *vi = iosapic_get_vector(irq);
710 u32 d0, d1, dummy_d0; 709 u32 d0, d1, dummy_d0;
711 unsigned long flags; 710 unsigned long flags;
711 int dest_cpu;
712 712
713 if (cpu_check_affinity(irq, dest)) 713 dest_cpu = cpu_check_affinity(irq, dest);
714 if (dest_cpu < 0)
714 return; 715 return;
715 716
716 vi->txn_addr = txn_affinity_addr(irq, cpumask_first(dest)); 717 irq_desc[irq].affinity = cpumask_of_cpu(dest_cpu);
718 vi->txn_addr = txn_affinity_addr(irq, dest_cpu);
717 719
718 spin_lock_irqsave(&iosapic_lock, flags); 720 spin_lock_irqsave(&iosapic_lock, flags);
719 /* d1 contains the destination CPU, so only want to set that 721 /* d1 contains the destination CPU, so only want to set that
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index d8233de8c75d..59fbbf128365 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -644,7 +644,7 @@ lba_fixup_bus(struct pci_bus *bus)
644 ** Properly Setup MMIO resources for this bus. 644 ** Properly Setup MMIO resources for this bus.
645 ** pci_alloc_primary_bus() mangles this. 645 ** pci_alloc_primary_bus() mangles this.
646 */ 646 */
647 if (bus->self) { 647 if (bus->parent) {
648 int i; 648 int i;
649 /* PCI-PCI Bridge */ 649 /* PCI-PCI Bridge */
650 pci_read_bridge_bases(bus); 650 pci_read_bridge_bases(bus);
@@ -802,7 +802,7 @@ lba_fixup_bus(struct pci_bus *bus)
802** Can't fixup here anyway....garr... 802** Can't fixup here anyway....garr...
803*/ 803*/
804 if (fbb_enable) { 804 if (fbb_enable) {
805 if (bus->self) { 805 if (bus->parent) {
806 u8 control; 806 u8 control;
807 /* enable on PPB */ 807 /* enable on PPB */
808 (void) pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &control); 808 (void) pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &control);
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index a70cf16ee1ad..e5999c4cedc8 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -1206,30 +1206,48 @@ sba_alloc_pdir(unsigned int pdir_size)
1206 return (void *) pdir_base; 1206 return (void *) pdir_base;
1207} 1207}
1208 1208
1209static struct device *next_device(struct klist_iter *i) 1209struct ibase_data_struct {
1210 struct ioc *ioc;
1211 int ioc_num;
1212};
1213
1214static int setup_ibase_imask_callback(struct device *dev, void *data)
1210{ 1215{
1211 struct klist_node * n = klist_next(i); 1216 /* lba_set_iregs() is in drivers/parisc/lba_pci.c */
1212 return n ? container_of(n, struct device, knode_parent) : NULL; 1217 extern void lba_set_iregs(struct parisc_device *, u32, u32);
1218 struct parisc_device *lba = to_parisc_device(dev);
1219 struct ibase_data_struct *ibd = data;
1220 int rope_num = (lba->hpa.start >> 13) & 0xf;
1221 if (rope_num >> 3 == ibd->ioc_num)
1222 lba_set_iregs(lba, ibd->ioc->ibase, ibd->ioc->imask);
1223 return 0;
1213} 1224}
1214 1225
1215/* setup Mercury or Elroy IBASE/IMASK registers. */ 1226/* setup Mercury or Elroy IBASE/IMASK registers. */
1216static void 1227static void
1217setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num) 1228setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1218{ 1229{
1219 /* lba_set_iregs() is in drivers/parisc/lba_pci.c */ 1230 struct ibase_data_struct ibase_data = {
1220 extern void lba_set_iregs(struct parisc_device *, u32, u32); 1231 .ioc = ioc,
1221 struct device *dev; 1232 .ioc_num = ioc_num,
1222 struct klist_iter i; 1233 };
1223 1234
1224 klist_iter_init(&sba->dev.klist_children, &i); 1235 device_for_each_child(&sba->dev, &ibase_data,
1225 while ((dev = next_device(&i))) { 1236 setup_ibase_imask_callback);
1226 struct parisc_device *lba = to_parisc_device(dev); 1237}
1227 int rope_num = (lba->hpa.start >> 13) & 0xf; 1238
1228 if (rope_num >> 3 == ioc_num) 1239#ifdef SBA_AGP_SUPPORT
1229 lba_set_iregs(lba, ioc->ibase, ioc->imask); 1240static int
1230 } 1241sba_ioc_find_quicksilver(struct device *dev, void *data)
1231 klist_iter_exit(&i); 1242{
1243 int *agp_found = data;
1244 struct parisc_device *lba = to_parisc_device(dev);
1245
1246 if (IS_QUICKSILVER(lba))
1247 *agp_found = 1;
1248 return 0;
1232} 1249}
1250#endif
1233 1251
1234static void 1252static void
1235sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) 1253sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
@@ -1332,9 +1350,6 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1332 WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM); 1350 WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM);
1333 1351
1334#ifdef SBA_AGP_SUPPORT 1352#ifdef SBA_AGP_SUPPORT
1335{
1336 struct klist_iter i;
1337 struct device *dev = NULL;
1338 1353
1339 /* 1354 /*
1340 ** If an AGP device is present, only use half of the IOV space 1355 ** If an AGP device is present, only use half of the IOV space
@@ -1344,13 +1359,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1344 ** We program the next pdir index after we stop w/ a key for 1359 ** We program the next pdir index after we stop w/ a key for
1345 ** the GART code to handshake on. 1360 ** the GART code to handshake on.
1346 */ 1361 */
1347 klist_iter_init(&sba->dev.klist_children, &i); 1362 device_for_each_child(&sba->dev, &agp_found, sba_ioc_find_quicksilver);
1348 while ((dev = next_device(&i))) {
1349 struct parisc_device *lba = to_parisc_device(dev);
1350 if (IS_QUICKSILVER(lba))
1351 agp_found = 1;
1352 }
1353 klist_iter_exit(&i);
1354 1363
1355 if (agp_found && sba_reserve_agpgart) { 1364 if (agp_found && sba_reserve_agpgart) {
1356 printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n", 1365 printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n",
@@ -1358,9 +1367,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1358 ioc->pdir_size /= 2; 1367 ioc->pdir_size /= 2;
1359 ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE; 1368 ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE;
1360 } 1369 }
1361}
1362#endif /*SBA_AGP_SUPPORT*/ 1370#endif /*SBA_AGP_SUPPORT*/
1363
1364} 1371}
1365 1372
1366static void 1373static void
diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c
index ad4cdd256137..0b28fccec03f 100644
--- a/drivers/parport/parport_atari.c
+++ b/drivers/parport/parport_atari.c
@@ -84,7 +84,7 @@ parport_atari_frob_control(struct parport *p, unsigned char mask,
84static unsigned char 84static unsigned char
85parport_atari_read_status(struct parport *p) 85parport_atari_read_status(struct parport *p)
86{ 86{
87 return ((mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) | 87 return ((st_mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) |
88 PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR); 88 PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR);
89} 89}
90 90
@@ -193,9 +193,9 @@ static int __init parport_atari_init(void)
193 sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5); 193 sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5);
194 local_irq_restore(flags); 194 local_irq_restore(flags);
195 /* MFP port I0 as input. */ 195 /* MFP port I0 as input. */
196 mfp.data_dir &= ~1; 196 st_mfp.data_dir &= ~1;
197 /* MFP port I0 interrupt on high->low edge. */ 197 /* MFP port I0 interrupt on high->low edge. */
198 mfp.active_edge &= ~1; 198 st_mfp.active_edge &= ~1;
199 p = parport_register_port((unsigned long)&sound_ym.wd_data, 199 p = parport_register_port((unsigned long)&sound_ym.wd_data,
200 IRQ_MFP_BUSY, PARPORT_DMA_NONE, 200 IRQ_MFP_BUSY, PARPORT_DMA_NONE,
201 &parport_atari_ops); 201 &parport_atari_ops);
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index f5a662a50acb..26c536b51c5a 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -330,6 +330,14 @@ parse_dmar_table(void)
330 entry_header = (struct acpi_dmar_header *)(dmar + 1); 330 entry_header = (struct acpi_dmar_header *)(dmar + 1);
331 while (((unsigned long)entry_header) < 331 while (((unsigned long)entry_header) <
332 (((unsigned long)dmar) + dmar_tbl->length)) { 332 (((unsigned long)dmar) + dmar_tbl->length)) {
333 /* Avoid looping forever on bad ACPI tables */
334 if (entry_header->length == 0) {
335 printk(KERN_WARNING PREFIX
336 "Invalid 0-length structure\n");
337 ret = -EINVAL;
338 break;
339 }
340
333 dmar_table_print_dmar_entry(entry_header); 341 dmar_table_print_dmar_entry(entry_header);
334 342
335 switch (entry_header->type) { 343 switch (entry_header->type) {
@@ -491,7 +499,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
491 int map_size; 499 int map_size;
492 u32 ver; 500 u32 ver;
493 static int iommu_allocated = 0; 501 static int iommu_allocated = 0;
494 int agaw; 502 int agaw = 0;
495 503
496 iommu = kzalloc(sizeof(*iommu), GFP_KERNEL); 504 iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
497 if (!iommu) 505 if (!iommu)
@@ -507,6 +515,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
507 iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG); 515 iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
508 iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG); 516 iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
509 517
518#ifdef CONFIG_DMAR
510 agaw = iommu_calculate_agaw(iommu); 519 agaw = iommu_calculate_agaw(iommu);
511 if (agaw < 0) { 520 if (agaw < 0) {
512 printk(KERN_ERR 521 printk(KERN_ERR
@@ -514,6 +523,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
514 iommu->seq_id); 523 iommu->seq_id);
515 goto error; 524 goto error;
516 } 525 }
526#endif
517 iommu->agaw = agaw; 527 iommu->agaw = agaw;
518 528
519 /* the registers might be more than one page */ 529 /* the registers might be more than one page */
@@ -571,19 +581,49 @@ static inline void reclaim_free_desc(struct q_inval *qi)
571 } 581 }
572} 582}
573 583
584static int qi_check_fault(struct intel_iommu *iommu, int index)
585{
586 u32 fault;
587 int head;
588 struct q_inval *qi = iommu->qi;
589 int wait_index = (index + 1) % QI_LENGTH;
590
591 fault = readl(iommu->reg + DMAR_FSTS_REG);
592
593 /*
594 * If IQE happens, the head points to the descriptor associated
595 * with the error. No new descriptors are fetched until the IQE
596 * is cleared.
597 */
598 if (fault & DMA_FSTS_IQE) {
599 head = readl(iommu->reg + DMAR_IQH_REG);
600 if ((head >> 4) == index) {
601 memcpy(&qi->desc[index], &qi->desc[wait_index],
602 sizeof(struct qi_desc));
603 __iommu_flush_cache(iommu, &qi->desc[index],
604 sizeof(struct qi_desc));
605 writel(DMA_FSTS_IQE, iommu->reg + DMAR_FSTS_REG);
606 return -EINVAL;
607 }
608 }
609
610 return 0;
611}
612
574/* 613/*
575 * Submit the queued invalidation descriptor to the remapping 614 * Submit the queued invalidation descriptor to the remapping
576 * hardware unit and wait for its completion. 615 * hardware unit and wait for its completion.
577 */ 616 */
578void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu) 617int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu)
579{ 618{
619 int rc = 0;
580 struct q_inval *qi = iommu->qi; 620 struct q_inval *qi = iommu->qi;
581 struct qi_desc *hw, wait_desc; 621 struct qi_desc *hw, wait_desc;
582 int wait_index, index; 622 int wait_index, index;
583 unsigned long flags; 623 unsigned long flags;
584 624
585 if (!qi) 625 if (!qi)
586 return; 626 return 0;
587 627
588 hw = qi->desc; 628 hw = qi->desc;
589 629
@@ -601,7 +641,8 @@ void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu)
601 641
602 hw[index] = *desc; 642 hw[index] = *desc;
603 643
604 wait_desc.low = QI_IWD_STATUS_DATA(2) | QI_IWD_STATUS_WRITE | QI_IWD_TYPE; 644 wait_desc.low = QI_IWD_STATUS_DATA(QI_DONE) |
645 QI_IWD_STATUS_WRITE | QI_IWD_TYPE;
605 wait_desc.high = virt_to_phys(&qi->desc_status[wait_index]); 646 wait_desc.high = virt_to_phys(&qi->desc_status[wait_index]);
606 647
607 hw[wait_index] = wait_desc; 648 hw[wait_index] = wait_desc;
@@ -612,13 +653,11 @@ void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu)
612 qi->free_head = (qi->free_head + 2) % QI_LENGTH; 653 qi->free_head = (qi->free_head + 2) % QI_LENGTH;
613 qi->free_cnt -= 2; 654 qi->free_cnt -= 2;
614 655
615 spin_lock(&iommu->register_lock);
616 /* 656 /*
617 * update the HW tail register indicating the presence of 657 * update the HW tail register indicating the presence of
618 * new descriptors. 658 * new descriptors.
619 */ 659 */
620 writel(qi->free_head << 4, iommu->reg + DMAR_IQT_REG); 660 writel(qi->free_head << 4, iommu->reg + DMAR_IQT_REG);
621 spin_unlock(&iommu->register_lock);
622 661
623 while (qi->desc_status[wait_index] != QI_DONE) { 662 while (qi->desc_status[wait_index] != QI_DONE) {
624 /* 663 /*
@@ -628,15 +667,21 @@ void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu)
628 * a deadlock where the interrupt context can wait indefinitely 667 * a deadlock where the interrupt context can wait indefinitely
629 * for free slots in the queue. 668 * for free slots in the queue.
630 */ 669 */
670 rc = qi_check_fault(iommu, index);
671 if (rc)
672 goto out;
673
631 spin_unlock(&qi->q_lock); 674 spin_unlock(&qi->q_lock);
632 cpu_relax(); 675 cpu_relax();
633 spin_lock(&qi->q_lock); 676 spin_lock(&qi->q_lock);
634 } 677 }
635 678out:
636 qi->desc_status[index] = QI_DONE; 679 qi->desc_status[index] = qi->desc_status[wait_index] = QI_DONE;
637 680
638 reclaim_free_desc(qi); 681 reclaim_free_desc(qi);
639 spin_unlock_irqrestore(&qi->q_lock, flags); 682 spin_unlock_irqrestore(&qi->q_lock, flags);
683
684 return rc;
640} 685}
641 686
642/* 687/*
@@ -649,13 +694,13 @@ void qi_global_iec(struct intel_iommu *iommu)
649 desc.low = QI_IEC_TYPE; 694 desc.low = QI_IEC_TYPE;
650 desc.high = 0; 695 desc.high = 0;
651 696
697 /* should never fail */
652 qi_submit_sync(&desc, iommu); 698 qi_submit_sync(&desc, iommu);
653} 699}
654 700
655int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, 701int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm,
656 u64 type, int non_present_entry_flush) 702 u64 type, int non_present_entry_flush)
657{ 703{
658
659 struct qi_desc desc; 704 struct qi_desc desc;
660 705
661 if (non_present_entry_flush) { 706 if (non_present_entry_flush) {
@@ -669,10 +714,7 @@ int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm,
669 | QI_CC_GRAN(type) | QI_CC_TYPE; 714 | QI_CC_GRAN(type) | QI_CC_TYPE;
670 desc.high = 0; 715 desc.high = 0;
671 716
672 qi_submit_sync(&desc, iommu); 717 return qi_submit_sync(&desc, iommu);
673
674 return 0;
675
676} 718}
677 719
678int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, 720int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
@@ -702,10 +744,7 @@ int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
702 desc.high = QI_IOTLB_ADDR(addr) | QI_IOTLB_IH(ih) 744 desc.high = QI_IOTLB_ADDR(addr) | QI_IOTLB_IH(ih)
703 | QI_IOTLB_AM(size_order); 745 | QI_IOTLB_AM(size_order);
704 746
705 qi_submit_sync(&desc, iommu); 747 return qi_submit_sync(&desc, iommu);
706
707 return 0;
708
709} 748}
710 749
711/* 750/*
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index eacfb13998bb..9aa4fe100a0d 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -143,7 +143,7 @@ config HOTPLUG_PCI_SHPC
143 143
144config HOTPLUG_PCI_RPA 144config HOTPLUG_PCI_RPA
145 tristate "RPA PCI Hotplug driver" 145 tristate "RPA PCI Hotplug driver"
146 depends on PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE 146 depends on PPC_PSERIES && EEH && !HOTPLUG_PCI_FAKE
147 help 147 help
148 Say Y here if you have a RPA system that supports PCI Hotplug. 148 Say Y here if you have a RPA system that supports PCI Hotplug.
149 149
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index db85284ffb62..39ae37589fda 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -111,6 +111,7 @@ struct controller {
111 int cmd_busy; 111 int cmd_busy;
112 unsigned int no_cmd_complete:1; 112 unsigned int no_cmd_complete:1;
113 unsigned int link_active_reporting:1; 113 unsigned int link_active_reporting:1;
114 unsigned int notification_enabled:1;
114}; 115};
115 116
116#define INT_BUTTON_IGNORE 0 117#define INT_BUTTON_IGNORE 0
@@ -170,6 +171,7 @@ extern int pciehp_configure_device(struct slot *p_slot);
170extern int pciehp_unconfigure_device(struct slot *p_slot); 171extern int pciehp_unconfigure_device(struct slot *p_slot);
171extern void pciehp_queue_pushbutton_work(struct work_struct *work); 172extern void pciehp_queue_pushbutton_work(struct work_struct *work);
172struct controller *pcie_init(struct pcie_device *dev); 173struct controller *pcie_init(struct pcie_device *dev);
174int pcie_init_notification(struct controller *ctrl);
173int pciehp_enable_slot(struct slot *p_slot); 175int pciehp_enable_slot(struct slot *p_slot);
174int pciehp_disable_slot(struct slot *p_slot); 176int pciehp_disable_slot(struct slot *p_slot);
175int pcie_enable_notification(struct controller *ctrl); 177int pcie_enable_notification(struct controller *ctrl);
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index c2485542f543..681e3912b821 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -434,6 +434,13 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
434 goto err_out_release_ctlr; 434 goto err_out_release_ctlr;
435 } 435 }
436 436
437 /* Enable events after we have setup the data structures */
438 rc = pcie_init_notification(ctrl);
439 if (rc) {
440 ctrl_err(ctrl, "Notification initialization failed\n");
441 goto err_out_release_ctlr;
442 }
443
437 /* Check if slot is occupied */ 444 /* Check if slot is occupied */
438 t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 445 t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
439 t_slot->hpc_ops->get_adapter_status(t_slot, &value); 446 t_slot->hpc_ops->get_adapter_status(t_slot, &value);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 71a8012886b0..7a16c6897bb9 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -934,7 +934,7 @@ static void pcie_disable_notification(struct controller *ctrl)
934 ctrl_warn(ctrl, "Cannot disable software notification\n"); 934 ctrl_warn(ctrl, "Cannot disable software notification\n");
935} 935}
936 936
937static int pcie_init_notification(struct controller *ctrl) 937int pcie_init_notification(struct controller *ctrl)
938{ 938{
939 if (pciehp_request_irq(ctrl)) 939 if (pciehp_request_irq(ctrl))
940 return -1; 940 return -1;
@@ -942,13 +942,17 @@ static int pcie_init_notification(struct controller *ctrl)
942 pciehp_free_irq(ctrl); 942 pciehp_free_irq(ctrl);
943 return -1; 943 return -1;
944 } 944 }
945 ctrl->notification_enabled = 1;
945 return 0; 946 return 0;
946} 947}
947 948
948static void pcie_shutdown_notification(struct controller *ctrl) 949static void pcie_shutdown_notification(struct controller *ctrl)
949{ 950{
950 pcie_disable_notification(ctrl); 951 if (ctrl->notification_enabled) {
951 pciehp_free_irq(ctrl); 952 pcie_disable_notification(ctrl);
953 pciehp_free_irq(ctrl);
954 ctrl->notification_enabled = 0;
955 }
952} 956}
953 957
954static int pcie_init_slot(struct controller *ctrl) 958static int pcie_init_slot(struct controller *ctrl)
@@ -1110,13 +1114,8 @@ struct controller *pcie_init(struct pcie_device *dev)
1110 if (pcie_init_slot(ctrl)) 1114 if (pcie_init_slot(ctrl))
1111 goto abort_ctrl; 1115 goto abort_ctrl;
1112 1116
1113 if (pcie_init_notification(ctrl))
1114 goto abort_slot;
1115
1116 return ctrl; 1117 return ctrl;
1117 1118
1118abort_slot:
1119 pcie_cleanup_slot(ctrl);
1120abort_ctrl: 1119abort_ctrl:
1121 kfree(ctrl); 1120 kfree(ctrl);
1122abort: 1121abort:
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index f4b7c79023ff..f3f686581a90 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -61,6 +61,8 @@
61/* global iommu list, set NULL for ignored DMAR units */ 61/* global iommu list, set NULL for ignored DMAR units */
62static struct intel_iommu **g_iommus; 62static struct intel_iommu **g_iommus;
63 63
64static int rwbf_quirk;
65
64/* 66/*
65 * 0: Present 67 * 0: Present
66 * 1-11: Reserved 68 * 1-11: Reserved
@@ -785,7 +787,7 @@ static void iommu_flush_write_buffer(struct intel_iommu *iommu)
785 u32 val; 787 u32 val;
786 unsigned long flag; 788 unsigned long flag;
787 789
788 if (!cap_rwbf(iommu->cap)) 790 if (!rwbf_quirk && !cap_rwbf(iommu->cap))
789 return; 791 return;
790 val = iommu->gcmd | DMA_GCMD_WBF; 792 val = iommu->gcmd | DMA_GCMD_WBF;
791 793
@@ -3137,3 +3139,15 @@ static struct iommu_ops intel_iommu_ops = {
3137 .unmap = intel_iommu_unmap_range, 3139 .unmap = intel_iommu_unmap_range,
3138 .iova_to_phys = intel_iommu_iova_to_phys, 3140 .iova_to_phys = intel_iommu_iova_to_phys,
3139}; 3141};
3142
3143static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
3144{
3145 /*
3146 * Mobile 4 Series Chipset neglects to set RWBF capability,
3147 * but needs it:
3148 */
3149 printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");
3150 rwbf_quirk = 1;
3151}
3152
3153DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 3d604132a04f..b721c2fbe8f5 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -207,7 +207,7 @@ int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
207 return index; 207 return index;
208} 208}
209 209
210static void qi_flush_iec(struct intel_iommu *iommu, int index, int mask) 210static int qi_flush_iec(struct intel_iommu *iommu, int index, int mask)
211{ 211{
212 struct qi_desc desc; 212 struct qi_desc desc;
213 213
@@ -215,7 +215,7 @@ static void qi_flush_iec(struct intel_iommu *iommu, int index, int mask)
215 | QI_IEC_SELECTIVE; 215 | QI_IEC_SELECTIVE;
216 desc.high = 0; 216 desc.high = 0;
217 217
218 qi_submit_sync(&desc, iommu); 218 return qi_submit_sync(&desc, iommu);
219} 219}
220 220
221int map_irq_to_irte_handle(int irq, u16 *sub_handle) 221int map_irq_to_irte_handle(int irq, u16 *sub_handle)
@@ -283,6 +283,7 @@ int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index)
283 283
284int modify_irte(int irq, struct irte *irte_modified) 284int modify_irte(int irq, struct irte *irte_modified)
285{ 285{
286 int rc;
286 int index; 287 int index;
287 struct irte *irte; 288 struct irte *irte;
288 struct intel_iommu *iommu; 289 struct intel_iommu *iommu;
@@ -303,14 +304,15 @@ int modify_irte(int irq, struct irte *irte_modified)
303 set_64bit((unsigned long *)irte, irte_modified->low | (1 << 1)); 304 set_64bit((unsigned long *)irte, irte_modified->low | (1 << 1));
304 __iommu_flush_cache(iommu, irte, sizeof(*irte)); 305 __iommu_flush_cache(iommu, irte, sizeof(*irte));
305 306
306 qi_flush_iec(iommu, index, 0); 307 rc = qi_flush_iec(iommu, index, 0);
307
308 spin_unlock(&irq_2_ir_lock); 308 spin_unlock(&irq_2_ir_lock);
309 return 0; 309
310 return rc;
310} 311}
311 312
312int flush_irte(int irq) 313int flush_irte(int irq)
313{ 314{
315 int rc;
314 int index; 316 int index;
315 struct intel_iommu *iommu; 317 struct intel_iommu *iommu;
316 struct irq_2_iommu *irq_iommu; 318 struct irq_2_iommu *irq_iommu;
@@ -326,10 +328,10 @@ int flush_irte(int irq)
326 328
327 index = irq_iommu->irte_index + irq_iommu->sub_handle; 329 index = irq_iommu->irte_index + irq_iommu->sub_handle;
328 330
329 qi_flush_iec(iommu, index, irq_iommu->irte_mask); 331 rc = qi_flush_iec(iommu, index, irq_iommu->irte_mask);
330 spin_unlock(&irq_2_ir_lock); 332 spin_unlock(&irq_2_ir_lock);
331 333
332 return 0; 334 return rc;
333} 335}
334 336
335struct intel_iommu *map_ioapic_to_ir(int apic) 337struct intel_iommu *map_ioapic_to_ir(int apic)
@@ -355,6 +357,7 @@ struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
355 357
356int free_irte(int irq) 358int free_irte(int irq)
357{ 359{
360 int rc = 0;
358 int index, i; 361 int index, i;
359 struct irte *irte; 362 struct irte *irte;
360 struct intel_iommu *iommu; 363 struct intel_iommu *iommu;
@@ -375,7 +378,7 @@ int free_irte(int irq)
375 if (!irq_iommu->sub_handle) { 378 if (!irq_iommu->sub_handle) {
376 for (i = 0; i < (1 << irq_iommu->irte_mask); i++) 379 for (i = 0; i < (1 << irq_iommu->irte_mask); i++)
377 set_64bit((unsigned long *)irte, 0); 380 set_64bit((unsigned long *)irte, 0);
378 qi_flush_iec(iommu, index, irq_iommu->irte_mask); 381 rc = qi_flush_iec(iommu, index, irq_iommu->irte_mask);
379 } 382 }
380 383
381 irq_iommu->iommu = NULL; 384 irq_iommu->iommu = NULL;
@@ -385,7 +388,7 @@ int free_irte(int irq)
385 388
386 spin_unlock(&irq_2_ir_lock); 389 spin_unlock(&irq_2_ir_lock);
387 390
388 return 0; 391 return rc;
389} 392}
390 393
391static void iommu_set_intr_remapping(struct intel_iommu *iommu, int mode) 394static void iommu_set_intr_remapping(struct intel_iommu *iommu, int mode)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 44f15ff70c1d..baba2eb5367d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -103,14 +103,12 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
103 } 103 }
104} 104}
105 105
106/*
107 * Essentially, this is ((1 << (1 << x)) - 1), but without the
108 * undefinedness of a << 32.
109 */
110static inline __attribute_const__ u32 msi_mask(unsigned x) 106static inline __attribute_const__ u32 msi_mask(unsigned x)
111{ 107{
112 static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff }; 108 /* Don't shift by >= width of type */
113 return mask[x]; 109 if (x >= 5)
110 return 0xffffffff;
111 return (1 << (1 << x)) - 1;
114} 112}
115 113
116static void msix_flush_writes(struct irq_desc *desc) 114static void msix_flush_writes(struct irq_desc *desc)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e3efe6b19ee7..6d6120007af4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1540,16 +1540,21 @@ void pci_release_region(struct pci_dev *pdev, int bar)
1540} 1540}
1541 1541
1542/** 1542/**
1543 * pci_request_region - Reserved PCI I/O and memory resource 1543 * __pci_request_region - Reserved PCI I/O and memory resource
1544 * @pdev: PCI device whose resources are to be reserved 1544 * @pdev: PCI device whose resources are to be reserved
1545 * @bar: BAR to be reserved 1545 * @bar: BAR to be reserved
1546 * @res_name: Name to be associated with resource. 1546 * @res_name: Name to be associated with resource.
1547 * @exclusive: whether the region access is exclusive or not
1547 * 1548 *
1548 * Mark the PCI region associated with PCI device @pdev BR @bar as 1549 * Mark the PCI region associated with PCI device @pdev BR @bar as
1549 * being reserved by owner @res_name. Do not access any 1550 * being reserved by owner @res_name. Do not access any
1550 * address inside the PCI regions unless this call returns 1551 * address inside the PCI regions unless this call returns
1551 * successfully. 1552 * successfully.
1552 * 1553 *
1554 * If @exclusive is set, then the region is marked so that userspace
1555 * is explicitly not allowed to map the resource via /dev/mem or
1556 * sysfs MMIO access.
1557 *
1553 * Returns 0 on success, or %EBUSY on error. A warning 1558 * Returns 0 on success, or %EBUSY on error. A warning
1554 * message is also printed on failure. 1559 * message is also printed on failure.
1555 */ 1560 */
@@ -1588,12 +1593,12 @@ err_out:
1588} 1593}
1589 1594
1590/** 1595/**
1591 * pci_request_region - Reserved PCI I/O and memory resource 1596 * pci_request_region - Reserve PCI I/O and memory resource
1592 * @pdev: PCI device whose resources are to be reserved 1597 * @pdev: PCI device whose resources are to be reserved
1593 * @bar: BAR to be reserved 1598 * @bar: BAR to be reserved
1594 * @res_name: Name to be associated with resource. 1599 * @res_name: Name to be associated with resource
1595 * 1600 *
1596 * Mark the PCI region associated with PCI device @pdev BR @bar as 1601 * Mark the PCI region associated with PCI device @pdev BAR @bar as
1597 * being reserved by owner @res_name. Do not access any 1602 * being reserved by owner @res_name. Do not access any
1598 * address inside the PCI regions unless this call returns 1603 * address inside the PCI regions unless this call returns
1599 * successfully. 1604 * successfully.
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 26ddf78ac300..07c0aa5275e6 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -16,21 +16,21 @@ extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
16#endif 16#endif
17 17
18/** 18/**
19 * Firmware PM callbacks 19 * struct pci_platform_pm_ops - Firmware PM callbacks
20 * 20 *
21 * @is_manageable - returns 'true' if given device is power manageable by the 21 * @is_manageable: returns 'true' if given device is power manageable by the
22 * platform firmware 22 * platform firmware
23 * 23 *
24 * @set_state - invokes the platform firmware to set the device's power state 24 * @set_state: invokes the platform firmware to set the device's power state
25 * 25 *
26 * @choose_state - returns PCI power state of given device preferred by the 26 * @choose_state: returns PCI power state of given device preferred by the
27 * platform; to be used during system-wide transitions from a 27 * platform; to be used during system-wide transitions from a
28 * sleeping state to the working state and vice versa 28 * sleeping state to the working state and vice versa
29 * 29 *
30 * @can_wakeup - returns 'true' if given device is capable of waking up the 30 * @can_wakeup: returns 'true' if given device is capable of waking up the
31 * system from a sleeping state 31 * system from a sleeping state
32 * 32 *
33 * @sleep_wake - enables/disables the system wake up capability of given device 33 * @sleep_wake: enables/disables the system wake up capability of given device
34 * 34 *
35 * If given platform is generally capable of power managing PCI devices, all of 35 * If given platform is generally capable of power managing PCI devices, all of
36 * these callbacks are mandatory. 36 * these callbacks are mandatory.
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index aac7006949f1..382575007382 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -108,6 +108,37 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
108} 108}
109#endif /* 0 */ 109#endif /* 0 */
110 110
111
112static void set_device_error_reporting(struct pci_dev *dev, void *data)
113{
114 bool enable = *((bool *)data);
115
116 if (dev->pcie_type != PCIE_RC_PORT &&
117 dev->pcie_type != PCIE_SW_UPSTREAM_PORT &&
118 dev->pcie_type != PCIE_SW_DOWNSTREAM_PORT)
119 return;
120
121 if (enable)
122 pci_enable_pcie_error_reporting(dev);
123 else
124 pci_disable_pcie_error_reporting(dev);
125}
126
127/**
128 * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports.
129 * @dev: pointer to root port's pci_dev data structure
130 * @enable: true = enable error reporting, false = disable error reporting.
131 */
132static void set_downstream_devices_error_reporting(struct pci_dev *dev,
133 bool enable)
134{
135 set_device_error_reporting(dev, &enable);
136
137 if (!dev->subordinate)
138 return;
139 pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable);
140}
141
111static int find_device_iter(struct device *device, void *data) 142static int find_device_iter(struct device *device, void *data)
112{ 143{
113 struct pci_dev *dev; 144 struct pci_dev *dev;
@@ -525,15 +556,11 @@ void aer_enable_rootport(struct aer_rpc *rpc)
525 pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, &reg32); 556 pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, &reg32);
526 pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); 557 pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32);
527 558
528 /* Enable Root Port device reporting error itself */ 559 /*
529 pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, &reg16); 560 * Enable error reporting for the root port device and downstream port
530 reg16 = reg16 | 561 * devices.
531 PCI_EXP_DEVCTL_CERE | 562 */
532 PCI_EXP_DEVCTL_NFERE | 563 set_downstream_devices_error_reporting(pdev, true);
533 PCI_EXP_DEVCTL_FERE |
534 PCI_EXP_DEVCTL_URRE;
535 pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL,
536 reg16);
537 564
538 /* Enable Root Port's interrupt in response to error messages */ 565 /* Enable Root Port's interrupt in response to error messages */
539 pci_write_config_dword(pdev, 566 pci_write_config_dword(pdev,
@@ -553,6 +580,12 @@ static void disable_root_aer(struct aer_rpc *rpc)
553 u32 reg32; 580 u32 reg32;
554 int pos; 581 int pos;
555 582
583 /*
584 * Disable error reporting for the root port device and downstream port
585 * devices.
586 */
587 set_downstream_devices_error_reporting(pdev, false);
588
556 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); 589 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
557 /* Disable Root's interrupt in response to error messages */ 590 /* Disable Root's interrupt in response to error messages */
558 pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0); 591 pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0);
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index f9b874eaeb9f..5ea566e20b37 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -97,14 +97,13 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
97 97
98 pcie_portdrv_save_config(dev); 98 pcie_portdrv_save_config(dev);
99 99
100 pci_enable_pcie_error_reporting(dev);
101
102 return 0; 100 return 0;
103} 101}
104 102
105static void pcie_portdrv_remove (struct pci_dev *dev) 103static void pcie_portdrv_remove (struct pci_dev *dev)
106{ 104{
107 pcie_port_device_remove(dev); 105 pcie_port_device_remove(dev);
106 pci_disable_device(dev);
108 kfree(pci_get_drvdata(dev)); 107 kfree(pci_get_drvdata(dev));
109} 108}
110 109
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index baad093aafe3..92b9efe9bcaf 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -23,6 +23,7 @@
23#include <linux/acpi.h> 23#include <linux/acpi.h>
24#include <linux/kallsyms.h> 24#include <linux/kallsyms.h>
25#include <linux/dmi.h> 25#include <linux/dmi.h>
26#include <linux/pci-aspm.h>
26#include "pci.h" 27#include "pci.h"
27 28
28int isa_dma_bridge_buggy; 29int isa_dma_bridge_buggy;
@@ -1584,6 +1585,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_
1584 */ 1585 */
1585#define AMD_813X_MISC 0x40 1586#define AMD_813X_MISC 0x40
1586#define AMD_813X_NOIOAMODE (1<<0) 1587#define AMD_813X_NOIOAMODE (1<<0)
1588#define AMD_813X_REV_B2 0x13
1587 1589
1588static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev) 1590static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev)
1589{ 1591{
@@ -1591,6 +1593,8 @@ static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev)
1591 1593
1592 if (noioapicquirk) 1594 if (noioapicquirk)
1593 return; 1595 return;
1596 if (dev->revision == AMD_813X_REV_B2)
1597 return;
1594 1598
1595 pci_read_config_dword(dev, AMD_813X_MISC, &pci_config_dword); 1599 pci_read_config_dword(dev, AMD_813X_MISC, &pci_config_dword);
1596 pci_config_dword &= ~AMD_813X_NOIOAMODE; 1600 pci_config_dword &= ~AMD_813X_NOIOAMODE;
@@ -1746,6 +1750,30 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1746} 1750}
1747DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt); 1751DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
1748 1752
1753/*
1754 * The 82575 and 82598 may experience data corruption issues when transitioning
1755 * out of L0S. To prevent this we need to disable L0S on the pci-e link
1756 */
1757static void __devinit quirk_disable_aspm_l0s(struct pci_dev *dev)
1758{
1759 dev_info(&dev->dev, "Disabling L0s\n");
1760 pci_disable_link_state(dev, PCIE_LINK_STATE_L0S);
1761}
1762DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s);
1763DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s);
1764DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s);
1765DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s);
1766DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s);
1767DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s);
1768DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s);
1769DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s);
1770DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s);
1771DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s);
1772DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s);
1773DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
1774DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
1775DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
1776
1749static void __devinit fixup_rev1_53c810(struct pci_dev* dev) 1777static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1750{ 1778{
1751 /* rev 1 ncr53c810 chips don't set the class at all which means 1779 /* rev 1 ncr53c810 chips don't set the class at all which means
@@ -1981,7 +2009,6 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
1981DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, 2009DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
1982 quirk_msi_ht_cap); 2010 quirk_msi_ht_cap);
1983 2011
1984
1985/* The nVidia CK804 chipset may have 2 HT MSI mappings. 2012/* The nVidia CK804 chipset may have 2 HT MSI mappings.
1986 * MSI are supported if the MSI capability set in any of these mappings. 2013 * MSI are supported if the MSI capability set in any of these mappings.
1987 */ 2014 */
@@ -2032,6 +2059,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
2032 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, 2059 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
2033 ht_enable_msi_mapping); 2060 ht_enable_msi_mapping);
2034 2061
2062DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE,
2063 ht_enable_msi_mapping);
2064
2035/* The P5N32-SLI Premium motherboard from Asus has a problem with msi 2065/* The P5N32-SLI Premium motherboard from Asus has a problem with msi
2036 * for the MCP55 NIC. It is not yet determined whether the msi problem 2066 * for the MCP55 NIC. It is not yet determined whether the msi problem
2037 * also affects other devices. As for now, turn off msi for this device. 2067 * also affects other devices. As for now, turn off msi for this device.
@@ -2048,11 +2078,105 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
2048 PCI_DEVICE_ID_NVIDIA_NVENET_15, 2078 PCI_DEVICE_ID_NVIDIA_NVENET_15,
2049 nvenet_msi_disable); 2079 nvenet_msi_disable);
2050 2080
2051static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) 2081static void __devinit nv_ht_enable_msi_mapping(struct pci_dev *dev)
2052{ 2082{
2053 struct pci_dev *host_bridge; 2083 struct pci_dev *host_bridge;
2084 int pos;
2085 int i, dev_no;
2086 int found = 0;
2087
2088 dev_no = dev->devfn >> 3;
2089 for (i = dev_no; i >= 0; i--) {
2090 host_bridge = pci_get_slot(dev->bus, PCI_DEVFN(i, 0));
2091 if (!host_bridge)
2092 continue;
2093
2094 pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
2095 if (pos != 0) {
2096 found = 1;
2097 break;
2098 }
2099 pci_dev_put(host_bridge);
2100 }
2101
2102 if (!found)
2103 return;
2104
2105 /* root did that ! */
2106 if (msi_ht_cap_enabled(host_bridge))
2107 goto out;
2108
2109 ht_enable_msi_mapping(dev);
2110
2111out:
2112 pci_dev_put(host_bridge);
2113}
2114
2115static void __devinit ht_disable_msi_mapping(struct pci_dev *dev)
2116{
2054 int pos, ttl = 48; 2117 int pos, ttl = 48;
2055 2118
2119 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
2120 while (pos && ttl--) {
2121 u8 flags;
2122
2123 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
2124 &flags) == 0) {
2125 dev_info(&dev->dev, "Disabling HT MSI Mapping\n");
2126
2127 pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
2128 flags & ~HT_MSI_FLAGS_ENABLE);
2129 }
2130 pos = pci_find_next_ht_capability(dev, pos,
2131 HT_CAPTYPE_MSI_MAPPING);
2132 }
2133}
2134
2135static int __devinit ht_check_msi_mapping(struct pci_dev *dev)
2136{
2137 int pos, ttl = 48;
2138 int found = 0;
2139
2140 /* check if there is HT MSI cap or enabled on this device */
2141 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
2142 while (pos && ttl--) {
2143 u8 flags;
2144
2145 if (found < 1)
2146 found = 1;
2147 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
2148 &flags) == 0) {
2149 if (flags & HT_MSI_FLAGS_ENABLE) {
2150 if (found < 2) {
2151 found = 2;
2152 break;
2153 }
2154 }
2155 }
2156 pos = pci_find_next_ht_capability(dev, pos,
2157 HT_CAPTYPE_MSI_MAPPING);
2158 }
2159
2160 return found;
2161}
2162
2163static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
2164{
2165 struct pci_dev *host_bridge;
2166 int pos;
2167 int found;
2168
2169 /* Enabling HT MSI mapping on this device breaks MCP51 */
2170 if (dev->device == 0x270)
2171 return;
2172
2173 /* check if there is HT MSI cap or enabled on this device */
2174 found = ht_check_msi_mapping(dev);
2175
2176 /* no HT MSI CAP */
2177 if (found == 0)
2178 return;
2179
2056 /* 2180 /*
2057 * HT MSI mapping should be disabled on devices that are below 2181 * HT MSI mapping should be disabled on devices that are below
2058 * a non-Hypertransport host bridge. Locate the host bridge... 2182 * a non-Hypertransport host bridge. Locate the host bridge...
@@ -2067,24 +2191,19 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
2067 pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); 2191 pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
2068 if (pos != 0) { 2192 if (pos != 0) {
2069 /* Host bridge is to HT */ 2193 /* Host bridge is to HT */
2070 ht_enable_msi_mapping(dev); 2194 if (found == 1) {
2195 /* it is not enabled, try to enable it */
2196 nv_ht_enable_msi_mapping(dev);
2197 }
2071 return; 2198 return;
2072 } 2199 }
2073 2200
2074 /* Host bridge is not to HT, disable HT MSI mapping on this device */ 2201 /* HT MSI is not enabled */
2075 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); 2202 if (found == 1)
2076 while (pos && ttl--) { 2203 return;
2077 u8 flags;
2078 2204
2079 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, 2205 /* Host bridge is not to HT, disable HT MSI mapping on this device */
2080 &flags) == 0) { 2206 ht_disable_msi_mapping(dev);
2081 dev_info(&dev->dev, "Disabling HT MSI mapping");
2082 pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
2083 flags & ~HT_MSI_FLAGS_ENABLE);
2084 }
2085 pos = pci_find_next_ht_capability(dev, pos,
2086 HT_CAPTYPE_MSI_MAPPING);
2087 }
2088} 2207}
2089DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); 2208DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk);
2090DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk); 2209DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk);
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 29cbe47f219f..36864a935d68 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -55,6 +55,7 @@ void pci_disable_rom(struct pci_dev *pdev)
55 55
56/** 56/**
57 * pci_get_rom_size - obtain the actual size of the ROM image 57 * pci_get_rom_size - obtain the actual size of the ROM image
58 * @pdev: target PCI device
58 * @rom: kernel virtual pointer to image of ROM 59 * @rom: kernel virtual pointer to image of ROM
59 * @size: size of PCI window 60 * @size: size of PCI window
60 * return: size of actual ROM image 61 * return: size of actual ROM image
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 94363115a42a..b3866ad50227 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -62,6 +62,7 @@ config DELL_LAPTOP
62 depends on EXPERIMENTAL 62 depends on EXPERIMENTAL
63 depends on BACKLIGHT_CLASS_DEVICE 63 depends on BACKLIGHT_CLASS_DEVICE
64 depends on RFKILL 64 depends on RFKILL
65 depends on POWER_SUPPLY
65 default n 66 default n
66 ---help--- 67 ---help---
67 This driver adds support for rfkill and backlight control to Dell 68 This driver adds support for rfkill and backlight control to Dell
@@ -301,6 +302,7 @@ config INTEL_MENLOW
301config EEEPC_LAPTOP 302config EEEPC_LAPTOP
302 tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" 303 tristate "Eee PC Hotkey Driver (EXPERIMENTAL)"
303 depends on ACPI 304 depends on ACPI
305 depends on INPUT
304 depends on EXPERIMENTAL 306 depends on EXPERIMENTAL
305 select BACKLIGHT_CLASS_DEVICE 307 select BACKLIGHT_CLASS_DEVICE
306 select HWMON 308 select HWMON
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 94c9f911824e..6bcca616a704 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1297,7 +1297,7 @@ static int __init acer_wmi_init(void)
1297 1297
1298 set_quirks(); 1298 set_quirks();
1299 1299
1300 if (!acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) { 1300 if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
1301 interface->capability &= ~ACER_CAP_BRIGHTNESS; 1301 interface->capability &= ~ACER_CAP_BRIGHTNESS;
1302 printk(ACER_INFO "Brightness must be controlled by " 1302 printk(ACER_INFO "Brightness must be controlled by "
1303 "generic video driver\n"); 1303 "generic video driver\n");
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 65dc41540c62..45940f31fe9e 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -166,6 +166,7 @@ struct fujitsu_hotkey_t {
166 struct platform_device *pf_device; 166 struct platform_device *pf_device;
167 struct kfifo *fifo; 167 struct kfifo *fifo;
168 spinlock_t fifo_lock; 168 spinlock_t fifo_lock;
169 int rfkill_supported;
169 int rfkill_state; 170 int rfkill_state;
170 int logolamp_registered; 171 int logolamp_registered;
171 int kblamps_registered; 172 int kblamps_registered;
@@ -526,7 +527,7 @@ static ssize_t
526show_lid_state(struct device *dev, 527show_lid_state(struct device *dev,
527 struct device_attribute *attr, char *buf) 528 struct device_attribute *attr, char *buf)
528{ 529{
529 if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) 530 if (!(fujitsu_hotkey->rfkill_supported & 0x100))
530 return sprintf(buf, "unknown\n"); 531 return sprintf(buf, "unknown\n");
531 if (fujitsu_hotkey->rfkill_state & 0x100) 532 if (fujitsu_hotkey->rfkill_state & 0x100)
532 return sprintf(buf, "open\n"); 533 return sprintf(buf, "open\n");
@@ -538,7 +539,7 @@ static ssize_t
538show_dock_state(struct device *dev, 539show_dock_state(struct device *dev,
539 struct device_attribute *attr, char *buf) 540 struct device_attribute *attr, char *buf)
540{ 541{
541 if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) 542 if (!(fujitsu_hotkey->rfkill_supported & 0x200))
542 return sprintf(buf, "unknown\n"); 543 return sprintf(buf, "unknown\n");
543 if (fujitsu_hotkey->rfkill_state & 0x200) 544 if (fujitsu_hotkey->rfkill_state & 0x200)
544 return sprintf(buf, "docked\n"); 545 return sprintf(buf, "docked\n");
@@ -550,7 +551,7 @@ static ssize_t
550show_radios_state(struct device *dev, 551show_radios_state(struct device *dev,
551 struct device_attribute *attr, char *buf) 552 struct device_attribute *attr, char *buf)
552{ 553{
553 if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) 554 if (!(fujitsu_hotkey->rfkill_supported & 0x20))
554 return sprintf(buf, "unknown\n"); 555 return sprintf(buf, "unknown\n");
555 if (fujitsu_hotkey->rfkill_state & 0x20) 556 if (fujitsu_hotkey->rfkill_state & 0x20)
556 return sprintf(buf, "on\n"); 557 return sprintf(buf, "on\n");
@@ -928,8 +929,17 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
928 ; /* No action, result is discarded */ 929 ; /* No action, result is discarded */
929 vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); 930 vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
930 931
931 fujitsu_hotkey->rfkill_state = 932 fujitsu_hotkey->rfkill_supported =
932 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); 933 call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
934
935 /* Make sure our bitmask of supported functions is cleared if the
936 RFKILL function block is not implemented, like on the S7020. */
937 if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
938 fujitsu_hotkey->rfkill_supported = 0;
939
940 if (fujitsu_hotkey->rfkill_supported)
941 fujitsu_hotkey->rfkill_state =
942 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
933 943
934 /* Suspect this is a keymap of the application panel, print it */ 944 /* Suspect this is a keymap of the application panel, print it */
935 printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", 945 printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n",
@@ -1005,8 +1015,9 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
1005 1015
1006 input = fujitsu_hotkey->input; 1016 input = fujitsu_hotkey->input;
1007 1017
1008 fujitsu_hotkey->rfkill_state = 1018 if (fujitsu_hotkey->rfkill_supported)
1009 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); 1019 fujitsu_hotkey->rfkill_state =
1020 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
1010 1021
1011 switch (event) { 1022 switch (event) {
1012 case ACPI_FUJITSU_NOTIFY_CODE1: 1023 case ACPI_FUJITSU_NOTIFY_CODE1:
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index 1d768928e0bb..a52d4a11652d 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -180,10 +180,13 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)
180 di->empty_uAh = battery_interpolate(scale, di->temp_C / 10); 180 di->empty_uAh = battery_interpolate(scale, di->temp_C / 10);
181 di->empty_uAh *= 1000; /* convert to µAh */ 181 di->empty_uAh *= 1000; /* convert to µAh */
182 182
183 /* From Maxim Application Note 131: remaining capacity = 183 if (di->full_active_uAh == di->empty_uAh)
184 * ((ICA - Empty Value) / (Full Value - Empty Value)) x 100% */ 184 di->rem_capacity = 0;
185 di->rem_capacity = ((di->accum_current_uAh - di->empty_uAh) * 100L) / 185 else
186 (di->full_active_uAh - di->empty_uAh); 186 /* From Maxim Application Note 131: remaining capacity =
187 * ((ICA - Empty Value) / (Full Value - Empty Value)) x 100% */
188 di->rem_capacity = ((di->accum_current_uAh - di->empty_uAh) * 100L) /
189 (di->full_active_uAh - di->empty_uAh);
187 190
188 if (di->rem_capacity < 0) 191 if (di->rem_capacity < 0)
189 di->rem_capacity = 0; 192 di->rem_capacity = 0;
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 1fd8f2193ed8..4377e93a43d7 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -280,8 +280,11 @@ sclp_dispatch_evbufs(struct sccb_header *sccb)
280 rc = 0; 280 rc = 0;
281 for (offset = sizeof(struct sccb_header); offset < sccb->length; 281 for (offset = sizeof(struct sccb_header); offset < sccb->length;
282 offset += evbuf->length) { 282 offset += evbuf->length) {
283 /* Search for event handler */
284 evbuf = (struct evbuf_header *) ((addr_t) sccb + offset); 283 evbuf = (struct evbuf_header *) ((addr_t) sccb + offset);
284 /* Check for malformed hardware response */
285 if (evbuf->length == 0)
286 break;
287 /* Search for event handler */
285 reg = NULL; 288 reg = NULL;
286 list_for_each(l, &sclp_reg_list) { 289 list_for_each(l, &sclp_reg_list) {
287 reg = list_entry(l, struct sclp_register, list); 290 reg = list_entry(l, struct sclp_register, list);
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 506390496416..77ab6e34a100 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -19,6 +19,7 @@
19#include <linux/memory.h> 19#include <linux/memory.h>
20#include <asm/chpid.h> 20#include <asm/chpid.h>
21#include <asm/sclp.h> 21#include <asm/sclp.h>
22#include <asm/setup.h>
22 23
23#include "sclp.h" 24#include "sclp.h"
24 25
@@ -474,6 +475,10 @@ static void __init add_memory_merged(u16 rn)
474 goto skip_add; 475 goto skip_add;
475 if (start + size > VMEM_MAX_PHYS) 476 if (start + size > VMEM_MAX_PHYS)
476 size = VMEM_MAX_PHYS - start; 477 size = VMEM_MAX_PHYS - start;
478 if (memory_end_set && (start >= memory_end))
479 goto skip_add;
480 if (memory_end_set && (start + size > memory_end))
481 size = memory_end - start;
477 add_memory(0, start, size); 482 add_memory(0, start, size);
478skip_add: 483skip_add:
479 first_rn = rn; 484 first_rn = rn;
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index f08e169ba1b5..7e30e5f6e032 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -129,7 +129,7 @@ static int wait_for_pin(struct bbc_i2c_bus *bp, u8 *status)
129 bp->waiting = 1; 129 bp->waiting = 1;
130 add_wait_queue(&bp->wq, &wait); 130 add_wait_queue(&bp->wq, &wait);
131 while (limit-- > 0) { 131 while (limit-- > 0) {
132 unsigned long val; 132 long val;
133 133
134 val = wait_event_interruptible_timeout( 134 val = wait_event_interruptible_timeout(
135 bp->wq, 135 bp->wq,
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index a9a9893a5f95..e6d1fc8c54f1 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -38,9 +38,6 @@
38#include <linux/string.h> 38#include <linux/string.h>
39#include <linux/genhd.h> 39#include <linux/genhd.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41
42#define MAJOR_NR JSFD_MAJOR
43
44#include <asm/uaccess.h> 41#include <asm/uaccess.h>
45#include <asm/pgtable.h> 42#include <asm/pgtable.h>
46#include <asm/io.h> 43#include <asm/io.h>
diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index fde6e4c634e7..a7cf550b9cca 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -20,6 +20,7 @@
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/netdevice.h> 21#include <linux/netdevice.h>
22#include <linux/scatterlist.h> 22#include <linux/scatterlist.h>
23#include <linux/skbuff.h>
23#include <scsi/libiscsi_tcp.h> 24#include <scsi/libiscsi_tcp.h>
24 25
25/* from cxgb3 LLD */ 26/* from cxgb3 LLD */
@@ -113,6 +114,26 @@ struct cxgb3i_endpoint {
113 struct cxgb3i_conn *cconn; 114 struct cxgb3i_conn *cconn;
114}; 115};
115 116
117/**
118 * struct cxgb3i_task_data - private iscsi task data
119 *
120 * @nr_frags: # of coalesced page frags (from scsi sgl)
121 * @frags: coalesced page frags (from scsi sgl)
122 * @skb: tx pdu skb
123 * @offset: data offset for the next pdu
124 * @count: max. possible pdu payload
125 * @sgoffset: offset to the first sg entry for a given offset
126 */
127#define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
128struct cxgb3i_task_data {
129 unsigned short nr_frags;
130 skb_frag_t frags[MAX_PDU_FRAGS];
131 struct sk_buff *skb;
132 unsigned int offset;
133 unsigned int count;
134 unsigned int sgoffset;
135};
136
116int cxgb3i_iscsi_init(void); 137int cxgb3i_iscsi_init(void);
117void cxgb3i_iscsi_cleanup(void); 138void cxgb3i_iscsi_cleanup(void);
118 139
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 08f3a09d9233..a83d36e4926f 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -639,10 +639,11 @@ static int ddp_init(struct t3cdev *tdev)
639 write_unlock(&cxgb3i_ddp_rwlock); 639 write_unlock(&cxgb3i_ddp_rwlock);
640 640
641 ddp_log_info("nppods %u (0x%x ~ 0x%x), bits %u, mask 0x%x,0x%x " 641 ddp_log_info("nppods %u (0x%x ~ 0x%x), bits %u, mask 0x%x,0x%x "
642 "pkt %u,%u.\n", 642 "pkt %u/%u, %u/%u.\n",
643 ppmax, ddp->llimit, ddp->ulimit, ddp->idx_bits, 643 ppmax, ddp->llimit, ddp->ulimit, ddp->idx_bits,
644 ddp->idx_mask, ddp->rsvd_tag_mask, 644 ddp->idx_mask, ddp->rsvd_tag_mask,
645 ddp->max_txsz, ddp->max_rxsz); 645 ddp->max_txsz, uinfo.max_txsz,
646 ddp->max_rxsz, uinfo.max_rxsz);
646 return 0; 647 return 0;
647 648
648free_ddp_map: 649free_ddp_map:
@@ -654,8 +655,8 @@ free_ddp_map:
654 * cxgb3i_adapter_ddp_init - initialize the adapter's ddp resource 655 * cxgb3i_adapter_ddp_init - initialize the adapter's ddp resource
655 * @tdev: t3cdev adapter 656 * @tdev: t3cdev adapter
656 * @tformat: tag format 657 * @tformat: tag format
657 * @txsz: max tx pkt size, filled in by this func. 658 * @txsz: max tx pdu payload size, filled in by this func.
658 * @rxsz: max rx pkt size, filled in by this func. 659 * @rxsz: max rx pdu payload size, filled in by this func.
659 * initialize the ddp pagepod manager for a given adapter if needed and 660 * initialize the ddp pagepod manager for a given adapter if needed and
660 * setup the tag format for a given iscsi entity 661 * setup the tag format for a given iscsi entity
661 */ 662 */
@@ -685,10 +686,12 @@ int cxgb3i_adapter_ddp_init(struct t3cdev *tdev,
685 tformat->sw_bits, tformat->rsvd_bits, 686 tformat->sw_bits, tformat->rsvd_bits,
686 tformat->rsvd_shift, tformat->rsvd_mask); 687 tformat->rsvd_shift, tformat->rsvd_mask);
687 688
688 *txsz = ddp->max_txsz; 689 *txsz = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
689 *rxsz = ddp->max_rxsz; 690 ddp->max_txsz - ISCSI_PDU_NONPAYLOAD_LEN);
690 ddp_log_info("ddp max pkt size: %u, %u.\n", 691 *rxsz = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
691 ddp->max_txsz, ddp->max_rxsz); 692 ddp->max_rxsz - ISCSI_PDU_NONPAYLOAD_LEN);
693 ddp_log_info("max payload size: %u/%u, %u/%u.\n",
694 *txsz, ddp->max_txsz, *rxsz, ddp->max_rxsz);
692 return 0; 695 return 0;
693} 696}
694EXPORT_SYMBOL_GPL(cxgb3i_adapter_ddp_init); 697EXPORT_SYMBOL_GPL(cxgb3i_adapter_ddp_init);
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 5c7c4d95c493..3faae7831c83 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -13,6 +13,8 @@
13#ifndef __CXGB3I_ULP2_DDP_H__ 13#ifndef __CXGB3I_ULP2_DDP_H__
14#define __CXGB3I_ULP2_DDP_H__ 14#define __CXGB3I_ULP2_DDP_H__
15 15
16#include <linux/vmalloc.h>
17
16/** 18/**
17 * struct cxgb3i_tag_format - cxgb3i ulp tag format for an iscsi entity 19 * struct cxgb3i_tag_format - cxgb3i ulp tag format for an iscsi entity
18 * 20 *
@@ -85,8 +87,9 @@ struct cxgb3i_ddp_info {
85 struct sk_buff **gl_skb; 87 struct sk_buff **gl_skb;
86}; 88};
87 89
90#define ISCSI_PDU_NONPAYLOAD_LEN 312 /* bhs(48) + ahs(256) + digest(8) */
88#define ULP2_MAX_PKT_SIZE 16224 91#define ULP2_MAX_PKT_SIZE 16224
89#define ULP2_MAX_PDU_PAYLOAD (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_MAX) 92#define ULP2_MAX_PDU_PAYLOAD (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_LEN)
90#define PPOD_PAGES_MAX 4 93#define PPOD_PAGES_MAX 4
91#define PPOD_PAGES_SHIFT 2 /* 4 pages per pod */ 94#define PPOD_PAGES_SHIFT 2 /* 4 pages per pod */
92 95
diff --git a/drivers/scsi/cxgb3i/cxgb3i_init.c b/drivers/scsi/cxgb3i/cxgb3i_init.c
index 091ecb4d9f3d..1ce9f244e46c 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_init.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_init.c
@@ -12,8 +12,8 @@
12#include "cxgb3i.h" 12#include "cxgb3i.h"
13 13
14#define DRV_MODULE_NAME "cxgb3i" 14#define DRV_MODULE_NAME "cxgb3i"
15#define DRV_MODULE_VERSION "1.0.0" 15#define DRV_MODULE_VERSION "1.0.1"
16#define DRV_MODULE_RELDATE "Jun. 1, 2008" 16#define DRV_MODULE_RELDATE "Jan. 2009"
17 17
18static char version[] = 18static char version[] =
19 "Chelsio S3xx iSCSI Driver " DRV_MODULE_NAME 19 "Chelsio S3xx iSCSI Driver " DRV_MODULE_NAME
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index d83464b9b3f9..fa2a44f37b36 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -364,7 +364,8 @@ cxgb3i_session_create(struct iscsi_endpoint *ep, u16 cmds_max, u16 qdepth,
364 364
365 cls_session = iscsi_session_setup(&cxgb3i_iscsi_transport, shost, 365 cls_session = iscsi_session_setup(&cxgb3i_iscsi_transport, shost,
366 cmds_max, 366 cmds_max,
367 sizeof(struct iscsi_tcp_task), 367 sizeof(struct iscsi_tcp_task) +
368 sizeof(struct cxgb3i_task_data),
368 initial_cmdsn, ISCSI_MAX_TARGET); 369 initial_cmdsn, ISCSI_MAX_TARGET);
369 if (!cls_session) 370 if (!cls_session)
370 return NULL; 371 return NULL;
@@ -402,17 +403,15 @@ static inline int cxgb3i_conn_max_xmit_dlength(struct iscsi_conn *conn)
402{ 403{
403 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 404 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
404 struct cxgb3i_conn *cconn = tcp_conn->dd_data; 405 struct cxgb3i_conn *cconn = tcp_conn->dd_data;
405 unsigned int max = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, 406 unsigned int max = max(512 * MAX_SKB_FRAGS, SKB_TX_HEADROOM);
406 cconn->hba->snic->tx_max_size -
407 ISCSI_PDU_NONPAYLOAD_MAX);
408 407
408 max = min(cconn->hba->snic->tx_max_size, max);
409 if (conn->max_xmit_dlength) 409 if (conn->max_xmit_dlength)
410 conn->max_xmit_dlength = min_t(unsigned int, 410 conn->max_xmit_dlength = min(conn->max_xmit_dlength, max);
411 conn->max_xmit_dlength, max);
412 else 411 else
413 conn->max_xmit_dlength = max; 412 conn->max_xmit_dlength = max;
414 align_pdu_size(conn->max_xmit_dlength); 413 align_pdu_size(conn->max_xmit_dlength);
415 cxgb3i_log_info("conn 0x%p, max xmit %u.\n", 414 cxgb3i_api_debug("conn 0x%p, max xmit %u.\n",
416 conn, conn->max_xmit_dlength); 415 conn, conn->max_xmit_dlength);
417 return 0; 416 return 0;
418} 417}
@@ -427,9 +426,7 @@ static inline int cxgb3i_conn_max_recv_dlength(struct iscsi_conn *conn)
427{ 426{
428 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 427 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
429 struct cxgb3i_conn *cconn = tcp_conn->dd_data; 428 struct cxgb3i_conn *cconn = tcp_conn->dd_data;
430 unsigned int max = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, 429 unsigned int max = cconn->hba->snic->rx_max_size;
431 cconn->hba->snic->rx_max_size -
432 ISCSI_PDU_NONPAYLOAD_MAX);
433 430
434 align_pdu_size(max); 431 align_pdu_size(max);
435 if (conn->max_recv_dlength) { 432 if (conn->max_recv_dlength) {
@@ -439,8 +436,7 @@ static inline int cxgb3i_conn_max_recv_dlength(struct iscsi_conn *conn)
439 conn->max_recv_dlength, max); 436 conn->max_recv_dlength, max);
440 return -EINVAL; 437 return -EINVAL;
441 } 438 }
442 conn->max_recv_dlength = min_t(unsigned int, 439 conn->max_recv_dlength = min(conn->max_recv_dlength, max);
443 conn->max_recv_dlength, max);
444 align_pdu_size(conn->max_recv_dlength); 440 align_pdu_size(conn->max_recv_dlength);
445 } else 441 } else
446 conn->max_recv_dlength = max; 442 conn->max_recv_dlength = max;
@@ -844,7 +840,7 @@ static struct scsi_host_template cxgb3i_host_template = {
844 .proc_name = "cxgb3i", 840 .proc_name = "cxgb3i",
845 .queuecommand = iscsi_queuecommand, 841 .queuecommand = iscsi_queuecommand,
846 .change_queue_depth = iscsi_change_queue_depth, 842 .change_queue_depth = iscsi_change_queue_depth,
847 .can_queue = 128 * (ISCSI_DEF_XMIT_CMDS_MAX - 1), 843 .can_queue = CXGB3I_SCSI_QDEPTH_DFLT - 1,
848 .sg_tablesize = SG_ALL, 844 .sg_tablesize = SG_ALL,
849 .max_sectors = 0xFFFF, 845 .max_sectors = 0xFFFF,
850 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, 846 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index a865f1fefe8b..de3b3b614cca 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -23,19 +23,19 @@
23#include "cxgb3i_ddp.h" 23#include "cxgb3i_ddp.h"
24 24
25#ifdef __DEBUG_C3CN_CONN__ 25#ifdef __DEBUG_C3CN_CONN__
26#define c3cn_conn_debug cxgb3i_log_info 26#define c3cn_conn_debug cxgb3i_log_debug
27#else 27#else
28#define c3cn_conn_debug(fmt...) 28#define c3cn_conn_debug(fmt...)
29#endif 29#endif
30 30
31#ifdef __DEBUG_C3CN_TX__ 31#ifdef __DEBUG_C3CN_TX__
32#define c3cn_tx_debug cxgb3i_log_debug 32#define c3cn_tx_debug cxgb3i_log_debug
33#else 33#else
34#define c3cn_tx_debug(fmt...) 34#define c3cn_tx_debug(fmt...)
35#endif 35#endif
36 36
37#ifdef __DEBUG_C3CN_RX__ 37#ifdef __DEBUG_C3CN_RX__
38#define c3cn_rx_debug cxgb3i_log_debug 38#define c3cn_rx_debug cxgb3i_log_debug
39#else 39#else
40#define c3cn_rx_debug(fmt...) 40#define c3cn_rx_debug(fmt...)
41#endif 41#endif
@@ -47,9 +47,9 @@ static int cxgb3_rcv_win = 256 * 1024;
47module_param(cxgb3_rcv_win, int, 0644); 47module_param(cxgb3_rcv_win, int, 0644);
48MODULE_PARM_DESC(cxgb3_rcv_win, "TCP receive window in bytes (default=256KB)"); 48MODULE_PARM_DESC(cxgb3_rcv_win, "TCP receive window in bytes (default=256KB)");
49 49
50static int cxgb3_snd_win = 64 * 1024; 50static int cxgb3_snd_win = 128 * 1024;
51module_param(cxgb3_snd_win, int, 0644); 51module_param(cxgb3_snd_win, int, 0644);
52MODULE_PARM_DESC(cxgb3_snd_win, "TCP send window in bytes (default=64KB)"); 52MODULE_PARM_DESC(cxgb3_snd_win, "TCP send window in bytes (default=128KB)");
53 53
54static int cxgb3_rx_credit_thres = 10 * 1024; 54static int cxgb3_rx_credit_thres = 10 * 1024;
55module_param(cxgb3_rx_credit_thres, int, 0644); 55module_param(cxgb3_rx_credit_thres, int, 0644);
@@ -301,8 +301,8 @@ static void act_open_req_arp_failure(struct t3cdev *dev, struct sk_buff *skb)
301static void skb_entail(struct s3_conn *c3cn, struct sk_buff *skb, 301static void skb_entail(struct s3_conn *c3cn, struct sk_buff *skb,
302 int flags) 302 int flags)
303{ 303{
304 CXGB3_SKB_CB(skb)->seq = c3cn->write_seq; 304 skb_tcp_seq(skb) = c3cn->write_seq;
305 CXGB3_SKB_CB(skb)->flags = flags; 305 skb_flags(skb) = flags;
306 __skb_queue_tail(&c3cn->write_queue, skb); 306 __skb_queue_tail(&c3cn->write_queue, skb);
307} 307}
308 308
@@ -457,12 +457,9 @@ static unsigned int wrlen __read_mostly;
457 * The number of WRs needed for an skb depends on the number of fragments 457 * The number of WRs needed for an skb depends on the number of fragments
458 * in the skb and whether it has any payload in its main body. This maps the 458 * in the skb and whether it has any payload in its main body. This maps the
459 * length of the gather list represented by an skb into the # of necessary WRs. 459 * length of the gather list represented by an skb into the # of necessary WRs.
460 * 460 * The extra two fragments are for iscsi bhs and payload padding.
461 * The max. length of an skb is controlled by the max pdu size which is ~16K.
462 * Also, assume the min. fragment length is the sector size (512), then add
463 * extra fragment counts for iscsi bhs and payload padding.
464 */ 461 */
465#define SKB_WR_LIST_SIZE (16384/512 + 3) 462#define SKB_WR_LIST_SIZE (MAX_SKB_FRAGS + 2)
466static unsigned int skb_wrs[SKB_WR_LIST_SIZE] __read_mostly; 463static unsigned int skb_wrs[SKB_WR_LIST_SIZE] __read_mostly;
467 464
468static void s3_init_wr_tab(unsigned int wr_len) 465static void s3_init_wr_tab(unsigned int wr_len)
@@ -485,7 +482,7 @@ static void s3_init_wr_tab(unsigned int wr_len)
485 482
486static inline void reset_wr_list(struct s3_conn *c3cn) 483static inline void reset_wr_list(struct s3_conn *c3cn)
487{ 484{
488 c3cn->wr_pending_head = NULL; 485 c3cn->wr_pending_head = c3cn->wr_pending_tail = NULL;
489} 486}
490 487
491/* 488/*
@@ -496,7 +493,7 @@ static inline void reset_wr_list(struct s3_conn *c3cn)
496static inline void enqueue_wr(struct s3_conn *c3cn, 493static inline void enqueue_wr(struct s3_conn *c3cn,
497 struct sk_buff *skb) 494 struct sk_buff *skb)
498{ 495{
499 skb_wr_data(skb) = NULL; 496 skb_tx_wr_next(skb) = NULL;
500 497
501 /* 498 /*
502 * We want to take an extra reference since both us and the driver 499 * We want to take an extra reference since both us and the driver
@@ -509,10 +506,22 @@ static inline void enqueue_wr(struct s3_conn *c3cn,
509 if (!c3cn->wr_pending_head) 506 if (!c3cn->wr_pending_head)
510 c3cn->wr_pending_head = skb; 507 c3cn->wr_pending_head = skb;
511 else 508 else
512 skb_wr_data(skb) = skb; 509 skb_tx_wr_next(c3cn->wr_pending_tail) = skb;
513 c3cn->wr_pending_tail = skb; 510 c3cn->wr_pending_tail = skb;
514} 511}
515 512
513static int count_pending_wrs(struct s3_conn *c3cn)
514{
515 int n = 0;
516 const struct sk_buff *skb = c3cn->wr_pending_head;
517
518 while (skb) {
519 n += skb->csum;
520 skb = skb_tx_wr_next(skb);
521 }
522 return n;
523}
524
516static inline struct sk_buff *peek_wr(const struct s3_conn *c3cn) 525static inline struct sk_buff *peek_wr(const struct s3_conn *c3cn)
517{ 526{
518 return c3cn->wr_pending_head; 527 return c3cn->wr_pending_head;
@@ -529,8 +538,8 @@ static inline struct sk_buff *dequeue_wr(struct s3_conn *c3cn)
529 538
530 if (likely(skb)) { 539 if (likely(skb)) {
531 /* Don't bother clearing the tail */ 540 /* Don't bother clearing the tail */
532 c3cn->wr_pending_head = skb_wr_data(skb); 541 c3cn->wr_pending_head = skb_tx_wr_next(skb);
533 skb_wr_data(skb) = NULL; 542 skb_tx_wr_next(skb) = NULL;
534 } 543 }
535 return skb; 544 return skb;
536} 545}
@@ -543,13 +552,14 @@ static void purge_wr_queue(struct s3_conn *c3cn)
543} 552}
544 553
545static inline void make_tx_data_wr(struct s3_conn *c3cn, struct sk_buff *skb, 554static inline void make_tx_data_wr(struct s3_conn *c3cn, struct sk_buff *skb,
546 int len) 555 int len, int req_completion)
547{ 556{
548 struct tx_data_wr *req; 557 struct tx_data_wr *req;
549 558
550 skb_reset_transport_header(skb); 559 skb_reset_transport_header(skb);
551 req = (struct tx_data_wr *)__skb_push(skb, sizeof(*req)); 560 req = (struct tx_data_wr *)__skb_push(skb, sizeof(*req));
552 req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)); 561 req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA) |
562 (req_completion ? F_WR_COMPL : 0));
553 req->wr_lo = htonl(V_WR_TID(c3cn->tid)); 563 req->wr_lo = htonl(V_WR_TID(c3cn->tid));
554 req->sndseq = htonl(c3cn->snd_nxt); 564 req->sndseq = htonl(c3cn->snd_nxt);
555 /* len includes the length of any HW ULP additions */ 565 /* len includes the length of any HW ULP additions */
@@ -592,7 +602,7 @@ static int c3cn_push_tx_frames(struct s3_conn *c3cn, int req_completion)
592 602
593 if (unlikely(c3cn->state == C3CN_STATE_CONNECTING || 603 if (unlikely(c3cn->state == C3CN_STATE_CONNECTING ||
594 c3cn->state == C3CN_STATE_CLOSE_WAIT_1 || 604 c3cn->state == C3CN_STATE_CLOSE_WAIT_1 ||
595 c3cn->state == C3CN_STATE_ABORTING)) { 605 c3cn->state >= C3CN_STATE_ABORTING)) {
596 c3cn_tx_debug("c3cn 0x%p, in closing state %u.\n", 606 c3cn_tx_debug("c3cn 0x%p, in closing state %u.\n",
597 c3cn, c3cn->state); 607 c3cn, c3cn->state);
598 return 0; 608 return 0;
@@ -615,7 +625,7 @@ static int c3cn_push_tx_frames(struct s3_conn *c3cn, int req_completion)
615 if (c3cn->wr_avail < wrs_needed) { 625 if (c3cn->wr_avail < wrs_needed) {
616 c3cn_tx_debug("c3cn 0x%p, skb len %u/%u, frag %u, " 626 c3cn_tx_debug("c3cn 0x%p, skb len %u/%u, frag %u, "
617 "wr %d < %u.\n", 627 "wr %d < %u.\n",
618 c3cn, skb->len, skb->datalen, frags, 628 c3cn, skb->len, skb->data_len, frags,
619 wrs_needed, c3cn->wr_avail); 629 wrs_needed, c3cn->wr_avail);
620 break; 630 break;
621 } 631 }
@@ -627,20 +637,24 @@ static int c3cn_push_tx_frames(struct s3_conn *c3cn, int req_completion)
627 c3cn->wr_unacked += wrs_needed; 637 c3cn->wr_unacked += wrs_needed;
628 enqueue_wr(c3cn, skb); 638 enqueue_wr(c3cn, skb);
629 639
630 if (likely(CXGB3_SKB_CB(skb)->flags & C3CB_FLAG_NEED_HDR)) { 640 c3cn_tx_debug("c3cn 0x%p, enqueue, skb len %u/%u, frag %u, "
631 len += ulp_extra_len(skb); 641 "wr %d, left %u, unack %u.\n",
632 make_tx_data_wr(c3cn, skb, len); 642 c3cn, skb->len, skb->data_len, frags,
633 c3cn->snd_nxt += len; 643 wrs_needed, c3cn->wr_avail, c3cn->wr_unacked);
634 if ((req_completion 644
635 && c3cn->wr_unacked == wrs_needed)
636 || (CXGB3_SKB_CB(skb)->flags & C3CB_FLAG_COMPL)
637 || c3cn->wr_unacked >= c3cn->wr_max / 2) {
638 struct work_request_hdr *wr = cplhdr(skb);
639 645
640 wr->wr_hi |= htonl(F_WR_COMPL); 646 if (likely(skb_flags(skb) & C3CB_FLAG_NEED_HDR)) {
647 if ((req_completion &&
648 c3cn->wr_unacked == wrs_needed) ||
649 (skb_flags(skb) & C3CB_FLAG_COMPL) ||
650 c3cn->wr_unacked >= c3cn->wr_max / 2) {
651 req_completion = 1;
641 c3cn->wr_unacked = 0; 652 c3cn->wr_unacked = 0;
642 } 653 }
643 CXGB3_SKB_CB(skb)->flags &= ~C3CB_FLAG_NEED_HDR; 654 len += ulp_extra_len(skb);
655 make_tx_data_wr(c3cn, skb, len, req_completion);
656 c3cn->snd_nxt += len;
657 skb_flags(skb) &= ~C3CB_FLAG_NEED_HDR;
644 } 658 }
645 659
646 total_size += skb->truesize; 660 total_size += skb->truesize;
@@ -735,8 +749,11 @@ static void process_act_establish(struct s3_conn *c3cn, struct sk_buff *skb)
735 if (unlikely(c3cn_flag(c3cn, C3CN_ACTIVE_CLOSE_NEEDED))) 749 if (unlikely(c3cn_flag(c3cn, C3CN_ACTIVE_CLOSE_NEEDED)))
736 /* upper layer has requested closing */ 750 /* upper layer has requested closing */
737 send_abort_req(c3cn); 751 send_abort_req(c3cn);
738 else if (c3cn_push_tx_frames(c3cn, 1)) 752 else {
753 if (skb_queue_len(&c3cn->write_queue))
754 c3cn_push_tx_frames(c3cn, 1);
739 cxgb3i_conn_tx_open(c3cn); 755 cxgb3i_conn_tx_open(c3cn);
756 }
740} 757}
741 758
742static int do_act_establish(struct t3cdev *cdev, struct sk_buff *skb, 759static int do_act_establish(struct t3cdev *cdev, struct sk_buff *skb,
@@ -1082,8 +1099,8 @@ static void process_rx_iscsi_hdr(struct s3_conn *c3cn, struct sk_buff *skb)
1082 return; 1099 return;
1083 } 1100 }
1084 1101
1085 CXGB3_SKB_CB(skb)->seq = ntohl(hdr_cpl->seq); 1102 skb_tcp_seq(skb) = ntohl(hdr_cpl->seq);
1086 CXGB3_SKB_CB(skb)->flags = 0; 1103 skb_flags(skb) = 0;
1087 1104
1088 skb_reset_transport_header(skb); 1105 skb_reset_transport_header(skb);
1089 __skb_pull(skb, sizeof(struct cpl_iscsi_hdr)); 1106 __skb_pull(skb, sizeof(struct cpl_iscsi_hdr));
@@ -1103,12 +1120,12 @@ static void process_rx_iscsi_hdr(struct s3_conn *c3cn, struct sk_buff *skb)
1103 goto abort_conn; 1120 goto abort_conn;
1104 1121
1105 skb_ulp_mode(skb) = ULP2_FLAG_DATA_READY; 1122 skb_ulp_mode(skb) = ULP2_FLAG_DATA_READY;
1106 skb_ulp_pdulen(skb) = ntohs(ddp_cpl.len); 1123 skb_rx_pdulen(skb) = ntohs(ddp_cpl.len);
1107 skb_ulp_ddigest(skb) = ntohl(ddp_cpl.ulp_crc); 1124 skb_rx_ddigest(skb) = ntohl(ddp_cpl.ulp_crc);
1108 status = ntohl(ddp_cpl.ddp_status); 1125 status = ntohl(ddp_cpl.ddp_status);
1109 1126
1110 c3cn_rx_debug("rx skb 0x%p, len %u, pdulen %u, ddp status 0x%x.\n", 1127 c3cn_rx_debug("rx skb 0x%p, len %u, pdulen %u, ddp status 0x%x.\n",
1111 skb, skb->len, skb_ulp_pdulen(skb), status); 1128 skb, skb->len, skb_rx_pdulen(skb), status);
1112 1129
1113 if (status & (1 << RX_DDP_STATUS_HCRC_SHIFT)) 1130 if (status & (1 << RX_DDP_STATUS_HCRC_SHIFT))
1114 skb_ulp_mode(skb) |= ULP2_FLAG_HCRC_ERROR; 1131 skb_ulp_mode(skb) |= ULP2_FLAG_HCRC_ERROR;
@@ -1126,7 +1143,7 @@ static void process_rx_iscsi_hdr(struct s3_conn *c3cn, struct sk_buff *skb)
1126 } else if (status & (1 << RX_DDP_STATUS_DDP_SHIFT)) 1143 } else if (status & (1 << RX_DDP_STATUS_DDP_SHIFT))
1127 skb_ulp_mode(skb) |= ULP2_FLAG_DATA_DDPED; 1144 skb_ulp_mode(skb) |= ULP2_FLAG_DATA_DDPED;
1128 1145
1129 c3cn->rcv_nxt = ntohl(ddp_cpl.seq) + skb_ulp_pdulen(skb); 1146 c3cn->rcv_nxt = ntohl(ddp_cpl.seq) + skb_rx_pdulen(skb);
1130 __pskb_trim(skb, len); 1147 __pskb_trim(skb, len);
1131 __skb_queue_tail(&c3cn->receive_queue, skb); 1148 __skb_queue_tail(&c3cn->receive_queue, skb);
1132 cxgb3i_conn_pdu_ready(c3cn); 1149 cxgb3i_conn_pdu_ready(c3cn);
@@ -1151,12 +1168,27 @@ static int do_iscsi_hdr(struct t3cdev *t3dev, struct sk_buff *skb, void *ctx)
1151 * Process an acknowledgment of WR completion. Advance snd_una and send the 1168 * Process an acknowledgment of WR completion. Advance snd_una and send the
1152 * next batch of work requests from the write queue. 1169 * next batch of work requests from the write queue.
1153 */ 1170 */
1171static void check_wr_invariants(struct s3_conn *c3cn)
1172{
1173 int pending = count_pending_wrs(c3cn);
1174
1175 if (unlikely(c3cn->wr_avail + pending != c3cn->wr_max))
1176 cxgb3i_log_error("TID %u: credit imbalance: avail %u, "
1177 "pending %u, total should be %u\n",
1178 c3cn->tid, c3cn->wr_avail, pending,
1179 c3cn->wr_max);
1180}
1181
1154static void process_wr_ack(struct s3_conn *c3cn, struct sk_buff *skb) 1182static void process_wr_ack(struct s3_conn *c3cn, struct sk_buff *skb)
1155{ 1183{
1156 struct cpl_wr_ack *hdr = cplhdr(skb); 1184 struct cpl_wr_ack *hdr = cplhdr(skb);
1157 unsigned int credits = ntohs(hdr->credits); 1185 unsigned int credits = ntohs(hdr->credits);
1158 u32 snd_una = ntohl(hdr->snd_una); 1186 u32 snd_una = ntohl(hdr->snd_una);
1159 1187
1188 c3cn_tx_debug("%u WR credits, avail %u, unack %u, TID %u, state %u.\n",
1189 credits, c3cn->wr_avail, c3cn->wr_unacked,
1190 c3cn->tid, c3cn->state);
1191
1160 c3cn->wr_avail += credits; 1192 c3cn->wr_avail += credits;
1161 if (c3cn->wr_unacked > c3cn->wr_max - c3cn->wr_avail) 1193 if (c3cn->wr_unacked > c3cn->wr_max - c3cn->wr_avail)
1162 c3cn->wr_unacked = c3cn->wr_max - c3cn->wr_avail; 1194 c3cn->wr_unacked = c3cn->wr_max - c3cn->wr_avail;
@@ -1171,6 +1203,17 @@ static void process_wr_ack(struct s3_conn *c3cn, struct sk_buff *skb)
1171 break; 1203 break;
1172 } 1204 }
1173 if (unlikely(credits < p->csum)) { 1205 if (unlikely(credits < p->csum)) {
1206 struct tx_data_wr *w = cplhdr(p);
1207 cxgb3i_log_error("TID %u got %u WR credits need %u, "
1208 "len %u, main body %u, frags %u, "
1209 "seq # %u, ACK una %u, ACK nxt %u, "
1210 "WR_AVAIL %u, WRs pending %u\n",
1211 c3cn->tid, credits, p->csum, p->len,
1212 p->len - p->data_len,
1213 skb_shinfo(p)->nr_frags,
1214 ntohl(w->sndseq), snd_una,
1215 ntohl(hdr->snd_nxt), c3cn->wr_avail,
1216 count_pending_wrs(c3cn) - credits);
1174 p->csum -= credits; 1217 p->csum -= credits;
1175 break; 1218 break;
1176 } else { 1219 } else {
@@ -1180,15 +1223,24 @@ static void process_wr_ack(struct s3_conn *c3cn, struct sk_buff *skb)
1180 } 1223 }
1181 } 1224 }
1182 1225
1183 if (unlikely(before(snd_una, c3cn->snd_una))) 1226 check_wr_invariants(c3cn);
1227
1228 if (unlikely(before(snd_una, c3cn->snd_una))) {
1229 cxgb3i_log_error("TID %u, unexpected sequence # %u in WR_ACK "
1230 "snd_una %u\n",
1231 c3cn->tid, snd_una, c3cn->snd_una);
1184 goto out_free; 1232 goto out_free;
1233 }
1185 1234
1186 if (c3cn->snd_una != snd_una) { 1235 if (c3cn->snd_una != snd_una) {
1187 c3cn->snd_una = snd_una; 1236 c3cn->snd_una = snd_una;
1188 dst_confirm(c3cn->dst_cache); 1237 dst_confirm(c3cn->dst_cache);
1189 } 1238 }
1190 1239
1191 if (skb_queue_len(&c3cn->write_queue) && c3cn_push_tx_frames(c3cn, 0)) 1240 if (skb_queue_len(&c3cn->write_queue)) {
1241 if (c3cn_push_tx_frames(c3cn, 0))
1242 cxgb3i_conn_tx_open(c3cn);
1243 } else
1192 cxgb3i_conn_tx_open(c3cn); 1244 cxgb3i_conn_tx_open(c3cn);
1193out_free: 1245out_free:
1194 __kfree_skb(skb); 1246 __kfree_skb(skb);
@@ -1452,7 +1504,7 @@ static void init_offload_conn(struct s3_conn *c3cn,
1452 struct dst_entry *dst) 1504 struct dst_entry *dst)
1453{ 1505{
1454 BUG_ON(c3cn->cdev != cdev); 1506 BUG_ON(c3cn->cdev != cdev);
1455 c3cn->wr_max = c3cn->wr_avail = T3C_DATA(cdev)->max_wrs; 1507 c3cn->wr_max = c3cn->wr_avail = T3C_DATA(cdev)->max_wrs - 1;
1456 c3cn->wr_unacked = 0; 1508 c3cn->wr_unacked = 0;
1457 c3cn->mss_idx = select_mss(c3cn, dst_mtu(dst)); 1509 c3cn->mss_idx = select_mss(c3cn, dst_mtu(dst));
1458 1510
@@ -1671,9 +1723,17 @@ int cxgb3i_c3cn_send_pdus(struct s3_conn *c3cn, struct sk_buff *skb)
1671 goto out_err; 1723 goto out_err;
1672 } 1724 }
1673 1725
1674 err = -EPIPE;
1675 if (c3cn->err) { 1726 if (c3cn->err) {
1676 c3cn_tx_debug("c3cn 0x%p, err %d.\n", c3cn, c3cn->err); 1727 c3cn_tx_debug("c3cn 0x%p, err %d.\n", c3cn, c3cn->err);
1728 err = -EPIPE;
1729 goto out_err;
1730 }
1731
1732 if (c3cn->write_seq - c3cn->snd_una >= cxgb3_snd_win) {
1733 c3cn_tx_debug("c3cn 0x%p, snd %u - %u > %u.\n",
1734 c3cn, c3cn->write_seq, c3cn->snd_una,
1735 cxgb3_snd_win);
1736 err = -EAGAIN;
1677 goto out_err; 1737 goto out_err;
1678 } 1738 }
1679 1739
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.h b/drivers/scsi/cxgb3i/cxgb3i_offload.h
index d23156907ffd..6344b9eb2589 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.h
@@ -178,25 +178,33 @@ void cxgb3i_c3cn_release(struct s3_conn *);
178 * @flag: see C3CB_FLAG_* below 178 * @flag: see C3CB_FLAG_* below
179 * @ulp_mode: ULP mode/submode of sk_buff 179 * @ulp_mode: ULP mode/submode of sk_buff
180 * @seq: tcp sequence number 180 * @seq: tcp sequence number
181 * @ddigest: pdu data digest
182 * @pdulen: recovered pdu length
183 * @wr_data: scratch area for tx wr
184 */ 181 */
182struct cxgb3_skb_rx_cb {
183 __u32 ddigest; /* data digest */
184 __u32 pdulen; /* recovered pdu length */
185};
186
187struct cxgb3_skb_tx_cb {
188 struct sk_buff *wr_next; /* next wr */
189};
190
185struct cxgb3_skb_cb { 191struct cxgb3_skb_cb {
186 __u8 flags; 192 __u8 flags;
187 __u8 ulp_mode; 193 __u8 ulp_mode;
188 __u32 seq; 194 __u32 seq;
189 __u32 ddigest; 195 union {
190 __u32 pdulen; 196 struct cxgb3_skb_rx_cb rx;
191 struct sk_buff *wr_data; 197 struct cxgb3_skb_tx_cb tx;
198 };
192}; 199};
193 200
194#define CXGB3_SKB_CB(skb) ((struct cxgb3_skb_cb *)&((skb)->cb[0])) 201#define CXGB3_SKB_CB(skb) ((struct cxgb3_skb_cb *)&((skb)->cb[0]))
195 202#define skb_flags(skb) (CXGB3_SKB_CB(skb)->flags)
196#define skb_ulp_mode(skb) (CXGB3_SKB_CB(skb)->ulp_mode) 203#define skb_ulp_mode(skb) (CXGB3_SKB_CB(skb)->ulp_mode)
197#define skb_ulp_ddigest(skb) (CXGB3_SKB_CB(skb)->ddigest) 204#define skb_tcp_seq(skb) (CXGB3_SKB_CB(skb)->seq)
198#define skb_ulp_pdulen(skb) (CXGB3_SKB_CB(skb)->pdulen) 205#define skb_rx_ddigest(skb) (CXGB3_SKB_CB(skb)->rx.ddigest)
199#define skb_wr_data(skb) (CXGB3_SKB_CB(skb)->wr_data) 206#define skb_rx_pdulen(skb) (CXGB3_SKB_CB(skb)->rx.pdulen)
207#define skb_tx_wr_next(skb) (CXGB3_SKB_CB(skb)->tx.wr_next)
200 208
201enum c3cb_flags { 209enum c3cb_flags {
202 C3CB_FLAG_NEED_HDR = 1 << 0, /* packet needs a TX_DATA_WR header */ 210 C3CB_FLAG_NEED_HDR = 1 << 0, /* packet needs a TX_DATA_WR header */
@@ -217,6 +225,7 @@ struct sge_opaque_hdr {
217/* for TX: a skb must have a headroom of at least TX_HEADER_LEN bytes */ 225/* for TX: a skb must have a headroom of at least TX_HEADER_LEN bytes */
218#define TX_HEADER_LEN \ 226#define TX_HEADER_LEN \
219 (sizeof(struct tx_data_wr) + sizeof(struct sge_opaque_hdr)) 227 (sizeof(struct tx_data_wr) + sizeof(struct sge_opaque_hdr))
228#define SKB_TX_HEADROOM SKB_MAX_HEAD(TX_HEADER_LEN)
220 229
221/* 230/*
222 * get and set private ip for iscsi traffic 231 * get and set private ip for iscsi traffic
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
index ce7ce8c6094c..17115c230d65 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
@@ -32,6 +32,10 @@
32#define cxgb3i_tx_debug(fmt...) 32#define cxgb3i_tx_debug(fmt...)
33#endif 33#endif
34 34
35/* always allocate rooms for AHS */
36#define SKB_TX_PDU_HEADER_LEN \
37 (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE)
38static unsigned int skb_extra_headroom;
35static struct page *pad_page; 39static struct page *pad_page;
36 40
37/* 41/*
@@ -146,12 +150,13 @@ static inline void tx_skb_setmode(struct sk_buff *skb, int hcrc, int dcrc)
146 150
147void cxgb3i_conn_cleanup_task(struct iscsi_task *task) 151void cxgb3i_conn_cleanup_task(struct iscsi_task *task)
148{ 152{
149 struct iscsi_tcp_task *tcp_task = task->dd_data; 153 struct cxgb3i_task_data *tdata = task->dd_data +
154 sizeof(struct iscsi_tcp_task);
150 155
151 /* never reached the xmit task callout */ 156 /* never reached the xmit task callout */
152 if (tcp_task->dd_data) 157 if (tdata->skb)
153 kfree_skb(tcp_task->dd_data); 158 __kfree_skb(tdata->skb);
154 tcp_task->dd_data = NULL; 159 memset(tdata, 0, sizeof(struct cxgb3i_task_data));
155 160
156 /* MNC - Do we need a check in case this is called but 161 /* MNC - Do we need a check in case this is called but
157 * cxgb3i_conn_alloc_pdu has never been called on the task */ 162 * cxgb3i_conn_alloc_pdu has never been called on the task */
@@ -159,28 +164,102 @@ void cxgb3i_conn_cleanup_task(struct iscsi_task *task)
159 iscsi_tcp_cleanup_task(task); 164 iscsi_tcp_cleanup_task(task);
160} 165}
161 166
162/* 167static int sgl_seek_offset(struct scatterlist *sgl, unsigned int sgcnt,
163 * We do not support ahs yet 168 unsigned int offset, unsigned int *off,
164 */ 169 struct scatterlist **sgp)
170{
171 int i;
172 struct scatterlist *sg;
173
174 for_each_sg(sgl, sg, sgcnt, i) {
175 if (offset < sg->length) {
176 *off = offset;
177 *sgp = sg;
178 return 0;
179 }
180 offset -= sg->length;
181 }
182 return -EFAULT;
183}
184
185static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
186 unsigned int dlen, skb_frag_t *frags,
187 int frag_max)
188{
189 unsigned int datalen = dlen;
190 unsigned int sglen = sg->length - sgoffset;
191 struct page *page = sg_page(sg);
192 int i;
193
194 i = 0;
195 do {
196 unsigned int copy;
197
198 if (!sglen) {
199 sg = sg_next(sg);
200 if (!sg) {
201 cxgb3i_log_error("%s, sg NULL, len %u/%u.\n",
202 __func__, datalen, dlen);
203 return -EINVAL;
204 }
205 sgoffset = 0;
206 sglen = sg->length;
207 page = sg_page(sg);
208
209 }
210 copy = min(datalen, sglen);
211 if (i && page == frags[i - 1].page &&
212 sgoffset + sg->offset ==
213 frags[i - 1].page_offset + frags[i - 1].size) {
214 frags[i - 1].size += copy;
215 } else {
216 if (i >= frag_max) {
217 cxgb3i_log_error("%s, too many pages %u, "
218 "dlen %u.\n", __func__,
219 frag_max, dlen);
220 return -EINVAL;
221 }
222
223 frags[i].page = page;
224 frags[i].page_offset = sg->offset + sgoffset;
225 frags[i].size = copy;
226 i++;
227 }
228 datalen -= copy;
229 sgoffset += copy;
230 sglen -= copy;
231 } while (datalen);
232
233 return i;
234}
235
165int cxgb3i_conn_alloc_pdu(struct iscsi_task *task, u8 opcode) 236int cxgb3i_conn_alloc_pdu(struct iscsi_task *task, u8 opcode)
166{ 237{
238 struct iscsi_conn *conn = task->conn;
167 struct iscsi_tcp_task *tcp_task = task->dd_data; 239 struct iscsi_tcp_task *tcp_task = task->dd_data;
168 struct sk_buff *skb; 240 struct cxgb3i_task_data *tdata = task->dd_data + sizeof(*tcp_task);
241 struct scsi_cmnd *sc = task->sc;
242 int headroom = SKB_TX_PDU_HEADER_LEN;
169 243
244 tcp_task->dd_data = tdata;
170 task->hdr = NULL; 245 task->hdr = NULL;
171 /* always allocate rooms for AHS */ 246
172 skb = alloc_skb(sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE + 247 /* write command, need to send data pdus */
173 TX_HEADER_LEN, GFP_ATOMIC); 248 if (skb_extra_headroom && (opcode == ISCSI_OP_SCSI_DATA_OUT ||
174 if (!skb) 249 (opcode == ISCSI_OP_SCSI_CMD &&
250 (scsi_bidi_cmnd(sc) || sc->sc_data_direction == DMA_TO_DEVICE))))
251 headroom += min(skb_extra_headroom, conn->max_xmit_dlength);
252
253 tdata->skb = alloc_skb(TX_HEADER_LEN + headroom, GFP_ATOMIC);
254 if (!tdata->skb)
175 return -ENOMEM; 255 return -ENOMEM;
256 skb_reserve(tdata->skb, TX_HEADER_LEN);
176 257
177 cxgb3i_tx_debug("task 0x%p, opcode 0x%x, skb 0x%p.\n", 258 cxgb3i_tx_debug("task 0x%p, opcode 0x%x, skb 0x%p.\n",
178 task, opcode, skb); 259 task, opcode, tdata->skb);
179 260
180 tcp_task->dd_data = skb; 261 task->hdr = (struct iscsi_hdr *)tdata->skb->data;
181 skb_reserve(skb, TX_HEADER_LEN); 262 task->hdr_max = SKB_TX_PDU_HEADER_LEN;
182 task->hdr = (struct iscsi_hdr *)skb->data;
183 task->hdr_max = sizeof(struct iscsi_hdr);
184 263
185 /* data_out uses scsi_cmd's itt */ 264 /* data_out uses scsi_cmd's itt */
186 if (opcode != ISCSI_OP_SCSI_DATA_OUT) 265 if (opcode != ISCSI_OP_SCSI_DATA_OUT)
@@ -192,13 +271,13 @@ int cxgb3i_conn_alloc_pdu(struct iscsi_task *task, u8 opcode)
192int cxgb3i_conn_init_pdu(struct iscsi_task *task, unsigned int offset, 271int cxgb3i_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
193 unsigned int count) 272 unsigned int count)
194{ 273{
195 struct iscsi_tcp_task *tcp_task = task->dd_data;
196 struct sk_buff *skb = tcp_task->dd_data;
197 struct iscsi_conn *conn = task->conn; 274 struct iscsi_conn *conn = task->conn;
198 struct page *pg; 275 struct iscsi_tcp_task *tcp_task = task->dd_data;
276 struct cxgb3i_task_data *tdata = tcp_task->dd_data;
277 struct sk_buff *skb = tdata->skb;
199 unsigned int datalen = count; 278 unsigned int datalen = count;
200 int i, padlen = iscsi_padding(count); 279 int i, padlen = iscsi_padding(count);
201 skb_frag_t *frag; 280 struct page *pg;
202 281
203 cxgb3i_tx_debug("task 0x%p,0x%p, offset %u, count %u, skb 0x%p.\n", 282 cxgb3i_tx_debug("task 0x%p,0x%p, offset %u, count %u, skb 0x%p.\n",
204 task, task->sc, offset, count, skb); 283 task, task->sc, offset, count, skb);
@@ -209,90 +288,94 @@ int cxgb3i_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
209 return 0; 288 return 0;
210 289
211 if (task->sc) { 290 if (task->sc) {
212 struct scatterlist *sg; 291 struct scsi_data_buffer *sdb = scsi_out(task->sc);
213 struct scsi_data_buffer *sdb; 292 struct scatterlist *sg = NULL;
214 unsigned int sgoffset = offset; 293 int err;
215 struct page *sgpg; 294
216 unsigned int sglen; 295 tdata->offset = offset;
217 296 tdata->count = count;
218 sdb = scsi_out(task->sc); 297 err = sgl_seek_offset(sdb->table.sgl, sdb->table.nents,
219 sg = sdb->table.sgl; 298 tdata->offset, &tdata->sgoffset, &sg);
220 299 if (err < 0) {
221 for_each_sg(sdb->table.sgl, sg, sdb->table.nents, i) { 300 cxgb3i_log_warn("tpdu, sgl %u, bad offset %u/%u.\n",
222 cxgb3i_tx_debug("sg %d, page 0x%p, len %u offset %u\n", 301 sdb->table.nents, tdata->offset,
223 i, sg_page(sg), sg->length, sg->offset); 302 sdb->length);
224 303 return err;
225 if (sgoffset < sg->length)
226 break;
227 sgoffset -= sg->length;
228 } 304 }
229 sgpg = sg_page(sg); 305 err = sgl_read_to_frags(sg, tdata->sgoffset, tdata->count,
230 sglen = sg->length - sgoffset; 306 tdata->frags, MAX_PDU_FRAGS);
231 307 if (err < 0) {
232 do { 308 cxgb3i_log_warn("tpdu, sgl %u, bad offset %u + %u.\n",
233 int j = skb_shinfo(skb)->nr_frags; 309 sdb->table.nents, tdata->offset,
234 unsigned int copy; 310 tdata->count);
235 311 return err;
236 if (!sglen) { 312 }
237 sg = sg_next(sg); 313 tdata->nr_frags = err;
238 sgpg = sg_page(sg); 314
239 sgoffset = 0; 315 if (tdata->nr_frags > MAX_SKB_FRAGS ||
240 sglen = sg->length; 316 (padlen && tdata->nr_frags == MAX_SKB_FRAGS)) {
241 ++i; 317 char *dst = skb->data + task->hdr_len;
318 skb_frag_t *frag = tdata->frags;
319
320 /* data fits in the skb's headroom */
321 for (i = 0; i < tdata->nr_frags; i++, frag++) {
322 char *src = kmap_atomic(frag->page,
323 KM_SOFTIRQ0);
324
325 memcpy(dst, src+frag->page_offset, frag->size);
326 dst += frag->size;
327 kunmap_atomic(src, KM_SOFTIRQ0);
242 } 328 }
243 copy = min(sglen, datalen); 329 if (padlen) {
244 if (j && skb_can_coalesce(skb, j, sgpg, 330 memset(dst, 0, padlen);
245 sg->offset + sgoffset)) { 331 padlen = 0;
246 skb_shinfo(skb)->frags[j - 1].size += copy;
247 } else {
248 get_page(sgpg);
249 skb_fill_page_desc(skb, j, sgpg,
250 sg->offset + sgoffset, copy);
251 } 332 }
252 sgoffset += copy; 333 skb_put(skb, count + padlen);
253 sglen -= copy; 334 } else {
254 datalen -= copy; 335 /* data fit into frag_list */
255 } while (datalen); 336 for (i = 0; i < tdata->nr_frags; i++)
337 get_page(tdata->frags[i].page);
338
339 memcpy(skb_shinfo(skb)->frags, tdata->frags,
340 sizeof(skb_frag_t) * tdata->nr_frags);
341 skb_shinfo(skb)->nr_frags = tdata->nr_frags;
342 skb->len += count;
343 skb->data_len += count;
344 skb->truesize += count;
345 }
346
256 } else { 347 } else {
257 pg = virt_to_page(task->data); 348 pg = virt_to_page(task->data);
258 349
259 while (datalen) { 350 get_page(pg);
260 i = skb_shinfo(skb)->nr_frags; 351 skb_fill_page_desc(skb, 0, pg, offset_in_page(task->data),
261 frag = &skb_shinfo(skb)->frags[i]; 352 count);
262 353 skb->len += count;
263 get_page(pg); 354 skb->data_len += count;
264 frag->page = pg; 355 skb->truesize += count;
265 frag->page_offset = 0;
266 frag->size = min((unsigned int)PAGE_SIZE, datalen);
267
268 skb_shinfo(skb)->nr_frags++;
269 datalen -= frag->size;
270 pg++;
271 }
272 } 356 }
273 357
274 if (padlen) { 358 if (padlen) {
275 i = skb_shinfo(skb)->nr_frags; 359 i = skb_shinfo(skb)->nr_frags;
276 frag = &skb_shinfo(skb)->frags[i]; 360 get_page(pad_page);
277 frag->page = pad_page; 361 skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags, pad_page, 0,
278 frag->page_offset = 0; 362 padlen);
279 frag->size = padlen; 363
280 skb_shinfo(skb)->nr_frags++; 364 skb->data_len += padlen;
365 skb->truesize += padlen;
366 skb->len += padlen;
281 } 367 }
282 368
283 datalen = count + padlen;
284 skb->data_len += datalen;
285 skb->truesize += datalen;
286 skb->len += datalen;
287 return 0; 369 return 0;
288} 370}
289 371
290int cxgb3i_conn_xmit_pdu(struct iscsi_task *task) 372int cxgb3i_conn_xmit_pdu(struct iscsi_task *task)
291{ 373{
292 struct iscsi_tcp_task *tcp_task = task->dd_data;
293 struct sk_buff *skb = tcp_task->dd_data;
294 struct iscsi_tcp_conn *tcp_conn = task->conn->dd_data; 374 struct iscsi_tcp_conn *tcp_conn = task->conn->dd_data;
295 struct cxgb3i_conn *cconn = tcp_conn->dd_data; 375 struct cxgb3i_conn *cconn = tcp_conn->dd_data;
376 struct iscsi_tcp_task *tcp_task = task->dd_data;
377 struct cxgb3i_task_data *tdata = tcp_task->dd_data;
378 struct sk_buff *skb = tdata->skb;
296 unsigned int datalen; 379 unsigned int datalen;
297 int err; 380 int err;
298 381
@@ -300,13 +383,14 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *task)
300 return 0; 383 return 0;
301 384
302 datalen = skb->data_len; 385 datalen = skb->data_len;
303 tcp_task->dd_data = NULL; 386 tdata->skb = NULL;
304 err = cxgb3i_c3cn_send_pdus(cconn->cep->c3cn, skb); 387 err = cxgb3i_c3cn_send_pdus(cconn->cep->c3cn, skb);
305 cxgb3i_tx_debug("task 0x%p, skb 0x%p, len %u/%u, rv %d.\n",
306 task, skb, skb->len, skb->data_len, err);
307 if (err > 0) { 388 if (err > 0) {
308 int pdulen = err; 389 int pdulen = err;
309 390
391 cxgb3i_tx_debug("task 0x%p, skb 0x%p, len %u/%u, rv %d.\n",
392 task, skb, skb->len, skb->data_len, err);
393
310 if (task->conn->hdrdgst_en) 394 if (task->conn->hdrdgst_en)
311 pdulen += ISCSI_DIGEST_SIZE; 395 pdulen += ISCSI_DIGEST_SIZE;
312 if (datalen && task->conn->datadgst_en) 396 if (datalen && task->conn->datadgst_en)
@@ -325,12 +409,14 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *task)
325 return err; 409 return err;
326 } 410 }
327 /* reset skb to send when we are called again */ 411 /* reset skb to send when we are called again */
328 tcp_task->dd_data = skb; 412 tdata->skb = skb;
329 return -EAGAIN; 413 return -EAGAIN;
330} 414}
331 415
332int cxgb3i_pdu_init(void) 416int cxgb3i_pdu_init(void)
333{ 417{
418 if (SKB_TX_HEADROOM > (512 * MAX_SKB_FRAGS))
419 skb_extra_headroom = SKB_TX_HEADROOM;
334 pad_page = alloc_page(GFP_KERNEL); 420 pad_page = alloc_page(GFP_KERNEL);
335 if (!pad_page) 421 if (!pad_page)
336 return -ENOMEM; 422 return -ENOMEM;
@@ -366,7 +452,9 @@ void cxgb3i_conn_pdu_ready(struct s3_conn *c3cn)
366 skb = skb_peek(&c3cn->receive_queue); 452 skb = skb_peek(&c3cn->receive_queue);
367 while (!err && skb) { 453 while (!err && skb) {
368 __skb_unlink(skb, &c3cn->receive_queue); 454 __skb_unlink(skb, &c3cn->receive_queue);
369 read += skb_ulp_pdulen(skb); 455 read += skb_rx_pdulen(skb);
456 cxgb3i_rx_debug("conn 0x%p, cn 0x%p, rx skb 0x%p, pdulen %u.\n",
457 conn, c3cn, skb, skb_rx_pdulen(skb));
370 err = cxgb3i_conn_read_pdu_skb(conn, skb); 458 err = cxgb3i_conn_read_pdu_skb(conn, skb);
371 __kfree_skb(skb); 459 __kfree_skb(skb);
372 skb = skb_peek(&c3cn->receive_queue); 460 skb = skb_peek(&c3cn->receive_queue);
@@ -377,6 +465,11 @@ void cxgb3i_conn_pdu_ready(struct s3_conn *c3cn)
377 cxgb3i_c3cn_rx_credits(c3cn, read); 465 cxgb3i_c3cn_rx_credits(c3cn, read);
378 } 466 }
379 conn->rxdata_octets += read; 467 conn->rxdata_octets += read;
468
469 if (err) {
470 cxgb3i_log_info("conn 0x%p rx failed err %d.\n", conn, err);
471 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
472 }
380} 473}
381 474
382void cxgb3i_conn_tx_open(struct s3_conn *c3cn) 475void cxgb3i_conn_tx_open(struct s3_conn *c3cn)
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.h b/drivers/scsi/cxgb3i/cxgb3i_pdu.h
index a3f685cc2362..0770b23d90da 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_pdu.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.h
@@ -53,7 +53,7 @@ struct cpl_rx_data_ddp_norss {
53#define ULP2_FLAG_DCRC_ERROR 0x20 53#define ULP2_FLAG_DCRC_ERROR 0x20
54#define ULP2_FLAG_PAD_ERROR 0x40 54#define ULP2_FLAG_PAD_ERROR 0x40
55 55
56void cxgb3i_conn_closing(struct s3_conn *); 56void cxgb3i_conn_closing(struct s3_conn *c3cn);
57void cxgb3i_conn_pdu_ready(struct s3_conn *c3cn); 57void cxgb3i_conn_pdu_ready(struct s3_conn *c3cn);
58void cxgb3i_conn_tx_open(struct s3_conn *c3cn); 58void cxgb3i_conn_tx_open(struct s3_conn *c3cn);
59#endif 59#endif
diff --git a/drivers/scsi/fcoe/fc_transport_fcoe.c b/drivers/scsi/fcoe/fc_transport_fcoe.c
index bf7fe6fc0820..8862758006c0 100644
--- a/drivers/scsi/fcoe/fc_transport_fcoe.c
+++ b/drivers/scsi/fcoe/fc_transport_fcoe.c
@@ -33,19 +33,19 @@ static LIST_HEAD(fcoe_transports);
33static DEFINE_MUTEX(fcoe_transports_lock); 33static DEFINE_MUTEX(fcoe_transports_lock);
34 34
35/** 35/**
36 * fcoe_transport_default - returns ptr to the default transport fcoe_sw 36 * fcoe_transport_default() - Returns ptr to the default transport fcoe_sw
37 **/ 37 */
38struct fcoe_transport *fcoe_transport_default(void) 38struct fcoe_transport *fcoe_transport_default(void)
39{ 39{
40 return &fcoe_sw_transport; 40 return &fcoe_sw_transport;
41} 41}
42 42
43/** 43/**
44 * fcoe_transport_to_pcidev - get the pci dev from a netdev 44 * fcoe_transport_to_pcidev() - get the pci dev from a netdev
45 * @netdev: the netdev that pci dev will be retrived from 45 * @netdev: the netdev that pci dev will be retrived from
46 * 46 *
47 * Returns: NULL or the corrsponding pci_dev 47 * Returns: NULL or the corrsponding pci_dev
48 **/ 48 */
49struct pci_dev *fcoe_transport_pcidev(const struct net_device *netdev) 49struct pci_dev *fcoe_transport_pcidev(const struct net_device *netdev)
50{ 50{
51 if (!netdev->dev.parent) 51 if (!netdev->dev.parent)
@@ -54,18 +54,17 @@ struct pci_dev *fcoe_transport_pcidev(const struct net_device *netdev)
54} 54}
55 55
56/** 56/**
57 * fcoe_transport_device_lookup - find out netdev is managed by the 57 * fcoe_transport_device_lookup() - Lookup a transport
58 * transport
59 * assign a transport to a device
60 * @netdev: the netdev the transport to be attached to 58 * @netdev: the netdev the transport to be attached to
61 * 59 *
62 * This will look for existing offload driver, if not found, it falls back to 60 * This will look for existing offload driver, if not found, it falls back to
63 * the default sw hba (fcoe_sw) as its fcoe transport. 61 * the default sw hba (fcoe_sw) as its fcoe transport.
64 * 62 *
65 * Returns: 0 for success 63 * Returns: 0 for success
66 **/ 64 */
67static struct fcoe_transport_internal *fcoe_transport_device_lookup( 65static struct fcoe_transport_internal *
68 struct fcoe_transport *t, struct net_device *netdev) 66fcoe_transport_device_lookup(struct fcoe_transport *t,
67 struct net_device *netdev)
69{ 68{
70 struct fcoe_transport_internal *ti; 69 struct fcoe_transport_internal *ti;
71 70
@@ -81,14 +80,14 @@ static struct fcoe_transport_internal *fcoe_transport_device_lookup(
81 return NULL; 80 return NULL;
82} 81}
83/** 82/**
84 * fcoe_transport_device_add - assign a transport to a device 83 * fcoe_transport_device_add() - Assign a transport to a device
85 * @netdev: the netdev the transport to be attached to 84 * @netdev: the netdev the transport to be attached to
86 * 85 *
87 * This will look for existing offload driver, if not found, it falls back to 86 * This will look for existing offload driver, if not found, it falls back to
88 * the default sw hba (fcoe_sw) as its fcoe transport. 87 * the default sw hba (fcoe_sw) as its fcoe transport.
89 * 88 *
90 * Returns: 0 for success 89 * Returns: 0 for success
91 **/ 90 */
92static int fcoe_transport_device_add(struct fcoe_transport *t, 91static int fcoe_transport_device_add(struct fcoe_transport *t,
93 struct net_device *netdev) 92 struct net_device *netdev)
94{ 93{
@@ -123,14 +122,14 @@ static int fcoe_transport_device_add(struct fcoe_transport *t,
123} 122}
124 123
125/** 124/**
126 * fcoe_transport_device_remove - remove a device from its transport 125 * fcoe_transport_device_remove() - Remove a device from its transport
127 * @netdev: the netdev the transport to be attached to 126 * @netdev: the netdev the transport to be attached to
128 * 127 *
129 * this removes the device from the transport so the given transport will 128 * This removes the device from the transport so the given transport will
130 * not manage this device any more 129 * not manage this device any more
131 * 130 *
132 * Returns: 0 for success 131 * Returns: 0 for success
133 **/ 132 */
134static int fcoe_transport_device_remove(struct fcoe_transport *t, 133static int fcoe_transport_device_remove(struct fcoe_transport *t,
135 struct net_device *netdev) 134 struct net_device *netdev)
136{ 135{
@@ -155,13 +154,13 @@ static int fcoe_transport_device_remove(struct fcoe_transport *t,
155} 154}
156 155
157/** 156/**
158 * fcoe_transport_device_remove_all - remove all from transport devlist 157 * fcoe_transport_device_remove_all() - Remove all from transport devlist
159 * 158 *
160 * this removes the device from the transport so the given transport will 159 * This removes the device from the transport so the given transport will
161 * not manage this device any more 160 * not manage this device any more
162 * 161 *
163 * Returns: 0 for success 162 * Returns: 0 for success
164 **/ 163 */
165static void fcoe_transport_device_remove_all(struct fcoe_transport *t) 164static void fcoe_transport_device_remove_all(struct fcoe_transport *t)
166{ 165{
167 struct fcoe_transport_internal *ti, *tmp; 166 struct fcoe_transport_internal *ti, *tmp;
@@ -175,18 +174,18 @@ static void fcoe_transport_device_remove_all(struct fcoe_transport *t)
175} 174}
176 175
177/** 176/**
178 * fcoe_transport_match - use the bus device match function to match the hw 177 * fcoe_transport_match() - Use the bus device match function to match the hw
179 * @t: the fcoe transport 178 * @t: The fcoe transport to check
180 * @netdev: 179 * @netdev: The netdev to match against
181 * 180 *
182 * This function is used to check if the givne transport wants to manage the 181 * This function is used to check if the given transport wants to manage the
183 * input netdev. if the transports implements the match function, it will be 182 * input netdev. if the transports implements the match function, it will be
184 * called, o.w. we just compare the pci vendor and device id. 183 * called, o.w. we just compare the pci vendor and device id.
185 * 184 *
186 * Returns: true for match up 185 * Returns: true for match up
187 **/ 186 */
188static bool fcoe_transport_match(struct fcoe_transport *t, 187static bool fcoe_transport_match(struct fcoe_transport *t,
189 struct net_device *netdev) 188 struct net_device *netdev)
190{ 189{
191 /* match transport by vendor and device id */ 190 /* match transport by vendor and device id */
192 struct pci_dev *pci; 191 struct pci_dev *pci;
@@ -210,17 +209,17 @@ static bool fcoe_transport_match(struct fcoe_transport *t,
210} 209}
211 210
212/** 211/**
213 * fcoe_transport_lookup - check if the transport is already registered 212 * fcoe_transport_lookup() - Check if the transport is already registered
214 * @t: the transport to be looked up 213 * @t: the transport to be looked up
215 * 214 *
216 * This compares the parent device (pci) vendor and device id 215 * This compares the parent device (pci) vendor and device id
217 * 216 *
218 * Returns: NULL if not found 217 * Returns: NULL if not found
219 * 218 *
220 * TODO - return default sw transport if no other transport is found 219 * TODO: return default sw transport if no other transport is found
221 **/ 220 */
222static struct fcoe_transport *fcoe_transport_lookup( 221static struct fcoe_transport *
223 struct net_device *netdev) 222fcoe_transport_lookup(struct net_device *netdev)
224{ 223{
225 struct fcoe_transport *t; 224 struct fcoe_transport *t;
226 225
@@ -239,11 +238,11 @@ static struct fcoe_transport *fcoe_transport_lookup(
239} 238}
240 239
241/** 240/**
242 * fcoe_transport_register - adds a fcoe transport to the fcoe transports list 241 * fcoe_transport_register() - Adds a fcoe transport to the fcoe transports list
243 * @t: ptr to the fcoe transport to be added 242 * @t: ptr to the fcoe transport to be added
244 * 243 *
245 * Returns: 0 for success 244 * Returns: 0 for success
246 **/ 245 */
247int fcoe_transport_register(struct fcoe_transport *t) 246int fcoe_transport_register(struct fcoe_transport *t)
248{ 247{
249 struct fcoe_transport *tt; 248 struct fcoe_transport *tt;
@@ -259,9 +258,6 @@ int fcoe_transport_register(struct fcoe_transport *t)
259 list_add_tail(&t->list, &fcoe_transports); 258 list_add_tail(&t->list, &fcoe_transports);
260 mutex_unlock(&fcoe_transports_lock); 259 mutex_unlock(&fcoe_transports_lock);
261 260
262 mutex_init(&t->devlock);
263 INIT_LIST_HEAD(&t->devlist);
264
265 printk(KERN_DEBUG "fcoe_transport_register:%s\n", t->name); 261 printk(KERN_DEBUG "fcoe_transport_register:%s\n", t->name);
266 262
267 return 0; 263 return 0;
@@ -269,11 +265,11 @@ int fcoe_transport_register(struct fcoe_transport *t)
269EXPORT_SYMBOL_GPL(fcoe_transport_register); 265EXPORT_SYMBOL_GPL(fcoe_transport_register);
270 266
271/** 267/**
272 * fcoe_transport_unregister - remove the tranport fro the fcoe transports list 268 * fcoe_transport_unregister() - Remove the tranport fro the fcoe transports list
273 * @t: ptr to the fcoe transport to be removed 269 * @t: ptr to the fcoe transport to be removed
274 * 270 *
275 * Returns: 0 for success 271 * Returns: 0 for success
276 **/ 272 */
277int fcoe_transport_unregister(struct fcoe_transport *t) 273int fcoe_transport_unregister(struct fcoe_transport *t)
278{ 274{
279 struct fcoe_transport *tt, *tmp; 275 struct fcoe_transport *tt, *tmp;
@@ -294,8 +290,8 @@ int fcoe_transport_unregister(struct fcoe_transport *t)
294} 290}
295EXPORT_SYMBOL_GPL(fcoe_transport_unregister); 291EXPORT_SYMBOL_GPL(fcoe_transport_unregister);
296 292
297/* 293/**
298 * fcoe_load_transport_driver - load an offload driver by alias name 294 * fcoe_load_transport_driver() - Load an offload driver by alias name
299 * @netdev: the target net device 295 * @netdev: the target net device
300 * 296 *
301 * Requests for an offload driver module as the fcoe transport, if fails, it 297 * Requests for an offload driver module as the fcoe transport, if fails, it
@@ -307,7 +303,7 @@ EXPORT_SYMBOL_GPL(fcoe_transport_unregister);
307 * 3. pure hw fcoe hba may not have netdev 303 * 3. pure hw fcoe hba may not have netdev
308 * 304 *
309 * Returns: 0 for success 305 * Returns: 0 for success
310 **/ 306 */
311int fcoe_load_transport_driver(struct net_device *netdev) 307int fcoe_load_transport_driver(struct net_device *netdev)
312{ 308{
313 struct pci_dev *pci; 309 struct pci_dev *pci;
@@ -335,14 +331,14 @@ int fcoe_load_transport_driver(struct net_device *netdev)
335EXPORT_SYMBOL_GPL(fcoe_load_transport_driver); 331EXPORT_SYMBOL_GPL(fcoe_load_transport_driver);
336 332
337/** 333/**
338 * fcoe_transport_attach - load transport to fcoe 334 * fcoe_transport_attach() - Load transport to fcoe
339 * @netdev: the netdev the transport to be attached to 335 * @netdev: the netdev the transport to be attached to
340 * 336 *
341 * This will look for existing offload driver, if not found, it falls back to 337 * This will look for existing offload driver, if not found, it falls back to
342 * the default sw hba (fcoe_sw) as its fcoe transport. 338 * the default sw hba (fcoe_sw) as its fcoe transport.
343 * 339 *
344 * Returns: 0 for success 340 * Returns: 0 for success
345 **/ 341 */
346int fcoe_transport_attach(struct net_device *netdev) 342int fcoe_transport_attach(struct net_device *netdev)
347{ 343{
348 struct fcoe_transport *t; 344 struct fcoe_transport *t;
@@ -373,11 +369,11 @@ int fcoe_transport_attach(struct net_device *netdev)
373EXPORT_SYMBOL_GPL(fcoe_transport_attach); 369EXPORT_SYMBOL_GPL(fcoe_transport_attach);
374 370
375/** 371/**
376 * fcoe_transport_release - unload transport from fcoe 372 * fcoe_transport_release() - Unload transport from fcoe
377 * @netdev: the net device on which fcoe is to be released 373 * @netdev: the net device on which fcoe is to be released
378 * 374 *
379 * Returns: 0 for success 375 * Returns: 0 for success
380 **/ 376 */
381int fcoe_transport_release(struct net_device *netdev) 377int fcoe_transport_release(struct net_device *netdev)
382{ 378{
383 struct fcoe_transport *t; 379 struct fcoe_transport *t;
@@ -410,12 +406,12 @@ int fcoe_transport_release(struct net_device *netdev)
410EXPORT_SYMBOL_GPL(fcoe_transport_release); 406EXPORT_SYMBOL_GPL(fcoe_transport_release);
411 407
412/** 408/**
413 * fcoe_transport_init - initializes fcoe transport layer 409 * fcoe_transport_init() - Initializes fcoe transport layer
414 * 410 *
415 * This prepares for the fcoe transport layer 411 * This prepares for the fcoe transport layer
416 * 412 *
417 * Returns: none 413 * Returns: none
418 **/ 414 */
419int __init fcoe_transport_init(void) 415int __init fcoe_transport_init(void)
420{ 416{
421 INIT_LIST_HEAD(&fcoe_transports); 417 INIT_LIST_HEAD(&fcoe_transports);
@@ -424,12 +420,13 @@ int __init fcoe_transport_init(void)
424} 420}
425 421
426/** 422/**
427 * fcoe_transport_exit - cleans up the fcoe transport layer 423 * fcoe_transport_exit() - Cleans up the fcoe transport layer
424 *
428 * This cleans up the fcoe transport layer. removing any transport on the list, 425 * This cleans up the fcoe transport layer. removing any transport on the list,
429 * note that the transport destroy func is not called here. 426 * note that the transport destroy func is not called here.
430 * 427 *
431 * Returns: none 428 * Returns: none
432 **/ 429 */
433int __exit fcoe_transport_exit(void) 430int __exit fcoe_transport_exit(void)
434{ 431{
435 struct fcoe_transport *t, *tmp; 432 struct fcoe_transport *t, *tmp;
diff --git a/drivers/scsi/fcoe/fcoe_sw.c b/drivers/scsi/fcoe/fcoe_sw.c
index dc4cd5e25760..da210eba1941 100644
--- a/drivers/scsi/fcoe/fcoe_sw.c
+++ b/drivers/scsi/fcoe/fcoe_sw.c
@@ -104,19 +104,19 @@ static struct scsi_host_template fcoe_sw_shost_template = {
104 .max_sectors = 0xffff, 104 .max_sectors = 0xffff,
105}; 105};
106 106
107/* 107/**
108 * fcoe_sw_lport_config - sets up the fc_lport 108 * fcoe_sw_lport_config() - sets up the fc_lport
109 * @lp: ptr to the fc_lport 109 * @lp: ptr to the fc_lport
110 * @shost: ptr to the parent scsi host 110 * @shost: ptr to the parent scsi host
111 * 111 *
112 * Returns: 0 for success 112 * Returns: 0 for success
113 *
114 */ 113 */
115static int fcoe_sw_lport_config(struct fc_lport *lp) 114static int fcoe_sw_lport_config(struct fc_lport *lp)
116{ 115{
117 int i = 0; 116 int i = 0;
118 117
119 lp->link_status = 0; 118 lp->link_up = 0;
119 lp->qfull = 0;
120 lp->max_retry_count = 3; 120 lp->max_retry_count = 3;
121 lp->e_d_tov = 2 * 1000; /* FC-FS default */ 121 lp->e_d_tov = 2 * 1000; /* FC-FS default */
122 lp->r_a_tov = 2 * 2 * 1000; 122 lp->r_a_tov = 2 * 2 * 1000;
@@ -136,16 +136,14 @@ static int fcoe_sw_lport_config(struct fc_lport *lp)
136 return 0; 136 return 0;
137} 137}
138 138
139/* 139/**
140 * fcoe_sw_netdev_config - sets up fcoe_softc for lport and network 140 * fcoe_sw_netdev_config() - Set up netdev for SW FCoE
141 * related properties
142 * @lp : ptr to the fc_lport 141 * @lp : ptr to the fc_lport
143 * @netdev : ptr to the associated netdevice struct 142 * @netdev : ptr to the associated netdevice struct
144 * 143 *
145 * Must be called after fcoe_sw_lport_config() as it will use lport mutex 144 * Must be called after fcoe_sw_lport_config() as it will use lport mutex
146 * 145 *
147 * Returns : 0 for success 146 * Returns : 0 for success
148 *
149 */ 147 */
150static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev) 148static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
151{ 149{
@@ -181,9 +179,8 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
181 if (fc_set_mfs(lp, mfs)) 179 if (fc_set_mfs(lp, mfs))
182 return -EINVAL; 180 return -EINVAL;
183 181
184 lp->link_status = ~FC_PAUSE & ~FC_LINK_UP;
185 if (!fcoe_link_ok(lp)) 182 if (!fcoe_link_ok(lp))
186 lp->link_status |= FC_LINK_UP; 183 lp->link_up = 1;
187 184
188 /* offload features support */ 185 /* offload features support */
189 if (fc->real_dev->features & NETIF_F_SG) 186 if (fc->real_dev->features & NETIF_F_SG)
@@ -191,6 +188,7 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
191 188
192 189
193 skb_queue_head_init(&fc->fcoe_pending_queue); 190 skb_queue_head_init(&fc->fcoe_pending_queue);
191 fc->fcoe_pending_queue_active = 0;
194 192
195 /* setup Source Mac Address */ 193 /* setup Source Mac Address */
196 memcpy(fc->ctl_src_addr, fc->real_dev->dev_addr, 194 memcpy(fc->ctl_src_addr, fc->real_dev->dev_addr,
@@ -224,16 +222,15 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
224 return 0; 222 return 0;
225} 223}
226 224
227/* 225/**
228 * fcoe_sw_shost_config - sets up fc_lport->host 226 * fcoe_sw_shost_config() - Sets up fc_lport->host
229 * @lp : ptr to the fc_lport 227 * @lp : ptr to the fc_lport
230 * @shost : ptr to the associated scsi host 228 * @shost : ptr to the associated scsi host
231 * @dev : device associated to scsi host 229 * @dev : device associated to scsi host
232 * 230 *
233 * Must be called after fcoe_sw_lport_config) and fcoe_sw_netdev_config() 231 * Must be called after fcoe_sw_lport_config() and fcoe_sw_netdev_config()
234 * 232 *
235 * Returns : 0 for success 233 * Returns : 0 for success
236 *
237 */ 234 */
238static int fcoe_sw_shost_config(struct fc_lport *lp, struct Scsi_Host *shost, 235static int fcoe_sw_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
239 struct device *dev) 236 struct device *dev)
@@ -261,8 +258,8 @@ static int fcoe_sw_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
261 return 0; 258 return 0;
262} 259}
263 260
264/* 261/**
265 * fcoe_sw_em_config - allocates em for this lport 262 * fcoe_sw_em_config() - allocates em for this lport
266 * @lp: the port that em is to allocated for 263 * @lp: the port that em is to allocated for
267 * 264 *
268 * Returns : 0 on success 265 * Returns : 0 on success
@@ -279,8 +276,8 @@ static inline int fcoe_sw_em_config(struct fc_lport *lp)
279 return 0; 276 return 0;
280} 277}
281 278
282/* 279/**
283 * fcoe_sw_destroy - FCoE software HBA tear-down function 280 * fcoe_sw_destroy() - FCoE software HBA tear-down function
284 * @netdev: ptr to the associated net_device 281 * @netdev: ptr to the associated net_device
285 * 282 *
286 * Returns: 0 if link is OK for use by FCoE. 283 * Returns: 0 if link is OK for use by FCoE.
@@ -301,7 +298,7 @@ static int fcoe_sw_destroy(struct net_device *netdev)
301 if (!lp) 298 if (!lp)
302 return -ENODEV; 299 return -ENODEV;
303 300
304 fc = fcoe_softc(lp); 301 fc = lport_priv(lp);
305 302
306 /* Logout of the fabric */ 303 /* Logout of the fabric */
307 fc_fabric_logoff(lp); 304 fc_fabric_logoff(lp);
@@ -353,8 +350,8 @@ static struct libfc_function_template fcoe_sw_libfc_fcn_templ = {
353 .frame_send = fcoe_xmit, 350 .frame_send = fcoe_xmit,
354}; 351};
355 352
356/* 353/**
357 * fcoe_sw_create - this function creates the fcoe interface 354 * fcoe_sw_create() - this function creates the fcoe interface
358 * @netdev: pointer the associated netdevice 355 * @netdev: pointer the associated netdevice
359 * 356 *
360 * Creates fc_lport struct and scsi_host for lport, configures lport 357 * Creates fc_lport struct and scsi_host for lport, configures lport
@@ -440,8 +437,8 @@ out_host_put:
440 return rc; 437 return rc;
441} 438}
442 439
443/* 440/**
444 * fcoe_sw_match - the fcoe sw transport match function 441 * fcoe_sw_match() - The FCoE SW transport match function
445 * 442 *
446 * Returns : false always 443 * Returns : false always
447 */ 444 */
@@ -461,8 +458,8 @@ struct fcoe_transport fcoe_sw_transport = {
461 .device = 0xffff, 458 .device = 0xffff,
462}; 459};
463 460
464/* 461/**
465 * fcoe_sw_init - registers fcoe_sw_transport 462 * fcoe_sw_init() - Registers fcoe_sw_transport
466 * 463 *
467 * Returns : 0 on success 464 * Returns : 0 on success
468 */ 465 */
@@ -471,17 +468,22 @@ int __init fcoe_sw_init(void)
471 /* attach to scsi transport */ 468 /* attach to scsi transport */
472 scsi_transport_fcoe_sw = 469 scsi_transport_fcoe_sw =
473 fc_attach_transport(&fcoe_sw_transport_function); 470 fc_attach_transport(&fcoe_sw_transport_function);
471
474 if (!scsi_transport_fcoe_sw) { 472 if (!scsi_transport_fcoe_sw) {
475 printk(KERN_ERR "fcoe_sw_init:fc_attach_transport() failed\n"); 473 printk(KERN_ERR "fcoe_sw_init:fc_attach_transport() failed\n");
476 return -ENODEV; 474 return -ENODEV;
477 } 475 }
476
477 mutex_init(&fcoe_sw_transport.devlock);
478 INIT_LIST_HEAD(&fcoe_sw_transport.devlist);
479
478 /* register sw transport */ 480 /* register sw transport */
479 fcoe_transport_register(&fcoe_sw_transport); 481 fcoe_transport_register(&fcoe_sw_transport);
480 return 0; 482 return 0;
481} 483}
482 484
483/* 485/**
484 * fcoe_sw_exit - unregisters fcoe_sw_transport 486 * fcoe_sw_exit() - Unregisters fcoe_sw_transport
485 * 487 *
486 * Returns : 0 on success 488 * Returns : 0 on success
487 */ 489 */
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index e419f486cdb3..5548bf3bb58b 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -49,6 +49,7 @@
49static int debug_fcoe; 49static int debug_fcoe;
50 50
51#define FCOE_MAX_QUEUE_DEPTH 256 51#define FCOE_MAX_QUEUE_DEPTH 256
52#define FCOE_LOW_QUEUE_DEPTH 32
52 53
53/* destination address mode */ 54/* destination address mode */
54#define FCOE_GW_ADDR_MODE 0x00 55#define FCOE_GW_ADDR_MODE 0x00
@@ -69,8 +70,6 @@ struct fcoe_percpu_s *fcoe_percpu[NR_CPUS];
69 70
70/* Function Prototyes */ 71/* Function Prototyes */
71static int fcoe_check_wait_queue(struct fc_lport *); 72static int fcoe_check_wait_queue(struct fc_lport *);
72static void fcoe_insert_wait_queue_head(struct fc_lport *, struct sk_buff *);
73static void fcoe_insert_wait_queue(struct fc_lport *, struct sk_buff *);
74static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *); 73static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *);
75#ifdef CONFIG_HOTPLUG_CPU 74#ifdef CONFIG_HOTPLUG_CPU
76static int fcoe_cpu_callback(struct notifier_block *, ulong, void *); 75static int fcoe_cpu_callback(struct notifier_block *, ulong, void *);
@@ -91,13 +90,13 @@ static struct notifier_block fcoe_cpu_notifier = {
91}; 90};
92 91
93/** 92/**
94 * fcoe_create_percpu_data - creates the associated cpu data 93 * fcoe_create_percpu_data() - creates the associated cpu data
95 * @cpu: index for the cpu where fcoe cpu data will be created 94 * @cpu: index for the cpu where fcoe cpu data will be created
96 * 95 *
97 * create percpu stats block, from cpu add notifier 96 * create percpu stats block, from cpu add notifier
98 * 97 *
99 * Returns: none 98 * Returns: none
100 **/ 99 */
101static void fcoe_create_percpu_data(int cpu) 100static void fcoe_create_percpu_data(int cpu)
102{ 101{
103 struct fc_lport *lp; 102 struct fc_lport *lp;
@@ -115,13 +114,13 @@ static void fcoe_create_percpu_data(int cpu)
115} 114}
116 115
117/** 116/**
118 * fcoe_destroy_percpu_data - destroys the associated cpu data 117 * fcoe_destroy_percpu_data() - destroys the associated cpu data
119 * @cpu: index for the cpu where fcoe cpu data will destroyed 118 * @cpu: index for the cpu where fcoe cpu data will destroyed
120 * 119 *
121 * destroy percpu stats block called by cpu add/remove notifier 120 * destroy percpu stats block called by cpu add/remove notifier
122 * 121 *
123 * Retuns: none 122 * Retuns: none
124 **/ 123 */
125static void fcoe_destroy_percpu_data(int cpu) 124static void fcoe_destroy_percpu_data(int cpu)
126{ 125{
127 struct fc_lport *lp; 126 struct fc_lport *lp;
@@ -137,7 +136,7 @@ static void fcoe_destroy_percpu_data(int cpu)
137} 136}
138 137
139/** 138/**
140 * fcoe_cpu_callback - fcoe cpu hotplug event callback 139 * fcoe_cpu_callback() - fcoe cpu hotplug event callback
141 * @nfb: callback data block 140 * @nfb: callback data block
142 * @action: event triggering the callback 141 * @action: event triggering the callback
143 * @hcpu: index for the cpu of this event 142 * @hcpu: index for the cpu of this event
@@ -145,7 +144,7 @@ static void fcoe_destroy_percpu_data(int cpu)
145 * this creates or destroys per cpu data for fcoe 144 * this creates or destroys per cpu data for fcoe
146 * 145 *
147 * Returns NOTIFY_OK always. 146 * Returns NOTIFY_OK always.
148 **/ 147 */
149static int fcoe_cpu_callback(struct notifier_block *nfb, unsigned long action, 148static int fcoe_cpu_callback(struct notifier_block *nfb, unsigned long action,
150 void *hcpu) 149 void *hcpu)
151{ 150{
@@ -166,7 +165,7 @@ static int fcoe_cpu_callback(struct notifier_block *nfb, unsigned long action,
166#endif /* CONFIG_HOTPLUG_CPU */ 165#endif /* CONFIG_HOTPLUG_CPU */
167 166
168/** 167/**
169 * fcoe_rcv - this is the fcoe receive function called by NET_RX_SOFTIRQ 168 * fcoe_rcv() - this is the fcoe receive function called by NET_RX_SOFTIRQ
170 * @skb: the receive skb 169 * @skb: the receive skb
171 * @dev: associated net device 170 * @dev: associated net device
172 * @ptype: context 171 * @ptype: context
@@ -175,7 +174,7 @@ static int fcoe_cpu_callback(struct notifier_block *nfb, unsigned long action,
175 * this function will receive the packet and build fc frame and pass it up 174 * this function will receive the packet and build fc frame and pass it up
176 * 175 *
177 * Returns: 0 for success 176 * Returns: 0 for success
178 **/ 177 */
179int fcoe_rcv(struct sk_buff *skb, struct net_device *dev, 178int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
180 struct packet_type *ptype, struct net_device *olddev) 179 struct packet_type *ptype, struct net_device *olddev)
181{ 180{
@@ -265,11 +264,11 @@ err2:
265EXPORT_SYMBOL_GPL(fcoe_rcv); 264EXPORT_SYMBOL_GPL(fcoe_rcv);
266 265
267/** 266/**
268 * fcoe_start_io - pass to netdev to start xmit for fcoe 267 * fcoe_start_io() - pass to netdev to start xmit for fcoe
269 * @skb: the skb to be xmitted 268 * @skb: the skb to be xmitted
270 * 269 *
271 * Returns: 0 for success 270 * Returns: 0 for success
272 **/ 271 */
273static inline int fcoe_start_io(struct sk_buff *skb) 272static inline int fcoe_start_io(struct sk_buff *skb)
274{ 273{
275 int rc; 274 int rc;
@@ -283,12 +282,12 @@ static inline int fcoe_start_io(struct sk_buff *skb)
283} 282}
284 283
285/** 284/**
286 * fcoe_get_paged_crc_eof - in case we need alloc a page for crc_eof 285 * fcoe_get_paged_crc_eof() - in case we need alloc a page for crc_eof
287 * @skb: the skb to be xmitted 286 * @skb: the skb to be xmitted
288 * @tlen: total len 287 * @tlen: total len
289 * 288 *
290 * Returns: 0 for success 289 * Returns: 0 for success
291 **/ 290 */
292static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen) 291static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
293{ 292{
294 struct fcoe_percpu_s *fps; 293 struct fcoe_percpu_s *fps;
@@ -326,13 +325,12 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
326} 325}
327 326
328/** 327/**
329 * fcoe_fc_crc - calculates FC CRC in this fcoe skb 328 * fcoe_fc_crc() - calculates FC CRC in this fcoe skb
330 * @fp: the fc_frame containg data to be checksummed 329 * @fp: the fc_frame containg data to be checksummed
331 * 330 *
332 * This uses crc32() to calculate the crc for fc frame 331 * This uses crc32() to calculate the crc for fc frame
333 * Return : 32 bit crc 332 * Return : 32 bit crc
334 * 333 */
335 **/
336u32 fcoe_fc_crc(struct fc_frame *fp) 334u32 fcoe_fc_crc(struct fc_frame *fp)
337{ 335{
338 struct sk_buff *skb = fp_skb(fp); 336 struct sk_buff *skb = fp_skb(fp);
@@ -363,13 +361,12 @@ u32 fcoe_fc_crc(struct fc_frame *fp)
363EXPORT_SYMBOL_GPL(fcoe_fc_crc); 361EXPORT_SYMBOL_GPL(fcoe_fc_crc);
364 362
365/** 363/**
366 * fcoe_xmit - FCoE frame transmit function 364 * fcoe_xmit() - FCoE frame transmit function
367 * @lp: the associated local port 365 * @lp: the associated local port
368 * @fp: the fc_frame to be transmitted 366 * @fp: the fc_frame to be transmitted
369 * 367 *
370 * Return : 0 for success 368 * Return : 0 for success
371 * 369 */
372 **/
373int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp) 370int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
374{ 371{
375 int wlen, rc = 0; 372 int wlen, rc = 0;
@@ -389,7 +386,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
389 386
390 WARN_ON((fr_len(fp) % sizeof(u32)) != 0); 387 WARN_ON((fr_len(fp) % sizeof(u32)) != 0);
391 388
392 fc = fcoe_softc(lp); 389 fc = lport_priv(lp);
393 /* 390 /*
394 * if it is a flogi then we need to learn gw-addr 391 * if it is a flogi then we need to learn gw-addr
395 * and my own fcid 392 * and my own fcid
@@ -439,7 +436,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
439 if (skb_is_nonlinear(skb)) { 436 if (skb_is_nonlinear(skb)) {
440 skb_frag_t *frag; 437 skb_frag_t *frag;
441 if (fcoe_get_paged_crc_eof(skb, tlen)) { 438 if (fcoe_get_paged_crc_eof(skb, tlen)) {
442 kfree(skb); 439 kfree_skb(skb);
443 return -ENOMEM; 440 return -ENOMEM;
444 } 441 }
445 frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1]; 442 frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1];
@@ -502,21 +499,22 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
502 rc = fcoe_start_io(skb); 499 rc = fcoe_start_io(skb);
503 500
504 if (rc) { 501 if (rc) {
505 fcoe_insert_wait_queue(lp, skb); 502 spin_lock_bh(&fc->fcoe_pending_queue.lock);
503 __skb_queue_tail(&fc->fcoe_pending_queue, skb);
504 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
506 if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH) 505 if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH)
507 fc_pause(lp); 506 lp->qfull = 1;
508 } 507 }
509 508
510 return 0; 509 return 0;
511} 510}
512EXPORT_SYMBOL_GPL(fcoe_xmit); 511EXPORT_SYMBOL_GPL(fcoe_xmit);
513 512
514/* 513/**
515 * fcoe_percpu_receive_thread - recv thread per cpu 514 * fcoe_percpu_receive_thread() - recv thread per cpu
516 * @arg: ptr to the fcoe per cpu struct 515 * @arg: ptr to the fcoe per cpu struct
517 * 516 *
518 * Return: 0 for success 517 * Return: 0 for success
519 *
520 */ 518 */
521int fcoe_percpu_receive_thread(void *arg) 519int fcoe_percpu_receive_thread(void *arg)
522{ 520{
@@ -533,7 +531,7 @@ int fcoe_percpu_receive_thread(void *arg)
533 struct fcoe_softc *fc; 531 struct fcoe_softc *fc;
534 struct fcoe_hdr *hp; 532 struct fcoe_hdr *hp;
535 533
536 set_user_nice(current, 19); 534 set_user_nice(current, -20);
537 535
538 while (!kthread_should_stop()) { 536 while (!kthread_should_stop()) {
539 537
@@ -658,7 +656,7 @@ int fcoe_percpu_receive_thread(void *arg)
658} 656}
659 657
660/** 658/**
661 * fcoe_recv_flogi - flogi receive function 659 * fcoe_recv_flogi() - flogi receive function
662 * @fc: associated fcoe_softc 660 * @fc: associated fcoe_softc
663 * @fp: the recieved frame 661 * @fp: the recieved frame
664 * @sa: the source address of this flogi 662 * @sa: the source address of this flogi
@@ -667,7 +665,7 @@ int fcoe_percpu_receive_thread(void *arg)
667 * mac address for the initiator, eitehr OUI based or GW based. 665 * mac address for the initiator, eitehr OUI based or GW based.
668 * 666 *
669 * Returns: none 667 * Returns: none
670 **/ 668 */
671static void fcoe_recv_flogi(struct fcoe_softc *fc, struct fc_frame *fp, u8 *sa) 669static void fcoe_recv_flogi(struct fcoe_softc *fc, struct fc_frame *fp, u8 *sa)
672{ 670{
673 struct fc_frame_header *fh; 671 struct fc_frame_header *fh;
@@ -715,32 +713,23 @@ static void fcoe_recv_flogi(struct fcoe_softc *fc, struct fc_frame *fp, u8 *sa)
715} 713}
716 714
717/** 715/**
718 * fcoe_watchdog - fcoe timer callback 716 * fcoe_watchdog() - fcoe timer callback
719 * @vp: 717 * @vp:
720 * 718 *
721 * This checks the pending queue length for fcoe and put fcoe to be paused state 719 * This checks the pending queue length for fcoe and set lport qfull
722 * if the FCOE_MAX_QUEUE_DEPTH is reached. This is done for all fc_lport on the 720 * if the FCOE_MAX_QUEUE_DEPTH is reached. This is done for all fc_lport on the
723 * fcoe_hostlist. 721 * fcoe_hostlist.
724 * 722 *
725 * Returns: 0 for success 723 * Returns: 0 for success
726 **/ 724 */
727void fcoe_watchdog(ulong vp) 725void fcoe_watchdog(ulong vp)
728{ 726{
729 struct fc_lport *lp;
730 struct fcoe_softc *fc; 727 struct fcoe_softc *fc;
731 int paused = 0;
732 728
733 read_lock(&fcoe_hostlist_lock); 729 read_lock(&fcoe_hostlist_lock);
734 list_for_each_entry(fc, &fcoe_hostlist, list) { 730 list_for_each_entry(fc, &fcoe_hostlist, list) {
735 lp = fc->lp; 731 if (fc->lp)
736 if (lp) { 732 fcoe_check_wait_queue(fc->lp);
737 if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH)
738 paused = 1;
739 if (fcoe_check_wait_queue(lp) < FCOE_MAX_QUEUE_DEPTH) {
740 if (paused)
741 fc_unpause(lp);
742 }
743 }
744 } 733 }
745 read_unlock(&fcoe_hostlist_lock); 734 read_unlock(&fcoe_hostlist_lock);
746 735
@@ -750,96 +739,64 @@ void fcoe_watchdog(ulong vp)
750 739
751 740
752/** 741/**
753 * fcoe_check_wait_queue - put the skb into fcoe pending xmit queue 742 * fcoe_check_wait_queue() - put the skb into fcoe pending xmit queue
754 * @lp: the fc_port for this skb 743 * @lp: the fc_port for this skb
755 * @skb: the associated skb to be xmitted 744 * @skb: the associated skb to be xmitted
756 * 745 *
757 * This empties the wait_queue, dequeue the head of the wait_queue queue 746 * This empties the wait_queue, dequeue the head of the wait_queue queue
758 * and calls fcoe_start_io() for each packet, if all skb have been 747 * and calls fcoe_start_io() for each packet, if all skb have been
759 * transmitted, return 0 if a error occurs, then restore wait_queue and 748 * transmitted, return qlen or -1 if a error occurs, then restore
760 * try again later. 749 * wait_queue and try again later.
761 * 750 *
762 * The wait_queue is used when the skb transmit fails. skb will go 751 * The wait_queue is used when the skb transmit fails. skb will go
763 * in the wait_queue which will be emptied by the time function OR 752 * in the wait_queue which will be emptied by the time function OR
764 * by the next skb transmit. 753 * by the next skb transmit.
765 * 754 *
766 * Returns: 0 for success 755 * Returns: 0 for success
767 **/ 756 */
768static int fcoe_check_wait_queue(struct fc_lport *lp) 757static int fcoe_check_wait_queue(struct fc_lport *lp)
769{ 758{
770 int rc, unpause = 0; 759 struct fcoe_softc *fc = lport_priv(lp);
771 int paused = 0;
772 struct sk_buff *skb; 760 struct sk_buff *skb;
773 struct fcoe_softc *fc; 761 int rc = -1;
774 762
775 fc = fcoe_softc(lp);
776 spin_lock_bh(&fc->fcoe_pending_queue.lock); 763 spin_lock_bh(&fc->fcoe_pending_queue.lock);
764 if (fc->fcoe_pending_queue_active)
765 goto out;
766 fc->fcoe_pending_queue_active = 1;
777 767
778 /* 768 while (fc->fcoe_pending_queue.qlen) {
779 * is this interface paused? 769 /* keep qlen > 0 until fcoe_start_io succeeds */
780 */ 770 fc->fcoe_pending_queue.qlen++;
781 if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH) 771 skb = __skb_dequeue(&fc->fcoe_pending_queue);
782 paused = 1;
783 if (fc->fcoe_pending_queue.qlen) {
784 while ((skb = __skb_dequeue(&fc->fcoe_pending_queue)) != NULL) {
785 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
786 rc = fcoe_start_io(skb);
787 if (rc) {
788 fcoe_insert_wait_queue_head(lp, skb);
789 return rc;
790 }
791 spin_lock_bh(&fc->fcoe_pending_queue.lock);
792 }
793 if (fc->fcoe_pending_queue.qlen < FCOE_MAX_QUEUE_DEPTH)
794 unpause = 1;
795 }
796 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
797 if ((unpause) && (paused))
798 fc_unpause(lp);
799 return fc->fcoe_pending_queue.qlen;
800}
801
802/**
803 * fcoe_insert_wait_queue_head - puts skb to fcoe pending queue head
804 * @lp: the fc_port for this skb
805 * @skb: the associated skb to be xmitted
806 *
807 * Returns: none
808 **/
809static void fcoe_insert_wait_queue_head(struct fc_lport *lp,
810 struct sk_buff *skb)
811{
812 struct fcoe_softc *fc;
813 772
814 fc = fcoe_softc(lp); 773 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
815 spin_lock_bh(&fc->fcoe_pending_queue.lock); 774 rc = fcoe_start_io(skb);
816 __skb_queue_head(&fc->fcoe_pending_queue, skb); 775 spin_lock_bh(&fc->fcoe_pending_queue.lock);
817 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
818}
819 776
820/** 777 if (rc) {
821 * fcoe_insert_wait_queue - put the skb into fcoe pending queue tail 778 __skb_queue_head(&fc->fcoe_pending_queue, skb);
822 * @lp: the fc_port for this skb 779 /* undo temporary increment above */
823 * @skb: the associated skb to be xmitted 780 fc->fcoe_pending_queue.qlen--;
824 * 781 break;
825 * Returns: none 782 }
826 **/ 783 /* undo temporary increment above */
827static void fcoe_insert_wait_queue(struct fc_lport *lp, 784 fc->fcoe_pending_queue.qlen--;
828 struct sk_buff *skb) 785 }
829{
830 struct fcoe_softc *fc;
831 786
832 fc = fcoe_softc(lp); 787 if (fc->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
833 spin_lock_bh(&fc->fcoe_pending_queue.lock); 788 lp->qfull = 0;
834 __skb_queue_tail(&fc->fcoe_pending_queue, skb); 789 fc->fcoe_pending_queue_active = 0;
790 rc = fc->fcoe_pending_queue.qlen;
791out:
835 spin_unlock_bh(&fc->fcoe_pending_queue.lock); 792 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
793 return rc;
836} 794}
837 795
838/** 796/**
839 * fcoe_dev_setup - setup link change notification interface 797 * fcoe_dev_setup() - setup link change notification interface
840 * 798 */
841 **/ 799static void fcoe_dev_setup()
842static void fcoe_dev_setup(void)
843{ 800{
844 /* 801 /*
845 * here setup a interface specific wd time to 802 * here setup a interface specific wd time to
@@ -849,15 +806,15 @@ static void fcoe_dev_setup(void)
849} 806}
850 807
851/** 808/**
852 * fcoe_dev_setup - cleanup link change notification interface 809 * fcoe_dev_setup() - cleanup link change notification interface
853 **/ 810 */
854static void fcoe_dev_cleanup(void) 811static void fcoe_dev_cleanup(void)
855{ 812{
856 unregister_netdevice_notifier(&fcoe_notifier); 813 unregister_netdevice_notifier(&fcoe_notifier);
857} 814}
858 815
859/** 816/**
860 * fcoe_device_notification - netdev event notification callback 817 * fcoe_device_notification() - netdev event notification callback
861 * @notifier: context of the notification 818 * @notifier: context of the notification
862 * @event: type of event 819 * @event: type of event
863 * @ptr: fixed array for output parsed ifname 820 * @ptr: fixed array for output parsed ifname
@@ -865,7 +822,7 @@ static void fcoe_dev_cleanup(void)
865 * This function is called by the ethernet driver in case of link change event 822 * This function is called by the ethernet driver in case of link change event
866 * 823 *
867 * Returns: 0 for success 824 * Returns: 0 for success
868 **/ 825 */
869static int fcoe_device_notification(struct notifier_block *notifier, 826static int fcoe_device_notification(struct notifier_block *notifier,
870 ulong event, void *ptr) 827 ulong event, void *ptr)
871{ 828{
@@ -873,7 +830,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
873 struct net_device *real_dev = ptr; 830 struct net_device *real_dev = ptr;
874 struct fcoe_softc *fc; 831 struct fcoe_softc *fc;
875 struct fcoe_dev_stats *stats; 832 struct fcoe_dev_stats *stats;
876 u16 new_status; 833 u32 new_link_up;
877 u32 mfs; 834 u32 mfs;
878 int rc = NOTIFY_OK; 835 int rc = NOTIFY_OK;
879 836
@@ -890,17 +847,15 @@ static int fcoe_device_notification(struct notifier_block *notifier,
890 goto out; 847 goto out;
891 } 848 }
892 849
893 new_status = lp->link_status; 850 new_link_up = lp->link_up;
894 switch (event) { 851 switch (event) {
895 case NETDEV_DOWN: 852 case NETDEV_DOWN:
896 case NETDEV_GOING_DOWN: 853 case NETDEV_GOING_DOWN:
897 new_status &= ~FC_LINK_UP; 854 new_link_up = 0;
898 break; 855 break;
899 case NETDEV_UP: 856 case NETDEV_UP:
900 case NETDEV_CHANGE: 857 case NETDEV_CHANGE:
901 new_status &= ~FC_LINK_UP; 858 new_link_up = !fcoe_link_ok(lp);
902 if (!fcoe_link_ok(lp))
903 new_status |= FC_LINK_UP;
904 break; 859 break;
905 case NETDEV_CHANGEMTU: 860 case NETDEV_CHANGEMTU:
906 mfs = fc->real_dev->mtu - 861 mfs = fc->real_dev->mtu -
@@ -908,17 +863,15 @@ static int fcoe_device_notification(struct notifier_block *notifier,
908 sizeof(struct fcoe_crc_eof)); 863 sizeof(struct fcoe_crc_eof));
909 if (mfs >= FC_MIN_MAX_FRAME) 864 if (mfs >= FC_MIN_MAX_FRAME)
910 fc_set_mfs(lp, mfs); 865 fc_set_mfs(lp, mfs);
911 new_status &= ~FC_LINK_UP; 866 new_link_up = !fcoe_link_ok(lp);
912 if (!fcoe_link_ok(lp))
913 new_status |= FC_LINK_UP;
914 break; 867 break;
915 case NETDEV_REGISTER: 868 case NETDEV_REGISTER:
916 break; 869 break;
917 default: 870 default:
918 FC_DBG("unknown event %ld call", event); 871 FC_DBG("unknown event %ld call", event);
919 } 872 }
920 if (lp->link_status != new_status) { 873 if (lp->link_up != new_link_up) {
921 if ((new_status & FC_LINK_UP) == FC_LINK_UP) 874 if (new_link_up)
922 fc_linkup(lp); 875 fc_linkup(lp);
923 else { 876 else {
924 stats = lp->dev_stats[smp_processor_id()]; 877 stats = lp->dev_stats[smp_processor_id()];
@@ -933,12 +886,12 @@ out:
933} 886}
934 887
935/** 888/**
936 * fcoe_if_to_netdev - parse a name buffer to get netdev 889 * fcoe_if_to_netdev() - parse a name buffer to get netdev
937 * @ifname: fixed array for output parsed ifname 890 * @ifname: fixed array for output parsed ifname
938 * @buffer: incoming buffer to be copied 891 * @buffer: incoming buffer to be copied
939 * 892 *
940 * Returns: NULL or ptr to netdeive 893 * Returns: NULL or ptr to netdeive
941 **/ 894 */
942static struct net_device *fcoe_if_to_netdev(const char *buffer) 895static struct net_device *fcoe_if_to_netdev(const char *buffer)
943{ 896{
944 char *cp; 897 char *cp;
@@ -955,13 +908,13 @@ static struct net_device *fcoe_if_to_netdev(const char *buffer)
955} 908}
956 909
957/** 910/**
958 * fcoe_netdev_to_module_owner - finds out the nic drive moddule of the netdev 911 * fcoe_netdev_to_module_owner() - finds out the nic drive moddule of the netdev
959 * @netdev: the target netdev 912 * @netdev: the target netdev
960 * 913 *
961 * Returns: ptr to the struct module, NULL for failure 914 * Returns: ptr to the struct module, NULL for failure
962 **/ 915 */
963static struct module *fcoe_netdev_to_module_owner( 916static struct module *
964 const struct net_device *netdev) 917fcoe_netdev_to_module_owner(const struct net_device *netdev)
965{ 918{
966 struct device *dev; 919 struct device *dev;
967 920
@@ -979,12 +932,14 @@ static struct module *fcoe_netdev_to_module_owner(
979} 932}
980 933
981/** 934/**
982 * fcoe_ethdrv_get - holds the nic driver module by try_module_get() for 935 * fcoe_ethdrv_get() - Hold the Ethernet driver
983 * the corresponding netdev.
984 * @netdev: the target netdev 936 * @netdev: the target netdev
985 * 937 *
938 * Holds the Ethernet driver module by try_module_get() for
939 * the corresponding netdev.
940 *
986 * Returns: 0 for succsss 941 * Returns: 0 for succsss
987 **/ 942 */
988static int fcoe_ethdrv_get(const struct net_device *netdev) 943static int fcoe_ethdrv_get(const struct net_device *netdev)
989{ 944{
990 struct module *owner; 945 struct module *owner;
@@ -999,12 +954,14 @@ static int fcoe_ethdrv_get(const struct net_device *netdev)
999} 954}
1000 955
1001/** 956/**
1002 * fcoe_ethdrv_get - releases the nic driver module by module_put for 957 * fcoe_ethdrv_put() - Release the Ethernet driver
1003 * the corresponding netdev.
1004 * @netdev: the target netdev 958 * @netdev: the target netdev
1005 * 959 *
960 * Releases the Ethernet driver module by module_put for
961 * the corresponding netdev.
962 *
1006 * Returns: 0 for succsss 963 * Returns: 0 for succsss
1007 **/ 964 */
1008static int fcoe_ethdrv_put(const struct net_device *netdev) 965static int fcoe_ethdrv_put(const struct net_device *netdev)
1009{ 966{
1010 struct module *owner; 967 struct module *owner;
@@ -1020,12 +977,12 @@ static int fcoe_ethdrv_put(const struct net_device *netdev)
1020} 977}
1021 978
1022/** 979/**
1023 * fcoe_destroy- handles the destroy from sysfs 980 * fcoe_destroy() - handles the destroy from sysfs
1024 * @buffer: expcted to be a eth if name 981 * @buffer: expcted to be a eth if name
1025 * @kp: associated kernel param 982 * @kp: associated kernel param
1026 * 983 *
1027 * Returns: 0 for success 984 * Returns: 0 for success
1028 **/ 985 */
1029static int fcoe_destroy(const char *buffer, struct kernel_param *kp) 986static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
1030{ 987{
1031 int rc; 988 int rc;
@@ -1058,12 +1015,12 @@ out_nodev:
1058} 1015}
1059 1016
1060/** 1017/**
1061 * fcoe_create - handles the create call from sysfs 1018 * fcoe_create() - Handles the create call from sysfs
1062 * @buffer: expcted to be a eth if name 1019 * @buffer: expcted to be a eth if name
1063 * @kp: associated kernel param 1020 * @kp: associated kernel param
1064 * 1021 *
1065 * Returns: 0 for success 1022 * Returns: 0 for success
1066 **/ 1023 */
1067static int fcoe_create(const char *buffer, struct kernel_param *kp) 1024static int fcoe_create(const char *buffer, struct kernel_param *kp)
1068{ 1025{
1069 int rc; 1026 int rc;
@@ -1104,8 +1061,8 @@ module_param_call(destroy, fcoe_destroy, NULL, NULL, S_IWUSR);
1104__MODULE_PARM_TYPE(destroy, "string"); 1061__MODULE_PARM_TYPE(destroy, "string");
1105MODULE_PARM_DESC(destroy, "Destroy fcoe port"); 1062MODULE_PARM_DESC(destroy, "Destroy fcoe port");
1106 1063
1107/* 1064/**
1108 * fcoe_link_ok - check if link is ok for the fc_lport 1065 * fcoe_link_ok() - Check if link is ok for the fc_lport
1109 * @lp: ptr to the fc_lport 1066 * @lp: ptr to the fc_lport
1110 * 1067 *
1111 * Any permanently-disqualifying conditions have been previously checked. 1068 * Any permanently-disqualifying conditions have been previously checked.
@@ -1120,7 +1077,7 @@ MODULE_PARM_DESC(destroy, "Destroy fcoe port");
1120 */ 1077 */
1121int fcoe_link_ok(struct fc_lport *lp) 1078int fcoe_link_ok(struct fc_lport *lp)
1122{ 1079{
1123 struct fcoe_softc *fc = fcoe_softc(lp); 1080 struct fcoe_softc *fc = lport_priv(lp);
1124 struct net_device *dev = fc->real_dev; 1081 struct net_device *dev = fc->real_dev;
1125 struct ethtool_cmd ecmd = { ETHTOOL_GSET }; 1082 struct ethtool_cmd ecmd = { ETHTOOL_GSET };
1126 int rc = 0; 1083 int rc = 0;
@@ -1149,9 +1106,8 @@ int fcoe_link_ok(struct fc_lport *lp)
1149} 1106}
1150EXPORT_SYMBOL_GPL(fcoe_link_ok); 1107EXPORT_SYMBOL_GPL(fcoe_link_ok);
1151 1108
1152/* 1109/**
1153 * fcoe_percpu_clean - frees skb of the corresponding lport from the per 1110 * fcoe_percpu_clean() - Clear the pending skbs for an lport
1154 * cpu queue.
1155 * @lp: the fc_lport 1111 * @lp: the fc_lport
1156 */ 1112 */
1157void fcoe_percpu_clean(struct fc_lport *lp) 1113void fcoe_percpu_clean(struct fc_lport *lp)
@@ -1185,11 +1141,11 @@ void fcoe_percpu_clean(struct fc_lport *lp)
1185EXPORT_SYMBOL_GPL(fcoe_percpu_clean); 1141EXPORT_SYMBOL_GPL(fcoe_percpu_clean);
1186 1142
1187/** 1143/**
1188 * fcoe_clean_pending_queue - dequeue skb and free it 1144 * fcoe_clean_pending_queue() - Dequeue a skb and free it
1189 * @lp: the corresponding fc_lport 1145 * @lp: the corresponding fc_lport
1190 * 1146 *
1191 * Returns: none 1147 * Returns: none
1192 **/ 1148 */
1193void fcoe_clean_pending_queue(struct fc_lport *lp) 1149void fcoe_clean_pending_queue(struct fc_lport *lp)
1194{ 1150{
1195 struct fcoe_softc *fc = lport_priv(lp); 1151 struct fcoe_softc *fc = lport_priv(lp);
@@ -1206,21 +1162,21 @@ void fcoe_clean_pending_queue(struct fc_lport *lp)
1206EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue); 1162EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue);
1207 1163
1208/** 1164/**
1209 * libfc_host_alloc - allocate a Scsi_Host with room for the fc_lport 1165 * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport
1210 * @sht: ptr to the scsi host templ 1166 * @sht: ptr to the scsi host templ
1211 * @priv_size: size of private data after fc_lport 1167 * @priv_size: size of private data after fc_lport
1212 * 1168 *
1213 * Returns: ptr to Scsi_Host 1169 * Returns: ptr to Scsi_Host
1214 * TODO - to libfc? 1170 * TODO: to libfc?
1215 */ 1171 */
1216static inline struct Scsi_Host *libfc_host_alloc( 1172static inline struct Scsi_Host *
1217 struct scsi_host_template *sht, int priv_size) 1173libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
1218{ 1174{
1219 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); 1175 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size);
1220} 1176}
1221 1177
1222/** 1178/**
1223 * fcoe_host_alloc - allocate a Scsi_Host with room for the fcoe_softc 1179 * fcoe_host_alloc() - Allocate a Scsi_Host with room for the fcoe_softc
1224 * @sht: ptr to the scsi host templ 1180 * @sht: ptr to the scsi host templ
1225 * @priv_size: size of private data after fc_lport 1181 * @priv_size: size of private data after fc_lport
1226 * 1182 *
@@ -1232,8 +1188,8 @@ struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *sht, int priv_size)
1232} 1188}
1233EXPORT_SYMBOL_GPL(fcoe_host_alloc); 1189EXPORT_SYMBOL_GPL(fcoe_host_alloc);
1234 1190
1235/* 1191/**
1236 * fcoe_reset - resets the fcoe 1192 * fcoe_reset() - Resets the fcoe
1237 * @shost: shost the reset is from 1193 * @shost: shost the reset is from
1238 * 1194 *
1239 * Returns: always 0 1195 * Returns: always 0
@@ -1246,8 +1202,8 @@ int fcoe_reset(struct Scsi_Host *shost)
1246} 1202}
1247EXPORT_SYMBOL_GPL(fcoe_reset); 1203EXPORT_SYMBOL_GPL(fcoe_reset);
1248 1204
1249/* 1205/**
1250 * fcoe_wwn_from_mac - converts 48-bit IEEE MAC address to 64-bit FC WWN. 1206 * fcoe_wwn_from_mac() - Converts 48-bit IEEE MAC address to 64-bit FC WWN.
1251 * @mac: mac address 1207 * @mac: mac address
1252 * @scheme: check port 1208 * @scheme: check port
1253 * @port: port indicator for converting 1209 * @port: port indicator for converting
@@ -1286,14 +1242,15 @@ u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
1286 return wwn; 1242 return wwn;
1287} 1243}
1288EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); 1244EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac);
1289/* 1245
1290 * fcoe_hostlist_lookup_softc - find the corresponding lport by a given device 1246/**
1247 * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device
1291 * @device: this is currently ptr to net_device 1248 * @device: this is currently ptr to net_device
1292 * 1249 *
1293 * Returns: NULL or the located fcoe_softc 1250 * Returns: NULL or the located fcoe_softc
1294 */ 1251 */
1295static struct fcoe_softc *fcoe_hostlist_lookup_softc( 1252static struct fcoe_softc *
1296 const struct net_device *dev) 1253fcoe_hostlist_lookup_softc(const struct net_device *dev)
1297{ 1254{
1298 struct fcoe_softc *fc; 1255 struct fcoe_softc *fc;
1299 1256
@@ -1308,8 +1265,8 @@ static struct fcoe_softc *fcoe_hostlist_lookup_softc(
1308 return NULL; 1265 return NULL;
1309} 1266}
1310 1267
1311/* 1268/**
1312 * fcoe_hostlist_lookup - find the corresponding lport by netdev 1269 * fcoe_hostlist_lookup() - Find the corresponding lport by netdev
1313 * @netdev: ptr to net_device 1270 * @netdev: ptr to net_device
1314 * 1271 *
1315 * Returns: 0 for success 1272 * Returns: 0 for success
@@ -1324,8 +1281,8 @@ struct fc_lport *fcoe_hostlist_lookup(const struct net_device *netdev)
1324} 1281}
1325EXPORT_SYMBOL_GPL(fcoe_hostlist_lookup); 1282EXPORT_SYMBOL_GPL(fcoe_hostlist_lookup);
1326 1283
1327/* 1284/**
1328 * fcoe_hostlist_add - add a lport to lports list 1285 * fcoe_hostlist_add() - Add a lport to lports list
1329 * @lp: ptr to the fc_lport to badded 1286 * @lp: ptr to the fc_lport to badded
1330 * 1287 *
1331 * Returns: 0 for success 1288 * Returns: 0 for success
@@ -1336,7 +1293,7 @@ int fcoe_hostlist_add(const struct fc_lport *lp)
1336 1293
1337 fc = fcoe_hostlist_lookup_softc(fcoe_netdev(lp)); 1294 fc = fcoe_hostlist_lookup_softc(fcoe_netdev(lp));
1338 if (!fc) { 1295 if (!fc) {
1339 fc = fcoe_softc(lp); 1296 fc = lport_priv(lp);
1340 write_lock_bh(&fcoe_hostlist_lock); 1297 write_lock_bh(&fcoe_hostlist_lock);
1341 list_add_tail(&fc->list, &fcoe_hostlist); 1298 list_add_tail(&fc->list, &fcoe_hostlist);
1342 write_unlock_bh(&fcoe_hostlist_lock); 1299 write_unlock_bh(&fcoe_hostlist_lock);
@@ -1345,8 +1302,8 @@ int fcoe_hostlist_add(const struct fc_lport *lp)
1345} 1302}
1346EXPORT_SYMBOL_GPL(fcoe_hostlist_add); 1303EXPORT_SYMBOL_GPL(fcoe_hostlist_add);
1347 1304
1348/* 1305/**
1349 * fcoe_hostlist_remove - remove a lport from lports list 1306 * fcoe_hostlist_remove() - remove a lport from lports list
1350 * @lp: ptr to the fc_lport to badded 1307 * @lp: ptr to the fc_lport to badded
1351 * 1308 *
1352 * Returns: 0 for success 1309 * Returns: 0 for success
@@ -1366,12 +1323,12 @@ int fcoe_hostlist_remove(const struct fc_lport *lp)
1366EXPORT_SYMBOL_GPL(fcoe_hostlist_remove); 1323EXPORT_SYMBOL_GPL(fcoe_hostlist_remove);
1367 1324
1368/** 1325/**
1369 * fcoe_libfc_config - sets up libfc related properties for lport 1326 * fcoe_libfc_config() - sets up libfc related properties for lport
1370 * @lp: ptr to the fc_lport 1327 * @lp: ptr to the fc_lport
1371 * @tt: libfc function template 1328 * @tt: libfc function template
1372 * 1329 *
1373 * Returns : 0 for success 1330 * Returns : 0 for success
1374 **/ 1331 */
1375int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt) 1332int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt)
1376{ 1333{
1377 /* Set the function pointers set by the LLDD */ 1334 /* Set the function pointers set by the LLDD */
@@ -1389,14 +1346,14 @@ int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt)
1389EXPORT_SYMBOL_GPL(fcoe_libfc_config); 1346EXPORT_SYMBOL_GPL(fcoe_libfc_config);
1390 1347
1391/** 1348/**
1392 * fcoe_init - fcoe module loading initialization 1349 * fcoe_init() - fcoe module loading initialization
1393 * 1350 *
1394 * Initialization routine 1351 * Initialization routine
1395 * 1. Will create fc transport software structure 1352 * 1. Will create fc transport software structure
1396 * 2. initialize the link list of port information structure 1353 * 2. initialize the link list of port information structure
1397 * 1354 *
1398 * Returns 0 on success, negative on failure 1355 * Returns 0 on success, negative on failure
1399 **/ 1356 */
1400static int __init fcoe_init(void) 1357static int __init fcoe_init(void)
1401{ 1358{
1402 int cpu; 1359 int cpu;
@@ -1433,7 +1390,6 @@ static int __init fcoe_init(void)
1433 } else { 1390 } else {
1434 fcoe_percpu[cpu] = NULL; 1391 fcoe_percpu[cpu] = NULL;
1435 kfree(p); 1392 kfree(p);
1436
1437 } 1393 }
1438 } 1394 }
1439 } 1395 }
@@ -1443,11 +1399,9 @@ static int __init fcoe_init(void)
1443 */ 1399 */
1444 fcoe_dev_setup(); 1400 fcoe_dev_setup();
1445 1401
1446 init_timer(&fcoe_timer); 1402 setup_timer(&fcoe_timer, fcoe_watchdog, 0);
1447 fcoe_timer.data = 0; 1403
1448 fcoe_timer.function = fcoe_watchdog; 1404 mod_timer(&fcoe_timer, jiffies + (10 * HZ));
1449 fcoe_timer.expires = (jiffies + (10 * HZ));
1450 add_timer(&fcoe_timer);
1451 1405
1452 /* initiatlize the fcoe transport */ 1406 /* initiatlize the fcoe transport */
1453 fcoe_transport_init(); 1407 fcoe_transport_init();
@@ -1459,10 +1413,10 @@ static int __init fcoe_init(void)
1459module_init(fcoe_init); 1413module_init(fcoe_init);
1460 1414
1461/** 1415/**
1462 * fcoe_exit - fcoe module unloading cleanup 1416 * fcoe_exit() - fcoe module unloading cleanup
1463 * 1417 *
1464 * Returns 0 on success, negative on failure 1418 * Returns 0 on success, negative on failure
1465 **/ 1419 */
1466static void __exit fcoe_exit(void) 1420static void __exit fcoe_exit(void)
1467{ 1421{
1468 u32 idx; 1422 u32 idx;
@@ -1483,7 +1437,7 @@ static void __exit fcoe_exit(void)
1483 */ 1437 */
1484 del_timer_sync(&fcoe_timer); 1438 del_timer_sync(&fcoe_timer);
1485 1439
1486 /* releases the assocaited fcoe transport for each lport */ 1440 /* releases the associated fcoe transport for each lport */
1487 list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list) 1441 list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list)
1488 fcoe_transport_release(fc->real_dev); 1442 fcoe_transport_release(fc->real_dev);
1489 1443
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index a48e4990fe12..34be88d7afa5 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1251,6 +1251,7 @@ static struct pci_device_id hptiop_id_table[] = {
1251 { PCI_VDEVICE(TTI, 0x3530), (kernel_ulong_t)&hptiop_itl_ops }, 1251 { PCI_VDEVICE(TTI, 0x3530), (kernel_ulong_t)&hptiop_itl_ops },
1252 { PCI_VDEVICE(TTI, 0x3560), (kernel_ulong_t)&hptiop_itl_ops }, 1252 { PCI_VDEVICE(TTI, 0x3560), (kernel_ulong_t)&hptiop_itl_ops },
1253 { PCI_VDEVICE(TTI, 0x4322), (kernel_ulong_t)&hptiop_itl_ops }, 1253 { PCI_VDEVICE(TTI, 0x4322), (kernel_ulong_t)&hptiop_itl_ops },
1254 { PCI_VDEVICE(TTI, 0x4321), (kernel_ulong_t)&hptiop_itl_ops },
1254 { PCI_VDEVICE(TTI, 0x4210), (kernel_ulong_t)&hptiop_itl_ops }, 1255 { PCI_VDEVICE(TTI, 0x4210), (kernel_ulong_t)&hptiop_itl_ops },
1255 { PCI_VDEVICE(TTI, 0x4211), (kernel_ulong_t)&hptiop_itl_ops }, 1256 { PCI_VDEVICE(TTI, 0x4211), (kernel_ulong_t)&hptiop_itl_ops },
1256 { PCI_VDEVICE(TTI, 0x4310), (kernel_ulong_t)&hptiop_itl_ops }, 1257 { PCI_VDEVICE(TTI, 0x4310), (kernel_ulong_t)&hptiop_itl_ops },
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index a1a511bdec8c..ed1e728763a2 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1573,9 +1573,6 @@ static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd,
1573 vfc_cmd->resp_len = sizeof(vfc_cmd->rsp); 1573 vfc_cmd->resp_len = sizeof(vfc_cmd->rsp);
1574 vfc_cmd->cancel_key = (unsigned long)cmnd->device->hostdata; 1574 vfc_cmd->cancel_key = (unsigned long)cmnd->device->hostdata;
1575 vfc_cmd->tgt_scsi_id = rport->port_id; 1575 vfc_cmd->tgt_scsi_id = rport->port_id;
1576 if ((rport->supported_classes & FC_COS_CLASS3) &&
1577 (fc_host_supported_classes(vhost->host) & FC_COS_CLASS3))
1578 vfc_cmd->flags = IBMVFC_CLASS_3_ERR;
1579 vfc_cmd->iu.xfer_len = scsi_bufflen(cmnd); 1576 vfc_cmd->iu.xfer_len = scsi_bufflen(cmnd);
1580 int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); 1577 int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun);
1581 memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); 1578 memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len);
@@ -3266,6 +3263,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id)
3266 return -ENOMEM; 3263 return -ENOMEM;
3267 } 3264 }
3268 3265
3266 memset(tgt, 0, sizeof(*tgt));
3269 tgt->scsi_id = scsi_id; 3267 tgt->scsi_id = scsi_id;
3270 tgt->new_scsi_id = scsi_id; 3268 tgt->new_scsi_id = scsi_id;
3271 tgt->vhost = vhost; 3269 tgt->vhost = vhost;
@@ -3576,9 +3574,18 @@ static void ibmvfc_log_ae(struct ibmvfc_host *vhost, int events)
3576static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) 3574static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt)
3577{ 3575{
3578 struct ibmvfc_host *vhost = tgt->vhost; 3576 struct ibmvfc_host *vhost = tgt->vhost;
3579 struct fc_rport *rport; 3577 struct fc_rport *rport = tgt->rport;
3580 unsigned long flags; 3578 unsigned long flags;
3581 3579
3580 if (rport) {
3581 tgt_dbg(tgt, "Setting rport roles\n");
3582 fc_remote_port_rolechg(rport, tgt->ids.roles);
3583 spin_lock_irqsave(vhost->host->host_lock, flags);
3584 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
3585 spin_unlock_irqrestore(vhost->host->host_lock, flags);
3586 return;
3587 }
3588
3582 tgt_dbg(tgt, "Adding rport\n"); 3589 tgt_dbg(tgt, "Adding rport\n");
3583 rport = fc_remote_port_add(vhost->host, 0, &tgt->ids); 3590 rport = fc_remote_port_add(vhost->host, 0, &tgt->ids);
3584 spin_lock_irqsave(vhost->host->host_lock, flags); 3591 spin_lock_irqsave(vhost->host->host_lock, flags);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index 87dafd0f8d44..b21e071b9862 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -32,7 +32,7 @@
32#define IBMVFC_DRIVER_VERSION "1.0.4" 32#define IBMVFC_DRIVER_VERSION "1.0.4"
33#define IBMVFC_DRIVER_DATE "(November 14, 2008)" 33#define IBMVFC_DRIVER_DATE "(November 14, 2008)"
34 34
35#define IBMVFC_DEFAULT_TIMEOUT 15 35#define IBMVFC_DEFAULT_TIMEOUT 60
36#define IBMVFC_INIT_TIMEOUT 120 36#define IBMVFC_INIT_TIMEOUT 120
37#define IBMVFC_MAX_REQUESTS_DEFAULT 100 37#define IBMVFC_MAX_REQUESTS_DEFAULT 100
38 38
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 74d07d137dae..c9aa7611e408 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -432,6 +432,7 @@ static int map_sg_data(struct scsi_cmnd *cmd,
432 sdev_printk(KERN_ERR, cmd->device, 432 sdev_printk(KERN_ERR, cmd->device,
433 "Can't allocate memory " 433 "Can't allocate memory "
434 "for indirect table\n"); 434 "for indirect table\n");
435 scsi_dma_unmap(cmd);
435 return 0; 436 return 0;
436 } 437 }
437 } 438 }
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c
index 4a4e6954ec79..f23c4ca9a2ee 100644
--- a/drivers/scsi/lasi700.c
+++ b/drivers/scsi/lasi700.c
@@ -103,7 +103,7 @@ lasi700_probe(struct parisc_device *dev)
103 103
104 hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); 104 hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
105 if (!hostdata) { 105 if (!hostdata) {
106 dev_printk(KERN_ERR, dev, "Failed to allocate host data\n"); 106 dev_printk(KERN_ERR, &dev->dev, "Failed to allocate host data\n");
107 return -ENOMEM; 107 return -ENOMEM;
108 } 108 }
109 109
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index dd1564c9e04a..e57556ea5b48 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -64,7 +64,7 @@ static void fc_disc_single(struct fc_disc *, struct fc_disc_port *);
64static void fc_disc_restart(struct fc_disc *); 64static void fc_disc_restart(struct fc_disc *);
65 65
66/** 66/**
67 * fc_disc_lookup_rport - lookup a remote port by port_id 67 * fc_disc_lookup_rport() - lookup a remote port by port_id
68 * @lport: Fibre Channel host port instance 68 * @lport: Fibre Channel host port instance
69 * @port_id: remote port port_id to match 69 * @port_id: remote port port_id to match
70 */ 70 */
@@ -92,7 +92,7 @@ struct fc_rport *fc_disc_lookup_rport(const struct fc_lport *lport,
92} 92}
93 93
94/** 94/**
95 * fc_disc_stop_rports - delete all the remote ports associated with the lport 95 * fc_disc_stop_rports() - delete all the remote ports associated with the lport
96 * @disc: The discovery job to stop rports on 96 * @disc: The discovery job to stop rports on
97 * 97 *
98 * Locking Note: This function expects that the lport mutex is locked before 98 * Locking Note: This function expects that the lport mutex is locked before
@@ -117,7 +117,7 @@ void fc_disc_stop_rports(struct fc_disc *disc)
117} 117}
118 118
119/** 119/**
120 * fc_disc_rport_callback - Event handler for rport events 120 * fc_disc_rport_callback() - Event handler for rport events
121 * @lport: The lport which is receiving the event 121 * @lport: The lport which is receiving the event
122 * @rport: The rport which the event has occured on 122 * @rport: The rport which the event has occured on
123 * @event: The event that occured 123 * @event: The event that occured
@@ -151,7 +151,7 @@ static void fc_disc_rport_callback(struct fc_lport *lport,
151} 151}
152 152
153/** 153/**
154 * fc_disc_recv_rscn_req - Handle Registered State Change Notification (RSCN) 154 * fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN)
155 * @sp: Current sequence of the RSCN exchange 155 * @sp: Current sequence of the RSCN exchange
156 * @fp: RSCN Frame 156 * @fp: RSCN Frame
157 * @lport: Fibre Channel host port instance 157 * @lport: Fibre Channel host port instance
@@ -246,7 +246,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
246 list_del(&dp->peers); 246 list_del(&dp->peers);
247 rport = lport->tt.rport_lookup(lport, dp->ids.port_id); 247 rport = lport->tt.rport_lookup(lport, dp->ids.port_id);
248 if (rport) { 248 if (rport) {
249 rdata = RPORT_TO_PRIV(rport); 249 rdata = rport->dd_data;
250 list_del(&rdata->peers); 250 list_del(&rdata->peers);
251 lport->tt.rport_logoff(rport); 251 lport->tt.rport_logoff(rport);
252 } 252 }
@@ -265,7 +265,7 @@ reject:
265} 265}
266 266
267/** 267/**
268 * fc_disc_recv_req - Handle incoming requests 268 * fc_disc_recv_req() - Handle incoming requests
269 * @sp: Current sequence of the request exchange 269 * @sp: Current sequence of the request exchange
270 * @fp: The frame 270 * @fp: The frame
271 * @lport: The FC local port 271 * @lport: The FC local port
@@ -294,7 +294,7 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp,
294} 294}
295 295
296/** 296/**
297 * fc_disc_restart - Restart discovery 297 * fc_disc_restart() - Restart discovery
298 * @lport: FC discovery context 298 * @lport: FC discovery context
299 * 299 *
300 * Locking Note: This function expects that the disc mutex 300 * Locking Note: This function expects that the disc mutex
@@ -322,7 +322,7 @@ static void fc_disc_restart(struct fc_disc *disc)
322} 322}
323 323
324/** 324/**
325 * fc_disc_start - Fibre Channel Target discovery 325 * fc_disc_start() - Fibre Channel Target discovery
326 * @lport: FC local port 326 * @lport: FC local port
327 * 327 *
328 * Returns non-zero if discovery cannot be started. 328 * Returns non-zero if discovery cannot be started.
@@ -383,7 +383,7 @@ static struct fc_rport_operations fc_disc_rport_ops = {
383}; 383};
384 384
385/** 385/**
386 * fc_disc_new_target - Handle new target found by discovery 386 * fc_disc_new_target() - Handle new target found by discovery
387 * @lport: FC local port 387 * @lport: FC local port
388 * @rport: The previous FC remote port (NULL if new remote port) 388 * @rport: The previous FC remote port (NULL if new remote port)
389 * @ids: Identifiers for the new FC remote port 389 * @ids: Identifiers for the new FC remote port
@@ -396,7 +396,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
396 struct fc_rport_identifiers *ids) 396 struct fc_rport_identifiers *ids)
397{ 397{
398 struct fc_lport *lport = disc->lport; 398 struct fc_lport *lport = disc->lport;
399 struct fc_rport_libfc_priv *rp; 399 struct fc_rport_libfc_priv *rdata;
400 int error = 0; 400 int error = 0;
401 401
402 if (rport && ids->port_name) { 402 if (rport && ids->port_name) {
@@ -430,15 +430,15 @@ static int fc_disc_new_target(struct fc_disc *disc,
430 dp.ids.port_name = ids->port_name; 430 dp.ids.port_name = ids->port_name;
431 dp.ids.node_name = ids->node_name; 431 dp.ids.node_name = ids->node_name;
432 dp.ids.roles = ids->roles; 432 dp.ids.roles = ids->roles;
433 rport = fc_rport_rogue_create(&dp); 433 rport = lport->tt.rport_create(&dp);
434 } 434 }
435 if (!rport) 435 if (!rport)
436 error = -ENOMEM; 436 error = -ENOMEM;
437 } 437 }
438 if (rport) { 438 if (rport) {
439 rp = rport->dd_data; 439 rdata = rport->dd_data;
440 rp->ops = &fc_disc_rport_ops; 440 rdata->ops = &fc_disc_rport_ops;
441 rp->rp_state = RPORT_ST_INIT; 441 rdata->rp_state = RPORT_ST_INIT;
442 lport->tt.rport_login(rport); 442 lport->tt.rport_login(rport);
443 } 443 }
444 } 444 }
@@ -446,20 +446,20 @@ static int fc_disc_new_target(struct fc_disc *disc,
446} 446}
447 447
448/** 448/**
449 * fc_disc_del_target - Delete a target 449 * fc_disc_del_target() - Delete a target
450 * @disc: FC discovery context 450 * @disc: FC discovery context
451 * @rport: The remote port to be removed 451 * @rport: The remote port to be removed
452 */ 452 */
453static void fc_disc_del_target(struct fc_disc *disc, struct fc_rport *rport) 453static void fc_disc_del_target(struct fc_disc *disc, struct fc_rport *rport)
454{ 454{
455 struct fc_lport *lport = disc->lport; 455 struct fc_lport *lport = disc->lport;
456 struct fc_rport_libfc_priv *rdata = RPORT_TO_PRIV(rport); 456 struct fc_rport_libfc_priv *rdata = rport->dd_data;
457 list_del(&rdata->peers); 457 list_del(&rdata->peers);
458 lport->tt.rport_logoff(rport); 458 lport->tt.rport_logoff(rport);
459} 459}
460 460
461/** 461/**
462 * fc_disc_done - Discovery has been completed 462 * fc_disc_done() - Discovery has been completed
463 * @disc: FC discovery context 463 * @disc: FC discovery context
464 */ 464 */
465static void fc_disc_done(struct fc_disc *disc) 465static void fc_disc_done(struct fc_disc *disc)
@@ -479,7 +479,7 @@ static void fc_disc_done(struct fc_disc *disc)
479} 479}
480 480
481/** 481/**
482 * fc_disc_error - Handle error on dNS request 482 * fc_disc_error() - Handle error on dNS request
483 * @disc: FC discovery context 483 * @disc: FC discovery context
484 * @fp: The frame pointer 484 * @fp: The frame pointer
485 */ 485 */
@@ -519,7 +519,7 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
519} 519}
520 520
521/** 521/**
522 * fc_disc_gpn_ft_req - Send Get Port Names by FC-4 type (GPN_FT) request 522 * fc_disc_gpn_ft_req() - Send Get Port Names by FC-4 type (GPN_FT) request
523 * @lport: FC discovery context 523 * @lport: FC discovery context
524 * 524 *
525 * Locking Note: This function expects that the disc_mutex is locked 525 * Locking Note: This function expects that the disc_mutex is locked
@@ -553,7 +553,7 @@ err:
553} 553}
554 554
555/** 555/**
556 * fc_disc_gpn_ft_parse - Parse the list of IDs and names resulting from a request 556 * fc_disc_gpn_ft_parse() - Parse the list of IDs and names resulting from a request
557 * @lport: Fibre Channel host port instance 557 * @lport: Fibre Channel host port instance
558 * @buf: GPN_FT response buffer 558 * @buf: GPN_FT response buffer
559 * @len: size of response buffer 559 * @len: size of response buffer
@@ -617,7 +617,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
617 617
618 if ((dp.ids.port_id != fc_host_port_id(lport->host)) && 618 if ((dp.ids.port_id != fc_host_port_id(lport->host)) &&
619 (dp.ids.port_name != lport->wwpn)) { 619 (dp.ids.port_name != lport->wwpn)) {
620 rport = fc_rport_rogue_create(&dp); 620 rport = lport->tt.rport_create(&dp);
621 if (rport) { 621 if (rport) {
622 rdata = rport->dd_data; 622 rdata = rport->dd_data;
623 rdata->ops = &fc_disc_rport_ops; 623 rdata->ops = &fc_disc_rport_ops;
@@ -658,7 +658,10 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
658 return error; 658 return error;
659} 659}
660 660
661/* 661/**
662 * fc_disc_timeout() - Retry handler for the disc component
663 * @work: Structure holding disc obj that needs retry discovery
664 *
662 * Handle retry of memory allocation for remote ports. 665 * Handle retry of memory allocation for remote ports.
663 */ 666 */
664static void fc_disc_timeout(struct work_struct *work) 667static void fc_disc_timeout(struct work_struct *work)
@@ -673,7 +676,7 @@ static void fc_disc_timeout(struct work_struct *work)
673} 676}
674 677
675/** 678/**
676 * fc_disc_gpn_ft_resp - Handle a response frame from Get Port Names (GPN_FT) 679 * fc_disc_gpn_ft_resp() - Handle a response frame from Get Port Names (GPN_FT)
677 * @sp: Current sequence of GPN_FT exchange 680 * @sp: Current sequence of GPN_FT exchange
678 * @fp: response frame 681 * @fp: response frame
679 * @lp_arg: Fibre Channel host port instance 682 * @lp_arg: Fibre Channel host port instance
@@ -712,9 +715,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
712 fr_len(fp)); 715 fr_len(fp));
713 } else if (ntohs(cp->ct_cmd) == FC_FS_ACC) { 716 } else if (ntohs(cp->ct_cmd) == FC_FS_ACC) {
714 717
715 /* 718 /* Accepted, parse the response. */
716 * Accepted. Parse response.
717 */
718 buf = cp + 1; 719 buf = cp + 1;
719 len -= sizeof(*cp); 720 len -= sizeof(*cp);
720 } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) { 721 } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) {
@@ -746,7 +747,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
746} 747}
747 748
748/** 749/**
749 * fc_disc_single - Discover the directory information for a single target 750 * fc_disc_single() - Discover the directory information for a single target
750 * @lport: FC local port 751 * @lport: FC local port
751 * @dp: The port to rediscover 752 * @dp: The port to rediscover
752 * 753 *
@@ -769,7 +770,7 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
769 if (rport) 770 if (rport)
770 fc_disc_del_target(disc, rport); 771 fc_disc_del_target(disc, rport);
771 772
772 new_rport = fc_rport_rogue_create(dp); 773 new_rport = lport->tt.rport_create(dp);
773 if (new_rport) { 774 if (new_rport) {
774 rdata = new_rport->dd_data; 775 rdata = new_rport->dd_data;
775 rdata->ops = &fc_disc_rport_ops; 776 rdata->ops = &fc_disc_rport_ops;
@@ -782,7 +783,7 @@ out:
782} 783}
783 784
784/** 785/**
785 * fc_disc_stop - Stop discovery for a given lport 786 * fc_disc_stop() - Stop discovery for a given lport
786 * @lport: The lport that discovery should stop for 787 * @lport: The lport that discovery should stop for
787 */ 788 */
788void fc_disc_stop(struct fc_lport *lport) 789void fc_disc_stop(struct fc_lport *lport)
@@ -796,7 +797,7 @@ void fc_disc_stop(struct fc_lport *lport)
796} 797}
797 798
798/** 799/**
799 * fc_disc_stop_final - Stop discovery for a given lport 800 * fc_disc_stop_final() - Stop discovery for a given lport
800 * @lport: The lport that discovery should stop for 801 * @lport: The lport that discovery should stop for
801 * 802 *
802 * This function will block until discovery has been 803 * This function will block until discovery has been
@@ -809,7 +810,7 @@ void fc_disc_stop_final(struct fc_lport *lport)
809} 810}
810 811
811/** 812/**
812 * fc_disc_init - Initialize the discovery block 813 * fc_disc_init() - Initialize the discovery block
813 * @lport: FC local port 814 * @lport: FC local port
814 */ 815 */
815int fc_disc_init(struct fc_lport *lport) 816int fc_disc_init(struct fc_lport *lport)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 66db08a5f27f..505825b6124d 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -32,8 +32,6 @@
32#include <scsi/libfc.h> 32#include <scsi/libfc.h>
33#include <scsi/fc_encode.h> 33#include <scsi/fc_encode.h>
34 34
35#define FC_DEF_R_A_TOV (10 * 1000) /* resource allocation timeout */
36
37/* 35/*
38 * fc_exch_debug can be set in debugger or at compile time to get more logs. 36 * fc_exch_debug can be set in debugger or at compile time to get more logs.
39 */ 37 */
@@ -627,7 +625,6 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
627{ 625{
628 struct fc_exch *ep; 626 struct fc_exch *ep;
629 struct fc_frame_header *fh; 627 struct fc_frame_header *fh;
630 u16 rxid;
631 628
632 ep = mp->lp->tt.exch_get(mp->lp, fp); 629 ep = mp->lp->tt.exch_get(mp->lp, fp);
633 if (ep) { 630 if (ep) {
@@ -654,18 +651,6 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
654 if ((ntoh24(fh->fh_f_ctl) & FC_FC_SEQ_INIT) == 0) 651 if ((ntoh24(fh->fh_f_ctl) & FC_FC_SEQ_INIT) == 0)
655 ep->esb_stat &= ~ESB_ST_SEQ_INIT; 652 ep->esb_stat &= ~ESB_ST_SEQ_INIT;
656 653
657 /*
658 * Set the responder ID in the frame header.
659 * The old one should've been 0xffff.
660 * If it isn't, don't assign one.
661 * Incoming basic link service frames may specify
662 * a referenced RX_ID.
663 */
664 if (fh->fh_type != FC_TYPE_BLS) {
665 rxid = ntohs(fh->fh_rx_id);
666 WARN_ON(rxid != FC_XID_UNKNOWN);
667 fh->fh_rx_id = htons(ep->rxid);
668 }
669 fc_exch_hold(ep); /* hold for caller */ 654 fc_exch_hold(ep); /* hold for caller */
670 spin_unlock_bh(&ep->ex_lock); /* lock from exch_get */ 655 spin_unlock_bh(&ep->ex_lock); /* lock from exch_get */
671 } 656 }
@@ -677,8 +662,8 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
677 * If fc_pf_rjt_reason is FC_RJT_NONE then this function will have a hold 662 * If fc_pf_rjt_reason is FC_RJT_NONE then this function will have a hold
678 * on the ep that should be released by the caller. 663 * on the ep that should be released by the caller.
679 */ 664 */
680static enum fc_pf_rjt_reason 665static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_exch_mgr *mp,
681fc_seq_lookup_recip(struct fc_exch_mgr *mp, struct fc_frame *fp) 666 struct fc_frame *fp)
682{ 667{
683 struct fc_frame_header *fh = fc_frame_header_get(fp); 668 struct fc_frame_header *fh = fc_frame_header_get(fp);
684 struct fc_exch *ep = NULL; 669 struct fc_exch *ep = NULL;
@@ -996,9 +981,9 @@ static void fc_seq_send_ack(struct fc_seq *sp, const struct fc_frame *rx_fp)
996 * Send BLS Reject. 981 * Send BLS Reject.
997 * This is for rejecting BA_ABTS only. 982 * This is for rejecting BA_ABTS only.
998 */ 983 */
999static void 984static void fc_exch_send_ba_rjt(struct fc_frame *rx_fp,
1000fc_exch_send_ba_rjt(struct fc_frame *rx_fp, enum fc_ba_rjt_reason reason, 985 enum fc_ba_rjt_reason reason,
1001 enum fc_ba_rjt_explan explan) 986 enum fc_ba_rjt_explan explan)
1002{ 987{
1003 struct fc_frame *fp; 988 struct fc_frame *fp;
1004 struct fc_frame_header *rx_fh; 989 struct fc_frame_header *rx_fh;
@@ -1096,7 +1081,7 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp)
1096 ap->ba_high_seq_cnt = fh->fh_seq_cnt; 1081 ap->ba_high_seq_cnt = fh->fh_seq_cnt;
1097 ap->ba_low_seq_cnt = htons(sp->cnt); 1082 ap->ba_low_seq_cnt = htons(sp->cnt);
1098 } 1083 }
1099 sp = fc_seq_start_next(sp); 1084 sp = fc_seq_start_next_locked(sp);
1100 spin_unlock_bh(&ep->ex_lock); 1085 spin_unlock_bh(&ep->ex_lock);
1101 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); 1086 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS);
1102 fc_frame_free(rx_fp); 1087 fc_frame_free(rx_fp);
@@ -1480,10 +1465,11 @@ static void fc_exch_reset(struct fc_exch *ep)
1480 * If sid is non-zero, reset only exchanges we source from that FID. 1465 * If sid is non-zero, reset only exchanges we source from that FID.
1481 * If did is non-zero, reset only exchanges destined to that FID. 1466 * If did is non-zero, reset only exchanges destined to that FID.
1482 */ 1467 */
1483void fc_exch_mgr_reset(struct fc_exch_mgr *mp, u32 sid, u32 did) 1468void fc_exch_mgr_reset(struct fc_lport *lp, u32 sid, u32 did)
1484{ 1469{
1485 struct fc_exch *ep; 1470 struct fc_exch *ep;
1486 struct fc_exch *next; 1471 struct fc_exch *next;
1472 struct fc_exch_mgr *mp = lp->emp;
1487 1473
1488 spin_lock_bh(&mp->em_lock); 1474 spin_lock_bh(&mp->em_lock);
1489restart: 1475restart:
@@ -1607,7 +1593,7 @@ static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg)
1607 if (IS_ERR(fp)) { 1593 if (IS_ERR(fp)) {
1608 int err = PTR_ERR(fp); 1594 int err = PTR_ERR(fp);
1609 1595
1610 if (err == -FC_EX_CLOSED) 1596 if (err == -FC_EX_CLOSED || err == -FC_EX_TIMEOUT)
1611 goto cleanup; 1597 goto cleanup;
1612 FC_DBG("Cannot process RRQ, because of frame error %d\n", err); 1598 FC_DBG("Cannot process RRQ, because of frame error %d\n", err);
1613 return; 1599 return;
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 404e63ff46b8..2a631d7dbcec 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -161,7 +161,7 @@ static struct fc_fcp_pkt *fc_fcp_pkt_alloc(struct fc_lport *lp, gfp_t gfp)
161} 161}
162 162
163/** 163/**
164 * fc_fcp_pkt_release - release hold on scsi_pkt packet 164 * fc_fcp_pkt_release() - release hold on scsi_pkt packet
165 * @fsp: fcp packet struct 165 * @fsp: fcp packet struct
166 * 166 *
167 * This is used by upper layer scsi driver. 167 * This is used by upper layer scsi driver.
@@ -183,8 +183,7 @@ static void fc_fcp_pkt_hold(struct fc_fcp_pkt *fsp)
183} 183}
184 184
185/** 185/**
186 * fc_fcp_pkt_destory - release hold on scsi_pkt packet 186 * fc_fcp_pkt_destory() - release hold on scsi_pkt packet
187 *
188 * @seq: exchange sequence 187 * @seq: exchange sequence
189 * @fsp: fcp packet struct 188 * @fsp: fcp packet struct
190 * 189 *
@@ -199,7 +198,7 @@ static void fc_fcp_pkt_destroy(struct fc_seq *seq, void *fsp)
199} 198}
200 199
201/** 200/**
202 * fc_fcp_lock_pkt - lock a packet and get a ref to it. 201 * fc_fcp_lock_pkt() - lock a packet and get a ref to it.
203 * @fsp: fcp packet 202 * @fsp: fcp packet
204 * 203 *
205 * We should only return error if we return a command to scsi-ml before 204 * We should only return error if we return a command to scsi-ml before
@@ -291,9 +290,7 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
291 buf = fc_frame_payload_get(fp, 0); 290 buf = fc_frame_payload_get(fp, 0);
292 291
293 if (offset + len > fsp->data_len) { 292 if (offset + len > fsp->data_len) {
294 /* 293 /* this should never happen */
295 * this should never happen
296 */
297 if ((fr_flags(fp) & FCPHF_CRC_UNCHECKED) && 294 if ((fr_flags(fp) & FCPHF_CRC_UNCHECKED) &&
298 fc_frame_crc_check(fp)) 295 fc_frame_crc_check(fp))
299 goto crc_err; 296 goto crc_err;
@@ -387,8 +384,8 @@ crc_err:
387 fc_fcp_complete_locked(fsp); 384 fc_fcp_complete_locked(fsp);
388} 385}
389 386
390/* 387/**
391 * fc_fcp_send_data - Send SCSI data to target. 388 * fc_fcp_send_data() - Send SCSI data to target.
392 * @fsp: ptr to fc_fcp_pkt 389 * @fsp: ptr to fc_fcp_pkt
393 * @sp: ptr to this sequence 390 * @sp: ptr to this sequence
394 * @offset: starting offset for this data request 391 * @offset: starting offset for this data request
@@ -610,8 +607,8 @@ static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
610 } 607 }
611} 608}
612 609
613/* 610/**
614 * fc_fcp_reduce_can_queue - drop can_queue 611 * fc_fcp_reduce_can_queue() - drop can_queue
615 * @lp: lport to drop queueing for 612 * @lp: lport to drop queueing for
616 * 613 *
617 * If we are getting memory allocation failures, then we may 614 * If we are getting memory allocation failures, then we may
@@ -642,9 +639,11 @@ done:
642 spin_unlock_irqrestore(lp->host->host_lock, flags); 639 spin_unlock_irqrestore(lp->host->host_lock, flags);
643} 640}
644 641
645/* 642/**
646 * exch mgr calls this routine to process scsi 643 * fc_fcp_recv() - Reveive FCP frames
647 * exchanges. 644 * @seq: The sequence the frame is on
645 * @fp: The FC frame
646 * @arg: The related FCP packet
648 * 647 *
649 * Return : None 648 * Return : None
650 * Context : called from Soft IRQ context 649 * Context : called from Soft IRQ context
@@ -832,7 +831,7 @@ err:
832} 831}
833 832
834/** 833/**
835 * fc_fcp_complete_locked - complete processing of a fcp packet 834 * fc_fcp_complete_locked() - complete processing of a fcp packet
836 * @fsp: fcp packet 835 * @fsp: fcp packet
837 * 836 *
838 * This function may sleep if a timer is pending. The packet lock must be 837 * This function may sleep if a timer is pending. The packet lock must be
@@ -900,7 +899,7 @@ static void fc_fcp_cleanup_cmd(struct fc_fcp_pkt *fsp, int error)
900} 899}
901 900
902/** 901/**
903 * fc_fcp_cleanup_each_cmd - run fn on each active command 902 * fc_fcp_cleanup_each_cmd() - Cleanup active commads
904 * @lp: logical port 903 * @lp: logical port
905 * @id: target id 904 * @id: target id
906 * @lun: lun 905 * @lun: lun
@@ -952,7 +951,7 @@ static void fc_fcp_abort_io(struct fc_lport *lp)
952} 951}
953 952
954/** 953/**
955 * fc_fcp_pkt_send - send a fcp packet to the lower level. 954 * fc_fcp_pkt_send() - send a fcp packet to the lower level.
956 * @lp: fc lport 955 * @lp: fc lport
957 * @fsp: fc packet. 956 * @fsp: fc packet.
958 * 957 *
@@ -1621,7 +1620,7 @@ out:
1621static inline int fc_fcp_lport_queue_ready(struct fc_lport *lp) 1620static inline int fc_fcp_lport_queue_ready(struct fc_lport *lp)
1622{ 1621{
1623 /* lock ? */ 1622 /* lock ? */
1624 return (lp->state == LPORT_ST_READY) && (lp->link_status & FC_LINK_UP); 1623 return (lp->state == LPORT_ST_READY) && lp->link_up && !lp->qfull;
1625} 1624}
1626 1625
1627/** 1626/**
@@ -1727,7 +1726,7 @@ out:
1727EXPORT_SYMBOL(fc_queuecommand); 1726EXPORT_SYMBOL(fc_queuecommand);
1728 1727
1729/** 1728/**
1730 * fc_io_compl - Handle responses for completed commands 1729 * fc_io_compl() - Handle responses for completed commands
1731 * @fsp: scsi packet 1730 * @fsp: scsi packet
1732 * 1731 *
1733 * Translates a error to a Linux SCSI error. 1732 * Translates a error to a Linux SCSI error.
@@ -1810,12 +1809,12 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1810 sc_cmd->result = DID_ERROR << 16; 1809 sc_cmd->result = DID_ERROR << 16;
1811 break; 1810 break;
1812 case FC_DATA_UNDRUN: 1811 case FC_DATA_UNDRUN:
1813 if (fsp->cdb_status == 0) { 1812 if ((fsp->cdb_status == 0) && !(fsp->req_flags & FC_SRB_READ)) {
1814 /* 1813 /*
1815 * scsi status is good but transport level 1814 * scsi status is good but transport level
1816 * underrun. for read it should be an error?? 1815 * underrun.
1817 */ 1816 */
1818 sc_cmd->result = (DID_OK << 16) | fsp->cdb_status; 1817 sc_cmd->result = DID_OK << 16;
1819 } else { 1818 } else {
1820 /* 1819 /*
1821 * scsi got underrun, this is an error 1820 * scsi got underrun, this is an error
@@ -1857,7 +1856,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1857} 1856}
1858 1857
1859/** 1858/**
1860 * fc_fcp_complete - complete processing of a fcp packet 1859 * fc_fcp_complete() - complete processing of a fcp packet
1861 * @fsp: fcp packet 1860 * @fsp: fcp packet
1862 * 1861 *
1863 * This function may sleep if a fsp timer is pending. 1862 * This function may sleep if a fsp timer is pending.
@@ -1874,9 +1873,10 @@ void fc_fcp_complete(struct fc_fcp_pkt *fsp)
1874EXPORT_SYMBOL(fc_fcp_complete); 1873EXPORT_SYMBOL(fc_fcp_complete);
1875 1874
1876/** 1875/**
1877 * fc_eh_abort - Abort a command...from scsi host template 1876 * fc_eh_abort() - Abort a command
1878 * @sc_cmd: scsi command to abort 1877 * @sc_cmd: scsi command to abort
1879 * 1878 *
1879 * From scsi host template.
1880 * send ABTS to the target device and wait for the response 1880 * send ABTS to the target device and wait for the response
1881 * sc_cmd is the pointer to the command to be aborted. 1881 * sc_cmd is the pointer to the command to be aborted.
1882 */ 1882 */
@@ -1890,7 +1890,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
1890 lp = shost_priv(sc_cmd->device->host); 1890 lp = shost_priv(sc_cmd->device->host);
1891 if (lp->state != LPORT_ST_READY) 1891 if (lp->state != LPORT_ST_READY)
1892 return rc; 1892 return rc;
1893 else if (!(lp->link_status & FC_LINK_UP)) 1893 else if (!lp->link_up)
1894 return rc; 1894 return rc;
1895 1895
1896 spin_lock_irqsave(lp->host->host_lock, flags); 1896 spin_lock_irqsave(lp->host->host_lock, flags);
@@ -1920,7 +1920,7 @@ release_pkt:
1920EXPORT_SYMBOL(fc_eh_abort); 1920EXPORT_SYMBOL(fc_eh_abort);
1921 1921
1922/** 1922/**
1923 * fc_eh_device_reset: Reset a single LUN 1923 * fc_eh_device_reset() Reset a single LUN
1924 * @sc_cmd: scsi command 1924 * @sc_cmd: scsi command
1925 * 1925 *
1926 * Set from scsi host template to send tm cmd to the target and wait for the 1926 * Set from scsi host template to send tm cmd to the target and wait for the
@@ -1973,7 +1973,7 @@ out:
1973EXPORT_SYMBOL(fc_eh_device_reset); 1973EXPORT_SYMBOL(fc_eh_device_reset);
1974 1974
1975/** 1975/**
1976 * fc_eh_host_reset - The reset function will reset the ports on the host. 1976 * fc_eh_host_reset() - The reset function will reset the ports on the host.
1977 * @sc_cmd: scsi command 1977 * @sc_cmd: scsi command
1978 */ 1978 */
1979int fc_eh_host_reset(struct scsi_cmnd *sc_cmd) 1979int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)
@@ -1999,7 +1999,7 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)
1999EXPORT_SYMBOL(fc_eh_host_reset); 1999EXPORT_SYMBOL(fc_eh_host_reset);
2000 2000
2001/** 2001/**
2002 * fc_slave_alloc - configure queue depth 2002 * fc_slave_alloc() - configure queue depth
2003 * @sdev: scsi device 2003 * @sdev: scsi device
2004 * 2004 *
2005 * Configures queue depth based on host's cmd_per_len. If not set 2005 * Configures queue depth based on host's cmd_per_len. If not set
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 0b9bdb1fb807..2ae50a1188e6 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -139,7 +139,7 @@ static int fc_frame_drop(struct fc_lport *lport, struct fc_frame *fp)
139} 139}
140 140
141/** 141/**
142 * fc_lport_rport_callback - Event handler for rport events 142 * fc_lport_rport_callback() - Event handler for rport events
143 * @lport: The lport which is receiving the event 143 * @lport: The lport which is receiving the event
144 * @rport: The rport which the event has occured on 144 * @rport: The rport which the event has occured on
145 * @event: The event that occured 145 * @event: The event that occured
@@ -195,7 +195,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport,
195} 195}
196 196
197/** 197/**
198 * fc_lport_state - Return a string which represents the lport's state 198 * fc_lport_state() - Return a string which represents the lport's state
199 * @lport: The lport whose state is to converted to a string 199 * @lport: The lport whose state is to converted to a string
200 */ 200 */
201static const char *fc_lport_state(struct fc_lport *lport) 201static const char *fc_lport_state(struct fc_lport *lport)
@@ -209,7 +209,7 @@ static const char *fc_lport_state(struct fc_lport *lport)
209} 209}
210 210
211/** 211/**
212 * fc_lport_ptp_setup - Create an rport for point-to-point mode 212 * fc_lport_ptp_setup() - Create an rport for point-to-point mode
213 * @lport: The lport to attach the ptp rport to 213 * @lport: The lport to attach the ptp rport to
214 * @fid: The FID of the ptp rport 214 * @fid: The FID of the ptp rport
215 * @remote_wwpn: The WWPN of the ptp rport 215 * @remote_wwpn: The WWPN of the ptp rport
@@ -232,7 +232,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport,
232 lport->ptp_rp = NULL; 232 lport->ptp_rp = NULL;
233 } 233 }
234 234
235 lport->ptp_rp = fc_rport_rogue_create(&dp); 235 lport->ptp_rp = lport->tt.rport_create(&dp);
236 236
237 lport->tt.rport_login(lport->ptp_rp); 237 lport->tt.rport_login(lport->ptp_rp);
238 238
@@ -250,7 +250,7 @@ void fc_get_host_port_state(struct Scsi_Host *shost)
250{ 250{
251 struct fc_lport *lp = shost_priv(shost); 251 struct fc_lport *lp = shost_priv(shost);
252 252
253 if ((lp->link_status & FC_LINK_UP) == FC_LINK_UP) 253 if (lp->link_up)
254 fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; 254 fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
255 else 255 else
256 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; 256 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
@@ -351,7 +351,7 @@ static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type)
351} 351}
352 352
353/** 353/**
354 * fc_lport_recv_rlir_req - Handle received Registered Link Incident Report. 354 * fc_lport_recv_rlir_req() - Handle received Registered Link Incident Report.
355 * @lport: Fibre Channel local port recieving the RLIR 355 * @lport: Fibre Channel local port recieving the RLIR
356 * @sp: current sequence in the RLIR exchange 356 * @sp: current sequence in the RLIR exchange
357 * @fp: RLIR request frame 357 * @fp: RLIR request frame
@@ -370,7 +370,7 @@ static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
370} 370}
371 371
372/** 372/**
373 * fc_lport_recv_echo_req - Handle received ECHO request 373 * fc_lport_recv_echo_req() - Handle received ECHO request
374 * @lport: Fibre Channel local port recieving the ECHO 374 * @lport: Fibre Channel local port recieving the ECHO
375 * @sp: current sequence in the ECHO exchange 375 * @sp: current sequence in the ECHO exchange
376 * @fp: ECHO request frame 376 * @fp: ECHO request frame
@@ -412,7 +412,7 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
412} 412}
413 413
414/** 414/**
415 * fc_lport_recv_echo_req - Handle received Request Node ID data request 415 * fc_lport_recv_echo_req() - Handle received Request Node ID data request
416 * @lport: Fibre Channel local port recieving the RNID 416 * @lport: Fibre Channel local port recieving the RNID
417 * @sp: current sequence in the RNID exchange 417 * @sp: current sequence in the RNID exchange
418 * @fp: RNID request frame 418 * @fp: RNID request frame
@@ -479,7 +479,7 @@ static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
479} 479}
480 480
481/** 481/**
482 * fc_lport_recv_adisc_req - Handle received Address Discovery Request 482 * fc_lport_recv_adisc_req() - Handle received Address Discovery Request
483 * @lport: Fibre Channel local port recieving the ADISC 483 * @lport: Fibre Channel local port recieving the ADISC
484 * @sp: current sequence in the ADISC exchange 484 * @sp: current sequence in the ADISC exchange
485 * @fp: ADISC request frame 485 * @fp: ADISC request frame
@@ -529,7 +529,7 @@ static void fc_lport_recv_adisc_req(struct fc_seq *sp, struct fc_frame *in_fp,
529} 529}
530 530
531/** 531/**
532 * fc_lport_recv_logo_req - Handle received fabric LOGO request 532 * fc_lport_recv_logo_req() - Handle received fabric LOGO request
533 * @lport: Fibre Channel local port recieving the LOGO 533 * @lport: Fibre Channel local port recieving the LOGO
534 * @sp: current sequence in the LOGO exchange 534 * @sp: current sequence in the LOGO exchange
535 * @fp: LOGO request frame 535 * @fp: LOGO request frame
@@ -546,7 +546,7 @@ static void fc_lport_recv_logo_req(struct fc_seq *sp, struct fc_frame *fp,
546} 546}
547 547
548/** 548/**
549 * fc_fabric_login - Start the lport state machine 549 * fc_fabric_login() - Start the lport state machine
550 * @lport: The lport that should log into the fabric 550 * @lport: The lport that should log into the fabric
551 * 551 *
552 * Locking Note: This function should not be called 552 * Locking Note: This function should not be called
@@ -568,7 +568,7 @@ int fc_fabric_login(struct fc_lport *lport)
568EXPORT_SYMBOL(fc_fabric_login); 568EXPORT_SYMBOL(fc_fabric_login);
569 569
570/** 570/**
571 * fc_linkup - Handler for transport linkup events 571 * fc_linkup() - Handler for transport linkup events
572 * @lport: The lport whose link is up 572 * @lport: The lport whose link is up
573 */ 573 */
574void fc_linkup(struct fc_lport *lport) 574void fc_linkup(struct fc_lport *lport)
@@ -577,8 +577,8 @@ void fc_linkup(struct fc_lport *lport)
577 fc_host_port_id(lport->host)); 577 fc_host_port_id(lport->host));
578 578
579 mutex_lock(&lport->lp_mutex); 579 mutex_lock(&lport->lp_mutex);
580 if ((lport->link_status & FC_LINK_UP) != FC_LINK_UP) { 580 if (!lport->link_up) {
581 lport->link_status |= FC_LINK_UP; 581 lport->link_up = 1;
582 582
583 if (lport->state == LPORT_ST_RESET) 583 if (lport->state == LPORT_ST_RESET)
584 fc_lport_enter_flogi(lport); 584 fc_lport_enter_flogi(lport);
@@ -588,7 +588,7 @@ void fc_linkup(struct fc_lport *lport)
588EXPORT_SYMBOL(fc_linkup); 588EXPORT_SYMBOL(fc_linkup);
589 589
590/** 590/**
591 * fc_linkdown - Handler for transport linkdown events 591 * fc_linkdown() - Handler for transport linkdown events
592 * @lport: The lport whose link is down 592 * @lport: The lport whose link is down
593 */ 593 */
594void fc_linkdown(struct fc_lport *lport) 594void fc_linkdown(struct fc_lport *lport)
@@ -597,8 +597,8 @@ void fc_linkdown(struct fc_lport *lport)
597 FC_DEBUG_LPORT("Link is down for port (%6x)\n", 597 FC_DEBUG_LPORT("Link is down for port (%6x)\n",
598 fc_host_port_id(lport->host)); 598 fc_host_port_id(lport->host));
599 599
600 if ((lport->link_status & FC_LINK_UP) == FC_LINK_UP) { 600 if (lport->link_up) {
601 lport->link_status &= ~(FC_LINK_UP); 601 lport->link_up = 0;
602 fc_lport_enter_reset(lport); 602 fc_lport_enter_reset(lport);
603 lport->tt.fcp_cleanup(lport); 603 lport->tt.fcp_cleanup(lport);
604 } 604 }
@@ -607,48 +607,25 @@ void fc_linkdown(struct fc_lport *lport)
607EXPORT_SYMBOL(fc_linkdown); 607EXPORT_SYMBOL(fc_linkdown);
608 608
609/** 609/**
610 * fc_pause - Pause the flow of frames 610 * fc_fabric_logoff() - Logout of the fabric
611 * @lport: The lport to be paused
612 */
613void fc_pause(struct fc_lport *lport)
614{
615 mutex_lock(&lport->lp_mutex);
616 lport->link_status |= FC_PAUSE;
617 mutex_unlock(&lport->lp_mutex);
618}
619EXPORT_SYMBOL(fc_pause);
620
621/**
622 * fc_unpause - Unpause the flow of frames
623 * @lport: The lport to be unpaused
624 */
625void fc_unpause(struct fc_lport *lport)
626{
627 mutex_lock(&lport->lp_mutex);
628 lport->link_status &= ~(FC_PAUSE);
629 mutex_unlock(&lport->lp_mutex);
630}
631EXPORT_SYMBOL(fc_unpause);
632
633/**
634 * fc_fabric_logoff - Logout of the fabric
635 * @lport: fc_lport pointer to logoff the fabric 611 * @lport: fc_lport pointer to logoff the fabric
636 * 612 *
637 * Return value: 613 * Return value:
638 * 0 for success, -1 for failure 614 * 0 for success, -1 for failure
639 **/ 615 */
640int fc_fabric_logoff(struct fc_lport *lport) 616int fc_fabric_logoff(struct fc_lport *lport)
641{ 617{
642 lport->tt.disc_stop_final(lport); 618 lport->tt.disc_stop_final(lport);
643 mutex_lock(&lport->lp_mutex); 619 mutex_lock(&lport->lp_mutex);
644 fc_lport_enter_logo(lport); 620 fc_lport_enter_logo(lport);
645 mutex_unlock(&lport->lp_mutex); 621 mutex_unlock(&lport->lp_mutex);
622 cancel_delayed_work_sync(&lport->retry_work);
646 return 0; 623 return 0;
647} 624}
648EXPORT_SYMBOL(fc_fabric_logoff); 625EXPORT_SYMBOL(fc_fabric_logoff);
649 626
650/** 627/**
651 * fc_lport_destroy - unregister a fc_lport 628 * fc_lport_destroy() - unregister a fc_lport
652 * @lport: fc_lport pointer to unregister 629 * @lport: fc_lport pointer to unregister
653 * 630 *
654 * Return value: 631 * Return value:
@@ -658,26 +635,25 @@ EXPORT_SYMBOL(fc_fabric_logoff);
658 * clean-up all the allocated memory 635 * clean-up all the allocated memory
659 * and free up other system resources. 636 * and free up other system resources.
660 * 637 *
661 **/ 638 */
662int fc_lport_destroy(struct fc_lport *lport) 639int fc_lport_destroy(struct fc_lport *lport)
663{ 640{
664 lport->tt.frame_send = fc_frame_drop; 641 lport->tt.frame_send = fc_frame_drop;
665 lport->tt.fcp_abort_io(lport); 642 lport->tt.fcp_abort_io(lport);
666 lport->tt.exch_mgr_reset(lport->emp, 0, 0); 643 lport->tt.exch_mgr_reset(lport, 0, 0);
667 return 0; 644 return 0;
668} 645}
669EXPORT_SYMBOL(fc_lport_destroy); 646EXPORT_SYMBOL(fc_lport_destroy);
670 647
671/** 648/**
672 * fc_set_mfs - sets up the mfs for the corresponding fc_lport 649 * fc_set_mfs() - sets up the mfs for the corresponding fc_lport
673 * @lport: fc_lport pointer to unregister 650 * @lport: fc_lport pointer to unregister
674 * @mfs: the new mfs for fc_lport 651 * @mfs: the new mfs for fc_lport
675 * 652 *
676 * Set mfs for the given fc_lport to the new mfs. 653 * Set mfs for the given fc_lport to the new mfs.
677 * 654 *
678 * Return: 0 for success 655 * Return: 0 for success
679 * 656 */
680 **/
681int fc_set_mfs(struct fc_lport *lport, u32 mfs) 657int fc_set_mfs(struct fc_lport *lport, u32 mfs)
682{ 658{
683 unsigned int old_mfs; 659 unsigned int old_mfs;
@@ -706,7 +682,7 @@ int fc_set_mfs(struct fc_lport *lport, u32 mfs)
706EXPORT_SYMBOL(fc_set_mfs); 682EXPORT_SYMBOL(fc_set_mfs);
707 683
708/** 684/**
709 * fc_lport_disc_callback - Callback for discovery events 685 * fc_lport_disc_callback() - Callback for discovery events
710 * @lport: FC local port 686 * @lport: FC local port
711 * @event: The discovery event 687 * @event: The discovery event
712 */ 688 */
@@ -731,7 +707,7 @@ void fc_lport_disc_callback(struct fc_lport *lport, enum fc_disc_event event)
731} 707}
732 708
733/** 709/**
734 * fc_rport_enter_ready - Enter the ready state and start discovery 710 * fc_rport_enter_ready() - Enter the ready state and start discovery
735 * @lport: Fibre Channel local port that is ready 711 * @lport: Fibre Channel local port that is ready
736 * 712 *
737 * Locking Note: The lport lock is expected to be held before calling 713 * Locking Note: The lport lock is expected to be held before calling
@@ -748,7 +724,7 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
748} 724}
749 725
750/** 726/**
751 * fc_lport_recv_flogi_req - Receive a FLOGI request 727 * fc_lport_recv_flogi_req() - Receive a FLOGI request
752 * @sp_in: The sequence the FLOGI is on 728 * @sp_in: The sequence the FLOGI is on
753 * @rx_fp: The frame the FLOGI is in 729 * @rx_fp: The frame the FLOGI is in
754 * @lport: The lport that recieved the request 730 * @lport: The lport that recieved the request
@@ -838,7 +814,7 @@ out:
838} 814}
839 815
840/** 816/**
841 * fc_lport_recv_req - The generic lport request handler 817 * fc_lport_recv_req() - The generic lport request handler
842 * @lport: The lport that received the request 818 * @lport: The lport that received the request
843 * @sp: The sequence the request is on 819 * @sp: The sequence the request is on
844 * @fp: The frame the request is in 820 * @fp: The frame the request is in
@@ -934,7 +910,7 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp,
934} 910}
935 911
936/** 912/**
937 * fc_lport_reset - Reset an lport 913 * fc_lport_reset() - Reset an lport
938 * @lport: The lport which should be reset 914 * @lport: The lport which should be reset
939 * 915 *
940 * Locking Note: This functions should not be called with the 916 * Locking Note: This functions should not be called with the
@@ -942,6 +918,7 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp,
942 */ 918 */
943int fc_lport_reset(struct fc_lport *lport) 919int fc_lport_reset(struct fc_lport *lport)
944{ 920{
921 cancel_delayed_work_sync(&lport->retry_work);
945 mutex_lock(&lport->lp_mutex); 922 mutex_lock(&lport->lp_mutex);
946 fc_lport_enter_reset(lport); 923 fc_lport_enter_reset(lport);
947 mutex_unlock(&lport->lp_mutex); 924 mutex_unlock(&lport->lp_mutex);
@@ -950,7 +927,7 @@ int fc_lport_reset(struct fc_lport *lport)
950EXPORT_SYMBOL(fc_lport_reset); 927EXPORT_SYMBOL(fc_lport_reset);
951 928
952/** 929/**
953 * fc_rport_enter_reset - Reset the local port 930 * fc_rport_enter_reset() - Reset the local port
954 * @lport: Fibre Channel local port to be reset 931 * @lport: Fibre Channel local port to be reset
955 * 932 *
956 * Locking Note: The lport lock is expected to be held before calling 933 * Locking Note: The lport lock is expected to be held before calling
@@ -973,16 +950,16 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
973 950
974 lport->tt.disc_stop(lport); 951 lport->tt.disc_stop(lport);
975 952
976 lport->tt.exch_mgr_reset(lport->emp, 0, 0); 953 lport->tt.exch_mgr_reset(lport, 0, 0);
977 fc_host_fabric_name(lport->host) = 0; 954 fc_host_fabric_name(lport->host) = 0;
978 fc_host_port_id(lport->host) = 0; 955 fc_host_port_id(lport->host) = 0;
979 956
980 if ((lport->link_status & FC_LINK_UP) == FC_LINK_UP) 957 if (lport->link_up)
981 fc_lport_enter_flogi(lport); 958 fc_lport_enter_flogi(lport);
982} 959}
983 960
984/** 961/**
985 * fc_lport_error - Handler for any errors 962 * fc_lport_error() - Handler for any errors
986 * @lport: The fc_lport object 963 * @lport: The fc_lport object
987 * @fp: The frame pointer 964 * @fp: The frame pointer
988 * 965 *
@@ -1029,8 +1006,8 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp)
1029} 1006}
1030 1007
1031/** 1008/**
1032 * fc_lport_rft_id_resp - Handle response to Register Fibre 1009 * fc_lport_rft_id_resp() - Handle response to Register Fibre
1033 * Channel Types by ID (RPN_ID) request 1010 * Channel Types by ID (RPN_ID) request
1034 * @sp: current sequence in RPN_ID exchange 1011 * @sp: current sequence in RPN_ID exchange
1035 * @fp: response frame 1012 * @fp: response frame
1036 * @lp_arg: Fibre Channel host port instance 1013 * @lp_arg: Fibre Channel host port instance
@@ -1053,17 +1030,17 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1053 1030
1054 FC_DEBUG_LPORT("Received a RFT_ID response\n"); 1031 FC_DEBUG_LPORT("Received a RFT_ID response\n");
1055 1032
1033 if (IS_ERR(fp)) {
1034 fc_lport_error(lport, fp);
1035 goto err;
1036 }
1037
1056 if (lport->state != LPORT_ST_RFT_ID) { 1038 if (lport->state != LPORT_ST_RFT_ID) {
1057 FC_DBG("Received a RFT_ID response, but in state %s\n", 1039 FC_DBG("Received a RFT_ID response, but in state %s\n",
1058 fc_lport_state(lport)); 1040 fc_lport_state(lport));
1059 goto out; 1041 goto out;
1060 } 1042 }
1061 1043
1062 if (IS_ERR(fp)) {
1063 fc_lport_error(lport, fp);
1064 goto err;
1065 }
1066
1067 fh = fc_frame_header_get(fp); 1044 fh = fc_frame_header_get(fp);
1068 ct = fc_frame_payload_get(fp, sizeof(*ct)); 1045 ct = fc_frame_payload_get(fp, sizeof(*ct));
1069 1046
@@ -1081,8 +1058,8 @@ err:
1081} 1058}
1082 1059
1083/** 1060/**
1084 * fc_lport_rpn_id_resp - Handle response to Register Port 1061 * fc_lport_rpn_id_resp() - Handle response to Register Port
1085 * Name by ID (RPN_ID) request 1062 * Name by ID (RPN_ID) request
1086 * @sp: current sequence in RPN_ID exchange 1063 * @sp: current sequence in RPN_ID exchange
1087 * @fp: response frame 1064 * @fp: response frame
1088 * @lp_arg: Fibre Channel host port instance 1065 * @lp_arg: Fibre Channel host port instance
@@ -1105,17 +1082,17 @@ static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1105 1082
1106 FC_DEBUG_LPORT("Received a RPN_ID response\n"); 1083 FC_DEBUG_LPORT("Received a RPN_ID response\n");
1107 1084
1085 if (IS_ERR(fp)) {
1086 fc_lport_error(lport, fp);
1087 goto err;
1088 }
1089
1108 if (lport->state != LPORT_ST_RPN_ID) { 1090 if (lport->state != LPORT_ST_RPN_ID) {
1109 FC_DBG("Received a RPN_ID response, but in state %s\n", 1091 FC_DBG("Received a RPN_ID response, but in state %s\n",
1110 fc_lport_state(lport)); 1092 fc_lport_state(lport));
1111 goto out; 1093 goto out;
1112 } 1094 }
1113 1095
1114 if (IS_ERR(fp)) {
1115 fc_lport_error(lport, fp);
1116 goto err;
1117 }
1118
1119 fh = fc_frame_header_get(fp); 1096 fh = fc_frame_header_get(fp);
1120 ct = fc_frame_payload_get(fp, sizeof(*ct)); 1097 ct = fc_frame_payload_get(fp, sizeof(*ct));
1121 if (fh && ct && fh->fh_type == FC_TYPE_CT && 1098 if (fh && ct && fh->fh_type == FC_TYPE_CT &&
@@ -1133,7 +1110,7 @@ err:
1133} 1110}
1134 1111
1135/** 1112/**
1136 * fc_lport_scr_resp - Handle response to State Change Register (SCR) request 1113 * fc_lport_scr_resp() - Handle response to State Change Register (SCR) request
1137 * @sp: current sequence in SCR exchange 1114 * @sp: current sequence in SCR exchange
1138 * @fp: response frame 1115 * @fp: response frame
1139 * @lp_arg: Fibre Channel lport port instance that sent the registration request 1116 * @lp_arg: Fibre Channel lport port instance that sent the registration request
@@ -1155,17 +1132,17 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
1155 1132
1156 FC_DEBUG_LPORT("Received a SCR response\n"); 1133 FC_DEBUG_LPORT("Received a SCR response\n");
1157 1134
1135 if (IS_ERR(fp)) {
1136 fc_lport_error(lport, fp);
1137 goto err;
1138 }
1139
1158 if (lport->state != LPORT_ST_SCR) { 1140 if (lport->state != LPORT_ST_SCR) {
1159 FC_DBG("Received a SCR response, but in state %s\n", 1141 FC_DBG("Received a SCR response, but in state %s\n",
1160 fc_lport_state(lport)); 1142 fc_lport_state(lport));
1161 goto out; 1143 goto out;
1162 } 1144 }
1163 1145
1164 if (IS_ERR(fp)) {
1165 fc_lport_error(lport, fp);
1166 goto err;
1167 }
1168
1169 op = fc_frame_payload_op(fp); 1146 op = fc_frame_payload_op(fp);
1170 if (op == ELS_LS_ACC) 1147 if (op == ELS_LS_ACC)
1171 fc_lport_enter_ready(lport); 1148 fc_lport_enter_ready(lport);
@@ -1179,7 +1156,7 @@ err:
1179} 1156}
1180 1157
1181/** 1158/**
1182 * fc_lport_enter_scr - Send a State Change Register (SCR) request 1159 * fc_lport_enter_scr() - Send a State Change Register (SCR) request
1183 * @lport: Fibre Channel local port to register for state changes 1160 * @lport: Fibre Channel local port to register for state changes
1184 * 1161 *
1185 * Locking Note: The lport lock is expected to be held before calling 1162 * Locking Note: The lport lock is expected to be held before calling
@@ -1206,7 +1183,7 @@ static void fc_lport_enter_scr(struct fc_lport *lport)
1206} 1183}
1207 1184
1208/** 1185/**
1209 * fc_lport_enter_rft_id - Register FC4-types with the name server 1186 * fc_lport_enter_rft_id() - Register FC4-types with the name server
1210 * @lport: Fibre Channel local port to register 1187 * @lport: Fibre Channel local port to register
1211 * 1188 *
1212 * Locking Note: The lport lock is expected to be held before calling 1189 * Locking Note: The lport lock is expected to be held before calling
@@ -1248,7 +1225,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport)
1248} 1225}
1249 1226
1250/** 1227/**
1251 * fc_rport_enter_rft_id - Register port name with the name server 1228 * fc_rport_enter_rft_id() - Register port name with the name server
1252 * @lport: Fibre Channel local port to register 1229 * @lport: Fibre Channel local port to register
1253 * 1230 *
1254 * Locking Note: The lport lock is expected to be held before calling 1231 * Locking Note: The lport lock is expected to be held before calling
@@ -1281,7 +1258,7 @@ static struct fc_rport_operations fc_lport_rport_ops = {
1281}; 1258};
1282 1259
1283/** 1260/**
1284 * fc_rport_enter_dns - Create a rport to the name server 1261 * fc_rport_enter_dns() - Create a rport to the name server
1285 * @lport: Fibre Channel local port requesting a rport for the name server 1262 * @lport: Fibre Channel local port requesting a rport for the name server
1286 * 1263 *
1287 * Locking Note: The lport lock is expected to be held before calling 1264 * Locking Note: The lport lock is expected to be held before calling
@@ -1304,7 +1281,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport)
1304 1281
1305 fc_lport_state_enter(lport, LPORT_ST_DNS); 1282 fc_lport_state_enter(lport, LPORT_ST_DNS);
1306 1283
1307 rport = fc_rport_rogue_create(&dp); 1284 rport = lport->tt.rport_create(&dp);
1308 if (!rport) 1285 if (!rport)
1309 goto err; 1286 goto err;
1310 1287
@@ -1318,7 +1295,7 @@ err:
1318} 1295}
1319 1296
1320/** 1297/**
1321 * fc_lport_timeout - Handler for the retry_work timer. 1298 * fc_lport_timeout() - Handler for the retry_work timer.
1322 * @work: The work struct of the fc_lport 1299 * @work: The work struct of the fc_lport
1323 */ 1300 */
1324static void fc_lport_timeout(struct work_struct *work) 1301static void fc_lport_timeout(struct work_struct *work)
@@ -1359,7 +1336,7 @@ static void fc_lport_timeout(struct work_struct *work)
1359} 1336}
1360 1337
1361/** 1338/**
1362 * fc_lport_logo_resp - Handle response to LOGO request 1339 * fc_lport_logo_resp() - Handle response to LOGO request
1363 * @sp: current sequence in LOGO exchange 1340 * @sp: current sequence in LOGO exchange
1364 * @fp: response frame 1341 * @fp: response frame
1365 * @lp_arg: Fibre Channel lport port instance that sent the LOGO request 1342 * @lp_arg: Fibre Channel lport port instance that sent the LOGO request
@@ -1381,17 +1358,17 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
1381 1358
1382 FC_DEBUG_LPORT("Received a LOGO response\n"); 1359 FC_DEBUG_LPORT("Received a LOGO response\n");
1383 1360
1361 if (IS_ERR(fp)) {
1362 fc_lport_error(lport, fp);
1363 goto err;
1364 }
1365
1384 if (lport->state != LPORT_ST_LOGO) { 1366 if (lport->state != LPORT_ST_LOGO) {
1385 FC_DBG("Received a LOGO response, but in state %s\n", 1367 FC_DBG("Received a LOGO response, but in state %s\n",
1386 fc_lport_state(lport)); 1368 fc_lport_state(lport));
1387 goto out; 1369 goto out;
1388 } 1370 }
1389 1371
1390 if (IS_ERR(fp)) {
1391 fc_lport_error(lport, fp);
1392 goto err;
1393 }
1394
1395 op = fc_frame_payload_op(fp); 1372 op = fc_frame_payload_op(fp);
1396 if (op == ELS_LS_ACC) 1373 if (op == ELS_LS_ACC)
1397 fc_lport_enter_reset(lport); 1374 fc_lport_enter_reset(lport);
@@ -1405,7 +1382,7 @@ err:
1405} 1382}
1406 1383
1407/** 1384/**
1408 * fc_rport_enter_logo - Logout of the fabric 1385 * fc_rport_enter_logo() - Logout of the fabric
1409 * @lport: Fibre Channel local port to be logged out 1386 * @lport: Fibre Channel local port to be logged out
1410 * 1387 *
1411 * Locking Note: The lport lock is expected to be held before calling 1388 * Locking Note: The lport lock is expected to be held before calling
@@ -1437,7 +1414,7 @@ static void fc_lport_enter_logo(struct fc_lport *lport)
1437} 1414}
1438 1415
1439/** 1416/**
1440 * fc_lport_flogi_resp - Handle response to FLOGI request 1417 * fc_lport_flogi_resp() - Handle response to FLOGI request
1441 * @sp: current sequence in FLOGI exchange 1418 * @sp: current sequence in FLOGI exchange
1442 * @fp: response frame 1419 * @fp: response frame
1443 * @lp_arg: Fibre Channel lport port instance that sent the FLOGI request 1420 * @lp_arg: Fibre Channel lport port instance that sent the FLOGI request
@@ -1465,17 +1442,17 @@ static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1465 1442
1466 FC_DEBUG_LPORT("Received a FLOGI response\n"); 1443 FC_DEBUG_LPORT("Received a FLOGI response\n");
1467 1444
1445 if (IS_ERR(fp)) {
1446 fc_lport_error(lport, fp);
1447 goto err;
1448 }
1449
1468 if (lport->state != LPORT_ST_FLOGI) { 1450 if (lport->state != LPORT_ST_FLOGI) {
1469 FC_DBG("Received a FLOGI response, but in state %s\n", 1451 FC_DBG("Received a FLOGI response, but in state %s\n",
1470 fc_lport_state(lport)); 1452 fc_lport_state(lport));
1471 goto out; 1453 goto out;
1472 } 1454 }
1473 1455
1474 if (IS_ERR(fp)) {
1475 fc_lport_error(lport, fp);
1476 goto err;
1477 }
1478
1479 fh = fc_frame_header_get(fp); 1456 fh = fc_frame_header_get(fp);
1480 did = ntoh24(fh->fh_d_id); 1457 did = ntoh24(fh->fh_d_id);
1481 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { 1458 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {
@@ -1532,7 +1509,7 @@ err:
1532} 1509}
1533 1510
1534/** 1511/**
1535 * fc_rport_enter_flogi - Send a FLOGI request to the fabric manager 1512 * fc_rport_enter_flogi() - Send a FLOGI request to the fabric manager
1536 * @lport: Fibre Channel local port to be logged in to the fabric 1513 * @lport: Fibre Channel local port to be logged in to the fabric
1537 * 1514 *
1538 * Locking Note: The lport lock is expected to be held before calling 1515 * Locking Note: The lport lock is expected to be held before calling
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index e780d8caf70e..dae65133a833 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -81,6 +81,7 @@ static void fc_rport_recv_logo_req(struct fc_rport *,
81 struct fc_seq *, struct fc_frame *); 81 struct fc_seq *, struct fc_frame *);
82static void fc_rport_timeout(struct work_struct *); 82static void fc_rport_timeout(struct work_struct *);
83static void fc_rport_error(struct fc_rport *, struct fc_frame *); 83static void fc_rport_error(struct fc_rport *, struct fc_frame *);
84static void fc_rport_error_retry(struct fc_rport *, struct fc_frame *);
84static void fc_rport_work(struct work_struct *); 85static void fc_rport_work(struct work_struct *);
85 86
86static const char *fc_rport_state_names[] = { 87static const char *fc_rport_state_names[] = {
@@ -145,7 +146,7 @@ struct fc_rport *fc_rport_rogue_create(struct fc_disc_port *dp)
145} 146}
146 147
147/** 148/**
148 * fc_rport_state - return a string for the state the rport is in 149 * fc_rport_state() - return a string for the state the rport is in
149 * @rport: The rport whose state we want to get a string for 150 * @rport: The rport whose state we want to get a string for
150 */ 151 */
151static const char *fc_rport_state(struct fc_rport *rport) 152static const char *fc_rport_state(struct fc_rport *rport)
@@ -160,7 +161,7 @@ static const char *fc_rport_state(struct fc_rport *rport)
160} 161}
161 162
162/** 163/**
163 * fc_set_rport_loss_tmo - Set the remote port loss timeout in seconds. 164 * fc_set_rport_loss_tmo() - Set the remote port loss timeout in seconds.
164 * @rport: Pointer to Fibre Channel remote port structure 165 * @rport: Pointer to Fibre Channel remote port structure
165 * @timeout: timeout in seconds 166 * @timeout: timeout in seconds
166 */ 167 */
@@ -174,12 +175,12 @@ void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout)
174EXPORT_SYMBOL(fc_set_rport_loss_tmo); 175EXPORT_SYMBOL(fc_set_rport_loss_tmo);
175 176
176/** 177/**
177 * fc_plogi_get_maxframe - Get max payload from the common service parameters 178 * fc_plogi_get_maxframe() - Get max payload from the common service parameters
178 * @flp: FLOGI payload structure 179 * @flp: FLOGI payload structure
179 * @maxval: upper limit, may be less than what is in the service parameters 180 * @maxval: upper limit, may be less than what is in the service parameters
180 */ 181 */
181static unsigned int 182static unsigned int fc_plogi_get_maxframe(struct fc_els_flogi *flp,
182fc_plogi_get_maxframe(struct fc_els_flogi *flp, unsigned int maxval) 183 unsigned int maxval)
183{ 184{
184 unsigned int mfs; 185 unsigned int mfs;
185 186
@@ -197,7 +198,7 @@ fc_plogi_get_maxframe(struct fc_els_flogi *flp, unsigned int maxval)
197} 198}
198 199
199/** 200/**
200 * fc_rport_state_enter - Change the rport's state 201 * fc_rport_state_enter() - Change the rport's state
201 * @rport: The rport whose state should change 202 * @rport: The rport whose state should change
202 * @new: The new state of the rport 203 * @new: The new state of the rport
203 * 204 *
@@ -214,6 +215,7 @@ static void fc_rport_state_enter(struct fc_rport *rport,
214 215
215static void fc_rport_work(struct work_struct *work) 216static void fc_rport_work(struct work_struct *work)
216{ 217{
218 u32 port_id;
217 struct fc_rport_libfc_priv *rdata = 219 struct fc_rport_libfc_priv *rdata =
218 container_of(work, struct fc_rport_libfc_priv, event_work); 220 container_of(work, struct fc_rport_libfc_priv, event_work);
219 enum fc_rport_event event; 221 enum fc_rport_event event;
@@ -279,14 +281,18 @@ static void fc_rport_work(struct work_struct *work)
279 rport_ops->event_callback(lport, rport, event); 281 rport_ops->event_callback(lport, rport, event);
280 if (trans_state == FC_PORTSTATE_ROGUE) 282 if (trans_state == FC_PORTSTATE_ROGUE)
281 put_device(&rport->dev); 283 put_device(&rport->dev);
282 else 284 else {
285 port_id = rport->port_id;
283 fc_remote_port_delete(rport); 286 fc_remote_port_delete(rport);
287 lport->tt.exch_mgr_reset(lport, 0, port_id);
288 lport->tt.exch_mgr_reset(lport, port_id, 0);
289 }
284 } else 290 } else
285 mutex_unlock(&rdata->rp_mutex); 291 mutex_unlock(&rdata->rp_mutex);
286} 292}
287 293
288/** 294/**
289 * fc_rport_login - Start the remote port login state machine 295 * fc_rport_login() - Start the remote port login state machine
290 * @rport: Fibre Channel remote port 296 * @rport: Fibre Channel remote port
291 * 297 *
292 * Locking Note: Called without the rport lock held. This 298 * Locking Note: Called without the rport lock held. This
@@ -309,7 +315,7 @@ int fc_rport_login(struct fc_rport *rport)
309} 315}
310 316
311/** 317/**
312 * fc_rport_logoff - Logoff and remove an rport 318 * fc_rport_logoff() - Logoff and remove an rport
313 * @rport: Fibre Channel remote port to be removed 319 * @rport: Fibre Channel remote port to be removed
314 * 320 *
315 * Locking Note: Called without the rport lock held. This 321 * Locking Note: Called without the rport lock held. This
@@ -347,7 +353,7 @@ int fc_rport_logoff(struct fc_rport *rport)
347} 353}
348 354
349/** 355/**
350 * fc_rport_enter_ready - The rport is ready 356 * fc_rport_enter_ready() - The rport is ready
351 * @rport: Fibre Channel remote port that is ready 357 * @rport: Fibre Channel remote port that is ready
352 * 358 *
353 * Locking Note: The rport lock is expected to be held before calling 359 * Locking Note: The rport lock is expected to be held before calling
@@ -366,7 +372,7 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
366} 372}
367 373
368/** 374/**
369 * fc_rport_timeout - Handler for the retry_work timer. 375 * fc_rport_timeout() - Handler for the retry_work timer.
370 * @work: The work struct of the fc_rport_libfc_priv 376 * @work: The work struct of the fc_rport_libfc_priv
371 * 377 *
372 * Locking Note: Called without the rport lock held. This 378 * Locking Note: Called without the rport lock held. This
@@ -405,59 +411,75 @@ static void fc_rport_timeout(struct work_struct *work)
405} 411}
406 412
407/** 413/**
408 * fc_rport_error - Handler for any errors 414 * fc_rport_error() - Error handler, called once retries have been exhausted
409 * @rport: The fc_rport object 415 * @rport: The fc_rport object
410 * @fp: The frame pointer 416 * @fp: The frame pointer
411 * 417 *
412 * If the error was caused by a resource allocation failure
413 * then wait for half a second and retry, otherwise retry
414 * immediately.
415 *
416 * Locking Note: The rport lock is expected to be held before 418 * Locking Note: The rport lock is expected to be held before
417 * calling this routine 419 * calling this routine
418 */ 420 */
419static void fc_rport_error(struct fc_rport *rport, struct fc_frame *fp) 421static void fc_rport_error(struct fc_rport *rport, struct fc_frame *fp)
420{ 422{
421 struct fc_rport_libfc_priv *rdata = rport->dd_data; 423 struct fc_rport_libfc_priv *rdata = rport->dd_data;
422 unsigned long delay = 0;
423 424
424 FC_DEBUG_RPORT("Error %ld in state %s, retries %d\n", 425 FC_DEBUG_RPORT("Error %ld in state %s, retries %d\n",
425 PTR_ERR(fp), fc_rport_state(rport), rdata->retries); 426 PTR_ERR(fp), fc_rport_state(rport), rdata->retries);
426 427
427 if (!fp || PTR_ERR(fp) == -FC_EX_TIMEOUT) { 428 switch (rdata->rp_state) {
428 /* 429 case RPORT_ST_PLOGI:
429 * Memory allocation failure, or the exchange timed out. 430 case RPORT_ST_PRLI:
430 * Retry after delay 431 case RPORT_ST_LOGO:
431 */ 432 rdata->event = RPORT_EV_FAILED;
432 if (rdata->retries < rdata->local_port->max_retry_count) { 433 queue_work(rport_event_queue,
433 rdata->retries++; 434 &rdata->event_work);
434 if (!fp) 435 break;
435 delay = msecs_to_jiffies(500); 436 case RPORT_ST_RTV:
436 get_device(&rport->dev); 437 fc_rport_enter_ready(rport);
437 schedule_delayed_work(&rdata->retry_work, delay); 438 break;
438 } else { 439 case RPORT_ST_NONE:
439 switch (rdata->rp_state) { 440 case RPORT_ST_READY:
440 case RPORT_ST_PLOGI: 441 case RPORT_ST_INIT:
441 case RPORT_ST_PRLI: 442 break;
442 case RPORT_ST_LOGO:
443 rdata->event = RPORT_EV_FAILED;
444 queue_work(rport_event_queue,
445 &rdata->event_work);
446 break;
447 case RPORT_ST_RTV:
448 fc_rport_enter_ready(rport);
449 break;
450 case RPORT_ST_NONE:
451 case RPORT_ST_READY:
452 case RPORT_ST_INIT:
453 break;
454 }
455 }
456 } 443 }
457} 444}
458 445
459/** 446/**
460 * fc_rport_plogi_recv_resp - Handle incoming ELS PLOGI response 447 * fc_rport_error_retry() - Error handler when retries are desired
448 * @rport: The fc_rport object
449 * @fp: The frame pointer
450 *
451 * If the error was an exchange timeout retry immediately,
452 * otherwise wait for E_D_TOV.
453 *
454 * Locking Note: The rport lock is expected to be held before
455 * calling this routine
456 */
457static void fc_rport_error_retry(struct fc_rport *rport, struct fc_frame *fp)
458{
459 struct fc_rport_libfc_priv *rdata = rport->dd_data;
460 unsigned long delay = FC_DEF_E_D_TOV;
461
462 /* make sure this isn't an FC_EX_CLOSED error, never retry those */
463 if (PTR_ERR(fp) == -FC_EX_CLOSED)
464 return fc_rport_error(rport, fp);
465
466 if (rdata->retries < rdata->local_port->max_retry_count) {
467 FC_DEBUG_RPORT("Error %ld in state %s, retrying\n",
468 PTR_ERR(fp), fc_rport_state(rport));
469 rdata->retries++;
470 /* no additional delay on exchange timeouts */
471 if (PTR_ERR(fp) == -FC_EX_TIMEOUT)
472 delay = 0;
473 get_device(&rport->dev);
474 schedule_delayed_work(&rdata->retry_work, delay);
475 return;
476 }
477
478 return fc_rport_error(rport, fp);
479}
480
481/**
482 * fc_rport_plogi_recv_resp() - Handle incoming ELS PLOGI response
461 * @sp: current sequence in the PLOGI exchange 483 * @sp: current sequence in the PLOGI exchange
462 * @fp: response frame 484 * @fp: response frame
463 * @rp_arg: Fibre Channel remote port 485 * @rp_arg: Fibre Channel remote port
@@ -483,17 +505,17 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
483 FC_DEBUG_RPORT("Received a PLOGI response from port (%6x)\n", 505 FC_DEBUG_RPORT("Received a PLOGI response from port (%6x)\n",
484 rport->port_id); 506 rport->port_id);
485 507
508 if (IS_ERR(fp)) {
509 fc_rport_error_retry(rport, fp);
510 goto err;
511 }
512
486 if (rdata->rp_state != RPORT_ST_PLOGI) { 513 if (rdata->rp_state != RPORT_ST_PLOGI) {
487 FC_DBG("Received a PLOGI response, but in state %s\n", 514 FC_DBG("Received a PLOGI response, but in state %s\n",
488 fc_rport_state(rport)); 515 fc_rport_state(rport));
489 goto out; 516 goto out;
490 } 517 }
491 518
492 if (IS_ERR(fp)) {
493 fc_rport_error(rport, fp);
494 goto err;
495 }
496
497 op = fc_frame_payload_op(fp); 519 op = fc_frame_payload_op(fp);
498 if (op == ELS_LS_ACC && 520 if (op == ELS_LS_ACC &&
499 (plp = fc_frame_payload_get(fp, sizeof(*plp))) != NULL) { 521 (plp = fc_frame_payload_get(fp, sizeof(*plp))) != NULL) {
@@ -522,7 +544,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
522 else 544 else
523 fc_rport_enter_prli(rport); 545 fc_rport_enter_prli(rport);
524 } else 546 } else
525 fc_rport_error(rport, fp); 547 fc_rport_error_retry(rport, fp);
526 548
527out: 549out:
528 fc_frame_free(fp); 550 fc_frame_free(fp);
@@ -532,7 +554,7 @@ err:
532} 554}
533 555
534/** 556/**
535 * fc_rport_enter_plogi - Send Port Login (PLOGI) request to peer 557 * fc_rport_enter_plogi() - Send Port Login (PLOGI) request to peer
536 * @rport: Fibre Channel remote port to send PLOGI to 558 * @rport: Fibre Channel remote port to send PLOGI to
537 * 559 *
538 * Locking Note: The rport lock is expected to be held before calling 560 * Locking Note: The rport lock is expected to be held before calling
@@ -552,20 +574,20 @@ static void fc_rport_enter_plogi(struct fc_rport *rport)
552 rport->maxframe_size = FC_MIN_MAX_PAYLOAD; 574 rport->maxframe_size = FC_MIN_MAX_PAYLOAD;
553 fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi)); 575 fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi));
554 if (!fp) { 576 if (!fp) {
555 fc_rport_error(rport, fp); 577 fc_rport_error_retry(rport, fp);
556 return; 578 return;
557 } 579 }
558 rdata->e_d_tov = lport->e_d_tov; 580 rdata->e_d_tov = lport->e_d_tov;
559 581
560 if (!lport->tt.elsct_send(lport, rport, fp, ELS_PLOGI, 582 if (!lport->tt.elsct_send(lport, rport, fp, ELS_PLOGI,
561 fc_rport_plogi_resp, rport, lport->e_d_tov)) 583 fc_rport_plogi_resp, rport, lport->e_d_tov))
562 fc_rport_error(rport, fp); 584 fc_rport_error_retry(rport, fp);
563 else 585 else
564 get_device(&rport->dev); 586 get_device(&rport->dev);
565} 587}
566 588
567/** 589/**
568 * fc_rport_prli_resp - Process Login (PRLI) response handler 590 * fc_rport_prli_resp() - Process Login (PRLI) response handler
569 * @sp: current sequence in the PRLI exchange 591 * @sp: current sequence in the PRLI exchange
570 * @fp: response frame 592 * @fp: response frame
571 * @rp_arg: Fibre Channel remote port 593 * @rp_arg: Fibre Channel remote port
@@ -592,17 +614,17 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
592 FC_DEBUG_RPORT("Received a PRLI response from port (%6x)\n", 614 FC_DEBUG_RPORT("Received a PRLI response from port (%6x)\n",
593 rport->port_id); 615 rport->port_id);
594 616
617 if (IS_ERR(fp)) {
618 fc_rport_error_retry(rport, fp);
619 goto err;
620 }
621
595 if (rdata->rp_state != RPORT_ST_PRLI) { 622 if (rdata->rp_state != RPORT_ST_PRLI) {
596 FC_DBG("Received a PRLI response, but in state %s\n", 623 FC_DBG("Received a PRLI response, but in state %s\n",
597 fc_rport_state(rport)); 624 fc_rport_state(rport));
598 goto out; 625 goto out;
599 } 626 }
600 627
601 if (IS_ERR(fp)) {
602 fc_rport_error(rport, fp);
603 goto err;
604 }
605
606 op = fc_frame_payload_op(fp); 628 op = fc_frame_payload_op(fp);
607 if (op == ELS_LS_ACC) { 629 if (op == ELS_LS_ACC) {
608 pp = fc_frame_payload_get(fp, sizeof(*pp)); 630 pp = fc_frame_payload_get(fp, sizeof(*pp));
@@ -635,7 +657,7 @@ err:
635} 657}
636 658
637/** 659/**
638 * fc_rport_logo_resp - Logout (LOGO) response handler 660 * fc_rport_logo_resp() - Logout (LOGO) response handler
639 * @sp: current sequence in the LOGO exchange 661 * @sp: current sequence in the LOGO exchange
640 * @fp: response frame 662 * @fp: response frame
641 * @rp_arg: Fibre Channel remote port 663 * @rp_arg: Fibre Channel remote port
@@ -657,7 +679,7 @@ static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
657 rport->port_id); 679 rport->port_id);
658 680
659 if (IS_ERR(fp)) { 681 if (IS_ERR(fp)) {
660 fc_rport_error(rport, fp); 682 fc_rport_error_retry(rport, fp);
661 goto err; 683 goto err;
662 } 684 }
663 685
@@ -684,7 +706,7 @@ err:
684} 706}
685 707
686/** 708/**
687 * fc_rport_enter_prli - Send Process Login (PRLI) request to peer 709 * fc_rport_enter_prli() - Send Process Login (PRLI) request to peer
688 * @rport: Fibre Channel remote port to send PRLI to 710 * @rport: Fibre Channel remote port to send PRLI to
689 * 711 *
690 * Locking Note: The rport lock is expected to be held before calling 712 * Locking Note: The rport lock is expected to be held before calling
@@ -707,19 +729,19 @@ static void fc_rport_enter_prli(struct fc_rport *rport)
707 729
708 fp = fc_frame_alloc(lport, sizeof(*pp)); 730 fp = fc_frame_alloc(lport, sizeof(*pp));
709 if (!fp) { 731 if (!fp) {
710 fc_rport_error(rport, fp); 732 fc_rport_error_retry(rport, fp);
711 return; 733 return;
712 } 734 }
713 735
714 if (!lport->tt.elsct_send(lport, rport, fp, ELS_PRLI, 736 if (!lport->tt.elsct_send(lport, rport, fp, ELS_PRLI,
715 fc_rport_prli_resp, rport, lport->e_d_tov)) 737 fc_rport_prli_resp, rport, lport->e_d_tov))
716 fc_rport_error(rport, fp); 738 fc_rport_error_retry(rport, fp);
717 else 739 else
718 get_device(&rport->dev); 740 get_device(&rport->dev);
719} 741}
720 742
721/** 743/**
722 * fc_rport_els_rtv_resp - Request Timeout Value response handler 744 * fc_rport_els_rtv_resp() - Request Timeout Value response handler
723 * @sp: current sequence in the RTV exchange 745 * @sp: current sequence in the RTV exchange
724 * @fp: response frame 746 * @fp: response frame
725 * @rp_arg: Fibre Channel remote port 747 * @rp_arg: Fibre Channel remote port
@@ -742,17 +764,17 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
742 FC_DEBUG_RPORT("Received a RTV response from port (%6x)\n", 764 FC_DEBUG_RPORT("Received a RTV response from port (%6x)\n",
743 rport->port_id); 765 rport->port_id);
744 766
767 if (IS_ERR(fp)) {
768 fc_rport_error(rport, fp);
769 goto err;
770 }
771
745 if (rdata->rp_state != RPORT_ST_RTV) { 772 if (rdata->rp_state != RPORT_ST_RTV) {
746 FC_DBG("Received a RTV response, but in state %s\n", 773 FC_DBG("Received a RTV response, but in state %s\n",
747 fc_rport_state(rport)); 774 fc_rport_state(rport));
748 goto out; 775 goto out;
749 } 776 }
750 777
751 if (IS_ERR(fp)) {
752 fc_rport_error(rport, fp);
753 goto err;
754 }
755
756 op = fc_frame_payload_op(fp); 778 op = fc_frame_payload_op(fp);
757 if (op == ELS_LS_ACC) { 779 if (op == ELS_LS_ACC) {
758 struct fc_els_rtv_acc *rtv; 780 struct fc_els_rtv_acc *rtv;
@@ -785,7 +807,7 @@ err:
785} 807}
786 808
787/** 809/**
788 * fc_rport_enter_rtv - Send Request Timeout Value (RTV) request to peer 810 * fc_rport_enter_rtv() - Send Request Timeout Value (RTV) request to peer
789 * @rport: Fibre Channel remote port to send RTV to 811 * @rport: Fibre Channel remote port to send RTV to
790 * 812 *
791 * Locking Note: The rport lock is expected to be held before calling 813 * Locking Note: The rport lock is expected to be held before calling
@@ -804,19 +826,19 @@ static void fc_rport_enter_rtv(struct fc_rport *rport)
804 826
805 fp = fc_frame_alloc(lport, sizeof(struct fc_els_rtv)); 827 fp = fc_frame_alloc(lport, sizeof(struct fc_els_rtv));
806 if (!fp) { 828 if (!fp) {
807 fc_rport_error(rport, fp); 829 fc_rport_error_retry(rport, fp);
808 return; 830 return;
809 } 831 }
810 832
811 if (!lport->tt.elsct_send(lport, rport, fp, ELS_RTV, 833 if (!lport->tt.elsct_send(lport, rport, fp, ELS_RTV,
812 fc_rport_rtv_resp, rport, lport->e_d_tov)) 834 fc_rport_rtv_resp, rport, lport->e_d_tov))
813 fc_rport_error(rport, fp); 835 fc_rport_error_retry(rport, fp);
814 else 836 else
815 get_device(&rport->dev); 837 get_device(&rport->dev);
816} 838}
817 839
818/** 840/**
819 * fc_rport_enter_logo - Send Logout (LOGO) request to peer 841 * fc_rport_enter_logo() - Send Logout (LOGO) request to peer
820 * @rport: Fibre Channel remote port to send LOGO to 842 * @rport: Fibre Channel remote port to send LOGO to
821 * 843 *
822 * Locking Note: The rport lock is expected to be held before calling 844 * Locking Note: The rport lock is expected to be held before calling
@@ -835,20 +857,20 @@ static void fc_rport_enter_logo(struct fc_rport *rport)
835 857
836 fp = fc_frame_alloc(lport, sizeof(struct fc_els_logo)); 858 fp = fc_frame_alloc(lport, sizeof(struct fc_els_logo));
837 if (!fp) { 859 if (!fp) {
838 fc_rport_error(rport, fp); 860 fc_rport_error_retry(rport, fp);
839 return; 861 return;
840 } 862 }
841 863
842 if (!lport->tt.elsct_send(lport, rport, fp, ELS_LOGO, 864 if (!lport->tt.elsct_send(lport, rport, fp, ELS_LOGO,
843 fc_rport_logo_resp, rport, lport->e_d_tov)) 865 fc_rport_logo_resp, rport, lport->e_d_tov))
844 fc_rport_error(rport, fp); 866 fc_rport_error_retry(rport, fp);
845 else 867 else
846 get_device(&rport->dev); 868 get_device(&rport->dev);
847} 869}
848 870
849 871
850/** 872/**
851 * fc_rport_recv_req - Receive a request from a rport 873 * fc_rport_recv_req() - Receive a request from a rport
852 * @sp: current sequence in the PLOGI exchange 874 * @sp: current sequence in the PLOGI exchange
853 * @fp: response frame 875 * @fp: response frame
854 * @rp_arg: Fibre Channel remote port 876 * @rp_arg: Fibre Channel remote port
@@ -909,7 +931,7 @@ void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
909} 931}
910 932
911/** 933/**
912 * fc_rport_recv_plogi_req - Handle incoming Port Login (PLOGI) request 934 * fc_rport_recv_plogi_req() - Handle incoming Port Login (PLOGI) request
913 * @rport: Fibre Channel remote port that initiated PLOGI 935 * @rport: Fibre Channel remote port that initiated PLOGI
914 * @sp: current sequence in the PLOGI exchange 936 * @sp: current sequence in the PLOGI exchange
915 * @fp: PLOGI request frame 937 * @fp: PLOGI request frame
@@ -1031,7 +1053,7 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
1031} 1053}
1032 1054
1033/** 1055/**
1034 * fc_rport_recv_prli_req - Handle incoming Process Login (PRLI) request 1056 * fc_rport_recv_prli_req() - Handle incoming Process Login (PRLI) request
1035 * @rport: Fibre Channel remote port that initiated PRLI 1057 * @rport: Fibre Channel remote port that initiated PRLI
1036 * @sp: current sequence in the PRLI exchange 1058 * @sp: current sequence in the PRLI exchange
1037 * @fp: PRLI request frame 1059 * @fp: PRLI request frame
@@ -1182,7 +1204,7 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
1182} 1204}
1183 1205
1184/** 1206/**
1185 * fc_rport_recv_prlo_req - Handle incoming Process Logout (PRLO) request 1207 * fc_rport_recv_prlo_req() - Handle incoming Process Logout (PRLO) request
1186 * @rport: Fibre Channel remote port that initiated PRLO 1208 * @rport: Fibre Channel remote port that initiated PRLO
1187 * @sp: current sequence in the PRLO exchange 1209 * @sp: current sequence in the PRLO exchange
1188 * @fp: PRLO request frame 1210 * @fp: PRLO request frame
@@ -1213,7 +1235,7 @@ static void fc_rport_recv_prlo_req(struct fc_rport *rport, struct fc_seq *sp,
1213} 1235}
1214 1236
1215/** 1237/**
1216 * fc_rport_recv_logo_req - Handle incoming Logout (LOGO) request 1238 * fc_rport_recv_logo_req() - Handle incoming Logout (LOGO) request
1217 * @rport: Fibre Channel remote port that initiated LOGO 1239 * @rport: Fibre Channel remote port that initiated LOGO
1218 * @sp: current sequence in the LOGO exchange 1240 * @sp: current sequence in the LOGO exchange
1219 * @fp: LOGO request frame 1241 * @fp: LOGO request frame
@@ -1249,6 +1271,9 @@ static void fc_rport_flush_queue(void)
1249 1271
1250int fc_rport_init(struct fc_lport *lport) 1272int fc_rport_init(struct fc_lport *lport)
1251{ 1273{
1274 if (!lport->tt.rport_create)
1275 lport->tt.rport_create = fc_rport_rogue_create;
1276
1252 if (!lport->tt.rport_login) 1277 if (!lport->tt.rport_login)
1253 lport->tt.rport_login = fc_rport_login; 1278 lport->tt.rport_login = fc_rport_login;
1254 1279
@@ -1285,7 +1310,7 @@ void fc_rport_terminate_io(struct fc_rport *rport)
1285 struct fc_rport_libfc_priv *rdata = rport->dd_data; 1310 struct fc_rport_libfc_priv *rdata = rport->dd_data;
1286 struct fc_lport *lport = rdata->local_port; 1311 struct fc_lport *lport = rdata->local_port;
1287 1312
1288 lport->tt.exch_mgr_reset(lport->emp, 0, rport->port_id); 1313 lport->tt.exch_mgr_reset(lport, 0, rport->port_id);
1289 lport->tt.exch_mgr_reset(lport->emp, rport->port_id, 0); 1314 lport->tt.exch_mgr_reset(lport, rport->port_id, 0);
1290} 1315}
1291EXPORT_SYMBOL(fc_rport_terminate_io); 1316EXPORT_SYMBOL(fc_rport_terminate_io);
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 257c24115de9..809d32d95c76 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1998,6 +1998,8 @@ int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev)
1998 if (!shost->can_queue) 1998 if (!shost->can_queue)
1999 shost->can_queue = ISCSI_DEF_XMIT_CMDS_MAX; 1999 shost->can_queue = ISCSI_DEF_XMIT_CMDS_MAX;
2000 2000
2001 if (!shost->transportt->eh_timed_out)
2002 shost->transportt->eh_timed_out = iscsi_eh_cmd_timed_out;
2001 return scsi_add_host(shost, pdev); 2003 return scsi_add_host(shost, pdev);
2002} 2004}
2003EXPORT_SYMBOL_GPL(iscsi_host_add); 2005EXPORT_SYMBOL_GPL(iscsi_host_add);
@@ -2020,7 +2022,6 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
2020 shost = scsi_host_alloc(sht, sizeof(struct iscsi_host) + dd_data_size); 2022 shost = scsi_host_alloc(sht, sizeof(struct iscsi_host) + dd_data_size);
2021 if (!shost) 2023 if (!shost)
2022 return NULL; 2024 return NULL;
2023 shost->transportt->eh_timed_out = iscsi_eh_cmd_timed_out;
2024 2025
2025 if (qdepth > ISCSI_MAX_CMD_PER_LUN || qdepth < 1) { 2026 if (qdepth > ISCSI_MAX_CMD_PER_LUN || qdepth < 1) {
2026 if (qdepth != 0) 2027 if (qdepth != 0)
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index a8f30bdaff69..a7302480bc4a 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -5258,6 +5258,7 @@ lpfc_send_els_event(struct lpfc_vport *vport,
5258 sizeof(struct lpfc_name)); 5258 sizeof(struct lpfc_name));
5259 break; 5259 break;
5260 default: 5260 default:
5261 kfree(els_data);
5261 return; 5262 return;
5262 } 5263 }
5263 memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name)); 5264 memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name));
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 33a3c13fd893..ee9d40152430 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -244,12 +244,6 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
244 if (ha->optrom_state != QLA_SWAITING) 244 if (ha->optrom_state != QLA_SWAITING)
245 break; 245 break;
246 246
247 if (start & 0xfff) {
248 qla_printk(KERN_WARNING, ha,
249 "Invalid start region 0x%x/0x%x.\n", start, size);
250 return -EINVAL;
251 }
252
253 ha->optrom_region_start = start; 247 ha->optrom_region_start = start;
254 ha->optrom_region_size = start + size > ha->optrom_size ? 248 ha->optrom_region_size = start + size > ha->optrom_size ?
255 ha->optrom_size - start : size; 249 ha->optrom_size - start : size;
@@ -303,8 +297,7 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
303 else if (start == (ha->flt_region_boot * 4) || 297 else if (start == (ha->flt_region_boot * 4) ||
304 start == (ha->flt_region_fw * 4)) 298 start == (ha->flt_region_fw * 4))
305 valid = 1; 299 valid = 1;
306 else if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && 300 else if (IS_QLA25XX(ha) || IS_QLA81XX(ha))
307 start == (ha->flt_region_vpd_nvram * 4))
308 valid = 1; 301 valid = 1;
309 if (!valid) { 302 if (!valid) {
310 qla_printk(KERN_WARNING, ha, 303 qla_printk(KERN_WARNING, ha,
@@ -1265,13 +1258,6 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1265 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) 1258 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
1266 msleep(1000); 1259 msleep(1000);
1267 1260
1268 if (ha->mqenable) {
1269 if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS)
1270 qla_printk(KERN_WARNING, ha,
1271 "Queue delete failed.\n");
1272 vha->req_ques[0] = ha->req_q_map[0]->id;
1273 }
1274
1275 qla24xx_disable_vp(vha); 1261 qla24xx_disable_vp(vha);
1276 1262
1277 fc_remove_host(vha->host); 1263 fc_remove_host(vha->host);
@@ -1293,6 +1279,12 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1293 vha->host_no, vha->vp_idx, vha)); 1279 vha->host_no, vha->vp_idx, vha));
1294 } 1280 }
1295 1281
1282 if (ha->mqenable) {
1283 if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS)
1284 qla_printk(KERN_WARNING, ha,
1285 "Queue delete failed.\n");
1286 }
1287
1296 scsi_host_put(vha->host); 1288 scsi_host_put(vha->host);
1297 qla_printk(KERN_INFO, ha, "vport %d deleted\n", id); 1289 qla_printk(KERN_INFO, ha, "vport %d deleted\n", id);
1298 return 0; 1290 return 0;
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 023ee77fb027..e0c5bb54b258 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2135,6 +2135,7 @@ struct qla_msix_entry {
2135/* Work events. */ 2135/* Work events. */
2136enum qla_work_type { 2136enum qla_work_type {
2137 QLA_EVT_AEN, 2137 QLA_EVT_AEN,
2138 QLA_EVT_IDC_ACK,
2138}; 2139};
2139 2140
2140 2141
@@ -2149,6 +2150,10 @@ struct qla_work_evt {
2149 enum fc_host_event_code code; 2150 enum fc_host_event_code code;
2150 u32 data; 2151 u32 data;
2151 } aen; 2152 } aen;
2153 struct {
2154#define QLA_IDC_ACK_REGS 7
2155 uint16_t mb[QLA_IDC_ACK_REGS];
2156 } idc_ack;
2152 } u; 2157 } u;
2153}; 2158};
2154 2159
diff --git a/drivers/scsi/qla2xxx/qla_devtbl.h b/drivers/scsi/qla2xxx/qla_devtbl.h
index d78d35e681ab..d6ea69df7c5c 100644
--- a/drivers/scsi/qla2xxx/qla_devtbl.h
+++ b/drivers/scsi/qla2xxx/qla_devtbl.h
@@ -72,7 +72,7 @@ static char *qla2x00_model_name[QLA_MODEL_NAMES*2] = {
72 "QLA2462", "Sun PCI-X 2.0 to 4Gb FC, Dual Channel", /* 0x141 */ 72 "QLA2462", "Sun PCI-X 2.0 to 4Gb FC, Dual Channel", /* 0x141 */
73 "QLE2460", "Sun PCI-Express to 2Gb FC, Single Channel", /* 0x142 */ 73 "QLE2460", "Sun PCI-Express to 2Gb FC, Single Channel", /* 0x142 */
74 "QLE2462", "Sun PCI-Express to 4Gb FC, Single Channel", /* 0x143 */ 74 "QLE2462", "Sun PCI-Express to 4Gb FC, Single Channel", /* 0x143 */
75 "QEM2462" "Server I/O Module 4Gb FC, Dual Channel", /* 0x144 */ 75 "QEM2462", "Server I/O Module 4Gb FC, Dual Channel", /* 0x144 */
76 "QLE2440", "PCI-Express to 4Gb FC, Single Channel", /* 0x145 */ 76 "QLE2440", "PCI-Express to 4Gb FC, Single Channel", /* 0x145 */
77 "QLE2464", "PCI-Express to 4Gb FC, Quad Channel", /* 0x146 */ 77 "QLE2464", "PCI-Express to 4Gb FC, Quad Channel", /* 0x146 */
78 "QLA2440", "PCI-X 2.0 to 4Gb FC, Single Channel", /* 0x147 */ 78 "QLA2440", "PCI-X 2.0 to 4Gb FC, Single Channel", /* 0x147 */
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 7abb045a0410..ffff42554087 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -1402,6 +1402,8 @@ struct access_chip_rsp_84xx {
1402#define MBA_IDC_NOTIFY 0x8101 1402#define MBA_IDC_NOTIFY 0x8101
1403#define MBA_IDC_TIME_EXT 0x8102 1403#define MBA_IDC_TIME_EXT 0x8102
1404 1404
1405#define MBC_IDC_ACK 0x101
1406
1405struct nvram_81xx { 1407struct nvram_81xx {
1406 /* NVRAM header. */ 1408 /* NVRAM header. */
1407 uint8_t id[4]; 1409 uint8_t id[4];
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index a336b4bc81a7..6de283f8f111 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -72,6 +72,7 @@ extern int qla2x00_loop_reset(scsi_qla_host_t *);
72extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); 72extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
73extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum 73extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum
74 fc_host_event_code, u32); 74 fc_host_event_code, u32);
75extern int qla2x00_post_idc_ack_work(struct scsi_qla_host *, uint16_t *);
75 76
76extern void qla2x00_abort_fcport_cmds(fc_port_t *); 77extern void qla2x00_abort_fcport_cmds(fc_port_t *);
77extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, 78extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *,
@@ -266,6 +267,8 @@ qla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *);
266 267
267extern int qla84xx_verify_chip(struct scsi_qla_host *, uint16_t *); 268extern int qla84xx_verify_chip(struct scsi_qla_host *, uint16_t *);
268 269
270extern int qla81xx_idc_ack(scsi_qla_host_t *, uint16_t *);
271
269/* 272/*
270 * Global Function Prototypes in qla_isr.c source file. 273 * Global Function Prototypes in qla_isr.c source file.
271 */ 274 */
@@ -376,10 +379,8 @@ extern int qla2x00_dfs_remove(scsi_qla_host_t *);
376 379
377/* Globa function prototypes for multi-q */ 380/* Globa function prototypes for multi-q */
378extern int qla25xx_request_irq(struct rsp_que *); 381extern int qla25xx_request_irq(struct rsp_que *);
379extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *, 382extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *);
380 uint8_t); 383extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *);
381extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *,
382 uint8_t);
383extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t, 384extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t,
384 uint16_t, uint8_t, uint8_t); 385 uint16_t, uint8_t, uint8_t);
385extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t, 386extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t,
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index f6368a1d3021..87f9abc71460 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1226,9 +1226,8 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
1226 icb->firmware_options_2 |= 1226 icb->firmware_options_2 |=
1227 __constant_cpu_to_le32(BIT_18); 1227 __constant_cpu_to_le32(BIT_18);
1228 1228
1229 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_22); 1229 icb->firmware_options_2 &= __constant_cpu_to_le32(~BIT_22);
1230 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23); 1230 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23);
1231 ha->rsp_q_map[0]->options = icb->firmware_options_2;
1232 1231
1233 WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0); 1232 WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0);
1234 WRT_REG_DWORD(&reg->isp25mq.req_q_out, 0); 1233 WRT_REG_DWORD(&reg->isp25mq.req_q_out, 0);
@@ -1309,8 +1308,12 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
1309 1308
1310 DEBUG(printk("scsi(%ld): Issue init firmware.\n", vha->host_no)); 1309 DEBUG(printk("scsi(%ld): Issue init firmware.\n", vha->host_no));
1311 1310
1312 if (ha->flags.npiv_supported) 1311 if (ha->flags.npiv_supported) {
1312 if (ha->operating_mode == LOOP)
1313 ha->max_npiv_vports = MIN_MULTI_ID_FABRIC - 1;
1313 mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports); 1314 mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports);
1315 }
1316
1314 1317
1315 mid_init_cb->options = __constant_cpu_to_le16(BIT_1); 1318 mid_init_cb->options = __constant_cpu_to_le16(BIT_1);
1316 1319
@@ -2611,6 +2614,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
2611 port_id_t wrap, nxt_d_id; 2614 port_id_t wrap, nxt_d_id;
2612 struct qla_hw_data *ha = vha->hw; 2615 struct qla_hw_data *ha = vha->hw;
2613 struct scsi_qla_host *vp, *base_vha = pci_get_drvdata(ha->pdev); 2616 struct scsi_qla_host *vp, *base_vha = pci_get_drvdata(ha->pdev);
2617 struct scsi_qla_host *tvp;
2614 2618
2615 rval = QLA_SUCCESS; 2619 rval = QLA_SUCCESS;
2616 2620
@@ -2710,7 +2714,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
2710 /* Bypass virtual ports of the same host. */ 2714 /* Bypass virtual ports of the same host. */
2711 found = 0; 2715 found = 0;
2712 if (ha->num_vhosts) { 2716 if (ha->num_vhosts) {
2713 list_for_each_entry(vp, &ha->vp_list, list) { 2717 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) {
2714 if (new_fcport->d_id.b24 == vp->d_id.b24) { 2718 if (new_fcport->d_id.b24 == vp->d_id.b24) {
2715 found = 1; 2719 found = 1;
2716 break; 2720 break;
@@ -2833,6 +2837,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev)
2833 uint16_t first_loop_id; 2837 uint16_t first_loop_id;
2834 struct qla_hw_data *ha = vha->hw; 2838 struct qla_hw_data *ha = vha->hw;
2835 struct scsi_qla_host *vp; 2839 struct scsi_qla_host *vp;
2840 struct scsi_qla_host *tvp;
2836 2841
2837 rval = QLA_SUCCESS; 2842 rval = QLA_SUCCESS;
2838 2843
@@ -2857,7 +2862,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev)
2857 /* Check for loop ID being already in use. */ 2862 /* Check for loop ID being already in use. */
2858 found = 0; 2863 found = 0;
2859 fcport = NULL; 2864 fcport = NULL;
2860 list_for_each_entry(vp, &ha->vp_list, list) { 2865 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) {
2861 list_for_each_entry(fcport, &vp->vp_fcports, list) { 2866 list_for_each_entry(fcport, &vp->vp_fcports, list) {
2862 if (fcport->loop_id == dev->loop_id && 2867 if (fcport->loop_id == dev->loop_id &&
2863 fcport != dev) { 2868 fcport != dev) {
@@ -3292,6 +3297,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3292 uint8_t status = 0; 3297 uint8_t status = 0;
3293 struct qla_hw_data *ha = vha->hw; 3298 struct qla_hw_data *ha = vha->hw;
3294 struct scsi_qla_host *vp; 3299 struct scsi_qla_host *vp;
3300 struct scsi_qla_host *tvp;
3295 struct req_que *req = ha->req_q_map[0]; 3301 struct req_que *req = ha->req_q_map[0];
3296 3302
3297 if (vha->flags.online) { 3303 if (vha->flags.online) {
@@ -3307,7 +3313,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3307 if (atomic_read(&vha->loop_state) != LOOP_DOWN) { 3313 if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
3308 atomic_set(&vha->loop_state, LOOP_DOWN); 3314 atomic_set(&vha->loop_state, LOOP_DOWN);
3309 qla2x00_mark_all_devices_lost(vha, 0); 3315 qla2x00_mark_all_devices_lost(vha, 0);
3310 list_for_each_entry(vp, &ha->vp_list, list) 3316 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list)
3311 qla2x00_mark_all_devices_lost(vp, 0); 3317 qla2x00_mark_all_devices_lost(vp, 0);
3312 } else { 3318 } else {
3313 if (!atomic_read(&vha->loop_down_timer)) 3319 if (!atomic_read(&vha->loop_down_timer))
@@ -3404,7 +3410,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3404 DEBUG(printk(KERN_INFO 3410 DEBUG(printk(KERN_INFO
3405 "qla2x00_abort_isp(%ld): succeeded.\n", 3411 "qla2x00_abort_isp(%ld): succeeded.\n",
3406 vha->host_no)); 3412 vha->host_no));
3407 list_for_each_entry(vp, &ha->vp_list, list) { 3413 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) {
3408 if (vp->vp_idx) 3414 if (vp->vp_idx)
3409 qla2x00_vp_abort_isp(vp); 3415 qla2x00_vp_abort_isp(vp);
3410 } 3416 }
@@ -3429,7 +3435,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3429static int 3435static int
3430qla2x00_restart_isp(scsi_qla_host_t *vha) 3436qla2x00_restart_isp(scsi_qla_host_t *vha)
3431{ 3437{
3432 uint8_t status = 0; 3438 int status = 0;
3433 uint32_t wait_time; 3439 uint32_t wait_time;
3434 struct qla_hw_data *ha = vha->hw; 3440 struct qla_hw_data *ha = vha->hw;
3435 struct req_que *req = ha->req_q_map[0]; 3441 struct req_que *req = ha->req_q_map[0];
@@ -3493,7 +3499,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
3493 rsp = ha->rsp_q_map[i]; 3499 rsp = ha->rsp_q_map[i];
3494 if (rsp) { 3500 if (rsp) {
3495 rsp->options &= ~BIT_0; 3501 rsp->options &= ~BIT_0;
3496 ret = qla25xx_init_rsp_que(base_vha, rsp, rsp->options); 3502 ret = qla25xx_init_rsp_que(base_vha, rsp);
3497 if (ret != QLA_SUCCESS) 3503 if (ret != QLA_SUCCESS)
3498 DEBUG2_17(printk(KERN_WARNING 3504 DEBUG2_17(printk(KERN_WARNING
3499 "%s Rsp que:%d init failed\n", __func__, 3505 "%s Rsp que:%d init failed\n", __func__,
@@ -3507,7 +3513,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
3507 if (req) { 3513 if (req) {
3508 /* Clear outstanding commands array. */ 3514 /* Clear outstanding commands array. */
3509 req->options &= ~BIT_0; 3515 req->options &= ~BIT_0;
3510 ret = qla25xx_init_req_que(base_vha, req, req->options); 3516 ret = qla25xx_init_req_que(base_vha, req);
3511 if (ret != QLA_SUCCESS) 3517 if (ret != QLA_SUCCESS)
3512 DEBUG2_17(printk(KERN_WARNING 3518 DEBUG2_17(printk(KERN_WARNING
3513 "%s Req que:%d init failed\n", __func__, 3519 "%s Req que:%d init failed\n", __func__,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index e28ad81baf1e..f250e5b7897c 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -266,6 +266,40 @@ qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
266 } 266 }
267} 267}
268 268
269static void
270qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
271{
272 static char *event[] =
273 { "Complete", "Request Notification", "Time Extension" };
274 int rval;
275 struct device_reg_24xx __iomem *reg24 = &vha->hw->iobase->isp24;
276 uint16_t __iomem *wptr;
277 uint16_t cnt, timeout, mb[QLA_IDC_ACK_REGS];
278
279 /* Seed data -- mailbox1 -> mailbox7. */
280 wptr = (uint16_t __iomem *)&reg24->mailbox1;
281 for (cnt = 0; cnt < QLA_IDC_ACK_REGS; cnt++, wptr++)
282 mb[cnt] = RD_REG_WORD(wptr);
283
284 DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- "
285 "%04x %04x %04x %04x %04x %04x %04x.\n", vha->host_no,
286 event[aen & 0xff],
287 mb[0], mb[1], mb[2], mb[3], mb[4], mb[5], mb[6]));
288
289 /* Acknowledgement needed? [Notify && non-zero timeout]. */
290 timeout = (descr >> 8) & 0xf;
291 if (aen != MBA_IDC_NOTIFY || !timeout)
292 return;
293
294 DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- "
295 "ACK timeout=%d.\n", vha->host_no, event[aen & 0xff], timeout));
296
297 rval = qla2x00_post_idc_ack_work(vha, mb);
298 if (rval != QLA_SUCCESS)
299 qla_printk(KERN_WARNING, vha->hw,
300 "IDC failed to post ACK.\n");
301}
302
269/** 303/**
270 * qla2x00_async_event() - Process aynchronous events. 304 * qla2x00_async_event() - Process aynchronous events.
271 * @ha: SCSI driver HA context 305 * @ha: SCSI driver HA context
@@ -714,21 +748,9 @@ skip_rio:
714 "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3])); 748 "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3]));
715 break; 749 break;
716 case MBA_IDC_COMPLETE: 750 case MBA_IDC_COMPLETE:
717 DEBUG2(printk("scsi(%ld): Inter-Driver Commucation "
718 "Complete -- %04x %04x %04x\n", vha->host_no, mb[1], mb[2],
719 mb[3]));
720 break;
721 case MBA_IDC_NOTIFY: 751 case MBA_IDC_NOTIFY:
722 DEBUG2(printk("scsi(%ld): Inter-Driver Commucation "
723 "Request Notification -- %04x %04x %04x\n", vha->host_no,
724 mb[1], mb[2], mb[3]));
725 /**** Mailbox registers 4 - 7 valid!!! */
726 break;
727 case MBA_IDC_TIME_EXT: 752 case MBA_IDC_TIME_EXT:
728 DEBUG2(printk("scsi(%ld): Inter-Driver Commucation " 753 qla81xx_idc_event(vha, mb[0], mb[1]);
729 "Time Extension -- %04x %04x %04x\n", vha->host_no, mb[1],
730 mb[2], mb[3]));
731 /**** Mailbox registers 4 - 7 valid!!! */
732 break; 754 break;
733 } 755 }
734 756
@@ -1707,7 +1729,6 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
1707 struct qla_hw_data *ha; 1729 struct qla_hw_data *ha;
1708 struct rsp_que *rsp; 1730 struct rsp_que *rsp;
1709 struct device_reg_24xx __iomem *reg; 1731 struct device_reg_24xx __iomem *reg;
1710 uint16_t msix_disabled_hccr = 0;
1711 1732
1712 rsp = (struct rsp_que *) dev_id; 1733 rsp = (struct rsp_que *) dev_id;
1713 if (!rsp) { 1734 if (!rsp) {
@@ -1720,17 +1741,8 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
1720 1741
1721 spin_lock_irq(&ha->hardware_lock); 1742 spin_lock_irq(&ha->hardware_lock);
1722 1743
1723 msix_disabled_hccr = rsp->options;
1724 if (!rsp->id)
1725 msix_disabled_hccr &= __constant_cpu_to_le32(BIT_22);
1726 else
1727 msix_disabled_hccr &= __constant_cpu_to_le32(BIT_6);
1728
1729 qla24xx_process_response_queue(rsp); 1744 qla24xx_process_response_queue(rsp);
1730 1745
1731 if (!msix_disabled_hccr)
1732 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
1733
1734 spin_unlock_irq(&ha->hardware_lock); 1746 spin_unlock_irq(&ha->hardware_lock);
1735 1747
1736 return IRQ_HANDLED; 1748 return IRQ_HANDLED;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index f94ffbb98e95..4aab7acf7525 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2685,6 +2685,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
2685 uint16_t stat = le16_to_cpu(rptid_entry->vp_idx); 2685 uint16_t stat = le16_to_cpu(rptid_entry->vp_idx);
2686 struct qla_hw_data *ha = vha->hw; 2686 struct qla_hw_data *ha = vha->hw;
2687 scsi_qla_host_t *vp; 2687 scsi_qla_host_t *vp;
2688 scsi_qla_host_t *tvp;
2688 2689
2689 if (rptid_entry->entry_status != 0) 2690 if (rptid_entry->entry_status != 0)
2690 return; 2691 return;
@@ -2710,7 +2711,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
2710 if (MSB(stat) == 1) 2711 if (MSB(stat) == 1)
2711 return; 2712 return;
2712 2713
2713 list_for_each_entry(vp, &ha->vp_list, list) 2714 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list)
2714 if (vp_idx == vp->vp_idx) 2715 if (vp_idx == vp->vp_idx)
2715 break; 2716 break;
2716 if (!vp) 2717 if (!vp)
@@ -3090,8 +3091,7 @@ verify_done:
3090} 3091}
3091 3092
3092int 3093int
3093qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req, 3094qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req)
3094 uint8_t options)
3095{ 3095{
3096 int rval; 3096 int rval;
3097 unsigned long flags; 3097 unsigned long flags;
@@ -3101,7 +3101,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
3101 struct qla_hw_data *ha = vha->hw; 3101 struct qla_hw_data *ha = vha->hw;
3102 3102
3103 mcp->mb[0] = MBC_INITIALIZE_MULTIQ; 3103 mcp->mb[0] = MBC_INITIALIZE_MULTIQ;
3104 mcp->mb[1] = options; 3104 mcp->mb[1] = req->options;
3105 mcp->mb[2] = MSW(LSD(req->dma)); 3105 mcp->mb[2] = MSW(LSD(req->dma));
3106 mcp->mb[3] = LSW(LSD(req->dma)); 3106 mcp->mb[3] = LSW(LSD(req->dma));
3107 mcp->mb[6] = MSW(MSD(req->dma)); 3107 mcp->mb[6] = MSW(MSD(req->dma));
@@ -3128,7 +3128,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
3128 mcp->tov = 60; 3128 mcp->tov = 60;
3129 3129
3130 spin_lock_irqsave(&ha->hardware_lock, flags); 3130 spin_lock_irqsave(&ha->hardware_lock, flags);
3131 if (!(options & BIT_0)) { 3131 if (!(req->options & BIT_0)) {
3132 WRT_REG_DWORD(&reg->req_q_in, 0); 3132 WRT_REG_DWORD(&reg->req_q_in, 0);
3133 WRT_REG_DWORD(&reg->req_q_out, 0); 3133 WRT_REG_DWORD(&reg->req_q_out, 0);
3134 } 3134 }
@@ -3142,8 +3142,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
3142} 3142}
3143 3143
3144int 3144int
3145qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp, 3145qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
3146 uint8_t options)
3147{ 3146{
3148 int rval; 3147 int rval;
3149 unsigned long flags; 3148 unsigned long flags;
@@ -3153,7 +3152,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
3153 struct qla_hw_data *ha = vha->hw; 3152 struct qla_hw_data *ha = vha->hw;
3154 3153
3155 mcp->mb[0] = MBC_INITIALIZE_MULTIQ; 3154 mcp->mb[0] = MBC_INITIALIZE_MULTIQ;
3156 mcp->mb[1] = options; 3155 mcp->mb[1] = rsp->options;
3157 mcp->mb[2] = MSW(LSD(rsp->dma)); 3156 mcp->mb[2] = MSW(LSD(rsp->dma));
3158 mcp->mb[3] = LSW(LSD(rsp->dma)); 3157 mcp->mb[3] = LSW(LSD(rsp->dma));
3159 mcp->mb[6] = MSW(MSD(rsp->dma)); 3158 mcp->mb[6] = MSW(MSD(rsp->dma));
@@ -3178,7 +3177,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
3178 mcp->tov = 60; 3177 mcp->tov = 60;
3179 3178
3180 spin_lock_irqsave(&ha->hardware_lock, flags); 3179 spin_lock_irqsave(&ha->hardware_lock, flags);
3181 if (!(options & BIT_0)) { 3180 if (!(rsp->options & BIT_0)) {
3182 WRT_REG_DWORD(&reg->rsp_q_out, 0); 3181 WRT_REG_DWORD(&reg->rsp_q_out, 0);
3183 WRT_REG_DWORD(&reg->rsp_q_in, 0); 3182 WRT_REG_DWORD(&reg->rsp_q_in, 0);
3184 } 3183 }
@@ -3193,3 +3192,29 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
3193 return rval; 3192 return rval;
3194} 3193}
3195 3194
3195int
3196qla81xx_idc_ack(scsi_qla_host_t *vha, uint16_t *mb)
3197{
3198 int rval;
3199 mbx_cmd_t mc;
3200 mbx_cmd_t *mcp = &mc;
3201
3202 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
3203
3204 mcp->mb[0] = MBC_IDC_ACK;
3205 memcpy(&mcp->mb[1], mb, QLA_IDC_ACK_REGS * sizeof(uint16_t));
3206 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
3207 mcp->in_mb = MBX_0;
3208 mcp->tov = MBX_TOV_SECONDS;
3209 mcp->flags = 0;
3210 rval = qla2x00_mailbox_command(vha, mcp);
3211
3212 if (rval != QLA_SUCCESS) {
3213 DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
3214 vha->host_no, rval, mcp->mb[0]));
3215 } else {
3216 DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
3217 }
3218
3219 return rval;
3220}
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index f53179c46423..785c61279e6e 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -69,9 +69,10 @@ static scsi_qla_host_t *
69qla24xx_find_vhost_by_name(struct qla_hw_data *ha, uint8_t *port_name) 69qla24xx_find_vhost_by_name(struct qla_hw_data *ha, uint8_t *port_name)
70{ 70{
71 scsi_qla_host_t *vha; 71 scsi_qla_host_t *vha;
72 struct scsi_qla_host *tvha;
72 73
73 /* Locate matching device in database. */ 74 /* Locate matching device in database. */
74 list_for_each_entry(vha, &ha->vp_list, list) { 75 list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) {
75 if (!memcmp(port_name, vha->port_name, WWN_SIZE)) 76 if (!memcmp(port_name, vha->port_name, WWN_SIZE))
76 return vha; 77 return vha;
77 } 78 }
@@ -194,11 +195,11 @@ qla24xx_configure_vp(scsi_qla_host_t *vha)
194void 195void
195qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) 196qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb)
196{ 197{
197 scsi_qla_host_t *vha; 198 scsi_qla_host_t *vha, *tvha;
198 struct qla_hw_data *ha = rsp->hw; 199 struct qla_hw_data *ha = rsp->hw;
199 int i = 0; 200 int i = 0;
200 201
201 list_for_each_entry(vha, &ha->vp_list, list) { 202 list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) {
202 if (vha->vp_idx) { 203 if (vha->vp_idx) {
203 switch (mb[0]) { 204 switch (mb[0]) {
204 case MBA_LIP_OCCURRED: 205 case MBA_LIP_OCCURRED:
@@ -300,6 +301,7 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *vha)
300 int ret; 301 int ret;
301 struct qla_hw_data *ha = vha->hw; 302 struct qla_hw_data *ha = vha->hw;
302 scsi_qla_host_t *vp; 303 scsi_qla_host_t *vp;
304 struct scsi_qla_host *tvp;
303 305
304 if (vha->vp_idx) 306 if (vha->vp_idx)
305 return; 307 return;
@@ -308,7 +310,7 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *vha)
308 310
309 clear_bit(VP_DPC_NEEDED, &vha->dpc_flags); 311 clear_bit(VP_DPC_NEEDED, &vha->dpc_flags);
310 312
311 list_for_each_entry(vp, &ha->vp_list, list) { 313 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) {
312 if (vp->vp_idx) 314 if (vp->vp_idx)
313 ret = qla2x00_do_dpc_vp(vp); 315 ret = qla2x00_do_dpc_vp(vp);
314 } 316 }
@@ -396,7 +398,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
396 398
397 qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL); 399 qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL);
398 400
399 memset(vha->req_ques, 0, sizeof(vha->req_ques) * QLA_MAX_HOST_QUES); 401 memset(vha->req_ques, 0, sizeof(vha->req_ques));
400 vha->req_ques[0] = ha->req_q_map[0]->id; 402 vha->req_ques[0] = ha->req_q_map[0]->id;
401 host->can_queue = ha->req_q_map[0]->length + 128; 403 host->can_queue = ha->req_q_map[0]->length + 128;
402 host->this_id = 255; 404 host->this_id = 255;
@@ -471,7 +473,7 @@ qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req)
471 473
472 if (req) { 474 if (req) {
473 req->options |= BIT_0; 475 req->options |= BIT_0;
474 ret = qla25xx_init_req_que(vha, req, req->options); 476 ret = qla25xx_init_req_que(vha, req);
475 } 477 }
476 if (ret == QLA_SUCCESS) 478 if (ret == QLA_SUCCESS)
477 qla25xx_free_req_que(vha, req); 479 qla25xx_free_req_que(vha, req);
@@ -486,7 +488,7 @@ qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
486 488
487 if (rsp) { 489 if (rsp) {
488 rsp->options |= BIT_0; 490 rsp->options |= BIT_0;
489 ret = qla25xx_init_rsp_que(vha, rsp, rsp->options); 491 ret = qla25xx_init_rsp_que(vha, rsp);
490 } 492 }
491 if (ret == QLA_SUCCESS) 493 if (ret == QLA_SUCCESS)
492 qla25xx_free_rsp_que(vha, rsp); 494 qla25xx_free_rsp_que(vha, rsp);
@@ -502,7 +504,7 @@ int qla25xx_update_req_que(struct scsi_qla_host *vha, uint8_t que, uint8_t qos)
502 504
503 req->options |= BIT_3; 505 req->options |= BIT_3;
504 req->qos = qos; 506 req->qos = qos;
505 ret = qla25xx_init_req_que(vha, req, req->options); 507 ret = qla25xx_init_req_que(vha, req);
506 if (ret != QLA_SUCCESS) 508 if (ret != QLA_SUCCESS)
507 DEBUG2_17(printk(KERN_WARNING "%s failed\n", __func__)); 509 DEBUG2_17(printk(KERN_WARNING "%s failed\n", __func__));
508 /* restore options bit */ 510 /* restore options bit */
@@ -632,7 +634,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
632 req->max_q_depth = ha->req_q_map[0]->max_q_depth; 634 req->max_q_depth = ha->req_q_map[0]->max_q_depth;
633 mutex_unlock(&ha->vport_lock); 635 mutex_unlock(&ha->vport_lock);
634 636
635 ret = qla25xx_init_req_que(base_vha, req, options); 637 ret = qla25xx_init_req_que(base_vha, req);
636 if (ret != QLA_SUCCESS) { 638 if (ret != QLA_SUCCESS) {
637 qla_printk(KERN_WARNING, ha, "%s failed\n", __func__); 639 qla_printk(KERN_WARNING, ha, "%s failed\n", __func__);
638 mutex_lock(&ha->vport_lock); 640 mutex_lock(&ha->vport_lock);
@@ -710,7 +712,7 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
710 if (ret) 712 if (ret)
711 goto que_failed; 713 goto que_failed;
712 714
713 ret = qla25xx_init_rsp_que(base_vha, rsp, options); 715 ret = qla25xx_init_rsp_que(base_vha, rsp);
714 if (ret != QLA_SUCCESS) { 716 if (ret != QLA_SUCCESS) {
715 qla_printk(KERN_WARNING, ha, "%s failed\n", __func__); 717 qla_printk(KERN_WARNING, ha, "%s failed\n", __func__);
716 mutex_lock(&ha->vport_lock); 718 mutex_lock(&ha->vport_lock);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index c11f872d3e10..3ddfa889e949 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2222,10 +2222,6 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
2222{ 2222{
2223 char name[16]; 2223 char name[16];
2224 2224
2225 ha->init_cb_size = sizeof(init_cb_t);
2226 if (IS_QLA2XXX_MIDTYPE(ha))
2227 ha->init_cb_size = sizeof(struct mid_init_cb_24xx);
2228
2229 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, 2225 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size,
2230 &ha->init_cb_dma, GFP_KERNEL); 2226 &ha->init_cb_dma, GFP_KERNEL);
2231 if (!ha->init_cb) 2227 if (!ha->init_cb)
@@ -2522,6 +2518,19 @@ qla2x00_post_aen_work(struct scsi_qla_host *vha, enum fc_host_event_code code,
2522 return qla2x00_post_work(vha, e, 1); 2518 return qla2x00_post_work(vha, e, 1);
2523} 2519}
2524 2520
2521int
2522qla2x00_post_idc_ack_work(struct scsi_qla_host *vha, uint16_t *mb)
2523{
2524 struct qla_work_evt *e;
2525
2526 e = qla2x00_alloc_work(vha, QLA_EVT_IDC_ACK, 1);
2527 if (!e)
2528 return QLA_FUNCTION_FAILED;
2529
2530 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t));
2531 return qla2x00_post_work(vha, e, 1);
2532}
2533
2525static void 2534static void
2526qla2x00_do_work(struct scsi_qla_host *vha) 2535qla2x00_do_work(struct scsi_qla_host *vha)
2527{ 2536{
@@ -2539,6 +2548,9 @@ qla2x00_do_work(struct scsi_qla_host *vha)
2539 fc_host_post_event(vha->host, fc_get_event_number(), 2548 fc_host_post_event(vha->host, fc_get_event_number(),
2540 e->u.aen.code, e->u.aen.data); 2549 e->u.aen.code, e->u.aen.data);
2541 break; 2550 break;
2551 case QLA_EVT_IDC_ACK:
2552 qla81xx_idc_ack(vha, e->u.idc_ack.mb);
2553 break;
2542 } 2554 }
2543 if (e->flags & QLA_EVT_FLAG_FREE) 2555 if (e->flags & QLA_EVT_FLAG_FREE)
2544 kfree(e); 2556 kfree(e);
@@ -2552,7 +2564,7 @@ qla2x00_do_work(struct scsi_qla_host *vha)
2552void qla2x00_relogin(struct scsi_qla_host *vha) 2564void qla2x00_relogin(struct scsi_qla_host *vha)
2553{ 2565{
2554 fc_port_t *fcport; 2566 fc_port_t *fcport;
2555 uint8_t status; 2567 int status;
2556 uint16_t next_loopid = 0; 2568 uint16_t next_loopid = 0;
2557 struct qla_hw_data *ha = vha->hw; 2569 struct qla_hw_data *ha = vha->hw;
2558 2570
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 9c3b694c049d..284827926eff 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -684,7 +684,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
684 "end=0x%x size=0x%x.\n", le32_to_cpu(region->code), start, 684 "end=0x%x size=0x%x.\n", le32_to_cpu(region->code), start,
685 le32_to_cpu(region->end) >> 2, le32_to_cpu(region->size))); 685 le32_to_cpu(region->end) >> 2, le32_to_cpu(region->size)));
686 686
687 switch (le32_to_cpu(region->code)) { 687 switch (le32_to_cpu(region->code) & 0xff) {
688 case FLT_REG_FW: 688 case FLT_REG_FW:
689 ha->flt_region_fw = start; 689 ha->flt_region_fw = start;
690 break; 690 break;
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index cfa4c11a4797..a772eab2f0ea 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.03.00-k2" 10#define QLA2XXX_VERSION "8.03.00-k4"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 3 13#define QLA_DRIVER_MINOR_VER 3
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 940dc32ff0dc..b82ffd90632e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1040,12 +1040,11 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
1040 action = ACTION_FAIL; 1040 action = ACTION_FAIL;
1041 break; 1041 break;
1042 case ABORTED_COMMAND: 1042 case ABORTED_COMMAND:
1043 action = ACTION_FAIL;
1043 if (sshdr.asc == 0x10) { /* DIF */ 1044 if (sshdr.asc == 0x10) { /* DIF */
1044 description = "Target Data Integrity Failure"; 1045 description = "Target Data Integrity Failure";
1045 action = ACTION_FAIL;
1046 error = -EILSEQ; 1046 error = -EILSEQ;
1047 } else 1047 }
1048 action = ACTION_RETRY;
1049 break; 1048 break;
1050 case NOT_READY: 1049 case NOT_READY:
1051 /* If the device is in the process of becoming 1050 /* If the device is in the process of becoming
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 66505bb79410..8f4de20c9deb 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
317 return sdev; 317 return sdev;
318 318
319out_device_destroy: 319out_device_destroy:
320 scsi_device_set_state(sdev, SDEV_DEL);
320 transport_destroy_device(&sdev->sdev_gendev); 321 transport_destroy_device(&sdev->sdev_gendev);
321 put_device(&sdev->sdev_gendev); 322 put_device(&sdev->sdev_gendev);
322out: 323out:
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d57566b8be0a..4970ae4a62d6 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -107,6 +107,7 @@ static void scsi_disk_release(struct device *cdev);
107static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); 107static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
108static void sd_print_result(struct scsi_disk *, int); 108static void sd_print_result(struct scsi_disk *, int);
109 109
110static DEFINE_SPINLOCK(sd_index_lock);
110static DEFINE_IDA(sd_index_ida); 111static DEFINE_IDA(sd_index_ida);
111 112
112/* This semaphore is used to mediate the 0->1 reference get in the 113/* This semaphore is used to mediate the 0->1 reference get in the
@@ -1166,23 +1167,19 @@ sd_spinup_disk(struct scsi_disk *sdkp)
1166 /* 1167 /*
1167 * The device does not want the automatic start to be issued. 1168 * The device does not want the automatic start to be issued.
1168 */ 1169 */
1169 if (sdkp->device->no_start_on_add) { 1170 if (sdkp->device->no_start_on_add)
1170 break; 1171 break;
1171 }
1172
1173 /*
1174 * If manual intervention is required, or this is an
1175 * absent USB storage device, a spinup is meaningless.
1176 */
1177 if (sense_valid &&
1178 sshdr.sense_key == NOT_READY &&
1179 sshdr.asc == 4 && sshdr.ascq == 3) {
1180 break; /* manual intervention required */
1181 1172
1182 /* 1173 if (sense_valid && sshdr.sense_key == NOT_READY) {
1183 * Issue command to spin up drive when not ready 1174 if (sshdr.asc == 4 && sshdr.ascq == 3)
1184 */ 1175 break; /* manual intervention required */
1185 } else if (sense_valid && sshdr.sense_key == NOT_READY) { 1176 if (sshdr.asc == 4 && sshdr.ascq == 0xb)
1177 break; /* standby */
1178 if (sshdr.asc == 4 && sshdr.ascq == 0xc)
1179 break; /* unavailable */
1180 /*
1181 * Issue command to spin up drive when not ready
1182 */
1186 if (!spintime) { 1183 if (!spintime) {
1187 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); 1184 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");
1188 cmd[0] = START_STOP; 1185 cmd[0] = START_STOP;
@@ -1914,7 +1911,9 @@ static int sd_probe(struct device *dev)
1914 if (!ida_pre_get(&sd_index_ida, GFP_KERNEL)) 1911 if (!ida_pre_get(&sd_index_ida, GFP_KERNEL))
1915 goto out_put; 1912 goto out_put;
1916 1913
1914 spin_lock(&sd_index_lock);
1917 error = ida_get_new(&sd_index_ida, &index); 1915 error = ida_get_new(&sd_index_ida, &index);
1916 spin_unlock(&sd_index_lock);
1918 } while (error == -EAGAIN); 1917 } while (error == -EAGAIN);
1919 1918
1920 if (error) 1919 if (error)
@@ -1936,7 +1935,9 @@ static int sd_probe(struct device *dev)
1936 return 0; 1935 return 0;
1937 1936
1938 out_free_index: 1937 out_free_index:
1938 spin_lock(&sd_index_lock);
1939 ida_remove(&sd_index_ida, index); 1939 ida_remove(&sd_index_ida, index);
1940 spin_unlock(&sd_index_lock);
1940 out_put: 1941 out_put:
1941 put_disk(gd); 1942 put_disk(gd);
1942 out_free: 1943 out_free:
@@ -1986,7 +1987,9 @@ static void scsi_disk_release(struct device *dev)
1986 struct scsi_disk *sdkp = to_scsi_disk(dev); 1987 struct scsi_disk *sdkp = to_scsi_disk(dev);
1987 struct gendisk *disk = sdkp->disk; 1988 struct gendisk *disk = sdkp->disk;
1988 1989
1990 spin_lock(&sd_index_lock);
1989 ida_remove(&sd_index_ida, sdkp->index); 1991 ida_remove(&sd_index_ida, sdkp->index);
1992 spin_unlock(&sd_index_lock);
1990 1993
1991 disk->private_data = NULL; 1994 disk->private_data = NULL;
1992 put_disk(disk); 1995 put_disk(disk);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 8f0bd3f7a59f..516925d8b570 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1078,7 +1078,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
1078 case BLKTRACESETUP: 1078 case BLKTRACESETUP:
1079 return blk_trace_setup(sdp->device->request_queue, 1079 return blk_trace_setup(sdp->device->request_queue,
1080 sdp->disk->disk_name, 1080 sdp->disk->disk_name,
1081 sdp->device->sdev_gendev.devt, 1081 MKDEV(SCSI_GENERIC_MAJOR, sdp->index),
1082 (char *)arg); 1082 (char *)arg);
1083 case BLKTRACESTART: 1083 case BLKTRACESTART:
1084 return blk_trace_startstop(sdp->device->request_queue, 1); 1084 return blk_trace_startstop(sdp->device->request_queue, 1);
diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
index a8d61a62522e..97f3158fa7b5 100644
--- a/drivers/scsi/zalon.c
+++ b/drivers/scsi/zalon.c
@@ -137,7 +137,7 @@ zalon_probe(struct parisc_device *dev)
137 goto fail; 137 goto fail;
138 138
139 if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) { 139 if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) {
140 dev_printk(KERN_ERR, dev, "irq problem with %d, detaching\n ", 140 dev_printk(KERN_ERR, &dev->dev, "irq problem with %d, detaching\n ",
141 dev->irq); 141 dev->irq);
142 goto fail; 142 goto fail;
143 } 143 }
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 0d934bfbdd9b..b4b39811b445 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2083,6 +2083,20 @@ static int serial8250_startup(struct uart_port *port)
2083 2083
2084 serial8250_set_mctrl(&up->port, up->port.mctrl); 2084 serial8250_set_mctrl(&up->port, up->port.mctrl);
2085 2085
2086 /* Serial over Lan (SoL) hack:
2087 Intel 8257x Gigabit ethernet chips have a
2088 16550 emulation, to be used for Serial Over Lan.
2089 Those chips take a longer time than a normal
2090 serial device to signalize that a transmission
2091 data was queued. Due to that, the above test generally
2092 fails. One solution would be to delay the reading of
2093 iir. However, this is not reliable, since the timeout
2094 is variable. So, let's just don't test if we receive
2095 TX irq. This way, we'll never enable UART_BUG_TXEN.
2096 */
2097 if (up->port.flags & UPF_NO_TXEN_TEST)
2098 goto dont_test_tx_en;
2099
2086 /* 2100 /*
2087 * Do a quick test to see if we receive an 2101 * Do a quick test to see if we receive an
2088 * interrupt when we enable the TX irq. 2102 * interrupt when we enable the TX irq.
@@ -2102,6 +2116,7 @@ static int serial8250_startup(struct uart_port *port)
2102 up->bugs &= ~UART_BUG_TXEN; 2116 up->bugs &= ~UART_BUG_TXEN;
2103 } 2117 }
2104 2118
2119dont_test_tx_en:
2105 spin_unlock_irqrestore(&up->port.lock, flags); 2120 spin_unlock_irqrestore(&up->port.lock, flags);
2106 2121
2107 /* 2122 /*
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 536d8e510f66..533f82025adf 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -798,6 +798,21 @@ pci_default_setup(struct serial_private *priv,
798 return setup_port(priv, port, bar, offset, board->reg_shift); 798 return setup_port(priv, port, bar, offset, board->reg_shift);
799} 799}
800 800
801static int skip_tx_en_setup(struct serial_private *priv,
802 const struct pciserial_board *board,
803 struct uart_port *port, int idx)
804{
805 port->flags |= UPF_NO_TXEN_TEST;
806 printk(KERN_DEBUG "serial8250: skipping TxEn test for device "
807 "[%04x:%04x] subsystem [%04x:%04x]\n",
808 priv->dev->vendor,
809 priv->dev->device,
810 priv->dev->subsystem_vendor,
811 priv->dev->subsystem_device);
812
813 return pci_default_setup(priv, board, port, idx);
814}
815
801/* This should be in linux/pci_ids.h */ 816/* This should be in linux/pci_ids.h */
802#define PCI_VENDOR_ID_SBSMODULARIO 0x124B 817#define PCI_VENDOR_ID_SBSMODULARIO 0x124B
803#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B 818#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
@@ -864,6 +879,27 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
864 .init = pci_inteli960ni_init, 879 .init = pci_inteli960ni_init,
865 .setup = pci_default_setup, 880 .setup = pci_default_setup,
866 }, 881 },
882 {
883 .vendor = PCI_VENDOR_ID_INTEL,
884 .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
885 .subvendor = PCI_ANY_ID,
886 .subdevice = PCI_ANY_ID,
887 .setup = skip_tx_en_setup,
888 },
889 {
890 .vendor = PCI_VENDOR_ID_INTEL,
891 .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
892 .subvendor = PCI_ANY_ID,
893 .subdevice = PCI_ANY_ID,
894 .setup = skip_tx_en_setup,
895 },
896 {
897 .vendor = PCI_VENDOR_ID_INTEL,
898 .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
899 .subvendor = PCI_ANY_ID,
900 .subdevice = PCI_ANY_ID,
901 .setup = skip_tx_en_setup,
902 },
867 /* 903 /*
868 * ITE 904 * ITE
869 */ 905 */
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 89362d733d62..8f58f7ff0dd7 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -877,6 +877,10 @@ static int atmel_startup(struct uart_port *port)
877 } 877 }
878 } 878 }
879 879
880 /* Save current CSR for comparison in atmel_tasklet_func() */
881 atmel_port->irq_status_prev = UART_GET_CSR(port);
882 atmel_port->irq_status = atmel_port->irq_status_prev;
883
880 /* 884 /*
881 * Finally, enable the serial port 885 * Finally, enable the serial port
882 */ 886 */
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index 92187e28608a..ac79cbe4c2cf 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -84,6 +84,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
84 brd->pci_dev = pdev; 84 brd->pci_dev = pdev;
85 if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) 85 if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM)
86 brd->maxports = 4; 86 brd->maxports = 4;
87 else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8)
88 brd->maxports = 8;
87 else 89 else
88 brd->maxports = 2; 90 brd->maxports = 2;
89 91
@@ -212,6 +214,7 @@ static struct pci_device_id jsm_pci_tbl[] = {
212 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, 214 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 },
213 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, 215 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 },
214 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, 216 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 },
217 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 },
215 { 0, } 218 { 0, }
216}; 219};
217MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); 220MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index 3599828b9766..022e89ffec1d 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -133,7 +133,7 @@
133# define SCSPTR3 0xffed0024 /* 16 bit SCIF */ 133# define SCSPTR3 0xffed0024 /* 16 bit SCIF */
134# define SCSPTR4 0xffee0024 /* 16 bit SCIF */ 134# define SCSPTR4 0xffee0024 /* 16 bit SCIF */
135# define SCSPTR5 0xffef0024 /* 16 bit SCIF */ 135# define SCSPTR5 0xffef0024 /* 16 bit SCIF */
136# define SCIF_OPER 0x0001 /* Overrun error bit */ 136# define SCIF_ORER 0x0001 /* Overrun error bit */
137# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 137# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
138#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \ 138#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
139 defined(CONFIG_CPU_SUBTYPE_SH7203) || \ 139 defined(CONFIG_CPU_SUBTYPE_SH7203) || \
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c
index 49698cabc30d..f5ed9721aabb 100644
--- a/drivers/spi/spi_gpio.c
+++ b/drivers/spi/spi_gpio.c
@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int is_on)
114 114
115static inline int getmiso(const struct spi_device *spi) 115static inline int getmiso(const struct spi_device *spi)
116{ 116{
117 return gpio_get_value(SPI_MISO_GPIO); 117 return !!gpio_get_value(SPI_MISO_GPIO);
118} 118}
119 119
120#undef pdata 120#undef pdata
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index ab69c1bf36a8..c2747bc88c6f 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2164,19 +2164,20 @@ static void __exit panel_cleanup_module(void)
2164 if (scan_timer.function != NULL) 2164 if (scan_timer.function != NULL)
2165 del_timer(&scan_timer); 2165 del_timer(&scan_timer);
2166 2166
2167 if (keypad_enabled) 2167 if (pprt != NULL) {
2168 misc_deregister(&keypad_dev); 2168 if (keypad_enabled)
2169 misc_deregister(&keypad_dev);
2170
2171 if (lcd_enabled) {
2172 panel_lcd_print("\x0cLCD driver " PANEL_VERSION
2173 "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-");
2174 misc_deregister(&lcd_dev);
2175 }
2169 2176
2170 if (lcd_enabled) { 2177 /* TODO: free all input signals */
2171 panel_lcd_print("\x0cLCD driver " PANEL_VERSION 2178 parport_release(pprt);
2172 "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-"); 2179 parport_unregister_device(pprt);
2173 misc_deregister(&lcd_dev);
2174 } 2180 }
2175
2176 /* TODO: free all input signals */
2177
2178 parport_release(pprt);
2179 parport_unregister_device(pprt);
2180 parport_unregister_driver(&panel_driver); 2181 parport_unregister_driver(&panel_driver);
2181} 2182}
2182 2183
diff --git a/drivers/staging/rtl8187se/Kconfig b/drivers/staging/rtl8187se/Kconfig
index 79c225acd1ad..f636296b54bc 100644
--- a/drivers/staging/rtl8187se/Kconfig
+++ b/drivers/staging/rtl8187se/Kconfig
@@ -1,5 +1,6 @@
1config RTL8187SE 1config RTL8187SE
2 tristate "RealTek RTL8187SE Wireless LAN NIC driver" 2 tristate "RealTek RTL8187SE Wireless LAN NIC driver"
3 depends on PCI 3 depends on PCI
4 depends on WIRELESS_EXT && COMPAT_NET_DEV_OPS
4 default N 5 default N
5 ---help--- 6 ---help---
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
index af64cfbe16db..7370296225e1 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
@@ -234,20 +234,21 @@ out:
234void ieee80211_crypto_deinit(void) 234void ieee80211_crypto_deinit(void)
235{ 235{
236 struct list_head *ptr, *n; 236 struct list_head *ptr, *n;
237 struct ieee80211_crypto_alg *alg = NULL;
237 238
238 if (hcrypt == NULL) 239 if (hcrypt == NULL)
239 return; 240 return;
240 241
241 for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; 242 list_for_each_safe(ptr, n, &hcrypt->algs) {
242 ptr = n, n = ptr->next) { 243 alg = list_entry(ptr, struct ieee80211_crypto_alg, list);
243 struct ieee80211_crypto_alg *alg = 244 if (alg) {
244 (struct ieee80211_crypto_alg *) ptr; 245 list_del(ptr);
245 list_del(ptr); 246 printk(KERN_DEBUG
246 printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " 247 "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n",
247 "'%s' (deinit)\n", alg->ops->name); 248 alg->ops->name);
248 kfree(alg); 249 kfree(alg);
250 }
249 } 251 }
250
251 kfree(hcrypt); 252 kfree(hcrypt);
252} 253}
253 254
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 94534955e38b..66de5cc8ddf1 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -6161,10 +6161,10 @@ static void __exit rtl8180_pci_module_exit(void)
6161{ 6161{
6162 pci_unregister_driver (&rtl8180_pci_driver); 6162 pci_unregister_driver (&rtl8180_pci_driver);
6163 rtl8180_proc_module_remove(); 6163 rtl8180_proc_module_remove();
6164 ieee80211_crypto_deinit();
6165 ieee80211_crypto_tkip_exit(); 6164 ieee80211_crypto_tkip_exit();
6166 ieee80211_crypto_ccmp_exit(); 6165 ieee80211_crypto_ccmp_exit();
6167 ieee80211_crypto_wep_exit(); 6166 ieee80211_crypto_wep_exit();
6167 ieee80211_crypto_deinit();
6168 DMESG("Exiting"); 6168 DMESG("Exiting");
6169} 6169}
6170 6170
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index b003f9a7e151..f716b2e92b65 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -319,16 +319,18 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
319 struct usb_device *udev = interface_to_usbdev(intf); 319 struct usb_device *udev = interface_to_usbdev(intf);
320 struct wbsoft_priv *priv; 320 struct wbsoft_priv *priv;
321 struct ieee80211_hw *dev; 321 struct ieee80211_hw *dev;
322 int err; 322 int nr, err;
323 323
324 usb_get_dev(udev); 324 usb_get_dev(udev);
325 325
326 // 20060630.2 Check the device if it already be opened 326 // 20060630.2 Check the device if it already be opened
327 err = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), 327 nr = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ),
328 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, 328 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN,
329 0x0, 0x400, &ltmp, 4, HZ*100 ); 329 0x0, 0x400, &ltmp, 4, HZ*100 );
330 if (err) 330 if (nr < 0) {
331 err = nr;
331 goto error; 332 goto error;
333 }
332 334
333 ltmp = cpu_to_le32(ltmp); 335 ltmp = cpu_to_le32(ltmp);
334 if (ltmp) { // Is already initialized? 336 if (ltmp) { // Is already initialized?
@@ -337,8 +339,10 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
337 } 339 }
338 340
339 dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); 341 dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
340 if (!dev) 342 if (!dev) {
343 err = -ENOMEM;
341 goto error; 344 goto error;
345 }
342 346
343 priv = dev->priv; 347 priv = dev->priv;
344 348
@@ -369,9 +373,11 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
369 } 373 }
370 374
371 dev->extra_tx_headroom = 12; /* FIXME */ 375 dev->extra_tx_headroom = 12; /* FIXME */
372 dev->flags = 0; 376 dev->flags = IEEE80211_HW_SIGNAL_UNSPEC;
377 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
373 378
374 dev->channel_change_time = 1000; 379 dev->channel_change_time = 1000;
380 dev->max_signal = 100;
375 dev->queues = 1; 381 dev->queues = 1;
376 382
377 dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &wbsoft_band_2GHz; 383 dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &wbsoft_band_2GHz;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 326dd7f65ee9..b3d5a23ab56f 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1376,6 +1376,15 @@ static struct usb_device_id acm_ids[] = {
1376 { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */ 1376 { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */
1377 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1377 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1378 }, 1378 },
1379 { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
1380 },
1381 { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */
1382 .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on
1383 data interface instead of
1384 communications interface.
1385 Maybe we should define a new
1386 quirk for this. */
1387 },
1379 1388
1380 /* control interfaces with various AT-command sets */ 1389 /* control interfaces with various AT-command sets */
1381 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 1390 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index c54fc40458b1..a4301dc02d27 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -298,19 +298,6 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
298EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); 298EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
299 299
300/** 300/**
301 * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled
302 * @dev: USB Host Controller being resumed
303 *
304 * Store this function in the HCD's struct pci_driver as .resume_early.
305 */
306int usb_hcd_pci_resume_early(struct pci_dev *dev)
307{
308 pci_restore_state(dev);
309 return 0;
310}
311EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early);
312
313/**
314 * usb_hcd_pci_resume - power management resume of a PCI-based HCD 301 * usb_hcd_pci_resume - power management resume of a PCI-based HCD
315 * @dev: USB Host Controller being resumed 302 * @dev: USB Host Controller being resumed
316 * 303 *
@@ -333,6 +320,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
333 } 320 }
334#endif 321#endif
335 322
323 pci_restore_state(dev);
324
336 hcd = pci_get_drvdata(dev); 325 hcd = pci_get_drvdata(dev);
337 if (hcd->state != HC_STATE_SUSPENDED) { 326 if (hcd->state != HC_STATE_SUSPENDED) {
338 dev_dbg(hcd->self.controller, 327 dev_dbg(hcd->self.controller,
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 5b94a56bec23..f750eb1ab595 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pci_dev *dev);
257 257
258#ifdef CONFIG_PM 258#ifdef CONFIG_PM
259extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg); 259extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg);
260extern int usb_hcd_pci_resume_early(struct pci_dev *dev);
261extern int usb_hcd_pci_resume(struct pci_dev *dev); 260extern int usb_hcd_pci_resume(struct pci_dev *dev);
262#endif /* CONFIG_PM */ 261#endif /* CONFIG_PM */
263 262
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 31fb204f44c6..49e7f56e0d7f 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -653,7 +653,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type,
653 if (result <= 0 && result != -ETIMEDOUT) 653 if (result <= 0 && result != -ETIMEDOUT)
654 continue; 654 continue;
655 if (result > 1 && ((u8 *)buf)[1] != type) { 655 if (result > 1 && ((u8 *)buf)[1] != type) {
656 result = -EPROTO; 656 result = -ENODATA;
657 continue; 657 continue;
658 } 658 }
659 break; 659 break;
@@ -696,8 +696,13 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid,
696 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, 696 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
697 (USB_DT_STRING << 8) + index, langid, buf, size, 697 (USB_DT_STRING << 8) + index, langid, buf, size,
698 USB_CTRL_GET_TIMEOUT); 698 USB_CTRL_GET_TIMEOUT);
699 if (!(result == 0 || result == -EPIPE)) 699 if (result == 0 || result == -EPIPE)
700 break; 700 continue;
701 if (result > 1 && ((u8 *) buf)[1] != USB_DT_STRING) {
702 result = -ENODATA;
703 continue;
704 }
705 break;
701 } 706 }
702 return result; 707 return result;
703} 708}
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3219d137340a..e55fef52a5dc 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -191,6 +191,7 @@ config USB_GADGET_OMAP
191 boolean "OMAP USB Device Controller" 191 boolean "OMAP USB Device Controller"
192 depends on ARCH_OMAP 192 depends on ARCH_OMAP
193 select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4_OTG 193 select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4_OTG
194 select USB_OTG_UTILS if ARCH_OMAP
194 help 195 help
195 Many Texas Instruments OMAP processors have flexible full 196 Many Texas Instruments OMAP processors have flexible full
196 speed USB device controllers, with support for up to 30 197 speed USB device controllers, with support for up to 30
diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c
index 80c2e7e9622f..38aa896cc5db 100644
--- a/drivers/usb/gadget/f_obex.c
+++ b/drivers/usb/gadget/f_obex.c
@@ -366,9 +366,9 @@ obex_bind(struct usb_configuration *c, struct usb_function *f)
366 f->hs_descriptors = usb_copy_descriptors(hs_function); 366 f->hs_descriptors = usb_copy_descriptors(hs_function);
367 367
368 obex->hs.obex_in = usb_find_endpoint(hs_function, 368 obex->hs.obex_in = usb_find_endpoint(hs_function,
369 f->descriptors, &obex_hs_ep_in_desc); 369 f->hs_descriptors, &obex_hs_ep_in_desc);
370 obex->hs.obex_out = usb_find_endpoint(hs_function, 370 obex->hs.obex_out = usb_find_endpoint(hs_function,
371 f->descriptors, &obex_hs_ep_out_desc); 371 f->hs_descriptors, &obex_hs_ep_out_desc);
372 } 372 }
373 373
374 /* Avoid letting this gadget enumerate until the userspace 374 /* Avoid letting this gadget enumerate until the userspace
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index b10fa31cc915..1ab9dac7e12d 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3879,7 +3879,11 @@ static int __init check_parameters(struct fsg_dev *fsg)
3879 mod_data.protocol_type = USB_SC_SCSI; 3879 mod_data.protocol_type = USB_SC_SCSI;
3880 mod_data.protocol_name = "Transparent SCSI"; 3880 mod_data.protocol_name = "Transparent SCSI";
3881 3881
3882 if (gadget_is_sh(fsg->gadget)) 3882 /* Some peripheral controllers are known not to be able to
3883 * halt bulk endpoints correctly. If one of them is present,
3884 * disable stalls.
3885 */
3886 if (gadget_is_sh(fsg->gadget) || gadget_is_at91(fsg->gadget))
3883 mod_data.can_stall = 0; 3887 mod_data.can_stall = 0;
3884 3888
3885 if (mod_data.release == 0xffff) { // Parameter wasn't set 3889 if (mod_data.release == 0xffff) { // Parameter wasn't set
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index f3c6703cffda..d8d9a52a44b3 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -404,7 +404,10 @@ static void struct_ep_qh_setup(struct fsl_udc *udc, unsigned char ep_num,
404 } 404 }
405 if (zlt) 405 if (zlt)
406 tmp |= EP_QUEUE_HEAD_ZLT_SEL; 406 tmp |= EP_QUEUE_HEAD_ZLT_SEL;
407
407 p_QH->max_pkt_length = cpu_to_le32(tmp); 408 p_QH->max_pkt_length = cpu_to_le32(tmp);
409 p_QH->next_dtd_ptr = 1;
410 p_QH->size_ioc_int_sts = 0;
408 411
409 return; 412 return;
410} 413}
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 9b36205c5759..0ce4e2819847 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -904,8 +904,8 @@ static void pxa25x_ep_fifo_flush(struct usb_ep *_ep)
904 904
905 /* most IN status is the same, but ISO can't stall */ 905 /* most IN status is the same, but ISO can't stall */
906 *ep->reg_udccs = UDCCS_BI_TPC|UDCCS_BI_FTF|UDCCS_BI_TUR 906 *ep->reg_udccs = UDCCS_BI_TPC|UDCCS_BI_FTF|UDCCS_BI_TUR
907 | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) 907 | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC
908 ? 0 : UDCCS_BI_SST; 908 ? 0 : UDCCS_BI_SST);
909} 909}
910 910
911 911
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 4725d15d096f..e551bb38852b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd)
485 * periodic_size can shrink by USBCMD update if hcc_params allows. 485 * periodic_size can shrink by USBCMD update if hcc_params allows.
486 */ 486 */
487 ehci->periodic_size = DEFAULT_I_TDPS; 487 ehci->periodic_size = DEFAULT_I_TDPS;
488 INIT_LIST_HEAD(&ehci->cached_itd_list);
488 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) 489 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
489 return retval; 490 return retval;
490 491
@@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd)
497 498
498 ehci->reclaim = NULL; 499 ehci->reclaim = NULL;
499 ehci->next_uframe = -1; 500 ehci->next_uframe = -1;
501 ehci->clock_frame = -1;
500 502
501 /* 503 /*
502 * dedicate a qh for the async ring head, since we couldn't unlink 504 * dedicate a qh for the async ring head, since we couldn't unlink
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 0431397836f6..10d52919abbb 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh)
128 128
129static void ehci_mem_cleanup (struct ehci_hcd *ehci) 129static void ehci_mem_cleanup (struct ehci_hcd *ehci)
130{ 130{
131 free_cached_itd_list(ehci);
131 if (ehci->async) 132 if (ehci->async)
132 qh_put (ehci->async); 133 qh_put (ehci->async);
133 ehci->async = NULL; 134 ehci->async = NULL;
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index bb21fb0a4969..abb9a7706ec7 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver = {
432 432
433#ifdef CONFIG_PM 433#ifdef CONFIG_PM
434 .suspend = usb_hcd_pci_suspend, 434 .suspend = usb_hcd_pci_suspend,
435 .resume_early = usb_hcd_pci_resume_early,
436 .resume = usb_hcd_pci_resume, 435 .resume = usb_hcd_pci_resume,
437#endif 436#endif
438 .shutdown = usb_hcd_pci_shutdown, 437 .shutdown = usb_hcd_pci_shutdown,
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index a081ee65bde6..07bcb931021b 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1004,7 +1004,8 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
1004 1004
1005 is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0; 1005 is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0;
1006 stream->bEndpointAddress &= 0x0f; 1006 stream->bEndpointAddress &= 0x0f;
1007 stream->ep->hcpriv = NULL; 1007 if (stream->ep)
1008 stream->ep->hcpriv = NULL;
1008 1009
1009 if (stream->rescheduled) { 1010 if (stream->rescheduled) {
1010 ehci_info (ehci, "ep%d%s-iso rescheduled " 1011 ehci_info (ehci, "ep%d%s-iso rescheduled "
@@ -1653,14 +1654,28 @@ itd_complete (
1653 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); 1654 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
1654 } 1655 }
1655 iso_stream_put (ehci, stream); 1656 iso_stream_put (ehci, stream);
1656 /* OK to recycle this ITD now that its completion callback ran. */ 1657
1657done: 1658done:
1658 usb_put_urb(urb); 1659 usb_put_urb(urb);
1659 itd->urb = NULL; 1660 itd->urb = NULL;
1660 itd->stream = NULL; 1661 if (ehci->clock_frame != itd->frame || itd->index[7] != -1) {
1661 list_move(&itd->itd_list, &stream->free_list); 1662 /* OK to recycle this ITD now. */
1662 iso_stream_put(ehci, stream); 1663 itd->stream = NULL;
1663 1664 list_move(&itd->itd_list, &stream->free_list);
1665 iso_stream_put(ehci, stream);
1666 } else {
1667 /* HW might remember this ITD, so we can't recycle it yet.
1668 * Move it to a safe place until a new frame starts.
1669 */
1670 list_move(&itd->itd_list, &ehci->cached_itd_list);
1671 if (stream->refcount == 2) {
1672 /* If iso_stream_put() were called here, stream
1673 * would be freed. Instead, just prevent reuse.
1674 */
1675 stream->ep->hcpriv = NULL;
1676 stream->ep = NULL;
1677 }
1678 }
1664 return retval; 1679 return retval;
1665} 1680}
1666 1681
@@ -2101,6 +2116,20 @@ done:
2101 2116
2102/*-------------------------------------------------------------------------*/ 2117/*-------------------------------------------------------------------------*/
2103 2118
2119static void free_cached_itd_list(struct ehci_hcd *ehci)
2120{
2121 struct ehci_itd *itd, *n;
2122
2123 list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
2124 struct ehci_iso_stream *stream = itd->stream;
2125 itd->stream = NULL;
2126 list_move(&itd->itd_list, &stream->free_list);
2127 iso_stream_put(ehci, stream);
2128 }
2129}
2130
2131/*-------------------------------------------------------------------------*/
2132
2104static void 2133static void
2105scan_periodic (struct ehci_hcd *ehci) 2134scan_periodic (struct ehci_hcd *ehci)
2106{ 2135{
@@ -2115,10 +2144,17 @@ scan_periodic (struct ehci_hcd *ehci)
2115 * Touches as few pages as possible: cache-friendly. 2144 * Touches as few pages as possible: cache-friendly.
2116 */ 2145 */
2117 now_uframe = ehci->next_uframe; 2146 now_uframe = ehci->next_uframe;
2118 if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) 2147 if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) {
2119 clock = ehci_readl(ehci, &ehci->regs->frame_index); 2148 clock = ehci_readl(ehci, &ehci->regs->frame_index);
2120 else 2149 clock_frame = (clock >> 3) % ehci->periodic_size;
2150 } else {
2121 clock = now_uframe + mod - 1; 2151 clock = now_uframe + mod - 1;
2152 clock_frame = -1;
2153 }
2154 if (ehci->clock_frame != clock_frame) {
2155 free_cached_itd_list(ehci);
2156 ehci->clock_frame = clock_frame;
2157 }
2122 clock %= mod; 2158 clock %= mod;
2123 clock_frame = clock >> 3; 2159 clock_frame = clock >> 3;
2124 2160
@@ -2277,6 +2313,10 @@ restart:
2277 /* rescan the rest of this frame, then ... */ 2313 /* rescan the rest of this frame, then ... */
2278 clock = now; 2314 clock = now;
2279 clock_frame = clock >> 3; 2315 clock_frame = clock >> 3;
2316 if (ehci->clock_frame != clock_frame) {
2317 free_cached_itd_list(ehci);
2318 ehci->clock_frame = clock_frame;
2319 }
2280 } else { 2320 } else {
2281 now_uframe++; 2321 now_uframe++;
2282 now_uframe %= mod; 2322 now_uframe %= mod;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index fb7054ccf4fc..262b00c9b334 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -87,6 +87,10 @@ struct ehci_hcd { /* one per controller */
87 int next_uframe; /* scan periodic, start here */ 87 int next_uframe; /* scan periodic, start here */
88 unsigned periodic_sched; /* periodic activity count */ 88 unsigned periodic_sched; /* periodic activity count */
89 89
90 /* list of itds completed while clock_frame was still active */
91 struct list_head cached_itd_list;
92 unsigned clock_frame;
93
90 /* per root hub port */ 94 /* per root hub port */
91 unsigned long reset_done [EHCI_MAX_ROOT_PORTS]; 95 unsigned long reset_done [EHCI_MAX_ROOT_PORTS];
92 96
@@ -220,6 +224,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
220 } 224 }
221} 225}
222 226
227static void free_cached_itd_list(struct ehci_hcd *ehci);
228
223/*-------------------------------------------------------------------------*/ 229/*-------------------------------------------------------------------------*/
224 230
225#include <linux/usb/ehci_def.h> 231#include <linux/usb/ehci_def.h>
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 5d625c3fd423..f9961b4c0da3 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver = {
487 487
488#ifdef CONFIG_PM 488#ifdef CONFIG_PM
489 .suspend = usb_hcd_pci_suspend, 489 .suspend = usb_hcd_pci_suspend,
490 .resume_early = usb_hcd_pci_resume_early,
491 .resume = usb_hcd_pci_resume, 490 .resume = usb_hcd_pci_resume,
492#endif 491#endif
493 492
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 944f7e0ca4df..cf5e4cf7ea42 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver = {
942 942
943#ifdef CONFIG_PM 943#ifdef CONFIG_PM
944 .suspend = usb_hcd_pci_suspend, 944 .suspend = usb_hcd_pci_suspend,
945 .resume_early = usb_hcd_pci_resume_early,
946 .resume = usb_hcd_pci_resume, 945 .resume = usb_hcd_pci_resume,
947#endif /* PM */ 946#endif /* PM */
948}; 947};
diff --git a/drivers/usb/host/whci/asl.c b/drivers/usb/host/whci/asl.c
index 2291c5f5af51..958751ccea43 100644
--- a/drivers/usb/host/whci/asl.c
+++ b/drivers/usb/host/whci/asl.c
@@ -227,13 +227,13 @@ void scan_async_work(struct work_struct *work)
227 * Now that the ASL is updated, complete the removal of any 227 * Now that the ASL is updated, complete the removal of any
228 * removed qsets. 228 * removed qsets.
229 */ 229 */
230 spin_lock(&whc->lock); 230 spin_lock_irq(&whc->lock);
231 231
232 list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) { 232 list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) {
233 qset_remove_complete(whc, qset); 233 qset_remove_complete(whc, qset);
234 } 234 }
235 235
236 spin_unlock(&whc->lock); 236 spin_unlock_irq(&whc->lock);
237} 237}
238 238
239/** 239/**
diff --git a/drivers/usb/host/whci/pzl.c b/drivers/usb/host/whci/pzl.c
index 7dc85a0bee7c..df8b85f07092 100644
--- a/drivers/usb/host/whci/pzl.c
+++ b/drivers/usb/host/whci/pzl.c
@@ -255,13 +255,13 @@ void scan_periodic_work(struct work_struct *work)
255 * Now that the PZL is updated, complete the removal of any 255 * Now that the PZL is updated, complete the removal of any
256 * removed qsets. 256 * removed qsets.
257 */ 257 */
258 spin_lock(&whc->lock); 258 spin_lock_irq(&whc->lock);
259 259
260 list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) { 260 list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) {
261 qset_remove_complete(whc, qset); 261 qset_remove_complete(whc, qset);
262 } 262 }
263 263
264 spin_unlock(&whc->lock); 264 spin_unlock_irq(&whc->lock);
265} 265}
266 266
267/** 267/**
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 5a8fd5d57a11..2dc7606f319c 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -377,18 +377,8 @@ int __init musb_platform_init(struct musb *musb)
377 u32 revision; 377 u32 revision;
378 378
379 musb->mregs += DAVINCI_BASE_OFFSET; 379 musb->mregs += DAVINCI_BASE_OFFSET;
380#if 0
381 /* REVISIT there's something odd about clocking, this
382 * didn't appear do the job ...
383 */
384 musb->clock = clk_get(pDevice, "usb");
385 if (IS_ERR(musb->clock))
386 return PTR_ERR(musb->clock);
387 380
388 status = clk_enable(musb->clock); 381 clk_enable(musb->clock);
389 if (status < 0)
390 return -ENODEV;
391#endif
392 382
393 /* returns zero if e.g. not clocked */ 383 /* returns zero if e.g. not clocked */
394 revision = musb_readl(tibase, DAVINCI_USB_VERSION_REG); 384 revision = musb_readl(tibase, DAVINCI_USB_VERSION_REG);
@@ -453,5 +443,8 @@ int musb_platform_exit(struct musb *musb)
453 } 443 }
454 444
455 phy_off(); 445 phy_off();
446
447 clk_disable(musb->clock);
448
456 return 0; 449 return 0;
457} 450}
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2cc34fa05b73..af77e4659006 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -115,7 +115,7 @@
115 115
116 116
117unsigned musb_debug; 117unsigned musb_debug;
118module_param(musb_debug, uint, S_IRUGO | S_IWUSR); 118module_param_named(debug, musb_debug, uint, S_IRUGO | S_IWUSR);
119MODULE_PARM_DESC(debug, "Debug message level. Default = 0"); 119MODULE_PARM_DESC(debug, "Debug message level. Default = 0");
120 120
121#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" 121#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia"
@@ -767,6 +767,7 @@ static irqreturn_t musb_stage2_irq(struct musb *musb, u8 int_usb,
767#ifdef CONFIG_USB_MUSB_HDRC_HCD 767#ifdef CONFIG_USB_MUSB_HDRC_HCD
768 case OTG_STATE_A_HOST: 768 case OTG_STATE_A_HOST:
769 case OTG_STATE_A_SUSPEND: 769 case OTG_STATE_A_SUSPEND:
770 usb_hcd_resume_root_hub(musb_to_hcd(musb));
770 musb_root_disconnect(musb); 771 musb_root_disconnect(musb);
771 if (musb->a_wait_bcon != 0) 772 if (musb->a_wait_bcon != 0)
772 musb_platform_try_idle(musb, jiffies 773 musb_platform_try_idle(musb, jiffies
@@ -1815,7 +1816,7 @@ static void musb_free(struct musb *musb)
1815#ifdef CONFIG_SYSFS 1816#ifdef CONFIG_SYSFS
1816 device_remove_file(musb->controller, &dev_attr_mode); 1817 device_remove_file(musb->controller, &dev_attr_mode);
1817 device_remove_file(musb->controller, &dev_attr_vbus); 1818 device_remove_file(musb->controller, &dev_attr_vbus);
1818#ifdef CONFIG_USB_MUSB_OTG 1819#ifdef CONFIG_USB_GADGET_MUSB_HDRC
1819 device_remove_file(musb->controller, &dev_attr_srp); 1820 device_remove_file(musb->controller, &dev_attr_srp);
1820#endif 1821#endif
1821#endif 1822#endif
@@ -2063,7 +2064,7 @@ fail2:
2063#ifdef CONFIG_SYSFS 2064#ifdef CONFIG_SYSFS
2064 device_remove_file(musb->controller, &dev_attr_mode); 2065 device_remove_file(musb->controller, &dev_attr_mode);
2065 device_remove_file(musb->controller, &dev_attr_vbus); 2066 device_remove_file(musb->controller, &dev_attr_vbus);
2066#ifdef CONFIG_USB_MUSB_OTG 2067#ifdef CONFIG_USB_GADGET_MUSB_HDRC
2067 device_remove_file(musb->controller, &dev_attr_srp); 2068 device_remove_file(musb->controller, &dev_attr_srp);
2068#endif 2069#endif
2069#endif 2070#endif
@@ -2243,10 +2244,10 @@ static int __init musb_init(void)
2243 return platform_driver_probe(&musb_driver, musb_probe); 2244 return platform_driver_probe(&musb_driver, musb_probe);
2244} 2245}
2245 2246
2246/* make us init after usbcore and before usb 2247/* make us init after usbcore and i2c (transceivers, regulators, etc)
2247 * gadget and host-side drivers start to register 2248 * and before usb gadget and host-side drivers start to register
2248 */ 2249 */
2249subsys_initcall(musb_init); 2250fs_initcall(musb_init);
2250 2251
2251static void __exit musb_cleanup(void) 2252static void __exit musb_cleanup(void)
2252{ 2253{
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 4ea305387981..c7ebd0867fcc 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -575,7 +575,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
575 struct usb_request *request = &req->request; 575 struct usb_request *request = &req->request;
576 struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; 576 struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out;
577 void __iomem *epio = musb->endpoints[epnum].regs; 577 void __iomem *epio = musb->endpoints[epnum].regs;
578 u16 fifo_count = 0; 578 unsigned fifo_count = 0;
579 u16 len = musb_ep->packet_sz; 579 u16 len = musb_ep->packet_sz;
580 580
581 csr = musb_readw(epio, MUSB_RXCSR); 581 csr = musb_readw(epio, MUSB_RXCSR);
@@ -687,7 +687,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
687 len, fifo_count, 687 len, fifo_count,
688 musb_ep->packet_sz); 688 musb_ep->packet_sz);
689 689
690 fifo_count = min(len, fifo_count); 690 fifo_count = min_t(unsigned, len, fifo_count);
691 691
692#ifdef CONFIG_USB_TUSB_OMAP_DMA 692#ifdef CONFIG_USB_TUSB_OMAP_DMA
693 if (tusb_dma_omap() && musb_ep->dma) { 693 if (tusb_dma_omap() && musb_ep->dma) {
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index a035ceccf950..6dbbd0786a6a 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -335,16 +335,11 @@ musb_save_toggle(struct musb_hw_ep *ep, int is_in, struct urb *urb)
335static struct musb_qh * 335static struct musb_qh *
336musb_giveback(struct musb_qh *qh, struct urb *urb, int status) 336musb_giveback(struct musb_qh *qh, struct urb *urb, int status)
337{ 337{
338 int is_in;
339 struct musb_hw_ep *ep = qh->hw_ep; 338 struct musb_hw_ep *ep = qh->hw_ep;
340 struct musb *musb = ep->musb; 339 struct musb *musb = ep->musb;
340 int is_in = usb_pipein(urb->pipe);
341 int ready = qh->is_ready; 341 int ready = qh->is_ready;
342 342
343 if (ep->is_shared_fifo)
344 is_in = 1;
345 else
346 is_in = usb_pipein(urb->pipe);
347
348 /* save toggle eagerly, for paranoia */ 343 /* save toggle eagerly, for paranoia */
349 switch (qh->type) { 344 switch (qh->type) {
350 case USB_ENDPOINT_XFER_BULK: 345 case USB_ENDPOINT_XFER_BULK:
@@ -432,7 +427,7 @@ musb_advance_schedule(struct musb *musb, struct urb *urb,
432 else 427 else
433 qh = musb_giveback(qh, urb, urb->status); 428 qh = musb_giveback(qh, urb, urb->status);
434 429
435 if (qh && qh->is_ready && !list_empty(&qh->hep->urb_list)) { 430 if (qh != NULL && qh->is_ready) {
436 DBG(4, "... next ep%d %cX urb %p\n", 431 DBG(4, "... next ep%d %cX urb %p\n",
437 hw_ep->epnum, is_in ? 'R' : 'T', 432 hw_ep->epnum, is_in ? 'R' : 'T',
438 next_urb(qh)); 433 next_urb(qh));
@@ -942,8 +937,8 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
942 switch (musb->ep0_stage) { 937 switch (musb->ep0_stage) {
943 case MUSB_EP0_IN: 938 case MUSB_EP0_IN:
944 fifo_dest = urb->transfer_buffer + urb->actual_length; 939 fifo_dest = urb->transfer_buffer + urb->actual_length;
945 fifo_count = min(len, ((u16) (urb->transfer_buffer_length 940 fifo_count = min_t(size_t, len, urb->transfer_buffer_length -
946 - urb->actual_length))); 941 urb->actual_length);
947 if (fifo_count < len) 942 if (fifo_count < len)
948 urb->status = -EOVERFLOW; 943 urb->status = -EOVERFLOW;
949 944
@@ -976,10 +971,9 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
976 } 971 }
977 /* FALLTHROUGH */ 972 /* FALLTHROUGH */
978 case MUSB_EP0_OUT: 973 case MUSB_EP0_OUT:
979 fifo_count = min(qh->maxpacket, ((u16) 974 fifo_count = min_t(size_t, qh->maxpacket,
980 (urb->transfer_buffer_length 975 urb->transfer_buffer_length -
981 - urb->actual_length))); 976 urb->actual_length);
982
983 if (fifo_count) { 977 if (fifo_count) {
984 fifo_dest = (u8 *) (urb->transfer_buffer 978 fifo_dest = (u8 *) (urb->transfer_buffer
985 + urb->actual_length); 979 + urb->actual_length);
@@ -1161,7 +1155,8 @@ void musb_host_tx(struct musb *musb, u8 epnum)
1161 struct urb *urb; 1155 struct urb *urb;
1162 struct musb_hw_ep *hw_ep = musb->endpoints + epnum; 1156 struct musb_hw_ep *hw_ep = musb->endpoints + epnum;
1163 void __iomem *epio = hw_ep->regs; 1157 void __iomem *epio = hw_ep->regs;
1164 struct musb_qh *qh = hw_ep->out_qh; 1158 struct musb_qh *qh = hw_ep->is_shared_fifo ? hw_ep->in_qh
1159 : hw_ep->out_qh;
1165 u32 status = 0; 1160 u32 status = 0;
1166 void __iomem *mbase = musb->mregs; 1161 void __iomem *mbase = musb->mregs;
1167 struct dma_channel *dma; 1162 struct dma_channel *dma;
@@ -1308,7 +1303,8 @@ void musb_host_tx(struct musb *musb, u8 epnum)
1308 * packets before updating TXCSR ... other docs disagree ... 1303 * packets before updating TXCSR ... other docs disagree ...
1309 */ 1304 */
1310 /* PIO: start next packet in this URB */ 1305 /* PIO: start next packet in this URB */
1311 wLength = min(qh->maxpacket, (u16) wLength); 1306 if (wLength > qh->maxpacket)
1307 wLength = qh->maxpacket;
1312 musb_write_fifo(hw_ep, wLength, buf); 1308 musb_write_fifo(hw_ep, wLength, buf);
1313 qh->segsize = wLength; 1309 qh->segsize = wLength;
1314 1310
@@ -1867,19 +1863,21 @@ static int musb_urb_enqueue(
1867 } 1863 }
1868 qh->type_reg = type_reg; 1864 qh->type_reg = type_reg;
1869 1865
1870 /* precompute rxinterval/txinterval register */ 1866 /* Precompute RXINTERVAL/TXINTERVAL register */
1871 interval = min((u8)16, epd->bInterval); /* log encoding */
1872 switch (qh->type) { 1867 switch (qh->type) {
1873 case USB_ENDPOINT_XFER_INT: 1868 case USB_ENDPOINT_XFER_INT:
1874 /* fullspeed uses linear encoding */ 1869 /*
1875 if (USB_SPEED_FULL == urb->dev->speed) { 1870 * Full/low speeds use the linear encoding,
1876 interval = epd->bInterval; 1871 * high speed uses the logarithmic encoding.
1877 if (!interval) 1872 */
1878 interval = 1; 1873 if (urb->dev->speed <= USB_SPEED_FULL) {
1874 interval = max_t(u8, epd->bInterval, 1);
1875 break;
1879 } 1876 }
1880 /* FALLTHROUGH */ 1877 /* FALLTHROUGH */
1881 case USB_ENDPOINT_XFER_ISOC: 1878 case USB_ENDPOINT_XFER_ISOC:
1882 /* iso always uses log encoding */ 1879 /* ISO always uses logarithmic encoding */
1880 interval = min_t(u8, epd->bInterval, 16);
1883 break; 1881 break;
1884 default: 1882 default:
1885 /* REVISIT we actually want to use NAK limits, hinting to the 1883 /* REVISIT we actually want to use NAK limits, hinting to the
@@ -2037,9 +2035,9 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
2037 goto done; 2035 goto done;
2038 2036
2039 /* Any URB not actively programmed into endpoint hardware can be 2037 /* Any URB not actively programmed into endpoint hardware can be
2040 * immediately given back. Such an URB must be at the head of its 2038 * immediately given back; that's any URB not at the head of an
2041 * endpoint queue, unless someday we get real DMA queues. And even 2039 * endpoint queue, unless someday we get real DMA queues. And even
2042 * then, it might not be known to the hardware... 2040 * if it's at the head, it might not be known to the hardware...
2043 * 2041 *
2044 * Otherwise abort current transfer, pending dma, etc.; urb->status 2042 * Otherwise abort current transfer, pending dma, etc.; urb->status
2045 * has already been updated. This is a synchronous abort; it'd be 2043 * has already been updated. This is a synchronous abort; it'd be
@@ -2078,6 +2076,15 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
2078 qh->is_ready = 0; 2076 qh->is_ready = 0;
2079 __musb_giveback(musb, urb, 0); 2077 __musb_giveback(musb, urb, 0);
2080 qh->is_ready = ready; 2078 qh->is_ready = ready;
2079
2080 /* If nothing else (usually musb_giveback) is using it
2081 * and its URB list has emptied, recycle this qh.
2082 */
2083 if (ready && list_empty(&qh->hep->urb_list)) {
2084 qh->hep->hcpriv = NULL;
2085 list_del(&qh->ring);
2086 kfree(qh);
2087 }
2081 } else 2088 } else
2082 ret = musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); 2089 ret = musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN);
2083done: 2090done:
@@ -2093,15 +2100,16 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
2093 unsigned long flags; 2100 unsigned long flags;
2094 struct musb *musb = hcd_to_musb(hcd); 2101 struct musb *musb = hcd_to_musb(hcd);
2095 u8 is_in = epnum & USB_DIR_IN; 2102 u8 is_in = epnum & USB_DIR_IN;
2096 struct musb_qh *qh = hep->hcpriv; 2103 struct musb_qh *qh;
2097 struct urb *urb, *tmp; 2104 struct urb *urb;
2098 struct list_head *sched; 2105 struct list_head *sched;
2099 2106
2100 if (!qh)
2101 return;
2102
2103 spin_lock_irqsave(&musb->lock, flags); 2107 spin_lock_irqsave(&musb->lock, flags);
2104 2108
2109 qh = hep->hcpriv;
2110 if (qh == NULL)
2111 goto exit;
2112
2105 switch (qh->type) { 2113 switch (qh->type) {
2106 case USB_ENDPOINT_XFER_CONTROL: 2114 case USB_ENDPOINT_XFER_CONTROL:
2107 sched = &musb->control; 2115 sched = &musb->control;
@@ -2135,13 +2143,28 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
2135 2143
2136 /* cleanup */ 2144 /* cleanup */
2137 musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); 2145 musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN);
2138 } else
2139 urb = NULL;
2140 2146
2141 /* then just nuke all the others */ 2147 /* Then nuke all the others ... and advance the
2142 list_for_each_entry_safe_from(urb, tmp, &hep->urb_list, urb_list) 2148 * queue on hw_ep (e.g. bulk ring) when we're done.
2143 musb_giveback(qh, urb, -ESHUTDOWN); 2149 */
2150 while (!list_empty(&hep->urb_list)) {
2151 urb = next_urb(qh);
2152 urb->status = -ESHUTDOWN;
2153 musb_advance_schedule(musb, urb, qh->hw_ep, is_in);
2154 }
2155 } else {
2156 /* Just empty the queue; the hardware is busy with
2157 * other transfers, and since !qh->is_ready nothing
2158 * will activate any of these as it advances.
2159 */
2160 while (!list_empty(&hep->urb_list))
2161 __musb_giveback(musb, next_urb(qh), -ESHUTDOWN);
2144 2162
2163 hep->hcpriv = NULL;
2164 list_del(&qh->ring);
2165 kfree(qh);
2166 }
2167exit:
2145 spin_unlock_irqrestore(&musb->lock, flags); 2168 spin_unlock_irqrestore(&musb->lock, flags);
2146} 2169}
2147 2170
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index bfd0b68ceccd..b7c132bded7f 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -294,7 +294,11 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
294 294
295/* Ericsson products */ 295/* Ericsson products */
296#define ERICSSON_VENDOR_ID 0x0bdb 296#define ERICSSON_VENDOR_ID 0x0bdb
297#define ERICSSON_PRODUCT_F3507G 0x1900 297#define ERICSSON_PRODUCT_F3507G_1 0x1900
298#define ERICSSON_PRODUCT_F3507G_2 0x1902
299
300#define BENQ_VENDOR_ID 0x04a5
301#define BENQ_PRODUCT_H10 0x4068
298 302
299static struct usb_device_id option_ids[] = { 303static struct usb_device_id option_ids[] = {
300 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 304 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -509,7 +513,10 @@ static struct usb_device_id option_ids[] = {
509 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) }, 513 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) },
510 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, 514 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
511 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, 515 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
512 { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) }, 516 { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_1) },
517 { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_2) },
518 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
519 { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */
513 { } /* Terminating entry */ 520 { } /* Terminating entry */
514}; 521};
515MODULE_DEVICE_TABLE(usb, option_ids); 522MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 50dc33a6065b..6f59c8e510ea 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -907,13 +907,13 @@ UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff,
907 "Genesys Logic", 907 "Genesys Logic",
908 "USB to IDE Optical", 908 "USB to IDE Optical",
909 US_SC_DEVICE, US_PR_DEVICE, NULL, 909 US_SC_DEVICE, US_PR_DEVICE, NULL,
910 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), 910 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
911 911
912UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, 912UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff,
913 "Genesys Logic", 913 "Genesys Logic",
914 "USB to IDE Disk", 914 "USB to IDE Disk",
915 US_SC_DEVICE, US_PR_DEVICE, NULL, 915 US_SC_DEVICE, US_PR_DEVICE, NULL,
916 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), 916 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
917 917
918/* Reported by Ben Efros <ben@pc-doctor.com> */ 918/* Reported by Ben Efros <ben@pc-doctor.com> */
919UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x9451, 919UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x9451,
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index bf0af660df8a..fb19803060cf 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1054,10 +1054,7 @@ config FB_RIVA_BACKLIGHT
1054 1054
1055config FB_I810 1055config FB_I810
1056 tristate "Intel 810/815 support (EXPERIMENTAL)" 1056 tristate "Intel 810/815 support (EXPERIMENTAL)"
1057 depends on EXPERIMENTAL && PCI && X86_32 1057 depends on EXPERIMENTAL && FB && PCI && X86_32 && AGP_INTEL
1058 select AGP
1059 select AGP_INTEL
1060 select FB
1061 select FB_MODE_HELPERS 1058 select FB_MODE_HELPERS
1062 select FB_CFB_FILLRECT 1059 select FB_CFB_FILLRECT
1063 select FB_CFB_COPYAREA 1060 select FB_CFB_COPYAREA
@@ -1120,10 +1117,7 @@ config FB_CARILLO_RANCH
1120 1117
1121config FB_INTEL 1118config FB_INTEL
1122 tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" 1119 tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)"
1123 depends on EXPERIMENTAL && PCI && X86 1120 depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL
1124 select FB
1125 select AGP
1126 select AGP_INTEL
1127 select FB_MODE_HELPERS 1121 select FB_MODE_HELPERS
1128 select FB_CFB_FILLRECT 1122 select FB_CFB_FILLRECT
1129 select FB_CFB_COPYAREA 1123 select FB_CFB_COPYAREA
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index 8058572a7428..018850c116c6 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -841,7 +841,7 @@ static int tt_detect(void)
841 tt_dmasnd.ctrl = DMASND_CTRL_OFF; 841 tt_dmasnd.ctrl = DMASND_CTRL_OFF;
842 udelay(20); /* wait a while for things to settle down */ 842 udelay(20); /* wait a while for things to settle down */
843 } 843 }
844 mono_moni = (mfp.par_dt_reg & 0x80) == 0; 844 mono_moni = (st_mfp.par_dt_reg & 0x80) == 0;
845 845
846 tt_get_par(&par); 846 tt_get_par(&par);
847 tt_encode_var(&atafb_predefined[0], &par); 847 tt_encode_var(&atafb_predefined[0], &par);
@@ -2035,7 +2035,7 @@ static int stste_detect(void)
2035 tt_dmasnd.ctrl = DMASND_CTRL_OFF; 2035 tt_dmasnd.ctrl = DMASND_CTRL_OFF;
2036 udelay(20); /* wait a while for things to settle down */ 2036 udelay(20); /* wait a while for things to settle down */
2037 } 2037 }
2038 mono_moni = (mfp.par_dt_reg & 0x80) == 0; 2038 mono_moni = (st_mfp.par_dt_reg & 0x80) == 0;
2039 2039
2040 stste_get_par(&par); 2040 stste_get_par(&par);
2041 stste_encode_var(&atafb_predefined[0], &par); 2041 stste_encode_var(&atafb_predefined[0], &par);
@@ -2086,20 +2086,20 @@ static void st_ovsc_switch(void)
2086 return; 2086 return;
2087 local_irq_save(flags); 2087 local_irq_save(flags);
2088 2088
2089 mfp.tim_ct_b = 0x10; 2089 st_mfp.tim_ct_b = 0x10;
2090 mfp.active_edge |= 8; 2090 st_mfp.active_edge |= 8;
2091 mfp.tim_ct_b = 0; 2091 st_mfp.tim_ct_b = 0;
2092 mfp.tim_dt_b = 0xf0; 2092 st_mfp.tim_dt_b = 0xf0;
2093 mfp.tim_ct_b = 8; 2093 st_mfp.tim_ct_b = 8;
2094 while (mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */ 2094 while (st_mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */
2095 ; 2095 ;
2096 new = mfp.tim_dt_b; 2096 new = st_mfp.tim_dt_b;
2097 do { 2097 do {
2098 udelay(LINE_DELAY); 2098 udelay(LINE_DELAY);
2099 old = new; 2099 old = new;
2100 new = mfp.tim_dt_b; 2100 new = st_mfp.tim_dt_b;
2101 } while (old != new); 2101 } while (old != new);
2102 mfp.tim_ct_b = 0x10; 2102 st_mfp.tim_ct_b = 0x10;
2103 udelay(SYNC_DELAY); 2103 udelay(SYNC_DELAY);
2104 2104
2105 if (atari_switches & ATARI_SWITCH_OVSC_IKBD) 2105 if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index e6e299feb51b..35e8eb02b9e9 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1853,13 +1853,14 @@ static void aty128_bl_exit(struct backlight_device *bd)
1853 * Initialisation 1853 * Initialisation
1854 */ 1854 */
1855 1855
1856#ifdef CONFIG_PPC_PMAC 1856#ifdef CONFIG_PPC_PMAC__disabled
1857static void aty128_early_resume(void *data) 1857static void aty128_early_resume(void *data)
1858{ 1858{
1859 struct aty128fb_par *par = data; 1859 struct aty128fb_par *par = data;
1860 1860
1861 if (try_acquire_console_sem()) 1861 if (try_acquire_console_sem())
1862 return; 1862 return;
1863 pci_restore_state(par->pdev);
1863 aty128_do_resume(par->pdev); 1864 aty128_do_resume(par->pdev);
1864 release_console_sem(); 1865 release_console_sem();
1865} 1866}
@@ -1907,7 +1908,14 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
1907 /* Indicate sleep capability */ 1908 /* Indicate sleep capability */
1908 if (par->chip_gen == rage_M3) { 1909 if (par->chip_gen == rage_M3) {
1909 pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, NULL, 0, 1); 1910 pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, NULL, 0, 1);
1911#if 0 /* Disable the early video resume hack for now as it's causing problems, among
1912 * others we now rely on the PCI core restoring the config space for us, which
1913 * isn't the case with that hack, and that code path causes various things to
1914 * be called with interrupts off while they shouldn't. I'm leaving the code in
1915 * as it can be useful for debugging purposes
1916 */
1910 pmac_set_early_video_resume(aty128_early_resume, par); 1917 pmac_set_early_video_resume(aty128_early_resume, par);
1918#endif
1911 } 1919 }
1912 1920
1913 /* Find default mode */ 1921 /* Find default mode */
@@ -2365,7 +2373,6 @@ static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, int dx
2365static void aty128_set_suspend(struct aty128fb_par *par, int suspend) 2373static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
2366{ 2374{
2367 u32 pmgt; 2375 u32 pmgt;
2368 u16 pwr_command;
2369 struct pci_dev *pdev = par->pdev; 2376 struct pci_dev *pdev = par->pdev;
2370 2377
2371 if (!par->pm_reg) 2378 if (!par->pm_reg)
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index ca5f0dc28546..81603f85e17e 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -2762,12 +2762,13 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
2762 return rc; 2762 return rc;
2763} 2763}
2764 2764
2765#ifdef CONFIG_PPC_OF 2765#ifdef CONFIG_PPC_OF__disabled
2766static void radeonfb_early_resume(void *data) 2766static void radeonfb_early_resume(void *data)
2767{ 2767{
2768 struct radeonfb_info *rinfo = data; 2768 struct radeonfb_info *rinfo = data;
2769 2769
2770 rinfo->no_schedule = 1; 2770 rinfo->no_schedule = 1;
2771 pci_restore_state(rinfo->pdev);
2771 radeonfb_pci_resume(rinfo->pdev); 2772 radeonfb_pci_resume(rinfo->pdev);
2772 rinfo->no_schedule = 0; 2773 rinfo->no_schedule = 0;
2773} 2774}
@@ -2834,7 +2835,14 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlis
2834 */ 2835 */
2835 if (rinfo->pm_mode != radeon_pm_none) { 2836 if (rinfo->pm_mode != radeon_pm_none) {
2836 pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, rinfo->of_node, 0, 1); 2837 pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, rinfo->of_node, 0, 1);
2838#if 0 /* Disable the early video resume hack for now as it's causing problems, among
2839 * others we now rely on the PCI core restoring the config space for us, which
2840 * isn't the case with that hack, and that code path causes various things to
2841 * be called with interrupts off while they shouldn't. I'm leaving the code in
2842 * as it can be useful for debugging purposes
2843 */
2837 pmac_set_early_video_resume(radeonfb_early_resume, rinfo); 2844 pmac_set_early_video_resume(radeonfb_early_resume, rinfo);
2845#endif
2838 } 2846 }
2839 2847
2840#if 0 2848#if 0
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index a24e680d2b9c..2e940199fc89 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -993,6 +993,7 @@ static int i810_check_params(struct fb_var_screeninfo *var,
993 struct i810fb_par *par = info->par; 993 struct i810fb_par *par = info->par;
994 int line_length, vidmem, mode_valid = 0, retval = 0; 994 int line_length, vidmem, mode_valid = 0, retval = 0;
995 u32 vyres = var->yres_virtual, vxres = var->xres_virtual; 995 u32 vyres = var->yres_virtual, vxres = var->xres_virtual;
996
996 /* 997 /*
997 * Memory limit 998 * Memory limit
998 */ 999 */
@@ -1002,12 +1003,12 @@ static int i810_check_params(struct fb_var_screeninfo *var,
1002 if (vidmem > par->fb.size) { 1003 if (vidmem > par->fb.size) {
1003 vyres = par->fb.size/line_length; 1004 vyres = par->fb.size/line_length;
1004 if (vyres < var->yres) { 1005 if (vyres < var->yres) {
1005 vyres = yres; 1006 vyres = info->var.yres;
1006 vxres = par->fb.size/vyres; 1007 vxres = par->fb.size/vyres;
1007 vxres /= var->bits_per_pixel >> 3; 1008 vxres /= var->bits_per_pixel >> 3;
1008 line_length = get_line_length(par, vxres, 1009 line_length = get_line_length(par, vxres,
1009 var->bits_per_pixel); 1010 var->bits_per_pixel);
1010 vidmem = line_length * yres; 1011 vidmem = line_length * info->var.yres;
1011 if (vxres < var->xres) { 1012 if (vxres < var->xres) {
1012 printk("i810fb: required video memory, " 1013 printk("i810fb: required video memory, "
1013 "%d bytes, for %dx%d-%d (virtual) " 1014 "%d bytes, for %dx%d-%d (virtual) "
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 48ff701d3a72..2552b9f325ee 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -2230,7 +2230,7 @@ static int __devexit pxafb_remove(struct platform_device *dev)
2230 2230
2231static struct platform_driver pxafb_driver = { 2231static struct platform_driver pxafb_driver = {
2232 .probe = pxafb_probe, 2232 .probe = pxafb_probe,
2233 .remove = pxafb_remove, 2233 .remove = __devexit_p(pxafb_remove),
2234 .suspend = pxafb_suspend, 2234 .suspend = pxafb_suspend,
2235 .resume = pxafb_resume, 2235 .resume = pxafb_resume,
2236 .driver = { 2236 .driver = {
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 0e2b8fd24df1..2c5d069e5f06 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -446,7 +446,6 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
446{ 446{
447 struct sh_mobile_lcdc_chan *ch; 447 struct sh_mobile_lcdc_chan *ch;
448 struct sh_mobile_lcdc_board_cfg *board_cfg; 448 struct sh_mobile_lcdc_board_cfg *board_cfg;
449 unsigned long tmp;
450 int k; 449 int k;
451 450
452 /* tell the board code to disable the panel */ 451 /* tell the board code to disable the panel */
@@ -456,9 +455,8 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
456 if (board_cfg->display_off) 455 if (board_cfg->display_off)
457 board_cfg->display_off(board_cfg->board_data); 456 board_cfg->display_off(board_cfg->board_data);
458 457
459 /* cleanup deferred io if SYS bus */ 458 /* cleanup deferred io if enabled */
460 tmp = ch->cfg.sys_bus_cfg.deferred_io_msec; 459 if (ch->info.fbdefio) {
461 if (ch->ldmt1r_value & (1 << 12) && tmp) {
462 fb_deferred_io_cleanup(&ch->info); 460 fb_deferred_io_cleanup(&ch->info);
463 ch->info.fbdefio = NULL; 461 ch->info.fbdefio = NULL;
464 } 462 }
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index 9e1138a75e8b..a411702413d6 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -39,7 +39,7 @@ static u8 w1_gpio_read_bit(void *data)
39{ 39{
40 struct w1_gpio_platform_data *pdata = data; 40 struct w1_gpio_platform_data *pdata = data;
41 41
42 return gpio_get_value(pdata->pin); 42 return gpio_get_value(pdata->pin) ? 1 : 0;
43} 43}
44 44
45static int __init w1_gpio_probe(struct platform_device *pdev) 45static int __init w1_gpio_probe(struct platform_device *pdev)
diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig
index 8d0b1fb1e52e..1f51366417b9 100644
--- a/drivers/w1/slaves/Kconfig
+++ b/drivers/w1/slaves/Kconfig
@@ -16,6 +16,12 @@ config W1_SLAVE_SMEM
16 Say Y here if you want to connect 1-wire 16 Say Y here if you want to connect 1-wire
17 simple 64bit memory rom(ds2401/ds2411/ds1990*) to your wire. 17 simple 64bit memory rom(ds2401/ds2411/ds1990*) to your wire.
18 18
19config W1_SLAVE_DS2431
20 tristate "1kb EEPROM family support (DS2431)"
21 help
22 Say Y here if you want to use a 1-wire
23 1kb EEPROM family device (DS2431)
24
19config W1_SLAVE_DS2433 25config W1_SLAVE_DS2433
20 tristate "4kb EEPROM family support (DS2433)" 26 tristate "4kb EEPROM family support (DS2433)"
21 help 27 help
diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile
index 990f400b6d22..f1f51f19b129 100644
--- a/drivers/w1/slaves/Makefile
+++ b/drivers/w1/slaves/Makefile
@@ -4,6 +4,7 @@
4 4
5obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o 5obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o
6obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o 6obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o
7obj-$(CONFIG_W1_SLAVE_DS2431) += w1_ds2431.o
7obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o 8obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o
8obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o 9obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o
9obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o 10obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index 858c16a544c2..139447148822 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -156,6 +156,9 @@ out_up:
156 */ 156 */
157static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data) 157static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data)
158{ 158{
159#ifdef CONFIG_W1_SLAVE_DS2433_CRC
160 struct w1_f23_data *f23 = sl->family_data;
161#endif
159 u8 wrbuf[4]; 162 u8 wrbuf[4];
160 u8 rdbuf[W1_PAGE_SIZE + 3]; 163 u8 rdbuf[W1_PAGE_SIZE + 3];
161 u8 es = (addr + len - 1) & 0x1f; 164 u8 es = (addr + len - 1) & 0x1f;
@@ -196,7 +199,9 @@ static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data)
196 199
197 /* Reset the bus to wake up the EEPROM (this may not be needed) */ 200 /* Reset the bus to wake up the EEPROM (this may not be needed) */
198 w1_reset_bus(sl->master); 201 w1_reset_bus(sl->master);
199 202#ifdef CONFIG_W1_SLAVE_DS2433_CRC
203 f23->validcrc &= ~(1 << (addr >> W1_PAGE_BITS));
204#endif
200 return 0; 205 return 0;
201} 206}
202 207
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 09a3d5522b43..325c10ff6a2c 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -406,7 +406,7 @@ config ITCO_WDT
406 ---help--- 406 ---help---
407 Hardware driver for the intel TCO timer based watchdog devices. 407 Hardware driver for the intel TCO timer based watchdog devices.
408 These drivers are included in the Intel 82801 I/O Controller 408 These drivers are included in the Intel 82801 I/O Controller
409 Hub family (from ICH0 up to ICH8) and in the Intel 6300ESB 409 Hub family (from ICH0 up to ICH10) and in the Intel 63xxESB
410 controller hub. 410 controller hub.
411 411
412 The TCO (Total Cost of Ownership) timer is a watchdog timer 412 The TCO (Total Cost of Ownership) timer is a watchdog timer
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
index 5531691f46ea..e35d54589232 100644
--- a/drivers/watchdog/at91rm9200_wdt.c
+++ b/drivers/watchdog/at91rm9200_wdt.c
@@ -107,10 +107,10 @@ static int at91_wdt_close(struct inode *inode, struct file *file)
107static int at91_wdt_settimeout(int new_time) 107static int at91_wdt_settimeout(int new_time)
108{ 108{
109 /* 109 /*
110 * All counting occurs at SLOW_CLOCK / 128 = 0.256 Hz 110 * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
111 * 111 *
112 * Since WDV is a 16-bit counter, the maximum period is 112 * Since WDV is a 16-bit counter, the maximum period is
113 * 65536 / 0.256 = 256 seconds. 113 * 65536 / 256 = 256 seconds.
114 */ 114 */
115 if ((new_time <= 0) || (new_time > WDT_MAX_TIME)) 115 if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
116 return -EINVAL; 116 return -EINVAL;
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index b1da287f90ec..a56ac84381b1 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/io.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/miscdevice.h> 23#include <linux/miscdevice.h>
23#include <linux/module.h> 24#include <linux/module.h>
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index f0c2b7a1a175..734d9806a872 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -269,7 +269,7 @@ static int __devinit gef_wdt_probe(struct of_device *dev,
269 bus_clk = 133; /* in MHz */ 269 bus_clk = 133; /* in MHz */
270 270
271 freq = fsl_get_sys_freq(); 271 freq = fsl_get_sys_freq();
272 if (freq > 0) 272 if (freq != -1)
273 bus_clk = freq; 273 bus_clk = freq;
274 274
275 /* Map devices registers into memory */ 275 /* Map devices registers into memory */
diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c
index 2474ebca88f6..d8264ad0be41 100644
--- a/drivers/watchdog/iTCO_vendor_support.c
+++ b/drivers/watchdog/iTCO_vendor_support.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * intel TCO vendor specific watchdog driver support 2 * intel TCO vendor specific watchdog driver support
3 * 3 *
4 * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>. 4 * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
@@ -19,7 +19,7 @@
19 19
20/* Module and version information */ 20/* Module and version information */
21#define DRV_NAME "iTCO_vendor_support" 21#define DRV_NAME "iTCO_vendor_support"
22#define DRV_VERSION "1.02" 22#define DRV_VERSION "1.03"
23#define PFX DRV_NAME ": " 23#define PFX DRV_NAME ": "
24 24
25/* Includes */ 25/* Includes */
@@ -77,6 +77,26 @@ MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (n
77 * 20.6 seconds. 77 * 20.6 seconds.
78 */ 78 */
79 79
80static void supermicro_old_pre_start(unsigned long acpibase)
81{
82 unsigned long val32;
83
84 /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
85 val32 = inl(SMI_EN);
86 val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */
87 outl(val32, SMI_EN); /* Needed to activate watchdog */
88}
89
90static void supermicro_old_pre_stop(unsigned long acpibase)
91{
92 unsigned long val32;
93
94 /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */
95 val32 = inl(SMI_EN);
96 val32 |= 0x00002000; /* Turn on SMI clearing watchdog */
97 outl(val32, SMI_EN); /* Needed to deactivate watchdog */
98}
99
80static void supermicro_old_pre_keepalive(unsigned long acpibase) 100static void supermicro_old_pre_keepalive(unsigned long acpibase)
81{ 101{
82 /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */ 102 /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */
@@ -228,14 +248,18 @@ static void supermicro_new_pre_set_heartbeat(unsigned int heartbeat)
228void iTCO_vendor_pre_start(unsigned long acpibase, 248void iTCO_vendor_pre_start(unsigned long acpibase,
229 unsigned int heartbeat) 249 unsigned int heartbeat)
230{ 250{
231 if (vendorsupport == SUPERMICRO_NEW_BOARD) 251 if (vendorsupport == SUPERMICRO_OLD_BOARD)
252 supermicro_old_pre_start(acpibase);
253 else if (vendorsupport == SUPERMICRO_NEW_BOARD)
232 supermicro_new_pre_start(heartbeat); 254 supermicro_new_pre_start(heartbeat);
233} 255}
234EXPORT_SYMBOL(iTCO_vendor_pre_start); 256EXPORT_SYMBOL(iTCO_vendor_pre_start);
235 257
236void iTCO_vendor_pre_stop(unsigned long acpibase) 258void iTCO_vendor_pre_stop(unsigned long acpibase)
237{ 259{
238 if (vendorsupport == SUPERMICRO_NEW_BOARD) 260 if (vendorsupport == SUPERMICRO_OLD_BOARD)
261 supermicro_old_pre_stop(acpibase);
262 else if (vendorsupport == SUPERMICRO_NEW_BOARD)
239 supermicro_new_pre_stop(); 263 supermicro_new_pre_stop();
240} 264}
241EXPORT_SYMBOL(iTCO_vendor_pre_stop); 265EXPORT_SYMBOL(iTCO_vendor_pre_stop);
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index 5b395a4ddfdf..352334947ea3 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * intel TCO Watchdog Driver (Used in i82801 and i6300ESB chipsets) 2 * intel TCO Watchdog Driver (Used in i82801 and i63xxESB chipsets)
3 * 3 *
4 * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>. 4 * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
@@ -63,7 +63,7 @@
63 63
64/* Module and version information */ 64/* Module and version information */
65#define DRV_NAME "iTCO_wdt" 65#define DRV_NAME "iTCO_wdt"
66#define DRV_VERSION "1.04" 66#define DRV_VERSION "1.05"
67#define PFX DRV_NAME ": " 67#define PFX DRV_NAME ": "
68 68
69/* Includes */ 69/* Includes */
@@ -236,16 +236,16 @@ MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
236 236
237/* Address definitions for the TCO */ 237/* Address definitions for the TCO */
238/* TCO base address */ 238/* TCO base address */
239#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 239#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60
240/* SMI Control and Enable Register */ 240/* SMI Control and Enable Register */
241#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 241#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30
242 242
243#define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */ 243#define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */
244#define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */ 244#define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */
245#define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ 245#define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */
246#define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ 246#define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */
247#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ 247#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */
248#define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ 248#define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */
249#define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ 249#define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */
250#define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ 250#define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */
251#define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */ 251#define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */
@@ -338,7 +338,6 @@ static int iTCO_wdt_unset_NO_REBOOT_bit(void)
338static int iTCO_wdt_start(void) 338static int iTCO_wdt_start(void)
339{ 339{
340 unsigned int val; 340 unsigned int val;
341 unsigned long val32;
342 341
343 spin_lock(&iTCO_wdt_private.io_lock); 342 spin_lock(&iTCO_wdt_private.io_lock);
344 343
@@ -351,11 +350,6 @@ static int iTCO_wdt_start(void)
351 return -EIO; 350 return -EIO;
352 } 351 }
353 352
354 /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
355 val32 = inl(SMI_EN);
356 val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */
357 outl(val32, SMI_EN);
358
359 /* Force the timer to its reload value by writing to the TCO_RLD 353 /* Force the timer to its reload value by writing to the TCO_RLD
360 register */ 354 register */
361 if (iTCO_wdt_private.iTCO_version == 2) 355 if (iTCO_wdt_private.iTCO_version == 2)
@@ -378,7 +372,6 @@ static int iTCO_wdt_start(void)
378static int iTCO_wdt_stop(void) 372static int iTCO_wdt_stop(void)
379{ 373{
380 unsigned int val; 374 unsigned int val;
381 unsigned long val32;
382 375
383 spin_lock(&iTCO_wdt_private.io_lock); 376 spin_lock(&iTCO_wdt_private.io_lock);
384 377
@@ -390,11 +383,6 @@ static int iTCO_wdt_stop(void)
390 outw(val, TCO1_CNT); 383 outw(val, TCO1_CNT);
391 val = inw(TCO1_CNT); 384 val = inw(TCO1_CNT);
392 385
393 /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */
394 val32 = inl(SMI_EN);
395 val32 |= 0x00002000;
396 outl(val32, SMI_EN);
397
398 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ 386 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */
399 iTCO_wdt_set_NO_REBOOT_bit(); 387 iTCO_wdt_set_NO_REBOOT_bit();
400 388
@@ -649,6 +637,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
649 int ret; 637 int ret;
650 u32 base_address; 638 u32 base_address;
651 unsigned long RCBA; 639 unsigned long RCBA;
640 unsigned long val32;
652 641
653 /* 642 /*
654 * Find the ACPI/PM base I/O address which is the base 643 * Find the ACPI/PM base I/O address which is the base
@@ -695,6 +684,10 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
695 ret = -EIO; 684 ret = -EIO;
696 goto out; 685 goto out;
697 } 686 }
687 /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
688 val32 = inl(SMI_EN);
689 val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */
690 outl(val32, SMI_EN);
698 691
699 /* The TCO I/O registers reside in a 32-byte range pointed to 692 /* The TCO I/O registers reside in a 32-byte range pointed to
700 by the TCOBASE value */ 693 by the TCOBASE value */
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index 0b798fdaa378..74c92d384112 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -21,6 +21,7 @@
21#include <linux/watchdog.h> 21#include <linux/watchdog.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/uaccess.h> 23#include <linux/uaccess.h>
24#include <mach/timex.h>
24#include <mach/regs-timer.h> 25#include <mach/regs-timer.h>
25 26
26#define WDT_DEFAULT_TIME 5 /* seconds */ 27#define WDT_DEFAULT_TIME 5 /* seconds */
diff --git a/drivers/watchdog/orion5x_wdt.c b/drivers/watchdog/orion5x_wdt.c
index 14a339f58b6a..b64ae1a17832 100644
--- a/drivers/watchdog/orion5x_wdt.c
+++ b/drivers/watchdog/orion5x_wdt.c
@@ -29,6 +29,7 @@
29#define WDT_EN 0x0010 29#define WDT_EN 0x0010
30#define WDT_VAL (TIMER_VIRT_BASE + 0x0024) 30#define WDT_VAL (TIMER_VIRT_BASE + 0x0024)
31 31
32#define ORION5X_TCLK 166666667
32#define WDT_MAX_DURATION (0xffffffff / ORION5X_TCLK) 33#define WDT_MAX_DURATION (0xffffffff / ORION5X_TCLK)
33#define WDT_IN_USE 0 34#define WDT_IN_USE 0
34#define WDT_OK_TO_CLOSE 1 35#define WDT_OK_TO_CLOSE 1
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index 57027f4653ce..f3553fa40b17 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -34,104 +34,89 @@
34#include <asm/time.h> 34#include <asm/time.h>
35#include <asm/mach-rc32434/integ.h> 35#include <asm/mach-rc32434/integ.h>
36 36
37#define MAX_TIMEOUT 20 37#define VERSION "0.4"
38#define RC32434_WDT_INTERVAL (15 * HZ)
39
40#define VERSION "0.2"
41 38
42static struct { 39static struct {
43 struct completion stop;
44 int running;
45 struct timer_list timer;
46 int queue;
47 int default_ticks;
48 unsigned long inuse; 40 unsigned long inuse;
49} rc32434_wdt_device; 41} rc32434_wdt_device;
50 42
51static struct integ __iomem *wdt_reg; 43static struct integ __iomem *wdt_reg;
52static int ticks = 100 * HZ;
53 44
54static int expect_close; 45static int expect_close;
55static int timeout; 46
47/* Board internal clock speed in Hz,
48 * the watchdog timer ticks at. */
49extern unsigned int idt_cpu_freq;
50
51/* translate wtcompare value to seconds and vice versa */
52#define WTCOMP2SEC(x) (x / idt_cpu_freq)
53#define SEC2WTCOMP(x) (x * idt_cpu_freq)
54
55/* Use a default timeout of 20s. This should be
56 * safe for CPU clock speeds up to 400MHz, as
57 * ((2 ^ 32) - 1) / (400MHz / 2) = 21s. */
58#define WATCHDOG_TIMEOUT 20
59
60static int timeout = WATCHDOG_TIMEOUT;
56 61
57static int nowayout = WATCHDOG_NOWAYOUT; 62static int nowayout = WATCHDOG_NOWAYOUT;
58module_param(nowayout, int, 0); 63module_param(nowayout, int, 0);
59MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" 64MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
60 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 65 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
61 66
67/* apply or and nand masks to data read from addr and write back */
68#define SET_BITS(addr, or, nand) \
69 writel((readl(&addr) | or) & ~nand, &addr)
62 70
63static void rc32434_wdt_start(void) 71static void rc32434_wdt_start(void)
64{ 72{
65 u32 val; 73 u32 or, nand;
66
67 if (!rc32434_wdt_device.inuse) {
68 writel(0, &wdt_reg->wtcount);
69 74
70 val = RC32434_ERR_WRE; 75 /* zero the counter before enabling */
71 writel(readl(&wdt_reg->errcs) | val, &wdt_reg->errcs); 76 writel(0, &wdt_reg->wtcount);
72 77
73 val = RC32434_WTC_EN; 78 /* don't generate a non-maskable interrupt,
74 writel(readl(&wdt_reg->wtc) | val, &wdt_reg->wtc); 79 * do a warm reset instead */
75 } 80 nand = 1 << RC32434_ERR_WNE;
76 rc32434_wdt_device.running++; 81 or = 1 << RC32434_ERR_WRE;
77}
78 82
79static void rc32434_wdt_stop(void) 83 /* reset the ERRCS timeout bit in case it's set */
80{ 84 nand |= 1 << RC32434_ERR_WTO;
81 u32 val;
82 85
83 if (rc32434_wdt_device.running) { 86 SET_BITS(wdt_reg->errcs, or, nand);
84 87
85 val = ~RC32434_WTC_EN; 88 /* reset WTC timeout bit and enable WDT */
86 writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc); 89 nand = 1 << RC32434_WTC_TO;
90 or = 1 << RC32434_WTC_EN;
87 91
88 val = ~RC32434_ERR_WRE; 92 SET_BITS(wdt_reg->wtc, or, nand);
89 writel(readl(&wdt_reg->errcs) & val, &wdt_reg->errcs); 93}
90 94
91 rc32434_wdt_device.running = 0; 95static void rc32434_wdt_stop(void)
92 } 96{
97 /* Disable WDT */
98 SET_BITS(wdt_reg->wtc, 0, 1 << RC32434_WTC_EN);
93} 99}
94 100
95static void rc32434_wdt_set(int new_timeout) 101static int rc32434_wdt_set(int new_timeout)
96{ 102{
97 u32 cmp = new_timeout * HZ; 103 int max_to = WTCOMP2SEC((u32)-1);
98 u32 state, val;
99 104
105 if (new_timeout < 0 || new_timeout > max_to) {
106 printk(KERN_ERR KBUILD_MODNAME
107 ": timeout value must be between 0 and %d",
108 max_to);
109 return -EINVAL;
110 }
100 timeout = new_timeout; 111 timeout = new_timeout;
101 /* 112 writel(SEC2WTCOMP(timeout), &wdt_reg->wtcompare);
102 * store and disable WTC
103 */
104 state = (u32)(readl(&wdt_reg->wtc) & RC32434_WTC_EN);
105 val = ~RC32434_WTC_EN;
106 writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc);
107
108 writel(0, &wdt_reg->wtcount);
109 writel(cmp, &wdt_reg->wtcompare);
110
111 /*
112 * restore WTC
113 */
114
115 writel(readl(&wdt_reg->wtc) | state, &wdt_reg);
116}
117 113
118static void rc32434_wdt_reset(void) 114 return 0;
119{
120 ticks = rc32434_wdt_device.default_ticks;
121} 115}
122 116
123static void rc32434_wdt_update(unsigned long unused) 117static void rc32434_wdt_ping(void)
124{ 118{
125 if (rc32434_wdt_device.running)
126 ticks--;
127
128 writel(0, &wdt_reg->wtcount); 119 writel(0, &wdt_reg->wtcount);
129
130 if (rc32434_wdt_device.queue && ticks)
131 mod_timer(&rc32434_wdt_device.timer,
132 jiffies + RC32434_WDT_INTERVAL);
133 else
134 complete(&rc32434_wdt_device.stop);
135} 120}
136 121
137static int rc32434_wdt_open(struct inode *inode, struct file *file) 122static int rc32434_wdt_open(struct inode *inode, struct file *file)
@@ -142,19 +127,23 @@ static int rc32434_wdt_open(struct inode *inode, struct file *file)
142 if (nowayout) 127 if (nowayout)
143 __module_get(THIS_MODULE); 128 __module_get(THIS_MODULE);
144 129
130 rc32434_wdt_start();
131 rc32434_wdt_ping();
132
145 return nonseekable_open(inode, file); 133 return nonseekable_open(inode, file);
146} 134}
147 135
148static int rc32434_wdt_release(struct inode *inode, struct file *file) 136static int rc32434_wdt_release(struct inode *inode, struct file *file)
149{ 137{
150 if (expect_close && nowayout == 0) { 138 if (expect_close == 42) {
151 rc32434_wdt_stop(); 139 rc32434_wdt_stop();
152 printk(KERN_INFO KBUILD_MODNAME ": disabling watchdog timer\n"); 140 printk(KERN_INFO KBUILD_MODNAME ": disabling watchdog timer\n");
153 module_put(THIS_MODULE); 141 module_put(THIS_MODULE);
154 } else 142 } else {
155 printk(KERN_CRIT KBUILD_MODNAME 143 printk(KERN_CRIT KBUILD_MODNAME
156 ": device closed unexpectedly. WDT will not stop !\n"); 144 ": device closed unexpectedly. WDT will not stop !\n");
157 145 rc32434_wdt_ping();
146 }
158 clear_bit(0, &rc32434_wdt_device.inuse); 147 clear_bit(0, &rc32434_wdt_device.inuse);
159 return 0; 148 return 0;
160} 149}
@@ -174,10 +163,10 @@ static ssize_t rc32434_wdt_write(struct file *file, const char *data,
174 if (get_user(c, data + i)) 163 if (get_user(c, data + i))
175 return -EFAULT; 164 return -EFAULT;
176 if (c == 'V') 165 if (c == 'V')
177 expect_close = 1; 166 expect_close = 42;
178 } 167 }
179 } 168 }
180 rc32434_wdt_update(0); 169 rc32434_wdt_ping();
181 return len; 170 return len;
182 } 171 }
183 return 0; 172 return 0;
@@ -197,11 +186,11 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
197 }; 186 };
198 switch (cmd) { 187 switch (cmd) {
199 case WDIOC_KEEPALIVE: 188 case WDIOC_KEEPALIVE:
200 rc32434_wdt_reset(); 189 rc32434_wdt_ping();
201 break; 190 break;
202 case WDIOC_GETSTATUS: 191 case WDIOC_GETSTATUS:
203 case WDIOC_GETBOOTSTATUS: 192 case WDIOC_GETBOOTSTATUS:
204 value = readl(&wdt_reg->wtcount); 193 value = 0;
205 if (copy_to_user(argp, &value, sizeof(int))) 194 if (copy_to_user(argp, &value, sizeof(int)))
206 return -EFAULT; 195 return -EFAULT;
207 break; 196 break;
@@ -218,6 +207,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
218 break; 207 break;
219 case WDIOS_DISABLECARD: 208 case WDIOS_DISABLECARD:
220 rc32434_wdt_stop(); 209 rc32434_wdt_stop();
210 break;
221 default: 211 default:
222 return -EINVAL; 212 return -EINVAL;
223 } 213 }
@@ -225,11 +215,9 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
225 case WDIOC_SETTIMEOUT: 215 case WDIOC_SETTIMEOUT:
226 if (copy_from_user(&new_timeout, argp, sizeof(int))) 216 if (copy_from_user(&new_timeout, argp, sizeof(int)))
227 return -EFAULT; 217 return -EFAULT;
228 if (new_timeout < 1) 218 if (rc32434_wdt_set(new_timeout))
229 return -EINVAL; 219 return -EINVAL;
230 if (new_timeout > MAX_TIMEOUT) 220 /* Fall through */
231 return -EINVAL;
232 rc32434_wdt_set(new_timeout);
233 case WDIOC_GETTIMEOUT: 221 case WDIOC_GETTIMEOUT:
234 return copy_to_user(argp, &timeout, sizeof(int)); 222 return copy_to_user(argp, &timeout, sizeof(int));
235 default: 223 default:
@@ -254,15 +242,15 @@ static struct miscdevice rc32434_wdt_miscdev = {
254 .fops = &rc32434_wdt_fops, 242 .fops = &rc32434_wdt_fops,
255}; 243};
256 244
257static char banner[] = KERN_INFO KBUILD_MODNAME 245static char banner[] __devinitdata = KERN_INFO KBUILD_MODNAME
258 ": Watchdog Timer version " VERSION ", timer margin: %d sec\n"; 246 ": Watchdog Timer version " VERSION ", timer margin: %d sec\n";
259 247
260static int rc32434_wdt_probe(struct platform_device *pdev) 248static int __devinit rc32434_wdt_probe(struct platform_device *pdev)
261{ 249{
262 int ret; 250 int ret;
263 struct resource *r; 251 struct resource *r;
264 252
265 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb500_wdt_res"); 253 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb532_wdt_res");
266 if (!r) { 254 if (!r) {
267 printk(KERN_ERR KBUILD_MODNAME 255 printk(KERN_ERR KBUILD_MODNAME
268 "failed to retrieve resources\n"); 256 "failed to retrieve resources\n");
@@ -277,24 +265,12 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
277 } 265 }
278 266
279 ret = misc_register(&rc32434_wdt_miscdev); 267 ret = misc_register(&rc32434_wdt_miscdev);
280
281 if (ret < 0) { 268 if (ret < 0) {
282 printk(KERN_ERR KBUILD_MODNAME 269 printk(KERN_ERR KBUILD_MODNAME
283 "failed to register watchdog device\n"); 270 "failed to register watchdog device\n");
284 goto unmap; 271 goto unmap;
285 } 272 }
286 273
287 init_completion(&rc32434_wdt_device.stop);
288 rc32434_wdt_device.queue = 0;
289
290 clear_bit(0, &rc32434_wdt_device.inuse);
291
292 setup_timer(&rc32434_wdt_device.timer, rc32434_wdt_update, 0L);
293
294 rc32434_wdt_device.default_ticks = ticks;
295
296 rc32434_wdt_start();
297
298 printk(banner, timeout); 274 printk(banner, timeout);
299 275
300 return 0; 276 return 0;
@@ -304,23 +280,17 @@ unmap:
304 return ret; 280 return ret;
305} 281}
306 282
307static int rc32434_wdt_remove(struct platform_device *pdev) 283static int __devexit rc32434_wdt_remove(struct platform_device *pdev)
308{ 284{
309 if (rc32434_wdt_device.queue) {
310 rc32434_wdt_device.queue = 0;
311 wait_for_completion(&rc32434_wdt_device.stop);
312 }
313 misc_deregister(&rc32434_wdt_miscdev); 285 misc_deregister(&rc32434_wdt_miscdev);
314
315 iounmap(wdt_reg); 286 iounmap(wdt_reg);
316
317 return 0; 287 return 0;
318} 288}
319 289
320static struct platform_driver rc32434_wdt = { 290static struct platform_driver rc32434_wdt = {
321 .probe = rc32434_wdt_probe, 291 .probe = rc32434_wdt_probe,
322 .remove = rc32434_wdt_remove, 292 .remove = __devexit_p(rc32434_wdt_remove),
323 .driver = { 293 .driver = {
324 .name = "rc32434_wdt", 294 .name = "rc32434_wdt",
325 } 295 }
326}; 296};
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 9b91617b9582..56892a142ee2 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -45,6 +45,13 @@ static int xen_suspend(void *data)
45 err); 45 err);
46 return err; 46 return err;
47 } 47 }
48 err = sysdev_suspend(PMSG_SUSPEND);
49 if (err) {
50 printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
51 err);
52 device_power_up(PMSG_RESUME);
53 return err;
54 }
48 55
49 xen_mm_pin_all(); 56 xen_mm_pin_all();
50 gnttab_suspend(); 57 gnttab_suspend();
@@ -61,6 +68,7 @@ static int xen_suspend(void *data)
61 gnttab_resume(); 68 gnttab_resume();
62 xen_mm_unpin_all(); 69 xen_mm_unpin_all();
63 70
71 sysdev_resume();
64 device_power_up(PMSG_RESUME); 72 device_power_up(PMSG_RESUME);
65 73
66 if (!*cancelled) { 74 if (!*cancelled) {
diff --git a/fs/Makefile b/fs/Makefile
index 38bc735c67ad..dc20db348679 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -69,10 +69,12 @@ obj-$(CONFIG_DLM) += dlm/
69# Do not add any filesystems before this line 69# Do not add any filesystems before this line
70obj-$(CONFIG_REISERFS_FS) += reiserfs/ 70obj-$(CONFIG_REISERFS_FS) += reiserfs/
71obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3 71obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3
72obj-$(CONFIG_EXT4_FS) += ext4/ # Before ext2 so root fs can be ext4 72obj-$(CONFIG_EXT2_FS) += ext2/
73# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext2
74# unless explicitly requested by rootfstype
75obj-$(CONFIG_EXT4_FS) += ext4/
73obj-$(CONFIG_JBD) += jbd/ 76obj-$(CONFIG_JBD) += jbd/
74obj-$(CONFIG_JBD2) += jbd2/ 77obj-$(CONFIG_JBD2) += jbd2/
75obj-$(CONFIG_EXT2_FS) += ext2/
76obj-$(CONFIG_CRAMFS) += cramfs/ 78obj-$(CONFIG_CRAMFS) += cramfs/
77obj-$(CONFIG_SQUASHFS) += squashfs/ 79obj-$(CONFIG_SQUASHFS) += squashfs/
78obj-y += ramfs/ 80obj-y += ramfs/
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 549b0144da11..fe2b1aa2464e 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -685,19 +685,20 @@ EXPORT_SYMBOL(bio_integrity_split);
685 * bio_integrity_clone - Callback for cloning bios with integrity metadata 685 * bio_integrity_clone - Callback for cloning bios with integrity metadata
686 * @bio: New bio 686 * @bio: New bio
687 * @bio_src: Original bio 687 * @bio_src: Original bio
688 * @gfp_mask: Memory allocation mask
688 * @bs: bio_set to allocate bip from 689 * @bs: bio_set to allocate bip from
689 * 690 *
690 * Description: Called to allocate a bip when cloning a bio 691 * Description: Called to allocate a bip when cloning a bio
691 */ 692 */
692int bio_integrity_clone(struct bio *bio, struct bio *bio_src, 693int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
693 struct bio_set *bs) 694 gfp_t gfp_mask, struct bio_set *bs)
694{ 695{
695 struct bio_integrity_payload *bip_src = bio_src->bi_integrity; 696 struct bio_integrity_payload *bip_src = bio_src->bi_integrity;
696 struct bio_integrity_payload *bip; 697 struct bio_integrity_payload *bip;
697 698
698 BUG_ON(bip_src == NULL); 699 BUG_ON(bip_src == NULL);
699 700
700 bip = bio_integrity_alloc_bioset(bio, GFP_NOIO, bip_src->bip_vcnt, bs); 701 bip = bio_integrity_alloc_bioset(bio, gfp_mask, bip_src->bip_vcnt, bs);
701 702
702 if (bip == NULL) 703 if (bip == NULL)
703 return -EIO; 704 return -EIO;
diff --git a/fs/bio.c b/fs/bio.c
index 062299acbccd..d4f06327c810 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -302,9 +302,10 @@ void bio_init(struct bio *bio)
302struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) 302struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
303{ 303{
304 struct bio *bio = NULL; 304 struct bio *bio = NULL;
305 void *uninitialized_var(p);
305 306
306 if (bs) { 307 if (bs) {
307 void *p = mempool_alloc(bs->bio_pool, gfp_mask); 308 p = mempool_alloc(bs->bio_pool, gfp_mask);
308 309
309 if (p) 310 if (p)
310 bio = p + bs->front_pad; 311 bio = p + bs->front_pad;
@@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
329 } 330 }
330 if (unlikely(!bvl)) { 331 if (unlikely(!bvl)) {
331 if (bs) 332 if (bs)
332 mempool_free(bio, bs->bio_pool); 333 mempool_free(p, bs->bio_pool);
333 else 334 else
334 kfree(bio); 335 kfree(bio);
335 bio = NULL; 336 bio = NULL;
@@ -462,10 +463,12 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
462 if (bio_integrity(bio)) { 463 if (bio_integrity(bio)) {
463 int ret; 464 int ret;
464 465
465 ret = bio_integrity_clone(b, bio, fs_bio_set); 466 ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set);
466 467
467 if (ret < 0) 468 if (ret < 0) {
469 bio_put(b);
468 return NULL; 470 return NULL;
471 }
469 } 472 }
470 473
471 return b; 474 return b;
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index a8c9693b75ac..72677ce2b74f 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -66,6 +66,9 @@ struct btrfs_inode {
66 */ 66 */
67 struct list_head delalloc_inodes; 67 struct list_head delalloc_inodes;
68 68
69 /* the space_info for where this inode's data allocations are done */
70 struct btrfs_space_info *space_info;
71
69 /* full 64 bit generation number, struct vfs_inode doesn't have a big 72 /* full 64 bit generation number, struct vfs_inode doesn't have a big
70 * enough field for this. 73 * enough field for this.
71 */ 74 */
@@ -94,6 +97,11 @@ struct btrfs_inode {
94 */ 97 */
95 u64 delalloc_bytes; 98 u64 delalloc_bytes;
96 99
100 /* total number of bytes that may be used for this inode for
101 * delalloc
102 */
103 u64 reserved_bytes;
104
97 /* 105 /*
98 * the size of the file stored in the metadata on disk. data=ordered 106 * the size of the file stored in the metadata on disk. data=ordered
99 * means the in-memory i_size might be larger than the size on disk 107 * means the in-memory i_size might be larger than the size on disk
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 35443cc4b9a9..37f31b5529aa 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -38,19 +38,12 @@ static int balance_node_right(struct btrfs_trans_handle *trans,
38static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, 38static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
39 struct btrfs_path *path, int level, int slot); 39 struct btrfs_path *path, int level, int slot);
40 40
41inline void btrfs_init_path(struct btrfs_path *p)
42{
43 memset(p, 0, sizeof(*p));
44}
45
46struct btrfs_path *btrfs_alloc_path(void) 41struct btrfs_path *btrfs_alloc_path(void)
47{ 42{
48 struct btrfs_path *path; 43 struct btrfs_path *path;
49 path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS); 44 path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);
50 if (path) { 45 if (path)
51 btrfs_init_path(path);
52 path->reada = 1; 46 path->reada = 1;
53 }
54 return path; 47 return path;
55} 48}
56 49
@@ -69,14 +62,38 @@ noinline void btrfs_set_path_blocking(struct btrfs_path *p)
69 62
70/* 63/*
71 * reset all the locked nodes in the patch to spinning locks. 64 * reset all the locked nodes in the patch to spinning locks.
65 *
66 * held is used to keep lockdep happy, when lockdep is enabled
67 * we set held to a blocking lock before we go around and
68 * retake all the spinlocks in the path. You can safely use NULL
69 * for held
72 */ 70 */
73noinline void btrfs_clear_path_blocking(struct btrfs_path *p) 71noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
72 struct extent_buffer *held)
74{ 73{
75 int i; 74 int i;
76 for (i = 0; i < BTRFS_MAX_LEVEL; i++) { 75
76#ifdef CONFIG_DEBUG_LOCK_ALLOC
77 /* lockdep really cares that we take all of these spinlocks
78 * in the right order. If any of the locks in the path are not
79 * currently blocking, it is going to complain. So, make really
80 * really sure by forcing the path to blocking before we clear
81 * the path blocking.
82 */
83 if (held)
84 btrfs_set_lock_blocking(held);
85 btrfs_set_path_blocking(p);
86#endif
87
88 for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) {
77 if (p->nodes[i] && p->locks[i]) 89 if (p->nodes[i] && p->locks[i])
78 btrfs_clear_lock_blocking(p->nodes[i]); 90 btrfs_clear_lock_blocking(p->nodes[i]);
79 } 91 }
92
93#ifdef CONFIG_DEBUG_LOCK_ALLOC
94 if (held)
95 btrfs_clear_lock_blocking(held);
96#endif
80} 97}
81 98
82/* this also releases the path */ 99/* this also releases the path */
@@ -260,7 +277,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
260 if (*cow_ret == buf) 277 if (*cow_ret == buf)
261 unlock_orig = 1; 278 unlock_orig = 1;
262 279
263 WARN_ON(!btrfs_tree_locked(buf)); 280 btrfs_assert_tree_locked(buf);
264 281
265 if (parent) 282 if (parent)
266 parent_start = parent->start; 283 parent_start = parent->start;
@@ -286,7 +303,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
286 trans->transid, level, &ins); 303 trans->transid, level, &ins);
287 BUG_ON(ret); 304 BUG_ON(ret);
288 cow = btrfs_init_new_buffer(trans, root, prealloc_dest, 305 cow = btrfs_init_new_buffer(trans, root, prealloc_dest,
289 buf->len); 306 buf->len, level);
290 } else { 307 } else {
291 cow = btrfs_alloc_free_block(trans, root, buf->len, 308 cow = btrfs_alloc_free_block(trans, root, buf->len,
292 parent_start, 309 parent_start,
@@ -917,9 +934,9 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
917 934
918 /* promote the child to a root */ 935 /* promote the child to a root */
919 child = read_node_slot(root, mid, 0); 936 child = read_node_slot(root, mid, 0);
937 BUG_ON(!child);
920 btrfs_tree_lock(child); 938 btrfs_tree_lock(child);
921 btrfs_set_lock_blocking(child); 939 btrfs_set_lock_blocking(child);
922 BUG_ON(!child);
923 ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); 940 ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);
924 BUG_ON(ret); 941 BUG_ON(ret);
925 942
@@ -1566,7 +1583,7 @@ cow_done:
1566 if (!p->skip_locking) 1583 if (!p->skip_locking)
1567 p->locks[level] = 1; 1584 p->locks[level] = 1;
1568 1585
1569 btrfs_clear_path_blocking(p); 1586 btrfs_clear_path_blocking(p, NULL);
1570 1587
1571 /* 1588 /*
1572 * we have a lock on b and as long as we aren't changing 1589 * we have a lock on b and as long as we aren't changing
@@ -1605,7 +1622,7 @@ cow_done:
1605 1622
1606 btrfs_set_path_blocking(p); 1623 btrfs_set_path_blocking(p);
1607 sret = split_node(trans, root, p, level); 1624 sret = split_node(trans, root, p, level);
1608 btrfs_clear_path_blocking(p); 1625 btrfs_clear_path_blocking(p, NULL);
1609 1626
1610 BUG_ON(sret > 0); 1627 BUG_ON(sret > 0);
1611 if (sret) { 1628 if (sret) {
@@ -1625,7 +1642,7 @@ cow_done:
1625 1642
1626 btrfs_set_path_blocking(p); 1643 btrfs_set_path_blocking(p);
1627 sret = balance_level(trans, root, p, level); 1644 sret = balance_level(trans, root, p, level);
1628 btrfs_clear_path_blocking(p); 1645 btrfs_clear_path_blocking(p, NULL);
1629 1646
1630 if (sret) { 1647 if (sret) {
1631 ret = sret; 1648 ret = sret;
@@ -1688,13 +1705,13 @@ cow_done:
1688 if (!p->skip_locking) { 1705 if (!p->skip_locking) {
1689 int lret; 1706 int lret;
1690 1707
1691 btrfs_clear_path_blocking(p); 1708 btrfs_clear_path_blocking(p, NULL);
1692 lret = btrfs_try_spin_lock(b); 1709 lret = btrfs_try_spin_lock(b);
1693 1710
1694 if (!lret) { 1711 if (!lret) {
1695 btrfs_set_path_blocking(p); 1712 btrfs_set_path_blocking(p);
1696 btrfs_tree_lock(b); 1713 btrfs_tree_lock(b);
1697 btrfs_clear_path_blocking(p); 1714 btrfs_clear_path_blocking(p, b);
1698 } 1715 }
1699 } 1716 }
1700 } else { 1717 } else {
@@ -1706,7 +1723,7 @@ cow_done:
1706 btrfs_set_path_blocking(p); 1723 btrfs_set_path_blocking(p);
1707 sret = split_leaf(trans, root, key, 1724 sret = split_leaf(trans, root, key,
1708 p, ins_len, ret == 0); 1725 p, ins_len, ret == 0);
1709 btrfs_clear_path_blocking(p); 1726 btrfs_clear_path_blocking(p, NULL);
1710 1727
1711 BUG_ON(sret > 0); 1728 BUG_ON(sret > 0);
1712 if (sret) { 1729 if (sret) {
@@ -2348,7 +2365,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
2348 if (slot >= btrfs_header_nritems(upper) - 1) 2365 if (slot >= btrfs_header_nritems(upper) - 1)
2349 return 1; 2366 return 1;
2350 2367
2351 WARN_ON(!btrfs_tree_locked(path->nodes[1])); 2368 btrfs_assert_tree_locked(path->nodes[1]);
2352 2369
2353 right = read_node_slot(root, upper, slot + 1); 2370 right = read_node_slot(root, upper, slot + 1);
2354 btrfs_tree_lock(right); 2371 btrfs_tree_lock(right);
@@ -2545,7 +2562,7 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
2545 if (right_nritems == 0) 2562 if (right_nritems == 0)
2546 return 1; 2563 return 1;
2547 2564
2548 WARN_ON(!btrfs_tree_locked(path->nodes[1])); 2565 btrfs_assert_tree_locked(path->nodes[1]);
2549 2566
2550 left = read_node_slot(root, path->nodes[1], slot - 1); 2567 left = read_node_slot(root, path->nodes[1], slot - 1);
2551 btrfs_tree_lock(left); 2568 btrfs_tree_lock(left);
@@ -3926,7 +3943,6 @@ find_next_key:
3926 btrfs_release_path(root, path); 3943 btrfs_release_path(root, path);
3927 goto again; 3944 goto again;
3928 } else { 3945 } else {
3929 btrfs_clear_path_blocking(path);
3930 goto out; 3946 goto out;
3931 } 3947 }
3932 } 3948 }
@@ -3946,7 +3962,7 @@ find_next_key:
3946 path->locks[level - 1] = 1; 3962 path->locks[level - 1] = 1;
3947 path->nodes[level - 1] = cur; 3963 path->nodes[level - 1] = cur;
3948 unlock_up(path, level, 1); 3964 unlock_up(path, level, 1);
3949 btrfs_clear_path_blocking(path); 3965 btrfs_clear_path_blocking(path, NULL);
3950 } 3966 }
3951out: 3967out:
3952 if (ret == 0) 3968 if (ret == 0)
@@ -4085,7 +4101,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
4085 4101
4086 next = read_node_slot(root, c, slot); 4102 next = read_node_slot(root, c, slot);
4087 if (!path->skip_locking) { 4103 if (!path->skip_locking) {
4088 WARN_ON(!btrfs_tree_locked(c)); 4104 btrfs_assert_tree_locked(c);
4089 btrfs_tree_lock(next); 4105 btrfs_tree_lock(next);
4090 btrfs_set_lock_blocking(next); 4106 btrfs_set_lock_blocking(next);
4091 } 4107 }
@@ -4110,7 +4126,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
4110 reada_for_search(root, path, level, slot, 0); 4126 reada_for_search(root, path, level, slot, 0);
4111 next = read_node_slot(root, next, 0); 4127 next = read_node_slot(root, next, 0);
4112 if (!path->skip_locking) { 4128 if (!path->skip_locking) {
4113 WARN_ON(!btrfs_tree_locked(path->nodes[level])); 4129 btrfs_assert_tree_locked(path->nodes[level]);
4114 btrfs_tree_lock(next); 4130 btrfs_tree_lock(next);
4115 btrfs_set_lock_blocking(next); 4131 btrfs_set_lock_blocking(next);
4116 } 4132 }
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 531db112c8bd..82491ba8fa40 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -43,11 +43,7 @@ struct btrfs_ordered_sum;
43 43
44#define BTRFS_ACL_NOT_CACHED ((void *)-1) 44#define BTRFS_ACL_NOT_CACHED ((void *)-1)
45 45
46#ifdef CONFIG_LOCKDEP 46#define BTRFS_MAX_LEVEL 8
47# define BTRFS_MAX_LEVEL 7
48#else
49# define BTRFS_MAX_LEVEL 8
50#endif
51 47
52/* holds pointers to all of the tree roots */ 48/* holds pointers to all of the tree roots */
53#define BTRFS_ROOT_TREE_OBJECTID 1ULL 49#define BTRFS_ROOT_TREE_OBJECTID 1ULL
@@ -600,13 +596,27 @@ struct btrfs_block_group_item {
600 596
601struct btrfs_space_info { 597struct btrfs_space_info {
602 u64 flags; 598 u64 flags;
603 u64 total_bytes; 599
604 u64 bytes_used; 600 u64 total_bytes; /* total bytes in the space */
605 u64 bytes_pinned; 601 u64 bytes_used; /* total bytes used on disk */
606 u64 bytes_reserved; 602 u64 bytes_pinned; /* total bytes pinned, will be freed when the
607 u64 bytes_readonly; 603 transaction finishes */
608 int full; 604 u64 bytes_reserved; /* total bytes the allocator has reserved for
609 int force_alloc; 605 current allocations */
606 u64 bytes_readonly; /* total bytes that are read only */
607
608 /* delalloc accounting */
609 u64 bytes_delalloc; /* number of bytes reserved for allocation,
610 this space is not necessarily reserved yet
611 by the allocator */
612 u64 bytes_may_use; /* number of bytes that may be used for
613 delalloc */
614
615 int full; /* indicates that we cannot allocate any more
616 chunks for this space */
617 int force_alloc; /* set if we need to force a chunk alloc for
618 this space */
619
610 struct list_head list; 620 struct list_head list;
611 621
612 /* for block groups in our same type */ 622 /* for block groups in our same type */
@@ -1715,7 +1725,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
1715 u64 empty_size); 1725 u64 empty_size);
1716struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 1726struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
1717 struct btrfs_root *root, 1727 struct btrfs_root *root,
1718 u64 bytenr, u32 blocksize); 1728 u64 bytenr, u32 blocksize,
1729 int level);
1719int btrfs_alloc_extent(struct btrfs_trans_handle *trans, 1730int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
1720 struct btrfs_root *root, 1731 struct btrfs_root *root,
1721 u64 num_bytes, u64 parent, u64 min_bytes, 1732 u64 num_bytes, u64 parent, u64 min_bytes,
@@ -1785,6 +1796,16 @@ int btrfs_add_dead_reloc_root(struct btrfs_root *root);
1785int btrfs_cleanup_reloc_trees(struct btrfs_root *root); 1796int btrfs_cleanup_reloc_trees(struct btrfs_root *root);
1786int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len); 1797int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len);
1787u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags); 1798u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags);
1799void btrfs_set_inode_space_info(struct btrfs_root *root, struct inode *ionde);
1800int btrfs_check_metadata_free_space(struct btrfs_root *root);
1801int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode,
1802 u64 bytes);
1803void btrfs_free_reserved_data_space(struct btrfs_root *root,
1804 struct inode *inode, u64 bytes);
1805void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode,
1806 u64 bytes);
1807void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode,
1808 u64 bytes);
1788/* ctree.c */ 1809/* ctree.c */
1789int btrfs_previous_item(struct btrfs_root *root, 1810int btrfs_previous_item(struct btrfs_root *root,
1790 struct btrfs_path *path, u64 min_objectid, 1811 struct btrfs_path *path, u64 min_objectid,
@@ -1834,9 +1855,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
1834void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); 1855void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
1835struct btrfs_path *btrfs_alloc_path(void); 1856struct btrfs_path *btrfs_alloc_path(void);
1836void btrfs_free_path(struct btrfs_path *p); 1857void btrfs_free_path(struct btrfs_path *p);
1837void btrfs_init_path(struct btrfs_path *p);
1838void btrfs_set_path_blocking(struct btrfs_path *p); 1858void btrfs_set_path_blocking(struct btrfs_path *p);
1839void btrfs_clear_path_blocking(struct btrfs_path *p);
1840void btrfs_unlock_up_safe(struct btrfs_path *p, int level); 1859void btrfs_unlock_up_safe(struct btrfs_path *p, int level);
1841 1860
1842int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, 1861int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
@@ -2032,8 +2051,6 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
2032unsigned long btrfs_force_ra(struct address_space *mapping, 2051unsigned long btrfs_force_ra(struct address_space *mapping,
2033 struct file_ra_state *ra, struct file *file, 2052 struct file_ra_state *ra, struct file *file,
2034 pgoff_t offset, pgoff_t last_index); 2053 pgoff_t offset, pgoff_t last_index);
2035int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
2036 int for_del);
2037int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); 2054int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page);
2038int btrfs_readpage(struct file *file, struct page *page); 2055int btrfs_readpage(struct file *file, struct page *page);
2039void btrfs_delete_inode(struct inode *inode); 2056void btrfs_delete_inode(struct inode *inode);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 5aebddd71193..3e18175248e0 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -75,6 +75,40 @@ struct async_submit_bio {
75 struct btrfs_work work; 75 struct btrfs_work work;
76}; 76};
77 77
78/* These are used to set the lockdep class on the extent buffer locks.
79 * The class is set by the readpage_end_io_hook after the buffer has
80 * passed csum validation but before the pages are unlocked.
81 *
82 * The lockdep class is also set by btrfs_init_new_buffer on freshly
83 * allocated blocks.
84 *
85 * The class is based on the level in the tree block, which allows lockdep
86 * to know that lower nodes nest inside the locks of higher nodes.
87 *
88 * We also add a check to make sure the highest level of the tree is
89 * the same as our lockdep setup here. If BTRFS_MAX_LEVEL changes, this
90 * code needs update as well.
91 */
92#ifdef CONFIG_DEBUG_LOCK_ALLOC
93# if BTRFS_MAX_LEVEL != 8
94# error
95# endif
96static struct lock_class_key btrfs_eb_class[BTRFS_MAX_LEVEL + 1];
97static const char *btrfs_eb_name[BTRFS_MAX_LEVEL + 1] = {
98 /* leaf */
99 "btrfs-extent-00",
100 "btrfs-extent-01",
101 "btrfs-extent-02",
102 "btrfs-extent-03",
103 "btrfs-extent-04",
104 "btrfs-extent-05",
105 "btrfs-extent-06",
106 "btrfs-extent-07",
107 /* highest possible level */
108 "btrfs-extent-08",
109};
110#endif
111
78/* 112/*
79 * extents on the btree inode are pretty simple, there's one extent 113 * extents on the btree inode are pretty simple, there's one extent
80 * that covers the entire device 114 * that covers the entire device
@@ -347,6 +381,15 @@ static int check_tree_block_fsid(struct btrfs_root *root,
347 return ret; 381 return ret;
348} 382}
349 383
384#ifdef CONFIG_DEBUG_LOCK_ALLOC
385void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level)
386{
387 lockdep_set_class_and_name(&eb->lock,
388 &btrfs_eb_class[level],
389 btrfs_eb_name[level]);
390}
391#endif
392
350static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, 393static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
351 struct extent_state *state) 394 struct extent_state *state)
352{ 395{
@@ -392,6 +435,8 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
392 } 435 }
393 found_level = btrfs_header_level(eb); 436 found_level = btrfs_header_level(eb);
394 437
438 btrfs_set_buffer_lockdep_class(eb, found_level);
439
395 ret = csum_tree_block(root, eb, 1); 440 ret = csum_tree_block(root, eb, 1);
396 if (ret) 441 if (ret)
397 ret = -EIO; 442 ret = -EIO;
@@ -812,7 +857,7 @@ int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
812 struct inode *btree_inode = root->fs_info->btree_inode; 857 struct inode *btree_inode = root->fs_info->btree_inode;
813 if (btrfs_header_generation(buf) == 858 if (btrfs_header_generation(buf) ==
814 root->fs_info->running_transaction->transid) { 859 root->fs_info->running_transaction->transid) {
815 WARN_ON(!btrfs_tree_locked(buf)); 860 btrfs_assert_tree_locked(buf);
816 861
817 /* ugh, clear_extent_buffer_dirty can be expensive */ 862 /* ugh, clear_extent_buffer_dirty can be expensive */
818 btrfs_set_lock_blocking(buf); 863 btrfs_set_lock_blocking(buf);
@@ -1777,7 +1822,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1777 ret = find_and_setup_root(tree_root, fs_info, 1822 ret = find_and_setup_root(tree_root, fs_info,
1778 BTRFS_DEV_TREE_OBJECTID, dev_root); 1823 BTRFS_DEV_TREE_OBJECTID, dev_root);
1779 dev_root->track_dirty = 1; 1824 dev_root->track_dirty = 1;
1780
1781 if (ret) 1825 if (ret)
1782 goto fail_extent_root; 1826 goto fail_extent_root;
1783 1827
@@ -2317,7 +2361,7 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
2317 2361
2318 btrfs_set_lock_blocking(buf); 2362 btrfs_set_lock_blocking(buf);
2319 2363
2320 WARN_ON(!btrfs_tree_locked(buf)); 2364 btrfs_assert_tree_locked(buf);
2321 if (transid != root->fs_info->generation) { 2365 if (transid != root->fs_info->generation) {
2322 printk(KERN_CRIT "btrfs transid mismatch buffer %llu, " 2366 printk(KERN_CRIT "btrfs transid mismatch buffer %llu, "
2323 "found %llu running %llu\n", 2367 "found %llu running %llu\n",
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 494a56eb2986..95029db227be 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -101,4 +101,14 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
101int btrfs_add_log_tree(struct btrfs_trans_handle *trans, 101int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
102 struct btrfs_root *root); 102 struct btrfs_root *root);
103int btree_lock_page_hook(struct page *page); 103int btree_lock_page_hook(struct page *page);
104
105
106#ifdef CONFIG_DEBUG_LOCK_ALLOC
107void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level);
108#else
109static inline void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb,
110 int level)
111{
112}
113#endif
104#endif 114#endif
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7527523c2d2d..9abf81f71c46 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -60,6 +60,10 @@ static int update_block_group(struct btrfs_trans_handle *trans,
60 u64 bytenr, u64 num_bytes, int alloc, 60 u64 bytenr, u64 num_bytes, int alloc,
61 int mark_free); 61 int mark_free);
62 62
63static int do_chunk_alloc(struct btrfs_trans_handle *trans,
64 struct btrfs_root *extent_root, u64 alloc_bytes,
65 u64 flags, int force);
66
63static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits) 67static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits)
64{ 68{
65 return (cache->flags & bits) == bits; 69 return (cache->flags & bits) == bits;
@@ -1323,8 +1327,25 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
1323int btrfs_extent_post_op(struct btrfs_trans_handle *trans, 1327int btrfs_extent_post_op(struct btrfs_trans_handle *trans,
1324 struct btrfs_root *root) 1328 struct btrfs_root *root)
1325{ 1329{
1326 finish_current_insert(trans, root->fs_info->extent_root, 1); 1330 u64 start;
1327 del_pending_extents(trans, root->fs_info->extent_root, 1); 1331 u64 end;
1332 int ret;
1333
1334 while(1) {
1335 finish_current_insert(trans, root->fs_info->extent_root, 1);
1336 del_pending_extents(trans, root->fs_info->extent_root, 1);
1337
1338 /* is there more work to do? */
1339 ret = find_first_extent_bit(&root->fs_info->pending_del,
1340 0, &start, &end, EXTENT_WRITEBACK);
1341 if (!ret)
1342 continue;
1343 ret = find_first_extent_bit(&root->fs_info->extent_ins,
1344 0, &start, &end, EXTENT_WRITEBACK);
1345 if (!ret)
1346 continue;
1347 break;
1348 }
1328 return 0; 1349 return 0;
1329} 1350}
1330 1351
@@ -1892,6 +1913,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
1892 found->bytes_pinned = 0; 1913 found->bytes_pinned = 0;
1893 found->bytes_reserved = 0; 1914 found->bytes_reserved = 0;
1894 found->bytes_readonly = 0; 1915 found->bytes_readonly = 0;
1916 found->bytes_delalloc = 0;
1895 found->full = 0; 1917 found->full = 0;
1896 found->force_alloc = 0; 1918 found->force_alloc = 0;
1897 *space_info = found; 1919 *space_info = found;
@@ -1955,6 +1977,233 @@ u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags)
1955 return flags; 1977 return flags;
1956} 1978}
1957 1979
1980static u64 btrfs_get_alloc_profile(struct btrfs_root *root, u64 data)
1981{
1982 struct btrfs_fs_info *info = root->fs_info;
1983 u64 alloc_profile;
1984
1985 if (data) {
1986 alloc_profile = info->avail_data_alloc_bits &
1987 info->data_alloc_profile;
1988 data = BTRFS_BLOCK_GROUP_DATA | alloc_profile;
1989 } else if (root == root->fs_info->chunk_root) {
1990 alloc_profile = info->avail_system_alloc_bits &
1991 info->system_alloc_profile;
1992 data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile;
1993 } else {
1994 alloc_profile = info->avail_metadata_alloc_bits &
1995 info->metadata_alloc_profile;
1996 data = BTRFS_BLOCK_GROUP_METADATA | alloc_profile;
1997 }
1998
1999 return btrfs_reduce_alloc_profile(root, data);
2000}
2001
2002void btrfs_set_inode_space_info(struct btrfs_root *root, struct inode *inode)
2003{
2004 u64 alloc_target;
2005
2006 alloc_target = btrfs_get_alloc_profile(root, 1);
2007 BTRFS_I(inode)->space_info = __find_space_info(root->fs_info,
2008 alloc_target);
2009}
2010
2011/*
2012 * for now this just makes sure we have at least 5% of our metadata space free
2013 * for use.
2014 */
2015int btrfs_check_metadata_free_space(struct btrfs_root *root)
2016{
2017 struct btrfs_fs_info *info = root->fs_info;
2018 struct btrfs_space_info *meta_sinfo;
2019 u64 alloc_target, thresh;
2020 int committed = 0, ret;
2021
2022 /* get the space info for where the metadata will live */
2023 alloc_target = btrfs_get_alloc_profile(root, 0);
2024 meta_sinfo = __find_space_info(info, alloc_target);
2025
2026again:
2027 spin_lock(&meta_sinfo->lock);
2028 if (!meta_sinfo->full)
2029 thresh = meta_sinfo->total_bytes * 80;
2030 else
2031 thresh = meta_sinfo->total_bytes * 95;
2032
2033 do_div(thresh, 100);
2034
2035 if (meta_sinfo->bytes_used + meta_sinfo->bytes_reserved +
2036 meta_sinfo->bytes_pinned + meta_sinfo->bytes_readonly > thresh) {
2037 struct btrfs_trans_handle *trans;
2038 if (!meta_sinfo->full) {
2039 meta_sinfo->force_alloc = 1;
2040 spin_unlock(&meta_sinfo->lock);
2041
2042 trans = btrfs_start_transaction(root, 1);
2043 if (!trans)
2044 return -ENOMEM;
2045
2046 ret = do_chunk_alloc(trans, root->fs_info->extent_root,
2047 2 * 1024 * 1024, alloc_target, 0);
2048 btrfs_end_transaction(trans, root);
2049 goto again;
2050 }
2051 spin_unlock(&meta_sinfo->lock);
2052
2053 if (!committed) {
2054 committed = 1;
2055 trans = btrfs_join_transaction(root, 1);
2056 if (!trans)
2057 return -ENOMEM;
2058 ret = btrfs_commit_transaction(trans, root);
2059 if (ret)
2060 return ret;
2061 goto again;
2062 }
2063 return -ENOSPC;
2064 }
2065 spin_unlock(&meta_sinfo->lock);
2066
2067 return 0;
2068}
2069
2070/*
2071 * This will check the space that the inode allocates from to make sure we have
2072 * enough space for bytes.
2073 */
2074int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode,
2075 u64 bytes)
2076{
2077 struct btrfs_space_info *data_sinfo;
2078 int ret = 0, committed = 0;
2079
2080 /* make sure bytes are sectorsize aligned */
2081 bytes = (bytes + root->sectorsize - 1) & ~((u64)root->sectorsize - 1);
2082
2083 data_sinfo = BTRFS_I(inode)->space_info;
2084again:
2085 /* make sure we have enough space to handle the data first */
2086 spin_lock(&data_sinfo->lock);
2087 if (data_sinfo->total_bytes - data_sinfo->bytes_used -
2088 data_sinfo->bytes_delalloc - data_sinfo->bytes_reserved -
2089 data_sinfo->bytes_pinned - data_sinfo->bytes_readonly -
2090 data_sinfo->bytes_may_use < bytes) {
2091 struct btrfs_trans_handle *trans;
2092
2093 /*
2094 * if we don't have enough free bytes in this space then we need
2095 * to alloc a new chunk.
2096 */
2097 if (!data_sinfo->full) {
2098 u64 alloc_target;
2099
2100 data_sinfo->force_alloc = 1;
2101 spin_unlock(&data_sinfo->lock);
2102
2103 alloc_target = btrfs_get_alloc_profile(root, 1);
2104 trans = btrfs_start_transaction(root, 1);
2105 if (!trans)
2106 return -ENOMEM;
2107
2108 ret = do_chunk_alloc(trans, root->fs_info->extent_root,
2109 bytes + 2 * 1024 * 1024,
2110 alloc_target, 0);
2111 btrfs_end_transaction(trans, root);
2112 if (ret)
2113 return ret;
2114 goto again;
2115 }
2116 spin_unlock(&data_sinfo->lock);
2117
2118 /* commit the current transaction and try again */
2119 if (!committed) {
2120 committed = 1;
2121 trans = btrfs_join_transaction(root, 1);
2122 if (!trans)
2123 return -ENOMEM;
2124 ret = btrfs_commit_transaction(trans, root);
2125 if (ret)
2126 return ret;
2127 goto again;
2128 }
2129
2130 printk(KERN_ERR "no space left, need %llu, %llu delalloc bytes"
2131 ", %llu bytes_used, %llu bytes_reserved, "
2132 "%llu bytes_pinned, %llu bytes_readonly, %llu may use"
2133 "%llu total\n", bytes, data_sinfo->bytes_delalloc,
2134 data_sinfo->bytes_used, data_sinfo->bytes_reserved,
2135 data_sinfo->bytes_pinned, data_sinfo->bytes_readonly,
2136 data_sinfo->bytes_may_use, data_sinfo->total_bytes);
2137 return -ENOSPC;
2138 }
2139 data_sinfo->bytes_may_use += bytes;
2140 BTRFS_I(inode)->reserved_bytes += bytes;
2141 spin_unlock(&data_sinfo->lock);
2142
2143 return btrfs_check_metadata_free_space(root);
2144}
2145
2146/*
2147 * if there was an error for whatever reason after calling
2148 * btrfs_check_data_free_space, call this so we can cleanup the counters.
2149 */
2150void btrfs_free_reserved_data_space(struct btrfs_root *root,
2151 struct inode *inode, u64 bytes)
2152{
2153 struct btrfs_space_info *data_sinfo;
2154
2155 /* make sure bytes are sectorsize aligned */
2156 bytes = (bytes + root->sectorsize - 1) & ~((u64)root->sectorsize - 1);
2157
2158 data_sinfo = BTRFS_I(inode)->space_info;
2159 spin_lock(&data_sinfo->lock);
2160 data_sinfo->bytes_may_use -= bytes;
2161 BTRFS_I(inode)->reserved_bytes -= bytes;
2162 spin_unlock(&data_sinfo->lock);
2163}
2164
2165/* called when we are adding a delalloc extent to the inode's io_tree */
2166void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode,
2167 u64 bytes)
2168{
2169 struct btrfs_space_info *data_sinfo;
2170
2171 /* get the space info for where this inode will be storing its data */
2172 data_sinfo = BTRFS_I(inode)->space_info;
2173
2174 /* make sure we have enough space to handle the data first */
2175 spin_lock(&data_sinfo->lock);
2176 data_sinfo->bytes_delalloc += bytes;
2177
2178 /*
2179 * we are adding a delalloc extent without calling
2180 * btrfs_check_data_free_space first. This happens on a weird
2181 * writepage condition, but shouldn't hurt our accounting
2182 */
2183 if (unlikely(bytes > BTRFS_I(inode)->reserved_bytes)) {
2184 data_sinfo->bytes_may_use -= BTRFS_I(inode)->reserved_bytes;
2185 BTRFS_I(inode)->reserved_bytes = 0;
2186 } else {
2187 data_sinfo->bytes_may_use -= bytes;
2188 BTRFS_I(inode)->reserved_bytes -= bytes;
2189 }
2190
2191 spin_unlock(&data_sinfo->lock);
2192}
2193
2194/* called when we are clearing an delalloc extent from the inode's io_tree */
2195void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode,
2196 u64 bytes)
2197{
2198 struct btrfs_space_info *info;
2199
2200 info = BTRFS_I(inode)->space_info;
2201
2202 spin_lock(&info->lock);
2203 info->bytes_delalloc -= bytes;
2204 spin_unlock(&info->lock);
2205}
2206
1958static int do_chunk_alloc(struct btrfs_trans_handle *trans, 2207static int do_chunk_alloc(struct btrfs_trans_handle *trans,
1959 struct btrfs_root *extent_root, u64 alloc_bytes, 2208 struct btrfs_root *extent_root, u64 alloc_bytes,
1960 u64 flags, int force) 2209 u64 flags, int force)
@@ -2211,13 +2460,12 @@ static int finish_current_insert(struct btrfs_trans_handle *trans,
2211 u64 end; 2460 u64 end;
2212 u64 priv; 2461 u64 priv;
2213 u64 search = 0; 2462 u64 search = 0;
2214 u64 skipped = 0;
2215 struct btrfs_fs_info *info = extent_root->fs_info; 2463 struct btrfs_fs_info *info = extent_root->fs_info;
2216 struct btrfs_path *path; 2464 struct btrfs_path *path;
2217 struct pending_extent_op *extent_op, *tmp; 2465 struct pending_extent_op *extent_op, *tmp;
2218 struct list_head insert_list, update_list; 2466 struct list_head insert_list, update_list;
2219 int ret; 2467 int ret;
2220 int num_inserts = 0, max_inserts; 2468 int num_inserts = 0, max_inserts, restart = 0;
2221 2469
2222 path = btrfs_alloc_path(); 2470 path = btrfs_alloc_path();
2223 INIT_LIST_HEAD(&insert_list); 2471 INIT_LIST_HEAD(&insert_list);
@@ -2233,19 +2481,19 @@ again:
2233 ret = find_first_extent_bit(&info->extent_ins, search, &start, 2481 ret = find_first_extent_bit(&info->extent_ins, search, &start,
2234 &end, EXTENT_WRITEBACK); 2482 &end, EXTENT_WRITEBACK);
2235 if (ret) { 2483 if (ret) {
2236 if (skipped && all && !num_inserts && 2484 if (restart && !num_inserts &&
2237 list_empty(&update_list)) { 2485 list_empty(&update_list)) {
2238 skipped = 0; 2486 restart = 0;
2239 search = 0; 2487 search = 0;
2240 continue; 2488 continue;
2241 } 2489 }
2242 mutex_unlock(&info->extent_ins_mutex);
2243 break; 2490 break;
2244 } 2491 }
2245 2492
2246 ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS); 2493 ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS);
2247 if (!ret) { 2494 if (!ret) {
2248 skipped = 1; 2495 if (all)
2496 restart = 1;
2249 search = end + 1; 2497 search = end + 1;
2250 if (need_resched()) { 2498 if (need_resched()) {
2251 mutex_unlock(&info->extent_ins_mutex); 2499 mutex_unlock(&info->extent_ins_mutex);
@@ -2264,7 +2512,7 @@ again:
2264 list_add_tail(&extent_op->list, &insert_list); 2512 list_add_tail(&extent_op->list, &insert_list);
2265 search = end + 1; 2513 search = end + 1;
2266 if (num_inserts == max_inserts) { 2514 if (num_inserts == max_inserts) {
2267 mutex_unlock(&info->extent_ins_mutex); 2515 restart = 1;
2268 break; 2516 break;
2269 } 2517 }
2270 } else if (extent_op->type == PENDING_BACKREF_UPDATE) { 2518 } else if (extent_op->type == PENDING_BACKREF_UPDATE) {
@@ -2280,7 +2528,6 @@ again:
2280 * somebody marked this thing for deletion then just unlock it and be 2528 * somebody marked this thing for deletion then just unlock it and be
2281 * done, the free_extents will handle it 2529 * done, the free_extents will handle it
2282 */ 2530 */
2283 mutex_lock(&info->extent_ins_mutex);
2284 list_for_each_entry_safe(extent_op, tmp, &update_list, list) { 2531 list_for_each_entry_safe(extent_op, tmp, &update_list, list) {
2285 clear_extent_bits(&info->extent_ins, extent_op->bytenr, 2532 clear_extent_bits(&info->extent_ins, extent_op->bytenr,
2286 extent_op->bytenr + extent_op->num_bytes - 1, 2533 extent_op->bytenr + extent_op->num_bytes - 1,
@@ -2302,6 +2549,10 @@ again:
2302 if (!list_empty(&update_list)) { 2549 if (!list_empty(&update_list)) {
2303 ret = update_backrefs(trans, extent_root, path, &update_list); 2550 ret = update_backrefs(trans, extent_root, path, &update_list);
2304 BUG_ON(ret); 2551 BUG_ON(ret);
2552
2553 /* we may have COW'ed new blocks, so lets start over */
2554 if (all)
2555 restart = 1;
2305 } 2556 }
2306 2557
2307 /* 2558 /*
@@ -2309,9 +2560,9 @@ again:
2309 * need to make sure everything is cleaned then reset everything and 2560 * need to make sure everything is cleaned then reset everything and
2310 * go back to the beginning 2561 * go back to the beginning
2311 */ 2562 */
2312 if (!num_inserts && all && skipped) { 2563 if (!num_inserts && restart) {
2313 search = 0; 2564 search = 0;
2314 skipped = 0; 2565 restart = 0;
2315 INIT_LIST_HEAD(&update_list); 2566 INIT_LIST_HEAD(&update_list);
2316 INIT_LIST_HEAD(&insert_list); 2567 INIT_LIST_HEAD(&insert_list);
2317 goto again; 2568 goto again;
@@ -2368,27 +2619,19 @@ again:
2368 BUG_ON(ret); 2619 BUG_ON(ret);
2369 2620
2370 /* 2621 /*
2371 * if we broke out of the loop in order to insert stuff because we hit 2622 * if restart is set for whatever reason we need to go back and start
2372 * the maximum number of inserts at a time we can handle, then loop 2623 * searching through the pending list again.
2373 * back and pick up where we left off 2624 *
2625 * We just inserted some extents, which could have resulted in new
2626 * blocks being allocated, which would result in new blocks needing
2627 * updates, so if all is set we _must_ restart to get the updated
2628 * blocks.
2374 */ 2629 */
2375 if (num_inserts == max_inserts) { 2630 if (restart || all) {
2376 INIT_LIST_HEAD(&insert_list);
2377 INIT_LIST_HEAD(&update_list);
2378 num_inserts = 0;
2379 goto again;
2380 }
2381
2382 /*
2383 * again, if we need to make absolutely sure there are no more pending
2384 * extent operations left and we know that we skipped some, go back to
2385 * the beginning and do it all again
2386 */
2387 if (all && skipped) {
2388 INIT_LIST_HEAD(&insert_list); 2631 INIT_LIST_HEAD(&insert_list);
2389 INIT_LIST_HEAD(&update_list); 2632 INIT_LIST_HEAD(&update_list);
2390 search = 0; 2633 search = 0;
2391 skipped = 0; 2634 restart = 0;
2392 num_inserts = 0; 2635 num_inserts = 0;
2393 goto again; 2636 goto again;
2394 } 2637 }
@@ -2709,6 +2952,8 @@ again:
2709 goto again; 2952 goto again;
2710 } 2953 }
2711 2954
2955 if (!err)
2956 finish_current_insert(trans, extent_root, 0);
2712 return err; 2957 return err;
2713} 2958}
2714 2959
@@ -2859,7 +3104,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
2859 3104
2860 if (data & BTRFS_BLOCK_GROUP_METADATA) { 3105 if (data & BTRFS_BLOCK_GROUP_METADATA) {
2861 last_ptr = &root->fs_info->last_alloc; 3106 last_ptr = &root->fs_info->last_alloc;
2862 empty_cluster = 64 * 1024; 3107 if (!btrfs_test_opt(root, SSD))
3108 empty_cluster = 64 * 1024;
2863 } 3109 }
2864 3110
2865 if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD)) 3111 if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD))
@@ -3091,6 +3337,10 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes)
3091 (unsigned long long)(info->total_bytes - info->bytes_used - 3337 (unsigned long long)(info->total_bytes - info->bytes_used -
3092 info->bytes_pinned - info->bytes_reserved), 3338 info->bytes_pinned - info->bytes_reserved),
3093 (info->full) ? "" : "not "); 3339 (info->full) ? "" : "not ");
3340 printk(KERN_INFO "space_info total=%llu, pinned=%llu, delalloc=%llu,"
3341 " may_use=%llu, used=%llu\n", info->total_bytes,
3342 info->bytes_pinned, info->bytes_delalloc, info->bytes_may_use,
3343 info->bytes_used);
3094 3344
3095 down_read(&info->groups_sem); 3345 down_read(&info->groups_sem);
3096 list_for_each_entry(cache, &info->block_groups, list) { 3346 list_for_each_entry(cache, &info->block_groups, list) {
@@ -3117,24 +3367,10 @@ static int __btrfs_reserve_extent(struct btrfs_trans_handle *trans,
3117{ 3367{
3118 int ret; 3368 int ret;
3119 u64 search_start = 0; 3369 u64 search_start = 0;
3120 u64 alloc_profile;
3121 struct btrfs_fs_info *info = root->fs_info; 3370 struct btrfs_fs_info *info = root->fs_info;
3122 3371
3123 if (data) { 3372 data = btrfs_get_alloc_profile(root, data);
3124 alloc_profile = info->avail_data_alloc_bits &
3125 info->data_alloc_profile;
3126 data = BTRFS_BLOCK_GROUP_DATA | alloc_profile;
3127 } else if (root == root->fs_info->chunk_root) {
3128 alloc_profile = info->avail_system_alloc_bits &
3129 info->system_alloc_profile;
3130 data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile;
3131 } else {
3132 alloc_profile = info->avail_metadata_alloc_bits &
3133 info->metadata_alloc_profile;
3134 data = BTRFS_BLOCK_GROUP_METADATA | alloc_profile;
3135 }
3136again: 3373again:
3137 data = btrfs_reduce_alloc_profile(root, data);
3138 /* 3374 /*
3139 * the only place that sets empty_size is btrfs_realloc_node, which 3375 * the only place that sets empty_size is btrfs_realloc_node, which
3140 * is not called recursively on allocations 3376 * is not called recursively on allocations
@@ -3402,7 +3638,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
3402 3638
3403struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 3639struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
3404 struct btrfs_root *root, 3640 struct btrfs_root *root,
3405 u64 bytenr, u32 blocksize) 3641 u64 bytenr, u32 blocksize,
3642 int level)
3406{ 3643{
3407 struct extent_buffer *buf; 3644 struct extent_buffer *buf;
3408 3645
@@ -3410,6 +3647,7 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
3410 if (!buf) 3647 if (!buf)
3411 return ERR_PTR(-ENOMEM); 3648 return ERR_PTR(-ENOMEM);
3412 btrfs_set_header_generation(buf, trans->transid); 3649 btrfs_set_header_generation(buf, trans->transid);
3650 btrfs_set_buffer_lockdep_class(buf, level);
3413 btrfs_tree_lock(buf); 3651 btrfs_tree_lock(buf);
3414 clean_tree_block(trans, root, buf); 3652 clean_tree_block(trans, root, buf);
3415 3653
@@ -3453,7 +3691,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
3453 return ERR_PTR(ret); 3691 return ERR_PTR(ret);
3454 } 3692 }
3455 3693
3456 buf = btrfs_init_new_buffer(trans, root, ins.objectid, blocksize); 3694 buf = btrfs_init_new_buffer(trans, root, ins.objectid,
3695 blocksize, level);
3457 return buf; 3696 return buf;
3458} 3697}
3459 3698
@@ -4179,13 +4418,13 @@ int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
4179 path = btrfs_alloc_path(); 4418 path = btrfs_alloc_path();
4180 BUG_ON(!path); 4419 BUG_ON(!path);
4181 4420
4182 BUG_ON(!btrfs_tree_locked(parent)); 4421 btrfs_assert_tree_locked(parent);
4183 parent_level = btrfs_header_level(parent); 4422 parent_level = btrfs_header_level(parent);
4184 extent_buffer_get(parent); 4423 extent_buffer_get(parent);
4185 path->nodes[parent_level] = parent; 4424 path->nodes[parent_level] = parent;
4186 path->slots[parent_level] = btrfs_header_nritems(parent); 4425 path->slots[parent_level] = btrfs_header_nritems(parent);
4187 4426
4188 BUG_ON(!btrfs_tree_locked(node)); 4427 btrfs_assert_tree_locked(node);
4189 level = btrfs_header_level(node); 4428 level = btrfs_header_level(node);
4190 extent_buffer_get(node); 4429 extent_buffer_get(node);
4191 path->nodes[level] = node; 4430 path->nodes[level] = node;
@@ -5641,7 +5880,9 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root,
5641 prev_block = block_start; 5880 prev_block = block_start;
5642 } 5881 }
5643 5882
5883 mutex_lock(&extent_root->fs_info->trans_mutex);
5644 btrfs_record_root_in_trans(found_root); 5884 btrfs_record_root_in_trans(found_root);
5885 mutex_unlock(&extent_root->fs_info->trans_mutex);
5645 if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { 5886 if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) {
5646 /* 5887 /*
5647 * try to update data extent references while 5888 * try to update data extent references while
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 37d43b516b79..ebe6b29e6069 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -415,8 +415,6 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig,
415 415
416 node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node); 416 node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node);
417 if (node) { 417 if (node) {
418 struct extent_state *found;
419 found = rb_entry(node, struct extent_state, rb_node);
420 free_extent_state(prealloc); 418 free_extent_state(prealloc);
421 return -EEXIST; 419 return -EEXIST;
422 } 420 }
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 3e8023efaff7..dc78954861b3 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1091,19 +1091,24 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
1091 WARN_ON(num_pages > nrptrs); 1091 WARN_ON(num_pages > nrptrs);
1092 memset(pages, 0, sizeof(struct page *) * nrptrs); 1092 memset(pages, 0, sizeof(struct page *) * nrptrs);
1093 1093
1094 ret = btrfs_check_free_space(root, write_bytes, 0); 1094 ret = btrfs_check_data_free_space(root, inode, write_bytes);
1095 if (ret) 1095 if (ret)
1096 goto out; 1096 goto out;
1097 1097
1098 ret = prepare_pages(root, file, pages, num_pages, 1098 ret = prepare_pages(root, file, pages, num_pages,
1099 pos, first_index, last_index, 1099 pos, first_index, last_index,
1100 write_bytes); 1100 write_bytes);
1101 if (ret) 1101 if (ret) {
1102 btrfs_free_reserved_data_space(root, inode,
1103 write_bytes);
1102 goto out; 1104 goto out;
1105 }
1103 1106
1104 ret = btrfs_copy_from_user(pos, num_pages, 1107 ret = btrfs_copy_from_user(pos, num_pages,
1105 write_bytes, pages, buf); 1108 write_bytes, pages, buf);
1106 if (ret) { 1109 if (ret) {
1110 btrfs_free_reserved_data_space(root, inode,
1111 write_bytes);
1107 btrfs_drop_pages(pages, num_pages); 1112 btrfs_drop_pages(pages, num_pages);
1108 goto out; 1113 goto out;
1109 } 1114 }
@@ -1111,8 +1116,11 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
1111 ret = dirty_and_release_pages(NULL, root, file, pages, 1116 ret = dirty_and_release_pages(NULL, root, file, pages,
1112 num_pages, pos, write_bytes); 1117 num_pages, pos, write_bytes);
1113 btrfs_drop_pages(pages, num_pages); 1118 btrfs_drop_pages(pages, num_pages);
1114 if (ret) 1119 if (ret) {
1120 btrfs_free_reserved_data_space(root, inode,
1121 write_bytes);
1115 goto out; 1122 goto out;
1123 }
1116 1124
1117 if (will_write) { 1125 if (will_write) {
1118 btrfs_fdatawrite_range(inode->i_mapping, pos, 1126 btrfs_fdatawrite_range(inode->i_mapping, pos,
@@ -1136,6 +1144,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
1136 } 1144 }
1137out: 1145out:
1138 mutex_unlock(&inode->i_mutex); 1146 mutex_unlock(&inode->i_mutex);
1147 if (ret)
1148 err = ret;
1139 1149
1140out_nolock: 1150out_nolock:
1141 kfree(pages); 1151 kfree(pages);
@@ -1222,7 +1232,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1222 /* 1232 /*
1223 * ok we haven't committed the transaction yet, lets do a commit 1233 * ok we haven't committed the transaction yet, lets do a commit
1224 */ 1234 */
1225 if (file->private_data) 1235 if (file && file->private_data)
1226 btrfs_ioctl_trans_end(file); 1236 btrfs_ioctl_trans_end(file);
1227 1237
1228 trans = btrfs_start_transaction(root, 1); 1238 trans = btrfs_start_transaction(root, 1);
@@ -1231,7 +1241,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1231 goto out; 1241 goto out;
1232 } 1242 }
1233 1243
1234 ret = btrfs_log_dentry_safe(trans, root, file->f_dentry); 1244 ret = btrfs_log_dentry_safe(trans, root, dentry);
1235 if (ret < 0) 1245 if (ret < 0)
1236 goto out; 1246 goto out;
1237 1247
@@ -1245,7 +1255,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1245 * file again, but that will end up using the synchronization 1255 * file again, but that will end up using the synchronization
1246 * inside btrfs_sync_log to keep things safe. 1256 * inside btrfs_sync_log to keep things safe.
1247 */ 1257 */
1248 mutex_unlock(&file->f_dentry->d_inode->i_mutex); 1258 mutex_unlock(&dentry->d_inode->i_mutex);
1249 1259
1250 if (ret > 0) { 1260 if (ret > 0) {
1251 ret = btrfs_commit_transaction(trans, root); 1261 ret = btrfs_commit_transaction(trans, root);
@@ -1253,7 +1263,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1253 btrfs_sync_log(trans, root); 1263 btrfs_sync_log(trans, root);
1254 ret = btrfs_end_transaction(trans, root); 1264 ret = btrfs_end_transaction(trans, root);
1255 } 1265 }
1256 mutex_lock(&file->f_dentry->d_inode->i_mutex); 1266 mutex_lock(&dentry->d_inode->i_mutex);
1257out: 1267out:
1258 return ret > 0 ? EIO : ret; 1268 return ret > 0 ? EIO : ret;
1259} 1269}
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index 2aa79873eb46..cc7334d833c9 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -84,7 +84,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
84 search_key.type = 0; 84 search_key.type = 0;
85 search_key.offset = 0; 85 search_key.offset = 0;
86 86
87 btrfs_init_path(path);
88 start_found = 0; 87 start_found = 0;
89 ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0); 88 ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0);
90 if (ret < 0) 89 if (ret < 0)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8f0706210a47..7d4f948bc22a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -102,34 +102,6 @@ static int btrfs_init_inode_security(struct inode *inode, struct inode *dir)
102} 102}
103 103
104/* 104/*
105 * a very lame attempt at stopping writes when the FS is 85% full. There
106 * are countless ways this is incorrect, but it is better than nothing.
107 */
108int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
109 int for_del)
110{
111 u64 total;
112 u64 used;
113 u64 thresh;
114 int ret = 0;
115
116 spin_lock(&root->fs_info->delalloc_lock);
117 total = btrfs_super_total_bytes(&root->fs_info->super_copy);
118 used = btrfs_super_bytes_used(&root->fs_info->super_copy);
119 if (for_del)
120 thresh = total * 90;
121 else
122 thresh = total * 85;
123
124 do_div(thresh, 100);
125
126 if (used + root->fs_info->delalloc_bytes + num_required > thresh)
127 ret = -ENOSPC;
128 spin_unlock(&root->fs_info->delalloc_lock);
129 return ret;
130}
131
132/*
133 * this does all the hard work for inserting an inline extent into 105 * this does all the hard work for inserting an inline extent into
134 * the btree. The caller should have done a btrfs_drop_extents so that 106 * the btree. The caller should have done a btrfs_drop_extents so that
135 * no overlapping inline items exist in the btree 107 * no overlapping inline items exist in the btree
@@ -1190,6 +1162,7 @@ static int btrfs_set_bit_hook(struct inode *inode, u64 start, u64 end,
1190 */ 1162 */
1191 if (!(old & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) { 1163 if (!(old & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) {
1192 struct btrfs_root *root = BTRFS_I(inode)->root; 1164 struct btrfs_root *root = BTRFS_I(inode)->root;
1165 btrfs_delalloc_reserve_space(root, inode, end - start + 1);
1193 spin_lock(&root->fs_info->delalloc_lock); 1166 spin_lock(&root->fs_info->delalloc_lock);
1194 BTRFS_I(inode)->delalloc_bytes += end - start + 1; 1167 BTRFS_I(inode)->delalloc_bytes += end - start + 1;
1195 root->fs_info->delalloc_bytes += end - start + 1; 1168 root->fs_info->delalloc_bytes += end - start + 1;
@@ -1223,9 +1196,12 @@ static int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end,
1223 (unsigned long long)end - start + 1, 1196 (unsigned long long)end - start + 1,
1224 (unsigned long long) 1197 (unsigned long long)
1225 root->fs_info->delalloc_bytes); 1198 root->fs_info->delalloc_bytes);
1199 btrfs_delalloc_free_space(root, inode, (u64)-1);
1226 root->fs_info->delalloc_bytes = 0; 1200 root->fs_info->delalloc_bytes = 0;
1227 BTRFS_I(inode)->delalloc_bytes = 0; 1201 BTRFS_I(inode)->delalloc_bytes = 0;
1228 } else { 1202 } else {
1203 btrfs_delalloc_free_space(root, inode,
1204 end - start + 1);
1229 root->fs_info->delalloc_bytes -= end - start + 1; 1205 root->fs_info->delalloc_bytes -= end - start + 1;
1230 BTRFS_I(inode)->delalloc_bytes -= end - start + 1; 1206 BTRFS_I(inode)->delalloc_bytes -= end - start + 1;
1231 } 1207 }
@@ -2245,10 +2221,6 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
2245 2221
2246 root = BTRFS_I(dir)->root; 2222 root = BTRFS_I(dir)->root;
2247 2223
2248 ret = btrfs_check_free_space(root, 1, 1);
2249 if (ret)
2250 goto fail;
2251
2252 trans = btrfs_start_transaction(root, 1); 2224 trans = btrfs_start_transaction(root, 1);
2253 2225
2254 btrfs_set_trans_block_group(trans, dir); 2226 btrfs_set_trans_block_group(trans, dir);
@@ -2261,7 +2233,6 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
2261 nr = trans->blocks_used; 2233 nr = trans->blocks_used;
2262 2234
2263 btrfs_end_transaction_throttle(trans, root); 2235 btrfs_end_transaction_throttle(trans, root);
2264fail:
2265 btrfs_btree_balance_dirty(root, nr); 2236 btrfs_btree_balance_dirty(root, nr);
2266 return ret; 2237 return ret;
2267} 2238}
@@ -2284,10 +2255,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
2284 return -ENOTEMPTY; 2255 return -ENOTEMPTY;
2285 } 2256 }
2286 2257
2287 ret = btrfs_check_free_space(root, 1, 1);
2288 if (ret)
2289 goto fail;
2290
2291 trans = btrfs_start_transaction(root, 1); 2258 trans = btrfs_start_transaction(root, 1);
2292 btrfs_set_trans_block_group(trans, dir); 2259 btrfs_set_trans_block_group(trans, dir);
2293 2260
@@ -2304,7 +2271,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
2304fail_trans: 2271fail_trans:
2305 nr = trans->blocks_used; 2272 nr = trans->blocks_used;
2306 ret = btrfs_end_transaction_throttle(trans, root); 2273 ret = btrfs_end_transaction_throttle(trans, root);
2307fail:
2308 btrfs_btree_balance_dirty(root, nr); 2274 btrfs_btree_balance_dirty(root, nr);
2309 2275
2310 if (ret && !err) 2276 if (ret && !err)
@@ -2531,8 +2497,6 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
2531 key.offset = (u64)-1; 2497 key.offset = (u64)-1;
2532 key.type = (u8)-1; 2498 key.type = (u8)-1;
2533 2499
2534 btrfs_init_path(path);
2535
2536search_again: 2500search_again:
2537 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 2501 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
2538 if (ret < 0) 2502 if (ret < 0)
@@ -2820,7 +2784,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
2820 if (size <= hole_start) 2784 if (size <= hole_start)
2821 return 0; 2785 return 0;
2822 2786
2823 err = btrfs_check_free_space(root, 1, 0); 2787 err = btrfs_check_metadata_free_space(root);
2824 if (err) 2788 if (err)
2825 return err; 2789 return err;
2826 2790
@@ -3016,6 +2980,7 @@ static noinline void init_btrfs_i(struct inode *inode)
3016 bi->last_trans = 0; 2980 bi->last_trans = 0;
3017 bi->logged_trans = 0; 2981 bi->logged_trans = 0;
3018 bi->delalloc_bytes = 0; 2982 bi->delalloc_bytes = 0;
2983 bi->reserved_bytes = 0;
3019 bi->disk_i_size = 0; 2984 bi->disk_i_size = 0;
3020 bi->flags = 0; 2985 bi->flags = 0;
3021 bi->index_cnt = (u64)-1; 2986 bi->index_cnt = (u64)-1;
@@ -3037,6 +3002,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
3037 inode->i_ino = args->ino; 3002 inode->i_ino = args->ino;
3038 init_btrfs_i(inode); 3003 init_btrfs_i(inode);
3039 BTRFS_I(inode)->root = args->root; 3004 BTRFS_I(inode)->root = args->root;
3005 btrfs_set_inode_space_info(args->root, inode);
3040 return 0; 3006 return 0;
3041} 3007}
3042 3008
@@ -3457,6 +3423,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
3457 BTRFS_I(inode)->index_cnt = 2; 3423 BTRFS_I(inode)->index_cnt = 2;
3458 BTRFS_I(inode)->root = root; 3424 BTRFS_I(inode)->root = root;
3459 BTRFS_I(inode)->generation = trans->transid; 3425 BTRFS_I(inode)->generation = trans->transid;
3426 btrfs_set_inode_space_info(root, inode);
3460 3427
3461 if (mode & S_IFDIR) 3428 if (mode & S_IFDIR)
3462 owner = 0; 3429 owner = 0;
@@ -3604,7 +3571,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
3604 if (!new_valid_dev(rdev)) 3571 if (!new_valid_dev(rdev))
3605 return -EINVAL; 3572 return -EINVAL;
3606 3573
3607 err = btrfs_check_free_space(root, 1, 0); 3574 err = btrfs_check_metadata_free_space(root);
3608 if (err) 3575 if (err)
3609 goto fail; 3576 goto fail;
3610 3577
@@ -3667,7 +3634,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
3667 u64 objectid; 3634 u64 objectid;
3668 u64 index = 0; 3635 u64 index = 0;
3669 3636
3670 err = btrfs_check_free_space(root, 1, 0); 3637 err = btrfs_check_metadata_free_space(root);
3671 if (err) 3638 if (err)
3672 goto fail; 3639 goto fail;
3673 trans = btrfs_start_transaction(root, 1); 3640 trans = btrfs_start_transaction(root, 1);
@@ -3735,7 +3702,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
3735 return -ENOENT; 3702 return -ENOENT;
3736 3703
3737 btrfs_inc_nlink(inode); 3704 btrfs_inc_nlink(inode);
3738 err = btrfs_check_free_space(root, 1, 0); 3705 err = btrfs_check_metadata_free_space(root);
3739 if (err) 3706 if (err)
3740 goto fail; 3707 goto fail;
3741 err = btrfs_set_inode_index(dir, &index); 3708 err = btrfs_set_inode_index(dir, &index);
@@ -3781,7 +3748,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
3781 u64 index = 0; 3748 u64 index = 0;
3782 unsigned long nr = 1; 3749 unsigned long nr = 1;
3783 3750
3784 err = btrfs_check_free_space(root, 1, 0); 3751 err = btrfs_check_metadata_free_space(root);
3785 if (err) 3752 if (err)
3786 goto out_unlock; 3753 goto out_unlock;
3787 3754
@@ -4263,7 +4230,7 @@ static int btrfs_releasepage(struct page *page, gfp_t gfp_flags)
4263{ 4230{
4264 if (PageWriteback(page) || PageDirty(page)) 4231 if (PageWriteback(page) || PageDirty(page))
4265 return 0; 4232 return 0;
4266 return __btrfs_releasepage(page, gfp_flags); 4233 return __btrfs_releasepage(page, gfp_flags & GFP_NOFS);
4267} 4234}
4268 4235
4269static void btrfs_invalidatepage(struct page *page, unsigned long offset) 4236static void btrfs_invalidatepage(struct page *page, unsigned long offset)
@@ -4338,7 +4305,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
4338 u64 page_start; 4305 u64 page_start;
4339 u64 page_end; 4306 u64 page_end;
4340 4307
4341 ret = btrfs_check_free_space(root, PAGE_CACHE_SIZE, 0); 4308 ret = btrfs_check_data_free_space(root, inode, PAGE_CACHE_SIZE);
4342 if (ret) 4309 if (ret)
4343 goto out; 4310 goto out;
4344 4311
@@ -4351,6 +4318,7 @@ again:
4351 4318
4352 if ((page->mapping != inode->i_mapping) || 4319 if ((page->mapping != inode->i_mapping) ||
4353 (page_start >= size)) { 4320 (page_start >= size)) {
4321 btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE);
4354 /* page got truncated out from underneath us */ 4322 /* page got truncated out from underneath us */
4355 goto out_unlock; 4323 goto out_unlock;
4356 } 4324 }
@@ -4633,7 +4601,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
4633 if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) 4601 if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID)
4634 return -EXDEV; 4602 return -EXDEV;
4635 4603
4636 ret = btrfs_check_free_space(root, 1, 0); 4604 ret = btrfs_check_metadata_free_space(root);
4637 if (ret) 4605 if (ret)
4638 goto out_unlock; 4606 goto out_unlock;
4639 4607
@@ -4751,7 +4719,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
4751 if (name_len > BTRFS_MAX_INLINE_DATA_SIZE(root)) 4719 if (name_len > BTRFS_MAX_INLINE_DATA_SIZE(root))
4752 return -ENAMETOOLONG; 4720 return -ENAMETOOLONG;
4753 4721
4754 err = btrfs_check_free_space(root, 1, 0); 4722 err = btrfs_check_metadata_free_space(root);
4755 if (err) 4723 if (err)
4756 goto out_fail; 4724 goto out_fail;
4757 4725
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 988fdc8b49eb..bca729fc80c8 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -70,7 +70,7 @@ static noinline int create_subvol(struct btrfs_root *root,
70 u64 index = 0; 70 u64 index = 0;
71 unsigned long nr = 1; 71 unsigned long nr = 1;
72 72
73 ret = btrfs_check_free_space(root, 1, 0); 73 ret = btrfs_check_metadata_free_space(root);
74 if (ret) 74 if (ret)
75 goto fail_commit; 75 goto fail_commit;
76 76
@@ -203,7 +203,7 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
203 if (!root->ref_cows) 203 if (!root->ref_cows)
204 return -EINVAL; 204 return -EINVAL;
205 205
206 ret = btrfs_check_free_space(root, 1, 0); 206 ret = btrfs_check_metadata_free_space(root);
207 if (ret) 207 if (ret)
208 goto fail_unlock; 208 goto fail_unlock;
209 209
@@ -374,7 +374,7 @@ static int btrfs_defrag_file(struct file *file)
374 unsigned long i; 374 unsigned long i;
375 int ret; 375 int ret;
376 376
377 ret = btrfs_check_free_space(root, inode->i_size, 0); 377 ret = btrfs_check_data_free_space(root, inode, inode->i_size);
378 if (ret) 378 if (ret)
379 return -ENOSPC; 379 return -ENOSPC;
380 380
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 9ebe9385129b..47b0a88c12a2 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -25,21 +25,10 @@
25#include "extent_io.h" 25#include "extent_io.h"
26#include "locking.h" 26#include "locking.h"
27 27
28/*
29 * btrfs_header_level() isn't free, so don't call it when lockdep isn't
30 * on
31 */
32#ifdef CONFIG_DEBUG_LOCK_ALLOC
33static inline void spin_nested(struct extent_buffer *eb)
34{
35 spin_lock_nested(&eb->lock, BTRFS_MAX_LEVEL - btrfs_header_level(eb));
36}
37#else
38static inline void spin_nested(struct extent_buffer *eb) 28static inline void spin_nested(struct extent_buffer *eb)
39{ 29{
40 spin_lock(&eb->lock); 30 spin_lock(&eb->lock);
41} 31}
42#endif
43 32
44/* 33/*
45 * Setting a lock to blocking will drop the spinlock and set the 34 * Setting a lock to blocking will drop the spinlock and set the
@@ -231,8 +220,8 @@ int btrfs_tree_unlock(struct extent_buffer *eb)
231 return 0; 220 return 0;
232} 221}
233 222
234int btrfs_tree_locked(struct extent_buffer *eb) 223void btrfs_assert_tree_locked(struct extent_buffer *eb)
235{ 224{
236 return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) || 225 if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
237 spin_is_locked(&eb->lock); 226 assert_spin_locked(&eb->lock);
238} 227}
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
index 6bb0afbff928..6c4ce457168c 100644
--- a/fs/btrfs/locking.h
+++ b/fs/btrfs/locking.h
@@ -21,11 +21,11 @@
21 21
22int btrfs_tree_lock(struct extent_buffer *eb); 22int btrfs_tree_lock(struct extent_buffer *eb);
23int btrfs_tree_unlock(struct extent_buffer *eb); 23int btrfs_tree_unlock(struct extent_buffer *eb);
24int btrfs_tree_locked(struct extent_buffer *eb);
25 24
26int btrfs_try_tree_lock(struct extent_buffer *eb); 25int btrfs_try_tree_lock(struct extent_buffer *eb);
27int btrfs_try_spin_lock(struct extent_buffer *eb); 26int btrfs_try_spin_lock(struct extent_buffer *eb);
28 27
29void btrfs_set_lock_blocking(struct extent_buffer *eb); 28void btrfs_set_lock_blocking(struct extent_buffer *eb);
30void btrfs_clear_lock_blocking(struct extent_buffer *eb); 29void btrfs_clear_lock_blocking(struct extent_buffer *eb);
30void btrfs_assert_tree_locked(struct extent_buffer *eb);
31#endif 31#endif
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f3fd7e2cbc38..19a4daf03ccb 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -379,7 +379,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
379 btrfs_start_delalloc_inodes(root); 379 btrfs_start_delalloc_inodes(root);
380 btrfs_wait_ordered_extents(root, 0); 380 btrfs_wait_ordered_extents(root, 0);
381 381
382 btrfs_clean_old_snapshots(root);
383 trans = btrfs_start_transaction(root, 1); 382 trans = btrfs_start_transaction(root, 1);
384 ret = btrfs_commit_transaction(trans, root); 383 ret = btrfs_commit_transaction(trans, root);
385 sb->s_dirt = 0; 384 sb->s_dirt = 0;
@@ -511,6 +510,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
511 struct btrfs_root *root = btrfs_sb(sb); 510 struct btrfs_root *root = btrfs_sb(sb);
512 int ret; 511 int ret;
513 512
513 ret = btrfs_parse_options(root, data);
514 if (ret)
515 return -EINVAL;
516
514 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 517 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
515 return 0; 518 return 0;
516 519
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 919172de5c9a..4112d53d4f4d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -688,7 +688,9 @@ static noinline int drop_dirty_roots(struct btrfs_root *tree_root,
688 num_bytes -= btrfs_root_used(&dirty->root->root_item); 688 num_bytes -= btrfs_root_used(&dirty->root->root_item);
689 bytes_used = btrfs_root_used(&root->root_item); 689 bytes_used = btrfs_root_used(&root->root_item);
690 if (num_bytes) { 690 if (num_bytes) {
691 mutex_lock(&root->fs_info->trans_mutex);
691 btrfs_record_root_in_trans(root); 692 btrfs_record_root_in_trans(root);
693 mutex_unlock(&root->fs_info->trans_mutex);
692 btrfs_set_root_used(&root->root_item, 694 btrfs_set_root_used(&root->root_item,
693 bytes_used - num_bytes); 695 bytes_used - num_bytes);
694 } 696 }
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 20794290256b..9c462fbd60fa 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2832,7 +2832,9 @@ again:
2832 BUG_ON(!wc.replay_dest); 2832 BUG_ON(!wc.replay_dest);
2833 2833
2834 wc.replay_dest->log_root = log; 2834 wc.replay_dest->log_root = log;
2835 mutex_lock(&fs_info->trans_mutex);
2835 btrfs_record_root_in_trans(wc.replay_dest); 2836 btrfs_record_root_in_trans(wc.replay_dest);
2837 mutex_unlock(&fs_info->trans_mutex);
2836 ret = walk_log_tree(trans, log, &wc); 2838 ret = walk_log_tree(trans, log, &wc);
2837 BUG_ON(ret); 2839 BUG_ON(ret);
2838 2840
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index bcd14ebccae1..1316139bf9e8 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2894,10 +2894,6 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
2894 free_extent_map(em); 2894 free_extent_map(em);
2895 } 2895 }
2896 2896
2897 map = kzalloc(sizeof(*map), GFP_NOFS);
2898 if (!map)
2899 return -ENOMEM;
2900
2901 em = alloc_extent_map(GFP_NOFS); 2897 em = alloc_extent_map(GFP_NOFS);
2902 if (!em) 2898 if (!em)
2903 return -ENOMEM; 2899 return -ENOMEM;
@@ -3106,6 +3102,8 @@ int btrfs_read_sys_array(struct btrfs_root *root)
3106 if (!sb) 3102 if (!sb)
3107 return -ENOMEM; 3103 return -ENOMEM;
3108 btrfs_set_buffer_uptodate(sb); 3104 btrfs_set_buffer_uptodate(sb);
3105 btrfs_set_buffer_lockdep_class(sb, 0);
3106
3109 write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); 3107 write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
3110 array_size = btrfs_super_sys_array_size(super_copy); 3108 array_size = btrfs_super_sys_array_size(super_copy);
3111 3109
diff --git a/fs/buffer.c b/fs/buffer.c
index 665d446b25bc..9f697419ed8e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -777,6 +777,7 @@ static int __set_page_dirty(struct page *page,
777 __inc_zone_page_state(page, NR_FILE_DIRTY); 777 __inc_zone_page_state(page, NR_FILE_DIRTY);
778 __inc_bdi_stat(mapping->backing_dev_info, 778 __inc_bdi_stat(mapping->backing_dev_info,
779 BDI_RECLAIMABLE); 779 BDI_RECLAIMABLE);
780 task_dirty_inc(current);
780 task_io_account_write(PAGE_CACHE_SIZE); 781 task_io_account_write(PAGE_CACHE_SIZE);
781 } 782 }
782 radix_tree_tag_set(&mapping->page_tree, 783 radix_tree_tag_set(&mapping->page_tree,
@@ -3108,7 +3109,7 @@ int sync_dirty_buffer(struct buffer_head *bh)
3108 if (test_clear_buffer_dirty(bh)) { 3109 if (test_clear_buffer_dirty(bh)) {
3109 get_bh(bh); 3110 get_bh(bh);
3110 bh->b_end_io = end_buffer_write_sync; 3111 bh->b_end_io = end_buffer_write_sync;
3111 ret = submit_bh(WRITE_SYNC, bh); 3112 ret = submit_bh(WRITE, bh);
3112 wait_on_buffer(bh); 3113 wait_on_buffer(bh);
3113 if (buffer_eopnotsupp(bh)) { 3114 if (buffer_eopnotsupp(bh)) {
3114 clear_buffer_eopnotsupp(bh); 3115 clear_buffer_eopnotsupp(bh);
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 73ac7ebd1dfc..851388fafc73 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,3 +1,13 @@
1Version 1.57
2------------
3Improve support for multiple security contexts to the same server. We
4used to use the same "vcnumber" for all connections which could cause
5the server to treat subsequent connections, especially those that
6are authenticated as guest, as reconnections, invalidating the earlier
7user's smb session. This fix allows cifs to mount multiple times to the
8same server with different userids without risking invalidating earlier
9established security contexts.
10
1Version 1.56 11Version 1.56
2------------ 12------------
3Add "forcemandatorylock" mount option to allow user to use mandatory 13Add "forcemandatorylock" mount option to allow user to use mandatory
@@ -7,7 +17,10 @@ specified and user does not have access to query information about the
7top of the share. Fix problem in 2.6.28 resolving DFS paths to 17top of the share. Fix problem in 2.6.28 resolving DFS paths to
8Samba servers (worked to Windows). Fix rmdir so that pending search 18Samba servers (worked to Windows). Fix rmdir so that pending search
9(readdir) requests do not get invalid results which include the now 19(readdir) requests do not get invalid results which include the now
10removed directory. 20removed directory. Fix oops in cifs_dfs_ref.c when prefixpath is not reachable
21when using DFS. Add better file create support to servers which support
22the CIFS POSIX protocol extensions (this adds support for new flags
23on create, and improves semantics for write of locked ranges).
11 24
12Version 1.55 25Version 1.55
13------------ 26------------
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 7ac481841f87..2b1d28a9ee28 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -100,5 +100,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
100extern const struct export_operations cifs_export_ops; 100extern const struct export_operations cifs_export_ops;
101#endif /* EXPERIMENTAL */ 101#endif /* EXPERIMENTAL */
102 102
103#define CIFS_VERSION "1.56" 103#define CIFS_VERSION "1.57"
104#endif /* _CIFSFS_H */ 104#endif /* _CIFSFS_H */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 94c1ca0ec953..e004f6db5fc8 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -164,9 +164,12 @@ struct TCP_Server_Info {
164 /* multiplexed reads or writes */ 164 /* multiplexed reads or writes */
165 unsigned int maxBuf; /* maxBuf specifies the maximum */ 165 unsigned int maxBuf; /* maxBuf specifies the maximum */
166 /* message size the server can send or receive for non-raw SMBs */ 166 /* message size the server can send or receive for non-raw SMBs */
167 unsigned int maxRw; /* maxRw specifies the maximum */ 167 unsigned int max_rw; /* maxRw specifies the maximum */
168 /* message size the server can send or receive for */ 168 /* message size the server can send or receive for */
169 /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ 169 /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */
170 unsigned int max_vcs; /* maximum number of smb sessions, at least
171 those that can be specified uniquely with
172 vcnumbers */
170 char sessid[4]; /* unique token id for this session */ 173 char sessid[4]; /* unique token id for this session */
171 /* (returned on Negotiate */ 174 /* (returned on Negotiate */
172 int capabilities; /* allow selective disabling of caps by smb sess */ 175 int capabilities; /* allow selective disabling of caps by smb sess */
@@ -210,6 +213,7 @@ struct cifsSesInfo {
210 unsigned overrideSecFlg; /* if non-zero override global sec flags */ 213 unsigned overrideSecFlg; /* if non-zero override global sec flags */
211 __u16 ipc_tid; /* special tid for connection to IPC share */ 214 __u16 ipc_tid; /* special tid for connection to IPC share */
212 __u16 flags; 215 __u16 flags;
216 __u16 vcnum;
213 char *serverOS; /* name of operating system underlying server */ 217 char *serverOS; /* name of operating system underlying server */
214 char *serverNOS; /* name of network operating system of server */ 218 char *serverNOS; /* name of network operating system of server */
215 char *serverDomain; /* security realm of server */ 219 char *serverDomain; /* security realm of server */
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 382ba6298809..083dfc57c7a3 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -42,6 +42,7 @@ extern void _FreeXid(unsigned int);
42#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid())); 42#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid()));
43#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__func__,curr_xid,(int)rc));} 43#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__func__,curr_xid,(int)rc));}
44extern char *build_path_from_dentry(struct dentry *); 44extern char *build_path_from_dentry(struct dentry *);
45extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb);
45extern char *build_wildcard_path_from_dentry(struct dentry *direntry); 46extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
46/* extern void renew_parental_timestamps(struct dentry *direntry);*/ 47/* extern void renew_parental_timestamps(struct dentry *direntry);*/
47extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, 48extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
@@ -91,6 +92,9 @@ extern u64 cifs_UnixTimeToNT(struct timespec);
91extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); 92extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
92extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); 93extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
93 94
95extern void posix_fill_in_inode(struct inode *tmp_inode,
96 FILE_UNIX_BASIC_INFO *pData, int isNewInode);
97extern struct inode *cifs_new_inode(struct super_block *sb, __u64 *inum);
94extern int cifs_get_inode_info(struct inode **pinode, 98extern int cifs_get_inode_info(struct inode **pinode,
95 const unsigned char *search_path, 99 const unsigned char *search_path,
96 FILE_ALL_INFO *pfile_info, 100 FILE_ALL_INFO *pfile_info,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 552642a507c4..939e2f76b959 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -528,14 +528,15 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
528 server->maxReq = le16_to_cpu(rsp->MaxMpxCount); 528 server->maxReq = le16_to_cpu(rsp->MaxMpxCount);
529 server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize), 529 server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize),
530 (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); 530 (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
531 server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs);
531 GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey); 532 GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey);
532 /* even though we do not use raw we might as well set this 533 /* even though we do not use raw we might as well set this
533 accurately, in case we ever find a need for it */ 534 accurately, in case we ever find a need for it */
534 if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { 535 if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) {
535 server->maxRw = 0xFF00; 536 server->max_rw = 0xFF00;
536 server->capabilities = CAP_MPX_MODE | CAP_RAW_MODE; 537 server->capabilities = CAP_MPX_MODE | CAP_RAW_MODE;
537 } else { 538 } else {
538 server->maxRw = 0;/* we do not need to use raw anyway */ 539 server->max_rw = 0;/* do not need to use raw anyway */
539 server->capabilities = CAP_MPX_MODE; 540 server->capabilities = CAP_MPX_MODE;
540 } 541 }
541 tmp = (__s16)le16_to_cpu(rsp->ServerTimeZone); 542 tmp = (__s16)le16_to_cpu(rsp->ServerTimeZone);
@@ -638,7 +639,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
638 /* probably no need to store and check maxvcs */ 639 /* probably no need to store and check maxvcs */
639 server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize), 640 server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize),
640 (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); 641 (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
641 server->maxRw = le32_to_cpu(pSMBr->MaxRawSize); 642 server->max_rw = le32_to_cpu(pSMBr->MaxRawSize);
642 cFYI(DBG2, ("Max buf = %d", ses->server->maxBuf)); 643 cFYI(DBG2, ("Max buf = %d", ses->server->maxBuf));
643 GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey); 644 GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey);
644 server->capabilities = le32_to_cpu(pSMBr->Capabilities); 645 server->capabilities = le32_to_cpu(pSMBr->Capabilities);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 2209be943051..da0f4ffa0613 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -23,7 +23,6 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/wait.h> 25#include <linux/wait.h>
26#include <linux/ipv6.h>
27#include <linux/pagemap.h> 26#include <linux/pagemap.h>
28#include <linux/ctype.h> 27#include <linux/ctype.h>
29#include <linux/utsname.h> 28#include <linux/utsname.h>
@@ -35,6 +34,7 @@
35#include <linux/freezer.h> 34#include <linux/freezer.h>
36#include <asm/uaccess.h> 35#include <asm/uaccess.h>
37#include <asm/processor.h> 36#include <asm/processor.h>
37#include <net/ipv6.h>
38#include "cifspdu.h" 38#include "cifspdu.h"
39#include "cifsglob.h" 39#include "cifsglob.h"
40#include "cifsproto.h" 40#include "cifsproto.h"
@@ -1379,8 +1379,8 @@ cifs_find_tcp_session(struct sockaddr_storage *addr)
1379 server->addr.sockAddr.sin_addr.s_addr)) 1379 server->addr.sockAddr.sin_addr.s_addr))
1380 continue; 1380 continue;
1381 else if (addr->ss_family == AF_INET6 && 1381 else if (addr->ss_family == AF_INET6 &&
1382 memcmp(&server->addr.sockAddr6.sin6_addr, 1382 !ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr,
1383 &addr6->sin6_addr, sizeof(addr6->sin6_addr))) 1383 &addr6->sin6_addr))
1384 continue; 1384 continue;
1385 1385
1386 ++server->srv_count; 1386 ++server->srv_count;
@@ -2180,6 +2180,33 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
2180 "mount option supported")); 2180 "mount option supported"));
2181} 2181}
2182 2182
2183static int
2184is_path_accessible(int xid, struct cifsTconInfo *tcon,
2185 struct cifs_sb_info *cifs_sb, const char *full_path)
2186{
2187 int rc;
2188 __u64 inode_num;
2189 FILE_ALL_INFO *pfile_info;
2190
2191 rc = CIFSGetSrvInodeNumber(xid, tcon, full_path, &inode_num,
2192 cifs_sb->local_nls,
2193 cifs_sb->mnt_cifs_flags &
2194 CIFS_MOUNT_MAP_SPECIAL_CHR);
2195 if (rc != -EOPNOTSUPP)
2196 return rc;
2197
2198 pfile_info = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
2199 if (pfile_info == NULL)
2200 return -ENOMEM;
2201
2202 rc = CIFSSMBQPathInfo(xid, tcon, full_path, pfile_info,
2203 0 /* not legacy */, cifs_sb->local_nls,
2204 cifs_sb->mnt_cifs_flags &
2205 CIFS_MOUNT_MAP_SPECIAL_CHR);
2206 kfree(pfile_info);
2207 return rc;
2208}
2209
2183int 2210int
2184cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, 2211cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2185 char *mount_data, const char *devname) 2212 char *mount_data, const char *devname)
@@ -2190,6 +2217,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2190 struct cifsSesInfo *pSesInfo = NULL; 2217 struct cifsSesInfo *pSesInfo = NULL;
2191 struct cifsTconInfo *tcon = NULL; 2218 struct cifsTconInfo *tcon = NULL;
2192 struct TCP_Server_Info *srvTcp = NULL; 2219 struct TCP_Server_Info *srvTcp = NULL;
2220 char *full_path;
2193 2221
2194 xid = GetXid(); 2222 xid = GetXid();
2195 2223
@@ -2426,6 +2454,23 @@ mount_fail_check:
2426 cifs_sb->rsize = min(cifs_sb->rsize, 2454 cifs_sb->rsize = min(cifs_sb->rsize,
2427 (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)); 2455 (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE));
2428 2456
2457 if (!rc && cifs_sb->prepathlen) {
2458 /* build_path_to_root works only when we have a valid tcon */
2459 full_path = cifs_build_path_to_root(cifs_sb);
2460 if (full_path == NULL) {
2461 rc = -ENOMEM;
2462 goto mount_fail_check;
2463 }
2464 rc = is_path_accessible(xid, tcon, cifs_sb, full_path);
2465 if (rc) {
2466 cERROR(1, ("Path %s in not accessible: %d",
2467 full_path, rc));
2468 kfree(full_path);
2469 goto mount_fail_check;
2470 }
2471 kfree(full_path);
2472 }
2473
2429 /* volume_info->password is freed above when existing session found 2474 /* volume_info->password is freed above when existing session found
2430 (in which case it is not needed anymore) but when new sesion is created 2475 (in which case it is not needed anymore) but when new sesion is created
2431 the password ptr is put in the new session structure (in which case the 2476 the password ptr is put in the new session structure (in which case the
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 964aad03c5ad..89fb72832652 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * vfs operations that deal with dentries 4 * vfs operations that deal with dentries
5 * 5 *
6 * Copyright (C) International Business Machines Corp., 2002,2008 6 * Copyright (C) International Business Machines Corp., 2002,2009
7 * Author(s): Steve French (sfrench@us.ibm.com) 7 * Author(s): Steve French (sfrench@us.ibm.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or modify 9 * This library is free software; you can redistribute it and/or modify
@@ -129,6 +129,78 @@ cifs_bp_rename_retry:
129 return full_path; 129 return full_path;
130} 130}
131 131
132static int cifs_posix_open(char *full_path, struct inode **pinode,
133 struct super_block *sb, int mode, int oflags,
134 int *poplock, __u16 *pnetfid, int xid)
135{
136 int rc;
137 __u32 oplock;
138 FILE_UNIX_BASIC_INFO *presp_data;
139 __u32 posix_flags = 0;
140 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
141
142 cFYI(1, ("posix open %s", full_path));
143
144 presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
145 if (presp_data == NULL)
146 return -ENOMEM;
147
148/* So far cifs posix extensions can only map the following flags.
149 There are other valid fmode oflags such as FMODE_LSEEK, FMODE_PREAD, but
150 so far we do not seem to need them, and we can treat them as local only */
151 if ((oflags & (FMODE_READ | FMODE_WRITE)) ==
152 (FMODE_READ | FMODE_WRITE))
153 posix_flags = SMB_O_RDWR;
154 else if (oflags & FMODE_READ)
155 posix_flags = SMB_O_RDONLY;
156 else if (oflags & FMODE_WRITE)
157 posix_flags = SMB_O_WRONLY;
158 if (oflags & O_CREAT)
159 posix_flags |= SMB_O_CREAT;
160 if (oflags & O_EXCL)
161 posix_flags |= SMB_O_EXCL;
162 if (oflags & O_TRUNC)
163 posix_flags |= SMB_O_TRUNC;
164 if (oflags & O_APPEND)
165 posix_flags |= SMB_O_APPEND;
166 if (oflags & O_SYNC)
167 posix_flags |= SMB_O_SYNC;
168 if (oflags & O_DIRECTORY)
169 posix_flags |= SMB_O_DIRECTORY;
170 if (oflags & O_NOFOLLOW)
171 posix_flags |= SMB_O_NOFOLLOW;
172 if (oflags & O_DIRECT)
173 posix_flags |= SMB_O_DIRECT;
174
175
176 rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode,
177 pnetfid, presp_data, &oplock, full_path,
178 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
179 CIFS_MOUNT_MAP_SPECIAL_CHR);
180 if (rc)
181 goto posix_open_ret;
182
183 if (presp_data->Type == cpu_to_le32(-1))
184 goto posix_open_ret; /* open ok, caller does qpathinfo */
185
186 /* get new inode and set it up */
187 if (!pinode)
188 goto posix_open_ret; /* caller does not need info */
189
190 *pinode = cifs_new_inode(sb, &presp_data->UniqueId);
191
192 /* We do not need to close the file if new_inode fails since
193 the caller will retry qpathinfo as long as inode is null */
194 if (*pinode == NULL)
195 goto posix_open_ret;
196
197 posix_fill_in_inode(*pinode, presp_data, 1);
198
199posix_open_ret:
200 kfree(presp_data);
201 return rc;
202}
203
132static void setup_cifs_dentry(struct cifsTconInfo *tcon, 204static void setup_cifs_dentry(struct cifsTconInfo *tcon,
133 struct dentry *direntry, 205 struct dentry *direntry,
134 struct inode *newinode) 206 struct inode *newinode)
@@ -150,7 +222,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
150 int xid; 222 int xid;
151 int create_options = CREATE_NOT_DIR; 223 int create_options = CREATE_NOT_DIR;
152 int oplock = 0; 224 int oplock = 0;
153 /* BB below access is too much for the mknod to request */ 225 int oflags;
226 /*
227 * BB below access is probably too much for mknod to request
228 * but we have to do query and setpathinfo so requesting
229 * less could fail (unless we want to request getatr and setatr
230 * permissions (only). At least for POSIX we do not have to
231 * request so much.
232 */
154 int desiredAccess = GENERIC_READ | GENERIC_WRITE; 233 int desiredAccess = GENERIC_READ | GENERIC_WRITE;
155 __u16 fileHandle; 234 __u16 fileHandle;
156 struct cifs_sb_info *cifs_sb; 235 struct cifs_sb_info *cifs_sb;
@@ -174,13 +253,43 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
174 } 253 }
175 254
176 mode &= ~current->fs->umask; 255 mode &= ~current->fs->umask;
256 if (oplockEnabled)
257 oplock = REQ_OPLOCK;
177 258
178 if (nd && (nd->flags & LOOKUP_OPEN)) { 259 if (nd && (nd->flags & LOOKUP_OPEN))
179 int oflags = nd->intent.open.flags; 260 oflags = nd->intent.open.flags;
261 else
262 oflags = FMODE_READ;
263
264 if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) &&
265 (CIFS_UNIX_POSIX_PATH_OPS_CAP &
266 le64_to_cpu(tcon->fsUnixInfo.Capability))) {
267 rc = cifs_posix_open(full_path, &newinode, inode->i_sb,
268 mode, oflags, &oplock, &fileHandle, xid);
269 /* EIO could indicate that (posix open) operation is not
270 supported, despite what server claimed in capability
271 negotation. EREMOTE indicates DFS junction, which is not
272 handled in posix open */
273
274 if ((rc == 0) && (newinode == NULL))
275 goto cifs_create_get_file_info; /* query inode info */
276 else if (rc == 0) /* success, no need to query */
277 goto cifs_create_set_dentry;
278 else if ((rc != -EIO) && (rc != -EREMOTE) &&
279 (rc != -EOPNOTSUPP)) /* path not found or net err */
280 goto cifs_create_out;
281 /* else fallthrough to retry, using older open call, this is
282 case where server does not support this SMB level, and
283 falsely claims capability (also get here for DFS case
284 which should be rare for path not covered on files) */
285 }
180 286
287 if (nd && (nd->flags & LOOKUP_OPEN)) {
288 /* if the file is going to stay open, then we
289 need to set the desired access properly */
181 desiredAccess = 0; 290 desiredAccess = 0;
182 if (oflags & FMODE_READ) 291 if (oflags & FMODE_READ)
183 desiredAccess |= GENERIC_READ; 292 desiredAccess |= GENERIC_READ; /* is this too little? */
184 if (oflags & FMODE_WRITE) { 293 if (oflags & FMODE_WRITE) {
185 desiredAccess |= GENERIC_WRITE; 294 desiredAccess |= GENERIC_WRITE;
186 if (!(oflags & FMODE_READ)) 295 if (!(oflags & FMODE_READ))
@@ -199,8 +308,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
199 308
200 /* BB add processing to set equivalent of mode - e.g. via CreateX with 309 /* BB add processing to set equivalent of mode - e.g. via CreateX with
201 ACLs */ 310 ACLs */
202 if (oplockEnabled)
203 oplock = REQ_OPLOCK;
204 311
205 buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); 312 buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
206 if (buf == NULL) { 313 if (buf == NULL) {
@@ -233,116 +340,112 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
233 } 340 }
234 if (rc) { 341 if (rc) {
235 cFYI(1, ("cifs_create returned 0x%x", rc)); 342 cFYI(1, ("cifs_create returned 0x%x", rc));
236 } else { 343 goto cifs_create_out;
237 /* If Open reported that we actually created a file 344 }
238 then we now have to set the mode if possible */ 345
239 if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 346 /* If Open reported that we actually created a file
240 struct cifs_unix_set_info_args args = { 347 then we now have to set the mode if possible */
348 if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
349 struct cifs_unix_set_info_args args = {
241 .mode = mode, 350 .mode = mode,
242 .ctime = NO_CHANGE_64, 351 .ctime = NO_CHANGE_64,
243 .atime = NO_CHANGE_64, 352 .atime = NO_CHANGE_64,
244 .mtime = NO_CHANGE_64, 353 .mtime = NO_CHANGE_64,
245 .device = 0, 354 .device = 0,
246 }; 355 };
247 356
248 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 357 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
249 args.uid = (__u64) current_fsuid(); 358 args.uid = (__u64) current_fsuid();
250 if (inode->i_mode & S_ISGID) 359 if (inode->i_mode & S_ISGID)
251 args.gid = (__u64) inode->i_gid; 360 args.gid = (__u64) inode->i_gid;
252 else 361 else
253 args.gid = (__u64) current_fsgid(); 362 args.gid = (__u64) current_fsgid();
254 } else {
255 args.uid = NO_CHANGE_64;
256 args.gid = NO_CHANGE_64;
257 }
258 CIFSSMBUnixSetInfo(xid, tcon, full_path, &args,
259 cifs_sb->local_nls,
260 cifs_sb->mnt_cifs_flags &
261 CIFS_MOUNT_MAP_SPECIAL_CHR);
262 } else { 363 } else {
263 /* BB implement mode setting via Windows security 364 args.uid = NO_CHANGE_64;
264 descriptors e.g. */ 365 args.gid = NO_CHANGE_64;
265 /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/
266
267 /* Could set r/o dos attribute if mode & 0222 == 0 */
268 } 366 }
367 CIFSSMBUnixSetInfo(xid, tcon, full_path, &args,
368 cifs_sb->local_nls,
369 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
370 } else {
371 /* BB implement mode setting via Windows security
372 descriptors e.g. */
373 /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/
269 374
270 /* server might mask mode so we have to query for it */ 375 /* Could set r/o dos attribute if mode & 0222 == 0 */
271 if (tcon->unix_ext) 376 }
272 rc = cifs_get_inode_info_unix(&newinode, full_path, 377
273 inode->i_sb, xid); 378cifs_create_get_file_info:
274 else { 379 /* server might mask mode so we have to query for it */
275 rc = cifs_get_inode_info(&newinode, full_path, 380 if (tcon->unix_ext)
276 buf, inode->i_sb, xid, 381 rc = cifs_get_inode_info_unix(&newinode, full_path,
277 &fileHandle); 382 inode->i_sb, xid);
278 if (newinode) { 383 else {
279 if (cifs_sb->mnt_cifs_flags & 384 rc = cifs_get_inode_info(&newinode, full_path, buf,
280 CIFS_MOUNT_DYNPERM) 385 inode->i_sb, xid, &fileHandle);
281 newinode->i_mode = mode; 386 if (newinode) {
282 if ((oplock & CIFS_CREATE_ACTION) && 387 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)
283 (cifs_sb->mnt_cifs_flags & 388 newinode->i_mode = mode;
284 CIFS_MOUNT_SET_UID)) { 389 if ((oplock & CIFS_CREATE_ACTION) &&
285 newinode->i_uid = current_fsuid(); 390 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) {
286 if (inode->i_mode & S_ISGID) 391 newinode->i_uid = current_fsuid();
287 newinode->i_gid = 392 if (inode->i_mode & S_ISGID)
288 inode->i_gid; 393 newinode->i_gid = inode->i_gid;
289 else 394 else
290 newinode->i_gid = 395 newinode->i_gid = current_fsgid();
291 current_fsgid();
292 }
293 } 396 }
294 } 397 }
398 }
295 399
296 if (rc != 0) { 400cifs_create_set_dentry:
297 cFYI(1, ("Create worked, get_inode_info failed rc = %d", 401 if (rc == 0)
298 rc)); 402 setup_cifs_dentry(tcon, direntry, newinode);
299 } else 403 else
300 setup_cifs_dentry(tcon, direntry, newinode); 404 cFYI(1, ("Create worked, get_inode_info failed rc = %d", rc));
301 405
302 if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || 406 /* nfsd case - nfs srv does not set nd */
303 (!(nd->flags & LOOKUP_OPEN))) { 407 if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) {
304 /* mknod case - do not leave file open */ 408 /* mknod case - do not leave file open */
305 CIFSSMBClose(xid, tcon, fileHandle); 409 CIFSSMBClose(xid, tcon, fileHandle);
306 } else if (newinode) { 410 } else if (newinode) {
307 struct cifsFileInfo *pCifsFile = 411 struct cifsFileInfo *pCifsFile =
308 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); 412 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
309 413
310 if (pCifsFile == NULL) 414 if (pCifsFile == NULL)
311 goto cifs_create_out; 415 goto cifs_create_out;
312 pCifsFile->netfid = fileHandle; 416 pCifsFile->netfid = fileHandle;
313 pCifsFile->pid = current->tgid; 417 pCifsFile->pid = current->tgid;
314 pCifsFile->pInode = newinode; 418 pCifsFile->pInode = newinode;
315 pCifsFile->invalidHandle = false; 419 pCifsFile->invalidHandle = false;
316 pCifsFile->closePend = false; 420 pCifsFile->closePend = false;
317 init_MUTEX(&pCifsFile->fh_sem); 421 init_MUTEX(&pCifsFile->fh_sem);
318 mutex_init(&pCifsFile->lock_mutex); 422 mutex_init(&pCifsFile->lock_mutex);
319 INIT_LIST_HEAD(&pCifsFile->llist); 423 INIT_LIST_HEAD(&pCifsFile->llist);
320 atomic_set(&pCifsFile->wrtPending, 0); 424 atomic_set(&pCifsFile->wrtPending, 0);
321 425
322 /* set the following in open now 426 /* set the following in open now
323 pCifsFile->pfile = file; */ 427 pCifsFile->pfile = file; */
324 write_lock(&GlobalSMBSeslock); 428 write_lock(&GlobalSMBSeslock);
325 list_add(&pCifsFile->tlist, &tcon->openFileList); 429 list_add(&pCifsFile->tlist, &tcon->openFileList);
326 pCifsInode = CIFS_I(newinode); 430 pCifsInode = CIFS_I(newinode);
327 if (pCifsInode) { 431 if (pCifsInode) {
328 /* if readable file instance put first in list*/ 432 /* if readable file instance put first in list*/
329 if (write_only) { 433 if (write_only) {
330 list_add_tail(&pCifsFile->flist, 434 list_add_tail(&pCifsFile->flist,
331 &pCifsInode->openFileList); 435 &pCifsInode->openFileList);
332 } else { 436 } else {
333 list_add(&pCifsFile->flist, 437 list_add(&pCifsFile->flist,
334 &pCifsInode->openFileList); 438 &pCifsInode->openFileList);
335 }
336 if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
337 pCifsInode->clientCanCacheAll = true;
338 pCifsInode->clientCanCacheRead = true;
339 cFYI(1, ("Exclusive Oplock inode %p",
340 newinode));
341 } else if ((oplock & 0xF) == OPLOCK_READ)
342 pCifsInode->clientCanCacheRead = true;
343 } 439 }
344 write_unlock(&GlobalSMBSeslock); 440 if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
441 pCifsInode->clientCanCacheAll = true;
442 pCifsInode->clientCanCacheRead = true;
443 cFYI(1, ("Exclusive Oplock inode %p",
444 newinode));
445 } else if ((oplock & 0xF) == OPLOCK_READ)
446 pCifsInode->clientCanCacheRead = true;
345 } 447 }
448 write_unlock(&GlobalSMBSeslock);
346 } 449 }
347cifs_create_out: 450cifs_create_out:
348 kfree(buf); 451 kfree(buf);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index bcf7b5184664..4690a360c855 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -199,6 +199,49 @@ static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat,
199 pfnd_dat->Gid = cpu_to_le64(pinode->i_gid); 199 pfnd_dat->Gid = cpu_to_le64(pinode->i_gid);
200} 200}
201 201
202/**
203 * cifs_new inode - create new inode, initialize, and hash it
204 * @sb - pointer to superblock
205 * @inum - if valid pointer and serverino is enabled, replace i_ino with val
206 *
207 * Create a new inode, initialize it for CIFS and hash it. Returns the new
208 * inode or NULL if one couldn't be allocated.
209 *
210 * If the share isn't mounted with "serverino" or inum is a NULL pointer then
211 * we'll just use the inode number assigned by new_inode(). Note that this can
212 * mean i_ino collisions since the i_ino assigned by new_inode is not
213 * guaranteed to be unique.
214 */
215struct inode *
216cifs_new_inode(struct super_block *sb, __u64 *inum)
217{
218 struct inode *inode;
219
220 inode = new_inode(sb);
221 if (inode == NULL)
222 return NULL;
223
224 /*
225 * BB: Is i_ino == 0 legal? Here, we assume that it is. If it isn't we
226 * stop passing inum as ptr. Are there sanity checks we can use to
227 * ensure that the server is really filling in that field? Also,
228 * if serverino is disabled, perhaps we should be using iunique()?
229 */
230 if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
231 inode->i_ino = (unsigned long) *inum;
232
233 /*
234 * must set this here instead of cifs_alloc_inode since VFS will
235 * clobber i_flags
236 */
237 if (sb->s_flags & MS_NOATIME)
238 inode->i_flags |= S_NOATIME | S_NOCMTIME;
239
240 insert_inode_hash(inode);
241
242 return inode;
243}
244
202int cifs_get_inode_info_unix(struct inode **pinode, 245int cifs_get_inode_info_unix(struct inode **pinode,
203 const unsigned char *full_path, struct super_block *sb, int xid) 246 const unsigned char *full_path, struct super_block *sb, int xid)
204{ 247{
@@ -233,22 +276,11 @@ int cifs_get_inode_info_unix(struct inode **pinode,
233 276
234 /* get new inode */ 277 /* get new inode */
235 if (*pinode == NULL) { 278 if (*pinode == NULL) {
236 *pinode = new_inode(sb); 279 *pinode = cifs_new_inode(sb, &find_data.UniqueId);
237 if (*pinode == NULL) { 280 if (*pinode == NULL) {
238 rc = -ENOMEM; 281 rc = -ENOMEM;
239 goto cgiiu_exit; 282 goto cgiiu_exit;
240 } 283 }
241 /* Is an i_ino of zero legal? */
242 /* note ino incremented to unique num in new_inode */
243 /* Are there sanity checks we can use to ensure that
244 the server is really filling in that field? */
245 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
246 (*pinode)->i_ino = (unsigned long)find_data.UniqueId;
247
248 if (sb->s_flags & MS_NOATIME)
249 (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME;
250
251 insert_inode_hash(*pinode);
252 } 284 }
253 285
254 inode = *pinode; 286 inode = *pinode;
@@ -465,11 +497,9 @@ int cifs_get_inode_info(struct inode **pinode,
465 497
466 /* get new inode */ 498 /* get new inode */
467 if (*pinode == NULL) { 499 if (*pinode == NULL) {
468 *pinode = new_inode(sb); 500 __u64 inode_num;
469 if (*pinode == NULL) { 501 __u64 *pinum = &inode_num;
470 rc = -ENOMEM; 502
471 goto cgii_exit;
472 }
473 /* Is an i_ino of zero legal? Can we use that to check 503 /* Is an i_ino of zero legal? Can we use that to check
474 if the server supports returning inode numbers? Are 504 if the server supports returning inode numbers? Are
475 there other sanity checks we can use to ensure that 505 there other sanity checks we can use to ensure that
@@ -486,22 +516,26 @@ int cifs_get_inode_info(struct inode **pinode,
486 516
487 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { 517 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
488 int rc1 = 0; 518 int rc1 = 0;
489 __u64 inode_num;
490 519
491 rc1 = CIFSGetSrvInodeNumber(xid, pTcon, 520 rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
492 full_path, &inode_num, 521 full_path, pinum,
493 cifs_sb->local_nls, 522 cifs_sb->local_nls,
494 cifs_sb->mnt_cifs_flags & 523 cifs_sb->mnt_cifs_flags &
495 CIFS_MOUNT_MAP_SPECIAL_CHR); 524 CIFS_MOUNT_MAP_SPECIAL_CHR);
496 if (rc1) { 525 if (rc1) {
497 cFYI(1, ("GetSrvInodeNum rc %d", rc1)); 526 cFYI(1, ("GetSrvInodeNum rc %d", rc1));
527 pinum = NULL;
498 /* BB EOPNOSUPP disable SERVER_INUM? */ 528 /* BB EOPNOSUPP disable SERVER_INUM? */
499 } else /* do we need cast or hash to ino? */ 529 }
500 (*pinode)->i_ino = inode_num; 530 } else {
501 } /* else ino incremented to unique num in new_inode*/ 531 pinum = NULL;
502 if (sb->s_flags & MS_NOATIME) 532 }
503 (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; 533
504 insert_inode_hash(*pinode); 534 *pinode = cifs_new_inode(sb, pinum);
535 if (*pinode == NULL) {
536 rc = -ENOMEM;
537 goto cgii_exit;
538 }
505 } 539 }
506 inode = *pinode; 540 inode = *pinode;
507 cifsInfo = CIFS_I(inode); 541 cifsInfo = CIFS_I(inode);
@@ -621,7 +655,7 @@ static const struct inode_operations cifs_ipc_inode_ops = {
621 .lookup = cifs_lookup, 655 .lookup = cifs_lookup,
622}; 656};
623 657
624static char *build_path_to_root(struct cifs_sb_info *cifs_sb) 658char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb)
625{ 659{
626 int pplen = cifs_sb->prepathlen; 660 int pplen = cifs_sb->prepathlen;
627 int dfsplen; 661 int dfsplen;
@@ -678,7 +712,7 @@ struct inode *cifs_iget(struct super_block *sb, unsigned long ino)
678 return inode; 712 return inode;
679 713
680 cifs_sb = CIFS_SB(inode->i_sb); 714 cifs_sb = CIFS_SB(inode->i_sb);
681 full_path = build_path_to_root(cifs_sb); 715 full_path = cifs_build_path_to_root(cifs_sb);
682 if (full_path == NULL) 716 if (full_path == NULL)
683 return ERR_PTR(-ENOMEM); 717 return ERR_PTR(-ENOMEM);
684 718
@@ -1017,7 +1051,7 @@ out_reval:
1017 return rc; 1051 return rc;
1018} 1052}
1019 1053
1020static void posix_fill_in_inode(struct inode *tmp_inode, 1054void posix_fill_in_inode(struct inode *tmp_inode,
1021 FILE_UNIX_BASIC_INFO *pData, int isNewInode) 1055 FILE_UNIX_BASIC_INFO *pData, int isNewInode)
1022{ 1056{
1023 struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); 1057 struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode);
@@ -1114,24 +1148,14 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1114 else 1148 else
1115 direntry->d_op = &cifs_dentry_ops; 1149 direntry->d_op = &cifs_dentry_ops;
1116 1150
1117 newinode = new_inode(inode->i_sb); 1151 newinode = cifs_new_inode(inode->i_sb,
1152 &pInfo->UniqueId);
1118 if (newinode == NULL) { 1153 if (newinode == NULL) {
1119 kfree(pInfo); 1154 kfree(pInfo);
1120 goto mkdir_get_info; 1155 goto mkdir_get_info;
1121 } 1156 }
1122 1157
1123 /* Is an i_ino of zero legal? */
1124 /* Are there sanity checks we can use to ensure that
1125 the server is really filling in that field? */
1126 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
1127 newinode->i_ino =
1128 (unsigned long)pInfo->UniqueId;
1129 } /* note ino incremented to unique num in new_inode */
1130 if (inode->i_sb->s_flags & MS_NOATIME)
1131 newinode->i_flags |= S_NOATIME | S_NOCMTIME;
1132 newinode->i_nlink = 2; 1158 newinode->i_nlink = 2;
1133
1134 insert_inode_hash(newinode);
1135 d_instantiate(direntry, newinode); 1159 d_instantiate(direntry, newinode);
1136 1160
1137 /* we already checked in POSIXCreate whether 1161 /* we already checked in POSIXCreate whether
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 9f51f9bf0292..c2c01ff4c32c 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -56,35 +56,34 @@ static inline void dump_cifs_file_struct(struct file *file, char *label)
56} 56}
57#endif /* DEBUG2 */ 57#endif /* DEBUG2 */
58 58
59/* Returns one if new inode created (which therefore needs to be hashed) */ 59/* Returns 1 if new inode created, 2 if both dentry and inode were */
60/* Might check in the future if inode number changed so we can rehash inode */ 60/* Might check in the future if inode number changed so we can rehash inode */
61static int construct_dentry(struct qstr *qstring, struct file *file, 61static int
62 struct inode **ptmp_inode, struct dentry **pnew_dentry) 62construct_dentry(struct qstr *qstring, struct file *file,
63 struct inode **ptmp_inode, struct dentry **pnew_dentry,
64 __u64 *inum)
63{ 65{
64 struct dentry *tmp_dentry; 66 struct dentry *tmp_dentry = NULL;
65 struct cifs_sb_info *cifs_sb; 67 struct super_block *sb = file->f_path.dentry->d_sb;
66 struct cifsTconInfo *pTcon;
67 int rc = 0; 68 int rc = 0;
68 69
69 cFYI(1, ("For %s", qstring->name)); 70 cFYI(1, ("For %s", qstring->name));
70 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
71 pTcon = cifs_sb->tcon;
72 71
73 qstring->hash = full_name_hash(qstring->name, qstring->len); 72 qstring->hash = full_name_hash(qstring->name, qstring->len);
74 tmp_dentry = d_lookup(file->f_path.dentry, qstring); 73 tmp_dentry = d_lookup(file->f_path.dentry, qstring);
75 if (tmp_dentry) { 74 if (tmp_dentry) {
75 /* BB: overwrite old name? i.e. tmp_dentry->d_name and
76 * tmp_dentry->d_name.len??
77 */
76 cFYI(0, ("existing dentry with inode 0x%p", 78 cFYI(0, ("existing dentry with inode 0x%p",
77 tmp_dentry->d_inode)); 79 tmp_dentry->d_inode));
78 *ptmp_inode = tmp_dentry->d_inode; 80 *ptmp_inode = tmp_dentry->d_inode;
79/* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/
80 if (*ptmp_inode == NULL) { 81 if (*ptmp_inode == NULL) {
81 *ptmp_inode = new_inode(file->f_path.dentry->d_sb); 82 *ptmp_inode = cifs_new_inode(sb, inum);
82 if (*ptmp_inode == NULL) 83 if (*ptmp_inode == NULL)
83 return rc; 84 return rc;
84 rc = 1; 85 rc = 1;
85 } 86 }
86 if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME)
87 (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME;
88 } else { 87 } else {
89 tmp_dentry = d_alloc(file->f_path.dentry, qstring); 88 tmp_dentry = d_alloc(file->f_path.dentry, qstring);
90 if (tmp_dentry == NULL) { 89 if (tmp_dentry == NULL) {
@@ -93,15 +92,14 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
93 return rc; 92 return rc;
94 } 93 }
95 94
96 *ptmp_inode = new_inode(file->f_path.dentry->d_sb); 95 if (CIFS_SB(sb)->tcon->nocase)
97 if (pTcon->nocase)
98 tmp_dentry->d_op = &cifs_ci_dentry_ops; 96 tmp_dentry->d_op = &cifs_ci_dentry_ops;
99 else 97 else
100 tmp_dentry->d_op = &cifs_dentry_ops; 98 tmp_dentry->d_op = &cifs_dentry_ops;
99
100 *ptmp_inode = cifs_new_inode(sb, inum);
101 if (*ptmp_inode == NULL) 101 if (*ptmp_inode == NULL)
102 return rc; 102 return rc;
103 if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME)
104 (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME;
105 rc = 2; 103 rc = 2;
106 } 104 }
107 105
@@ -822,7 +820,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
822/* inode num, inode type and filename returned */ 820/* inode num, inode type and filename returned */
823static int cifs_get_name_from_search_buf(struct qstr *pqst, 821static int cifs_get_name_from_search_buf(struct qstr *pqst,
824 char *current_entry, __u16 level, unsigned int unicode, 822 char *current_entry, __u16 level, unsigned int unicode,
825 struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum) 823 struct cifs_sb_info *cifs_sb, int max_len, __u64 *pinum)
826{ 824{
827 int rc = 0; 825 int rc = 0;
828 unsigned int len = 0; 826 unsigned int len = 0;
@@ -842,9 +840,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
842 len = strnlen(filename, PATH_MAX); 840 len = strnlen(filename, PATH_MAX);
843 } 841 }
844 842
845 /* BB fixme - hash low and high 32 bits if not 64 bit arch BB */ 843 *pinum = pFindData->UniqueId;
846 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
847 *pinum = pFindData->UniqueId;
848 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { 844 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
849 FILE_DIRECTORY_INFO *pFindData = 845 FILE_DIRECTORY_INFO *pFindData =
850 (FILE_DIRECTORY_INFO *)current_entry; 846 (FILE_DIRECTORY_INFO *)current_entry;
@@ -907,7 +903,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
907 struct qstr qstring; 903 struct qstr qstring;
908 struct cifsFileInfo *pCifsF; 904 struct cifsFileInfo *pCifsF;
909 unsigned int obj_type; 905 unsigned int obj_type;
910 ino_t inum; 906 __u64 inum;
911 struct cifs_sb_info *cifs_sb; 907 struct cifs_sb_info *cifs_sb;
912 struct inode *tmp_inode; 908 struct inode *tmp_inode;
913 struct dentry *tmp_dentry; 909 struct dentry *tmp_dentry;
@@ -940,20 +936,18 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
940 if (rc) 936 if (rc)
941 return rc; 937 return rc;
942 938
943 rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry); 939 /* only these two infolevels return valid inode numbers */
940 if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX ||
941 pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO)
942 rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry,
943 &inum);
944 else
945 rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry,
946 NULL);
947
944 if ((tmp_inode == NULL) || (tmp_dentry == NULL)) 948 if ((tmp_inode == NULL) || (tmp_dentry == NULL))
945 return -ENOMEM; 949 return -ENOMEM;
946 950
947 if (rc) {
948 /* inode created, we need to hash it with right inode number */
949 if (inum != 0) {
950 /* BB fixme - hash the 2 32 quantities bits together if
951 * necessary BB */
952 tmp_inode->i_ino = inum;
953 }
954 insert_inode_hash(tmp_inode);
955 }
956
957 /* we pass in rc below, indicating whether it is a new inode, 951 /* we pass in rc below, indicating whether it is a new inode,
958 so we can figure out whether to invalidate the inode cached 952 so we can figure out whether to invalidate the inode cached
959 data if the file has changed */ 953 data if the file has changed */
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 5f22de7b79a9..5c68b4282be9 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -34,15 +34,99 @@
34extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, 34extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
35 unsigned char *p24); 35 unsigned char *p24);
36 36
37/* Checks if this is the first smb session to be reconnected after
38 the socket has been reestablished (so we know whether to use vc 0).
39 Called while holding the cifs_tcp_ses_lock, so do not block */
40static bool is_first_ses_reconnect(struct cifsSesInfo *ses)
41{
42 struct list_head *tmp;
43 struct cifsSesInfo *tmp_ses;
44
45 list_for_each(tmp, &ses->server->smb_ses_list) {
46 tmp_ses = list_entry(tmp, struct cifsSesInfo,
47 smb_ses_list);
48 if (tmp_ses->need_reconnect == false)
49 return false;
50 }
51 /* could not find a session that was already connected,
52 this must be the first one we are reconnecting */
53 return true;
54}
55
56/*
57 * vc number 0 is treated specially by some servers, and should be the
58 * first one we request. After that we can use vcnumbers up to maxvcs,
59 * one for each smb session (some Windows versions set maxvcs incorrectly
60 * so maxvc=1 can be ignored). If we have too many vcs, we can reuse
61 * any vc but zero (some servers reset the connection on vcnum zero)
62 *
63 */
64static __le16 get_next_vcnum(struct cifsSesInfo *ses)
65{
66 __u16 vcnum = 0;
67 struct list_head *tmp;
68 struct cifsSesInfo *tmp_ses;
69 __u16 max_vcs = ses->server->max_vcs;
70 __u16 i;
71 int free_vc_found = 0;
72
73 /* Quoting the MS-SMB specification: "Windows-based SMB servers set this
74 field to one but do not enforce this limit, which allows an SMB client
75 to establish more virtual circuits than allowed by this value ... but
76 other server implementations can enforce this limit." */
77 if (max_vcs < 2)
78 max_vcs = 0xFFFF;
79
80 write_lock(&cifs_tcp_ses_lock);
81 if ((ses->need_reconnect) && is_first_ses_reconnect(ses))
82 goto get_vc_num_exit; /* vcnum will be zero */
83 for (i = ses->server->srv_count - 1; i < max_vcs; i++) {
84 if (i == 0) /* this is the only connection, use vc 0 */
85 break;
86
87 free_vc_found = 1;
88
89 list_for_each(tmp, &ses->server->smb_ses_list) {
90 tmp_ses = list_entry(tmp, struct cifsSesInfo,
91 smb_ses_list);
92 if (tmp_ses->vcnum == i) {
93 free_vc_found = 0;
94 break; /* found duplicate, try next vcnum */
95 }
96 }
97 if (free_vc_found)
98 break; /* we found a vcnumber that will work - use it */
99 }
100
101 if (i == 0)
102 vcnum = 0; /* for most common case, ie if one smb session, use
103 vc zero. Also for case when no free vcnum, zero
104 is safest to send (some clients only send zero) */
105 else if (free_vc_found == 0)
106 vcnum = 1; /* we can not reuse vc=0 safely, since some servers
107 reset all uids on that, but 1 is ok. */
108 else
109 vcnum = i;
110 ses->vcnum = vcnum;
111get_vc_num_exit:
112 write_unlock(&cifs_tcp_ses_lock);
113
114 return le16_to_cpu(vcnum);
115}
116
37static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) 117static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
38{ 118{
39 __u32 capabilities = 0; 119 __u32 capabilities = 0;
40 120
41 /* init fields common to all four types of SessSetup */ 121 /* init fields common to all four types of SessSetup */
42 /* note that header is initialized to zero in header_assemble */ 122 /* Note that offsets for first seven fields in req struct are same */
123 /* in CIFS Specs so does not matter which of 3 forms of struct */
124 /* that we use in next few lines */
125 /* Note that header is initialized to zero in header_assemble */
43 pSMB->req.AndXCommand = 0xFF; 126 pSMB->req.AndXCommand = 0xFF;
44 pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); 127 pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
45 pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); 128 pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
129 pSMB->req.VcNumber = get_next_vcnum(ses);
46 130
47 /* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */ 131 /* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */
48 132
@@ -71,7 +155,6 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
71 if (ses->capabilities & CAP_UNIX) 155 if (ses->capabilities & CAP_UNIX)
72 capabilities |= CAP_UNIX; 156 capabilities |= CAP_UNIX;
73 157
74 /* BB check whether to init vcnum BB */
75 return capabilities; 158 return capabilities;
76} 159}
77 160
@@ -228,7 +311,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
228 311
229 kfree(ses->serverOS); 312 kfree(ses->serverOS);
230 /* UTF-8 string will not grow more than four times as big as UCS-16 */ 313 /* UTF-8 string will not grow more than four times as big as UCS-16 */
231 ses->serverOS = kzalloc(4 * len, GFP_KERNEL); 314 ses->serverOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
232 if (ses->serverOS != NULL) 315 if (ses->serverOS != NULL)
233 cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp); 316 cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp);
234 data += 2 * (len + 1); 317 data += 2 * (len + 1);
@@ -241,7 +324,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
241 return rc; 324 return rc;
242 325
243 kfree(ses->serverNOS); 326 kfree(ses->serverNOS);
244 ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */ 327 ses->serverNOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
245 if (ses->serverNOS != NULL) { 328 if (ses->serverNOS != NULL) {
246 cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len, 329 cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len,
247 nls_cp); 330 nls_cp);
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 9c6d815dd191..45e59d3c7f1f 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1913,6 +1913,9 @@ COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */
1913/* 0x00 */ 1913/* 0x00 */
1914COMPATIBLE_IOCTL(FIBMAP) 1914COMPATIBLE_IOCTL(FIBMAP)
1915COMPATIBLE_IOCTL(FIGETBSZ) 1915COMPATIBLE_IOCTL(FIGETBSZ)
1916/* 'X' - originally XFS but some now in the VFS */
1917COMPATIBLE_IOCTL(FIFREEZE)
1918COMPATIBLE_IOCTL(FITHAW)
1916/* RAID */ 1919/* RAID */
1917COMPATIBLE_IOCTL(RAID_VERSION) 1920COMPATIBLE_IOCTL(RAID_VERSION)
1918COMPATIBLE_IOCTL(GET_ARRAY_INFO) 1921COMPATIBLE_IOCTL(GET_ARRAY_INFO)
@@ -1938,6 +1941,8 @@ ULONG_IOCTL(SET_BITMAP_FILE)
1938/* Big K */ 1941/* Big K */
1939COMPATIBLE_IOCTL(PIO_FONT) 1942COMPATIBLE_IOCTL(PIO_FONT)
1940COMPATIBLE_IOCTL(GIO_FONT) 1943COMPATIBLE_IOCTL(GIO_FONT)
1944COMPATIBLE_IOCTL(PIO_CMAP)
1945COMPATIBLE_IOCTL(GIO_CMAP)
1941ULONG_IOCTL(KDSIGACCEPT) 1946ULONG_IOCTL(KDSIGACCEPT)
1942COMPATIBLE_IOCTL(KDGETKEYCODE) 1947COMPATIBLE_IOCTL(KDGETKEYCODE)
1943COMPATIBLE_IOCTL(KDSETKEYCODE) 1948COMPATIBLE_IOCTL(KDSETKEYCODE)
diff --git a/fs/dcache.c b/fs/dcache.c
index 937df0fb0da5..07e2d4a44bda 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1180,7 +1180,7 @@ struct dentry *d_obtain_alias(struct inode *inode)
1180 iput(inode); 1180 iput(inode);
1181 return res; 1181 return res;
1182} 1182}
1183EXPORT_SYMBOL_GPL(d_obtain_alias); 1183EXPORT_SYMBOL(d_obtain_alias);
1184 1184
1185/** 1185/**
1186 * d_splice_alias - splice a disconnected dentry into the tree if one exists 1186 * d_splice_alias - splice a disconnected dentry into the tree if one exists
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 5f3231b9633f..bff4052b05e7 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -198,9 +198,6 @@ static int mknod_ptmx(struct super_block *sb)
198 198
199 fsi->ptmx_dentry = dentry; 199 fsi->ptmx_dentry = dentry;
200 rc = 0; 200 rc = 0;
201
202 printk(KERN_DEBUG "Created ptmx node in devpts ino %lu\n",
203 inode->i_ino);
204out: 201out:
205 mutex_unlock(&root->d_inode->i_mutex); 202 mutex_unlock(&root->d_inode->i_mutex);
206 return rc; 203 return rc;
@@ -369,8 +366,6 @@ static int new_pts_mount(struct file_system_type *fs_type, int flags,
369 struct pts_fs_info *fsi; 366 struct pts_fs_info *fsi;
370 struct pts_mount_opts *opts; 367 struct pts_mount_opts *opts;
371 368
372 printk(KERN_NOTICE "devpts: newinstance mount\n");
373
374 err = get_sb_nodev(fs_type, flags, data, devpts_fill_super, mnt); 369 err = get_sb_nodev(fs_type, flags, data, devpts_fill_super, mnt);
375 if (err) 370 if (err)
376 return err; 371 return err;
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index f6caeb1d1106..bdca1f4b3a3e 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -946,6 +946,8 @@ static int ecryptfs_copy_mount_wide_sigs_to_inode_sigs(
946 list_for_each_entry(global_auth_tok, 946 list_for_each_entry(global_auth_tok,
947 &mount_crypt_stat->global_auth_tok_list, 947 &mount_crypt_stat->global_auth_tok_list,
948 mount_crypt_stat_list) { 948 mount_crypt_stat_list) {
949 if (global_auth_tok->flags & ECRYPTFS_AUTH_TOK_FNEK)
950 continue;
949 rc = ecryptfs_add_keysig(crypt_stat, global_auth_tok->sig); 951 rc = ecryptfs_add_keysig(crypt_stat, global_auth_tok->sig);
950 if (rc) { 952 if (rc) {
951 printk(KERN_ERR "Error adding keysig; rc = [%d]\n", rc); 953 printk(KERN_ERR "Error adding keysig; rc = [%d]\n", rc);
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index c11fc95714ab..eb2267eca1fe 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -328,6 +328,7 @@ struct ecryptfs_dentry_info {
328 */ 328 */
329struct ecryptfs_global_auth_tok { 329struct ecryptfs_global_auth_tok {
330#define ECRYPTFS_AUTH_TOK_INVALID 0x00000001 330#define ECRYPTFS_AUTH_TOK_INVALID 0x00000001
331#define ECRYPTFS_AUTH_TOK_FNEK 0x00000002
331 u32 flags; 332 u32 flags;
332 struct list_head mount_crypt_stat_list; 333 struct list_head mount_crypt_stat_list;
333 struct key *global_auth_tok_key; 334 struct key *global_auth_tok_key;
@@ -696,7 +697,7 @@ ecryptfs_write_header_metadata(char *virt,
696int ecryptfs_add_keysig(struct ecryptfs_crypt_stat *crypt_stat, char *sig); 697int ecryptfs_add_keysig(struct ecryptfs_crypt_stat *crypt_stat, char *sig);
697int 698int
698ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat, 699ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
699 char *sig); 700 char *sig, u32 global_auth_tok_flags);
700int ecryptfs_get_global_auth_tok_for_sig( 701int ecryptfs_get_global_auth_tok_for_sig(
701 struct ecryptfs_global_auth_tok **global_auth_tok, 702 struct ecryptfs_global_auth_tok **global_auth_tok,
702 struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig); 703 struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig);
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index ff539420cc6f..e4a6223c3145 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -2375,7 +2375,7 @@ struct kmem_cache *ecryptfs_global_auth_tok_cache;
2375 2375
2376int 2376int
2377ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat, 2377ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
2378 char *sig) 2378 char *sig, u32 global_auth_tok_flags)
2379{ 2379{
2380 struct ecryptfs_global_auth_tok *new_auth_tok; 2380 struct ecryptfs_global_auth_tok *new_auth_tok;
2381 int rc = 0; 2381 int rc = 0;
@@ -2389,6 +2389,7 @@ ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
2389 goto out; 2389 goto out;
2390 } 2390 }
2391 memcpy(new_auth_tok->sig, sig, ECRYPTFS_SIG_SIZE_HEX); 2391 memcpy(new_auth_tok->sig, sig, ECRYPTFS_SIG_SIZE_HEX);
2392 new_auth_tok->flags = global_auth_tok_flags;
2392 new_auth_tok->sig[ECRYPTFS_SIG_SIZE_HEX] = '\0'; 2393 new_auth_tok->sig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
2393 mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex); 2394 mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
2394 list_add(&new_auth_tok->mount_crypt_stat_list, 2395 list_add(&new_auth_tok->mount_crypt_stat_list,
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 789cf2e1be1e..aed56c25539b 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -319,7 +319,7 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
319 case ecryptfs_opt_ecryptfs_sig: 319 case ecryptfs_opt_ecryptfs_sig:
320 sig_src = args[0].from; 320 sig_src = args[0].from;
321 rc = ecryptfs_add_global_auth_tok(mount_crypt_stat, 321 rc = ecryptfs_add_global_auth_tok(mount_crypt_stat,
322 sig_src); 322 sig_src, 0);
323 if (rc) { 323 if (rc) {
324 printk(KERN_ERR "Error attempting to register " 324 printk(KERN_ERR "Error attempting to register "
325 "global sig; rc = [%d]\n", rc); 325 "global sig; rc = [%d]\n", rc);
@@ -370,7 +370,8 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
370 ECRYPTFS_SIG_SIZE_HEX] = '\0'; 370 ECRYPTFS_SIG_SIZE_HEX] = '\0';
371 rc = ecryptfs_add_global_auth_tok( 371 rc = ecryptfs_add_global_auth_tok(
372 mount_crypt_stat, 372 mount_crypt_stat,
373 mount_crypt_stat->global_default_fnek_sig); 373 mount_crypt_stat->global_default_fnek_sig,
374 ECRYPTFS_AUTH_TOK_FNEK);
374 if (rc) { 375 if (rc) {
375 printk(KERN_ERR "Error attempting to register " 376 printk(KERN_ERR "Error attempting to register "
376 "global fnek sig [%s]; rc = [%d]\n", 377 "global fnek sig [%s]; rc = [%d]\n",
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 9a50b8052dcf..de9459b4cb94 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -609,7 +609,9 @@ int ext4_claim_free_blocks(struct ext4_sb_info *sbi,
609 */ 609 */
610int ext4_should_retry_alloc(struct super_block *sb, int *retries) 610int ext4_should_retry_alloc(struct super_block *sb, int *retries)
611{ 611{
612 if (!ext4_has_free_blocks(EXT4_SB(sb), 1) || (*retries)++ > 3) 612 if (!ext4_has_free_blocks(EXT4_SB(sb), 1) ||
613 (*retries)++ > 3 ||
614 !EXT4_SB(sb)->s_journal)
613 return 0; 615 return 0;
614 616
615 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); 617 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index aafc9eba1c25..b0c87dce66a3 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -868,7 +868,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
868{ 868{
869 unsigned len = le16_to_cpu(dlen); 869 unsigned len = le16_to_cpu(dlen);
870 870
871 if (len == EXT4_MAX_REC_LEN) 871 if (len == EXT4_MAX_REC_LEN || len == 0)
872 return 1 << 16; 872 return 1 << 16;
873 return len; 873 return len;
874} 874}
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 4fb86a0061d0..627f8c3337a3 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -188,7 +188,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
188 struct ext4_group_desc *gdp; 188 struct ext4_group_desc *gdp;
189 struct ext4_super_block *es; 189 struct ext4_super_block *es;
190 struct ext4_sb_info *sbi; 190 struct ext4_sb_info *sbi;
191 int fatal = 0, err, count; 191 int fatal = 0, err, count, cleared;
192 ext4_group_t flex_group; 192 ext4_group_t flex_group;
193 193
194 if (atomic_read(&inode->i_count) > 1) { 194 if (atomic_read(&inode->i_count) > 1) {
@@ -248,8 +248,10 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
248 goto error_return; 248 goto error_return;
249 249
250 /* Ok, now we can actually update the inode bitmaps.. */ 250 /* Ok, now we can actually update the inode bitmaps.. */
251 if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group), 251 spin_lock(sb_bgl_lock(sbi, block_group));
252 bit, bitmap_bh->b_data)) 252 cleared = ext4_clear_bit(bit, bitmap_bh->b_data);
253 spin_unlock(sb_bgl_lock(sbi, block_group));
254 if (!cleared)
253 ext4_error(sb, "ext4_free_inode", 255 ext4_error(sb, "ext4_free_inode",
254 "bit already cleared for inode %lu", ino); 256 "bit already cleared for inode %lu", ino);
255 else { 257 else {
@@ -715,6 +717,13 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
715 717
716 if (sbi->s_log_groups_per_flex) { 718 if (sbi->s_log_groups_per_flex) {
717 ret2 = find_group_flex(sb, dir, &group); 719 ret2 = find_group_flex(sb, dir, &group);
720 if (ret2 == -1) {
721 ret2 = find_group_other(sb, dir, &group);
722 if (ret2 == 0 && printk_ratelimit())
723 printk(KERN_NOTICE "ext4: find_group_flex "
724 "failed, fallback succeeded dir %lu\n",
725 dir->i_ino);
726 }
718 goto got_group; 727 goto got_group;
719 } 728 }
720 729
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 03ba20be1329..c7fed5b18745 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -47,8 +47,10 @@
47static inline int ext4_begin_ordered_truncate(struct inode *inode, 47static inline int ext4_begin_ordered_truncate(struct inode *inode,
48 loff_t new_size) 48 loff_t new_size)
49{ 49{
50 return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode, 50 return jbd2_journal_begin_ordered_truncate(
51 new_size); 51 EXT4_SB(inode->i_sb)->s_journal,
52 &EXT4_I(inode)->jinode,
53 new_size);
52} 54}
53 55
54static void ext4_invalidatepage(struct page *page, unsigned long offset); 56static void ext4_invalidatepage(struct page *page, unsigned long offset);
@@ -1366,6 +1368,10 @@ retry:
1366 goto out; 1368 goto out;
1367 } 1369 }
1368 1370
1371 /* We cannot recurse into the filesystem as the transaction is already
1372 * started */
1373 flags |= AOP_FLAG_NOFS;
1374
1369 page = grab_cache_page_write_begin(mapping, index, flags); 1375 page = grab_cache_page_write_begin(mapping, index, flags);
1370 if (!page) { 1376 if (!page) {
1371 ext4_journal_stop(handle); 1377 ext4_journal_stop(handle);
@@ -1375,7 +1381,7 @@ retry:
1375 *pagep = page; 1381 *pagep = page;
1376 1382
1377 ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, 1383 ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
1378 ext4_get_block); 1384 ext4_get_block);
1379 1385
1380 if (!ret && ext4_should_journal_data(inode)) { 1386 if (!ret && ext4_should_journal_data(inode)) {
1381 ret = walk_page_buffers(handle, page_buffers(page), 1387 ret = walk_page_buffers(handle, page_buffers(page),
@@ -2437,6 +2443,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2437 int no_nrwrite_index_update; 2443 int no_nrwrite_index_update;
2438 int pages_written = 0; 2444 int pages_written = 0;
2439 long pages_skipped; 2445 long pages_skipped;
2446 int range_cyclic, cycled = 1, io_done = 0;
2440 int needed_blocks, ret = 0, nr_to_writebump = 0; 2447 int needed_blocks, ret = 0, nr_to_writebump = 0;
2441 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); 2448 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2442 2449
@@ -2488,9 +2495,15 @@ static int ext4_da_writepages(struct address_space *mapping,
2488 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) 2495 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
2489 range_whole = 1; 2496 range_whole = 1;
2490 2497
2491 if (wbc->range_cyclic) 2498 range_cyclic = wbc->range_cyclic;
2499 if (wbc->range_cyclic) {
2492 index = mapping->writeback_index; 2500 index = mapping->writeback_index;
2493 else 2501 if (index)
2502 cycled = 0;
2503 wbc->range_start = index << PAGE_CACHE_SHIFT;
2504 wbc->range_end = LLONG_MAX;
2505 wbc->range_cyclic = 0;
2506 } else
2494 index = wbc->range_start >> PAGE_CACHE_SHIFT; 2507 index = wbc->range_start >> PAGE_CACHE_SHIFT;
2495 2508
2496 mpd.wbc = wbc; 2509 mpd.wbc = wbc;
@@ -2504,6 +2517,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2504 wbc->no_nrwrite_index_update = 1; 2517 wbc->no_nrwrite_index_update = 1;
2505 pages_skipped = wbc->pages_skipped; 2518 pages_skipped = wbc->pages_skipped;
2506 2519
2520retry:
2507 while (!ret && wbc->nr_to_write > 0) { 2521 while (!ret && wbc->nr_to_write > 0) {
2508 2522
2509 /* 2523 /*
@@ -2530,7 +2544,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2530 2544
2531 ext4_journal_stop(handle); 2545 ext4_journal_stop(handle);
2532 2546
2533 if (mpd.retval == -ENOSPC) { 2547 if ((mpd.retval == -ENOSPC) && sbi->s_journal) {
2534 /* commit the transaction which would 2548 /* commit the transaction which would
2535 * free blocks released in the transaction 2549 * free blocks released in the transaction
2536 * and try again 2550 * and try again
@@ -2546,6 +2560,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2546 pages_written += mpd.pages_written; 2560 pages_written += mpd.pages_written;
2547 wbc->pages_skipped = pages_skipped; 2561 wbc->pages_skipped = pages_skipped;
2548 ret = 0; 2562 ret = 0;
2563 io_done = 1;
2549 } else if (wbc->nr_to_write) 2564 } else if (wbc->nr_to_write)
2550 /* 2565 /*
2551 * There is no more writeout needed 2566 * There is no more writeout needed
@@ -2554,6 +2569,13 @@ static int ext4_da_writepages(struct address_space *mapping,
2554 */ 2569 */
2555 break; 2570 break;
2556 } 2571 }
2572 if (!io_done && !cycled) {
2573 cycled = 1;
2574 index = 0;
2575 wbc->range_start = index << PAGE_CACHE_SHIFT;
2576 wbc->range_end = mapping->writeback_index - 1;
2577 goto retry;
2578 }
2557 if (pages_skipped != wbc->pages_skipped) 2579 if (pages_skipped != wbc->pages_skipped)
2558 printk(KERN_EMERG "This should not happen leaving %s " 2580 printk(KERN_EMERG "This should not happen leaving %s "
2559 "with nr_to_write = %ld ret = %d\n", 2581 "with nr_to_write = %ld ret = %d\n",
@@ -2561,6 +2583,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2561 2583
2562 /* Update index */ 2584 /* Update index */
2563 index += pages_written; 2585 index += pages_written;
2586 wbc->range_cyclic = range_cyclic;
2564 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) 2587 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
2565 /* 2588 /*
2566 * set the writeback_index so that range_cyclic 2589 * set the writeback_index so that range_cyclic
@@ -2648,6 +2671,9 @@ retry:
2648 ret = PTR_ERR(handle); 2671 ret = PTR_ERR(handle);
2649 goto out; 2672 goto out;
2650 } 2673 }
2674 /* We cannot recurse into the filesystem as the transaction is already
2675 * started */
2676 flags |= AOP_FLAG_NOFS;
2651 2677
2652 page = grab_cache_page_write_begin(mapping, index, flags); 2678 page = grab_cache_page_write_begin(mapping, index, flags);
2653 if (!page) { 2679 if (!page) {
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index deba54f6cbed..4415beeb0b62 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3693,6 +3693,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
3693 pa->pa_free = pa->pa_len; 3693 pa->pa_free = pa->pa_len;
3694 atomic_set(&pa->pa_count, 1); 3694 atomic_set(&pa->pa_count, 1);
3695 spin_lock_init(&pa->pa_lock); 3695 spin_lock_init(&pa->pa_lock);
3696 INIT_LIST_HEAD(&pa->pa_inode_list);
3697 INIT_LIST_HEAD(&pa->pa_group_list);
3696 pa->pa_deleted = 0; 3698 pa->pa_deleted = 0;
3697 pa->pa_linear = 0; 3699 pa->pa_linear = 0;
3698 3700
@@ -3755,6 +3757,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
3755 atomic_set(&pa->pa_count, 1); 3757 atomic_set(&pa->pa_count, 1);
3756 spin_lock_init(&pa->pa_lock); 3758 spin_lock_init(&pa->pa_lock);
3757 INIT_LIST_HEAD(&pa->pa_inode_list); 3759 INIT_LIST_HEAD(&pa->pa_inode_list);
3760 INIT_LIST_HEAD(&pa->pa_group_list);
3758 pa->pa_deleted = 0; 3761 pa->pa_deleted = 0;
3759 pa->pa_linear = 1; 3762 pa->pa_linear = 1;
3760 3763
@@ -4476,23 +4479,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
4476 pa->pa_free -= ac->ac_b_ex.fe_len; 4479 pa->pa_free -= ac->ac_b_ex.fe_len;
4477 pa->pa_len -= ac->ac_b_ex.fe_len; 4480 pa->pa_len -= ac->ac_b_ex.fe_len;
4478 spin_unlock(&pa->pa_lock); 4481 spin_unlock(&pa->pa_lock);
4479 /*
4480 * We want to add the pa to the right bucket.
4481 * Remove it from the list and while adding
4482 * make sure the list to which we are adding
4483 * doesn't grow big.
4484 */
4485 if (likely(pa->pa_free)) {
4486 spin_lock(pa->pa_obj_lock);
4487 list_del_rcu(&pa->pa_inode_list);
4488 spin_unlock(pa->pa_obj_lock);
4489 ext4_mb_add_n_trim(ac);
4490 }
4491 } 4482 }
4492 ext4_mb_put_pa(ac, ac->ac_sb, pa);
4493 } 4483 }
4494 if (ac->alloc_semp) 4484 if (ac->alloc_semp)
4495 up_read(ac->alloc_semp); 4485 up_read(ac->alloc_semp);
4486 if (pa) {
4487 /*
4488 * We want to add the pa to the right bucket.
4489 * Remove it from the list and while adding
4490 * make sure the list to which we are adding
4491 * doesn't grow big. We need to release
4492 * alloc_semp before calling ext4_mb_add_n_trim()
4493 */
4494 if (pa->pa_linear && likely(pa->pa_free)) {
4495 spin_lock(pa->pa_obj_lock);
4496 list_del_rcu(&pa->pa_inode_list);
4497 spin_unlock(pa->pa_obj_lock);
4498 ext4_mb_add_n_trim(ac);
4499 }
4500 ext4_mb_put_pa(ac, ac->ac_sb, pa);
4501 }
4496 if (ac->ac_bitmap_page) 4502 if (ac->ac_bitmap_page)
4497 page_cache_release(ac->ac_bitmap_page); 4503 page_cache_release(ac->ac_bitmap_page);
4498 if (ac->ac_buddy_page) 4504 if (ac->ac_buddy_page)
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index 734abca25e35..fe64d9f79852 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -481,7 +481,7 @@ int ext4_ext_migrate(struct inode *inode)
481 + 1); 481 + 1);
482 if (IS_ERR(handle)) { 482 if (IS_ERR(handle)) {
483 retval = PTR_ERR(handle); 483 retval = PTR_ERR(handle);
484 goto err_out; 484 return retval;
485 } 485 }
486 tmp_inode = ext4_new_inode(handle, 486 tmp_inode = ext4_new_inode(handle,
487 inode->i_sb->s_root->d_inode, 487 inode->i_sb->s_root->d_inode,
@@ -489,8 +489,7 @@ int ext4_ext_migrate(struct inode *inode)
489 if (IS_ERR(tmp_inode)) { 489 if (IS_ERR(tmp_inode)) {
490 retval = -ENOMEM; 490 retval = -ENOMEM;
491 ext4_journal_stop(handle); 491 ext4_journal_stop(handle);
492 tmp_inode = NULL; 492 return retval;
493 goto err_out;
494 } 493 }
495 i_size_write(tmp_inode, i_size_read(inode)); 494 i_size_write(tmp_inode, i_size_read(inode));
496 /* 495 /*
@@ -618,8 +617,7 @@ err_out:
618 617
619 ext4_journal_stop(handle); 618 ext4_journal_stop(handle);
620 619
621 if (tmp_inode) 620 iput(tmp_inode);
622 iput(tmp_inode);
623 621
624 return retval; 622 return retval;
625} 623}
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e5f06a5f045e..39d1993cfa13 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3046,14 +3046,17 @@ static void ext4_write_super(struct super_block *sb)
3046static int ext4_sync_fs(struct super_block *sb, int wait) 3046static int ext4_sync_fs(struct super_block *sb, int wait)
3047{ 3047{
3048 int ret = 0; 3048 int ret = 0;
3049 tid_t target;
3049 3050
3050 trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); 3051 trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
3051 sb->s_dirt = 0; 3052 sb->s_dirt = 0;
3052 if (EXT4_SB(sb)->s_journal) { 3053 if (EXT4_SB(sb)->s_journal) {
3053 if (wait) 3054 if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal,
3054 ret = ext4_force_commit(sb); 3055 &target)) {
3055 else 3056 if (wait)
3056 jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL); 3057 jbd2_log_wait_commit(EXT4_SB(sb)->s_journal,
3058 target);
3059 }
3057 } else { 3060 } else {
3058 ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); 3061 ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait);
3059 } 3062 }
@@ -3088,7 +3091,6 @@ static int ext4_freeze(struct super_block *sb)
3088 3091
3089 /* Journal blocked and flushed, clear needs_recovery flag. */ 3092 /* Journal blocked and flushed, clear needs_recovery flag. */
3090 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); 3093 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
3091 ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
3092 error = ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1); 3094 error = ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
3093 if (error) 3095 if (error)
3094 goto out; 3096 goto out;
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 6b74d09adbe5..de0004fe6e00 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -202,9 +202,9 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
202 sector_t blocknr; 202 sector_t blocknr;
203 203
204 /* fat_get_cluster() assumes the requested blocknr isn't truncated. */ 204 /* fat_get_cluster() assumes the requested blocknr isn't truncated. */
205 mutex_lock(&mapping->host->i_mutex); 205 down_read(&mapping->host->i_alloc_sem);
206 blocknr = generic_block_bmap(mapping, block, fat_get_block); 206 blocknr = generic_block_bmap(mapping, block, fat_get_block);
207 mutex_unlock(&mapping->host->i_mutex); 207 up_read(&mapping->host->i_alloc_sem);
208 208
209 return blocknr; 209 return blocknr;
210} 210}
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index e5eaa62fd17f..e3fe9918faaf 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -274,6 +274,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
274 int ret; 274 int ret;
275 275
276 BUG_ON(inode->i_state & I_SYNC); 276 BUG_ON(inode->i_state & I_SYNC);
277 WARN_ON(inode->i_state & I_NEW);
277 278
278 /* Set I_SYNC, reset I_DIRTY */ 279 /* Set I_SYNC, reset I_DIRTY */
279 dirty = inode->i_state & I_DIRTY; 280 dirty = inode->i_state & I_DIRTY;
@@ -298,6 +299,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
298 } 299 }
299 300
300 spin_lock(&inode_lock); 301 spin_lock(&inode_lock);
302 WARN_ON(inode->i_state & I_NEW);
301 inode->i_state &= ~I_SYNC; 303 inode->i_state &= ~I_SYNC;
302 if (!(inode->i_state & I_FREEING)) { 304 if (!(inode->i_state & I_FREEING)) {
303 if (!(inode->i_state & I_DIRTY) && 305 if (!(inode->i_state & I_DIRTY) &&
@@ -470,6 +472,11 @@ void generic_sync_sb_inodes(struct super_block *sb,
470 break; 472 break;
471 } 473 }
472 474
475 if (inode->i_state & I_NEW) {
476 requeue_io(inode);
477 continue;
478 }
479
473 if (wbc->nonblocking && bdi_write_congested(bdi)) { 480 if (wbc->nonblocking && bdi_write_congested(bdi)) {
474 wbc->encountered_congestion = 1; 481 wbc->encountered_congestion = 1;
475 if (!sb_is_blkdev_sb(sb)) 482 if (!sb_is_blkdev_sb(sb))
@@ -531,7 +538,7 @@ void generic_sync_sb_inodes(struct super_block *sb,
531 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 538 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
532 struct address_space *mapping; 539 struct address_space *mapping;
533 540
534 if (inode->i_state & (I_FREEING|I_WILL_FREE)) 541 if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW))
535 continue; 542 continue;
536 mapping = inode->i_mapping; 543 mapping = inode->i_mapping;
537 if (mapping->nrpages == 0) 544 if (mapping->nrpages == 0)
diff --git a/fs/inode.c b/fs/inode.c
index 913ab2d9a5d1..826fb0b9d1c3 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -359,6 +359,7 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
359 invalidate_inode_buffers(inode); 359 invalidate_inode_buffers(inode);
360 if (!atomic_read(&inode->i_count)) { 360 if (!atomic_read(&inode->i_count)) {
361 list_move(&inode->i_list, dispose); 361 list_move(&inode->i_list, dispose);
362 WARN_ON(inode->i_state & I_NEW);
362 inode->i_state |= I_FREEING; 363 inode->i_state |= I_FREEING;
363 count++; 364 count++;
364 continue; 365 continue;
@@ -460,6 +461,7 @@ static void prune_icache(int nr_to_scan)
460 continue; 461 continue;
461 } 462 }
462 list_move(&inode->i_list, &freeable); 463 list_move(&inode->i_list, &freeable);
464 WARN_ON(inode->i_state & I_NEW);
463 inode->i_state |= I_FREEING; 465 inode->i_state |= I_FREEING;
464 nr_pruned++; 466 nr_pruned++;
465 } 467 }
@@ -656,6 +658,7 @@ void unlock_new_inode(struct inode *inode)
656 * just created it (so there can be no old holders 658 * just created it (so there can be no old holders
657 * that haven't tested I_LOCK). 659 * that haven't tested I_LOCK).
658 */ 660 */
661 WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW));
659 inode->i_state &= ~(I_LOCK|I_NEW); 662 inode->i_state &= ~(I_LOCK|I_NEW);
660 wake_up_inode(inode); 663 wake_up_inode(inode);
661} 664}
@@ -1145,6 +1148,7 @@ void generic_delete_inode(struct inode *inode)
1145 1148
1146 list_del_init(&inode->i_list); 1149 list_del_init(&inode->i_list);
1147 list_del_init(&inode->i_sb_list); 1150 list_del_init(&inode->i_sb_list);
1151 WARN_ON(inode->i_state & I_NEW);
1148 inode->i_state |= I_FREEING; 1152 inode->i_state |= I_FREEING;
1149 inodes_stat.nr_inodes--; 1153 inodes_stat.nr_inodes--;
1150 spin_unlock(&inode_lock); 1154 spin_unlock(&inode_lock);
@@ -1186,16 +1190,19 @@ static void generic_forget_inode(struct inode *inode)
1186 spin_unlock(&inode_lock); 1190 spin_unlock(&inode_lock);
1187 return; 1191 return;
1188 } 1192 }
1193 WARN_ON(inode->i_state & I_NEW);
1189 inode->i_state |= I_WILL_FREE; 1194 inode->i_state |= I_WILL_FREE;
1190 spin_unlock(&inode_lock); 1195 spin_unlock(&inode_lock);
1191 write_inode_now(inode, 1); 1196 write_inode_now(inode, 1);
1192 spin_lock(&inode_lock); 1197 spin_lock(&inode_lock);
1198 WARN_ON(inode->i_state & I_NEW);
1193 inode->i_state &= ~I_WILL_FREE; 1199 inode->i_state &= ~I_WILL_FREE;
1194 inodes_stat.nr_unused--; 1200 inodes_stat.nr_unused--;
1195 hlist_del_init(&inode->i_hash); 1201 hlist_del_init(&inode->i_hash);
1196 } 1202 }
1197 list_del_init(&inode->i_list); 1203 list_del_init(&inode->i_list);
1198 list_del_init(&inode->i_sb_list); 1204 list_del_init(&inode->i_sb_list);
1205 WARN_ON(inode->i_state & I_NEW);
1199 inode->i_state |= I_FREEING; 1206 inode->i_state |= I_FREEING;
1200 inodes_stat.nr_inodes--; 1207 inodes_stat.nr_inodes--;
1201 spin_unlock(&inode_lock); 1208 spin_unlock(&inode_lock);
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index eb343008eded..58144102bf25 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -450,7 +450,7 @@ int __jbd2_log_space_left(journal_t *journal)
450} 450}
451 451
452/* 452/*
453 * Called under j_state_lock. Returns true if a transaction was started. 453 * Called under j_state_lock. Returns true if a transaction commit was started.
454 */ 454 */
455int __jbd2_log_start_commit(journal_t *journal, tid_t target) 455int __jbd2_log_start_commit(journal_t *journal, tid_t target)
456{ 456{
@@ -518,7 +518,8 @@ int jbd2_journal_force_commit_nested(journal_t *journal)
518 518
519/* 519/*
520 * Start a commit of the current running transaction (if any). Returns true 520 * Start a commit of the current running transaction (if any). Returns true
521 * if a transaction was started, and fills its tid in at *ptid 521 * if a transaction is going to be committed (or is currently already
522 * committing), and fills its tid in at *ptid
522 */ 523 */
523int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) 524int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
524{ 525{
@@ -528,15 +529,19 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
528 if (journal->j_running_transaction) { 529 if (journal->j_running_transaction) {
529 tid_t tid = journal->j_running_transaction->t_tid; 530 tid_t tid = journal->j_running_transaction->t_tid;
530 531
531 ret = __jbd2_log_start_commit(journal, tid); 532 __jbd2_log_start_commit(journal, tid);
532 if (ret && ptid) 533 /* There's a running transaction and we've just made sure
534 * it's commit has been scheduled. */
535 if (ptid)
533 *ptid = tid; 536 *ptid = tid;
534 } else if (journal->j_committing_transaction && ptid) { 537 ret = 1;
538 } else if (journal->j_committing_transaction) {
535 /* 539 /*
536 * If ext3_write_super() recently started a commit, then we 540 * If ext3_write_super() recently started a commit, then we
537 * have to wait for completion of that transaction 541 * have to wait for completion of that transaction
538 */ 542 */
539 *ptid = journal->j_committing_transaction->t_tid; 543 if (ptid)
544 *ptid = journal->j_committing_transaction->t_tid;
540 ret = 1; 545 ret = 1;
541 } 546 }
542 spin_unlock(&journal->j_state_lock); 547 spin_unlock(&journal->j_state_lock);
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 46b4e347ed7d..28ce21d8598e 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -2129,26 +2129,46 @@ done:
2129} 2129}
2130 2130
2131/* 2131/*
2132 * This function must be called when inode is journaled in ordered mode 2132 * File truncate and transaction commit interact with each other in a
2133 * before truncation happens. It starts writeout of truncated part in 2133 * non-trivial way. If a transaction writing data block A is
2134 * case it is in the committing transaction so that we stand to ordered 2134 * committing, we cannot discard the data by truncate until we have
2135 * mode consistency guarantees. 2135 * written them. Otherwise if we crashed after the transaction with
2136 * write has committed but before the transaction with truncate has
2137 * committed, we could see stale data in block A. This function is a
2138 * helper to solve this problem. It starts writeout of the truncated
2139 * part in case it is in the committing transaction.
2140 *
2141 * Filesystem code must call this function when inode is journaled in
2142 * ordered mode before truncation happens and after the inode has been
2143 * placed on orphan list with the new inode size. The second condition
2144 * avoids the race that someone writes new data and we start
2145 * committing the transaction after this function has been called but
2146 * before a transaction for truncate is started (and furthermore it
2147 * allows us to optimize the case where the addition to orphan list
2148 * happens in the same transaction as write --- we don't have to write
2149 * any data in such case).
2136 */ 2150 */
2137int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, 2151int jbd2_journal_begin_ordered_truncate(journal_t *journal,
2152 struct jbd2_inode *jinode,
2138 loff_t new_size) 2153 loff_t new_size)
2139{ 2154{
2140 journal_t *journal; 2155 transaction_t *inode_trans, *commit_trans;
2141 transaction_t *commit_trans;
2142 int ret = 0; 2156 int ret = 0;
2143 2157
2144 if (!inode->i_transaction && !inode->i_next_transaction) 2158 /* This is a quick check to avoid locking if not necessary */
2159 if (!jinode->i_transaction)
2145 goto out; 2160 goto out;
2146 journal = inode->i_transaction->t_journal; 2161 /* Locks are here just to force reading of recent values, it is
2162 * enough that the transaction was not committing before we started
2163 * a transaction adding the inode to orphan list */
2147 spin_lock(&journal->j_state_lock); 2164 spin_lock(&journal->j_state_lock);
2148 commit_trans = journal->j_committing_transaction; 2165 commit_trans = journal->j_committing_transaction;
2149 spin_unlock(&journal->j_state_lock); 2166 spin_unlock(&journal->j_state_lock);
2150 if (inode->i_transaction == commit_trans) { 2167 spin_lock(&journal->j_list_lock);
2151 ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping, 2168 inode_trans = jinode->i_transaction;
2169 spin_unlock(&journal->j_list_lock);
2170 if (inode_trans == commit_trans) {
2171 ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,
2152 new_size, LLONG_MAX); 2172 new_size, LLONG_MAX);
2153 if (ret) 2173 if (ret)
2154 jbd2_journal_abort(journal, ret); 2174 jbd2_journal_abort(journal, ret);
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 3cceef4ad2b7..e9580104b6ba 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -95,13 +95,17 @@ static int jffs2_garbage_collect_thread(void *_c)
95 spin_unlock(&c->erase_completion_lock); 95 spin_unlock(&c->erase_completion_lock);
96 96
97 97
98 /* This thread is purely an optimisation. But if it runs when 98 /* Problem - immediately after bootup, the GCD spends a lot
99 other things could be running, it actually makes things a 99 * of time in places like jffs2_kill_fragtree(); so much so
100 lot worse. Use yield() and put it at the back of the runqueue 100 * that userspace processes (like gdm and X) are starved
101 every time. Especially during boot, pulling an inode in 101 * despite plenty of cond_resched()s and renicing. Yield()
102 with read_inode() is much preferable to having the GC thread 102 * doesn't help, either (presumably because userspace and GCD
103 get there first. */ 103 * are generally competing for a higher latency resource -
104 yield(); 104 * disk).
105 * This forces the GCD to slow the hell down. Pulling an
106 * inode in with read_inode() is much preferable to having
107 * the GC thread get there first. */
108 schedule_timeout_interruptible(msecs_to_jiffies(50));
105 109
106 /* Put_super will send a SIGKILL and then wait on the sem. 110 /* Put_super will send a SIGKILL and then wait on the sem.
107 */ 111 */
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 6ca08ad887c0..1fc1e92356ee 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -220,7 +220,7 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
220 struct jffs2_tmp_dnode_info *tn) 220 struct jffs2_tmp_dnode_info *tn)
221{ 221{
222 uint32_t fn_end = tn->fn->ofs + tn->fn->size; 222 uint32_t fn_end = tn->fn->ofs + tn->fn->size;
223 struct jffs2_tmp_dnode_info *this; 223 struct jffs2_tmp_dnode_info *this, *ptn;
224 224
225 dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw)); 225 dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw));
226 226
@@ -251,11 +251,18 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
251 if (this) { 251 if (this) {
252 /* If the node is coincident with another at a lower address, 252 /* If the node is coincident with another at a lower address,
253 back up until the other node is found. It may be relevant */ 253 back up until the other node is found. It may be relevant */
254 while (this->overlapped) 254 while (this->overlapped) {
255 this = tn_prev(this); 255 ptn = tn_prev(this);
256 256 if (!ptn) {
257 /* First node should never be marked overlapped */ 257 /*
258 BUG_ON(!this); 258 * We killed a node which set the overlapped
259 * flags during the scan. Fix it up.
260 */
261 this->overlapped = 0;
262 break;
263 }
264 this = ptn;
265 }
259 dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole"); 266 dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole");
260 } 267 }
261 268
@@ -360,7 +367,17 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
360 } 367 }
361 if (!this->overlapped) 368 if (!this->overlapped)
362 break; 369 break;
363 this = tn_prev(this); 370
371 ptn = tn_prev(this);
372 if (!ptn) {
373 /*
374 * We killed a node which set the overlapped
375 * flags during the scan. Fix it up.
376 */
377 this->overlapped = 0;
378 break;
379 }
380 this = ptn;
364 } 381 }
365 } 382 }
366 383
@@ -456,8 +473,15 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c,
456 eat_last(&rii->tn_root, &last->rb); 473 eat_last(&rii->tn_root, &last->rb);
457 ver_insert(&ver_root, last); 474 ver_insert(&ver_root, last);
458 475
459 if (unlikely(last->overlapped)) 476 if (unlikely(last->overlapped)) {
460 continue; 477 if (pen)
478 continue;
479 /*
480 * We killed a node which set the overlapped
481 * flags during the scan. Fix it up.
482 */
483 last->overlapped = 0;
484 }
461 485
462 /* Now we have a bunch of nodes in reverse version 486 /* Now we have a bunch of nodes in reverse version
463 order, in the tree at ver_root. Most of the time, 487 order, in the tree at ver_root. Most of the time,
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 1f3b0fc0d351..aedc47a264c1 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -139,6 +139,55 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
139 return 0; 139 return 0;
140} 140}
141 141
142#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
143static const struct in6_addr *nlmclnt_map_v4addr(const struct sockaddr *sap,
144 struct in6_addr *addr_mapped)
145{
146 const struct sockaddr_in *sin = (const struct sockaddr_in *)sap;
147
148 switch (sap->sa_family) {
149 case AF_INET6:
150 return &((const struct sockaddr_in6 *)sap)->sin6_addr;
151 case AF_INET:
152 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, addr_mapped);
153 return addr_mapped;
154 }
155
156 return NULL;
157}
158
159/*
160 * If lockd is using a PF_INET6 listener, all incoming requests appear
161 * to come from AF_INET6 remotes. The address of AF_INET remotes are
162 * mapped to AF_INET6 automatically by the network layer. In case the
163 * user passed an AF_INET server address at mount time, ensure both
164 * addresses are AF_INET6 before comparing them.
165 */
166static int nlmclnt_cmp_addr(const struct nlm_host *host,
167 const struct sockaddr *sap)
168{
169 const struct in6_addr *addr1;
170 const struct in6_addr *addr2;
171 struct in6_addr addr1_mapped;
172 struct in6_addr addr2_mapped;
173
174 addr1 = nlmclnt_map_v4addr(nlm_addr(host), &addr1_mapped);
175 if (likely(addr1 != NULL)) {
176 addr2 = nlmclnt_map_v4addr(sap, &addr2_mapped);
177 if (likely(addr2 != NULL))
178 return ipv6_addr_equal(addr1, addr2);
179 }
180
181 return 0;
182}
183#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
184static int nlmclnt_cmp_addr(const struct nlm_host *host,
185 const struct sockaddr *sap)
186{
187 return nlm_cmp_addr(nlm_addr(host), sap);
188}
189#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
190
142/* 191/*
143 * The server lockd has called us back to tell us the lock was granted 192 * The server lockd has called us back to tell us the lock was granted
144 */ 193 */
@@ -166,7 +215,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock)
166 */ 215 */
167 if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid) 216 if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid)
168 continue; 217 continue;
169 if (!nlm_cmp_addr(nlm_addr(block->b_host), addr)) 218 if (!nlmclnt_cmp_addr(block->b_host, addr))
170 continue; 219 continue;
171 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0) 220 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
172 continue; 221 continue;
diff --git a/fs/namespace.c b/fs/namespace.c
index 228d8c4bfd18..06f8e63f6cb1 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -614,9 +614,11 @@ static inline void __mntput(struct vfsmount *mnt)
614 */ 614 */
615 for_each_possible_cpu(cpu) { 615 for_each_possible_cpu(cpu) {
616 struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu); 616 struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu);
617 if (cpu_writer->mnt != mnt)
618 continue;
619 spin_lock(&cpu_writer->lock); 617 spin_lock(&cpu_writer->lock);
618 if (cpu_writer->mnt != mnt) {
619 spin_unlock(&cpu_writer->lock);
620 continue;
621 }
620 atomic_add(cpu_writer->count, &mnt->__mnt_writers); 622 atomic_add(cpu_writer->count, &mnt->__mnt_writers);
621 cpu_writer->count = 0; 623 cpu_writer->count = 0;
622 /* 624 /*
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 9b728f3565a1..574158ae2398 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -255,6 +255,32 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
255 } 255 }
256 return 0; 256 return 0;
257} 257}
258
259/*
260 * Test if two ip6 socket addresses refer to the same socket by
261 * comparing relevant fields. The padding bytes specifically, are not
262 * compared. sin6_flowinfo is not compared because it only affects QoS
263 * and sin6_scope_id is only compared if the address is "link local"
264 * because "link local" addresses need only be unique to a specific
265 * link. Conversely, ordinary unicast addresses might have different
266 * sin6_scope_id.
267 *
268 * The caller should ensure both socket addresses are AF_INET6.
269 */
270static int nfs_sockaddr_cmp_ip6(const struct sockaddr *sa1,
271 const struct sockaddr *sa2)
272{
273 const struct sockaddr_in6 *saddr1 = (const struct sockaddr_in6 *)sa1;
274 const struct sockaddr_in6 *saddr2 = (const struct sockaddr_in6 *)sa2;
275
276 if (!ipv6_addr_equal(&saddr1->sin6_addr,
277 &saddr1->sin6_addr))
278 return 0;
279 if (ipv6_addr_scope(&saddr1->sin6_addr) == IPV6_ADDR_SCOPE_LINKLOCAL &&
280 saddr1->sin6_scope_id != saddr2->sin6_scope_id)
281 return 0;
282 return saddr1->sin6_port == saddr2->sin6_port;
283}
258#else 284#else
259static int nfs_sockaddr_match_ipaddr4(const struct sockaddr_in *sa1, 285static int nfs_sockaddr_match_ipaddr4(const struct sockaddr_in *sa1,
260 const struct sockaddr_in *sa2) 286 const struct sockaddr_in *sa2)
@@ -270,9 +296,52 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
270 return nfs_sockaddr_match_ipaddr4((const struct sockaddr_in *)sa1, 296 return nfs_sockaddr_match_ipaddr4((const struct sockaddr_in *)sa1,
271 (const struct sockaddr_in *)sa2); 297 (const struct sockaddr_in *)sa2);
272} 298}
299
300static int nfs_sockaddr_cmp_ip6(const struct sockaddr * sa1,
301 const struct sockaddr * sa2)
302{
303 return 0;
304}
273#endif 305#endif
274 306
275/* 307/*
308 * Test if two ip4 socket addresses refer to the same socket, by
309 * comparing relevant fields. The padding bytes specifically, are
310 * not compared.
311 *
312 * The caller should ensure both socket addresses are AF_INET.
313 */
314static int nfs_sockaddr_cmp_ip4(const struct sockaddr *sa1,
315 const struct sockaddr *sa2)
316{
317 const struct sockaddr_in *saddr1 = (const struct sockaddr_in *)sa1;
318 const struct sockaddr_in *saddr2 = (const struct sockaddr_in *)sa2;
319
320 if (saddr1->sin_addr.s_addr != saddr2->sin_addr.s_addr)
321 return 0;
322 return saddr1->sin_port == saddr2->sin_port;
323}
324
325/*
326 * Test if two socket addresses represent the same actual socket,
327 * by comparing (only) relevant fields.
328 */
329static int nfs_sockaddr_cmp(const struct sockaddr *sa1,
330 const struct sockaddr *sa2)
331{
332 if (sa1->sa_family != sa2->sa_family)
333 return 0;
334
335 switch (sa1->sa_family) {
336 case AF_INET:
337 return nfs_sockaddr_cmp_ip4(sa1, sa2);
338 case AF_INET6:
339 return nfs_sockaddr_cmp_ip6(sa1, sa2);
340 }
341 return 0;
342}
343
344/*
276 * Find a client by IP address and protocol version 345 * Find a client by IP address and protocol version
277 * - returns NULL if no such client 346 * - returns NULL if no such client
278 */ 347 */
@@ -344,8 +413,10 @@ struct nfs_client *nfs_find_client_next(struct nfs_client *clp)
344static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *data) 413static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *data)
345{ 414{
346 struct nfs_client *clp; 415 struct nfs_client *clp;
416 const struct sockaddr *sap = data->addr;
347 417
348 list_for_each_entry(clp, &nfs_client_list, cl_share_link) { 418 list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
419 const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr;
349 /* Don't match clients that failed to initialise properly */ 420 /* Don't match clients that failed to initialise properly */
350 if (clp->cl_cons_state < 0) 421 if (clp->cl_cons_state < 0)
351 continue; 422 continue;
@@ -358,7 +429,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
358 continue; 429 continue;
359 430
360 /* Match the full socket address */ 431 /* Match the full socket address */
361 if (memcmp(&clp->cl_addr, data->addr, sizeof(clp->cl_addr)) != 0) 432 if (!nfs_sockaddr_cmp(sap, clap))
362 continue; 433 continue;
363 434
364 atomic_inc(&clp->cl_count); 435 atomic_inc(&clp->cl_count);
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index e35c8199f82f..672368f865ca 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1892,8 +1892,14 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
1892 cache.cred = cred; 1892 cache.cred = cred;
1893 cache.jiffies = jiffies; 1893 cache.jiffies = jiffies;
1894 status = NFS_PROTO(inode)->access(inode, &cache); 1894 status = NFS_PROTO(inode)->access(inode, &cache);
1895 if (status != 0) 1895 if (status != 0) {
1896 if (status == -ESTALE) {
1897 nfs_zap_caches(inode);
1898 if (!S_ISDIR(inode->i_mode))
1899 set_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
1900 }
1896 return status; 1901 return status;
1902 }
1897 nfs_access_add_cache(inode, &cache); 1903 nfs_access_add_cache(inode, &cache);
1898out: 1904out:
1899 if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) 1905 if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index cef62557c87d..6bbf0e6daad2 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -292,7 +292,7 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
292{ 292{
293 struct nfs_server *server = NFS_SERVER(inode); 293 struct nfs_server *server = NFS_SERVER(inode);
294 struct nfs_fattr fattr; 294 struct nfs_fattr fattr;
295 struct page *pages[NFSACL_MAXPAGES] = { }; 295 struct page *pages[NFSACL_MAXPAGES];
296 struct nfs3_setaclargs args = { 296 struct nfs3_setaclargs args = {
297 .inode = inode, 297 .inode = inode,
298 .mask = NFS_ACL, 298 .mask = NFS_ACL,
@@ -303,7 +303,7 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
303 .rpc_argp = &args, 303 .rpc_argp = &args,
304 .rpc_resp = &fattr, 304 .rpc_resp = &fattr,
305 }; 305 };
306 int status, count; 306 int status;
307 307
308 status = -EOPNOTSUPP; 308 status = -EOPNOTSUPP;
309 if (!nfs_server_capable(inode, NFS_CAP_ACLS)) 309 if (!nfs_server_capable(inode, NFS_CAP_ACLS))
@@ -319,6 +319,20 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
319 if (S_ISDIR(inode->i_mode)) { 319 if (S_ISDIR(inode->i_mode)) {
320 args.mask |= NFS_DFACL; 320 args.mask |= NFS_DFACL;
321 args.acl_default = dfacl; 321 args.acl_default = dfacl;
322 args.len = nfsacl_size(acl, dfacl);
323 } else
324 args.len = nfsacl_size(acl, NULL);
325
326 if (args.len > NFS_ACL_INLINE_BUFSIZE) {
327 unsigned int npages = 1 + ((args.len - 1) >> PAGE_SHIFT);
328
329 status = -ENOMEM;
330 do {
331 args.pages[args.npages] = alloc_page(GFP_KERNEL);
332 if (args.pages[args.npages] == NULL)
333 goto out_freepages;
334 args.npages++;
335 } while (args.npages < npages);
322 } 336 }
323 337
324 dprintk("NFS call setacl\n"); 338 dprintk("NFS call setacl\n");
@@ -329,10 +343,6 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
329 nfs_zap_acl_cache(inode); 343 nfs_zap_acl_cache(inode);
330 dprintk("NFS reply setacl: %d\n", status); 344 dprintk("NFS reply setacl: %d\n", status);
331 345
332 /* pages may have been allocated at the xdr layer. */
333 for (count = 0; count < NFSACL_MAXPAGES && args.pages[count]; count++)
334 __free_page(args.pages[count]);
335
336 switch (status) { 346 switch (status) {
337 case 0: 347 case 0:
338 status = nfs_refresh_inode(inode, &fattr); 348 status = nfs_refresh_inode(inode, &fattr);
@@ -346,6 +356,11 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
346 case -ENOTSUPP: 356 case -ENOTSUPP:
347 status = -EOPNOTSUPP; 357 status = -EOPNOTSUPP;
348 } 358 }
359out_freepages:
360 while (args.npages != 0) {
361 args.npages--;
362 __free_page(args.pages[args.npages]);
363 }
349out: 364out:
350 return status; 365 return status;
351} 366}
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 11cdddec1432..6cdeacffde46 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -82,8 +82,10 @@
82#define NFS3_commitres_sz (1+NFS3_wcc_data_sz+2) 82#define NFS3_commitres_sz (1+NFS3_wcc_data_sz+2)
83 83
84#define ACL3_getaclargs_sz (NFS3_fh_sz+1) 84#define ACL3_getaclargs_sz (NFS3_fh_sz+1)
85#define ACL3_setaclargs_sz (NFS3_fh_sz+1+2*(2+5*3)) 85#define ACL3_setaclargs_sz (NFS3_fh_sz+1+ \
86#define ACL3_getaclres_sz (1+NFS3_post_op_attr_sz+1+2*(2+5*3)) 86 XDR_QUADLEN(NFS_ACL_INLINE_BUFSIZE))
87#define ACL3_getaclres_sz (1+NFS3_post_op_attr_sz+1+ \
88 XDR_QUADLEN(NFS_ACL_INLINE_BUFSIZE))
87#define ACL3_setaclres_sz (1+NFS3_post_op_attr_sz) 89#define ACL3_setaclres_sz (1+NFS3_post_op_attr_sz)
88 90
89/* 91/*
@@ -703,28 +705,18 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
703 struct nfs3_setaclargs *args) 705 struct nfs3_setaclargs *args)
704{ 706{
705 struct xdr_buf *buf = &req->rq_snd_buf; 707 struct xdr_buf *buf = &req->rq_snd_buf;
706 unsigned int base, len_in_head, len = nfsacl_size( 708 unsigned int base;
707 (args->mask & NFS_ACL) ? args->acl_access : NULL, 709 int err;
708 (args->mask & NFS_DFACL) ? args->acl_default : NULL);
709 int count, err;
710 710
711 p = xdr_encode_fhandle(p, NFS_FH(args->inode)); 711 p = xdr_encode_fhandle(p, NFS_FH(args->inode));
712 *p++ = htonl(args->mask); 712 *p++ = htonl(args->mask);
713 base = (char *)p - (char *)buf->head->iov_base; 713 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
714 /* put as much of the acls into head as possible. */ 714 base = req->rq_slen;
715 len_in_head = min_t(unsigned int, buf->head->iov_len - base, len); 715
716 len -= len_in_head; 716 if (args->npages != 0)
717 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p + (len_in_head >> 2)); 717 xdr_encode_pages(buf, args->pages, 0, args->len);
718 718 else
719 for (count = 0; (count << PAGE_SHIFT) < len; count++) { 719 req->rq_slen += args->len;
720 args->pages[count] = alloc_page(GFP_KERNEL);
721 if (!args->pages[count]) {
722 while (count)
723 __free_page(args->pages[--count]);
724 return -ENOMEM;
725 }
726 }
727 xdr_encode_pages(buf, args->pages, 0, len);
728 720
729 err = nfsacl_encode(buf, base, args->inode, 721 err = nfsacl_encode(buf, base, args->inode,
730 (args->mask & NFS_ACL) ? 722 (args->mask & NFS_ACL) ?
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 30befc39b3c6..2a2a0a7143ad 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -21,7 +21,9 @@
21#define NFSDBG_FACILITY NFSDBG_VFS 21#define NFSDBG_FACILITY NFSDBG_VFS
22 22
23/* 23/*
24 * Check if fs_root is valid 24 * Convert the NFSv4 pathname components into a standard posix path.
25 *
26 * Note that the resulting string will be placed at the end of the buffer
25 */ 27 */
26static inline char *nfs4_pathname_string(const struct nfs4_pathname *pathname, 28static inline char *nfs4_pathname_string(const struct nfs4_pathname *pathname,
27 char *buffer, ssize_t buflen) 29 char *buffer, ssize_t buflen)
@@ -99,21 +101,20 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
99{ 101{
100 struct vfsmount *mnt = ERR_PTR(-ENOENT); 102 struct vfsmount *mnt = ERR_PTR(-ENOENT);
101 char *mnt_path; 103 char *mnt_path;
102 int page2len; 104 unsigned int maxbuflen;
103 unsigned int s; 105 unsigned int s;
104 106
105 mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); 107 mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE);
106 if (IS_ERR(mnt_path)) 108 if (IS_ERR(mnt_path))
107 return mnt; 109 return mnt;
108 mountdata->mnt_path = mnt_path; 110 mountdata->mnt_path = mnt_path;
109 page2 += strlen(mnt_path) + 1; 111 maxbuflen = mnt_path - 1 - page2;
110 page2len = PAGE_SIZE - strlen(mnt_path) - 1;
111 112
112 for (s = 0; s < location->nservers; s++) { 113 for (s = 0; s < location->nservers; s++) {
113 const struct nfs4_string *buf = &location->servers[s]; 114 const struct nfs4_string *buf = &location->servers[s];
114 struct sockaddr_storage addr; 115 struct sockaddr_storage addr;
115 116
116 if (buf->len <= 0 || buf->len >= PAGE_SIZE) 117 if (buf->len <= 0 || buf->len >= maxbuflen)
117 continue; 118 continue;
118 119
119 mountdata->addr = (struct sockaddr *)&addr; 120 mountdata->addr = (struct sockaddr *)&addr;
@@ -126,8 +127,8 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
126 continue; 127 continue;
127 nfs_set_port(mountdata->addr, NFS_PORT); 128 nfs_set_port(mountdata->addr, NFS_PORT);
128 129
129 strncpy(page2, buf->data, page2len); 130 memcpy(page2, buf->data, buf->len);
130 page2[page2len] = '\0'; 131 page2[buf->len] = '\0';
131 mountdata->hostname = page2; 132 mountdata->hostname = page2;
132 133
133 snprintf(page, PAGE_SIZE, "%s:%s", 134 snprintf(page, PAGE_SIZE, "%s:%s",
diff --git a/fs/notify/inotify/inotify.c b/fs/notify/inotify/inotify.c
index dae3f28f30d4..331f2e88e284 100644
--- a/fs/notify/inotify/inotify.c
+++ b/fs/notify/inotify/inotify.c
@@ -156,7 +156,7 @@ static int inotify_handle_get_wd(struct inotify_handle *ih,
156 int ret; 156 int ret;
157 157
158 do { 158 do {
159 if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL))) 159 if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS)))
160 return -ENOSPC; 160 return -ENOSPC;
161 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); 161 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd);
162 } while (ret == -EAGAIN); 162 } while (ret == -EAGAIN);
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 60fe74035db5..19e3a96aa02c 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -176,7 +176,8 @@ static int ocfs2_dinode_insert_check(struct inode *inode,
176 176
177 BUG_ON(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL); 177 BUG_ON(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL);
178 mlog_bug_on_msg(!ocfs2_sparse_alloc(osb) && 178 mlog_bug_on_msg(!ocfs2_sparse_alloc(osb) &&
179 (OCFS2_I(inode)->ip_clusters != rec->e_cpos), 179 (OCFS2_I(inode)->ip_clusters !=
180 le32_to_cpu(rec->e_cpos)),
180 "Device %s, asking for sparse allocation: inode %llu, " 181 "Device %s, asking for sparse allocation: inode %llu, "
181 "cpos %u, clusters %u\n", 182 "cpos %u, clusters %u\n",
182 osb->dev_str, 183 osb->dev_str,
@@ -4796,6 +4797,29 @@ out:
4796 return ret; 4797 return ret;
4797} 4798}
4798 4799
4800static int ocfs2_replace_extent_rec(struct inode *inode,
4801 handle_t *handle,
4802 struct ocfs2_path *path,
4803 struct ocfs2_extent_list *el,
4804 int split_index,
4805 struct ocfs2_extent_rec *split_rec)
4806{
4807 int ret;
4808
4809 ret = ocfs2_path_bh_journal_access(handle, inode, path,
4810 path_num_items(path) - 1);
4811 if (ret) {
4812 mlog_errno(ret);
4813 goto out;
4814 }
4815
4816 el->l_recs[split_index] = *split_rec;
4817
4818 ocfs2_journal_dirty(handle, path_leaf_bh(path));
4819out:
4820 return ret;
4821}
4822
4799/* 4823/*
4800 * Mark part or all of the extent record at split_index in the leaf 4824 * Mark part or all of the extent record at split_index in the leaf
4801 * pointed to by path as written. This removes the unwritten 4825 * pointed to by path as written. This removes the unwritten
@@ -4885,7 +4909,9 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
4885 4909
4886 if (ctxt.c_contig_type == CONTIG_NONE) { 4910 if (ctxt.c_contig_type == CONTIG_NONE) {
4887 if (ctxt.c_split_covers_rec) 4911 if (ctxt.c_split_covers_rec)
4888 el->l_recs[split_index] = *split_rec; 4912 ret = ocfs2_replace_extent_rec(inode, handle,
4913 path, el,
4914 split_index, split_rec);
4889 else 4915 else
4890 ret = ocfs2_split_and_insert(inode, handle, path, et, 4916 ret = ocfs2_split_and_insert(inode, handle, path, et,
4891 &last_eb_bh, split_index, 4917 &last_eb_bh, split_index,
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index a067a6cffb01..8e1709a679b7 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -227,7 +227,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
227 size = i_size_read(inode); 227 size = i_size_read(inode);
228 228
229 if (size > PAGE_CACHE_SIZE || 229 if (size > PAGE_CACHE_SIZE ||
230 size > ocfs2_max_inline_data(inode->i_sb)) { 230 size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
231 ocfs2_error(inode->i_sb, 231 ocfs2_error(inode->i_sb,
232 "Inode %llu has with inline data has bad size: %Lu", 232 "Inode %llu has with inline data has bad size: %Lu",
233 (unsigned long long)OCFS2_I(inode)->ip_blkno, 233 (unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -1555,6 +1555,7 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
1555 int ret, written = 0; 1555 int ret, written = 0;
1556 loff_t end = pos + len; 1556 loff_t end = pos + len;
1557 struct ocfs2_inode_info *oi = OCFS2_I(inode); 1557 struct ocfs2_inode_info *oi = OCFS2_I(inode);
1558 struct ocfs2_dinode *di = NULL;
1558 1559
1559 mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n", 1560 mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
1560 (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos, 1561 (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
@@ -1587,7 +1588,9 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
1587 /* 1588 /*
1588 * Check whether the write can fit. 1589 * Check whether the write can fit.
1589 */ 1590 */
1590 if (mmap_page || end > ocfs2_max_inline_data(inode->i_sb)) 1591 di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
1592 if (mmap_page ||
1593 end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di))
1591 return 0; 1594 return 0;
1592 1595
1593do_inline_write: 1596do_inline_write:
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 54e182a27caf..0a2813947853 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1849,12 +1849,12 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data,
1849 if (!mle) { 1849 if (!mle) {
1850 if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN && 1850 if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN &&
1851 res->owner != assert->node_idx) { 1851 res->owner != assert->node_idx) {
1852 mlog(ML_ERROR, "assert_master from " 1852 mlog(ML_ERROR, "DIE! Mastery assert from %u, "
1853 "%u, but current owner is " 1853 "but current owner is %u! (%.*s)\n",
1854 "%u! (%.*s)\n", 1854 assert->node_idx, res->owner, namelen,
1855 assert->node_idx, res->owner, 1855 name);
1856 namelen, name); 1856 __dlm_print_one_lock_resource(res);
1857 goto kill; 1857 BUG();
1858 } 1858 }
1859 } else if (mle->type != DLM_MLE_MIGRATION) { 1859 } else if (mle->type != DLM_MLE_MIGRATION) {
1860 if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) { 1860 if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) {
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index d1295203029f..4060bb328bc8 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -181,8 +181,7 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
181 181
182 spin_lock(&res->spinlock); 182 spin_lock(&res->spinlock);
183 /* This ensures that clear refmap is sent after the set */ 183 /* This ensures that clear refmap is sent after the set */
184 __dlm_wait_on_lockres_flags(res, (DLM_LOCK_RES_SETREF_INPROG | 184 __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG);
185 DLM_LOCK_RES_MIGRATING));
186 spin_unlock(&res->spinlock); 185 spin_unlock(&res->spinlock);
187 186
188 /* clear our bit from the master's refmap, ignore errors */ 187 /* clear our bit from the master's refmap, ignore errors */
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c
index 86ca085ef324..fcf879ed6930 100644
--- a/fs/ocfs2/dlm/dlmunlock.c
+++ b/fs/ocfs2/dlm/dlmunlock.c
@@ -117,11 +117,11 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
117 else 117 else
118 BUG_ON(res->owner == dlm->node_num); 118 BUG_ON(res->owner == dlm->node_num);
119 119
120 spin_lock(&dlm->spinlock); 120 spin_lock(&dlm->ast_lock);
121 /* We want to be sure that we're not freeing a lock 121 /* We want to be sure that we're not freeing a lock
122 * that still has AST's pending... */ 122 * that still has AST's pending... */
123 in_use = !list_empty(&lock->ast_list); 123 in_use = !list_empty(&lock->ast_list);
124 spin_unlock(&dlm->spinlock); 124 spin_unlock(&dlm->ast_lock);
125 if (in_use) { 125 if (in_use) {
126 mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " 126 mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock "
127 "while waiting for an ast!", res->lockname.len, 127 "while waiting for an ast!", res->lockname.len,
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 206a2370876a..7219a86d34cc 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -320,9 +320,14 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
320 struct ocfs2_lock_res *lockres); 320 struct ocfs2_lock_res *lockres);
321static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, 321static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
322 int convert); 322 int convert);
323#define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ 323#define ocfs2_log_dlm_error(_func, _err, _lockres) do { \
324 mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ 324 if ((_lockres)->l_type != OCFS2_LOCK_TYPE_DENTRY) \
325 _err, _func, _lockres->l_name); \ 325 mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \
326 _err, _func, _lockres->l_name); \
327 else \
328 mlog(ML_ERROR, "DLM error %d while calling %s on resource %.*s%08x\n", \
329 _err, _func, OCFS2_DENTRY_LOCK_INO_START - 1, (_lockres)->l_name, \
330 (unsigned int)ocfs2_get_dentry_lock_ino(_lockres)); \
326} while (0) 331} while (0)
327static int ocfs2_downconvert_thread(void *arg); 332static int ocfs2_downconvert_thread(void *arg);
328static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, 333static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 3c3532e1307c..172850a9a12a 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -513,8 +513,10 @@ static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode)
513static inline int ocfs2_begin_ordered_truncate(struct inode *inode, 513static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
514 loff_t new_size) 514 loff_t new_size)
515{ 515{
516 return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode, 516 return jbd2_journal_begin_ordered_truncate(
517 new_size); 517 OCFS2_SB(inode->i_sb)->journal->j_journal,
518 &OCFS2_I(inode)->ip_jinode,
519 new_size);
518} 520}
519 521
520#endif /* OCFS2_JOURNAL_H */ 522#endif /* OCFS2_JOURNAL_H */
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 084aba86c3b2..4b11762f249e 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -532,7 +532,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
532 532
533 fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL); 533 fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL);
534 534
535 fe->id2.i_data.id_count = cpu_to_le16(ocfs2_max_inline_data(osb->sb)); 535 fe->id2.i_data.id_count = cpu_to_le16(
536 ocfs2_max_inline_data_with_xattr(osb->sb, fe));
536 } else { 537 } else {
537 fel = &fe->id2.i_list; 538 fel = &fe->id2.i_list;
538 fel->l_tree_depth = 0; 539 fel->l_tree_depth = 0;
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 077384135f4e..946d3c34b90b 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -341,6 +341,9 @@ struct ocfs2_super
341 struct ocfs2_node_map osb_recovering_orphan_dirs; 341 struct ocfs2_node_map osb_recovering_orphan_dirs;
342 unsigned int *osb_orphan_wipes; 342 unsigned int *osb_orphan_wipes;
343 wait_queue_head_t osb_wipe_event; 343 wait_queue_head_t osb_wipe_event;
344
345 /* used to protect metaecc calculation check of xattr. */
346 spinlock_t osb_xattr_lock;
344}; 347};
345 348
346#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) 349#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info)
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index c7ae45aaa36c..2332ef740f4f 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -1070,12 +1070,6 @@ static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
1070 offsetof(struct ocfs2_dinode, id2.i_symlink); 1070 offsetof(struct ocfs2_dinode, id2.i_symlink);
1071} 1071}
1072 1072
1073static inline int ocfs2_max_inline_data(struct super_block *sb)
1074{
1075 return sb->s_blocksize -
1076 offsetof(struct ocfs2_dinode, id2.i_data.id_data);
1077}
1078
1079static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb, 1073static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
1080 struct ocfs2_dinode *di) 1074 struct ocfs2_dinode *di)
1081{ 1075{
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index b1cb38fbe807..7ac83a81ee55 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1537,6 +1537,13 @@ static int ocfs2_get_sector(struct super_block *sb,
1537 unlock_buffer(*bh); 1537 unlock_buffer(*bh);
1538 ll_rw_block(READ, 1, bh); 1538 ll_rw_block(READ, 1, bh);
1539 wait_on_buffer(*bh); 1539 wait_on_buffer(*bh);
1540 if (!buffer_uptodate(*bh)) {
1541 mlog_errno(-EIO);
1542 brelse(*bh);
1543 *bh = NULL;
1544 return -EIO;
1545 }
1546
1540 return 0; 1547 return 0;
1541} 1548}
1542 1549
@@ -1747,6 +1754,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
1747 INIT_LIST_HEAD(&osb->blocked_lock_list); 1754 INIT_LIST_HEAD(&osb->blocked_lock_list);
1748 osb->blocked_lock_count = 0; 1755 osb->blocked_lock_count = 0;
1749 spin_lock_init(&osb->osb_lock); 1756 spin_lock_init(&osb->osb_lock);
1757 spin_lock_init(&osb->osb_xattr_lock);
1750 ocfs2_init_inode_steal_slot(osb); 1758 ocfs2_init_inode_steal_slot(osb);
1751 1759
1752 atomic_set(&osb->alloc_stats.moves, 0); 1760 atomic_set(&osb->alloc_stats.moves, 0);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 915039fffe6e..2563df89fc2a 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt {
82 82
83#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root)) 83#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))
84#define OCFS2_XATTR_INLINE_SIZE 80 84#define OCFS2_XATTR_INLINE_SIZE 80
85#define OCFS2_XATTR_HEADER_GAP 4
85#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ 86#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \
86 - sizeof(struct ocfs2_xattr_header) \ 87 - sizeof(struct ocfs2_xattr_header) \
87 - sizeof(__u32)) 88 - OCFS2_XATTR_HEADER_GAP)
88#define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \ 89#define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \
89 - sizeof(struct ocfs2_xattr_block) \ 90 - sizeof(struct ocfs2_xattr_block) \
90 - sizeof(struct ocfs2_xattr_header) \ 91 - sizeof(struct ocfs2_xattr_header) \
91 - sizeof(__u32)) 92 - OCFS2_XATTR_HEADER_GAP)
92 93
93static struct ocfs2_xattr_def_value_root def_xv = { 94static struct ocfs2_xattr_def_value_root def_xv = {
94 .xv.xr_list.l_count = cpu_to_le16(1), 95 .xv.xr_list.l_count = cpu_to_le16(1),
@@ -274,10 +275,12 @@ static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
274 bucket->bu_blocks, bucket->bu_bhs, 0, 275 bucket->bu_blocks, bucket->bu_bhs, 0,
275 NULL); 276 NULL);
276 if (!rc) { 277 if (!rc) {
278 spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
277 rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb, 279 rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb,
278 bucket->bu_bhs, 280 bucket->bu_bhs,
279 bucket->bu_blocks, 281 bucket->bu_blocks,
280 &bucket_xh(bucket)->xh_check); 282 &bucket_xh(bucket)->xh_check);
283 spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
281 if (rc) 284 if (rc)
282 mlog_errno(rc); 285 mlog_errno(rc);
283 } 286 }
@@ -310,9 +313,11 @@ static void ocfs2_xattr_bucket_journal_dirty(handle_t *handle,
310{ 313{
311 int i; 314 int i;
312 315
316 spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
313 ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb, 317 ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb,
314 bucket->bu_bhs, bucket->bu_blocks, 318 bucket->bu_bhs, bucket->bu_blocks,
315 &bucket_xh(bucket)->xh_check); 319 &bucket_xh(bucket)->xh_check);
320 spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
316 321
317 for (i = 0; i < bucket->bu_blocks; i++) 322 for (i = 0; i < bucket->bu_blocks; i++)
318 ocfs2_journal_dirty(handle, bucket->bu_bhs[i]); 323 ocfs2_journal_dirty(handle, bucket->bu_bhs[i]);
@@ -542,8 +547,12 @@ int ocfs2_calc_xattr_init(struct inode *dir,
542 * when blocksize = 512, may reserve one more cluser for 547 * when blocksize = 512, may reserve one more cluser for
543 * xattr bucket, otherwise reserve one metadata block 548 * xattr bucket, otherwise reserve one metadata block
544 * for them is ok. 549 * for them is ok.
550 * If this is a new directory with inline data,
551 * we choose to reserve the entire inline area for
552 * directory contents and force an external xattr block.
545 */ 553 */
546 if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE || 554 if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
555 (S_ISDIR(mode) && ocfs2_supports_inline_data(osb)) ||
547 (s_size + a_size) > OCFS2_XATTR_FREE_IN_IBODY) { 556 (s_size + a_size) > OCFS2_XATTR_FREE_IN_IBODY) {
548 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, xattr_ac); 557 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, xattr_ac);
549 if (ret) { 558 if (ret) {
@@ -1507,7 +1516,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1507 last += 1; 1516 last += 1;
1508 } 1517 }
1509 1518
1510 free = min_offs - ((void *)last - xs->base) - sizeof(__u32); 1519 free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP;
1511 if (free < 0) 1520 if (free < 0)
1512 return -EIO; 1521 return -EIO;
1513 1522
@@ -2190,7 +2199,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode,
2190 last += 1; 2199 last += 1;
2191 } 2200 }
2192 2201
2193 free = min_offs - ((void *)last - xs->base) - sizeof(__u32); 2202 free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP;
2194 if (free < 0) 2203 if (free < 0)
2195 return 0; 2204 return 0;
2196 2205
@@ -2592,8 +2601,9 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
2592 2601
2593 if (!ret) { 2602 if (!ret) {
2594 /* Update inode ctime. */ 2603 /* Update inode ctime. */
2595 ret = ocfs2_journal_access(ctxt->handle, inode, xis->inode_bh, 2604 ret = ocfs2_journal_access_di(ctxt->handle, inode,
2596 OCFS2_JOURNAL_ACCESS_WRITE); 2605 xis->inode_bh,
2606 OCFS2_JOURNAL_ACCESS_WRITE);
2597 if (ret) { 2607 if (ret) {
2598 mlog_errno(ret); 2608 mlog_errno(ret);
2599 goto out; 2609 goto out;
@@ -4785,19 +4795,33 @@ static int ocfs2_xattr_bucket_set_value_outside(struct inode *inode,
4785 char *val, 4795 char *val,
4786 int value_len) 4796 int value_len)
4787{ 4797{
4788 int offset; 4798 int ret, offset, block_off;
4789 struct ocfs2_xattr_value_root *xv; 4799 struct ocfs2_xattr_value_root *xv;
4790 struct ocfs2_xattr_entry *xe = xs->here; 4800 struct ocfs2_xattr_entry *xe = xs->here;
4801 struct ocfs2_xattr_header *xh = bucket_xh(xs->bucket);
4802 void *base;
4791 4803
4792 BUG_ON(!xs->base || !xe || ocfs2_xattr_is_local(xe)); 4804 BUG_ON(!xs->base || !xe || ocfs2_xattr_is_local(xe));
4793 4805
4794 offset = le16_to_cpu(xe->xe_name_offset) + 4806 ret = ocfs2_xattr_bucket_get_name_value(inode, xh,
4795 OCFS2_XATTR_SIZE(xe->xe_name_len); 4807 xe - xh->xh_entries,
4808 &block_off,
4809 &offset);
4810 if (ret) {
4811 mlog_errno(ret);
4812 goto out;
4813 }
4796 4814
4797 xv = (struct ocfs2_xattr_value_root *)(xs->base + offset); 4815 base = bucket_block(xs->bucket, block_off);
4816 xv = (struct ocfs2_xattr_value_root *)(base + offset +
4817 OCFS2_XATTR_SIZE(xe->xe_name_len));
4798 4818
4799 return __ocfs2_xattr_set_value_outside(inode, handle, 4819 ret = __ocfs2_xattr_set_value_outside(inode, handle,
4800 xv, val, value_len); 4820 xv, val, value_len);
4821 if (ret)
4822 mlog_errno(ret);
4823out:
4824 return ret;
4801} 4825}
4802 4826
4803static int ocfs2_rm_xattr_cluster(struct inode *inode, 4827static int ocfs2_rm_xattr_cluster(struct inode *inode,
@@ -5060,8 +5084,8 @@ try_again:
5060 xh_free_start = le16_to_cpu(xh->xh_free_start); 5084 xh_free_start = le16_to_cpu(xh->xh_free_start);
5061 header_size = sizeof(struct ocfs2_xattr_header) + 5085 header_size = sizeof(struct ocfs2_xattr_header) +
5062 count * sizeof(struct ocfs2_xattr_entry); 5086 count * sizeof(struct ocfs2_xattr_entry);
5063 max_free = OCFS2_XATTR_BUCKET_SIZE - 5087 max_free = OCFS2_XATTR_BUCKET_SIZE - header_size -
5064 le16_to_cpu(xh->xh_name_value_len) - header_size; 5088 le16_to_cpu(xh->xh_name_value_len) - OCFS2_XATTR_HEADER_GAP;
5065 5089
5066 mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " 5090 mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size "
5067 "of %u which exceed block size\n", 5091 "of %u which exceed block size\n",
@@ -5094,7 +5118,7 @@ try_again:
5094 need = 0; 5118 need = 0;
5095 } 5119 }
5096 5120
5097 free = xh_free_start - header_size; 5121 free = xh_free_start - header_size - OCFS2_XATTR_HEADER_GAP;
5098 /* 5122 /*
5099 * We need to make sure the new name/value pair 5123 * We need to make sure the new name/value pair
5100 * can exist in the same block. 5124 * can exist in the same block.
@@ -5127,7 +5151,8 @@ try_again:
5127 } 5151 }
5128 5152
5129 xh_free_start = le16_to_cpu(xh->xh_free_start); 5153 xh_free_start = le16_to_cpu(xh->xh_free_start);
5130 free = xh_free_start - header_size; 5154 free = xh_free_start - header_size
5155 - OCFS2_XATTR_HEADER_GAP;
5131 if (xh_free_start % blocksize < need) 5156 if (xh_free_start % blocksize < need)
5132 free -= xh_free_start % blocksize; 5157 free -= xh_free_start % blocksize;
5133 5158
diff --git a/fs/pipe.c b/fs/pipe.c
index 3a48ba5179d5..14f502b89cf5 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -699,12 +699,12 @@ pipe_rdwr_fasync(int fd, struct file *filp, int on)
699 int retval; 699 int retval;
700 700
701 mutex_lock(&inode->i_mutex); 701 mutex_lock(&inode->i_mutex);
702
703 retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); 702 retval = fasync_helper(fd, filp, on, &pipe->fasync_readers);
704 703 if (retval >= 0) {
705 if (retval >= 0)
706 retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); 704 retval = fasync_helper(fd, filp, on, &pipe->fasync_writers);
707 705 if (retval < 0) /* this can happen only if on == T */
706 fasync_helper(-1, filp, 0, &pipe->fasync_readers);
707 }
708 mutex_unlock(&inode->i_mutex); 708 mutex_unlock(&inode->i_mutex);
709 709
710 if (retval < 0) 710 if (retval < 0)
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 3e76bb9b3ad6..d8bb5c671f42 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -485,8 +485,10 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
485 } 485 }
486 } 486 }
487 unlock_new_inode(inode); 487 unlock_new_inode(inode);
488 } else 488 } else {
489 module_put(de->owner); 489 module_put(de->owner);
490 de_put(de);
491 }
490 return inode; 492 return inode;
491 493
492out_ino: 494out_ino:
diff --git a/fs/proc/page.c b/fs/proc/page.c
index 767d95a6d1b1..e9983837d08d 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {
80#define KPF_RECLAIM 9 80#define KPF_RECLAIM 9
81#define KPF_BUDDY 10 81#define KPF_BUDDY 10
82 82
83#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos) 83#define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)
84 84
85static ssize_t kpageflags_read(struct file *file, char __user *buf, 85static ssize_t kpageflags_read(struct file *file, char __user *buf,
86 size_t count, loff_t *ppos) 86 size_t count, loff_t *ppos)
@@ -107,7 +107,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
107 else 107 else
108 kflags = ppage->flags; 108 kflags = ppage->flags;
109 109
110 uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) | 110 uflags = kpf_copy_bit(kflags, KPF_LOCKED, PG_locked) |
111 kpf_copy_bit(kflags, KPF_ERROR, PG_error) | 111 kpf_copy_bit(kflags, KPF_ERROR, PG_error) |
112 kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) | 112 kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) |
113 kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) | 113 kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index b9b567a28376..5d7c7ececa64 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -114,6 +114,9 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
114 if (!pagevec_add(&lru_pvec, page)) 114 if (!pagevec_add(&lru_pvec, page))
115 __pagevec_lru_add_file(&lru_pvec); 115 __pagevec_lru_add_file(&lru_pvec);
116 116
117 /* prevent the page from being discarded on memory pressure */
118 SetPageDirty(page);
119
117 unlock_page(page); 120 unlock_page(page);
118 } 121 }
119 122
@@ -126,6 +129,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
126 return -EFBIG; 129 return -EFBIG;
127 130
128 add_error: 131 add_error:
132 pagevec_lru_add_file(&lru_pvec);
129 page_cache_release(pages + loop); 133 page_cache_release(pages + loop);
130 for (loop++; loop < npages; loop++) 134 for (loop++; loop < npages; loop++)
131 __free_page(pages + loop); 135 __free_page(pages + loop);
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 5267098532bf..a1a4cfe19210 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -48,8 +48,16 @@ int seq_open(struct file *file, const struct seq_operations *op)
48 */ 48 */
49 file->f_version = 0; 49 file->f_version = 0;
50 50
51 /* SEQ files support lseek, but not pread/pwrite */ 51 /*
52 file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); 52 * seq_files support lseek() and pread(). They do not implement
53 * write() at all, but we clear FMODE_PWRITE here for historical
54 * reasons.
55 *
56 * If a client of seq_files a) implements file.write() and b) wishes to
57 * support pwrite() then that client will need to implement its own
58 * file.open() which calls seq_open() and then sets FMODE_PWRITE.
59 */
60 file->f_mode &= ~FMODE_PWRITE;
53 return 0; 61 return 0;
54} 62}
55EXPORT_SYMBOL(seq_open); 63EXPORT_SYMBOL(seq_open);
@@ -131,6 +139,22 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
131 int err = 0; 139 int err = 0;
132 140
133 mutex_lock(&m->lock); 141 mutex_lock(&m->lock);
142
143 /* Don't assume *ppos is where we left it */
144 if (unlikely(*ppos != m->read_pos)) {
145 m->read_pos = *ppos;
146 while ((err = traverse(m, *ppos)) == -EAGAIN)
147 ;
148 if (err) {
149 /* With prejudice... */
150 m->read_pos = 0;
151 m->version = 0;
152 m->index = 0;
153 m->count = 0;
154 goto Done;
155 }
156 }
157
134 /* 158 /*
135 * seq_file->op->..m_start/m_stop/m_next may do special actions 159 * seq_file->op->..m_start/m_stop/m_next may do special actions
136 * or optimisations based on the file->f_version, so we want to 160 * or optimisations based on the file->f_version, so we want to
@@ -230,8 +254,10 @@ Fill:
230Done: 254Done:
231 if (!copied) 255 if (!copied)
232 copied = err; 256 copied = err;
233 else 257 else {
234 *ppos += copied; 258 *ppos += copied;
259 m->read_pos += copied;
260 }
235 file->f_version = m->version; 261 file->f_version = m->version;
236 mutex_unlock(&m->lock); 262 mutex_unlock(&m->lock);
237 return copied; 263 return copied;
@@ -266,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
266 if (offset < 0) 292 if (offset < 0)
267 break; 293 break;
268 retval = offset; 294 retval = offset;
269 if (offset != file->f_pos) { 295 if (offset != m->read_pos) {
270 while ((retval=traverse(m, offset)) == -EAGAIN) 296 while ((retval=traverse(m, offset)) == -EAGAIN)
271 ; 297 ;
272 if (retval) { 298 if (retval) {
273 /* with extreme prejudice... */ 299 /* with extreme prejudice... */
274 file->f_pos = 0; 300 file->f_pos = 0;
301 m->read_pos = 0;
275 m->version = 0; 302 m->version = 0;
276 m->index = 0; 303 m->index = 0;
277 m->count = 0; 304 m->count = 0;
278 } else { 305 } else {
306 m->read_pos = offset;
279 retval = file->f_pos = offset; 307 retval = file->f_pos = offset;
280 } 308 }
281 } 309 }
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index c837dfc2b3c6..2a7960310349 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -80,7 +80,7 @@ static struct buffer_head *get_block_length(struct super_block *sb,
80 * generated a larger block - this does occasionally happen with zlib). 80 * generated a larger block - this does occasionally happen with zlib).
81 */ 81 */
82int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, 82int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
83 int length, u64 *next_index, int srclength) 83 int length, u64 *next_index, int srclength, int pages)
84{ 84{
85 struct squashfs_sb_info *msblk = sb->s_fs_info; 85 struct squashfs_sb_info *msblk = sb->s_fs_info;
86 struct buffer_head **bh; 86 struct buffer_head **bh;
@@ -184,7 +184,7 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
184 offset = 0; 184 offset = 0;
185 } 185 }
186 186
187 if (msblk->stream.avail_out == 0) { 187 if (msblk->stream.avail_out == 0 && page < pages) {
188 msblk->stream.next_out = buffer[page++]; 188 msblk->stream.next_out = buffer[page++];
189 msblk->stream.avail_out = PAGE_CACHE_SIZE; 189 msblk->stream.avail_out = PAGE_CACHE_SIZE;
190 } 190 }
@@ -201,25 +201,20 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
201 zlib_init = 1; 201 zlib_init = 1;
202 } 202 }
203 203
204 zlib_err = zlib_inflate(&msblk->stream, Z_NO_FLUSH); 204 zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH);
205 205
206 if (msblk->stream.avail_in == 0 && k < b) 206 if (msblk->stream.avail_in == 0 && k < b)
207 put_bh(bh[k++]); 207 put_bh(bh[k++]);
208 } while (zlib_err == Z_OK); 208 } while (zlib_err == Z_OK);
209 209
210 if (zlib_err != Z_STREAM_END) { 210 if (zlib_err != Z_STREAM_END) {
211 ERROR("zlib_inflate returned unexpected result" 211 ERROR("zlib_inflate error, data probably corrupt\n");
212 " 0x%x, srclength %d, avail_in %d,"
213 " avail_out %d\n", zlib_err, srclength,
214 msblk->stream.avail_in,
215 msblk->stream.avail_out);
216 goto release_mutex; 212 goto release_mutex;
217 } 213 }
218 214
219 zlib_err = zlib_inflateEnd(&msblk->stream); 215 zlib_err = zlib_inflateEnd(&msblk->stream);
220 if (zlib_err != Z_OK) { 216 if (zlib_err != Z_OK) {
221 ERROR("zlib_inflateEnd returned unexpected result 0x%x," 217 ERROR("zlib_inflate error, data probably corrupt\n");
222 " srclength %d\n", zlib_err, srclength);
223 goto release_mutex; 218 goto release_mutex;
224 } 219 }
225 length = msblk->stream.total_out; 220 length = msblk->stream.total_out;
@@ -268,7 +263,8 @@ block_release:
268 put_bh(bh[k]); 263 put_bh(bh[k]);
269 264
270read_failure: 265read_failure:
271 ERROR("sb_bread failed reading block 0x%llx\n", cur_index); 266 ERROR("squashfs_read_data failed to read block 0x%llx\n",
267 (unsigned long long) index);
272 kfree(bh); 268 kfree(bh);
273 return -EIO; 269 return -EIO;
274} 270}
diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
index f29eda16d25e..1c4739e33af6 100644
--- a/fs/squashfs/cache.c
+++ b/fs/squashfs/cache.c
@@ -119,7 +119,7 @@ struct squashfs_cache_entry *squashfs_cache_get(struct super_block *sb,
119 119
120 entry->length = squashfs_read_data(sb, entry->data, 120 entry->length = squashfs_read_data(sb, entry->data,
121 block, length, &entry->next_index, 121 block, length, &entry->next_index,
122 cache->block_size); 122 cache->block_size, cache->pages);
123 123
124 spin_lock(&cache->lock); 124 spin_lock(&cache->lock);
125 125
@@ -406,7 +406,7 @@ int squashfs_read_table(struct super_block *sb, void *buffer, u64 block,
406 for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE) 406 for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE)
407 data[i] = buffer; 407 data[i] = buffer;
408 res = squashfs_read_data(sb, data, block, length | 408 res = squashfs_read_data(sb, data, block, length |
409 SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length); 409 SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length, pages);
410 kfree(data); 410 kfree(data);
411 return res; 411 return res;
412} 412}
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index 7a63398bb855..9101dbde39ec 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -133,7 +133,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
133 type = le16_to_cpu(sqshb_ino->inode_type); 133 type = le16_to_cpu(sqshb_ino->inode_type);
134 switch (type) { 134 switch (type) {
135 case SQUASHFS_REG_TYPE: { 135 case SQUASHFS_REG_TYPE: {
136 unsigned int frag_offset, frag_size, frag; 136 unsigned int frag_offset, frag;
137 int frag_size;
137 u64 frag_blk; 138 u64 frag_blk;
138 struct squashfs_reg_inode *sqsh_ino = &squashfs_ino.reg; 139 struct squashfs_reg_inode *sqsh_ino = &squashfs_ino.reg;
139 140
@@ -175,7 +176,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
175 break; 176 break;
176 } 177 }
177 case SQUASHFS_LREG_TYPE: { 178 case SQUASHFS_LREG_TYPE: {
178 unsigned int frag_offset, frag_size, frag; 179 unsigned int frag_offset, frag;
180 int frag_size;
179 u64 frag_blk; 181 u64 frag_blk;
180 struct squashfs_lreg_inode *sqsh_ino = &squashfs_ino.lreg; 182 struct squashfs_lreg_inode *sqsh_ino = &squashfs_ino.lreg;
181 183
diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
index 6b2515d027d5..0e9feb6adf7e 100644
--- a/fs/squashfs/squashfs.h
+++ b/fs/squashfs/squashfs.h
@@ -34,7 +34,7 @@ static inline struct squashfs_inode_info *squashfs_i(struct inode *inode)
34 34
35/* block.c */ 35/* block.c */
36extern int squashfs_read_data(struct super_block *, void **, u64, int, u64 *, 36extern int squashfs_read_data(struct super_block *, void **, u64, int, u64 *,
37 int); 37 int, int);
38 38
39/* cache.c */ 39/* cache.c */
40extern struct squashfs_cache *squashfs_cache_init(char *, int, int); 40extern struct squashfs_cache *squashfs_cache_init(char *, int, int);
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 071df5b5b491..681ec0d83799 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -389,7 +389,7 @@ static int __init init_squashfs_fs(void)
389 return err; 389 return err;
390 } 390 }
391 391
392 printk(KERN_INFO "squashfs: version 4.0 (2009/01/03) " 392 printk(KERN_INFO "squashfs: version 4.0 (2009/01/31) "
393 "Phillip Lougher\n"); 393 "Phillip Lougher\n");
394 394
395 return 0; 395 return 0;
diff --git a/fs/super.c b/fs/super.c
index 61dce001dd57..6ce501447ada 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -82,7 +82,22 @@ static struct super_block *alloc_super(struct file_system_type *type)
82 * lock ordering than usbfs: 82 * lock ordering than usbfs:
83 */ 83 */
84 lockdep_set_class(&s->s_lock, &type->s_lock_key); 84 lockdep_set_class(&s->s_lock, &type->s_lock_key);
85 down_write(&s->s_umount); 85 /*
86 * sget() can have s_umount recursion.
87 *
88 * When it cannot find a suitable sb, it allocates a new
89 * one (this one), and tries again to find a suitable old
90 * one.
91 *
92 * In case that succeeds, it will acquire the s_umount
93 * lock of the old one. Since these are clearly distrinct
94 * locks, and this object isn't exposed yet, there's no
95 * risk of deadlocks.
96 *
97 * Annotate this by putting this lock in a different
98 * subclass.
99 */
100 down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING);
86 s->s_count = S_BIAS; 101 s->s_count = S_BIAS;
87 atomic_set(&s->s_active, 1); 102 atomic_set(&s->s_active, 1);
88 mutex_init(&s->s_vfs_rename_mutex); 103 mutex_init(&s->s_vfs_rename_mutex);
@@ -356,8 +371,10 @@ retry:
356 continue; 371 continue;
357 if (!grab_super(old)) 372 if (!grab_super(old))
358 goto retry; 373 goto retry;
359 if (s) 374 if (s) {
375 up_write(&s->s_umount);
360 destroy_super(s); 376 destroy_super(s);
377 }
361 return old; 378 return old;
362 } 379 }
363 } 380 }
@@ -372,6 +389,7 @@ retry:
372 err = set(s, data); 389 err = set(s, data);
373 if (err) { 390 if (err) {
374 spin_unlock(&sb_lock); 391 spin_unlock(&sb_lock);
392 up_write(&s->s_umount);
375 destroy_super(s); 393 destroy_super(s);
376 return ERR_PTR(err); 394 return ERR_PTR(err);
377 } 395 }
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 6a123b8ff3f5..b042bd7034b1 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -186,10 +186,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
186 BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); 186 BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
187 BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); 187 BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
188 188
189 if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) 189 if ((flags & ~TFD_CREATE_FLAGS) ||
190 return -EINVAL; 190 (clockid != CLOCK_MONOTONIC &&
191 if (clockid != CLOCK_MONOTONIC && 191 clockid != CLOCK_REALTIME))
192 clockid != CLOCK_REALTIME)
193 return -EINVAL; 192 return -EINVAL;
194 193
195 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 194 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -201,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
201 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); 200 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS);
202 201
203 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, 202 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
204 flags & (O_CLOEXEC | O_NONBLOCK)); 203 flags & TFD_SHARED_FCNTL_FLAGS);
205 if (ufd < 0) 204 if (ufd < 0)
206 kfree(ctx); 205 kfree(ctx);
207 206
@@ -219,7 +218,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
219 if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) 218 if (copy_from_user(&ktmr, utmr, sizeof(ktmr)))
220 return -EFAULT; 219 return -EFAULT;
221 220
222 if (!timespec_valid(&ktmr.it_value) || 221 if ((flags & ~TFD_SETTIME_FLAGS) ||
222 !timespec_valid(&ktmr.it_value) ||
223 !timespec_valid(&ktmr.it_interval)) 223 !timespec_valid(&ktmr.it_interval))
224 return -EINVAL; 224 return -EINVAL;
225 225
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index d71dc44e21ed..aa1016bb9134 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -34,6 +34,12 @@
34#include <linux/backing-dev.h> 34#include <linux/backing-dev.h>
35#include <linux/freezer.h> 35#include <linux/freezer.h>
36 36
37#include "xfs_sb.h"
38#include "xfs_inum.h"
39#include "xfs_ag.h"
40#include "xfs_dmapi.h"
41#include "xfs_mount.h"
42
37static kmem_zone_t *xfs_buf_zone; 43static kmem_zone_t *xfs_buf_zone;
38STATIC int xfsbufd(void *); 44STATIC int xfsbufd(void *);
39STATIC int xfsbufd_wakeup(int, gfp_t); 45STATIC int xfsbufd_wakeup(int, gfp_t);
@@ -166,6 +172,75 @@ test_page_region(
166} 172}
167 173
168/* 174/*
175 * Mapping of multi-page buffers into contiguous virtual space
176 */
177
178typedef struct a_list {
179 void *vm_addr;
180 struct a_list *next;
181} a_list_t;
182
183static a_list_t *as_free_head;
184static int as_list_len;
185static DEFINE_SPINLOCK(as_lock);
186
187/*
188 * Try to batch vunmaps because they are costly.
189 */
190STATIC void
191free_address(
192 void *addr)
193{
194 a_list_t *aentry;
195
196#ifdef CONFIG_XEN
197 /*
198 * Xen needs to be able to make sure it can get an exclusive
199 * RO mapping of pages it wants to turn into a pagetable. If
200 * a newly allocated page is also still being vmap()ed by xfs,
201 * it will cause pagetable construction to fail. This is a
202 * quick workaround to always eagerly unmap pages so that Xen
203 * is happy.
204 */
205 vunmap(addr);
206 return;
207#endif
208
209 aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
210 if (likely(aentry)) {
211 spin_lock(&as_lock);
212 aentry->next = as_free_head;
213 aentry->vm_addr = addr;
214 as_free_head = aentry;
215 as_list_len++;
216 spin_unlock(&as_lock);
217 } else {
218 vunmap(addr);
219 }
220}
221
222STATIC void
223purge_addresses(void)
224{
225 a_list_t *aentry, *old;
226
227 if (as_free_head == NULL)
228 return;
229
230 spin_lock(&as_lock);
231 aentry = as_free_head;
232 as_free_head = NULL;
233 as_list_len = 0;
234 spin_unlock(&as_lock);
235
236 while ((old = aentry) != NULL) {
237 vunmap(aentry->vm_addr);
238 aentry = aentry->next;
239 kfree(old);
240 }
241}
242
243/*
169 * Internal xfs_buf_t object manipulation 244 * Internal xfs_buf_t object manipulation
170 */ 245 */
171 246
@@ -264,7 +339,7 @@ xfs_buf_free(
264 uint i; 339 uint i;
265 340
266 if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) 341 if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1))
267 vm_unmap_ram(bp->b_addr - bp->b_offset, bp->b_page_count); 342 free_address(bp->b_addr - bp->b_offset);
268 343
269 for (i = 0; i < bp->b_page_count; i++) { 344 for (i = 0; i < bp->b_page_count; i++) {
270 struct page *page = bp->b_pages[i]; 345 struct page *page = bp->b_pages[i];
@@ -386,8 +461,10 @@ _xfs_buf_map_pages(
386 bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset; 461 bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset;
387 bp->b_flags |= XBF_MAPPED; 462 bp->b_flags |= XBF_MAPPED;
388 } else if (flags & XBF_MAPPED) { 463 } else if (flags & XBF_MAPPED) {
389 bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count, 464 if (as_list_len > 64)
390 -1, PAGE_KERNEL); 465 purge_addresses();
466 bp->b_addr = vmap(bp->b_pages, bp->b_page_count,
467 VM_MAP, PAGE_KERNEL);
391 if (unlikely(bp->b_addr == NULL)) 468 if (unlikely(bp->b_addr == NULL))
392 return -ENOMEM; 469 return -ENOMEM;
393 bp->b_addr += bp->b_offset; 470 bp->b_addr += bp->b_offset;
@@ -1364,10 +1441,12 @@ xfs_unregister_buftarg(
1364 1441
1365void 1442void
1366xfs_free_buftarg( 1443xfs_free_buftarg(
1367 xfs_buftarg_t *btp) 1444 struct xfs_mount *mp,
1445 struct xfs_buftarg *btp)
1368{ 1446{
1369 xfs_flush_buftarg(btp, 1); 1447 xfs_flush_buftarg(btp, 1);
1370 xfs_blkdev_issue_flush(btp); 1448 if (mp->m_flags & XFS_MOUNT_BARRIER)
1449 xfs_blkdev_issue_flush(btp);
1371 xfs_free_bufhash(btp); 1450 xfs_free_bufhash(btp);
1372 iput(btp->bt_mapping->host); 1451 iput(btp->bt_mapping->host);
1373 1452
@@ -1672,6 +1751,8 @@ xfsbufd(
1672 count++; 1751 count++;
1673 } 1752 }
1674 1753
1754 if (as_list_len > 0)
1755 purge_addresses();
1675 if (count) 1756 if (count)
1676 blk_run_address_space(target->bt_mapping); 1757 blk_run_address_space(target->bt_mapping);
1677 1758
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 288ae7c4c800..9b4d666ad31f 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -413,7 +413,7 @@ static inline int XFS_bwrite(xfs_buf_t *bp)
413 * Handling of buftargs. 413 * Handling of buftargs.
414 */ 414 */
415extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int); 415extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int);
416extern void xfs_free_buftarg(xfs_buftarg_t *); 416extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *);
417extern void xfs_wait_buftarg(xfs_buftarg_t *); 417extern void xfs_wait_buftarg(xfs_buftarg_t *);
418extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); 418extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
419extern int xfs_flush_buftarg(xfs_buftarg_t *, int); 419extern int xfs_flush_buftarg(xfs_buftarg_t *, int);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index c71e226da7f5..32ae5028e96b 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -734,15 +734,15 @@ xfs_close_devices(
734{ 734{
735 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { 735 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {
736 struct block_device *logdev = mp->m_logdev_targp->bt_bdev; 736 struct block_device *logdev = mp->m_logdev_targp->bt_bdev;
737 xfs_free_buftarg(mp->m_logdev_targp); 737 xfs_free_buftarg(mp, mp->m_logdev_targp);
738 xfs_blkdev_put(logdev); 738 xfs_blkdev_put(logdev);
739 } 739 }
740 if (mp->m_rtdev_targp) { 740 if (mp->m_rtdev_targp) {
741 struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; 741 struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev;
742 xfs_free_buftarg(mp->m_rtdev_targp); 742 xfs_free_buftarg(mp, mp->m_rtdev_targp);
743 xfs_blkdev_put(rtdev); 743 xfs_blkdev_put(rtdev);
744 } 744 }
745 xfs_free_buftarg(mp->m_ddev_targp); 745 xfs_free_buftarg(mp, mp->m_ddev_targp);
746} 746}
747 747
748/* 748/*
@@ -811,9 +811,9 @@ xfs_open_devices(
811 811
812 out_free_rtdev_targ: 812 out_free_rtdev_targ:
813 if (mp->m_rtdev_targp) 813 if (mp->m_rtdev_targp)
814 xfs_free_buftarg(mp->m_rtdev_targp); 814 xfs_free_buftarg(mp, mp->m_rtdev_targp);
815 out_free_ddev_targ: 815 out_free_ddev_targ:
816 xfs_free_buftarg(mp->m_ddev_targp); 816 xfs_free_buftarg(mp, mp->m_ddev_targp);
817 out_close_rtdev: 817 out_close_rtdev:
818 if (rtdev) 818 if (rtdev)
819 xfs_blkdev_put(rtdev); 819 xfs_blkdev_put(rtdev);
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index e2fb6210d4c5..478e587087fe 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -246,9 +246,6 @@ xfs_iget_cache_miss(
246 goto out_destroy; 246 goto out_destroy;
247 } 247 }
248 248
249 if (lock_flags)
250 xfs_ilock(ip, lock_flags);
251
252 /* 249 /*
253 * Preload the radix tree so we can insert safely under the 250 * Preload the radix tree so we can insert safely under the
254 * write spinlock. Note that we cannot sleep inside the preload 251 * write spinlock. Note that we cannot sleep inside the preload
@@ -256,7 +253,16 @@ xfs_iget_cache_miss(
256 */ 253 */
257 if (radix_tree_preload(GFP_KERNEL)) { 254 if (radix_tree_preload(GFP_KERNEL)) {
258 error = EAGAIN; 255 error = EAGAIN;
259 goto out_unlock; 256 goto out_destroy;
257 }
258
259 /*
260 * Because the inode hasn't been added to the radix-tree yet it can't
261 * be found by another thread, so we can do the non-sleeping lock here.
262 */
263 if (lock_flags) {
264 if (!xfs_ilock_nowait(ip, lock_flags))
265 BUG();
260 } 266 }
261 267
262 mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); 268 mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1);
@@ -284,7 +290,6 @@ xfs_iget_cache_miss(
284out_preload_end: 290out_preload_end:
285 write_unlock(&pag->pag_ici_lock); 291 write_unlock(&pag->pag_ici_lock);
286 radix_tree_preload_end(); 292 radix_tree_preload_end();
287out_unlock:
288 if (lock_flags) 293 if (lock_flags)
289 xfs_iunlock(ip, lock_flags); 294 xfs_iunlock(ip, lock_flags);
290out_destroy: 295out_destroy:
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index b1047de2fffd..61af610d79b3 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1455,10 +1455,19 @@ xlog_recover_add_to_trans(
1455 item = item->ri_prev; 1455 item = item->ri_prev;
1456 1456
1457 if (item->ri_total == 0) { /* first region to be added */ 1457 if (item->ri_total == 0) { /* first region to be added */
1458 item->ri_total = in_f->ilf_size; 1458 if (in_f->ilf_size == 0 ||
1459 ASSERT(item->ri_total <= XLOG_MAX_REGIONS_IN_ITEM); 1459 in_f->ilf_size > XLOG_MAX_REGIONS_IN_ITEM) {
1460 item->ri_buf = kmem_zalloc((item->ri_total * 1460 xlog_warn(
1461 sizeof(xfs_log_iovec_t)), KM_SLEEP); 1461 "XFS: bad number of regions (%d) in inode log format",
1462 in_f->ilf_size);
1463 ASSERT(0);
1464 return XFS_ERROR(EIO);
1465 }
1466
1467 item->ri_total = in_f->ilf_size;
1468 item->ri_buf =
1469 kmem_zalloc(item->ri_total * sizeof(xfs_log_iovec_t),
1470 KM_SLEEP);
1462 } 1471 }
1463 ASSERT(item->ri_total > item->ri_cnt); 1472 ASSERT(item->ri_total > item->ri_cnt);
1464 /* Description region is ri_buf[0] */ 1473 /* Description region is ri_buf[0] */
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 83c51aba534b..e16fdb1f4f4f 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -478,7 +478,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
478#define __swp_type(x) (((x).val >> 2) & 0x1f) 478#define __swp_type(x) (((x).val >> 2) & 0x1f)
479#define __swp_offset(x) ((x).val >> 8) 479#define __swp_offset(x) ((x).val >> 8)
480#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) 480#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) })
481#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte }) 481#define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte })
482#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 482#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
483 483
484static inline int pte_file(pte_t pte) 484static inline int pte_file(pte_t pte)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8190b9bcc2d9..e5f4ae989abf 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1321,6 +1321,8 @@ void drm_gem_object_free(struct kref *kref);
1321struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1321struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1322 size_t size); 1322 size_t size);
1323void drm_gem_object_handle_free(struct kref *kref); 1323void drm_gem_object_handle_free(struct kref *kref);
1324void drm_gem_vm_open(struct vm_area_struct *vma);
1325void drm_gem_vm_close(struct vm_area_struct *vma);
1324int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1326int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1325 1327
1326static inline void 1328static inline void
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index d54de24bf371..5ded1acfb543 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -609,7 +609,7 @@ extern char *drm_get_dvi_i_subconnector_name(int val);
609extern char *drm_get_dvi_i_select_name(int val); 609extern char *drm_get_dvi_i_select_name(int val);
610extern char *drm_get_tv_subconnector_name(int val); 610extern char *drm_get_tv_subconnector_name(int val);
611extern char *drm_get_tv_select_name(int val); 611extern char *drm_get_tv_select_name(int val);
612extern void drm_fb_release(struct file *filp); 612extern void drm_fb_release(struct drm_file *file_priv);
613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
614extern struct edid *drm_get_edid(struct drm_connector *connector, 614extern struct edid *drm_get_edid(struct drm_connector *connector,
615 struct i2c_adapter *adapter); 615 struct i2c_adapter *adapter);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 0c6f0e11b41b..c7d4b2e606a5 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -54,13 +54,13 @@ struct drm_crtc_helper_funcs {
54 struct drm_display_mode *mode, 54 struct drm_display_mode *mode,
55 struct drm_display_mode *adjusted_mode); 55 struct drm_display_mode *adjusted_mode);
56 /* Actually set the mode */ 56 /* Actually set the mode */
57 void (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, 57 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
58 struct drm_display_mode *adjusted_mode, int x, int y, 58 struct drm_display_mode *adjusted_mode, int x, int y,
59 struct drm_framebuffer *old_fb); 59 struct drm_framebuffer *old_fb);
60 60
61 /* Move the crtc on the current fb to the given position *optional* */ 61 /* Move the crtc on the current fb to the given position *optional* */
62 void (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 62 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
63 struct drm_framebuffer *old_fb); 63 struct drm_framebuffer *old_fb);
64}; 64};
65 65
66struct drm_encoder_helper_funcs { 66struct drm_encoder_helper_funcs {
@@ -76,6 +76,7 @@ struct drm_encoder_helper_funcs {
76 void (*mode_set)(struct drm_encoder *encoder, 76 void (*mode_set)(struct drm_encoder *encoder,
77 struct drm_display_mode *mode, 77 struct drm_display_mode *mode,
78 struct drm_display_mode *adjusted_mode); 78 struct drm_display_mode *adjusted_mode);
79 struct drm_crtc *(*get_crtc)(struct drm_encoder *encoder);
79 /* detect for DAC style encoders */ 80 /* detect for DAC style encoders */
80 enum drm_connector_status (*detect)(struct drm_encoder *encoder, 81 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
81 struct drm_connector *connector); 82 struct drm_connector *connector);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index c707c15f5164..a11cc9d32591 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -58,10 +58,10 @@ struct detailed_pixel_timing {
58 u8 hsync_pulse_width_lo; 58 u8 hsync_pulse_width_lo;
59 u8 vsync_pulse_width_lo:4; 59 u8 vsync_pulse_width_lo:4;
60 u8 vsync_offset_lo:4; 60 u8 vsync_offset_lo:4;
61 u8 hsync_pulse_width_hi:2;
62 u8 hsync_offset_hi:2;
63 u8 vsync_pulse_width_hi:2; 61 u8 vsync_pulse_width_hi:2;
64 u8 vsync_offset_hi:2; 62 u8 vsync_offset_hi:2;
63 u8 hsync_pulse_width_hi:2;
64 u8 hsync_offset_hi:2;
65 u8 width_mm_lo; 65 u8 width_mm_lo;
66 u8 height_mm_lo; 66 u8 height_mm_lo;
67 u8 height_mm_hi:4; 67 u8 height_mm_hi:4;
@@ -69,8 +69,8 @@ struct detailed_pixel_timing {
69 u8 hborder; 69 u8 hborder;
70 u8 vborder; 70 u8 vborder;
71 u8 unknown0:1; 71 u8 unknown0:1;
72 u8 vsync_positive:1;
73 u8 hsync_positive:1; 72 u8 hsync_positive:1;
73 u8 vsync_positive:1;
74 u8 separate_sync:2; 74 u8 separate_sync:2;
75 u8 stereo:1; 75 u8 stereo:1;
76 u8 unknown6:1; 76 u8 unknown6:1;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b97cdc516a8f..106c3ba50844 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -52,6 +52,7 @@ header-y += const.h
52header-y += cgroupstats.h 52header-y += cgroupstats.h
53header-y += cramfs_fs.h 53header-y += cramfs_fs.h
54header-y += cycx_cfm.h 54header-y += cycx_cfm.h
55header-y += dcbnl.h
55header-y += dlmconstants.h 56header-y += dlmconstants.h
56header-y += dlm_device.h 57header-y += dlm_device.h
57header-y += dlm_netlink.h 58header-y += dlm_netlink.h
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 08a86d5cdf1b..9a061accd8b8 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -89,6 +89,8 @@ enum {
89 ATA_ID_DLF = 128, 89 ATA_ID_DLF = 128,
90 ATA_ID_CSFO = 129, 90 ATA_ID_CSFO = 129,
91 ATA_ID_CFA_POWER = 160, 91 ATA_ID_CFA_POWER = 160,
92 ATA_ID_CFA_KEY_MGMT = 162,
93 ATA_ID_CFA_MODES = 163,
92 ATA_ID_ROT_SPEED = 217, 94 ATA_ID_ROT_SPEED = 217,
93 ATA_ID_PIO4 = (1 << 1), 95 ATA_ID_PIO4 = (1 << 1),
94 96
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 2aa283ab062b..d8bd43bfdcf5 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -171,8 +171,6 @@ struct bio {
171#define BIO_RW_FAILFAST_TRANSPORT 8 171#define BIO_RW_FAILFAST_TRANSPORT 8
172#define BIO_RW_FAILFAST_DRIVER 9 172#define BIO_RW_FAILFAST_DRIVER 9
173 173
174#define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG)
175
176#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 174#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
177 175
178/* 176/*
@@ -533,7 +531,7 @@ extern void bio_integrity_endio(struct bio *, int);
533extern void bio_integrity_advance(struct bio *, unsigned int); 531extern void bio_integrity_advance(struct bio *, unsigned int);
534extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); 532extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
535extern void bio_integrity_split(struct bio *, struct bio_pair *, int); 533extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
536extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *); 534extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *);
537extern int bioset_integrity_create(struct bio_set *, int); 535extern int bioset_integrity_create(struct bio_set *, int);
538extern void bioset_integrity_free(struct bio_set *); 536extern void bioset_integrity_free(struct bio_set *);
539extern void bio_integrity_init_slab(void); 537extern void bio_integrity_init_slab(void);
@@ -544,7 +542,7 @@ extern void bio_integrity_init_slab(void);
544#define bioset_integrity_create(a, b) (0) 542#define bioset_integrity_create(a, b) (0)
545#define bio_integrity_prep(a) (0) 543#define bio_integrity_prep(a) (0)
546#define bio_integrity_enabled(a) (0) 544#define bio_integrity_enabled(a) (0)
547#define bio_integrity_clone(a, b, c) (0) 545#define bio_integrity_clone(a, b, c,d ) (0)
548#define bioset_integrity_free(a) do { } while (0) 546#define bioset_integrity_free(a) do { } while (0)
549#define bio_integrity_free(a, b) do { } while (0) 547#define bio_integrity_free(a, b) do { } while (0)
550#define bio_integrity_endio(a, b) do { } while (0) 548#define bio_integrity_endio(a, b) do { } while (0)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index dcaa0fd84b02..465d6babc847 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -708,6 +708,8 @@ struct req_iterator {
708}; 708};
709 709
710/* This should not be used directly - use rq_for_each_segment */ 710/* This should not be used directly - use rq_for_each_segment */
711#define for_each_bio(_bio) \
712 for (; _bio; _bio = _bio->bi_next)
711#define __rq_for_each_bio(_bio, rq) \ 713#define __rq_for_each_bio(_bio, rq) \
712 if ((rq->bio)) \ 714 if ((rq->bio)) \
713 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) 715 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 25379cba2370..6e915878e88c 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -15,6 +15,7 @@ enum blktrace_cat {
15 BLK_TC_WRITE = 1 << 1, /* writes */ 15 BLK_TC_WRITE = 1 << 1, /* writes */
16 BLK_TC_BARRIER = 1 << 2, /* barrier */ 16 BLK_TC_BARRIER = 1 << 2, /* barrier */
17 BLK_TC_SYNC = 1 << 3, /* sync IO */ 17 BLK_TC_SYNC = 1 << 3, /* sync IO */
18 BLK_TC_SYNCIO = BLK_TC_SYNC,
18 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ 19 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
19 BLK_TC_REQUEUE = 1 << 5, /* requeueing */ 20 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
20 BLK_TC_ISSUE = 1 << 6, /* issue */ 21 BLK_TC_ISSUE = 1 << 6, /* issue */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 1514d534deeb..a3ed7cb8ca34 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -52,7 +52,15 @@
52#define __deprecated __attribute__((deprecated)) 52#define __deprecated __attribute__((deprecated))
53#define __packed __attribute__((packed)) 53#define __packed __attribute__((packed))
54#define __weak __attribute__((weak)) 54#define __weak __attribute__((weak))
55#define __naked __attribute__((naked)) 55
56/*
57 * it doesn't make sense on ARM (currently the only user of __naked) to trace
58 * naked functions because then mcount is called without stack and frame pointer
59 * being set up and there is no chance to restore the lr register to the value
60 * before mcount was called.
61 */
62#define __naked __attribute__((naked)) notrace
63
56#define __noreturn __attribute__((noreturn)) 64#define __noreturn __attribute__((noreturn))
57 65
58/* 66/*
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 384b38d3e8e2..161042746afc 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -234,7 +234,6 @@ struct cpufreq_driver {
234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
235 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
236 struct freq_attr **attr; 236 struct freq_attr **attr;
237 bool hide_interface;
238}; 237};
239 238
240/* flags */ 239/* flags */
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index b0ef274e0031..7d2e10006188 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -20,10 +20,12 @@
20#ifndef __LINUX_DCBNL_H__ 20#ifndef __LINUX_DCBNL_H__
21#define __LINUX_DCBNL_H__ 21#define __LINUX_DCBNL_H__
22 22
23#include <linux/types.h>
24
23#define DCB_PROTO_VERSION 1 25#define DCB_PROTO_VERSION 1
24 26
25struct dcbmsg { 27struct dcbmsg {
26 unsigned char dcb_family; 28 __u8 dcb_family;
27 __u8 cmd; 29 __u8 cmd;
28 __u16 dcb_pad; 30 __u16 dcb_pad;
29}; 31};
diff --git a/include/linux/device.h b/include/linux/device.h
index 45e5b1921fbb..47f343c7bdda 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -147,6 +147,8 @@ extern void put_driver(struct device_driver *drv);
147extern struct device_driver *driver_find(const char *name, 147extern struct device_driver *driver_find(const char *name,
148 struct bus_type *bus); 148 struct bus_type *bus);
149extern int driver_probe_done(void); 149extern int driver_probe_done(void);
150extern int wait_for_device_probe(void);
151
150 152
151/* sysfs interface for exporting driver attributes */ 153/* sysfs interface for exporting driver attributes */
152 154
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3e68469c1885..1956c8d46d32 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -97,7 +97,6 @@ typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t;
97 97
98/** 98/**
99 * struct dma_chan_percpu - the per-CPU part of struct dma_chan 99 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
100 * @refcount: local_t used for open-coded "bigref" counting
101 * @memcpy_count: transaction counter 100 * @memcpy_count: transaction counter
102 * @bytes_transferred: byte counter 101 * @bytes_transferred: byte counter
103 */ 102 */
@@ -114,13 +113,11 @@ struct dma_chan_percpu {
114 * @cookie: last cookie value returned to client 113 * @cookie: last cookie value returned to client
115 * @chan_id: channel ID for sysfs 114 * @chan_id: channel ID for sysfs
116 * @dev: class device for sysfs 115 * @dev: class device for sysfs
117 * @refcount: kref, used in "bigref" slow-mode
118 * @slow_ref: indicates that the DMA channel is free
119 * @rcu: the DMA channel's RCU head
120 * @device_node: used to add this to the device chan list 116 * @device_node: used to add this to the device chan list
121 * @local: per-cpu pointer to a struct dma_chan_percpu 117 * @local: per-cpu pointer to a struct dma_chan_percpu
122 * @client-count: how many clients are using this channel 118 * @client-count: how many clients are using this channel
123 * @table_count: number of appearances in the mem-to-mem allocation table 119 * @table_count: number of appearances in the mem-to-mem allocation table
120 * @private: private data for certain client-channel associations
124 */ 121 */
125struct dma_chan { 122struct dma_chan {
126 struct dma_device *device; 123 struct dma_device *device;
@@ -134,6 +131,7 @@ struct dma_chan {
134 struct dma_chan_percpu *local; 131 struct dma_chan_percpu *local;
135 int client_count; 132 int client_count;
136 int table_count; 133 int table_count;
134 void *private;
137}; 135};
138 136
139/** 137/**
@@ -211,8 +209,6 @@ struct dma_async_tx_descriptor {
211 * @global_node: list_head for global dma_device_list 209 * @global_node: list_head for global dma_device_list
212 * @cap_mask: one or more dma_capability flags 210 * @cap_mask: one or more dma_capability flags
213 * @max_xor: maximum number of xor sources, 0 if no capability 211 * @max_xor: maximum number of xor sources, 0 if no capability
214 * @refcount: reference count
215 * @done: IO completion struct
216 * @dev_id: unique device ID 212 * @dev_id: unique device ID
217 * @dev: struct device reference for dma mapping api 213 * @dev: struct device reference for dma mapping api
218 * @device_alloc_chan_resources: allocate resources and return the 214 * @device_alloc_chan_resources: allocate resources and return the
@@ -225,6 +221,7 @@ struct dma_async_tx_descriptor {
225 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 221 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
226 * @device_prep_slave_sg: prepares a slave dma operation 222 * @device_prep_slave_sg: prepares a slave dma operation
227 * @device_terminate_all: terminate all pending operations 223 * @device_terminate_all: terminate all pending operations
224 * @device_is_tx_complete: poll for transaction completion
228 * @device_issue_pending: push pending transactions to hardware 225 * @device_issue_pending: push pending transactions to hardware
229 */ 226 */
230struct dma_device { 227struct dma_device {
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index 6e199c8dfacc..cca686b39123 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * include/linux/firmware-map.h: 2 * include/linux/firmware-map.h:
3 * Copyright (C) 2008 SUSE LINUX Products GmbH 3 * Copyright (C) 2008 SUSE LINUX Products GmbH
4 * by Bernhard Walle <bwalle@suse.de> 4 * by Bernhard Walle <bernhard.walle@gmx.de>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License v2.0 as published by 7 * it under the terms of the GNU General Public License v2.0 as published by
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6022f44043f2..92734c0012e6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -54,24 +54,30 @@ struct inodes_stat_t {
54#define MAY_ACCESS 16 54#define MAY_ACCESS 16
55#define MAY_OPEN 32 55#define MAY_OPEN 32
56 56
57/*
58 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
59 * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
60 */
61
57/* file is open for reading */ 62/* file is open for reading */
58#define FMODE_READ ((__force fmode_t)1) 63#define FMODE_READ ((__force fmode_t)1)
59/* file is open for writing */ 64/* file is open for writing */
60#define FMODE_WRITE ((__force fmode_t)2) 65#define FMODE_WRITE ((__force fmode_t)2)
61/* file is seekable */ 66/* file is seekable */
62#define FMODE_LSEEK ((__force fmode_t)4) 67#define FMODE_LSEEK ((__force fmode_t)4)
63/* file can be accessed using pread/pwrite */ 68/* file can be accessed using pread */
64#define FMODE_PREAD ((__force fmode_t)8) 69#define FMODE_PREAD ((__force fmode_t)8)
65#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ 70/* file can be accessed using pwrite */
71#define FMODE_PWRITE ((__force fmode_t)16)
66/* File is opened for execution with sys_execve / sys_uselib */ 72/* File is opened for execution with sys_execve / sys_uselib */
67#define FMODE_EXEC ((__force fmode_t)16) 73#define FMODE_EXEC ((__force fmode_t)32)
68/* File is opened with O_NDELAY (only set for block devices) */ 74/* File is opened with O_NDELAY (only set for block devices) */
69#define FMODE_NDELAY ((__force fmode_t)32) 75#define FMODE_NDELAY ((__force fmode_t)64)
70/* File is opened with O_EXCL (only set for block devices) */ 76/* File is opened with O_EXCL (only set for block devices) */
71#define FMODE_EXCL ((__force fmode_t)64) 77#define FMODE_EXCL ((__force fmode_t)128)
72/* File is opened using open(.., 3, ..) and is writeable only for ioctls 78/* File is opened using open(.., 3, ..) and is writeable only for ioctls
73 (specialy hack for floppy.c) */ 79 (specialy hack for floppy.c) */
74#define FMODE_WRITE_IOCTL ((__force fmode_t)128) 80#define FMODE_WRITE_IOCTL ((__force fmode_t)256)
75 81
76/* 82/*
77 * Don't update ctime and mtime. 83 * Don't update ctime and mtime.
@@ -87,10 +93,10 @@ struct inodes_stat_t {
87#define WRITE 1 93#define WRITE 1
88#define READA 2 /* read-ahead - don't block if no resources */ 94#define READA 2 /* read-ahead - don't block if no resources */
89#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
90#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
91#define READ_META (READ | (1 << BIO_RW_META)) 97#define READ_META (READ | (1 << BIO_RW_META))
92#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 98#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
93#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) 99#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
94#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 100#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
95#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 101#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
96#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 102#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index c37e9241fae7..ed21bd3dbd25 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -511,7 +511,6 @@ struct hd_driveid {
511 unsigned short words69_70[2]; /* reserved words 69-70 511 unsigned short words69_70[2]; /* reserved words 69-70
512 * future command overlap and queuing 512 * future command overlap and queuing
513 */ 513 */
514 /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
515 unsigned short words71_74[4]; /* reserved words 71-74 514 unsigned short words71_74[4]; /* reserved words 71-74
516 * for IDENTIFY PACKET DEVICE command 515 * for IDENTIFY PACKET DEVICE command
517 */ 516 */
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index 311315b56b61..fd53bfd26470 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -33,7 +33,7 @@
33 */ 33 */
34#define I2C_RETRIES 0x0701 /* number of times a device address should 34#define I2C_RETRIES 0x0701 /* number of times a device address should
35 be polled when not acknowledging */ 35 be polled when not acknowledging */
36#define I2C_TIMEOUT 0x0702 /* set timeout in jiffies - call with int */ 36#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */
37 37
38/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 38/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
39 * are NOT supported! (due to code brokenness) 39 * are NOT supported! (due to code brokenness)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fcfbfea3af72..c86c3b07604c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -361,7 +361,7 @@ struct i2c_adapter {
361 struct mutex bus_lock; 361 struct mutex bus_lock;
362 struct mutex clist_lock; 362 struct mutex clist_lock;
363 363
364 int timeout; 364 int timeout; /* in jiffies */
365 int retries; 365 int retries;
366 struct device dev; /* the adapter device */ 366 struct device dev; /* the adapter device */
367 367
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 194da5a4b0d6..25087aead657 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -663,7 +663,7 @@ typedef struct ide_drive_s ide_drive_t;
663#define to_ide_device(dev) container_of(dev, ide_drive_t, gendev) 663#define to_ide_device(dev) container_of(dev, ide_drive_t, gendev)
664 664
665#define to_ide_drv(obj, cont_type) \ 665#define to_ide_drv(obj, cont_type) \
666 container_of(obj, struct cont_type, kref) 666 container_of(obj, struct cont_type, dev)
667 667
668#define ide_drv_g(disk, cont_type) \ 668#define ide_drv_g(disk, cont_type) \
669 container_of((disk)->private_data, struct cont_type, driver) 669 container_of((disk)->private_data, struct cont_type, driver)
@@ -797,6 +797,7 @@ typedef struct hwif_s {
797 struct scatterlist *sg_table; 797 struct scatterlist *sg_table;
798 int sg_max_nents; /* Maximum number of entries in it */ 798 int sg_max_nents; /* Maximum number of entries in it */
799 int sg_nents; /* Current number of entries in it */ 799 int sg_nents; /* Current number of entries in it */
800 int orig_sg_nents;
800 int sg_dma_direction; /* dma transfer direction */ 801 int sg_dma_direction; /* dma transfer direction */
801 802
802 /* data phase of the active command (currently only valid for PIO/DMA) */ 803 /* data phase of the active command (currently only valid for PIO/DMA) */
@@ -866,6 +867,7 @@ struct ide_host {
866 unsigned int n_ports; 867 unsigned int n_ports;
867 struct device *dev[2]; 868 struct device *dev[2];
868 unsigned int (*init_chipset)(struct pci_dev *); 869 unsigned int (*init_chipset)(struct pci_dev *);
870 irq_handler_t irq_handler;
869 unsigned long host_flags; 871 unsigned long host_flags;
870 void *host_priv; 872 void *host_priv;
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 873 ide_hwif_t *cur_port; /* for hosts requiring serialization */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index f8ff918c208f..e1ff5b14310e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -210,6 +210,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
210 210
211 /* Move the mac addresses to the beginning of the new header. */ 211 /* Move the mac addresses to the beginning of the new header. */
212 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); 212 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
213 skb->mac_header -= VLAN_HLEN;
213 214
214 /* first, the ethernet type */ 215 /* first, the ethernet type */
215 veth->h_vlan_proto = htons(ETH_P_8021Q); 216 veth->h_vlan_proto = htons(ETH_P_8021Q);
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index c4f6c101dbcd..d2e3cbfba14f 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -194,6 +194,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
194/* FSTS_REG */ 194/* FSTS_REG */
195#define DMA_FSTS_PPF ((u32)2) 195#define DMA_FSTS_PPF ((u32)2)
196#define DMA_FSTS_PFO ((u32)1) 196#define DMA_FSTS_PFO ((u32)1)
197#define DMA_FSTS_IQE (1 << 4)
197#define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff) 198#define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
198 199
199/* FRCD_REG, 32 bits access */ 200/* FRCD_REG, 32 bits access */
@@ -328,7 +329,7 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
328 unsigned int size_order, u64 type, 329 unsigned int size_order, u64 type,
329 int non_present_entry_flush); 330 int non_present_entry_flush);
330 331
331extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 332extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
332 333
333extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t); 334extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
334extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t); 335extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 468e3a25a4a1..91658d076598 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -61,6 +61,17 @@
61 61
62typedef irqreturn_t (*irq_handler_t)(int, void *); 62typedef irqreturn_t (*irq_handler_t)(int, void *);
63 63
64/**
65 * struct irqaction - per interrupt action descriptor
66 * @handler: interrupt handler function
67 * @flags: flags (see IRQF_* above)
68 * @mask: no comment as it is useless and about to be removed
69 * @name: name of the device
70 * @dev_id: cookie to identify the device
71 * @next: pointer to the next irqaction for shared interrupts
72 * @irq: interrupt number
73 * @dir: pointer to the proc/irq/NN/name entry
74 */
64struct irqaction { 75struct irqaction {
65 irq_handler_t handler; 76 irq_handler_t handler;
66 unsigned long flags; 77 unsigned long flags;
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 82df31726a54..0adb0f91568c 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -30,11 +30,14 @@
30 * See Documentation/io_mapping.txt 30 * See Documentation/io_mapping.txt
31 */ 31 */
32 32
33/* this struct isn't actually defined anywhere */
34struct io_mapping;
35
36#ifdef CONFIG_HAVE_ATOMIC_IOMAP 33#ifdef CONFIG_HAVE_ATOMIC_IOMAP
37 34
35struct io_mapping {
36 resource_size_t base;
37 unsigned long size;
38 pgprot_t prot;
39};
40
38/* 41/*
39 * For small address space machines, mapping large objects 42 * For small address space machines, mapping large objects
40 * into the kernel virtual space isn't practical. Where 43 * into the kernel virtual space isn't practical. Where
@@ -43,23 +46,40 @@ struct io_mapping;
43 */ 46 */
44 47
45static inline struct io_mapping * 48static inline struct io_mapping *
46io_mapping_create_wc(unsigned long base, unsigned long size) 49io_mapping_create_wc(resource_size_t base, unsigned long size)
47{ 50{
48 return (struct io_mapping *) base; 51 struct io_mapping *iomap;
52
53 if (!is_io_mapping_possible(base, size))
54 return NULL;
55
56 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL);
57 if (!iomap)
58 return NULL;
59
60 iomap->base = base;
61 iomap->size = size;
62 iomap->prot = pgprot_writecombine(__pgprot(__PAGE_KERNEL));
63 return iomap;
49} 64}
50 65
51static inline void 66static inline void
52io_mapping_free(struct io_mapping *mapping) 67io_mapping_free(struct io_mapping *mapping)
53{ 68{
69 kfree(mapping);
54} 70}
55 71
56/* Atomic map/unmap */ 72/* Atomic map/unmap */
57static inline void * 73static inline void *
58io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) 74io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
59{ 75{
60 offset += (unsigned long) mapping; 76 resource_size_t phys_addr;
61 return iomap_atomic_prot_pfn(offset >> PAGE_SHIFT, KM_USER0, 77 unsigned long pfn;
62 __pgprot(__PAGE_KERNEL_WC)); 78
79 BUG_ON(offset >= mapping->size);
80 phys_addr = mapping->base + offset;
81 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
82 return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot);
63} 83}
64 84
65static inline void 85static inline void
@@ -71,8 +91,12 @@ io_mapping_unmap_atomic(void *vaddr)
71static inline void * 91static inline void *
72io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) 92io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
73{ 93{
74 offset += (unsigned long) mapping; 94 resource_size_t phys_addr;
75 return ioremap_wc(offset, PAGE_SIZE); 95
96 BUG_ON(offset >= mapping->size);
97 phys_addr = mapping->base + offset;
98
99 return ioremap_wc(phys_addr, PAGE_SIZE);
76} 100}
77 101
78static inline void 102static inline void
@@ -83,9 +107,12 @@ io_mapping_unmap(void *vaddr)
83 107
84#else 108#else
85 109
110/* this struct isn't actually defined anywhere */
111struct io_mapping;
112
86/* Create the io_mapping object*/ 113/* Create the io_mapping object*/
87static inline struct io_mapping * 114static inline struct io_mapping *
88io_mapping_create_wc(unsigned long base, unsigned long size) 115io_mapping_create_wc(resource_size_t base, unsigned long size)
89{ 116{
90 return (struct io_mapping *) ioremap_wc(base, size); 117 return (struct io_mapping *) ioremap_wc(base, size);
91} 118}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 48901e9a33b9..6db939a575bd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -218,7 +218,6 @@ irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
218 * Migration helpers for obsolete names, they will go away: 218 * Migration helpers for obsolete names, they will go away:
219 */ 219 */
220#define hw_interrupt_type irq_chip 220#define hw_interrupt_type irq_chip
221typedef struct irq_chip hw_irq_controller;
222#define no_irq_type no_irq_chip 221#define no_irq_type no_irq_chip
223typedef struct irq_desc irq_desc_t; 222typedef struct irq_desc irq_desc_t;
224 223
@@ -228,6 +227,7 @@ typedef struct irq_desc irq_desc_t;
228#include <asm/hw_irq.h> 227#include <asm/hw_irq.h>
229 228
230extern int setup_irq(unsigned int irq, struct irqaction *new); 229extern int setup_irq(unsigned int irq, struct irqaction *new);
230extern void remove_irq(unsigned int irq, struct irqaction *act);
231 231
232#ifdef CONFIG_GENERIC_HARDIRQS 232#ifdef CONFIG_GENERIC_HARDIRQS
233 233
@@ -272,7 +272,7 @@ static inline int irq_balancing_disabled(unsigned int irq)
272} 272}
273 273
274/* Handle irq action chains: */ 274/* Handle irq action chains: */
275extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); 275extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
276 276
277/* 277/*
278 * Built-in IRQ handlers for various IRQ types, 278 * Built-in IRQ handlers for various IRQ types,
@@ -317,7 +317,7 @@ static inline void generic_handle_irq(unsigned int irq)
317 317
318/* Handling of unhandled and spurious interrupts: */ 318/* Handling of unhandled and spurious interrupts: */
319extern void note_interrupt(unsigned int irq, struct irq_desc *desc, 319extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
320 int action_ret); 320 irqreturn_t action_ret);
321 321
322/* Resending of interrupts :*/ 322/* Resending of interrupts :*/
323void check_irq_resend(struct irq_desc *desc, unsigned int irq); 323void check_irq_resend(struct irq_desc *desc, unsigned int irq);
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
index 881883c2009d..c5584ca5b8c9 100644
--- a/include/linux/irqreturn.h
+++ b/include/linux/irqreturn.h
@@ -1,25 +1,17 @@
1/* irqreturn.h */
2#ifndef _LINUX_IRQRETURN_H 1#ifndef _LINUX_IRQRETURN_H
3#define _LINUX_IRQRETURN_H 2#define _LINUX_IRQRETURN_H
4 3
5/* 4/**
6 * For 2.4.x compatibility, 2.4.x can use 5 * enum irqreturn
7 * 6 * @IRQ_NONE interrupt was not from this device
8 * typedef void irqreturn_t; 7 * @IRQ_HANDLED interrupt was handled by this device
9 * #define IRQ_NONE
10 * #define IRQ_HANDLED
11 * #define IRQ_RETVAL(x)
12 *
13 * To mix old-style and new-style irq handler returns.
14 *
15 * IRQ_NONE means we didn't handle it.
16 * IRQ_HANDLED means that we did have a valid interrupt and handled it.
17 * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
18 */ 8 */
19typedef int irqreturn_t; 9enum irqreturn {
10 IRQ_NONE,
11 IRQ_HANDLED,
12};
20 13
21#define IRQ_NONE (0) 14typedef enum irqreturn irqreturn_t;
22#define IRQ_HANDLED (1) 15#define IRQ_RETVAL(x) ((x) != IRQ_NONE)
23#define IRQ_RETVAL(x) ((x) != 0)
24 16
25#endif 17#endif
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index b28b37eb11c6..4d248b3f1323 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1150,7 +1150,8 @@ extern int jbd2_journal_clear_err (journal_t *);
1150extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1150extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1151extern int jbd2_journal_force_commit(journal_t *); 1151extern int jbd2_journal_force_commit(journal_t *);
1152extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); 1152extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1153extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size); 1153extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
1154 struct jbd2_inode *inode, loff_t new_size);
1154extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); 1155extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
1155extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); 1156extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
1156 1157
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 5715f1907601..0424326f1679 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -58,10 +58,10 @@ struct kvm_irqchip {
58 __u32 pad; 58 __u32 pad;
59 union { 59 union {
60 char dummy[512]; /* reserving space */ 60 char dummy[512]; /* reserving space */
61#ifdef CONFIG_X86 61#ifdef __KVM_HAVE_PIT
62 struct kvm_pic_state pic; 62 struct kvm_pic_state pic;
63#endif 63#endif
64#if defined(CONFIG_X86) || defined(CONFIG_IA64) 64#ifdef __KVM_HAVE_IOAPIC
65 struct kvm_ioapic_state ioapic; 65 struct kvm_ioapic_state ioapic;
66#endif 66#endif
67 } chip; 67 } chip;
@@ -384,16 +384,16 @@ struct kvm_trace_rec {
384#define KVM_CAP_MP_STATE 14 384#define KVM_CAP_MP_STATE 14
385#define KVM_CAP_COALESCED_MMIO 15 385#define KVM_CAP_COALESCED_MMIO 15
386#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 386#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
387#if defined(CONFIG_X86)||defined(CONFIG_IA64) 387#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
388#define KVM_CAP_DEVICE_ASSIGNMENT 17 388#define KVM_CAP_DEVICE_ASSIGNMENT 17
389#endif 389#endif
390#define KVM_CAP_IOMMU 18 390#define KVM_CAP_IOMMU 18
391#if defined(CONFIG_X86) 391#ifdef __KVM_HAVE_MSI
392#define KVM_CAP_DEVICE_MSI 20 392#define KVM_CAP_DEVICE_MSI 20
393#endif 393#endif
394/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ 394/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
395#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 395#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
396#if defined(CONFIG_X86) 396#ifdef __KVM_HAVE_USER_NMI
397#define KVM_CAP_USER_NMI 22 397#define KVM_CAP_USER_NMI 22
398#endif 398#endif
399 399
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ec49d0be7f52..bf6f703642fc 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -285,6 +285,7 @@ void kvm_free_physmem(struct kvm *kvm);
285struct kvm *kvm_arch_create_vm(void); 285struct kvm *kvm_arch_create_vm(void);
286void kvm_arch_destroy_vm(struct kvm *kvm); 286void kvm_arch_destroy_vm(struct kvm *kvm);
287void kvm_free_all_assigned_devices(struct kvm *kvm); 287void kvm_free_all_assigned_devices(struct kvm *kvm);
288void kvm_arch_sync_events(struct kvm *kvm);
288 289
289int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 290int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
290int kvm_cpu_has_interrupt(struct kvm_vcpu *v); 291int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5d87bc09a1f5..dc18b87ed722 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -275,7 +275,7 @@ enum {
275 * advised to wait only for the following duration before 275 * advised to wait only for the following duration before
276 * doing SRST. 276 * doing SRST.
277 */ 277 */
278 ATA_TMOUT_PMP_SRST_WAIT = 1000, 278 ATA_TMOUT_PMP_SRST_WAIT = 5000,
279 279
280 /* ATA bus states */ 280 /* ATA bus states */
281 BUS_UNKNOWN = 0, 281 BUS_UNKNOWN = 0,
@@ -530,6 +530,7 @@ struct ata_queued_cmd {
530 unsigned long flags; /* ATA_QCFLAG_xxx */ 530 unsigned long flags; /* ATA_QCFLAG_xxx */
531 unsigned int tag; 531 unsigned int tag;
532 unsigned int n_elem; 532 unsigned int n_elem;
533 unsigned int orig_n_elem;
533 534
534 int dma_dir; 535 int dma_dir;
535 536
@@ -750,7 +751,8 @@ struct ata_port {
750 acpi_handle acpi_handle; 751 acpi_handle acpi_handle;
751 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ 752 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
752#endif 753#endif
753 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 754 /* owned by EH */
755 u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned;
754}; 756};
755 757
756/* The following initializer overrides a method to NULL whether one of 758/* The following initializer overrides a method to NULL whether one of
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index aa6fe7026de7..51855dfd8adb 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -346,6 +346,7 @@ static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
347} 347}
348 348
349#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
349static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, 350static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
350 const struct sockaddr *sap2) 351 const struct sockaddr *sap2)
351{ 352{
@@ -353,6 +354,13 @@ static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
353 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; 354 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
354 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); 355 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
355} 356}
357#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
358static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
359 const struct sockaddr *sap2)
360{
361 return 0;
362}
363#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
356 364
357/* 365/*
358 * Compare two host addresses 366 * Compare two host addresses
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 323561582c10..065cdf8c09fb 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1041,10 +1041,23 @@ extern void free_bootmem_with_active_regions(int nid,
1041typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1041typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1042extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); 1042extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1043extern void sparse_memory_present_with_active_regions(int nid); 1043extern void sparse_memory_present_with_active_regions(int nid);
1044#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
1045extern int early_pfn_to_nid(unsigned long pfn);
1046#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
1047#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 1044#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
1045
1046#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
1047 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
1048static inline int __early_pfn_to_nid(unsigned long pfn)
1049{
1050 return 0;
1051}
1052#else
1053/* please see mm/page_alloc.c */
1054extern int __meminit early_pfn_to_nid(unsigned long pfn);
1055#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
1056/* there is a per-arch backend function. */
1057extern int __meminit __early_pfn_to_nid(unsigned long pfn);
1058#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
1059#endif
1060
1048extern void set_dma_reserve(unsigned long new_dma_reserve); 1061extern void set_dma_reserve(unsigned long new_dma_reserve);
1049extern void memmap_init_zone(unsigned long, int, unsigned long, 1062extern void memmap_init_zone(unsigned long, int, unsigned long,
1050 unsigned long, enum memmap_context); 1063 unsigned long, enum memmap_context);
@@ -1159,6 +1172,7 @@ extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
1159 1172
1160/* mm/page-writeback.c */ 1173/* mm/page-writeback.c */
1161int write_one_page(struct page *page, int wait); 1174int write_one_page(struct page *page, int wait);
1175void task_dirty_inc(struct task_struct *tsk);
1162 1176
1163/* readahead.c */ 1177/* readahead.c */
1164#define VM_MAX_READAHEAD 128 /* kbytes */ 1178#define VM_MAX_READAHEAD 128 /* kbytes */
@@ -1304,5 +1318,6 @@ void vmemmap_populate_print_last(void);
1304 1318
1305extern void *alloc_locked_buffer(size_t size); 1319extern void *alloc_locked_buffer(size_t size);
1306extern void free_locked_buffer(void *buffer, size_t size); 1320extern void free_locked_buffer(void *buffer, size_t size);
1321extern void release_locked_buffer(void *buffer, size_t size);
1307#endif /* __KERNEL__ */ 1322#endif /* __KERNEL__ */
1308#endif /* _LINUX_MM_H */ 1323#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 92915e81443f..d84feb7bdbf0 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -276,4 +276,7 @@ struct mm_struct {
276#endif 276#endif
277}; 277};
278 278
279/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
280#define mm_cpumask(mm) (&(mm)->cpu_vm_mask)
281
279#endif /* _LINUX_MM_TYPES_H */ 282#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 09c14e213b63..1aca6cebbb78 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1071,7 +1071,7 @@ void sparse_init(void);
1071#endif /* CONFIG_SPARSEMEM */ 1071#endif /* CONFIG_SPARSEMEM */
1072 1072
1073#ifdef CONFIG_NODES_SPAN_OTHER_NODES 1073#ifdef CONFIG_NODES_SPAN_OTHER_NODES
1074#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) 1074bool early_pfn_in_nid(unsigned long pfn, int nid);
1075#else 1075#else
1076#define early_pfn_in_nid(pfn, nid) (1) 1076#define early_pfn_in_nid(pfn, nid) (1)
1077#endif 1077#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ec54785d34f9..659366734f3f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1079,6 +1079,7 @@ extern void synchronize_net(void);
1079extern int register_netdevice_notifier(struct notifier_block *nb); 1079extern int register_netdevice_notifier(struct notifier_block *nb);
1080extern 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); 1081extern int init_dummy_netdev(struct net_device *dev);
1082extern void netdev_resync_ops(struct net_device *dev);
1082 1083
1083extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1084extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1084extern 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/xt_NFLOG.h b/include/linux/netfilter/xt_NFLOG.h
index cdcd0ed58f7a..4b36aeb46a10 100644
--- a/include/linux/netfilter/xt_NFLOG.h
+++ b/include/linux/netfilter/xt_NFLOG.h
@@ -2,7 +2,7 @@
2#define _XT_NFLOG_TARGET 2#define _XT_NFLOG_TARGET
3 3
4#define XT_NFLOG_DEFAULT_GROUP 0x1 4#define XT_NFLOG_DEFAULT_GROUP 0x1
5#define XT_NFLOG_DEFAULT_THRESHOLD 1 5#define XT_NFLOG_DEFAULT_THRESHOLD 0
6 6
7#define XT_NFLOG_MASK 0x0 7#define XT_NFLOG_MASK 0x0
8 8
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a550b528319f..2e5f00066afd 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -406,6 +406,8 @@ struct nfs3_setaclargs {
406 int mask; 406 int mask;
407 struct posix_acl * acl_access; 407 struct posix_acl * acl_access;
408 struct posix_acl * acl_default; 408 struct posix_acl * acl_default;
409 size_t len;
410 unsigned int npages;
409 struct page ** pages; 411 struct page ** pages;
410}; 412};
411 413
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
index 54487a99beb8..43011b69297c 100644
--- a/include/linux/nfsacl.h
+++ b/include/linux/nfsacl.h
@@ -37,6 +37,9 @@
37#define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \ 37#define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \
38 >> PAGE_SHIFT) 38 >> PAGE_SHIFT)
39 39
40#define NFS_ACL_MAX_ENTRIES_INLINE (5)
41#define NFS_ACL_INLINE_BUFSIZE ((2*(2+3*NFS_ACL_MAX_ENTRIES_INLINE)) << 2)
42
40static inline unsigned int 43static inline unsigned int
41nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) 44nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
42{ 45{
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 52a9fe08451c..aca8c458aa8a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1312,6 +1312,7 @@
1312#define PCI_DEVICE_ID_VIA_VT3351 0x0351 1312#define PCI_DEVICE_ID_VIA_VT3351 0x0351
1313#define PCI_DEVICE_ID_VIA_VT3364 0x0364 1313#define PCI_DEVICE_ID_VIA_VT3364 0x0364
1314#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1314#define PCI_DEVICE_ID_VIA_8371_0 0x0391
1315#define PCI_DEVICE_ID_VIA_6415 0x0415
1315#define PCI_DEVICE_ID_VIA_8501_0 0x0501 1316#define PCI_DEVICE_ID_VIA_8501_0 0x0501
1316#define PCI_DEVICE_ID_VIA_82C561 0x0561 1317#define PCI_DEVICE_ID_VIA_82C561 0x0561
1317#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 1318#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
@@ -1444,6 +1445,7 @@
1444#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 1445#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
1445#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 1446#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
1446#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 1447#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
1448#define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1
1447#define PCI_DEVICE_ID_NEO_2DB9 0x00C8 1449#define PCI_DEVICE_ID_NEO_2DB9 0x00C8
1448#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 1450#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9
1449#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA 1451#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
@@ -2321,6 +2323,9 @@
2321#define PCI_DEVICE_ID_INTEL_82378 0x0484 2323#define PCI_DEVICE_ID_INTEL_82378 0x0484
2322#define PCI_DEVICE_ID_INTEL_I960 0x0960 2324#define PCI_DEVICE_ID_INTEL_I960 0x0960
2323#define PCI_DEVICE_ID_INTEL_I960RM 0x0962 2325#define PCI_DEVICE_ID_INTEL_I960RM 0x0962
2326#define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062
2327#define PCI_DEVICE_ID_INTEL_82573E_SOL 0x1085
2328#define PCI_DEVICE_ID_INTEL_82573L_SOL 0x108F
2324#define PCI_DEVICE_ID_INTEL_82815_MC 0x1130 2329#define PCI_DEVICE_ID_INTEL_82815_MC 0x1130
2325#define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132 2330#define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132
2326#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 2331#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
diff --git a/include/linux/pm.h b/include/linux/pm.h
index de2e0a8f6728..24ba5f67b3a3 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -381,10 +381,12 @@ struct dev_pm_info {
381 381
382#ifdef CONFIG_PM_SLEEP 382#ifdef CONFIG_PM_SLEEP
383extern void device_pm_lock(void); 383extern void device_pm_lock(void);
384extern int sysdev_resume(void);
384extern void device_power_up(pm_message_t state); 385extern void device_power_up(pm_message_t state);
385extern void device_resume(pm_message_t state); 386extern void device_resume(pm_message_t state);
386 387
387extern void device_pm_unlock(void); 388extern void device_pm_unlock(void);
389extern int sysdev_suspend(pm_message_t state);
388extern int device_power_down(pm_message_t state); 390extern int device_power_down(pm_message_t state);
389extern int device_suspend(pm_message_t state); 391extern int device_suspend(pm_message_t state);
390extern int device_prepare_suspend(pm_message_t state); 392extern int device_prepare_suspend(pm_message_t state);
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index f3f697df1d71..80044a4f3ab9 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -181,4 +181,10 @@ extern long rcu_batches_completed_bh(void);
181#define rcu_enter_nohz() do { } while (0) 181#define rcu_enter_nohz() do { } while (0)
182#define rcu_exit_nohz() do { } while (0) 182#define rcu_exit_nohz() do { } while (0)
183 183
184/* A context switch is a grace period for rcuclassic. */
185static inline int rcu_blocking_is_gp(void)
186{
187 return num_online_cpus() == 1;
188}
189
184#endif /* __LINUX_RCUCLASSIC_H */ 190#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 921340a7b71c..528343e6da51 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,6 +52,9 @@ struct rcu_head {
52 void (*func)(struct rcu_head *head); 52 void (*func)(struct rcu_head *head);
53}; 53};
54 54
55/* Internal to kernel, but needed by rcupreempt.h. */
56extern int rcu_scheduler_active;
57
55#if defined(CONFIG_CLASSIC_RCU) 58#if defined(CONFIG_CLASSIC_RCU)
56#include <linux/rcuclassic.h> 59#include <linux/rcuclassic.h>
57#elif defined(CONFIG_TREE_RCU) 60#elif defined(CONFIG_TREE_RCU)
@@ -265,6 +268,7 @@ extern void rcu_barrier_sched(void);
265 268
266/* Internal to kernel */ 269/* Internal to kernel */
267extern void rcu_init(void); 270extern void rcu_init(void);
271extern void rcu_scheduler_starting(void);
268extern int rcu_needs_cpu(int cpu); 272extern int rcu_needs_cpu(int cpu);
269 273
270#endif /* __LINUX_RCUPDATE_H */ 274#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 3e05c09b54a2..74304b4538d8 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -142,4 +142,19 @@ static inline void rcu_exit_nohz(void)
142#define rcu_exit_nohz() do { } while (0) 142#define rcu_exit_nohz() do { } while (0)
143#endif /* CONFIG_NO_HZ */ 143#endif /* CONFIG_NO_HZ */
144 144
145/*
146 * A context switch is a grace period for rcupreempt synchronize_rcu()
147 * only during early boot, before the scheduler has been initialized.
148 * So, how the heck do we get a context switch? Well, if the caller
149 * invokes synchronize_rcu(), they are willing to accept a context
150 * switch, so we simply pretend that one happened.
151 *
152 * After boot, there might be a blocked or preempted task in an RCU
153 * read-side critical section, so we cannot then take the fastpath.
154 */
155static inline int rcu_blocking_is_gp(void)
156{
157 return num_online_cpus() == 1 && !rcu_scheduler_active;
158}
159
145#endif /* __LINUX_RCUPREEMPT_H */ 160#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index d4368b7975c3..a722fb67bb2d 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -326,4 +326,10 @@ static inline void rcu_exit_nohz(void)
326} 326}
327#endif /* CONFIG_NO_HZ */ 327#endif /* CONFIG_NO_HZ */
328 328
329/* A context switch is a grace period for rcutree. */
330static inline int rcu_blocking_is_gp(void)
331{
332 return num_online_cpus() == 1;
333}
334
329#endif /* __LINUX_RCUTREE_H */ 335#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8981e52c714f..011db2f4c94c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1419,6 +1419,9 @@ struct task_struct {
1419#endif 1419#endif
1420}; 1420};
1421 1421
1422/* Future-safe accessor for struct task_struct's cpus_allowed. */
1423#define tsk_cpumask(tsk) (&(tsk)->cpus_allowed)
1424
1422/* 1425/*
1423 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 1426 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1424 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH 1427 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
@@ -2291,9 +2294,13 @@ extern long sched_group_rt_runtime(struct task_group *tg);
2291extern int sched_group_set_rt_period(struct task_group *tg, 2294extern int sched_group_set_rt_period(struct task_group *tg,
2292 long rt_period_us); 2295 long rt_period_us);
2293extern long sched_group_rt_period(struct task_group *tg); 2296extern long sched_group_rt_period(struct task_group *tg);
2297extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk);
2294#endif 2298#endif
2295#endif 2299#endif
2296 2300
2301extern int task_can_switch_user(struct user_struct *up,
2302 struct task_struct *tsk);
2303
2297#ifdef CONFIG_TASK_XACCT 2304#ifdef CONFIG_TASK_XACCT
2298static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 2305static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
2299{ 2306{
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 40ea5058c2ec..f616f31576d7 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -19,6 +19,7 @@ struct seq_file {
19 size_t from; 19 size_t from;
20 size_t count; 20 size_t count;
21 loff_t index; 21 loff_t index;
22 loff_t read_pos;
22 u64 version; 23 u64 version;
23 struct mutex lock; 24 struct mutex lock;
24 const struct seq_operations *op; 25 const struct seq_operations *op;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 90bbbf0b1161..df9245c7bd3b 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -296,6 +296,7 @@ struct uart_port {
296#define UPF_HARDPPS_CD ((__force upf_t) (1 << 11)) 296#define UPF_HARDPPS_CD ((__force upf_t) (1 << 11))
297#define UPF_LOW_LATENCY ((__force upf_t) (1 << 13)) 297#define UPF_LOW_LATENCY ((__force upf_t) (1 << 13))
298#define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) 298#define UPF_BUGGY_UART ((__force upf_t) (1 << 14))
299#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
299#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) 300#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16))
300#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 301#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
301#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 302#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 1bcb357a01a1..e0417e4d3f15 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -212,7 +212,7 @@ static inline void serio_unpin_driver(struct serio *serio)
212#define SERIO_FUJITSU 0x35 212#define SERIO_FUJITSU 0x35
213#define SERIO_ZHENHUA 0x36 213#define SERIO_ZHENHUA 0x36
214#define SERIO_INEXIO 0x37 214#define SERIO_INEXIO 0x37
215#define SERIO_TOUCHIT213 0x37 215#define SERIO_TOUCHIT213 0x38
216#define SERIO_W8001 0x39 216#define SERIO_W8001 0x39
217 217
218#endif 218#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index cf2cb50f77d1..9dcf956ad18a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -416,15 +416,6 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
416 void *here); 416 void *here);
417extern void skb_under_panic(struct sk_buff *skb, int len, 417extern void skb_under_panic(struct sk_buff *skb, int len,
418 void *here); 418 void *here);
419extern void skb_truesize_bug(struct sk_buff *skb);
420
421static inline void skb_truesize_check(struct sk_buff *skb)
422{
423 int len = sizeof(struct sk_buff) + skb->len;
424
425 if (unlikely((int)skb->truesize < len))
426 skb_truesize_bug(skb);
427}
428 419
429extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 420extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
430 int getfrag(void *from, char *to, int offset, 421 int getfrag(void *from, char *to, int offset,
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f96d13c281e8..24c5602bee99 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -127,6 +127,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
127void * __must_check __krealloc(const void *, size_t, gfp_t); 127void * __must_check __krealloc(const void *, size_t, gfp_t);
128void * __must_check krealloc(const void *, size_t, gfp_t); 128void * __must_check krealloc(const void *, size_t, gfp_t);
129void kfree(const void *); 129void kfree(const void *);
130void kzfree(const void *);
130size_t ksize(const void *); 131size_t ksize(const void *);
131 132
132/* 133/*
diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index 523d069c862c..1904afedb82f 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -1045,50 +1045,36 @@ typedef struct mixer_vol_table {
1045 */ 1045 */
1046#define LOCL_STARTAUDIO 1 1046#define LOCL_STARTAUDIO 1
1047 1047
1048#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 1048#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
1049/* 1049/*
1050 * Some convenience macros to simplify programming of the 1050 * Some convenience macros to simplify programming of the
1051 * /dev/sequencer interface 1051 * /dev/sequencer interface
1052 * 1052 *
1053 * These macros define the API which should be used when possible. 1053 * This is a legacy interface for applications written against
1054 * the OSSlib-3.8 style interface. It is no longer possible
1055 * to actually link against OSSlib with this header, but we
1056 * still provide these macros for programs using them.
1057 *
1058 * If you want to use OSSlib, it is recommended that you get
1059 * the GPL version of OSS-4.x and build against that version
1060 * of the header.
1061 *
1062 * We redefine the extern keyword so that make headers_check
1063 * does not complain about SEQ_USE_EXTBUF.
1054 */ 1064 */
1055#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() 1065#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
1056 1066
1057void seqbuf_dump(void); /* This function must be provided by programs */ 1067void seqbuf_dump(void); /* This function must be provided by programs */
1058 1068
1059extern int OSS_init(int seqfd, int buflen);
1060extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
1061extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
1062extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
1063extern void OSS_patch_caching(int dev, int chn, int patch,
1064 int fd, unsigned char *buf, int buflen);
1065extern void OSS_drum_caching(int dev, int chn, int patch,
1066 int fd, unsigned char *buf, int buflen);
1067extern void OSS_write_patch(int fd, unsigned char *buf, int len);
1068extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
1069
1070#define SEQ_PM_DEFINES int __foo_bar___ 1069#define SEQ_PM_DEFINES int __foo_bar___
1071#ifdef OSSLIB 1070
1072# define SEQ_USE_EXTBUF() \ 1071#define SEQ_LOAD_GMINSTR(dev, instr)
1073 extern unsigned char *_seqbuf; \ 1072#define SEQ_LOAD_GMDRUM(dev, drum)
1074 extern int _seqbuflen;extern int _seqbufptr 1073
1075# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len 1074#define _SEQ_EXTERN extern
1076# define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen) 1075#define SEQ_USE_EXTBUF() \
1077# define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen) 1076 _SEQ_EXTERN unsigned char _seqbuf[]; \
1078# define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen) 1077 _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr
1079
1080# define SEQ_LOAD_GMINSTR(dev, instr) \
1081 OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
1082# define SEQ_LOAD_GMDRUM(dev, drum) \
1083 OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
1084#else /* !OSSLIB */
1085
1086# define SEQ_LOAD_GMINSTR(dev, instr)
1087# define SEQ_LOAD_GMDRUM(dev, drum)
1088
1089# define SEQ_USE_EXTBUF() \
1090 extern unsigned char _seqbuf[]; \
1091 extern int _seqbuflen;extern int _seqbufptr
1092 1078
1093#ifndef USE_SIMPLE_MACROS 1079#ifndef USE_SIMPLE_MACROS
1094/* Sample seqbuf_dump() implementation: 1080/* Sample seqbuf_dump() implementation:
@@ -1131,7 +1117,6 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
1131 */ 1117 */
1132#define _SEQ_NEEDBUF(len) /* empty */ 1118#define _SEQ_NEEDBUF(len) /* empty */
1133#endif 1119#endif
1134#endif /* !OSSLIB */
1135 1120
1136#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ 1121#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
1137 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ 1122 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
@@ -1215,14 +1200,8 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
1215 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) 1200 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
1216 1201
1217#define SEQ_SET_PATCH SEQ_PGM_CHANGE 1202#define SEQ_SET_PATCH SEQ_PGM_CHANGE
1218#ifdef OSSLIB 1203#define SEQ_PGM_CHANGE(dev, chn, patch) \
1219# define SEQ_PGM_CHANGE(dev, chn, patch) \
1220 {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
1221 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
1222#else
1223# define SEQ_PGM_CHANGE(dev, chn, patch) \
1224 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) 1204 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
1225#endif
1226 1205
1227#define SEQ_CONTROL(dev, chn, controller, value) \ 1206#define SEQ_CONTROL(dev, chn, controller, value) \
1228 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) 1207 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
@@ -1300,19 +1279,12 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
1300/* 1279/*
1301 * Patch loading. 1280 * Patch loading.
1302 */ 1281 */
1303#ifdef OSSLIB 1282#define SEQ_WRPATCH(patchx, len) \
1304# define SEQ_WRPATCH(patchx, len) \
1305 OSS_write_patch(seqfd, (char*)(patchx), len)
1306# define SEQ_WRPATCH2(patchx, len) \
1307 OSS_write_patch2(seqfd, (char*)(patchx), len)
1308#else
1309# define SEQ_WRPATCH(patchx, len) \
1310 {if (_seqbufptr) SEQ_DUMPBUF();\ 1283 {if (_seqbufptr) SEQ_DUMPBUF();\
1311 if (write(seqfd, (char*)(patchx), len)==-1) \ 1284 if (write(seqfd, (char*)(patchx), len)==-1) \
1312 perror("Write patch: /dev/sequencer");} 1285 perror("Write patch: /dev/sequencer");}
1313# define SEQ_WRPATCH2(patchx, len) \ 1286#define SEQ_WRPATCH2(patchx, len) \
1314 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) 1287 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
1315#endif
1316 1288
1317#endif 1289#endif
1318#endif 1290#endif
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index bf8de281b4ed..eed4254bd503 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -83,6 +83,13 @@ extern int spi_bitbang_stop(struct spi_bitbang *spi);
83 * int getmiso(struct spi_device *); 83 * int getmiso(struct spi_device *);
84 * void spidelay(unsigned); 84 * void spidelay(unsigned);
85 * 85 *
86 * setsck()'s is_on parameter is a zero/nonzero boolean.
87 *
88 * setmosi()'s is_on parameter is a zero/nonzero boolean.
89 *
90 * getmiso() is required to return 0 or 1 only. Any other value is invalid
91 * and will result in improper operation.
92 *
86 * A non-inlined routine would call bitbang_txrx_*() routines. The 93 * A non-inlined routine would call bitbang_txrx_*() routines. The
87 * main loop could easily compile down to a handful of instructions, 94 * main loop could easily compile down to a handful of instructions,
88 * especially if the delay is a NOP (to run at peak speed). 95 * especially if the delay is a NOP (to run at peak speed).
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index 86cb0501d3e2..2d0792983f8c 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -11,13 +11,21 @@
11/* For O_CLOEXEC and O_NONBLOCK */ 11/* For O_CLOEXEC and O_NONBLOCK */
12#include <linux/fcntl.h> 12#include <linux/fcntl.h>
13 13
14/* Flags for timerfd_settime. */ 14/*
15 * CAREFUL: Check include/asm-generic/fcntl.h when defining
16 * new flags, since they might collide with O_* ones. We want
17 * to re-use O_* flags that couldn't possibly have a meaning
18 * from eventfd, in order to leave a free define-space for
19 * shared O_* flags.
20 */
15#define TFD_TIMER_ABSTIME (1 << 0) 21#define TFD_TIMER_ABSTIME (1 << 0)
16
17/* Flags for timerfd_create. */
18#define TFD_CLOEXEC O_CLOEXEC 22#define TFD_CLOEXEC O_CLOEXEC
19#define TFD_NONBLOCK O_NONBLOCK 23#define TFD_NONBLOCK O_NONBLOCK
20 24
25#define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)
26/* Flags for timerfd_create. */
27#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS
28/* Flags for timerfd_settime. */
29#define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME
21 30
22#endif /* _LINUX_TIMERFD_H */ 31#endif /* _LINUX_TIMERFD_H */
23
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 315bcd375224..cc4f45361dbb 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -13,6 +13,7 @@ struct user_namespace {
13 struct kref kref; 13 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 14 struct hlist_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *creator; 15 struct user_struct *creator;
16 struct work_struct destroyer;
16}; 17};
17 18
18extern struct user_namespace init_user_ns; 19extern struct user_namespace init_user_ns;
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 506e7620a986..9c0890c7a06a 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -84,6 +84,10 @@ extern struct vm_struct *get_vm_area_caller(unsigned long size,
84 unsigned long flags, void *caller); 84 unsigned long flags, void *caller);
85extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 85extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
86 unsigned long start, unsigned long end); 86 unsigned long start, unsigned long end);
87extern struct vm_struct *__get_vm_area_caller(unsigned long size,
88 unsigned long flags,
89 unsigned long start, unsigned long end,
90 void *caller);
87extern struct vm_struct *get_vm_area_node(unsigned long size, 91extern struct vm_struct *get_vm_area_node(unsigned long size,
88 unsigned long flags, int node, 92 unsigned long flags, int node,
89 gfp_t gfp_mask); 93 gfp_t gfp_mask);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 6fc13d905c5f..ded434b032a4 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -109,11 +109,6 @@ extern struct list_head net_namespace_list;
109#ifdef CONFIG_NET_NS 109#ifdef CONFIG_NET_NS
110extern void __put_net(struct net *net); 110extern void __put_net(struct net *net);
111 111
112static inline int net_alive(struct net *net)
113{
114 return net && atomic_read(&net->count);
115}
116
117static inline struct net *get_net(struct net *net) 112static inline struct net *get_net(struct net *net)
118{ 113{
119 atomic_inc(&net->count); 114 atomic_inc(&net->count);
@@ -145,11 +140,6 @@ int net_eq(const struct net *net1, const struct net *net2)
145} 140}
146#else 141#else
147 142
148static inline int net_alive(struct net *net)
149{
150 return 1;
151}
152
153static inline struct net *get_net(struct net *net) 143static inline struct net *get_net(struct net *net)
154{ 144{
155 return net; 145 return net;
@@ -234,6 +224,23 @@ struct pernet_operations {
234 void (*exit)(struct net *net); 224 void (*exit)(struct net *net);
235}; 225};
236 226
227/*
228 * Use these carefully. If you implement a network device and it
229 * needs per network namespace operations use device pernet operations,
230 * otherwise use pernet subsys operations.
231 *
232 * This is critically important. Most of the network code cleanup
233 * runs with the assumption that dev_remove_pack has been called so no
234 * new packets will arrive during and after the cleanup functions have
235 * been called. dev_remove_pack is not per namespace so instead the
236 * guarantee of no more packets arriving in a network namespace is
237 * provided by ensuring that all network devices and all sockets have
238 * left the network namespace before the cleanup methods are called.
239 *
240 * For the longest time the ipv4 icmp code was registered as a pernet
241 * device which caused kernel oops, and panics during network
242 * namespace cleanup. So please don't get this wrong.
243 */
237extern int register_pernet_subsys(struct pernet_operations *); 244extern int register_pernet_subsys(struct pernet_operations *);
238extern void unregister_pernet_subsys(struct pernet_operations *); 245extern void unregister_pernet_subsys(struct pernet_operations *);
239extern int register_pernet_gen_subsys(int *id, struct pernet_operations *); 246extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index e78afe7f28e3..c25068e38516 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -59,7 +59,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
59 struct nf_conn *ct = (struct nf_conn *)skb->nfct; 59 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
60 int ret = NF_ACCEPT; 60 int ret = NF_ACCEPT;
61 61
62 if (ct) { 62 if (ct && ct != &nf_conntrack_untracked) {
63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
64 ret = __nf_conntrack_confirm(skb); 64 ret = __nf_conntrack_confirm(skb);
65 nf_ct_deliver_cached_events(ct); 65 nf_ct_deliver_cached_events(ct);
diff --git a/include/net/sock.h b/include/net/sock.h
index ce3b5b622683..eefeeaf7fc46 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -860,7 +860,6 @@ static inline void sk_mem_uncharge(struct sock *sk, int size)
860 860
861static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) 861static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
862{ 862{
863 skb_truesize_check(skb);
864 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 863 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
865 sk->sk_wmem_queued -= skb->truesize; 864 sk->sk_wmem_queued -= skb->truesize;
866 sk_mem_uncharge(sk, skb->truesize); 865 sk_mem_uncharge(sk, skb->truesize);
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index 57aaa8f0d613..f271d9cc0fc2 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -31,10 +31,6 @@
31#define ETH_P_FCOE 0x8906 /* FCOE ether type */ 31#define ETH_P_FCOE 0x8906 /* FCOE ether type */
32#endif 32#endif
33 33
34#ifndef ETH_P_8021Q
35#define ETH_P_8021Q 0x8100
36#endif
37
38/* 34/*
39 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. 35 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD.
40 */ 36 */
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h
index 3e4801d2bdbb..1b7af3a64c7c 100644
--- a/include/scsi/fc/fc_fs.h
+++ b/include/scsi/fc/fc_fs.h
@@ -337,4 +337,9 @@ enum fc_pf_rjt_reason {
337 FC_RJT_VENDOR = 0xff, /* vendor specific reject */ 337 FC_RJT_VENDOR = 0xff, /* vendor specific reject */
338}; 338};
339 339
340/* default timeout values */
341
342#define FC_DEF_E_D_TOV 2000UL
343#define FC_DEF_R_A_TOV 10000UL
344
340#endif /* _FC_FS_H_ */ 345#endif /* _FC_FS_H_ */
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 9f2876397dda..a2e126b86e3e 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -68,9 +68,6 @@
68/* 68/*
69 * FC HBA status 69 * FC HBA status
70 */ 70 */
71#define FC_PAUSE (1 << 1)
72#define FC_LINK_UP (1 << 0)
73
74enum fc_lport_state { 71enum fc_lport_state {
75 LPORT_ST_NONE = 0, 72 LPORT_ST_NONE = 0,
76 LPORT_ST_FLOGI, 73 LPORT_ST_FLOGI,
@@ -339,31 +336,17 @@ struct fc_exch {
339 336
340struct libfc_function_template { 337struct libfc_function_template {
341 338
342 /**
343 * Mandatory Fields
344 *
345 * These handlers must be implemented by the LLD.
346 */
347
348 /* 339 /*
349 * Interface to send a FC frame 340 * Interface to send a FC frame
350 */
351 int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp);
352
353 /**
354 * Optional Fields
355 * 341 *
356 * The LLD may choose to implement any of the following handlers. 342 * STATUS: REQUIRED
357 * If LLD doesn't specify hander and leaves its pointer NULL then
358 * the default libfc function will be used for that handler.
359 */
360
361 /**
362 * ELS/CT interfaces
363 */ 343 */
344 int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp);
364 345
365 /* 346 /*
366 * elsct_send - sends ELS/CT frame 347 * Interface to send ELS/CT frames
348 *
349 * STATUS: OPTIONAL
367 */ 350 */
368 struct fc_seq *(*elsct_send)(struct fc_lport *lport, 351 struct fc_seq *(*elsct_send)(struct fc_lport *lport,
369 struct fc_rport *rport, 352 struct fc_rport *rport,
@@ -373,9 +356,6 @@ struct libfc_function_template {
373 struct fc_frame *fp, 356 struct fc_frame *fp,
374 void *arg), 357 void *arg),
375 void *arg, u32 timer_msec); 358 void *arg, u32 timer_msec);
376 /**
377 * Exhance Manager interfaces
378 */
379 359
380 /* 360 /*
381 * Send the FC frame payload using a new exchange and sequence. 361 * Send the FC frame payload using a new exchange and sequence.
@@ -407,6 +387,8 @@ struct libfc_function_template {
407 * timer_msec argument is specified. The timer is canceled when 387 * timer_msec argument is specified. The timer is canceled when
408 * it fires or when the exchange is done. The exchange timeout handler 388 * it fires or when the exchange is done. The exchange timeout handler
409 * is registered by EM layer. 389 * is registered by EM layer.
390 *
391 * STATUS: OPTIONAL
410 */ 392 */
411 struct fc_seq *(*exch_seq_send)(struct fc_lport *lp, 393 struct fc_seq *(*exch_seq_send)(struct fc_lport *lp,
412 struct fc_frame *fp, 394 struct fc_frame *fp,
@@ -418,14 +400,18 @@ struct libfc_function_template {
418 void *arg, unsigned int timer_msec); 400 void *arg, unsigned int timer_msec);
419 401
420 /* 402 /*
421 * send a frame using existing sequence and exchange. 403 * Send a frame using an existing sequence and exchange.
404 *
405 * STATUS: OPTIONAL
422 */ 406 */
423 int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp, 407 int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp,
424 struct fc_frame *fp); 408 struct fc_frame *fp);
425 409
426 /* 410 /*
427 * Send ELS response using mainly infomation 411 * Send an ELS response using infomation from a previous
428 * in exchange and sequence in EM layer. 412 * exchange and sequence.
413 *
414 * STATUS: OPTIONAL
429 */ 415 */
430 void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd, 416 void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd,
431 struct fc_seq_els_data *els_data); 417 struct fc_seq_els_data *els_data);
@@ -437,6 +423,8 @@ struct libfc_function_template {
437 * A timer_msec can be specified for abort timeout, if non-zero 423 * A timer_msec can be specified for abort timeout, if non-zero
438 * timer_msec value is specified then exchange resp handler 424 * timer_msec value is specified then exchange resp handler
439 * will be called with timeout error if no response to abort. 425 * will be called with timeout error if no response to abort.
426 *
427 * STATUS: OPTIONAL
440 */ 428 */
441 int (*seq_exch_abort)(const struct fc_seq *req_sp, 429 int (*seq_exch_abort)(const struct fc_seq *req_sp,
442 unsigned int timer_msec); 430 unsigned int timer_msec);
@@ -444,6 +432,8 @@ struct libfc_function_template {
444 /* 432 /*
445 * Indicate that an exchange/sequence tuple is complete and the memory 433 * Indicate that an exchange/sequence tuple is complete and the memory
446 * allocated for the related objects may be freed. 434 * allocated for the related objects may be freed.
435 *
436 * STATUS: OPTIONAL
447 */ 437 */
448 void (*exch_done)(struct fc_seq *sp); 438 void (*exch_done)(struct fc_seq *sp);
449 439
@@ -451,6 +441,8 @@ struct libfc_function_template {
451 * Assigns a EM and a free XID for an new exchange and then 441 * Assigns a EM and a free XID for an new exchange and then
452 * allocates a new exchange and sequence pair. 442 * allocates a new exchange and sequence pair.
453 * The fp can be used to determine free XID. 443 * The fp can be used to determine free XID.
444 *
445 * STATUS: OPTIONAL
454 */ 446 */
455 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp); 447 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp);
456 448
@@ -458,12 +450,16 @@ struct libfc_function_template {
458 * Release previously assigned XID by exch_get API. 450 * Release previously assigned XID by exch_get API.
459 * The LLD may implement this if XID is assigned by LLD 451 * The LLD may implement this if XID is assigned by LLD
460 * in exch_get(). 452 * in exch_get().
453 *
454 * STATUS: OPTIONAL
461 */ 455 */
462 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp, 456 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp,
463 u16 ex_id); 457 u16 ex_id);
464 458
465 /* 459 /*
466 * Start a new sequence on the same exchange/sequence tuple. 460 * Start a new sequence on the same exchange/sequence tuple.
461 *
462 * STATUS: OPTIONAL
467 */ 463 */
468 struct fc_seq *(*seq_start_next)(struct fc_seq *sp); 464 struct fc_seq *(*seq_start_next)(struct fc_seq *sp);
469 465
@@ -471,26 +467,38 @@ struct libfc_function_template {
471 * Reset an exchange manager, completing all sequences and exchanges. 467 * Reset an exchange manager, completing all sequences and exchanges.
472 * If s_id is non-zero, reset only exchanges originating from that FID. 468 * If s_id is non-zero, reset only exchanges originating from that FID.
473 * If d_id is non-zero, reset only exchanges sending to that FID. 469 * If d_id is non-zero, reset only exchanges sending to that FID.
470 *
471 * STATUS: OPTIONAL
474 */ 472 */
475 void (*exch_mgr_reset)(struct fc_exch_mgr *, 473 void (*exch_mgr_reset)(struct fc_lport *,
476 u32 s_id, u32 d_id); 474 u32 s_id, u32 d_id);
477 475
478 void (*rport_flush_queue)(void); 476 /*
479 /** 477 * Flush the rport work queue. Generally used before shutdown.
480 * Local Port interfaces 478 *
479 * STATUS: OPTIONAL
481 */ 480 */
481 void (*rport_flush_queue)(void);
482 482
483 /* 483 /*
484 * Receive a frame to a local port. 484 * Receive a frame for a local port.
485 *
486 * STATUS: OPTIONAL
485 */ 487 */
486 void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp, 488 void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp,
487 struct fc_frame *fp); 489 struct fc_frame *fp);
488 490
491 /*
492 * Reset the local port.
493 *
494 * STATUS: OPTIONAL
495 */
489 int (*lport_reset)(struct fc_lport *); 496 int (*lport_reset)(struct fc_lport *);
490 497
491 /** 498 /*
492 * Remote Port interfaces 499 * Create a remote port
493 */ 500 */
501 struct fc_rport *(*rport_create)(struct fc_disc_port *);
494 502
495 /* 503 /*
496 * Initiates the RP state machine. It is called from the LP module. 504 * Initiates the RP state machine. It is called from the LP module.
@@ -500,26 +508,33 @@ struct libfc_function_template {
500 * - PLOGI 508 * - PLOGI
501 * - PRLI 509 * - PRLI
502 * - RTV 510 * - RTV
511 *
512 * STATUS: OPTIONAL
503 */ 513 */
504 int (*rport_login)(struct fc_rport *rport); 514 int (*rport_login)(struct fc_rport *rport);
505 515
506 /* 516 /*
507 * Logoff, and remove the rport from the transport if 517 * Logoff, and remove the rport from the transport if
508 * it had been added. This will send a LOGO to the target. 518 * it had been added. This will send a LOGO to the target.
519 *
520 * STATUS: OPTIONAL
509 */ 521 */
510 int (*rport_logoff)(struct fc_rport *rport); 522 int (*rport_logoff)(struct fc_rport *rport);
511 523
512 /* 524 /*
513 * Recieve a request from a remote port. 525 * Recieve a request from a remote port.
526 *
527 * STATUS: OPTIONAL
514 */ 528 */
515 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, 529 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *,
516 struct fc_rport *); 530 struct fc_rport *);
517 531
518 struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32); 532 /*
519 533 * lookup an rport by it's port ID.
520 /** 534 *
521 * FCP interfaces 535 * STATUS: OPTIONAL
522 */ 536 */
537 struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32);
523 538
524 /* 539 /*
525 * Send a fcp cmd from fsp pkt. 540 * Send a fcp cmd from fsp pkt.
@@ -527,30 +542,38 @@ struct libfc_function_template {
527 * 542 *
528 * The resp handler is called when FCP_RSP received. 543 * The resp handler is called when FCP_RSP received.
529 * 544 *
545 * STATUS: OPTIONAL
530 */ 546 */
531 int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp, 547 int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp,
532 void (*resp)(struct fc_seq *, struct fc_frame *fp, 548 void (*resp)(struct fc_seq *, struct fc_frame *fp,
533 void *arg)); 549 void *arg));
534 550
535 /* 551 /*
536 * Used at least durring linkdown and reset 552 * Cleanup the FCP layer, used durring link down and reset
553 *
554 * STATUS: OPTIONAL
537 */ 555 */
538 void (*fcp_cleanup)(struct fc_lport *lp); 556 void (*fcp_cleanup)(struct fc_lport *lp);
539 557
540 /* 558 /*
541 * Abort all I/O on a local port 559 * Abort all I/O on a local port
560 *
561 * STATUS: OPTIONAL
542 */ 562 */
543 void (*fcp_abort_io)(struct fc_lport *lp); 563 void (*fcp_abort_io)(struct fc_lport *lp);
544 564
545 /** 565 /*
546 * Discovery interfaces 566 * Receive a request for the discovery layer.
567 *
568 * STATUS: OPTIONAL
547 */ 569 */
548
549 void (*disc_recv_req)(struct fc_seq *, 570 void (*disc_recv_req)(struct fc_seq *,
550 struct fc_frame *, struct fc_lport *); 571 struct fc_frame *, struct fc_lport *);
551 572
552 /* 573 /*
553 * Start discovery for a local port. 574 * Start discovery for a local port.
575 *
576 * STATUS: OPTIONAL
554 */ 577 */
555 void (*disc_start)(void (*disc_callback)(struct fc_lport *, 578 void (*disc_start)(void (*disc_callback)(struct fc_lport *,
556 enum fc_disc_event), 579 enum fc_disc_event),
@@ -559,6 +582,8 @@ struct libfc_function_template {
559 /* 582 /*
560 * Stop discovery for a given lport. This will remove 583 * Stop discovery for a given lport. This will remove
561 * all discovered rports 584 * all discovered rports
585 *
586 * STATUS: OPTIONAL
562 */ 587 */
563 void (*disc_stop) (struct fc_lport *); 588 void (*disc_stop) (struct fc_lport *);
564 589
@@ -566,6 +591,8 @@ struct libfc_function_template {
566 * Stop discovery for a given lport. This will block 591 * Stop discovery for a given lport. This will block
567 * until all discovered rports are deleted from the 592 * until all discovered rports are deleted from the
568 * FC transport class 593 * FC transport class
594 *
595 * STATUS: OPTIONAL
569 */ 596 */
570 void (*disc_stop_final) (struct fc_lport *); 597 void (*disc_stop_final) (struct fc_lport *);
571}; 598};
@@ -603,7 +630,8 @@ struct fc_lport {
603 630
604 /* Operational Information */ 631 /* Operational Information */
605 struct libfc_function_template tt; 632 struct libfc_function_template tt;
606 u16 link_status; 633 u8 link_up;
634 u8 qfull;
607 enum fc_lport_state state; 635 enum fc_lport_state state;
608 unsigned long boot_time; 636 unsigned long boot_time;
609 637
@@ -637,7 +665,7 @@ struct fc_lport {
637 struct delayed_work disc_work; 665 struct delayed_work disc_work;
638}; 666};
639 667
640/** 668/*
641 * FC_LPORT HELPER FUNCTIONS 669 * FC_LPORT HELPER FUNCTIONS
642 *****************************/ 670 *****************************/
643static inline void *lport_priv(const struct fc_lport *lp) 671static inline void *lport_priv(const struct fc_lport *lp)
@@ -669,7 +697,7 @@ static inline void fc_lport_state_enter(struct fc_lport *lp,
669} 697}
670 698
671 699
672/** 700/*
673 * LOCAL PORT LAYER 701 * LOCAL PORT LAYER
674 *****************************/ 702 *****************************/
675int fc_lport_init(struct fc_lport *lp); 703int fc_lport_init(struct fc_lport *lp);
@@ -704,12 +732,6 @@ void fc_linkup(struct fc_lport *);
704void fc_linkdown(struct fc_lport *); 732void fc_linkdown(struct fc_lport *);
705 733
706/* 734/*
707 * Pause and unpause traffic.
708 */
709void fc_pause(struct fc_lport *);
710void fc_unpause(struct fc_lport *);
711
712/*
713 * Configure the local port. 735 * Configure the local port.
714 */ 736 */
715int fc_lport_config(struct fc_lport *); 737int fc_lport_config(struct fc_lport *);
@@ -725,19 +747,19 @@ int fc_lport_reset(struct fc_lport *);
725int fc_set_mfs(struct fc_lport *lp, u32 mfs); 747int fc_set_mfs(struct fc_lport *lp, u32 mfs);
726 748
727 749
728/** 750/*
729 * REMOTE PORT LAYER 751 * REMOTE PORT LAYER
730 *****************************/ 752 *****************************/
731int fc_rport_init(struct fc_lport *lp); 753int fc_rport_init(struct fc_lport *lp);
732void fc_rport_terminate_io(struct fc_rport *rp); 754void fc_rport_terminate_io(struct fc_rport *rp);
733 755
734/** 756/*
735 * DISCOVERY LAYER 757 * DISCOVERY LAYER
736 *****************************/ 758 *****************************/
737int fc_disc_init(struct fc_lport *lp); 759int fc_disc_init(struct fc_lport *lp);
738 760
739 761
740/** 762/*
741 * SCSI LAYER 763 * SCSI LAYER
742 *****************************/ 764 *****************************/
743/* 765/*
@@ -798,7 +820,7 @@ int fc_change_queue_type(struct scsi_device *sdev, int tag_type);
798 */ 820 */
799void fc_fcp_destroy(struct fc_lport *); 821void fc_fcp_destroy(struct fc_lport *);
800 822
801/** 823/*
802 * ELS/CT interface 824 * ELS/CT interface
803 *****************************/ 825 *****************************/
804/* 826/*
@@ -807,7 +829,7 @@ void fc_fcp_destroy(struct fc_lport *);
807int fc_elsct_init(struct fc_lport *lp); 829int fc_elsct_init(struct fc_lport *lp);
808 830
809 831
810/** 832/*
811 * EXCHANGE MANAGER LAYER 833 * EXCHANGE MANAGER LAYER
812 *****************************/ 834 *****************************/
813/* 835/*
@@ -916,7 +938,7 @@ struct fc_seq *fc_seq_start_next(struct fc_seq *sp);
916 * If s_id is non-zero, reset only exchanges originating from that FID. 938 * If s_id is non-zero, reset only exchanges originating from that FID.
917 * If d_id is non-zero, reset only exchanges sending to that FID. 939 * If d_id is non-zero, reset only exchanges sending to that FID.
918 */ 940 */
919void fc_exch_mgr_reset(struct fc_exch_mgr *, u32 s_id, u32 d_id); 941void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
920 942
921/* 943/*
922 * Functions for fc_functions_template 944 * Functions for fc_functions_template
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 89fdbb9a6a1b..941818f29f59 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -46,6 +46,7 @@ struct fcoe_softc {
46 struct net_device *phys_dev; /* device with ethtool_ops */ 46 struct net_device *phys_dev; /* device with ethtool_ops */
47 struct packet_type fcoe_packet_type; 47 struct packet_type fcoe_packet_type;
48 struct sk_buff_head fcoe_pending_queue; 48 struct sk_buff_head fcoe_pending_queue;
49 u8 fcoe_pending_queue_active;
49 50
50 u8 dest_addr[ETH_ALEN]; 51 u8 dest_addr[ETH_ALEN];
51 u8 ctl_src_addr[ETH_ALEN]; 52 u8 ctl_src_addr[ETH_ALEN];
@@ -58,16 +59,10 @@ struct fcoe_softc {
58 u8 address_mode; 59 u8 address_mode;
59}; 60};
60 61
61static inline struct fcoe_softc *fcoe_softc(
62 const struct fc_lport *lp)
63{
64 return (struct fcoe_softc *)lport_priv(lp);
65}
66
67static inline struct net_device *fcoe_netdev( 62static inline struct net_device *fcoe_netdev(
68 const struct fc_lport *lp) 63 const struct fc_lport *lp)
69{ 64{
70 return fcoe_softc(lp)->real_dev; 65 return ((struct fcoe_softc *)lport_priv(lp))->real_dev;
71} 66}
72 67
73static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb) 68static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)
diff --git a/init/Kconfig b/init/Kconfig
index f068071fcc5d..6a5c5fed66c9 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -675,6 +675,9 @@ config CC_OPTIMIZE_FOR_SIZE
675config SYSCTL 675config SYSCTL
676 bool 676 bool
677 677
678config ANON_INODES
679 bool
680
678menuconfig EMBEDDED 681menuconfig EMBEDDED
679 bool "Configure standard kernel features (for small systems)" 682 bool "Configure standard kernel features (for small systems)"
680 help 683 help
@@ -780,18 +783,6 @@ config PCSPKR_PLATFORM
780 This option allows to disable the internal PC-Speaker 783 This option allows to disable the internal PC-Speaker
781 support, saving some memory. 784 support, saving some memory.
782 785
783config COMPAT_BRK
784 bool "Disable heap randomization"
785 default y
786 help
787 Randomizing heap placement makes heap exploits harder, but it
788 also breaks ancient binaries (including anything libc5 based).
789 This option changes the bootup default to heap randomization
790 disabled, and can be overriden runtime by setting
791 /proc/sys/kernel/randomize_va_space to 2.
792
793 On non-ancient distros (post-2000 ones) N is usually a safe choice.
794
795config BASE_FULL 786config BASE_FULL
796 default y 787 default y
797 bool "Enable full-sized data structures for core" if EMBEDDED 788 bool "Enable full-sized data structures for core" if EMBEDDED
@@ -809,9 +800,6 @@ config FUTEX
809 support for "fast userspace mutexes". The resulting kernel may not 800 support for "fast userspace mutexes". The resulting kernel may not
810 run glibc-based applications correctly. 801 run glibc-based applications correctly.
811 802
812config ANON_INODES
813 bool
814
815config EPOLL 803config EPOLL
816 bool "Enable eventpoll support" if EMBEDDED 804 bool "Enable eventpoll support" if EMBEDDED
817 default y 805 default y
@@ -897,6 +885,18 @@ config SLUB_DEBUG
897 SLUB sysfs support. /sys/slab will not exist and there will be 885 SLUB sysfs support. /sys/slab will not exist and there will be
898 no support for cache validation etc. 886 no support for cache validation etc.
899 887
888config COMPAT_BRK
889 bool "Disable heap randomization"
890 default y
891 help
892 Randomizing heap placement makes heap exploits harder, but it
893 also breaks ancient binaries (including anything libc5 based).
894 This option changes the bootup default to heap randomization
895 disabled, and can be overriden runtime by setting
896 /proc/sys/kernel/randomize_va_space to 2.
897
898 On non-ancient distros (post-2000 ones) N is usually a safe choice.
899
900choice 900choice
901 prompt "Choose SLAB allocator" 901 prompt "Choose SLAB allocator"
902 default SLUB 902 default SLUB
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 708105e163df..8d4ff5afc1d8 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -370,10 +370,14 @@ void __init prepare_namespace(void)
370 ssleep(root_delay); 370 ssleep(root_delay);
371 } 371 }
372 372
373 /* wait for the known devices to complete their probing */ 373 /*
374 while (driver_probe_done() != 0) 374 * wait for the known devices to complete their probing
375 msleep(100); 375 *
376 async_synchronize_full(); 376 * Note: this is a potential source of long boot delays.
377 * For example, it is not atypical to wait 5 seconds here
378 * for the touchpad of a laptop to initialize.
379 */
380 wait_for_device_probe();
377 381
378 md_run_setup(); 382 md_run_setup();
379 383
@@ -399,6 +403,7 @@ void __init prepare_namespace(void)
399 while (driver_probe_done() != 0 || 403 while (driver_probe_done() != 0 ||
400 (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) 404 (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
401 msleep(100); 405 msleep(100);
406 async_synchronize_full();
402 } 407 }
403 408
404 is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; 409 is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index ff95e3192884..9bdddbcb3d6a 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -281,8 +281,9 @@ static void __init autodetect_raid(void)
281 */ 281 */
282 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n"); 282 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
283 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n"); 283 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
284 while (driver_probe_done() < 0) 284
285 msleep(100); 285 wait_for_device_probe();
286
286 fd = sys_open("/dev/md0", 0, 0); 287 fd = sys_open("/dev/md0", 0, 0);
287 if (fd >= 0) { 288 if (fd >= 0) {
288 sys_ioctl(fd, RAID_AUTORUN, raid_autopart); 289 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
diff --git a/init/main.c b/init/main.c
index 844209453c02..83697e160b3a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -97,7 +97,7 @@ static inline void mark_rodata_ro(void) { }
97extern void tc_init(void); 97extern void tc_init(void);
98#endif 98#endif
99 99
100enum system_states system_state; 100enum system_states system_state __read_mostly;
101EXPORT_SYMBOL(system_state); 101EXPORT_SYMBOL(system_state);
102 102
103/* 103/*
@@ -463,6 +463,7 @@ static noinline void __init_refok rest_init(void)
463 * at least once to get things moving: 463 * at least once to get things moving:
464 */ 464 */
465 init_idle_bootup_task(current); 465 init_idle_bootup_task(current);
466 rcu_scheduler_starting();
466 preempt_enable_no_resched(); 467 preempt_enable_no_resched();
467 schedule(); 468 schedule();
468 preempt_disable(); 469 preempt_disable();
diff --git a/kernel/Makefile b/kernel/Makefile
index 170a9213c1b6..e4791b3ba55d 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_UID16) += uid16.o
51obj-$(CONFIG_MODULES) += module.o 51obj-$(CONFIG_MODULES) += module.o
52obj-$(CONFIG_KALLSYMS) += kallsyms.o 52obj-$(CONFIG_KALLSYMS) += kallsyms.o
53obj-$(CONFIG_PM) += power/ 53obj-$(CONFIG_PM) += power/
54obj-$(CONFIG_FREEZER) += power/
54obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o 55obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
55obj-$(CONFIG_KEXEC) += kexec.o 56obj-$(CONFIG_KEXEC) += kexec.o
56obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o 57obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e14db9c089b9..9edb5c4b79b4 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1122,8 +1122,8 @@ static void cgroup_kill_sb(struct super_block *sb) {
1122 1122
1123 mutex_unlock(&cgroup_mutex); 1123 mutex_unlock(&cgroup_mutex);
1124 1124
1125 kfree(root);
1126 kill_litter_super(sb); 1125 kill_litter_super(sb);
1126 kfree(root);
1127} 1127}
1128 1128
1129static struct file_system_type cgroup_fs_type = { 1129static struct file_system_type cgroup_fs_type = {
diff --git a/kernel/fork.c b/kernel/fork.c
index a66fbde20715..4854c2c4a82e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1179,10 +1179,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1179#endif 1179#endif
1180 clear_all_latency_tracing(p); 1180 clear_all_latency_tracing(p);
1181 1181
1182 /* Our parent execution domain becomes current domain
1183 These must match for thread signalling to apply */
1184 p->parent_exec_id = p->self_exec_id;
1185
1186 /* ok, now we should be set up.. */ 1182 /* ok, now we should be set up.. */
1187 p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); 1183 p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL);
1188 p->pdeath_signal = 0; 1184 p->pdeath_signal = 0;
@@ -1220,10 +1216,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1220 set_task_cpu(p, smp_processor_id()); 1216 set_task_cpu(p, smp_processor_id());
1221 1217
1222 /* CLONE_PARENT re-uses the old parent */ 1218 /* CLONE_PARENT re-uses the old parent */
1223 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) 1219 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
1224 p->real_parent = current->real_parent; 1220 p->real_parent = current->real_parent;
1225 else 1221 p->parent_exec_id = current->parent_exec_id;
1222 } else {
1226 p->real_parent = current; 1223 p->real_parent = current;
1224 p->parent_exec_id = current->self_exec_id;
1225 }
1227 1226
1228 spin_lock(&current->sighand->siglock); 1227 spin_lock(&current->sighand->siglock);
1229 1228
diff --git a/kernel/futex.c b/kernel/futex.c
index f89d373a9c6d..438701adce23 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1165,6 +1165,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
1165 u32 val, ktime_t *abs_time, u32 bitset, int clockrt) 1165 u32 val, ktime_t *abs_time, u32 bitset, int clockrt)
1166{ 1166{
1167 struct task_struct *curr = current; 1167 struct task_struct *curr = current;
1168 struct restart_block *restart;
1168 DECLARE_WAITQUEUE(wait, curr); 1169 DECLARE_WAITQUEUE(wait, curr);
1169 struct futex_hash_bucket *hb; 1170 struct futex_hash_bucket *hb;
1170 struct futex_q q; 1171 struct futex_q q;
@@ -1216,11 +1217,13 @@ retry:
1216 1217
1217 if (!ret) 1218 if (!ret)
1218 goto retry; 1219 goto retry;
1219 return ret; 1220 goto out;
1220 } 1221 }
1221 ret = -EWOULDBLOCK; 1222 ret = -EWOULDBLOCK;
1222 if (uval != val) 1223 if (unlikely(uval != val)) {
1223 goto out_unlock_put_key; 1224 queue_unlock(&q, hb);
1225 goto out_put_key;
1226 }
1224 1227
1225 /* Only actually queue if *uaddr contained val. */ 1228 /* Only actually queue if *uaddr contained val. */
1226 queue_me(&q, hb); 1229 queue_me(&q, hb);
@@ -1284,38 +1287,38 @@ retry:
1284 */ 1287 */
1285 1288
1286 /* If we were woken (and unqueued), we succeeded, whatever. */ 1289 /* If we were woken (and unqueued), we succeeded, whatever. */
1290 ret = 0;
1287 if (!unqueue_me(&q)) 1291 if (!unqueue_me(&q))
1288 return 0; 1292 goto out_put_key;
1293 ret = -ETIMEDOUT;
1289 if (rem) 1294 if (rem)
1290 return -ETIMEDOUT; 1295 goto out_put_key;
1291 1296
1292 /* 1297 /*
1293 * We expect signal_pending(current), but another thread may 1298 * We expect signal_pending(current), but another thread may
1294 * have handled it for us already. 1299 * have handled it for us already.
1295 */ 1300 */
1301 ret = -ERESTARTSYS;
1296 if (!abs_time) 1302 if (!abs_time)
1297 return -ERESTARTSYS; 1303 goto out_put_key;
1298 else {
1299 struct restart_block *restart;
1300 restart = &current_thread_info()->restart_block;
1301 restart->fn = futex_wait_restart;
1302 restart->futex.uaddr = (u32 *)uaddr;
1303 restart->futex.val = val;
1304 restart->futex.time = abs_time->tv64;
1305 restart->futex.bitset = bitset;
1306 restart->futex.flags = 0;
1307
1308 if (fshared)
1309 restart->futex.flags |= FLAGS_SHARED;
1310 if (clockrt)
1311 restart->futex.flags |= FLAGS_CLOCKRT;
1312 return -ERESTART_RESTARTBLOCK;
1313 }
1314 1304
1315out_unlock_put_key: 1305 restart = &current_thread_info()->restart_block;
1316 queue_unlock(&q, hb); 1306 restart->fn = futex_wait_restart;
1317 put_futex_key(fshared, &q.key); 1307 restart->futex.uaddr = (u32 *)uaddr;
1308 restart->futex.val = val;
1309 restart->futex.time = abs_time->tv64;
1310 restart->futex.bitset = bitset;
1311 restart->futex.flags = 0;
1312
1313 if (fshared)
1314 restart->futex.flags |= FLAGS_SHARED;
1315 if (clockrt)
1316 restart->futex.flags |= FLAGS_CLOCKRT;
1318 1317
1318 ret = -ERESTART_RESTARTBLOCK;
1319
1320out_put_key:
1321 put_futex_key(fshared, &q.key);
1319out: 1322out:
1320 return ret; 1323 return ret;
1321} 1324}
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 759b8b04d294..f6cdda68e5c6 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -338,6 +338,8 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
338 irqreturn_t ret, retval = IRQ_NONE; 338 irqreturn_t ret, retval = IRQ_NONE;
339 unsigned int status = 0; 339 unsigned int status = 0;
340 340
341 WARN_ONCE(!in_irq(), "BUG: IRQ handler called from non-hardirq context!");
342
341 if (!(action->flags & IRQF_DISABLED)) 343 if (!(action->flags & IRQF_DISABLED))
342 local_irq_enable_in_hardirq(); 344 local_irq_enable_in_hardirq();
343 345
@@ -357,6 +359,11 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
357} 359}
358 360
359#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 361#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
362
363#ifdef CONFIG_ENABLE_WARN_DEPRECATED
364# warning __do_IRQ is deprecated. Please convert to proper flow handlers
365#endif
366
360/** 367/**
361 * __do_IRQ - original all in one highlevel IRQ handler 368 * __do_IRQ - original all in one highlevel IRQ handler
362 * @irq: the interrupt number 369 * @irq: the interrupt number
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index cbc3828faf5f..ea119effe096 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -389,9 +389,9 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
389 * allocate special interrupts that are part of the architecture. 389 * allocate special interrupts that are part of the architecture.
390 */ 390 */
391static int 391static int
392__setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new) 392__setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
393{ 393{
394 struct irqaction *old, **p; 394 struct irqaction *old, **old_ptr;
395 const char *old_name = NULL; 395 const char *old_name = NULL;
396 unsigned long flags; 396 unsigned long flags;
397 int shared = 0; 397 int shared = 0;
@@ -423,8 +423,8 @@ __setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new)
423 * The following block of code has to be executed atomically 423 * The following block of code has to be executed atomically
424 */ 424 */
425 spin_lock_irqsave(&desc->lock, flags); 425 spin_lock_irqsave(&desc->lock, flags);
426 p = &desc->action; 426 old_ptr = &desc->action;
427 old = *p; 427 old = *old_ptr;
428 if (old) { 428 if (old) {
429 /* 429 /*
430 * Can't share interrupts unless both agree to and are 430 * Can't share interrupts unless both agree to and are
@@ -447,8 +447,8 @@ __setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new)
447 447
448 /* add new interrupt at end of irq queue */ 448 /* add new interrupt at end of irq queue */
449 do { 449 do {
450 p = &old->next; 450 old_ptr = &old->next;
451 old = *p; 451 old = *old_ptr;
452 } while (old); 452 } while (old);
453 shared = 1; 453 shared = 1;
454 } 454 }
@@ -499,7 +499,7 @@ __setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new)
499 (int)(new->flags & IRQF_TRIGGER_MASK)); 499 (int)(new->flags & IRQF_TRIGGER_MASK));
500 } 500 }
501 501
502 *p = new; 502 *old_ptr = new;
503 503
504 /* Reset broken irq detection when installing new handler */ 504 /* Reset broken irq detection when installing new handler */
505 desc->irq_count = 0; 505 desc->irq_count = 0;
@@ -549,90 +549,117 @@ int setup_irq(unsigned int irq, struct irqaction *act)
549 549
550 return __setup_irq(irq, desc, act); 550 return __setup_irq(irq, desc, act);
551} 551}
552EXPORT_SYMBOL_GPL(setup_irq);
552 553
553/** 554 /*
554 * free_irq - free an interrupt 555 * Internal function to unregister an irqaction - used to free
555 * @irq: Interrupt line to free 556 * regular and special interrupts that are part of the architecture.
556 * @dev_id: Device identity to free
557 *
558 * Remove an interrupt handler. The handler is removed and if the
559 * interrupt line is no longer in use by any driver it is disabled.
560 * On a shared IRQ the caller must ensure the interrupt is disabled
561 * on the card it drives before calling this function. The function
562 * does not return until any executing interrupts for this IRQ
563 * have completed.
564 *
565 * This function must not be called from interrupt context.
566 */ 557 */
567void free_irq(unsigned int irq, void *dev_id) 558static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
568{ 559{
569 struct irq_desc *desc = irq_to_desc(irq); 560 struct irq_desc *desc = irq_to_desc(irq);
570 struct irqaction **p; 561 struct irqaction *action, **action_ptr;
571 unsigned long flags; 562 unsigned long flags;
572 563
573 WARN_ON(in_interrupt()); 564 WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq);
574 565
575 if (!desc) 566 if (!desc)
576 return; 567 return NULL;
577 568
578 spin_lock_irqsave(&desc->lock, flags); 569 spin_lock_irqsave(&desc->lock, flags);
579 p = &desc->action; 570
571 /*
572 * There can be multiple actions per IRQ descriptor, find the right
573 * one based on the dev_id:
574 */
575 action_ptr = &desc->action;
580 for (;;) { 576 for (;;) {
581 struct irqaction *action = *p; 577 action = *action_ptr;
582 578
583 if (action) { 579 if (!action) {
584 struct irqaction **pp = p; 580 WARN(1, "Trying to free already-free IRQ %d\n", irq);
581 spin_unlock_irqrestore(&desc->lock, flags);
585 582
586 p = &action->next; 583 return NULL;
587 if (action->dev_id != dev_id) 584 }
588 continue;
589 585
590 /* Found it - now remove it from the list of entries */ 586 if (action->dev_id == dev_id)
591 *pp = action->next; 587 break;
588 action_ptr = &action->next;
589 }
592 590
593 /* Currently used only by UML, might disappear one day.*/ 591 /* Found it - now remove it from the list of entries: */
592 *action_ptr = action->next;
593
594 /* Currently used only by UML, might disappear one day: */
594#ifdef CONFIG_IRQ_RELEASE_METHOD 595#ifdef CONFIG_IRQ_RELEASE_METHOD
595 if (desc->chip->release) 596 if (desc->chip->release)
596 desc->chip->release(irq, dev_id); 597 desc->chip->release(irq, dev_id);
597#endif 598#endif
598 599
599 if (!desc->action) { 600 /* If this was the last handler, shut down the IRQ line: */
600 desc->status |= IRQ_DISABLED; 601 if (!desc->action) {
601 if (desc->chip->shutdown) 602 desc->status |= IRQ_DISABLED;
602 desc->chip->shutdown(irq); 603 if (desc->chip->shutdown)
603 else 604 desc->chip->shutdown(irq);
604 desc->chip->disable(irq); 605 else
605 } 606 desc->chip->disable(irq);
606 spin_unlock_irqrestore(&desc->lock, flags); 607 }
607 unregister_handler_proc(irq, action); 608 spin_unlock_irqrestore(&desc->lock, flags);
609
610 unregister_handler_proc(irq, action);
611
612 /* Make sure it's not being used on another CPU: */
613 synchronize_irq(irq);
608 614
609 /* Make sure it's not being used on another CPU */
610 synchronize_irq(irq);
611#ifdef CONFIG_DEBUG_SHIRQ
612 /*
613 * It's a shared IRQ -- the driver ought to be
614 * prepared for it to happen even now it's
615 * being freed, so let's make sure.... We do
616 * this after actually deregistering it, to
617 * make sure that a 'real' IRQ doesn't run in
618 * parallel with our fake
619 */
620 if (action->flags & IRQF_SHARED) {
621 local_irq_save(flags);
622 action->handler(irq, dev_id);
623 local_irq_restore(flags);
624 }
625#endif
626 kfree(action);
627 return;
628 }
629 printk(KERN_ERR "Trying to free already-free IRQ %d\n", irq);
630#ifdef CONFIG_DEBUG_SHIRQ 615#ifdef CONFIG_DEBUG_SHIRQ
631 dump_stack(); 616 /*
632#endif 617 * It's a shared IRQ -- the driver ought to be prepared for an IRQ
633 spin_unlock_irqrestore(&desc->lock, flags); 618 * event to happen even now it's being freed, so let's make sure that
634 return; 619 * is so by doing an extra call to the handler ....
620 *
621 * ( We do this after actually deregistering it, to make sure that a
622 * 'real' IRQ doesn't run in * parallel with our fake. )
623 */
624 if (action->flags & IRQF_SHARED) {
625 local_irq_save(flags);
626 action->handler(irq, dev_id);
627 local_irq_restore(flags);
635 } 628 }
629#endif
630 return action;
631}
632
633/**
634 * remove_irq - free an interrupt
635 * @irq: Interrupt line to free
636 * @act: irqaction for the interrupt
637 *
638 * Used to remove interrupts statically setup by the early boot process.
639 */
640void remove_irq(unsigned int irq, struct irqaction *act)
641{
642 __free_irq(irq, act->dev_id);
643}
644EXPORT_SYMBOL_GPL(remove_irq);
645
646/**
647 * free_irq - free an interrupt allocated with request_irq
648 * @irq: Interrupt line to free
649 * @dev_id: Device identity to free
650 *
651 * Remove an interrupt handler. The handler is removed and if the
652 * interrupt line is no longer in use by any driver it is disabled.
653 * On a shared IRQ the caller must ensure the interrupt is disabled
654 * on the card it drives before calling this function. The function
655 * does not return until any executing interrupts for this IRQ
656 * have completed.
657 *
658 * This function must not be called from interrupt context.
659 */
660void free_irq(unsigned int irq, void *dev_id)
661{
662 kfree(__free_irq(irq, dev_id));
636} 663}
637EXPORT_SYMBOL(free_irq); 664EXPORT_SYMBOL(free_irq);
638 665
@@ -679,11 +706,12 @@ int request_irq(unsigned int irq, irq_handler_t handler,
679 * the behavior is classified as "will not fix" so we need to 706 * the behavior is classified as "will not fix" so we need to
680 * start nudging drivers away from using that idiom. 707 * start nudging drivers away from using that idiom.
681 */ 708 */
682 if ((irqflags & (IRQF_SHARED|IRQF_DISABLED)) 709 if ((irqflags & (IRQF_SHARED|IRQF_DISABLED)) ==
683 == (IRQF_SHARED|IRQF_DISABLED)) 710 (IRQF_SHARED|IRQF_DISABLED)) {
684 pr_warning("IRQ %d/%s: IRQF_DISABLED is not " 711 pr_warning(
685 "guaranteed on shared IRQs\n", 712 "IRQ %d/%s: IRQF_DISABLED is not guaranteed on shared IRQs\n",
686 irq, devname); 713 irq, devname);
714 }
687 715
688#ifdef CONFIG_LOCKDEP 716#ifdef CONFIG_LOCKDEP
689 /* 717 /*
@@ -709,15 +737,13 @@ int request_irq(unsigned int irq, irq_handler_t handler,
709 if (!handler) 737 if (!handler)
710 return -EINVAL; 738 return -EINVAL;
711 739
712 action = kmalloc(sizeof(struct irqaction), GFP_KERNEL); 740 action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
713 if (!action) 741 if (!action)
714 return -ENOMEM; 742 return -ENOMEM;
715 743
716 action->handler = handler; 744 action->handler = handler;
717 action->flags = irqflags; 745 action->flags = irqflags;
718 cpus_clear(action->mask);
719 action->name = devname; 746 action->name = devname;
720 action->next = NULL;
721 action->dev_id = dev_id; 747 action->dev_id = dev_id;
722 748
723 retval = __setup_irq(irq, desc, action); 749 retval = __setup_irq(irq, desc, action);
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 8a6d7b08864e..483899578259 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1465,6 +1465,11 @@ int kernel_kexec(void)
1465 error = device_power_down(PMSG_FREEZE); 1465 error = device_power_down(PMSG_FREEZE);
1466 if (error) 1466 if (error)
1467 goto Enable_irqs; 1467 goto Enable_irqs;
1468
1469 /* Suspend system devices */
1470 error = sysdev_suspend(PMSG_FREEZE);
1471 if (error)
1472 goto Power_up_devices;
1468 } else 1473 } else
1469#endif 1474#endif
1470 { 1475 {
@@ -1477,6 +1482,8 @@ int kernel_kexec(void)
1477 1482
1478#ifdef CONFIG_KEXEC_JUMP 1483#ifdef CONFIG_KEXEC_JUMP
1479 if (kexec_image->preserve_context) { 1484 if (kexec_image->preserve_context) {
1485 sysdev_resume();
1486 Power_up_devices:
1480 device_power_up(PMSG_RESTORE); 1487 device_power_up(PMSG_RESTORE);
1481 Enable_irqs: 1488 Enable_irqs:
1482 local_irq_enable(); 1489 local_irq_enable();
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 2313a4cc14ea..e976e505648d 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -681,6 +681,33 @@ static void cpu_timer_fire(struct k_itimer *timer)
681} 681}
682 682
683/* 683/*
684 * Sample a process (thread group) timer for the given group_leader task.
685 * Must be called with tasklist_lock held for reading.
686 */
687static int cpu_timer_sample_group(const clockid_t which_clock,
688 struct task_struct *p,
689 union cpu_time_count *cpu)
690{
691 struct task_cputime cputime;
692
693 thread_group_cputimer(p, &cputime);
694 switch (CPUCLOCK_WHICH(which_clock)) {
695 default:
696 return -EINVAL;
697 case CPUCLOCK_PROF:
698 cpu->cpu = cputime_add(cputime.utime, cputime.stime);
699 break;
700 case CPUCLOCK_VIRT:
701 cpu->cpu = cputime.utime;
702 break;
703 case CPUCLOCK_SCHED:
704 cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);
705 break;
706 }
707 return 0;
708}
709
710/*
684 * Guts of sys_timer_settime for CPU timers. 711 * Guts of sys_timer_settime for CPU timers.
685 * This is called with the timer locked and interrupts disabled. 712 * This is called with the timer locked and interrupts disabled.
686 * If we return TIMER_RETRY, it's necessary to release the timer's lock 713 * If we return TIMER_RETRY, it's necessary to release the timer's lock
@@ -741,7 +768,7 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags,
741 if (CPUCLOCK_PERTHREAD(timer->it_clock)) { 768 if (CPUCLOCK_PERTHREAD(timer->it_clock)) {
742 cpu_clock_sample(timer->it_clock, p, &val); 769 cpu_clock_sample(timer->it_clock, p, &val);
743 } else { 770 } else {
744 cpu_clock_sample_group(timer->it_clock, p, &val); 771 cpu_timer_sample_group(timer->it_clock, p, &val);
745 } 772 }
746 773
747 if (old) { 774 if (old) {
@@ -889,7 +916,7 @@ void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
889 read_unlock(&tasklist_lock); 916 read_unlock(&tasklist_lock);
890 goto dead; 917 goto dead;
891 } else { 918 } else {
892 cpu_clock_sample_group(timer->it_clock, p, &now); 919 cpu_timer_sample_group(timer->it_clock, p, &now);
893 clear_dead = (unlikely(p->exit_state) && 920 clear_dead = (unlikely(p->exit_state) &&
894 thread_group_empty(p)); 921 thread_group_empty(p));
895 } 922 }
@@ -1244,7 +1271,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
1244 clear_dead_task(timer, now); 1271 clear_dead_task(timer, now);
1245 goto out_unlock; 1272 goto out_unlock;
1246 } 1273 }
1247 cpu_clock_sample_group(timer->it_clock, p, &now); 1274 cpu_timer_sample_group(timer->it_clock, p, &now);
1248 bump_cpu_timer(timer, now); 1275 bump_cpu_timer(timer, now);
1249 /* Leave the tasklist_lock locked for the call below. */ 1276 /* Leave the tasklist_lock locked for the call below. */
1250 } 1277 }
@@ -1409,33 +1436,6 @@ void run_posix_cpu_timers(struct task_struct *tsk)
1409} 1436}
1410 1437
1411/* 1438/*
1412 * Sample a process (thread group) timer for the given group_leader task.
1413 * Must be called with tasklist_lock held for reading.
1414 */
1415static int cpu_timer_sample_group(const clockid_t which_clock,
1416 struct task_struct *p,
1417 union cpu_time_count *cpu)
1418{
1419 struct task_cputime cputime;
1420
1421 thread_group_cputimer(p, &cputime);
1422 switch (CPUCLOCK_WHICH(which_clock)) {
1423 default:
1424 return -EINVAL;
1425 case CPUCLOCK_PROF:
1426 cpu->cpu = cputime_add(cputime.utime, cputime.stime);
1427 break;
1428 case CPUCLOCK_VIRT:
1429 cpu->cpu = cputime.utime;
1430 break;
1431 case CPUCLOCK_SCHED:
1432 cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);
1433 break;
1434 }
1435 return 0;
1436}
1437
1438/*
1439 * Set one of the process-wide special case CPU timers. 1439 * Set one of the process-wide special case CPU timers.
1440 * The tsk->sighand->siglock must be held by the caller. 1440 * The tsk->sighand->siglock must be held by the caller.
1441 * The *newval argument is relative and we update it to be absolute, *oldval 1441 * The *newval argument is relative and we update it to be absolute, *oldval
diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index d7a10167a25b..720ea4f781bd 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -3,7 +3,7 @@ ifeq ($(CONFIG_PM_DEBUG),y)
3EXTRA_CFLAGS += -DDEBUG 3EXTRA_CFLAGS += -DDEBUG
4endif 4endif
5 5
6obj-y := main.o 6obj-$(CONFIG_PM) += main.o
7obj-$(CONFIG_PM_SLEEP) += console.o 7obj-$(CONFIG_PM_SLEEP) += console.o
8obj-$(CONFIG_FREEZER) += process.o 8obj-$(CONFIG_FREEZER) += process.o
9obj-$(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
diff --git a/kernel/power/console.c b/kernel/power/console.c
index b8628be2a465..a3961b205de7 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -78,6 +78,12 @@ void pm_restore_console(void)
78 } 78 }
79 set_console(orig_fgconsole); 79 set_console(orig_fgconsole);
80 release_console_sem(); 80 release_console_sem();
81
82 if (vt_waitactive(orig_fgconsole)) {
83 pr_debug("Resume: Can't switch VCs.");
84 return;
85 }
86
81 kmsg_redirect = orig_kmsg; 87 kmsg_redirect = orig_kmsg;
82} 88}
83#endif 89#endif
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 432ee575c9ee..4a4a206b1979 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -227,6 +227,12 @@ static int create_image(int platform_mode)
227 "aborting hibernation\n"); 227 "aborting hibernation\n");
228 goto Enable_irqs; 228 goto Enable_irqs;
229 } 229 }
230 sysdev_suspend(PMSG_FREEZE);
231 if (error) {
232 printk(KERN_ERR "PM: Some devices failed to power down, "
233 "aborting hibernation\n");
234 goto Power_up_devices;
235 }
230 236
231 if (hibernation_test(TEST_CORE)) 237 if (hibernation_test(TEST_CORE))
232 goto Power_up; 238 goto Power_up;
@@ -242,9 +248,11 @@ static int create_image(int platform_mode)
242 if (!in_suspend) 248 if (!in_suspend)
243 platform_leave(platform_mode); 249 platform_leave(platform_mode);
244 Power_up: 250 Power_up:
251 sysdev_resume();
245 /* NOTE: device_power_up() is just a resume() for devices 252 /* NOTE: device_power_up() is just a resume() for devices
246 * that suspended with irqs off ... no overall powerup. 253 * that suspended with irqs off ... no overall powerup.
247 */ 254 */
255 Power_up_devices:
248 device_power_up(in_suspend ? 256 device_power_up(in_suspend ?
249 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); 257 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
250 Enable_irqs: 258 Enable_irqs:
@@ -335,6 +343,7 @@ static int resume_target_kernel(void)
335 "aborting resume\n"); 343 "aborting resume\n");
336 goto Enable_irqs; 344 goto Enable_irqs;
337 } 345 }
346 sysdev_suspend(PMSG_QUIESCE);
338 /* We'll ignore saved state, but this gets preempt count (etc) right */ 347 /* We'll ignore saved state, but this gets preempt count (etc) right */
339 save_processor_state(); 348 save_processor_state();
340 error = restore_highmem(); 349 error = restore_highmem();
@@ -357,6 +366,7 @@ static int resume_target_kernel(void)
357 swsusp_free(); 366 swsusp_free();
358 restore_processor_state(); 367 restore_processor_state();
359 touch_softlockup_watchdog(); 368 touch_softlockup_watchdog();
369 sysdev_resume();
360 device_power_up(PMSG_RECOVER); 370 device_power_up(PMSG_RECOVER);
361 Enable_irqs: 371 Enable_irqs:
362 local_irq_enable(); 372 local_irq_enable();
@@ -440,6 +450,7 @@ int hibernation_platform_enter(void)
440 local_irq_disable(); 450 local_irq_disable();
441 error = device_power_down(PMSG_HIBERNATE); 451 error = device_power_down(PMSG_HIBERNATE);
442 if (!error) { 452 if (!error) {
453 sysdev_suspend(PMSG_HIBERNATE);
443 hibernation_ops->enter(); 454 hibernation_ops->enter();
444 /* We should never get here */ 455 /* We should never get here */
445 while (1); 456 while (1);
@@ -595,6 +606,12 @@ static int software_resume(void)
595 unsigned int flags; 606 unsigned int flags;
596 607
597 /* 608 /*
609 * If the user said "noresume".. bail out early.
610 */
611 if (noresume)
612 return 0;
613
614 /*
598 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs 615 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
599 * is configured into the kernel. Since the regular hibernate 616 * is configured into the kernel. Since the regular hibernate
600 * trigger path is via sysfs which takes a buffer mutex before 617 * trigger path is via sysfs which takes a buffer mutex before
@@ -610,6 +627,11 @@ static int software_resume(void)
610 mutex_unlock(&pm_mutex); 627 mutex_unlock(&pm_mutex);
611 return -ENOENT; 628 return -ENOENT;
612 } 629 }
630 /*
631 * Some device discovery might still be in progress; we need
632 * to wait for this to finish.
633 */
634 wait_for_device_probe();
613 swsusp_resume_device = name_to_dev_t(resume_file); 635 swsusp_resume_device = name_to_dev_t(resume_file);
614 pr_debug("PM: Resume from partition %s\n", resume_file); 636 pr_debug("PM: Resume from partition %s\n", resume_file);
615 } else { 637 } else {
diff --git a/kernel/power/main.c b/kernel/power/main.c
index b4d219016b6c..c9632f841f64 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -298,8 +298,12 @@ static int suspend_enter(suspend_state_t state)
298 goto Done; 298 goto Done;
299 } 299 }
300 300
301 if (!suspend_test(TEST_CORE)) 301 error = sysdev_suspend(PMSG_SUSPEND);
302 error = suspend_ops->enter(state); 302 if (!error) {
303 if (!suspend_test(TEST_CORE))
304 error = suspend_ops->enter(state);
305 sysdev_resume();
306 }
303 307
304 device_power_up(PMSG_RESUME); 308 device_power_up(PMSG_RESUME);
305 Done: 309 Done:
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 6da14358537c..505f319e489c 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -60,6 +60,7 @@ static struct block_device *resume_bdev;
60static int submit(int rw, pgoff_t page_off, struct page *page, 60static int submit(int rw, pgoff_t page_off, struct page *page,
61 struct bio **bio_chain) 61 struct bio **bio_chain)
62{ 62{
63 const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
63 struct bio *bio; 64 struct bio *bio;
64 65
65 bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); 66 bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1);
@@ -80,7 +81,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
80 bio_get(bio); 81 bio_get(bio);
81 82
82 if (bio_chain == NULL) { 83 if (bio_chain == NULL) {
83 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 84 submit_bio(bio_rw, bio);
84 wait_on_page_locked(page); 85 wait_on_page_locked(page);
85 if (rw == READ) 86 if (rw == READ)
86 bio_set_pages_dirty(bio); 87 bio_set_pages_dirty(bio);
@@ -90,7 +91,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
90 get_page(page); /* These pages are freed later */ 91 get_page(page); /* These pages are freed later */
91 bio->bi_private = *bio_chain; 92 bio->bi_private = *bio_chain;
92 *bio_chain = bio; 93 *bio_chain = bio;
93 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 94 submit_bio(bio_rw, bio);
94 } 95 }
95 return 0; 96 return 0;
96} 97}
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 005b93d839ba..6c85359364f2 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -95,15 +95,15 @@ static int snapshot_open(struct inode *inode, struct file *filp)
95 data->swap = swsusp_resume_device ? 95 data->swap = swsusp_resume_device ?
96 swap_type_of(swsusp_resume_device, 0, NULL) : -1; 96 swap_type_of(swsusp_resume_device, 0, NULL) : -1;
97 data->mode = O_RDONLY; 97 data->mode = O_RDONLY;
98 error = pm_notifier_call_chain(PM_RESTORE_PREPARE); 98 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
99 if (error) 99 if (error)
100 pm_notifier_call_chain(PM_POST_RESTORE); 100 pm_notifier_call_chain(PM_POST_HIBERNATION);
101 } else { 101 } else {
102 data->swap = -1; 102 data->swap = -1;
103 data->mode = O_WRONLY; 103 data->mode = O_WRONLY;
104 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); 104 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
105 if (error) 105 if (error)
106 pm_notifier_call_chain(PM_POST_HIBERNATION); 106 pm_notifier_call_chain(PM_POST_RESTORE);
107 } 107 }
108 if (error) 108 if (error)
109 atomic_inc(&snapshot_device_available); 109 atomic_inc(&snapshot_device_available);
diff --git a/kernel/printk.c b/kernel/printk.c
index 69188f226a93..e3602d0755b0 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -73,7 +73,6 @@ EXPORT_SYMBOL(oops_in_progress);
73 * driver system. 73 * driver system.
74 */ 74 */
75static DECLARE_MUTEX(console_sem); 75static DECLARE_MUTEX(console_sem);
76static DECLARE_MUTEX(secondary_console_sem);
77struct console *console_drivers; 76struct console *console_drivers;
78EXPORT_SYMBOL_GPL(console_drivers); 77EXPORT_SYMBOL_GPL(console_drivers);
79 78
@@ -891,12 +890,14 @@ void suspend_console(void)
891 printk("Suspending console(s) (use no_console_suspend to debug)\n"); 890 printk("Suspending console(s) (use no_console_suspend to debug)\n");
892 acquire_console_sem(); 891 acquire_console_sem();
893 console_suspended = 1; 892 console_suspended = 1;
893 up(&console_sem);
894} 894}
895 895
896void resume_console(void) 896void resume_console(void)
897{ 897{
898 if (!console_suspend_enabled) 898 if (!console_suspend_enabled)
899 return; 899 return;
900 down(&console_sem);
900 console_suspended = 0; 901 console_suspended = 0;
901 release_console_sem(); 902 release_console_sem();
902} 903}
@@ -912,11 +913,9 @@ void resume_console(void)
912void acquire_console_sem(void) 913void acquire_console_sem(void)
913{ 914{
914 BUG_ON(in_interrupt()); 915 BUG_ON(in_interrupt());
915 if (console_suspended) {
916 down(&secondary_console_sem);
917 return;
918 }
919 down(&console_sem); 916 down(&console_sem);
917 if (console_suspended)
918 return;
920 console_locked = 1; 919 console_locked = 1;
921 console_may_schedule = 1; 920 console_may_schedule = 1;
922} 921}
@@ -926,6 +925,10 @@ int try_acquire_console_sem(void)
926{ 925{
927 if (down_trylock(&console_sem)) 926 if (down_trylock(&console_sem))
928 return -1; 927 return -1;
928 if (console_suspended) {
929 up(&console_sem);
930 return -1;
931 }
929 console_locked = 1; 932 console_locked = 1;
930 console_may_schedule = 0; 933 console_may_schedule = 0;
931 return 0; 934 return 0;
@@ -979,7 +982,7 @@ void release_console_sem(void)
979 unsigned wake_klogd = 0; 982 unsigned wake_klogd = 0;
980 983
981 if (console_suspended) { 984 if (console_suspended) {
982 up(&secondary_console_sem); 985 up(&console_sem);
983 return; 986 return;
984 } 987 }
985 988
diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
index bd5a9003497c..654c640a6b9c 100644
--- a/kernel/rcuclassic.c
+++ b/kernel/rcuclassic.c
@@ -679,8 +679,8 @@ int rcu_needs_cpu(int cpu)
679void rcu_check_callbacks(int cpu, int user) 679void rcu_check_callbacks(int cpu, int user)
680{ 680{
681 if (user || 681 if (user ||
682 (idle_cpu(cpu) && !in_softirq() && 682 (idle_cpu(cpu) && rcu_scheduler_active &&
683 hardirq_count() <= (1 << HARDIRQ_SHIFT))) { 683 !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
684 684
685 /* 685 /*
686 * Get here if this CPU took its interrupt from user 686 * Get here if this CPU took its interrupt from user
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index d92a76a881aa..cae8a059cf47 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -44,6 +44,7 @@
44#include <linux/cpu.h> 44#include <linux/cpu.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/module.h> 46#include <linux/module.h>
47#include <linux/kernel_stat.h>
47 48
48enum rcu_barrier { 49enum rcu_barrier {
49 RCU_BARRIER_STD, 50 RCU_BARRIER_STD,
@@ -55,6 +56,7 @@ static DEFINE_PER_CPU(struct rcu_head, rcu_barrier_head) = {NULL};
55static atomic_t rcu_barrier_cpu_count; 56static atomic_t rcu_barrier_cpu_count;
56static DEFINE_MUTEX(rcu_barrier_mutex); 57static DEFINE_MUTEX(rcu_barrier_mutex);
57static struct completion rcu_barrier_completion; 58static struct completion rcu_barrier_completion;
59int rcu_scheduler_active __read_mostly;
58 60
59/* 61/*
60 * Awaken the corresponding synchronize_rcu() instance now that a 62 * Awaken the corresponding synchronize_rcu() instance now that a
@@ -80,6 +82,10 @@ void wakeme_after_rcu(struct rcu_head *head)
80void synchronize_rcu(void) 82void synchronize_rcu(void)
81{ 83{
82 struct rcu_synchronize rcu; 84 struct rcu_synchronize rcu;
85
86 if (rcu_blocking_is_gp())
87 return;
88
83 init_completion(&rcu.completion); 89 init_completion(&rcu.completion);
84 /* Will wake me after RCU finished. */ 90 /* Will wake me after RCU finished. */
85 call_rcu(&rcu.head, wakeme_after_rcu); 91 call_rcu(&rcu.head, wakeme_after_rcu);
@@ -175,3 +181,9 @@ void __init rcu_init(void)
175 __rcu_init(); 181 __rcu_init();
176} 182}
177 183
184void rcu_scheduler_starting(void)
185{
186 WARN_ON(num_online_cpus() != 1);
187 WARN_ON(nr_context_switches() > 0);
188 rcu_scheduler_active = 1;
189}
diff --git a/kernel/rcupreempt.c b/kernel/rcupreempt.c
index 33cfc50781f9..5d59e850fb71 100644
--- a/kernel/rcupreempt.c
+++ b/kernel/rcupreempt.c
@@ -1181,6 +1181,9 @@ void __synchronize_sched(void)
1181{ 1181{
1182 struct rcu_synchronize rcu; 1182 struct rcu_synchronize rcu;
1183 1183
1184 if (num_online_cpus() == 1)
1185 return; /* blocking is gp if only one CPU! */
1186
1184 init_completion(&rcu.completion); 1187 init_completion(&rcu.completion);
1185 /* Will wake me after RCU finished. */ 1188 /* Will wake me after RCU finished. */
1186 call_rcu_sched(&rcu.head, wakeme_after_rcu); 1189 call_rcu_sched(&rcu.head, wakeme_after_rcu);
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index b2fd602a6f6f..97ce31579ec0 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -948,8 +948,8 @@ static void rcu_do_batch(struct rcu_data *rdp)
948void rcu_check_callbacks(int cpu, int user) 948void rcu_check_callbacks(int cpu, int user)
949{ 949{
950 if (user || 950 if (user ||
951 (idle_cpu(cpu) && !in_softirq() && 951 (idle_cpu(cpu) && rcu_scheduler_active &&
952 hardirq_count() <= (1 << HARDIRQ_SHIFT))) { 952 !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
953 953
954 /* 954 /*
955 * Get here if this CPU took its interrupt from user 955 * Get here if this CPU took its interrupt from user
diff --git a/kernel/sched.c b/kernel/sched.c
index c1d0ed360088..8e2558c2ba67 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -223,7 +223,7 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
223{ 223{
224 ktime_t now; 224 ktime_t now;
225 225
226 if (rt_bandwidth_enabled() && rt_b->rt_runtime == RUNTIME_INF) 226 if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF)
227 return; 227 return;
228 228
229 if (hrtimer_active(&rt_b->rt_period_timer)) 229 if (hrtimer_active(&rt_b->rt_period_timer))
@@ -6944,20 +6944,26 @@ static void free_rootdomain(struct root_domain *rd)
6944 6944
6945static void rq_attach_root(struct rq *rq, struct root_domain *rd) 6945static void rq_attach_root(struct rq *rq, struct root_domain *rd)
6946{ 6946{
6947 struct root_domain *old_rd = NULL;
6947 unsigned long flags; 6948 unsigned long flags;
6948 6949
6949 spin_lock_irqsave(&rq->lock, flags); 6950 spin_lock_irqsave(&rq->lock, flags);
6950 6951
6951 if (rq->rd) { 6952 if (rq->rd) {
6952 struct root_domain *old_rd = rq->rd; 6953 old_rd = rq->rd;
6953 6954
6954 if (cpumask_test_cpu(rq->cpu, old_rd->online)) 6955 if (cpumask_test_cpu(rq->cpu, old_rd->online))
6955 set_rq_offline(rq); 6956 set_rq_offline(rq);
6956 6957
6957 cpumask_clear_cpu(rq->cpu, old_rd->span); 6958 cpumask_clear_cpu(rq->cpu, old_rd->span);
6958 6959
6959 if (atomic_dec_and_test(&old_rd->refcount)) 6960 /*
6960 free_rootdomain(old_rd); 6961 * If we dont want to free the old_rt yet then
6962 * set old_rd to NULL to skip the freeing later
6963 * in this function:
6964 */
6965 if (!atomic_dec_and_test(&old_rd->refcount))
6966 old_rd = NULL;
6961 } 6967 }
6962 6968
6963 atomic_inc(&rd->refcount); 6969 atomic_inc(&rd->refcount);
@@ -6968,6 +6974,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
6968 set_rq_online(rq); 6974 set_rq_online(rq);
6969 6975
6970 spin_unlock_irqrestore(&rq->lock, flags); 6976 spin_unlock_irqrestore(&rq->lock, flags);
6977
6978 if (old_rd)
6979 free_rootdomain(old_rd);
6971} 6980}
6972 6981
6973static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) 6982static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
@@ -9215,6 +9224,16 @@ static int sched_rt_global_constraints(void)
9215 9224
9216 return ret; 9225 return ret;
9217} 9226}
9227
9228int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
9229{
9230 /* Don't accept realtime tasks when there is no way for them to run */
9231 if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0)
9232 return 0;
9233
9234 return 1;
9235}
9236
9218#else /* !CONFIG_RT_GROUP_SCHED */ 9237#else /* !CONFIG_RT_GROUP_SCHED */
9219static int sched_rt_global_constraints(void) 9238static int sched_rt_global_constraints(void)
9220{ 9239{
@@ -9308,8 +9327,7 @@ cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
9308 struct task_struct *tsk) 9327 struct task_struct *tsk)
9309{ 9328{
9310#ifdef CONFIG_RT_GROUP_SCHED 9329#ifdef CONFIG_RT_GROUP_SCHED
9311 /* Don't accept realtime tasks when there is no way for them to run */ 9330 if (!sched_rt_can_attach(cgroup_tg(cgrp), tsk))
9312 if (rt_task(tsk) && cgroup_tg(cgrp)->rt_bandwidth.rt_runtime == 0)
9313 return -EINVAL; 9331 return -EINVAL;
9314#else 9332#else
9315 /* We don't support RT-tasks being in separate groups */ 9333 /* We don't support RT-tasks being in separate groups */
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index ad64fcb731f2..57d4b13b631d 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/seccomp.h> 9#include <linux/seccomp.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/compat.h>
11 12
12/* #define SECCOMP_DEBUG 1 */ 13/* #define SECCOMP_DEBUG 1 */
13#define NR_SECCOMP_MODES 1 14#define NR_SECCOMP_MODES 1
@@ -22,7 +23,7 @@ static int mode1_syscalls[] = {
22 0, /* null terminated */ 23 0, /* null terminated */
23}; 24};
24 25
25#ifdef TIF_32BIT 26#ifdef CONFIG_COMPAT
26static int mode1_syscalls_32[] = { 27static int mode1_syscalls_32[] = {
27 __NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32, 28 __NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,
28 0, /* null terminated */ 29 0, /* null terminated */
@@ -37,8 +38,8 @@ void __secure_computing(int this_syscall)
37 switch (mode) { 38 switch (mode) {
38 case 1: 39 case 1:
39 syscall = mode1_syscalls; 40 syscall = mode1_syscalls;
40#ifdef TIF_32BIT 41#ifdef CONFIG_COMPAT
41 if (test_thread_flag(TIF_32BIT)) 42 if (is_compat_task())
42 syscall = mode1_syscalls_32; 43 syscall = mode1_syscalls_32;
43#endif 44#endif
44 do { 45 do {
diff --git a/kernel/softirq.c b/kernel/softirq.c
index bdbe9de9cd8d..9041ea7948fe 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -626,6 +626,7 @@ static int ksoftirqd(void * __bind_cpu)
626 preempt_enable_no_resched(); 626 preempt_enable_no_resched();
627 cond_resched(); 627 cond_resched();
628 preempt_disable(); 628 preempt_disable();
629 rcu_qsctr_inc((long)__bind_cpu);
629 } 630 }
630 preempt_enable(); 631 preempt_enable();
631 set_current_state(TASK_INTERRUPTIBLE); 632 set_current_state(TASK_INTERRUPTIBLE);
diff --git a/kernel/sys.c b/kernel/sys.c
index f145c415bc16..37f458e6882a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -559,7 +559,7 @@ error:
559 abort_creds(new); 559 abort_creds(new);
560 return retval; 560 return retval;
561} 561}
562 562
563/* 563/*
564 * change the user struct in a credentials set to match the new UID 564 * change the user struct in a credentials set to match the new UID
565 */ 565 */
@@ -571,6 +571,11 @@ static int set_user(struct cred *new)
571 if (!new_user) 571 if (!new_user)
572 return -EAGAIN; 572 return -EAGAIN;
573 573
574 if (!task_can_switch_user(new_user, current)) {
575 free_uid(new_user);
576 return -EINVAL;
577 }
578
574 if (atomic_read(&new_user->processes) >= 579 if (atomic_read(&new_user->processes) >=
575 current->signal->rlim[RLIMIT_NPROC].rlim_cur && 580 current->signal->rlim[RLIMIT_NPROC].rlim_cur &&
576 new_user != INIT_USER) { 581 new_user != INIT_USER) {
@@ -631,10 +636,11 @@ SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
631 goto error; 636 goto error;
632 } 637 }
633 638
634 retval = -EAGAIN; 639 if (new->uid != old->uid) {
635 if (new->uid != old->uid && set_user(new) < 0) 640 retval = set_user(new);
636 goto error; 641 if (retval < 0)
637 642 goto error;
643 }
638 if (ruid != (uid_t) -1 || 644 if (ruid != (uid_t) -1 ||
639 (euid != (uid_t) -1 && euid != old->uid)) 645 (euid != (uid_t) -1 && euid != old->uid))
640 new->suid = new->euid; 646 new->suid = new->euid;
@@ -680,9 +686,10 @@ SYSCALL_DEFINE1(setuid, uid_t, uid)
680 retval = -EPERM; 686 retval = -EPERM;
681 if (capable(CAP_SETUID)) { 687 if (capable(CAP_SETUID)) {
682 new->suid = new->uid = uid; 688 new->suid = new->uid = uid;
683 if (uid != old->uid && set_user(new) < 0) { 689 if (uid != old->uid) {
684 retval = -EAGAIN; 690 retval = set_user(new);
685 goto error; 691 if (retval < 0)
692 goto error;
686 } 693 }
687 } else if (uid != old->uid && uid != new->suid) { 694 } else if (uid != old->uid && uid != new->suid) {
688 goto error; 695 goto error;
@@ -734,11 +741,13 @@ SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
734 goto error; 741 goto error;
735 } 742 }
736 743
737 retval = -EAGAIN;
738 if (ruid != (uid_t) -1) { 744 if (ruid != (uid_t) -1) {
739 new->uid = ruid; 745 new->uid = ruid;
740 if (ruid != old->uid && set_user(new) < 0) 746 if (ruid != old->uid) {
741 goto error; 747 retval = set_user(new);
748 if (retval < 0)
749 goto error;
750 }
742 } 751 }
743 if (euid != (uid_t) -1) 752 if (euid != (uid_t) -1)
744 new->euid = euid; 753 new->euid = euid;
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e2a4ff6fc3a6..34e707e5ab87 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -52,6 +52,7 @@ config FUNCTION_TRACER
52 depends on HAVE_FUNCTION_TRACER 52 depends on HAVE_FUNCTION_TRACER
53 depends on DEBUG_KERNEL 53 depends on DEBUG_KERNEL
54 select FRAME_POINTER 54 select FRAME_POINTER
55 select KALLSYMS
55 select TRACING 56 select TRACING
56 select CONTEXT_SWITCH_TRACER 57 select CONTEXT_SWITCH_TRACER
57 help 58 help
@@ -238,6 +239,7 @@ config STACK_TRACER
238 depends on DEBUG_KERNEL 239 depends on DEBUG_KERNEL
239 select FUNCTION_TRACER 240 select FUNCTION_TRACER
240 select STACKTRACE 241 select STACKTRACE
242 select KALLSYMS
241 help 243 help
242 This special tracer records the maximum stack footprint of the 244 This special tracer records the maximum stack footprint of the
243 kernel and displays it in debugfs/tracing/stack_trace. 245 kernel and displays it in debugfs/tracing/stack_trace.
@@ -302,4 +304,27 @@ config FTRACE_STARTUP_TEST
302 functioning properly. It will do tests on all the configured 304 functioning properly. It will do tests on all the configured
303 tracers of ftrace. 305 tracers of ftrace.
304 306
307config MMIOTRACE
308 bool "Memory mapped IO tracing"
309 depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
310 select TRACING
311 help
312 Mmiotrace traces Memory Mapped I/O access and is meant for
313 debugging and reverse engineering. It is called from the ioremap
314 implementation and works via page faults. Tracing is disabled by
315 default and can be enabled at run-time.
316
317 See Documentation/tracers/mmiotrace.txt.
318 If you are not helping to develop drivers, say N.
319
320config MMIOTRACE_TEST
321 tristate "Test module for mmiotrace"
322 depends on MMIOTRACE && m
323 help
324 This is a dumb module for testing mmiotrace. It is very dangerous
325 as it will write garbage to IO memory starting at a given address.
326 However, it should be safe to use on e.g. unused portion of VRAM.
327
328 Say N, unless you absolutely know what you are doing.
329
305endmenu 330endmenu
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 9a236ffe2aa4..fdf913dfc7e8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2033,7 +2033,7 @@ free:
2033static int start_graph_tracing(void) 2033static int start_graph_tracing(void)
2034{ 2034{
2035 struct ftrace_ret_stack **ret_stack_list; 2035 struct ftrace_ret_stack **ret_stack_list;
2036 int ret; 2036 int ret, cpu;
2037 2037
2038 ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE * 2038 ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE *
2039 sizeof(struct ftrace_ret_stack *), 2039 sizeof(struct ftrace_ret_stack *),
@@ -2042,6 +2042,10 @@ static int start_graph_tracing(void)
2042 if (!ret_stack_list) 2042 if (!ret_stack_list)
2043 return -ENOMEM; 2043 return -ENOMEM;
2044 2044
2045 /* The cpu_boot init_task->ret_stack will never be freed */
2046 for_each_online_cpu(cpu)
2047 ftrace_graph_init_task(idle_task(cpu));
2048
2045 do { 2049 do {
2046 ret = alloc_retstack_tasklist(ret_stack_list); 2050 ret = alloc_retstack_tasklist(ret_stack_list);
2047 } while (ret == -EAGAIN); 2051 } while (ret == -EAGAIN);
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index fffcb069f1dc..80e503ef6136 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/mmiotrace.h> 10#include <linux/mmiotrace.h>
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <asm/atomic.h>
12 13
13#include "trace.h" 14#include "trace.h"
14 15
@@ -19,6 +20,7 @@ struct header_iter {
19static struct trace_array *mmio_trace_array; 20static struct trace_array *mmio_trace_array;
20static bool overrun_detected; 21static bool overrun_detected;
21static unsigned long prev_overruns; 22static unsigned long prev_overruns;
23static atomic_t dropped_count;
22 24
23static void mmio_reset_data(struct trace_array *tr) 25static void mmio_reset_data(struct trace_array *tr)
24{ 26{
@@ -121,11 +123,11 @@ static void mmio_close(struct trace_iterator *iter)
121 123
122static unsigned long count_overruns(struct trace_iterator *iter) 124static unsigned long count_overruns(struct trace_iterator *iter)
123{ 125{
124 unsigned long cnt = 0; 126 unsigned long cnt = atomic_xchg(&dropped_count, 0);
125 unsigned long over = ring_buffer_overruns(iter->tr->buffer); 127 unsigned long over = ring_buffer_overruns(iter->tr->buffer);
126 128
127 if (over > prev_overruns) 129 if (over > prev_overruns)
128 cnt = over - prev_overruns; 130 cnt += over - prev_overruns;
129 prev_overruns = over; 131 prev_overruns = over;
130 return cnt; 132 return cnt;
131} 133}
@@ -310,8 +312,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
310 312
311 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), 313 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
312 &irq_flags); 314 &irq_flags);
313 if (!event) 315 if (!event) {
316 atomic_inc(&dropped_count);
314 return; 317 return;
318 }
315 entry = ring_buffer_event_data(event); 319 entry = ring_buffer_event_data(event);
316 tracing_generic_entry_update(&entry->ent, 0, preempt_count()); 320 tracing_generic_entry_update(&entry->ent, 0, preempt_count());
317 entry->ent.type = TRACE_MMIO_RW; 321 entry->ent.type = TRACE_MMIO_RW;
@@ -338,8 +342,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
338 342
339 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), 343 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
340 &irq_flags); 344 &irq_flags);
341 if (!event) 345 if (!event) {
346 atomic_inc(&dropped_count);
342 return; 347 return;
348 }
343 entry = ring_buffer_event_data(event); 349 entry = ring_buffer_event_data(event);
344 tracing_generic_entry_update(&entry->ent, 0, preempt_count()); 350 tracing_generic_entry_update(&entry->ent, 0, preempt_count());
345 entry->ent.type = TRACE_MMIO_MAP; 351 entry->ent.type = TRACE_MMIO_MAP;
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 88c8eb70f54a..bc8e80a86bca 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -23,10 +23,20 @@ static int trace_test_buffer_cpu(struct trace_array *tr, int cpu)
23{ 23{
24 struct ring_buffer_event *event; 24 struct ring_buffer_event *event;
25 struct trace_entry *entry; 25 struct trace_entry *entry;
26 unsigned int loops = 0;
26 27
27 while ((event = ring_buffer_consume(tr->buffer, cpu, NULL))) { 28 while ((event = ring_buffer_consume(tr->buffer, cpu, NULL))) {
28 entry = ring_buffer_event_data(event); 29 entry = ring_buffer_event_data(event);
29 30
31 /*
32 * The ring buffer is a size of trace_buf_size, if
33 * we loop more than the size, there's something wrong
34 * with the ring buffer.
35 */
36 if (loops++ > trace_buf_size) {
37 printk(KERN_CONT ".. bad ring buffer ");
38 goto failed;
39 }
30 if (!trace_valid_entry(entry)) { 40 if (!trace_valid_entry(entry)) {
31 printk(KERN_CONT ".. invalid entry %d ", 41 printk(KERN_CONT ".. invalid entry %d ",
32 entry->type); 42 entry->type);
@@ -57,11 +67,20 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count)
57 67
58 cnt = ring_buffer_entries(tr->buffer); 68 cnt = ring_buffer_entries(tr->buffer);
59 69
70 /*
71 * The trace_test_buffer_cpu runs a while loop to consume all data.
72 * If the calling tracer is broken, and is constantly filling
73 * the buffer, this will run forever, and hard lock the box.
74 * We disable the ring buffer while we do this test to prevent
75 * a hard lock up.
76 */
77 tracing_off();
60 for_each_possible_cpu(cpu) { 78 for_each_possible_cpu(cpu) {
61 ret = trace_test_buffer_cpu(tr, cpu); 79 ret = trace_test_buffer_cpu(tr, cpu);
62 if (ret) 80 if (ret)
63 break; 81 break;
64 } 82 }
83 tracing_on();
65 __raw_spin_unlock(&ftrace_max_lock); 84 __raw_spin_unlock(&ftrace_max_lock);
66 local_irq_restore(flags); 85 local_irq_restore(flags);
67 86
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 43f891b05a4b..00d59d048edf 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -122,8 +122,10 @@ void acct_update_integrals(struct task_struct *tsk)
122 if (likely(tsk->mm)) { 122 if (likely(tsk->mm)) {
123 cputime_t time, dtime; 123 cputime_t time, dtime;
124 struct timeval value; 124 struct timeval value;
125 unsigned long flags;
125 u64 delta; 126 u64 delta;
126 127
128 local_irq_save(flags);
127 time = tsk->stime + tsk->utime; 129 time = tsk->stime + tsk->utime;
128 dtime = cputime_sub(time, tsk->acct_timexpd); 130 dtime = cputime_sub(time, tsk->acct_timexpd);
129 jiffies_to_timeval(cputime_to_jiffies(dtime), &value); 131 jiffies_to_timeval(cputime_to_jiffies(dtime), &value);
@@ -131,10 +133,12 @@ void acct_update_integrals(struct task_struct *tsk)
131 delta = delta * USEC_PER_SEC + value.tv_usec; 133 delta = delta * USEC_PER_SEC + value.tv_usec;
132 134
133 if (delta == 0) 135 if (delta == 0)
134 return; 136 goto out;
135 tsk->acct_timexpd = time; 137 tsk->acct_timexpd = time;
136 tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm); 138 tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
137 tsk->acct_vm_mem1 += delta * tsk->mm->total_vm; 139 tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
140 out:
141 local_irq_restore(flags);
138 } 142 }
139} 143}
140 144
diff --git a/kernel/user.c b/kernel/user.c
index 477b6660f447..fbb300e6191f 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -72,6 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
72static void uid_hash_remove(struct user_struct *up) 72static void uid_hash_remove(struct user_struct *up)
73{ 73{
74 hlist_del_init(&up->uidhash_node); 74 hlist_del_init(&up->uidhash_node);
75 put_user_ns(up->user_ns);
75} 76}
76 77
77static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) 78static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
@@ -285,14 +286,12 @@ int __init uids_sysfs_init(void)
285/* work function to remove sysfs directory for a user and free up 286/* work function to remove sysfs directory for a user and free up
286 * corresponding structures. 287 * corresponding structures.
287 */ 288 */
288static void remove_user_sysfs_dir(struct work_struct *w) 289static void cleanup_user_struct(struct work_struct *w)
289{ 290{
290 struct user_struct *up = container_of(w, struct user_struct, work); 291 struct user_struct *up = container_of(w, struct user_struct, work);
291 unsigned long flags; 292 unsigned long flags;
292 int remove_user = 0; 293 int remove_user = 0;
293 294
294 if (up->user_ns != &init_user_ns)
295 return;
296 /* Make uid_hash_remove() + sysfs_remove_file() + kobject_del() 295 /* Make uid_hash_remove() + sysfs_remove_file() + kobject_del()
297 * atomic. 296 * atomic.
298 */ 297 */
@@ -311,9 +310,11 @@ static void remove_user_sysfs_dir(struct work_struct *w)
311 if (!remove_user) 310 if (!remove_user)
312 goto done; 311 goto done;
313 312
314 kobject_uevent(&up->kobj, KOBJ_REMOVE); 313 if (up->user_ns == &init_user_ns) {
315 kobject_del(&up->kobj); 314 kobject_uevent(&up->kobj, KOBJ_REMOVE);
316 kobject_put(&up->kobj); 315 kobject_del(&up->kobj);
316 kobject_put(&up->kobj);
317 }
317 318
318 sched_destroy_user(up); 319 sched_destroy_user(up);
319 key_put(up->uid_keyring); 320 key_put(up->uid_keyring);
@@ -334,8 +335,7 @@ static void free_user(struct user_struct *up, unsigned long flags)
334 atomic_inc(&up->__count); 335 atomic_inc(&up->__count);
335 spin_unlock_irqrestore(&uidhash_lock, flags); 336 spin_unlock_irqrestore(&uidhash_lock, flags);
336 337
337 put_user_ns(up->user_ns); 338 INIT_WORK(&up->work, cleanup_user_struct);
338 INIT_WORK(&up->work, remove_user_sysfs_dir);
339 schedule_work(&up->work); 339 schedule_work(&up->work);
340} 340}
341 341
@@ -357,12 +357,29 @@ static void free_user(struct user_struct *up, unsigned long flags)
357 sched_destroy_user(up); 357 sched_destroy_user(up);
358 key_put(up->uid_keyring); 358 key_put(up->uid_keyring);
359 key_put(up->session_keyring); 359 key_put(up->session_keyring);
360 put_user_ns(up->user_ns);
361 kmem_cache_free(uid_cachep, up); 360 kmem_cache_free(uid_cachep, up);
362} 361}
363 362
364#endif 363#endif
365 364
365#if defined(CONFIG_RT_GROUP_SCHED) && defined(CONFIG_USER_SCHED)
366/*
367 * We need to check if a setuid can take place. This function should be called
368 * before successfully completing the setuid.
369 */
370int task_can_switch_user(struct user_struct *up, struct task_struct *tsk)
371{
372
373 return sched_rt_can_attach(up->tg, tsk);
374
375}
376#else
377int task_can_switch_user(struct user_struct *up, struct task_struct *tsk)
378{
379 return 1;
380}
381#endif
382
366/* 383/*
367 * Locate the user_struct for the passed UID. If found, take a ref on it. The 384 * Locate the user_struct for the passed UID. If found, take a ref on it. The
368 * caller must undo that ref with free_uid(). 385 * caller must undo that ref with free_uid().
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 79084311ee57..076c7c8215b0 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -60,12 +60,25 @@ int create_user_ns(struct cred *new)
60 return 0; 60 return 0;
61} 61}
62 62
63void free_user_ns(struct kref *kref) 63/*
64 * Deferred destructor for a user namespace. This is required because
65 * free_user_ns() may be called with uidhash_lock held, but we need to call
66 * back to free_uid() which will want to take the lock again.
67 */
68static void free_user_ns_work(struct work_struct *work)
64{ 69{
65 struct user_namespace *ns; 70 struct user_namespace *ns =
66 71 container_of(work, struct user_namespace, destroyer);
67 ns = container_of(kref, struct user_namespace, kref);
68 free_uid(ns->creator); 72 free_uid(ns->creator);
69 kfree(ns); 73 kfree(ns);
70} 74}
75
76void free_user_ns(struct kref *kref)
77{
78 struct user_namespace *ns =
79 container_of(kref, struct user_namespace, kref);
80
81 INIT_WORK(&ns->destroyer, free_user_ns_work);
82 schedule_work(&ns->destroyer);
83}
71EXPORT_SYMBOL(free_user_ns); 84EXPORT_SYMBOL(free_user_ns);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 29044f500269..1bcf9cd4baa0 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -838,7 +838,7 @@ config FIREWIRE_OHCI_REMOTE_DMA
838 838
839 If unsure, say N. 839 If unsure, say N.
840 840
841menuconfig BUILD_DOCSRC 841config BUILD_DOCSRC
842 bool "Build targets in Documentation/ tree" 842 bool "Build targets in Documentation/ tree"
843 depends on HEADERS_CHECK 843 depends on HEADERS_CHECK
844 help 844 help
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 1338469ac849..35a1f7ff4149 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -948,15 +948,15 @@ done:
948 */ 948 */
949int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) 949int bitmap_find_free_region(unsigned long *bitmap, int bits, int order)
950{ 950{
951 int pos; /* scans bitmap by regions of size order */ 951 int pos, end; /* scans bitmap by regions of size order */
952 952
953 for (pos = 0; pos < bits; pos += (1 << order)) 953 for (pos = 0 ; (end = pos + (1 << order)) <= bits; pos = end) {
954 if (__reg_op(bitmap, pos, order, REG_OP_ISFREE)) 954 if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
955 break; 955 continue;
956 if (pos == bits) 956 __reg_op(bitmap, pos, order, REG_OP_ALLOC);
957 return -ENOMEM; 957 return pos;
958 __reg_op(bitmap, pos, order, REG_OP_ALLOC); 958 }
959 return pos; 959 return -ENOMEM;
960} 960}
961EXPORT_SYMBOL(bitmap_find_free_region); 961EXPORT_SYMBOL(bitmap_find_free_region);
962 962
diff --git a/lib/idr.c b/lib/idr.c
index c11c5765cdef..dab4bca86f5d 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -449,6 +449,7 @@ void idr_remove_all(struct idr *idp)
449 449
450 n = idp->layers * IDR_BITS; 450 n = idp->layers * IDR_BITS;
451 p = idp->top; 451 p = idp->top;
452 rcu_assign_pointer(idp->top, NULL);
452 max = 1 << n; 453 max = 1 << n;
453 454
454 id = 0; 455 id = 0;
@@ -467,7 +468,6 @@ void idr_remove_all(struct idr *idp)
467 p = *--paa; 468 p = *--paa;
468 } 469 }
469 } 470 }
470 rcu_assign_pointer(idp->top, NULL);
471 idp->layers = 0; 471 idp->layers = 0;
472} 472}
473EXPORT_SYMBOL(idr_remove_all); 473EXPORT_SYMBOL(idr_remove_all);
diff --git a/mm/mlock.c b/mm/mlock.c
index 037161d61b4e..cbe9e0581b75 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -660,7 +660,7 @@ void *alloc_locked_buffer(size_t size)
660 return buffer; 660 return buffer;
661} 661}
662 662
663void free_locked_buffer(void *buffer, size_t size) 663void release_locked_buffer(void *buffer, size_t size)
664{ 664{
665 unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; 665 unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
666 666
@@ -670,6 +670,11 @@ void free_locked_buffer(void *buffer, size_t size)
670 current->mm->locked_vm -= pgsz; 670 current->mm->locked_vm -= pgsz;
671 671
672 up_write(&current->mm->mmap_sem); 672 up_write(&current->mm->mmap_sem);
673}
674
675void free_locked_buffer(void *buffer, size_t size)
676{
677 release_locked_buffer(buffer, size);
673 678
674 kfree(buffer); 679 kfree(buffer);
675} 680}
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 3c84128596ba..74dc57c74349 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -240,7 +240,7 @@ void bdi_writeout_inc(struct backing_dev_info *bdi)
240} 240}
241EXPORT_SYMBOL_GPL(bdi_writeout_inc); 241EXPORT_SYMBOL_GPL(bdi_writeout_inc);
242 242
243static inline void task_dirty_inc(struct task_struct *tsk) 243void task_dirty_inc(struct task_struct *tsk)
244{ 244{
245 prop_inc_single(&vm_dirties, &tsk->dirties); 245 prop_inc_single(&vm_dirties, &tsk->dirties);
246} 246}
@@ -1230,6 +1230,7 @@ int __set_page_dirty_nobuffers(struct page *page)
1230 __inc_zone_page_state(page, NR_FILE_DIRTY); 1230 __inc_zone_page_state(page, NR_FILE_DIRTY);
1231 __inc_bdi_stat(mapping->backing_dev_info, 1231 __inc_bdi_stat(mapping->backing_dev_info,
1232 BDI_RECLAIMABLE); 1232 BDI_RECLAIMABLE);
1233 task_dirty_inc(current);
1233 task_io_account_write(PAGE_CACHE_SIZE); 1234 task_io_account_write(PAGE_CACHE_SIZE);
1234 } 1235 }
1235 radix_tree_tag_set(&mapping->page_tree, 1236 radix_tree_tag_set(&mapping->page_tree,
@@ -1262,7 +1263,7 @@ EXPORT_SYMBOL(redirty_page_for_writepage);
1262 * If the mapping doesn't provide a set_page_dirty a_op, then 1263 * If the mapping doesn't provide a set_page_dirty a_op, then
1263 * just fall through and assume that it wants buffer_heads. 1264 * just fall through and assume that it wants buffer_heads.
1264 */ 1265 */
1265static int __set_page_dirty(struct page *page) 1266int set_page_dirty(struct page *page)
1266{ 1267{
1267 struct address_space *mapping = page_mapping(page); 1268 struct address_space *mapping = page_mapping(page);
1268 1269
@@ -1280,14 +1281,6 @@ static int __set_page_dirty(struct page *page)
1280 } 1281 }
1281 return 0; 1282 return 0;
1282} 1283}
1283
1284int set_page_dirty(struct page *page)
1285{
1286 int ret = __set_page_dirty(page);
1287 if (ret)
1288 task_dirty_inc(current);
1289 return ret;
1290}
1291EXPORT_SYMBOL(set_page_dirty); 1284EXPORT_SYMBOL(set_page_dirty);
1292 1285
1293/* 1286/*
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5675b3073854..5c44ed49ca93 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2989,7 +2989,7 @@ static int __meminit next_active_region_index_in_nid(int index, int nid)
2989 * was used and there are no special requirements, this is a convenient 2989 * was used and there are no special requirements, this is a convenient
2990 * alternative 2990 * alternative
2991 */ 2991 */
2992int __meminit early_pfn_to_nid(unsigned long pfn) 2992int __meminit __early_pfn_to_nid(unsigned long pfn)
2993{ 2993{
2994 int i; 2994 int i;
2995 2995
@@ -3000,10 +3000,33 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
3000 if (start_pfn <= pfn && pfn < end_pfn) 3000 if (start_pfn <= pfn && pfn < end_pfn)
3001 return early_node_map[i].nid; 3001 return early_node_map[i].nid;
3002 } 3002 }
3003 /* This is a memory hole */
3004 return -1;
3005}
3006#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3007
3008int __meminit early_pfn_to_nid(unsigned long pfn)
3009{
3010 int nid;
3003 3011
3012 nid = __early_pfn_to_nid(pfn);
3013 if (nid >= 0)
3014 return nid;
3015 /* just returns 0 */
3004 return 0; 3016 return 0;
3005} 3017}
3006#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ 3018
3019#ifdef CONFIG_NODES_SPAN_OTHER_NODES
3020bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
3021{
3022 int nid;
3023
3024 nid = __early_pfn_to_nid(pfn);
3025 if (nid >= 0 && nid != node)
3026 return false;
3027 return true;
3028}
3029#endif
3007 3030
3008/* Basic iterator support to walk early_node_map[] */ 3031/* Basic iterator support to walk early_node_map[] */
3009#define for_each_active_range_index_in_nid(i, nid) \ 3032#define for_each_active_range_index_in_nid(i, nid) \
diff --git a/mm/page_io.c b/mm/page_io.c
index dc6ce0afbded..3023c475e041 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -111,7 +111,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
111 goto out; 111 goto out;
112 } 112 }
113 if (wbc->sync_mode == WB_SYNC_ALL) 113 if (wbc->sync_mode == WB_SYNC_ALL)
114 rw |= (1 << BIO_RW_SYNC); 114 rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
115 count_vm_event(PSWPOUT); 115 count_vm_event(PSWPOUT);
116 set_page_writeback(page); 116 set_page_writeback(page);
117 unlock_page(page); 117 unlock_page(page);
diff --git a/mm/shmem.c b/mm/shmem.c
index 19d566ccdeea..4103a239ce84 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -169,13 +169,13 @@ static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb)
169 */ 169 */
170static inline int shmem_acct_size(unsigned long flags, loff_t size) 170static inline int shmem_acct_size(unsigned long flags, loff_t size)
171{ 171{
172 return (flags & VM_ACCOUNT) ? 172 return (flags & VM_NORESERVE) ?
173 security_vm_enough_memory_kern(VM_ACCT(size)) : 0; 173 0 : security_vm_enough_memory_kern(VM_ACCT(size));
174} 174}
175 175
176static inline void shmem_unacct_size(unsigned long flags, loff_t size) 176static inline void shmem_unacct_size(unsigned long flags, loff_t size)
177{ 177{
178 if (flags & VM_ACCOUNT) 178 if (!(flags & VM_NORESERVE))
179 vm_unacct_memory(VM_ACCT(size)); 179 vm_unacct_memory(VM_ACCT(size));
180} 180}
181 181
@@ -187,13 +187,13 @@ static inline void shmem_unacct_size(unsigned long flags, loff_t size)
187 */ 187 */
188static inline int shmem_acct_block(unsigned long flags) 188static inline int shmem_acct_block(unsigned long flags)
189{ 189{
190 return (flags & VM_ACCOUNT) ? 190 return (flags & VM_NORESERVE) ?
191 0 : security_vm_enough_memory_kern(VM_ACCT(PAGE_CACHE_SIZE)); 191 security_vm_enough_memory_kern(VM_ACCT(PAGE_CACHE_SIZE)) : 0;
192} 192}
193 193
194static inline void shmem_unacct_blocks(unsigned long flags, long pages) 194static inline void shmem_unacct_blocks(unsigned long flags, long pages)
195{ 195{
196 if (!(flags & VM_ACCOUNT)) 196 if (flags & VM_NORESERVE)
197 vm_unacct_memory(pages * VM_ACCT(PAGE_CACHE_SIZE)); 197 vm_unacct_memory(pages * VM_ACCT(PAGE_CACHE_SIZE));
198} 198}
199 199
@@ -1515,8 +1515,8 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
1515 return 0; 1515 return 0;
1516} 1516}
1517 1517
1518static struct inode * 1518static struct inode *shmem_get_inode(struct super_block *sb, int mode,
1519shmem_get_inode(struct super_block *sb, int mode, dev_t dev) 1519 dev_t dev, unsigned long flags)
1520{ 1520{
1521 struct inode *inode; 1521 struct inode *inode;
1522 struct shmem_inode_info *info; 1522 struct shmem_inode_info *info;
@@ -1537,6 +1537,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1537 info = SHMEM_I(inode); 1537 info = SHMEM_I(inode);
1538 memset(info, 0, (char *)inode - (char *)info); 1538 memset(info, 0, (char *)inode - (char *)info);
1539 spin_lock_init(&info->lock); 1539 spin_lock_init(&info->lock);
1540 info->flags = flags & VM_NORESERVE;
1540 INIT_LIST_HEAD(&info->swaplist); 1541 INIT_LIST_HEAD(&info->swaplist);
1541 1542
1542 switch (mode & S_IFMT) { 1543 switch (mode & S_IFMT) {
@@ -1779,9 +1780,10 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
1779static int 1780static int
1780shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 1781shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1781{ 1782{
1782 struct inode *inode = shmem_get_inode(dir->i_sb, mode, dev); 1783 struct inode *inode;
1783 int error = -ENOSPC; 1784 int error = -ENOSPC;
1784 1785
1786 inode = shmem_get_inode(dir->i_sb, mode, dev, VM_NORESERVE);
1785 if (inode) { 1787 if (inode) {
1786 error = security_inode_init_security(inode, dir, NULL, NULL, 1788 error = security_inode_init_security(inode, dir, NULL, NULL,
1787 NULL); 1789 NULL);
@@ -1920,7 +1922,7 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
1920 if (len > PAGE_CACHE_SIZE) 1922 if (len > PAGE_CACHE_SIZE)
1921 return -ENAMETOOLONG; 1923 return -ENAMETOOLONG;
1922 1924
1923 inode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0); 1925 inode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0, VM_NORESERVE);
1924 if (!inode) 1926 if (!inode)
1925 return -ENOSPC; 1927 return -ENOSPC;
1926 1928
@@ -2332,7 +2334,7 @@ static int shmem_fill_super(struct super_block *sb,
2332 sb->s_flags |= MS_POSIXACL; 2334 sb->s_flags |= MS_POSIXACL;
2333#endif 2335#endif
2334 2336
2335 inode = shmem_get_inode(sb, S_IFDIR | sbinfo->mode, 0); 2337 inode = shmem_get_inode(sb, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE);
2336 if (!inode) 2338 if (!inode)
2337 goto failed; 2339 goto failed;
2338 inode->i_uid = sbinfo->uid; 2340 inode->i_uid = sbinfo->uid;
@@ -2574,12 +2576,12 @@ int shmem_unuse(swp_entry_t entry, struct page *page)
2574 return 0; 2576 return 0;
2575} 2577}
2576 2578
2577#define shmem_file_operations ramfs_file_operations 2579#define shmem_vm_ops generic_file_vm_ops
2578#define shmem_vm_ops generic_file_vm_ops 2580#define shmem_file_operations ramfs_file_operations
2579#define shmem_get_inode ramfs_get_inode 2581#define shmem_get_inode(sb, mode, dev, flags) ramfs_get_inode(sb, mode, dev)
2580#define shmem_acct_size(a, b) 0 2582#define shmem_acct_size(flags, size) 0
2581#define shmem_unacct_size(a, b) do {} while (0) 2583#define shmem_unacct_size(flags, size) do {} while (0)
2582#define SHMEM_MAX_BYTES LLONG_MAX 2584#define SHMEM_MAX_BYTES LLONG_MAX
2583 2585
2584#endif /* CONFIG_SHMEM */ 2586#endif /* CONFIG_SHMEM */
2585 2587
@@ -2589,7 +2591,7 @@ int shmem_unuse(swp_entry_t entry, struct page *page)
2589 * shmem_file_setup - get an unlinked file living in tmpfs 2591 * shmem_file_setup - get an unlinked file living in tmpfs
2590 * @name: name for dentry (to be seen in /proc/<pid>/maps 2592 * @name: name for dentry (to be seen in /proc/<pid>/maps
2591 * @size: size to be set for the file 2593 * @size: size to be set for the file
2592 * @flags: vm_flags 2594 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
2593 */ 2595 */
2594struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags) 2596struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
2595{ 2597{
@@ -2623,13 +2625,10 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
2623 goto put_dentry; 2625 goto put_dentry;
2624 2626
2625 error = -ENOSPC; 2627 error = -ENOSPC;
2626 inode = shmem_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); 2628 inode = shmem_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0, flags);
2627 if (!inode) 2629 if (!inode)
2628 goto close_file; 2630 goto close_file;
2629 2631
2630#ifdef CONFIG_SHMEM
2631 SHMEM_I(inode)->flags = (flags & VM_NORESERVE) ? 0 : VM_ACCOUNT;
2632#endif
2633 d_instantiate(dentry, inode); 2632 d_instantiate(dentry, inode);
2634 inode->i_size = size; 2633 inode->i_size = size;
2635 inode->i_nlink = 0; /* It is unlinked */ 2634 inode->i_nlink = 0; /* It is unlinked */
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 7e6304dfafab..312fafe0ab6e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -635,7 +635,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
635 635
636 if (!bdev) { 636 if (!bdev) {
637 if (bdev_p) 637 if (bdev_p)
638 *bdev_p = sis->bdev; 638 *bdev_p = bdget(sis->bdev->bd_dev);
639 639
640 spin_unlock(&swap_lock); 640 spin_unlock(&swap_lock);
641 return i; 641 return i;
@@ -647,7 +647,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
647 struct swap_extent, list); 647 struct swap_extent, list);
648 if (se->start_block == offset) { 648 if (se->start_block == offset) {
649 if (bdev_p) 649 if (bdev_p)
650 *bdev_p = sis->bdev; 650 *bdev_p = bdget(sis->bdev->bd_dev);
651 651
652 spin_unlock(&swap_lock); 652 spin_unlock(&swap_lock);
653 bdput(bdev); 653 bdput(bdev);
diff --git a/mm/util.c b/mm/util.c
index cb00b748ce47..37eaccdf3054 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -129,6 +129,26 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
129} 129}
130EXPORT_SYMBOL(krealloc); 130EXPORT_SYMBOL(krealloc);
131 131
132/**
133 * kzfree - like kfree but zero memory
134 * @p: object to free memory of
135 *
136 * The memory of the object @p points to is zeroed before freed.
137 * If @p is %NULL, kzfree() does nothing.
138 */
139void kzfree(const void *p)
140{
141 size_t ks;
142 void *mem = (void *)p;
143
144 if (unlikely(ZERO_OR_NULL_PTR(mem)))
145 return;
146 ks = ksize(mem);
147 memset(mem, 0, ks);
148 kfree(mem);
149}
150EXPORT_SYMBOL(kzfree);
151
132/* 152/*
133 * strndup_user - duplicate an existing string from user space 153 * strndup_user - duplicate an existing string from user space
134 * @s: The string to duplicate 154 * @s: The string to duplicate
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 75f49d312e8c..520a75980269 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -323,6 +323,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
323 unsigned long addr; 323 unsigned long addr;
324 int purged = 0; 324 int purged = 0;
325 325
326 BUG_ON(!size);
326 BUG_ON(size & ~PAGE_MASK); 327 BUG_ON(size & ~PAGE_MASK);
327 328
328 va = kmalloc_node(sizeof(struct vmap_area), 329 va = kmalloc_node(sizeof(struct vmap_area),
@@ -334,6 +335,9 @@ retry:
334 addr = ALIGN(vstart, align); 335 addr = ALIGN(vstart, align);
335 336
336 spin_lock(&vmap_area_lock); 337 spin_lock(&vmap_area_lock);
338 if (addr + size - 1 < addr)
339 goto overflow;
340
337 /* XXX: could have a last_hole cache */ 341 /* XXX: could have a last_hole cache */
338 n = vmap_area_root.rb_node; 342 n = vmap_area_root.rb_node;
339 if (n) { 343 if (n) {
@@ -365,6 +369,8 @@ retry:
365 369
366 while (addr + size > first->va_start && addr + size <= vend) { 370 while (addr + size > first->va_start && addr + size <= vend) {
367 addr = ALIGN(first->va_end + PAGE_SIZE, align); 371 addr = ALIGN(first->va_end + PAGE_SIZE, align);
372 if (addr + size - 1 < addr)
373 goto overflow;
368 374
369 n = rb_next(&first->rb_node); 375 n = rb_next(&first->rb_node);
370 if (n) 376 if (n)
@@ -375,6 +381,7 @@ retry:
375 } 381 }
376found: 382found:
377 if (addr + size > vend) { 383 if (addr + size > vend) {
384overflow:
378 spin_unlock(&vmap_area_lock); 385 spin_unlock(&vmap_area_lock);
379 if (!purged) { 386 if (!purged) {
380 purge_vmap_area_lazy(); 387 purge_vmap_area_lazy();
@@ -498,6 +505,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
498 static DEFINE_SPINLOCK(purge_lock); 505 static DEFINE_SPINLOCK(purge_lock);
499 LIST_HEAD(valist); 506 LIST_HEAD(valist);
500 struct vmap_area *va; 507 struct vmap_area *va;
508 struct vmap_area *n_va;
501 int nr = 0; 509 int nr = 0;
502 510
503 /* 511 /*
@@ -537,7 +545,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
537 545
538 if (nr) { 546 if (nr) {
539 spin_lock(&vmap_area_lock); 547 spin_lock(&vmap_area_lock);
540 list_for_each_entry(va, &valist, purge_list) 548 list_for_each_entry_safe(va, n_va, &valist, purge_list)
541 __free_vmap_area(va); 549 __free_vmap_area(va);
542 spin_unlock(&vmap_area_lock); 550 spin_unlock(&vmap_area_lock);
543 } 551 }
@@ -1012,6 +1020,8 @@ void __init vmalloc_init(void)
1012void unmap_kernel_range(unsigned long addr, unsigned long size) 1020void unmap_kernel_range(unsigned long addr, unsigned long size)
1013{ 1021{
1014 unsigned long end = addr + size; 1022 unsigned long end = addr + size;
1023
1024 flush_cache_vunmap(addr, end);
1015 vunmap_page_range(addr, end); 1025 vunmap_page_range(addr, end);
1016 flush_tlb_kernel_range(addr, end); 1026 flush_tlb_kernel_range(addr, end);
1017} 1027}
@@ -1106,6 +1116,14 @@ struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
1106} 1116}
1107EXPORT_SYMBOL_GPL(__get_vm_area); 1117EXPORT_SYMBOL_GPL(__get_vm_area);
1108 1118
1119struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags,
1120 unsigned long start, unsigned long end,
1121 void *caller)
1122{
1123 return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL,
1124 caller);
1125}
1126
1109/** 1127/**
1110 * get_vm_area - reserve a contiguous kernel virtual area 1128 * get_vm_area - reserve a contiguous kernel virtual area
1111 * @size: size of the area 1129 * @size: size of the area
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9a27c44aa327..56ddf41149eb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1262,7 +1262,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
1262 * Move the pages to the [file or anon] inactive list. 1262 * Move the pages to the [file or anon] inactive list.
1263 */ 1263 */
1264 pagevec_init(&pvec, 1); 1264 pagevec_init(&pvec, 1);
1265 pgmoved = 0;
1266 lru = LRU_BASE + file * LRU_FILE; 1265 lru = LRU_BASE + file * LRU_FILE;
1267 1266
1268 spin_lock_irq(&zone->lru_lock); 1267 spin_lock_irq(&zone->lru_lock);
@@ -1274,6 +1273,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
1274 */ 1273 */
1275 reclaim_stat->recent_rotated[!!file] += pgmoved; 1274 reclaim_stat->recent_rotated[!!file] += pgmoved;
1276 1275
1276 pgmoved = 0;
1277 while (!list_empty(&l_inactive)) { 1277 while (!list_empty(&l_inactive)) {
1278 page = lru_to_page(&l_inactive); 1278 page = lru_to_page(&l_inactive);
1279 prefetchw_prev_lru_page(page, &l_inactive, flags); 1279 prefetchw_prev_lru_page(page, &l_inactive, flags);
@@ -1469,7 +1469,7 @@ static void shrink_zone(int priority, struct zone *zone,
1469 int file = is_file_lru(l); 1469 int file = is_file_lru(l);
1470 int scan; 1470 int scan;
1471 1471
1472 scan = zone_page_state(zone, NR_LRU_BASE + l); 1472 scan = zone_nr_pages(zone, sc, l);
1473 if (priority) { 1473 if (priority) {
1474 scan >>= priority; 1474 scan >>= priority;
1475 scan = (scan * percent[file]) / 100; 1475 scan = (scan * percent[file]) / 100;
@@ -2057,31 +2057,31 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio,
2057 int pass, struct scan_control *sc) 2057 int pass, struct scan_control *sc)
2058{ 2058{
2059 struct zone *zone; 2059 struct zone *zone;
2060 unsigned long nr_to_scan, ret = 0; 2060 unsigned long ret = 0;
2061 enum lru_list l;
2062 2061
2063 for_each_zone(zone) { 2062 for_each_zone(zone) {
2063 enum lru_list l;
2064 2064
2065 if (!populated_zone(zone)) 2065 if (!populated_zone(zone))
2066 continue; 2066 continue;
2067
2068 if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY) 2067 if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY)
2069 continue; 2068 continue;
2070 2069
2071 for_each_evictable_lru(l) { 2070 for_each_evictable_lru(l) {
2071 enum zone_stat_item ls = NR_LRU_BASE + l;
2072 unsigned long lru_pages = zone_page_state(zone, ls);
2073
2072 /* For pass = 0, we don't shrink the active list */ 2074 /* For pass = 0, we don't shrink the active list */
2073 if (pass == 0 && 2075 if (pass == 0 && (l == LRU_ACTIVE_ANON ||
2074 (l == LRU_ACTIVE || l == LRU_ACTIVE_FILE)) 2076 l == LRU_ACTIVE_FILE))
2075 continue; 2077 continue;
2076 2078
2077 zone->lru[l].nr_scan += 2079 zone->lru[l].nr_scan += (lru_pages >> prio) + 1;
2078 (zone_page_state(zone, NR_LRU_BASE + l)
2079 >> prio) + 1;
2080 if (zone->lru[l].nr_scan >= nr_pages || pass > 3) { 2080 if (zone->lru[l].nr_scan >= nr_pages || pass > 3) {
2081 unsigned long nr_to_scan;
2082
2081 zone->lru[l].nr_scan = 0; 2083 zone->lru[l].nr_scan = 0;
2082 nr_to_scan = min(nr_pages, 2084 nr_to_scan = min(nr_pages, lru_pages);
2083 zone_page_state(zone,
2084 NR_LRU_BASE + l));
2085 ret += shrink_list(l, nr_to_scan, zone, 2085 ret += shrink_list(l, nr_to_scan, zone,
2086 sc, prio); 2086 sc, prio);
2087 if (ret >= nr_pages) 2087 if (ret >= nr_pages)
@@ -2089,7 +2089,6 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio,
2089 } 2089 }
2090 } 2090 }
2091 } 2091 }
2092
2093 return ret; 2092 return ret;
2094} 2093}
2095 2094
@@ -2112,7 +2111,6 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
2112 .may_swap = 0, 2111 .may_swap = 0,
2113 .swap_cluster_max = nr_pages, 2112 .swap_cluster_max = nr_pages,
2114 .may_writepage = 1, 2113 .may_writepage = 1,
2115 .swappiness = vm_swappiness,
2116 .isolate_pages = isolate_pages_global, 2114 .isolate_pages = isolate_pages_global,
2117 }; 2115 };
2118 2116
@@ -2146,10 +2144,8 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
2146 int prio; 2144 int prio;
2147 2145
2148 /* Force reclaiming mapped pages in the passes #3 and #4 */ 2146 /* Force reclaiming mapped pages in the passes #3 and #4 */
2149 if (pass > 2) { 2147 if (pass > 2)
2150 sc.may_swap = 1; 2148 sc.may_swap = 1;
2151 sc.swappiness = 100;
2152 }
2153 2149
2154 for (prio = DEF_PRIORITY; prio >= 0; prio--) { 2150 for (prio = DEF_PRIORITY; prio >= 0; prio--) {
2155 unsigned long nr_to_scan = nr_pages - ret; 2151 unsigned long nr_to_scan = nr_pages - ret;
diff --git a/net/802/tr.c b/net/802/tr.c
index 158150fee462..f47ae289d83b 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -668,3 +668,5 @@ module_init(rif_init);
668 668
669EXPORT_SYMBOL(tr_type_trans); 669EXPORT_SYMBOL(tr_type_trans);
670EXPORT_SYMBOL(alloc_trdev); 670EXPORT_SYMBOL(alloc_trdev);
671
672MODULE_LICENSE("GPL");
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index e9db889d6222..2886d2fb9ab5 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -1,12 +1,16 @@
1#include <linux/skbuff.h> 1#include <linux/skbuff.h>
2#include <linux/netdevice.h> 2#include <linux/netdevice.h>
3#include <linux/if_vlan.h> 3#include <linux/if_vlan.h>
4#include <linux/netpoll.h>
4#include "vlan.h" 5#include "vlan.h"
5 6
6/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ 7/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */
7int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, 8int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
8 u16 vlan_tci, int polling) 9 u16 vlan_tci, int polling)
9{ 10{
11 if (netpoll_rx(skb))
12 return NET_RX_DROP;
13
10 if (skb_bond_should_drop(skb)) 14 if (skb_bond_should_drop(skb))
11 goto drop; 15 goto drop;
12 16
@@ -100,6 +104,9 @@ int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
100{ 104{
101 int err = NET_RX_SUCCESS; 105 int err = NET_RX_SUCCESS;
102 106
107 if (netpoll_receive_skb(skb))
108 return NET_RX_DROP;
109
103 switch (vlan_gro_common(napi, grp, vlan_tci, skb)) { 110 switch (vlan_gro_common(napi, grp, vlan_tci, skb)) {
104 case -1: 111 case -1:
105 return netif_receive_skb(skb); 112 return netif_receive_skb(skb);
@@ -126,6 +133,9 @@ int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
126 if (!skb) 133 if (!skb)
127 goto out; 134 goto out;
128 135
136 if (netpoll_receive_skb(skb))
137 goto out;
138
129 err = NET_RX_SUCCESS; 139 err = NET_RX_SUCCESS;
130 140
131 switch (vlan_gro_common(napi, grp, vlan_tci, skb)) { 141 switch (vlan_gro_common(napi, grp, vlan_tci, skb)) {
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4a19acd3a32b..1b34135cf990 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -553,7 +553,7 @@ static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa)
553 int err = 0; 553 int err = 0;
554 554
555 if (netif_device_present(real_dev) && ops->ndo_neigh_setup) 555 if (netif_device_present(real_dev) && ops->ndo_neigh_setup)
556 err = ops->ndo_neigh_setup(dev, pa); 556 err = ops->ndo_neigh_setup(real_dev, pa);
557 557
558 return err; 558 return err;
559} 559}
@@ -639,6 +639,7 @@ static int vlan_dev_init(struct net_device *dev)
639 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; 639 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
640 dev->netdev_ops = &vlan_netdev_ops; 640 dev->netdev_ops = &vlan_netdev_ops;
641 } 641 }
642 netdev_resync_ops(dev);
642 643
643 if (is_vlan_dev(real_dev)) 644 if (is_vlan_dev(real_dev))
644 subclass = 1; 645 subclass = 1;
diff --git a/net/core/dev.c b/net/core/dev.c
index a17e00662363..f1129706ce7b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2267,12 +2267,6 @@ int netif_receive_skb(struct sk_buff *skb)
2267 2267
2268 rcu_read_lock(); 2268 rcu_read_lock();
2269 2269
2270 /* Don't receive packets in an exiting network namespace */
2271 if (!net_alive(dev_net(skb->dev))) {
2272 kfree_skb(skb);
2273 goto out;
2274 }
2275
2276#ifdef CONFIG_NET_CLS_ACT 2270#ifdef CONFIG_NET_CLS_ACT
2277 if (skb->tc_verd & TC_NCLS) { 2271 if (skb->tc_verd & TC_NCLS) {
2278 skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); 2272 skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
@@ -2488,6 +2482,9 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2488 2482
2489int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) 2483int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2490{ 2484{
2485 if (netpoll_receive_skb(skb))
2486 return NET_RX_DROP;
2487
2491 switch (__napi_gro_receive(napi, skb)) { 2488 switch (__napi_gro_receive(napi, skb)) {
2492 case -1: 2489 case -1:
2493 return netif_receive_skb(skb); 2490 return netif_receive_skb(skb);
@@ -2558,6 +2555,9 @@ int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
2558 if (!skb) 2555 if (!skb)
2559 goto out; 2556 goto out;
2560 2557
2558 if (netpoll_receive_skb(skb))
2559 goto out;
2560
2561 err = NET_RX_SUCCESS; 2561 err = NET_RX_SUCCESS;
2562 2562
2563 switch (__napi_gro_receive(napi, skb)) { 2563 switch (__napi_gro_receive(napi, skb)) {
@@ -4282,6 +4282,39 @@ unsigned long netdev_fix_features(unsigned long features, const char *name)
4282} 4282}
4283EXPORT_SYMBOL(netdev_fix_features); 4283EXPORT_SYMBOL(netdev_fix_features);
4284 4284
4285/* Some devices need to (re-)set their netdev_ops inside
4286 * ->init() or similar. If that happens, we have to setup
4287 * the compat pointers again.
4288 */
4289void netdev_resync_ops(struct net_device *dev)
4290{
4291#ifdef CONFIG_COMPAT_NET_DEV_OPS
4292 const struct net_device_ops *ops = dev->netdev_ops;
4293
4294 dev->init = ops->ndo_init;
4295 dev->uninit = ops->ndo_uninit;
4296 dev->open = ops->ndo_open;
4297 dev->change_rx_flags = ops->ndo_change_rx_flags;
4298 dev->set_rx_mode = ops->ndo_set_rx_mode;
4299 dev->set_multicast_list = ops->ndo_set_multicast_list;
4300 dev->set_mac_address = ops->ndo_set_mac_address;
4301 dev->validate_addr = ops->ndo_validate_addr;
4302 dev->do_ioctl = ops->ndo_do_ioctl;
4303 dev->set_config = ops->ndo_set_config;
4304 dev->change_mtu = ops->ndo_change_mtu;
4305 dev->neigh_setup = ops->ndo_neigh_setup;
4306 dev->tx_timeout = ops->ndo_tx_timeout;
4307 dev->get_stats = ops->ndo_get_stats;
4308 dev->vlan_rx_register = ops->ndo_vlan_rx_register;
4309 dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid;
4310 dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid;
4311#ifdef CONFIG_NET_POLL_CONTROLLER
4312 dev->poll_controller = ops->ndo_poll_controller;
4313#endif
4314#endif
4315}
4316EXPORT_SYMBOL(netdev_resync_ops);
4317
4285/** 4318/**
4286 * register_netdevice - register a network device 4319 * register_netdevice - register a network device
4287 * @dev: device to register 4320 * @dev: device to register
@@ -4326,27 +4359,7 @@ int register_netdevice(struct net_device *dev)
4326 * This is temporary until all network devices are converted. 4359 * This is temporary until all network devices are converted.
4327 */ 4360 */
4328 if (dev->netdev_ops) { 4361 if (dev->netdev_ops) {
4329 const struct net_device_ops *ops = dev->netdev_ops; 4362 netdev_resync_ops(dev);
4330
4331 dev->init = ops->ndo_init;
4332 dev->uninit = ops->ndo_uninit;
4333 dev->open = ops->ndo_open;
4334 dev->change_rx_flags = ops->ndo_change_rx_flags;
4335 dev->set_rx_mode = ops->ndo_set_rx_mode;
4336 dev->set_multicast_list = ops->ndo_set_multicast_list;
4337 dev->set_mac_address = ops->ndo_set_mac_address;
4338 dev->validate_addr = ops->ndo_validate_addr;
4339 dev->do_ioctl = ops->ndo_do_ioctl;
4340 dev->set_config = ops->ndo_set_config;
4341 dev->change_mtu = ops->ndo_change_mtu;
4342 dev->tx_timeout = ops->ndo_tx_timeout;
4343 dev->get_stats = ops->ndo_get_stats;
4344 dev->vlan_rx_register = ops->ndo_vlan_rx_register;
4345 dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid;
4346 dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid;
4347#ifdef CONFIG_NET_POLL_CONTROLLER
4348 dev->poll_controller = ops->ndo_poll_controller;
4349#endif
4350 } else { 4363 } else {
4351 char drivername[64]; 4364 char drivername[64];
4352 pr_info("%s (%s): not using net_device_ops yet\n", 4365 pr_info("%s (%s): not using net_device_ops yet\n",
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 6ac29a46e23e..484f58750eba 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -77,7 +77,9 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
77 if (endp == buf) 77 if (endp == buf)
78 goto err; 78 goto err;
79 79
80 rtnl_lock(); 80 if (!rtnl_trylock())
81 return -ERESTARTSYS;
82
81 if (dev_isalive(net)) { 83 if (dev_isalive(net)) {
82 if ((ret = (*set)(net, new)) == 0) 84 if ((ret = (*set)(net, new)) == 0)
83 ret = len; 85 ret = len;
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 55151faaf90c..e3bebd36f053 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -32,24 +32,14 @@ static __net_init int setup_net(struct net *net)
32{ 32{
33 /* Must be called with net_mutex held */ 33 /* Must be called with net_mutex held */
34 struct pernet_operations *ops; 34 struct pernet_operations *ops;
35 int error; 35 int error = 0;
36 struct net_generic *ng;
37 36
38 atomic_set(&net->count, 1); 37 atomic_set(&net->count, 1);
38
39#ifdef NETNS_REFCNT_DEBUG 39#ifdef NETNS_REFCNT_DEBUG
40 atomic_set(&net->use_count, 0); 40 atomic_set(&net->use_count, 0);
41#endif 41#endif
42 42
43 error = -ENOMEM;
44 ng = kzalloc(sizeof(struct net_generic) +
45 INITIAL_NET_GEN_PTRS * sizeof(void *), GFP_KERNEL);
46 if (ng == NULL)
47 goto out;
48
49 ng->len = INITIAL_NET_GEN_PTRS;
50 rcu_assign_pointer(net->gen, ng);
51
52 error = 0;
53 list_for_each_entry(ops, &pernet_list, list) { 43 list_for_each_entry(ops, &pernet_list, list) {
54 if (ops->init) { 44 if (ops->init) {
55 error = ops->init(net); 45 error = ops->init(net);
@@ -70,24 +60,50 @@ out_undo:
70 } 60 }
71 61
72 rcu_barrier(); 62 rcu_barrier();
73 kfree(ng);
74 goto out; 63 goto out;
75} 64}
76 65
66static struct net_generic *net_alloc_generic(void)
67{
68 struct net_generic *ng;
69 size_t generic_size = sizeof(struct net_generic) +
70 INITIAL_NET_GEN_PTRS * sizeof(void *);
71
72 ng = kzalloc(generic_size, GFP_KERNEL);
73 if (ng)
74 ng->len = INITIAL_NET_GEN_PTRS;
75
76 return ng;
77}
78
77#ifdef CONFIG_NET_NS 79#ifdef CONFIG_NET_NS
78static struct kmem_cache *net_cachep; 80static struct kmem_cache *net_cachep;
79static struct workqueue_struct *netns_wq; 81static struct workqueue_struct *netns_wq;
80 82
81static struct net *net_alloc(void) 83static struct net *net_alloc(void)
82{ 84{
83 return kmem_cache_zalloc(net_cachep, GFP_KERNEL); 85 struct net *net = NULL;
86 struct net_generic *ng;
87
88 ng = net_alloc_generic();
89 if (!ng)
90 goto out;
91
92 net = kmem_cache_zalloc(net_cachep, GFP_KERNEL);
93 if (!net)
94 goto out_free;
95
96 rcu_assign_pointer(net->gen, ng);
97out:
98 return net;
99
100out_free:
101 kfree(ng);
102 goto out;
84} 103}
85 104
86static void net_free(struct net *net) 105static void net_free(struct net *net)
87{ 106{
88 if (!net)
89 return;
90
91#ifdef NETNS_REFCNT_DEBUG 107#ifdef NETNS_REFCNT_DEBUG
92 if (unlikely(atomic_read(&net->use_count) != 0)) { 108 if (unlikely(atomic_read(&net->use_count) != 0)) {
93 printk(KERN_EMERG "network namespace not free! Usage: %d\n", 109 printk(KERN_EMERG "network namespace not free! Usage: %d\n",
@@ -112,27 +128,28 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
112 err = -ENOMEM; 128 err = -ENOMEM;
113 new_net = net_alloc(); 129 new_net = net_alloc();
114 if (!new_net) 130 if (!new_net)
115 goto out; 131 goto out_err;
116 132
117 mutex_lock(&net_mutex); 133 mutex_lock(&net_mutex);
118 err = setup_net(new_net); 134 err = setup_net(new_net);
119 if (err) 135 if (!err) {
120 goto out_unlock; 136 rtnl_lock();
121 137 list_add_tail(&new_net->list, &net_namespace_list);
122 rtnl_lock(); 138 rtnl_unlock();
123 list_add_tail(&new_net->list, &net_namespace_list); 139 }
124 rtnl_unlock();
125
126
127out_unlock:
128 mutex_unlock(&net_mutex); 140 mutex_unlock(&net_mutex);
141
142 if (err)
143 goto out_free;
129out: 144out:
130 put_net(old_net); 145 put_net(old_net);
131 if (err) {
132 net_free(new_net);
133 new_net = ERR_PTR(err);
134 }
135 return new_net; 146 return new_net;
147
148out_free:
149 net_free(new_net);
150out_err:
151 new_net = ERR_PTR(err);
152 goto out;
136} 153}
137 154
138static void cleanup_net(struct work_struct *work) 155static void cleanup_net(struct work_struct *work)
@@ -140,9 +157,6 @@ static void cleanup_net(struct work_struct *work)
140 struct pernet_operations *ops; 157 struct pernet_operations *ops;
141 struct net *net; 158 struct net *net;
142 159
143 /* Be very certain incoming network packets will not find us */
144 rcu_barrier();
145
146 net = container_of(work, struct net, work); 160 net = container_of(work, struct net, work);
147 161
148 mutex_lock(&net_mutex); 162 mutex_lock(&net_mutex);
@@ -188,6 +202,7 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
188 202
189static int __init net_ns_init(void) 203static int __init net_ns_init(void)
190{ 204{
205 struct net_generic *ng;
191 int err; 206 int err;
192 207
193 printk(KERN_INFO "net_namespace: %zd bytes\n", sizeof(struct net)); 208 printk(KERN_INFO "net_namespace: %zd bytes\n", sizeof(struct net));
@@ -202,6 +217,12 @@ static int __init net_ns_init(void)
202 panic("Could not create netns workq"); 217 panic("Could not create netns workq");
203#endif 218#endif
204 219
220 ng = net_alloc_generic();
221 if (!ng)
222 panic("Could not allocate generic netns");
223
224 rcu_assign_pointer(init_net.gen, ng);
225
205 mutex_lock(&net_mutex); 226 mutex_lock(&net_mutex);
206 err = setup_net(&init_net); 227 err = setup_net(&init_net);
207 228
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index da74b844f4ea..c6a6b166f8d6 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -143,14 +143,6 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
143 BUG(); 143 BUG();
144} 144}
145 145
146void skb_truesize_bug(struct sk_buff *skb)
147{
148 WARN(net_ratelimit(), KERN_ERR "SKB BUG: Invalid truesize (%u) "
149 "len=%u, sizeof(sk_buff)=%Zd\n",
150 skb->truesize, skb->len, sizeof(struct sk_buff));
151}
152EXPORT_SYMBOL(skb_truesize_bug);
153
154/* Allocate a new skbuff. We do this ourselves so we can fill in a few 146/* Allocate a new skbuff. We do this ourselves so we can fill in a few
155 * 'private' fields and also do memory statistics to find all the 147 * 'private' fields and also do memory statistics to find all the
156 * [BEEP] leaks. 148 * [BEEP] leaks.
diff --git a/net/core/sock.c b/net/core/sock.c
index 6f2e1337975d..5f97caa158e8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -696,7 +696,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
696 if (len < 0) 696 if (len < 0)
697 return -EINVAL; 697 return -EINVAL;
698 698
699 v.val = 0; 699 memset(&v, 0, sizeof(v));
700 700
701 switch(optname) { 701 switch(optname) {
702 case SO_DEBUG: 702 case SO_DEBUG:
@@ -1137,7 +1137,6 @@ void sock_rfree(struct sk_buff *skb)
1137{ 1137{
1138 struct sock *sk = skb->sk; 1138 struct sock *sk = skb->sk;
1139 1139
1140 skb_truesize_check(skb);
1141 atomic_sub(skb->truesize, &sk->sk_rmem_alloc); 1140 atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
1142 sk_mem_uncharge(skb->sk, skb->truesize); 1141 sk_mem_uncharge(skb->sk, skb->truesize);
1143} 1142}
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 6bb2635b5ded..7bc992976d29 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -3,11 +3,16 @@
3 * 3 *
4 * This is an implementation of the CIPSO 2.2 protocol as specified in 4 * This is an implementation of the CIPSO 2.2 protocol as specified in
5 * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in 5 * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in
6 * FIPS-188, copies of both documents can be found in the Documentation 6 * FIPS-188. While CIPSO never became a full IETF RFC standard many vendors
7 * directory. While CIPSO never became a full IETF RFC standard many vendors
8 * have chosen to adopt the protocol and over the years it has become a 7 * have chosen to adopt the protocol and over the years it has become a
9 * de-facto standard for labeled networking. 8 * de-facto standard for labeled networking.
10 * 9 *
10 * The CIPSO draft specification can be found in the kernel's Documentation
11 * directory as well as the following URL:
12 * http://netlabel.sourceforge.net/files/draft-ietf-cipso-ipsecurity-01.txt
13 * The FIPS-188 specification can be found at the following URL:
14 * http://www.itl.nist.gov/fipspubs/fip188.htm
15 *
11 * Author: Paul Moore <paul.moore@hp.com> 16 * Author: Paul Moore <paul.moore@hp.com>
12 * 17 *
13 */ 18 */
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 705b33b184a3..fc562d29cc46 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1205,7 +1205,7 @@ static struct pernet_operations __net_initdata icmp_sk_ops = {
1205 1205
1206int __init icmp_init(void) 1206int __init icmp_init(void)
1207{ 1207{
1208 return register_pernet_device(&icmp_sk_ops); 1208 return register_pernet_subsys(&icmp_sk_ops);
1209} 1209}
1210 1210
1211EXPORT_SYMBOL(icmp_err_convert); 1211EXPORT_SYMBOL(icmp_err_convert);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a6961d75c7ea..c28976a7e596 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1374,7 +1374,8 @@ static u8 tcp_sacktag_one(struct sk_buff *skb, struct sock *sk,
1374 1374
1375static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb, 1375static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
1376 struct tcp_sacktag_state *state, 1376 struct tcp_sacktag_state *state,
1377 unsigned int pcount, int shifted, int mss) 1377 unsigned int pcount, int shifted, int mss,
1378 int dup_sack)
1378{ 1379{
1379 struct tcp_sock *tp = tcp_sk(sk); 1380 struct tcp_sock *tp = tcp_sk(sk);
1380 struct sk_buff *prev = tcp_write_queue_prev(sk, skb); 1381 struct sk_buff *prev = tcp_write_queue_prev(sk, skb);
@@ -1410,7 +1411,7 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
1410 } 1411 }
1411 1412
1412 /* We discard results */ 1413 /* We discard results */
1413 tcp_sacktag_one(skb, sk, state, 0, pcount); 1414 tcp_sacktag_one(skb, sk, state, dup_sack, pcount);
1414 1415
1415 /* Difference in this won't matter, both ACKed by the same cumul. ACK */ 1416 /* Difference in this won't matter, both ACKed by the same cumul. ACK */
1416 TCP_SKB_CB(prev)->sacked |= (TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS); 1417 TCP_SKB_CB(prev)->sacked |= (TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS);
@@ -1561,7 +1562,7 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
1561 1562
1562 if (!skb_shift(prev, skb, len)) 1563 if (!skb_shift(prev, skb, len))
1563 goto fallback; 1564 goto fallback;
1564 if (!tcp_shifted_skb(sk, skb, state, pcount, len, mss)) 1565 if (!tcp_shifted_skb(sk, skb, state, pcount, len, mss, dup_sack))
1565 goto out; 1566 goto out;
1566 1567
1567 /* Hole filled allows collapsing with the next as well, this is very 1568 /* Hole filled allows collapsing with the next as well, this is very
@@ -1580,7 +1581,7 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
1580 len = skb->len; 1581 len = skb->len;
1581 if (skb_shift(prev, skb, len)) { 1582 if (skb_shift(prev, skb, len)) {
1582 pcount += tcp_skb_pcount(skb); 1583 pcount += tcp_skb_pcount(skb);
1583 tcp_shifted_skb(sk, skb, state, tcp_skb_pcount(skb), len, mss); 1584 tcp_shifted_skb(sk, skb, state, tcp_skb_pcount(skb), len, mss, 0);
1584 } 1585 }
1585 1586
1586out: 1587out:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 19d7b429a262..cf74c416831a 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2443,7 +2443,7 @@ static struct pernet_operations __net_initdata tcp_sk_ops = {
2443void __init tcp_v4_init(void) 2443void __init tcp_v4_init(void)
2444{ 2444{
2445 inet_hashinfo_init(&tcp_hashinfo); 2445 inet_hashinfo_init(&tcp_hashinfo);
2446 if (register_pernet_device(&tcp_sk_ops)) 2446 if (register_pernet_subsys(&tcp_sk_ops))
2447 panic("Failed to create the TCP control socket.\n"); 2447 panic("Failed to create the TCP control socket.\n");
2448} 2448}
2449 2449
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index dda42f0bd7a3..da2c3b8794f2 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2023,7 +2023,6 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
2023 last_lost = tp->snd_una; 2023 last_lost = tp->snd_una;
2024 } 2024 }
2025 2025
2026 /* First pass: retransmit lost packets. */
2027 tcp_for_write_queue_from(skb, sk) { 2026 tcp_for_write_queue_from(skb, sk) {
2028 __u8 sacked = TCP_SKB_CB(skb)->sacked; 2027 __u8 sacked = TCP_SKB_CB(skb)->sacked;
2029 2028
diff --git a/net/ipv4/tcp_scalable.c b/net/ipv4/tcp_scalable.c
index 2747ec7bfb63..4660b088a8ce 100644
--- a/net/ipv4/tcp_scalable.c
+++ b/net/ipv4/tcp_scalable.c
@@ -1,6 +1,6 @@
1/* Tom Kelly's Scalable TCP 1/* Tom Kelly's Scalable TCP
2 * 2 *
3 * See htt://www-lce.eng.cam.ac.uk/~ctk21/scalable/ 3 * See http://www.deneholme.net/tom/scalable/
4 * 4 *
5 * John Heffner <jheffner@sc.edu> 5 * John Heffner <jheffner@sc.edu>
6 */ 6 */
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f9afb452249c..1220e2c7831e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -493,15 +493,17 @@ static void addrconf_forward_change(struct net *net, __s32 newf)
493 read_unlock(&dev_base_lock); 493 read_unlock(&dev_base_lock);
494} 494}
495 495
496static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old) 496static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old)
497{ 497{
498 struct net *net; 498 struct net *net;
499 499
500 net = (struct net *)table->extra2; 500 net = (struct net *)table->extra2;
501 if (p == &net->ipv6.devconf_dflt->forwarding) 501 if (p == &net->ipv6.devconf_dflt->forwarding)
502 return; 502 return 0;
503
504 if (!rtnl_trylock())
505 return -ERESTARTSYS;
503 506
504 rtnl_lock();
505 if (p == &net->ipv6.devconf_all->forwarding) { 507 if (p == &net->ipv6.devconf_all->forwarding) {
506 __s32 newf = net->ipv6.devconf_all->forwarding; 508 __s32 newf = net->ipv6.devconf_all->forwarding;
507 net->ipv6.devconf_dflt->forwarding = newf; 509 net->ipv6.devconf_dflt->forwarding = newf;
@@ -512,6 +514,7 @@ static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old)
512 514
513 if (*p) 515 if (*p)
514 rt6_purge_dflt_routers(net); 516 rt6_purge_dflt_routers(net);
517 return 1;
515} 518}
516#endif 519#endif
517 520
@@ -2608,9 +2611,6 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2608 2611
2609 ASSERT_RTNL(); 2612 ASSERT_RTNL();
2610 2613
2611 if ((dev->flags & IFF_LOOPBACK) && how == 1)
2612 how = 0;
2613
2614 rt6_ifdown(net, dev); 2614 rt6_ifdown(net, dev);
2615 neigh_ifdown(&nd_tbl, dev); 2615 neigh_ifdown(&nd_tbl, dev);
2616 2616
@@ -3983,7 +3983,7 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
3983 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 3983 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
3984 3984
3985 if (write) 3985 if (write)
3986 addrconf_fixup_forwarding(ctl, valp, val); 3986 ret = addrconf_fixup_forwarding(ctl, valp, val);
3987 return ret; 3987 return ret;
3988} 3988}
3989 3989
@@ -4019,8 +4019,7 @@ static int addrconf_sysctl_forward_strategy(ctl_table *table,
4019 } 4019 }
4020 4020
4021 *valp = new; 4021 *valp = new;
4022 addrconf_fixup_forwarding(table, valp, val); 4022 return addrconf_fixup_forwarding(table, valp, val);
4023 return 1;
4024} 4023}
4025 4024
4026static struct addrconf_sysctl_table 4025static struct addrconf_sysctl_table
@@ -4446,25 +4445,6 @@ int unregister_inet6addr_notifier(struct notifier_block *nb)
4446 4445
4447EXPORT_SYMBOL(unregister_inet6addr_notifier); 4446EXPORT_SYMBOL(unregister_inet6addr_notifier);
4448 4447
4449static void addrconf_net_exit(struct net *net)
4450{
4451 struct net_device *dev;
4452
4453 rtnl_lock();
4454 /* clean dev list */
4455 for_each_netdev(net, dev) {
4456 if (__in6_dev_get(dev) == NULL)
4457 continue;
4458 addrconf_ifdown(dev, 1);
4459 }
4460 addrconf_ifdown(net->loopback_dev, 2);
4461 rtnl_unlock();
4462}
4463
4464static struct pernet_operations addrconf_net_ops = {
4465 .exit = addrconf_net_exit,
4466};
4467
4468/* 4448/*
4469 * Init / cleanup code 4449 * Init / cleanup code
4470 */ 4450 */
@@ -4506,10 +4486,6 @@ int __init addrconf_init(void)
4506 if (err) 4486 if (err)
4507 goto errlo; 4487 goto errlo;
4508 4488
4509 err = register_pernet_device(&addrconf_net_ops);
4510 if (err)
4511 return err;
4512
4513 register_netdevice_notifier(&ipv6_dev_notf); 4489 register_netdevice_notifier(&ipv6_dev_notf);
4514 4490
4515 addrconf_verify(0); 4491 addrconf_verify(0);
@@ -4539,15 +4515,22 @@ errlo:
4539void addrconf_cleanup(void) 4515void addrconf_cleanup(void)
4540{ 4516{
4541 struct inet6_ifaddr *ifa; 4517 struct inet6_ifaddr *ifa;
4518 struct net_device *dev;
4542 int i; 4519 int i;
4543 4520
4544 unregister_netdevice_notifier(&ipv6_dev_notf); 4521 unregister_netdevice_notifier(&ipv6_dev_notf);
4545 unregister_pernet_device(&addrconf_net_ops);
4546
4547 unregister_pernet_subsys(&addrconf_ops); 4522 unregister_pernet_subsys(&addrconf_ops);
4548 4523
4549 rtnl_lock(); 4524 rtnl_lock();
4550 4525
4526 /* clean dev list */
4527 for_each_netdev(&init_net, dev) {
4528 if (__in6_dev_get(dev) == NULL)
4529 continue;
4530 addrconf_ifdown(dev, 1);
4531 }
4532 addrconf_ifdown(init_net.loopback_dev, 2);
4533
4551 /* 4534 /*
4552 * Check hash table. 4535 * Check hash table.
4553 */ 4536 */
@@ -4568,6 +4551,4 @@ void addrconf_cleanup(void)
4568 4551
4569 del_timer(&addr_chk_timer); 4552 del_timer(&addr_chk_timer);
4570 rtnl_unlock(); 4553 rtnl_unlock();
4571
4572 unregister_pernet_subsys(&addrconf_net_ops);
4573} 4554}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index c802bc1658a8..da944eca2ca6 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -72,6 +72,10 @@ MODULE_LICENSE("GPL");
72static struct list_head inetsw6[SOCK_MAX]; 72static struct list_head inetsw6[SOCK_MAX];
73static DEFINE_SPINLOCK(inetsw6_lock); 73static DEFINE_SPINLOCK(inetsw6_lock);
74 74
75static int disable_ipv6 = 0;
76module_param_named(disable, disable_ipv6, int, 0);
77MODULE_PARM_DESC(disable, "Disable IPv6 such that it is non-functional");
78
75static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk) 79static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk)
76{ 80{
77 const int offset = sk->sk_prot->obj_size - sizeof(struct ipv6_pinfo); 81 const int offset = sk->sk_prot->obj_size - sizeof(struct ipv6_pinfo);
@@ -991,10 +995,21 @@ static int __init inet6_init(void)
991{ 995{
992 struct sk_buff *dummy_skb; 996 struct sk_buff *dummy_skb;
993 struct list_head *r; 997 struct list_head *r;
994 int err; 998 int err = 0;
995 999
996 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); 1000 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb));
997 1001
1002 /* Register the socket-side information for inet6_create. */
1003 for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
1004 INIT_LIST_HEAD(r);
1005
1006 if (disable_ipv6) {
1007 printk(KERN_INFO
1008 "IPv6: Loaded, but administratively disabled, "
1009 "reboot required to enable\n");
1010 goto out;
1011 }
1012
998 err = proto_register(&tcpv6_prot, 1); 1013 err = proto_register(&tcpv6_prot, 1);
999 if (err) 1014 if (err)
1000 goto out; 1015 goto out;
@@ -1012,10 +1027,6 @@ static int __init inet6_init(void)
1012 goto out_unregister_udplite_proto; 1027 goto out_unregister_udplite_proto;
1013 1028
1014 1029
1015 /* Register the socket-side information for inet6_create. */
1016 for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
1017 INIT_LIST_HEAD(r);
1018
1019 /* We MUST register RAW sockets before we create the ICMP6, 1030 /* We MUST register RAW sockets before we create the ICMP6,
1020 * IGMP6, or NDISC control sockets. 1031 * IGMP6, or NDISC control sockets.
1021 */ 1032 */
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index 8fe267feb81e..1bcc3431859e 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -258,11 +258,11 @@ unique:
258 258
259 if (twp != NULL) { 259 if (twp != NULL) {
260 *twp = tw; 260 *twp = tw;
261 NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITRECYCLED); 261 NET_INC_STATS_BH(net, LINUX_MIB_TIMEWAITRECYCLED);
262 } else if (tw != NULL) { 262 } else if (tw != NULL) {
263 /* Silly. Should hash-dance instead... */ 263 /* Silly. Should hash-dance instead... */
264 inet_twsk_deschedule(tw, death_row); 264 inet_twsk_deschedule(tw, death_row);
265 NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITRECYCLED); 265 NET_INC_STATS_BH(net, LINUX_MIB_TIMEWAITRECYCLED);
266 266
267 inet_twsk_put(tw); 267 inet_twsk_put(tw);
268 } 268 }
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index c323643ffcf9..72dbb6d1a6b3 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -201,8 +201,9 @@ icmpv6_error(struct net *net, struct sk_buff *skb, unsigned int dataoff,
201 201
202 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && 202 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
203 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) { 203 nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) {
204 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, 204 if (LOG_INVALID(net, IPPROTO_ICMPV6))
205 "nf_ct_icmpv6: ICMPv6 checksum failed\n"); 205 nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
206 "nf_ct_icmpv6: ICMPv6 checksum failed ");
206 return -NF_ACCEPT; 207 return -NF_ACCEPT;
207 } 208 }
208 209
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index fa49dc7fe100..c712e9fc6bba 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -39,7 +39,7 @@
39#endif 39#endif
40 40
41#define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE 41#define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE
42#define NFULNL_TIMEOUT_DEFAULT HZ /* every second */ 42#define NFULNL_TIMEOUT_DEFAULT 100 /* every second */
43#define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ 43#define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */
44#define NFULNL_COPY_RANGE_MAX 0xFFFF /* max packet size is limited by 16-bit struct nfattr nfa_len field */ 44#define NFULNL_COPY_RANGE_MAX 0xFFFF /* max packet size is limited by 16-bit struct nfattr nfa_len field */
45 45
@@ -590,8 +590,10 @@ nfulnl_log_packet(u_int8_t pf,
590 590
591 qthreshold = inst->qthreshold; 591 qthreshold = inst->qthreshold;
592 /* per-rule qthreshold overrides per-instance */ 592 /* per-rule qthreshold overrides per-instance */
593 if (qthreshold > li->u.ulog.qthreshold) 593 if (li->u.ulog.qthreshold)
594 qthreshold = li->u.ulog.qthreshold; 594 if (qthreshold > li->u.ulog.qthreshold)
595 qthreshold = li->u.ulog.qthreshold;
596
595 597
596 switch (inst->copy_mode) { 598 switch (inst->copy_mode) {
597 case NFULNL_COPY_META: 599 case NFULNL_COPY_META:
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index bfbf521f6ea5..5baccfa5a0de 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -827,59 +827,143 @@ static const struct file_operations xt_table_ops = {
827 .release = seq_release_net, 827 .release = seq_release_net,
828}; 828};
829 829
830static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos) 830/*
831 * Traverse state for ip{,6}_{tables,matches} for helping crossing
832 * the multi-AF mutexes.
833 */
834struct nf_mttg_trav {
835 struct list_head *head, *curr;
836 uint8_t class, nfproto;
837};
838
839enum {
840 MTTG_TRAV_INIT,
841 MTTG_TRAV_NFP_UNSPEC,
842 MTTG_TRAV_NFP_SPEC,
843 MTTG_TRAV_DONE,
844};
845
846static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos,
847 bool is_target)
831{ 848{
832 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private; 849 static const uint8_t next_class[] = {
833 u_int16_t af = (unsigned long)pde->data; 850 [MTTG_TRAV_NFP_UNSPEC] = MTTG_TRAV_NFP_SPEC,
851 [MTTG_TRAV_NFP_SPEC] = MTTG_TRAV_DONE,
852 };
853 struct nf_mttg_trav *trav = seq->private;
854
855 switch (trav->class) {
856 case MTTG_TRAV_INIT:
857 trav->class = MTTG_TRAV_NFP_UNSPEC;
858 mutex_lock(&xt[NFPROTO_UNSPEC].mutex);
859 trav->head = trav->curr = is_target ?
860 &xt[NFPROTO_UNSPEC].target : &xt[NFPROTO_UNSPEC].match;
861 break;
862 case MTTG_TRAV_NFP_UNSPEC:
863 trav->curr = trav->curr->next;
864 if (trav->curr != trav->head)
865 break;
866 mutex_unlock(&xt[NFPROTO_UNSPEC].mutex);
867 mutex_lock(&xt[trav->nfproto].mutex);
868 trav->head = trav->curr = is_target ?
869 &xt[trav->nfproto].target : &xt[trav->nfproto].match;
870 trav->class = next_class[trav->class];
871 break;
872 case MTTG_TRAV_NFP_SPEC:
873 trav->curr = trav->curr->next;
874 if (trav->curr != trav->head)
875 break;
876 /* fallthru, _stop will unlock */
877 default:
878 return NULL;
879 }
834 880
835 mutex_lock(&xt[af].mutex); 881 if (ppos != NULL)
836 return seq_list_start(&xt[af].match, *pos); 882 ++*ppos;
883 return trav;
837} 884}
838 885
839static void *xt_match_seq_next(struct seq_file *seq, void *v, loff_t *pos) 886static void *xt_mttg_seq_start(struct seq_file *seq, loff_t *pos,
887 bool is_target)
840{ 888{
841 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private; 889 struct nf_mttg_trav *trav = seq->private;
842 u_int16_t af = (unsigned long)pde->data; 890 unsigned int j;
843 891
844 return seq_list_next(v, &xt[af].match, pos); 892 trav->class = MTTG_TRAV_INIT;
893 for (j = 0; j < *pos; ++j)
894 if (xt_mttg_seq_next(seq, NULL, NULL, is_target) == NULL)
895 return NULL;
896 return trav;
845} 897}
846 898
847static void xt_match_seq_stop(struct seq_file *seq, void *v) 899static void xt_mttg_seq_stop(struct seq_file *seq, void *v)
848{ 900{
849 struct proc_dir_entry *pde = seq->private; 901 struct nf_mttg_trav *trav = seq->private;
850 u_int16_t af = (unsigned long)pde->data; 902
903 switch (trav->class) {
904 case MTTG_TRAV_NFP_UNSPEC:
905 mutex_unlock(&xt[NFPROTO_UNSPEC].mutex);
906 break;
907 case MTTG_TRAV_NFP_SPEC:
908 mutex_unlock(&xt[trav->nfproto].mutex);
909 break;
910 }
911}
851 912
852 mutex_unlock(&xt[af].mutex); 913static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos)
914{
915 return xt_mttg_seq_start(seq, pos, false);
853} 916}
854 917
855static int xt_match_seq_show(struct seq_file *seq, void *v) 918static void *xt_match_seq_next(struct seq_file *seq, void *v, loff_t *ppos)
856{ 919{
857 struct xt_match *match = list_entry(v, struct xt_match, list); 920 return xt_mttg_seq_next(seq, v, ppos, false);
921}
858 922
859 if (strlen(match->name)) 923static int xt_match_seq_show(struct seq_file *seq, void *v)
860 return seq_printf(seq, "%s\n", match->name); 924{
861 else 925 const struct nf_mttg_trav *trav = seq->private;
862 return 0; 926 const struct xt_match *match;
927
928 switch (trav->class) {
929 case MTTG_TRAV_NFP_UNSPEC:
930 case MTTG_TRAV_NFP_SPEC:
931 if (trav->curr == trav->head)
932 return 0;
933 match = list_entry(trav->curr, struct xt_match, list);
934 return (*match->name == '\0') ? 0 :
935 seq_printf(seq, "%s\n", match->name);
936 }
937 return 0;
863} 938}
864 939
865static const struct seq_operations xt_match_seq_ops = { 940static const struct seq_operations xt_match_seq_ops = {
866 .start = xt_match_seq_start, 941 .start = xt_match_seq_start,
867 .next = xt_match_seq_next, 942 .next = xt_match_seq_next,
868 .stop = xt_match_seq_stop, 943 .stop = xt_mttg_seq_stop,
869 .show = xt_match_seq_show, 944 .show = xt_match_seq_show,
870}; 945};
871 946
872static int xt_match_open(struct inode *inode, struct file *file) 947static int xt_match_open(struct inode *inode, struct file *file)
873{ 948{
949 struct seq_file *seq;
950 struct nf_mttg_trav *trav;
874 int ret; 951 int ret;
875 952
876 ret = seq_open(file, &xt_match_seq_ops); 953 trav = kmalloc(sizeof(*trav), GFP_KERNEL);
877 if (!ret) { 954 if (trav == NULL)
878 struct seq_file *seq = file->private_data; 955 return -ENOMEM;
879 956
880 seq->private = PDE(inode); 957 ret = seq_open(file, &xt_match_seq_ops);
958 if (ret < 0) {
959 kfree(trav);
960 return ret;
881 } 961 }
882 return ret; 962
963 seq = file->private_data;
964 seq->private = trav;
965 trav->nfproto = (unsigned long)PDE(inode)->data;
966 return 0;
883} 967}
884 968
885static const struct file_operations xt_match_ops = { 969static const struct file_operations xt_match_ops = {
@@ -887,62 +971,63 @@ static const struct file_operations xt_match_ops = {
887 .open = xt_match_open, 971 .open = xt_match_open,
888 .read = seq_read, 972 .read = seq_read,
889 .llseek = seq_lseek, 973 .llseek = seq_lseek,
890 .release = seq_release, 974 .release = seq_release_private,
891}; 975};
892 976
893static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos) 977static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos)
894{ 978{
895 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private; 979 return xt_mttg_seq_start(seq, pos, true);
896 u_int16_t af = (unsigned long)pde->data;
897
898 mutex_lock(&xt[af].mutex);
899 return seq_list_start(&xt[af].target, *pos);
900} 980}
901 981
902static void *xt_target_seq_next(struct seq_file *seq, void *v, loff_t *pos) 982static void *xt_target_seq_next(struct seq_file *seq, void *v, loff_t *ppos)
903{ 983{
904 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private; 984 return xt_mttg_seq_next(seq, v, ppos, true);
905 u_int16_t af = (unsigned long)pde->data;
906
907 return seq_list_next(v, &xt[af].target, pos);
908}
909
910static void xt_target_seq_stop(struct seq_file *seq, void *v)
911{
912 struct proc_dir_entry *pde = seq->private;
913 u_int16_t af = (unsigned long)pde->data;
914
915 mutex_unlock(&xt[af].mutex);
916} 985}
917 986
918static int xt_target_seq_show(struct seq_file *seq, void *v) 987static int xt_target_seq_show(struct seq_file *seq, void *v)
919{ 988{
920 struct xt_target *target = list_entry(v, struct xt_target, list); 989 const struct nf_mttg_trav *trav = seq->private;
921 990 const struct xt_target *target;
922 if (strlen(target->name)) 991
923 return seq_printf(seq, "%s\n", target->name); 992 switch (trav->class) {
924 else 993 case MTTG_TRAV_NFP_UNSPEC:
925 return 0; 994 case MTTG_TRAV_NFP_SPEC:
995 if (trav->curr == trav->head)
996 return 0;
997 target = list_entry(trav->curr, struct xt_target, list);
998 return (*target->name == '\0') ? 0 :
999 seq_printf(seq, "%s\n", target->name);
1000 }
1001 return 0;
926} 1002}
927 1003
928static const struct seq_operations xt_target_seq_ops = { 1004static const struct seq_operations xt_target_seq_ops = {
929 .start = xt_target_seq_start, 1005 .start = xt_target_seq_start,
930 .next = xt_target_seq_next, 1006 .next = xt_target_seq_next,
931 .stop = xt_target_seq_stop, 1007 .stop = xt_mttg_seq_stop,
932 .show = xt_target_seq_show, 1008 .show = xt_target_seq_show,
933}; 1009};
934 1010
935static int xt_target_open(struct inode *inode, struct file *file) 1011static int xt_target_open(struct inode *inode, struct file *file)
936{ 1012{
1013 struct seq_file *seq;
1014 struct nf_mttg_trav *trav;
937 int ret; 1015 int ret;
938 1016
939 ret = seq_open(file, &xt_target_seq_ops); 1017 trav = kmalloc(sizeof(*trav), GFP_KERNEL);
940 if (!ret) { 1018 if (trav == NULL)
941 struct seq_file *seq = file->private_data; 1019 return -ENOMEM;
942 1020
943 seq->private = PDE(inode); 1021 ret = seq_open(file, &xt_target_seq_ops);
1022 if (ret < 0) {
1023 kfree(trav);
1024 return ret;
944 } 1025 }
945 return ret; 1026
1027 seq = file->private_data;
1028 seq->private = trav;
1029 trav->nfproto = (unsigned long)PDE(inode)->data;
1030 return 0;
946} 1031}
947 1032
948static const struct file_operations xt_target_ops = { 1033static const struct file_operations xt_target_ops = {
@@ -950,7 +1035,7 @@ static const struct file_operations xt_target_ops = {
950 .open = xt_target_open, 1035 .open = xt_target_open,
951 .read = seq_read, 1036 .read = seq_read,
952 .llseek = seq_lseek, 1037 .llseek = seq_lseek,
953 .release = seq_release, 1038 .release = seq_release_private,
954}; 1039};
955 1040
956#define FORMAT_TABLES "_tables_names" 1041#define FORMAT_TABLES "_tables_names"
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index fe80b614a400..791e030ea903 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -542,7 +542,7 @@ recent_mt_proc_write(struct file *file, const char __user *input,
542 struct recent_entry *e; 542 struct recent_entry *e;
543 char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; 543 char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")];
544 const char *c = buf; 544 const char *c = buf;
545 union nf_inet_addr addr; 545 union nf_inet_addr addr = {};
546 u_int16_t family; 546 u_int16_t family;
547 bool add, succ; 547 bool add, succ;
548 548
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 9eb895c7a2a9..3ae3cb816563 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1084,6 +1084,13 @@ out:
1084 return 0; 1084 return 0;
1085} 1085}
1086 1086
1087/**
1088 * netlink_set_err - report error to broadcast listeners
1089 * @ssk: the kernel netlink socket, as returned by netlink_kernel_create()
1090 * @pid: the PID of a process that we want to skip (if any)
1091 * @groups: the broadcast group that will notice the error
1092 * @code: error code, must be negative (as usual in kernelspace)
1093 */
1087void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) 1094void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
1088{ 1095{
1089 struct netlink_set_err_data info; 1096 struct netlink_set_err_data info;
@@ -1093,7 +1100,8 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
1093 info.exclude_sk = ssk; 1100 info.exclude_sk = ssk;
1094 info.pid = pid; 1101 info.pid = pid;
1095 info.group = group; 1102 info.group = group;
1096 info.code = code; 1103 /* sk->sk_err wants a positive error value */
1104 info.code = -code;
1097 1105
1098 read_lock(&nl_table_lock); 1106 read_lock(&nl_table_lock);
1099 1107
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 5c72a116b1a4..f8f047b61245 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -183,13 +183,6 @@ override:
183 if (R_tab == NULL) 183 if (R_tab == NULL)
184 goto failure; 184 goto failure;
185 185
186 if (!est && (ret == ACT_P_CREATED ||
187 !gen_estimator_active(&police->tcf_bstats,
188 &police->tcf_rate_est))) {
189 err = -EINVAL;
190 goto failure;
191 }
192
193 if (parm->peakrate.rate) { 186 if (parm->peakrate.rate) {
194 P_tab = qdisc_get_rtab(&parm->peakrate, 187 P_tab = qdisc_get_rtab(&parm->peakrate,
195 tb[TCA_POLICE_PEAKRATE]); 188 tb[TCA_POLICE_PEAKRATE]);
@@ -205,6 +198,12 @@ override:
205 &police->tcf_lock, est); 198 &police->tcf_lock, est);
206 if (err) 199 if (err)
207 goto failure_unlock; 200 goto failure_unlock;
201 } else if (tb[TCA_POLICE_AVRATE] &&
202 (ret == ACT_P_CREATED ||
203 !gen_estimator_active(&police->tcf_bstats,
204 &police->tcf_rate_est))) {
205 err = -EINVAL;
206 goto failure_unlock;
208 } 207 }
209 208
210 /* No failure allowed after this point */ 209 /* No failure allowed after this point */
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index f6b4fa97df70..e36e94ab4e10 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -66,11 +66,15 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
66{ 66{
67 struct drr_sched *q = qdisc_priv(sch); 67 struct drr_sched *q = qdisc_priv(sch);
68 struct drr_class *cl = (struct drr_class *)*arg; 68 struct drr_class *cl = (struct drr_class *)*arg;
69 struct nlattr *opt = tca[TCA_OPTIONS];
69 struct nlattr *tb[TCA_DRR_MAX + 1]; 70 struct nlattr *tb[TCA_DRR_MAX + 1];
70 u32 quantum; 71 u32 quantum;
71 int err; 72 int err;
72 73
73 err = nla_parse_nested(tb, TCA_DRR_MAX, tca[TCA_OPTIONS], drr_policy); 74 if (!opt)
75 return -EINVAL;
76
77 err = nla_parse_nested(tb, TCA_DRR_MAX, opt, drr_policy);
74 if (err < 0) 78 if (err < 0)
75 return err; 79 return err;
76 80
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index b78e3be69013..c4986d0f7419 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -717,15 +717,20 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
717static int sctp_ctl_sock_init(void) 717static int sctp_ctl_sock_init(void)
718{ 718{
719 int err; 719 int err;
720 sa_family_t family; 720 sa_family_t family = PF_INET;
721 721
722 if (sctp_get_pf_specific(PF_INET6)) 722 if (sctp_get_pf_specific(PF_INET6))
723 family = PF_INET6; 723 family = PF_INET6;
724 else
725 family = PF_INET;
726 724
727 err = inet_ctl_sock_create(&sctp_ctl_sock, family, 725 err = inet_ctl_sock_create(&sctp_ctl_sock, family,
728 SOCK_SEQPACKET, IPPROTO_SCTP, &init_net); 726 SOCK_SEQPACKET, IPPROTO_SCTP, &init_net);
727
728 /* If IPv6 socket could not be created, try the IPv4 socket */
729 if (err < 0 && family == PF_INET6)
730 err = inet_ctl_sock_create(&sctp_ctl_sock, AF_INET,
731 SOCK_SEQPACKET, IPPROTO_SCTP,
732 &init_net);
733
729 if (err < 0) { 734 if (err < 0) {
730 printk(KERN_ERR 735 printk(KERN_ERR
731 "SCTP: Failed to create the SCTP control socket.\n"); 736 "SCTP: Failed to create the SCTP control socket.\n");
@@ -1322,9 +1327,8 @@ SCTP_STATIC __init int sctp_init(void)
1322out: 1327out:
1323 return status; 1328 return status;
1324err_v6_add_protocol: 1329err_v6_add_protocol:
1325 sctp_v6_del_protocol();
1326err_add_protocol:
1327 sctp_v4_del_protocol(); 1330 sctp_v4_del_protocol();
1331err_add_protocol:
1328 inet_ctl_sock_destroy(sctp_ctl_sock); 1332 inet_ctl_sock_destroy(sctp_ctl_sock);
1329err_ctl_sock_init: 1333err_ctl_sock_init:
1330 sctp_v6_protosw_exit(); 1334 sctp_v6_protosw_exit();
@@ -1335,7 +1339,6 @@ err_protosw_init:
1335 sctp_v4_pf_exit(); 1339 sctp_v4_pf_exit();
1336 sctp_v6_pf_exit(); 1340 sctp_v6_pf_exit();
1337 sctp_sysctl_unregister(); 1341 sctp_sysctl_unregister();
1338 list_del(&sctp_af_inet.list);
1339 free_pages((unsigned long)sctp_port_hashtable, 1342 free_pages((unsigned long)sctp_port_hashtable,
1340 get_order(sctp_port_hashsize * 1343 get_order(sctp_port_hashsize *
1341 sizeof(struct sctp_bind_hashbucket))); 1344 sizeof(struct sctp_bind_hashbucket)));
@@ -1383,7 +1386,6 @@ SCTP_STATIC __exit void sctp_exit(void)
1383 sctp_v4_pf_exit(); 1386 sctp_v4_pf_exit();
1384 1387
1385 sctp_sysctl_unregister(); 1388 sctp_sysctl_unregister();
1386 list_del(&sctp_af_inet.list);
1387 1389
1388 free_pages((unsigned long)sctp_assoc_hashtable, 1390 free_pages((unsigned long)sctp_assoc_hashtable,
1389 get_order(sctp_assoc_hashsize * 1391 get_order(sctp_assoc_hashsize *
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index e1d6076b4f59..b5495aecab60 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -787,36 +787,48 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds,
787 struct sctp_association *asoc, 787 struct sctp_association *asoc,
788 struct sctp_chunk *chunk) 788 struct sctp_chunk *chunk)
789{ 789{
790 struct sctp_operr_chunk *operr_chunk;
791 struct sctp_errhdr *err_hdr; 790 struct sctp_errhdr *err_hdr;
791 struct sctp_ulpevent *ev;
792 792
793 operr_chunk = (struct sctp_operr_chunk *)chunk->chunk_hdr; 793 while (chunk->chunk_end > chunk->skb->data) {
794 err_hdr = &operr_chunk->err_hdr; 794 err_hdr = (struct sctp_errhdr *)(chunk->skb->data);
795 795
796 switch (err_hdr->cause) { 796 ev = sctp_ulpevent_make_remote_error(asoc, chunk, 0,
797 case SCTP_ERROR_UNKNOWN_CHUNK: 797 GFP_ATOMIC);
798 { 798 if (!ev)
799 struct sctp_chunkhdr *unk_chunk_hdr; 799 return;
800 800
801 unk_chunk_hdr = (struct sctp_chunkhdr *)err_hdr->variable; 801 sctp_ulpq_tail_event(&asoc->ulpq, ev);
802 switch (unk_chunk_hdr->type) { 802
803 /* ADDIP 4.1 A9) If the peer responds to an ASCONF with an 803 switch (err_hdr->cause) {
804 * ERROR chunk reporting that it did not recognized the ASCONF 804 case SCTP_ERROR_UNKNOWN_CHUNK:
805 * chunk type, the sender of the ASCONF MUST NOT send any 805 {
806 * further ASCONF chunks and MUST stop its T-4 timer. 806 sctp_chunkhdr_t *unk_chunk_hdr;
807 */ 807
808 case SCTP_CID_ASCONF: 808 unk_chunk_hdr = (sctp_chunkhdr_t *)err_hdr->variable;
809 asoc->peer.asconf_capable = 0; 809 switch (unk_chunk_hdr->type) {
810 sctp_add_cmd_sf(cmds, SCTP_CMD_TIMER_STOP, 810 /* ADDIP 4.1 A9) If the peer responds to an ASCONF with
811 * an ERROR chunk reporting that it did not recognized
812 * the ASCONF chunk type, the sender of the ASCONF MUST
813 * NOT send any further ASCONF chunks and MUST stop its
814 * T-4 timer.
815 */
816 case SCTP_CID_ASCONF:
817 if (asoc->peer.asconf_capable == 0)
818 break;
819
820 asoc->peer.asconf_capable = 0;
821 sctp_add_cmd_sf(cmds, SCTP_CMD_TIMER_STOP,
811 SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); 822 SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
823 break;
824 default:
825 break;
826 }
812 break; 827 break;
828 }
813 default: 829 default:
814 break; 830 break;
815 } 831 }
816 break;
817 }
818 default:
819 break;
820 } 832 }
821} 833}
822 834
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 3a0cd075914f..f88dfded0e3a 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -3163,7 +3163,6 @@ sctp_disposition_t sctp_sf_operr_notify(const struct sctp_endpoint *ep,
3163 sctp_cmd_seq_t *commands) 3163 sctp_cmd_seq_t *commands)
3164{ 3164{
3165 struct sctp_chunk *chunk = arg; 3165 struct sctp_chunk *chunk = arg;
3166 struct sctp_ulpevent *ev;
3167 3166
3168 if (!sctp_vtag_verify(chunk, asoc)) 3167 if (!sctp_vtag_verify(chunk, asoc))
3169 return sctp_sf_pdiscard(ep, asoc, type, arg, commands); 3168 return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -3173,21 +3172,10 @@ sctp_disposition_t sctp_sf_operr_notify(const struct sctp_endpoint *ep,
3173 return sctp_sf_violation_chunklen(ep, asoc, type, arg, 3172 return sctp_sf_violation_chunklen(ep, asoc, type, arg,
3174 commands); 3173 commands);
3175 3174
3176 while (chunk->chunk_end > chunk->skb->data) { 3175 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR,
3177 ev = sctp_ulpevent_make_remote_error(asoc, chunk, 0, 3176 SCTP_CHUNK(chunk));
3178 GFP_ATOMIC);
3179 if (!ev)
3180 goto nomem;
3181 3177
3182 sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP,
3183 SCTP_ULPEVENT(ev));
3184 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR,
3185 SCTP_CHUNK(chunk));
3186 }
3187 return SCTP_DISPOSITION_CONSUME; 3178 return SCTP_DISPOSITION_CONSUME;
3188
3189nomem:
3190 return SCTP_DISPOSITION_NOMEM;
3191} 3179}
3192 3180
3193/* 3181/*
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 385f427bedad..ff50a0546865 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -293,11 +293,6 @@ static void rpc_make_runnable(struct rpc_task *task)
293 rpc_clear_queued(task); 293 rpc_clear_queued(task);
294 if (rpc_test_and_set_running(task)) 294 if (rpc_test_and_set_running(task))
295 return; 295 return;
296 /* We might have raced */
297 if (RPC_IS_QUEUED(task)) {
298 rpc_clear_running(task);
299 return;
300 }
301 if (RPC_IS_ASYNC(task)) { 296 if (RPC_IS_ASYNC(task)) {
302 int status; 297 int status;
303 298
@@ -607,7 +602,9 @@ void rpc_release_calldata(const struct rpc_call_ops *ops, void *calldata)
607 */ 602 */
608static void __rpc_execute(struct rpc_task *task) 603static void __rpc_execute(struct rpc_task *task)
609{ 604{
610 int status = 0; 605 struct rpc_wait_queue *queue;
606 int task_is_async = RPC_IS_ASYNC(task);
607 int status = 0;
611 608
612 dprintk("RPC: %5u __rpc_execute flags=0x%x\n", 609 dprintk("RPC: %5u __rpc_execute flags=0x%x\n",
613 task->tk_pid, task->tk_flags); 610 task->tk_pid, task->tk_flags);
@@ -647,15 +644,25 @@ static void __rpc_execute(struct rpc_task *task)
647 */ 644 */
648 if (!RPC_IS_QUEUED(task)) 645 if (!RPC_IS_QUEUED(task))
649 continue; 646 continue;
650 rpc_clear_running(task); 647 /*
651 if (RPC_IS_ASYNC(task)) { 648 * The queue->lock protects against races with
652 /* Careful! we may have raced... */ 649 * rpc_make_runnable().
653 if (RPC_IS_QUEUED(task)) 650 *
654 return; 651 * Note that once we clear RPC_TASK_RUNNING on an asynchronous
655 if (rpc_test_and_set_running(task)) 652 * rpc_task, rpc_make_runnable() can assign it to a
656 return; 653 * different workqueue. We therefore cannot assume that the
654 * rpc_task pointer may still be dereferenced.
655 */
656 queue = task->tk_waitqueue;
657 spin_lock_bh(&queue->lock);
658 if (!RPC_IS_QUEUED(task)) {
659 spin_unlock_bh(&queue->lock);
657 continue; 660 continue;
658 } 661 }
662 rpc_clear_running(task);
663 spin_unlock_bh(&queue->lock);
664 if (task_is_async)
665 return;
659 666
660 /* sync task: sleep here */ 667 /* sync task: sleep here */
661 dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); 668 dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid);
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 29e401bb612e..62098d101a1f 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -663,7 +663,7 @@ void xprt_connect(struct rpc_task *task)
663 xprt, (xprt_connected(xprt) ? "is" : "is not")); 663 xprt, (xprt_connected(xprt) ? "is" : "is not"));
664 664
665 if (!xprt_bound(xprt)) { 665 if (!xprt_bound(xprt)) {
666 task->tk_status = -EIO; 666 task->tk_status = -EAGAIN;
667 return; 667 return;
668 } 668 }
669 if (!xprt_lock_write(xprt, task)) 669 if (!xprt_lock_write(xprt, task))
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 5cbb404c4cdf..29c71e645b27 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -467,7 +467,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen,
467 int err, sent = 0; 467 int err, sent = 0;
468 468
469 if (unlikely(!sock)) 469 if (unlikely(!sock))
470 return -ENOTCONN; 470 return -ENOTSOCK;
471 471
472 clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags); 472 clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
473 if (base != 0) { 473 if (base != 0) {
@@ -577,6 +577,8 @@ static int xs_udp_send_request(struct rpc_task *task)
577 req->rq_svec->iov_base, 577 req->rq_svec->iov_base,
578 req->rq_svec->iov_len); 578 req->rq_svec->iov_len);
579 579
580 if (!xprt_bound(xprt))
581 return -ENOTCONN;
580 status = xs_sendpages(transport->sock, 582 status = xs_sendpages(transport->sock,
581 xs_addr(xprt), 583 xs_addr(xprt),
582 xprt->addrlen, xdr, 584 xprt->addrlen, xdr,
@@ -594,6 +596,10 @@ static int xs_udp_send_request(struct rpc_task *task)
594 } 596 }
595 597
596 switch (status) { 598 switch (status) {
599 case -ENOTSOCK:
600 status = -ENOTCONN;
601 /* Should we call xs_close() here? */
602 break;
597 case -EAGAIN: 603 case -EAGAIN:
598 xs_nospace(task); 604 xs_nospace(task);
599 break; 605 break;
@@ -693,6 +699,10 @@ static int xs_tcp_send_request(struct rpc_task *task)
693 } 699 }
694 700
695 switch (status) { 701 switch (status) {
702 case -ENOTSOCK:
703 status = -ENOTCONN;
704 /* Should we call xs_close() here? */
705 break;
696 case -EAGAIN: 706 case -EAGAIN:
697 xs_nospace(task); 707 xs_nospace(task);
698 break; 708 break;
@@ -1523,7 +1533,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
1523 struct socket *sock = transport->sock; 1533 struct socket *sock = transport->sock;
1524 int err, status = -EIO; 1534 int err, status = -EIO;
1525 1535
1526 if (xprt->shutdown || !xprt_bound(xprt)) 1536 if (xprt->shutdown)
1527 goto out; 1537 goto out;
1528 1538
1529 /* Start by resetting any existing state */ 1539 /* Start by resetting any existing state */
@@ -1564,7 +1574,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
1564 struct socket *sock = transport->sock; 1574 struct socket *sock = transport->sock;
1565 int err, status = -EIO; 1575 int err, status = -EIO;
1566 1576
1567 if (xprt->shutdown || !xprt_bound(xprt)) 1577 if (xprt->shutdown)
1568 goto out; 1578 goto out;
1569 1579
1570 /* Start by resetting any existing state */ 1580 /* Start by resetting any existing state */
@@ -1648,6 +1658,9 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1648 write_unlock_bh(&sk->sk_callback_lock); 1658 write_unlock_bh(&sk->sk_callback_lock);
1649 } 1659 }
1650 1660
1661 if (!xprt_bound(xprt))
1662 return -ENOTCONN;
1663
1651 /* Tell the socket layer to start connecting... */ 1664 /* Tell the socket layer to start connecting... */
1652 xprt->stat.connect_count++; 1665 xprt->stat.connect_count++;
1653 xprt->stat.connect_start = jiffies; 1666 xprt->stat.connect_start = jiffies;
@@ -1668,7 +1681,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1668 struct socket *sock = transport->sock; 1681 struct socket *sock = transport->sock;
1669 int err, status = -EIO; 1682 int err, status = -EIO;
1670 1683
1671 if (xprt->shutdown || !xprt_bound(xprt)) 1684 if (xprt->shutdown)
1672 goto out; 1685 goto out;
1673 1686
1674 if (!sock) { 1687 if (!sock) {
@@ -1728,7 +1741,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
1728 struct socket *sock = transport->sock; 1741 struct socket *sock = transport->sock;
1729 int err, status = -EIO; 1742 int err, status = -EIO;
1730 1743
1731 if (xprt->shutdown || !xprt_bound(xprt)) 1744 if (xprt->shutdown)
1732 goto out; 1745 goto out;
1733 1746
1734 if (!sock) { 1747 if (!sock) {
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 85c9034c59b2..bd0a16c3de5e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -380,7 +380,8 @@ static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule)
380 380
381 freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; 381 freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz;
382 382
383 if (freq_diff <= 0 || freq_range->max_bandwidth_khz > freq_diff) 383 if (freq_range->end_freq_khz <= freq_range->start_freq_khz ||
384 freq_range->max_bandwidth_khz > freq_diff)
384 return false; 385 return false;
385 386
386 return true; 387 return true;
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl
index b0246307aac4..12caa822a232 100644
--- a/scripts/bootgraph.pl
+++ b/scripts/bootgraph.pl
@@ -51,7 +51,7 @@ my %pidctr;
51 51
52while (<>) { 52while (<>) {
53 my $line = $_; 53 my $line = $_;
54 if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { 54 if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) {
55 my $func = $2; 55 my $func = $2;
56 if ($done == 0) { 56 if ($done == 0) {
57 $start{$func} = $1; 57 $start{$func} = $1;
@@ -87,7 +87,7 @@ while (<>) {
87 $count = $count + 1; 87 $count = $count + 1;
88 } 88 }
89 89
90 if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { 90 if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) {
91 if ($done == 0) { 91 if ($done == 0) {
92 $end{$2} = $1; 92 $end{$2} = $1;
93 $maxtime = $1; 93 $maxtime = $1;
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 45eb0ae98eba..2d5ece798c4c 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.27'; 13my $V = '0.28';
14 14
15use Getopt::Long qw(:config no_auto_abbrev); 15use Getopt::Long qw(:config no_auto_abbrev);
16 16
@@ -110,7 +110,8 @@ our $Sparse = qr{
110 __iomem| 110 __iomem|
111 __must_check| 111 __must_check|
112 __init_refok| 112 __init_refok|
113 __kprobes 113 __kprobes|
114 __ref
114 }x; 115 }x;
115our $Attribute = qr{ 116our $Attribute = qr{
116 const| 117 const|
@@ -1240,7 +1241,8 @@ sub process {
1240 $realfile =~ s@^([^/]*)/@@; 1241 $realfile =~ s@^([^/]*)/@@;
1241 1242
1242 $p1_prefix = $1; 1243 $p1_prefix = $1;
1243 if ($tree && $p1_prefix ne '' && -e "$root/$p1_prefix") { 1244 if (!$file && $tree && $p1_prefix ne '' &&
1245 -e "$root/$p1_prefix") {
1244 WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); 1246 WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
1245 } 1247 }
1246 1248
@@ -1583,9 +1585,9 @@ sub process {
1583 } 1585 }
1584# TEST: allow direct testing of the attribute matcher. 1586# TEST: allow direct testing of the attribute matcher.
1585 if ($dbg_attr) { 1587 if ($dbg_attr) {
1586 if ($line =~ /^.\s*$Attribute\s*$/) { 1588 if ($line =~ /^.\s*$Modifier\s*$/) {
1587 ERROR("TEST: is attr\n" . $herecurr); 1589 ERROR("TEST: is attr\n" . $herecurr);
1588 } elsif ($dbg_attr > 1 && $line =~ /^.+($Attribute)/) { 1590 } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) {
1589 ERROR("TEST: is not attr ($1 is)\n". $herecurr); 1591 ERROR("TEST: is not attr ($1 is)\n". $herecurr);
1590 } 1592 }
1591 next; 1593 next;
@@ -1657,7 +1659,7 @@ sub process {
1657 1659
1658# * goes on variable not on type 1660# * goes on variable not on type
1659 # (char*[ const]) 1661 # (char*[ const])
1660 if ($line =~ m{\($NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)*)\)}) { 1662 if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {
1661 my ($from, $to) = ($1, $1); 1663 my ($from, $to) = ($1, $1);
1662 1664
1663 # Should start with a space. 1665 # Should start with a space.
@@ -1672,7 +1674,7 @@ sub process {
1672 if ($from ne $to) { 1674 if ($from ne $to) {
1673 ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); 1675 ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr);
1674 } 1676 }
1675 } elsif ($line =~ m{\b$NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)?)($Ident)}) { 1677 } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) {
1676 my ($from, $to, $ident) = ($1, $1, $2); 1678 my ($from, $to, $ident) = ($1, $1, $2);
1677 1679
1678 # Should start with a space. 1680 # Should start with a space.
@@ -1685,8 +1687,8 @@ sub process {
1685 # Modifiers should have spaces. 1687 # Modifiers should have spaces.
1686 $to =~ s/(\b$Modifier$)/$1 /; 1688 $to =~ s/(\b$Modifier$)/$1 /;
1687 1689
1688 #print "from<$from> to<$to>\n"; 1690 #print "from<$from> to<$to> ident<$ident>\n";
1689 if ($from ne $to) { 1691 if ($from ne $to && $ident !~ /^$Modifier$/) {
1690 ERROR("\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); 1692 ERROR("\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr);
1691 } 1693 }
1692 } 1694 }
@@ -1885,11 +1887,11 @@ sub process {
1885 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { 1887 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
1886 ERROR("space required before that '$op' $at\n" . $hereptr); 1888 ERROR("space required before that '$op' $at\n" . $hereptr);
1887 } 1889 }
1888 if ($op eq '*' && $cc =~/\s*const\b/) { 1890 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
1889 # A unary '*' may be const 1891 # A unary '*' may be const
1890 1892
1891 } elsif ($ctx =~ /.xW/) { 1893 } elsif ($ctx =~ /.xW/) {
1892 ERROR("space prohibited after that '$op' $at\n" . $hereptr); 1894 ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr);
1893 } 1895 }
1894 1896
1895 # unary ++ and unary -- are allowed no space on one side. 1897 # unary ++ and unary -- are allowed no space on one side.
@@ -2560,7 +2562,7 @@ sub process {
2560 if ($line =~ /\bin_atomic\s*\(/) { 2562 if ($line =~ /\bin_atomic\s*\(/) {
2561 if ($realfile =~ m@^drivers/@) { 2563 if ($realfile =~ m@^drivers/@) {
2562 ERROR("do not use in_atomic in drivers\n" . $herecurr); 2564 ERROR("do not use in_atomic in drivers\n" . $herecurr);
2563 } else { 2565 } elsif ($realfile !~ m@^kernel/@) {
2564 WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); 2566 WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr);
2565 } 2567 }
2566 } 2568 }
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
index d40449cafa84..528492bcba5b 100644
--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!/usr/bin/perl
2 2
3use File::Basename; 3use File::Basename;
4 4
@@ -29,27 +29,151 @@ my $filename = $vmlinux_name;
29my $target = "0"; 29my $target = "0";
30my $function; 30my $function;
31my $module = ""; 31my $module = "";
32my $func_offset; 32my $func_offset = 0;
33my $vmaoffset = 0; 33my $vmaoffset = 0;
34 34
35my %regs;
36
37
38sub parse_x86_regs
39{
40 my ($line) = @_;
41 if ($line =~ /EAX: ([0-9a-f]+) EBX: ([0-9a-f]+) ECX: ([0-9a-f]+) EDX: ([0-9a-f]+)/) {
42 $regs{"%eax"} = $1;
43 $regs{"%ebx"} = $2;
44 $regs{"%ecx"} = $3;
45 $regs{"%edx"} = $4;
46 }
47 if ($line =~ /ESI: ([0-9a-f]+) EDI: ([0-9a-f]+) EBP: ([0-9a-f]+) ESP: ([0-9a-f]+)/) {
48 $regs{"%esi"} = $1;
49 $regs{"%edi"} = $2;
50 $regs{"%esp"} = $4;
51 }
52 if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) {
53 $regs{"%eax"} = $1;
54 $regs{"%ebx"} = $2;
55 $regs{"%ecx"} = $3;
56 }
57 if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) {
58 $regs{"%edx"} = $1;
59 $regs{"%esi"} = $2;
60 $regs{"%edi"} = $3;
61 }
62 if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) {
63 $regs{"%r08"} = $2;
64 $regs{"%r09"} = $3;
65 }
66 if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) {
67 $regs{"%r10"} = $1;
68 $regs{"%r11"} = $2;
69 $regs{"%r12"} = $3;
70 }
71 if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) {
72 $regs{"%r13"} = $1;
73 $regs{"%r14"} = $2;
74 $regs{"%r15"} = $3;
75 }
76}
77
78sub reg_name
79{
80 my ($reg) = @_;
81 $reg =~ s/r(.)x/e\1x/;
82 $reg =~ s/r(.)i/e\1i/;
83 $reg =~ s/r(.)p/e\1p/;
84 return $reg;
85}
86
87sub process_x86_regs
88{
89 my ($line, $cntr) = @_;
90 my $str = "";
91 if (length($line) < 40) {
92 return ""; # not an asm istruction
93 }
94
95 # find the arguments to the instruction
96 if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) {
97 $lastword = $1;
98 } else {
99 return "";
100 }
101
102 # we need to find the registers that get clobbered,
103 # since their value is no longer relevant for previous
104 # instructions in the stream.
105
106 $clobber = $lastword;
107 # first, remove all memory operands, they're read only
108 $clobber =~ s/\([a-z0-9\%\,]+\)//g;
109 # then, remove everything before the comma, thats the read part
110 $clobber =~ s/.*\,//g;
111
112 # if this is the instruction that faulted, we haven't actually done
113 # the write yet... nothing is clobbered.
114 if ($cntr == 0) {
115 $clobber = "";
116 }
117
118 foreach $reg (keys(%regs)) {
119 my $clobberprime = reg_name($clobber);
120 my $lastwordprime = reg_name($lastword);
121 my $val = $regs{$reg};
122 if ($val =~ /^[0]+$/) {
123 $val = "0";
124 } else {
125 $val =~ s/^0*//;
126 }
127
128 # first check if we're clobbering this register; if we do
129 # we print it with a =>, and then delete its value
130 if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) {
131 if (length($val) > 0) {
132 $str = $str . " $reg => $val ";
133 }
134 $regs{$reg} = "";
135 $val = "";
136 }
137 # now check if we're reading this register
138 if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) {
139 if (length($val) > 0) {
140 $str = $str . " $reg = $val ";
141 }
142 }
143 }
144 return $str;
145}
146
147# parse the oops
35while (<STDIN>) { 148while (<STDIN>) {
36 my $line = $_; 149 my $line = $_;
37 if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { 150 if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) {
38 $target = $1; 151 $target = $1;
39 } 152 }
153 if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) {
154 $target = $1;
155 }
40 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { 156 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
41 $function = $1; 157 $function = $1;
42 $func_offset = $2; 158 $func_offset = $2;
43 } 159 }
160 if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
161 $function = $1;
162 $func_offset = $2;
163 }
44 164
45 # check if it's a module 165 # check if it's a module
46 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { 166 if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {
47 $module = $3; 167 $module = $3;
48 } 168 }
169 if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {
170 $module = $3;
171 }
172 parse_x86_regs($line);
49} 173}
50 174
51my $decodestart = hex($target) - hex($func_offset); 175my $decodestart = hex($target) - hex($func_offset);
52my $decodestop = $decodestart + 8192; 176my $decodestop = hex($target) + 8192;
53if ($target eq "0") { 177if ($target eq "0") {
54 print "No oops found!\n"; 178 print "No oops found!\n";
55 print "Usage: \n"; 179 print "Usage: \n";
@@ -84,6 +208,7 @@ my $counter = 0;
84my $state = 0; 208my $state = 0;
85my $center = 0; 209my $center = 0;
86my @lines; 210my @lines;
211my @reglines;
87 212
88sub InRange { 213sub InRange {
89 my ($address, $target) = @_; 214 my ($address, $target) = @_;
@@ -188,16 +313,36 @@ while ($finish < $counter) {
188 313
189my $i; 314my $i;
190 315
191my $fulltext = ""; 316
317# start annotating the registers in the asm.
318# this goes from the oopsing point back, so that the annotator
319# can track (opportunistically) which registers got written and
320# whos value no longer is relevant.
321
322$i = $center;
323while ($i >= $start) {
324 $reglines[$i] = process_x86_regs($lines[$i], $center - $i);
325 $i = $i - 1;
326}
327
192$i = $start; 328$i = $start;
193while ($i < $finish) { 329while ($i < $finish) {
330 my $line;
194 if ($i == $center) { 331 if ($i == $center) {
195 $fulltext = $fulltext . "*$lines[$i] <----- faulting instruction\n"; 332 $line = "*$lines[$i] ";
196 } else { 333 } else {
197 $fulltext = $fulltext . " $lines[$i]\n"; 334 $line = " $lines[$i] ";
335 }
336 print $line;
337 if (defined($reglines[$i]) && length($reglines[$i]) > 0) {
338 my $c = 60 - length($line);
339 while ($c > 0) { print " "; $c = $c - 1; };
340 print "| $reglines[$i]";
198 } 341 }
342 if ($i == $center) {
343 print "<--- faulting instruction";
344 }
345 print "\n";
199 $i = $i +1; 346 $i = $i +1;
200} 347}
201 348
202print $fulltext;
203
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 491b8b1b6abf..4eea60b1693e 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size,
210static int do_hid_entry(const char *filename, 210static int do_hid_entry(const char *filename,
211 struct hid_device_id *id, char *alias) 211 struct hid_device_id *id, char *alias)
212{ 212{
213 id->bus = TO_NATIVE(id->bus);
213 id->vendor = TO_NATIVE(id->vendor); 214 id->vendor = TO_NATIVE(id->vendor);
214 id->product = TO_NATIVE(id->product); 215 id->product = TO_NATIVE(id->product);
215 216
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 8c6b7b09606a..fa4a0a17b7e0 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -35,9 +35,10 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
35rpm-pkg rpm: $(objtree)/kernel.spec FORCE 35rpm-pkg rpm: $(objtree)/kernel.spec FORCE
36 $(MAKE) clean 36 $(MAKE) clean
37 $(PREV) ln -sf $(srctree) $(KERNELPATH) 37 $(PREV) ln -sf $(srctree) $(KERNELPATH)
38 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion
38 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. 39 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
39 $(PREV) rm $(KERNELPATH) 40 $(PREV) rm $(KERNELPATH)
40 41 rm -f $(objtree)/.scmversion
41 set -e; \ 42 set -e; \
42 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 43 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
43 set -e; \ 44 set -e; \
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 2500886fb90a..3d93f8c81252 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -86,9 +86,17 @@ echo "%endif"
86echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" 86echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
87 87
88echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" 88echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
89
90echo "%ifnarch ppc64"
91echo 'cp vmlinux vmlinux.orig'
92echo 'bzip2 -9 vmlinux'
93echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
94echo 'mv vmlinux.orig vmlinux'
95echo "%endif"
96
89echo "" 97echo ""
90echo "%clean" 98echo "%clean"
91echo '#echo -rf $RPM_BUILD_ROOT' 99echo 'rm -rf $RPM_BUILD_ROOT'
92echo "" 100echo ""
93echo "%files" 101echo "%files"
94echo '%defattr (-, root, root)' 102echo '%defattr (-, root, root)'
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index f6946cf99ce1..f1c4b35bc324 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -58,14 +58,7 @@ fi
58# Check for svn and a svn repo. 58# Check for svn and a svn repo.
59if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then 59if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
60 rev=`echo $rev | awk '{print $NF}'` 60 rev=`echo $rev | awk '{print $NF}'`
61 changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` 61 printf -- '-svn%s' "$rev"
62
63 # Are there uncommitted changes?
64 if [ $changes != 0 ]; then
65 printf -- '-svn%s%s' "$rev" -dirty
66 else
67 printf -- '-svn%s' "$rev"
68 fi
69 62
70 # All done with svn 63 # All done with svn
71 exit 64 exit
diff --git a/scripts/tags.sh b/scripts/tags.sh
index fdbe78bb5e2b..5bd8b1003d44 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -76,7 +76,10 @@ all_sources()
76 76
77all_kconfigs() 77all_kconfigs()
78{ 78{
79 find_sources $ALLSOURCE_ARCHS 'Kconfig*' 79 for arch in $ALLSOURCE_ARCHS; do
80 find_sources $arch 'Kconfig*'
81 done
82 find_other_sources 'Kconfig*'
80} 83}
81 84
82all_defconfigs() 85all_defconfigs()
@@ -99,7 +102,8 @@ exuberant()
99 -I ____cacheline_internodealigned_in_smp \ 102 -I ____cacheline_internodealigned_in_smp \
100 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 103 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
101 --extra=+f --c-kinds=+px \ 104 --extra=+f --c-kinds=+px \
102 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' 105 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \
106 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/'
103 107
104 all_kconfigs | xargs $1 -a \ 108 all_kconfigs | xargs $1 -a \
105 --langdef=kconfig --language-force=kconfig \ 109 --langdef=kconfig --language-force=kconfig \
@@ -117,7 +121,9 @@ exuberant()
117 121
118emacs() 122emacs()
119{ 123{
120 all_sources | xargs $1 -a 124 all_sources | xargs $1 -a \
125 --regex='/^ENTRY(\([^)]*\)).*/\1/' \
126 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'
121 127
122 all_kconfigs | xargs $1 -a \ 128 all_kconfigs | xargs $1 -a \
123 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' 129 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 552025e72acb..05a31a6c7e1b 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -206,7 +206,7 @@ static void done(void);
206static void error(const char *); 206static void error(const char *);
207static int findsym(const char *); 207static int findsym(const char *);
208static void flushline(bool); 208static void flushline(bool);
209static Linetype getline(void); 209static Linetype get_line(void);
210static Linetype ifeval(const char **); 210static Linetype ifeval(const char **);
211static void ignoreoff(void); 211static void ignoreoff(void);
212static void ignoreon(void); 212static void ignoreon(void);
@@ -512,7 +512,7 @@ process(void)
512 512
513 for (;;) { 513 for (;;) {
514 linenum++; 514 linenum++;
515 lineval = getline(); 515 lineval = get_line();
516 trans_table[ifstate[depth]][lineval](); 516 trans_table[ifstate[depth]][lineval]();
517 debug("process %s -> %s depth %d", 517 debug("process %s -> %s depth %d",
518 linetype_name[lineval], 518 linetype_name[lineval],
@@ -526,7 +526,7 @@ process(void)
526 * help from skipcomment(). 526 * help from skipcomment().
527 */ 527 */
528static Linetype 528static Linetype
529getline(void) 529get_line(void)
530{ 530{
531 const char *cp; 531 const char *cp;
532 int cursym; 532 int cursym;
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
index f58701a7b728..350794ab9b42 100644
--- a/security/selinux/netlabel.c
+++ b/security/selinux/netlabel.c
@@ -386,11 +386,12 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)
386 if (!S_ISSOCK(inode->i_mode) || 386 if (!S_ISSOCK(inode->i_mode) ||
387 ((mask & (MAY_WRITE | MAY_APPEND)) == 0)) 387 ((mask & (MAY_WRITE | MAY_APPEND)) == 0))
388 return 0; 388 return 0;
389
390 sock = SOCKET_I(inode); 389 sock = SOCKET_I(inode);
391 sk = sock->sk; 390 sk = sock->sk;
391 if (sk == NULL)
392 return 0;
392 sksec = sk->sk_security; 393 sksec = sk->sk_security;
393 if (sksec->nlbl_state != NLBL_REQUIRE) 394 if (sksec == NULL || sksec->nlbl_state != NLBL_REQUIRE)
394 return 0; 395 return 0;
395 396
396 local_bh_disable(); 397 local_bh_disable();
@@ -490,8 +491,10 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock,
490 lock_sock(sk); 491 lock_sock(sk);
491 rc = netlbl_sock_getattr(sk, &secattr); 492 rc = netlbl_sock_getattr(sk, &secattr);
492 release_sock(sk); 493 release_sock(sk);
493 if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) 494 if (rc == 0)
494 rc = -EACCES; 495 rc = -EACCES;
496 else if (rc == -ENOMSG)
497 rc = 0;
495 netlbl_secattr_destroy(&secattr); 498 netlbl_secattr_destroy(&secattr);
496 } 499 }
497 500
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 0278bc083044..e7ded1326b0f 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1498,58 +1498,31 @@ static int smack_socket_post_create(struct socket *sock, int family,
1498 * looks for host based access restrictions 1498 * looks for host based access restrictions
1499 * 1499 *
1500 * This version will only be appropriate for really small 1500 * This version will only be appropriate for really small
1501 * sets of single label hosts. Because of the masking 1501 * sets of single label hosts.
1502 * it cannot shortcut out on the first match. There are
1503 * numerious ways to address the problem, but none of them
1504 * have been applied here.
1505 * 1502 *
1506 * Returns the label of the far end or NULL if it's not special. 1503 * Returns the label of the far end or NULL if it's not special.
1507 */ 1504 */
1508static char *smack_host_label(struct sockaddr_in *sip) 1505static char *smack_host_label(struct sockaddr_in *sip)
1509{ 1506{
1510 struct smk_netlbladdr *snp; 1507 struct smk_netlbladdr *snp;
1511 char *bestlabel = NULL;
1512 struct in_addr *siap = &sip->sin_addr; 1508 struct in_addr *siap = &sip->sin_addr;
1513 struct in_addr *liap;
1514 struct in_addr *miap;
1515 struct in_addr bestmask;
1516 1509
1517 if (siap->s_addr == 0) 1510 if (siap->s_addr == 0)
1518 return NULL; 1511 return NULL;
1519 1512
1520 bestmask.s_addr = 0;
1521
1522 for (snp = smack_netlbladdrs; snp != NULL; snp = snp->smk_next) { 1513 for (snp = smack_netlbladdrs; snp != NULL; snp = snp->smk_next) {
1523 liap = &snp->smk_host.sin_addr;
1524 miap = &snp->smk_mask;
1525 /*
1526 * If the addresses match after applying the list entry mask
1527 * the entry matches the address. If it doesn't move along to
1528 * the next entry.
1529 */
1530 if ((liap->s_addr & miap->s_addr) !=
1531 (siap->s_addr & miap->s_addr))
1532 continue;
1533 /* 1514 /*
1534 * If the list entry mask identifies a single address 1515 * we break after finding the first match because
1535 * it can't get any more specific. 1516 * the list is sorted from longest to shortest mask
1517 * so we have found the most specific match
1536 */ 1518 */
1537 if (miap->s_addr == 0xffffffff) 1519 if ((&snp->smk_host.sin_addr)->s_addr ==
1520 (siap->s_addr & (&snp->smk_mask)->s_addr)) {
1538 return snp->smk_label; 1521 return snp->smk_label;
1539 /* 1522 }
1540 * If the list entry mask is less specific than the best
1541 * already found this entry is uninteresting.
1542 */
1543 if ((miap->s_addr | bestmask.s_addr) == bestmask.s_addr)
1544 continue;
1545 /*
1546 * This is better than any entry found so far.
1547 */
1548 bestmask.s_addr = miap->s_addr;
1549 bestlabel = snp->smk_label;
1550 } 1523 }
1551 1524
1552 return bestlabel; 1525 return NULL;
1553} 1526}
1554 1527
1555/** 1528/**
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 8e42800878f4..51f0efc50dab 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -650,10 +650,6 @@ static void *netlbladdr_seq_next(struct seq_file *s, void *v, loff_t *pos)
650 650
651 return skp; 651 return skp;
652} 652}
653/*
654#define BEMASK 0x80000000
655*/
656#define BEMASK 0x00000001
657#define BEBITS (sizeof(__be32) * 8) 653#define BEBITS (sizeof(__be32) * 8)
658 654
659/* 655/*
@@ -663,12 +659,10 @@ static int netlbladdr_seq_show(struct seq_file *s, void *v)
663{ 659{
664 struct smk_netlbladdr *skp = (struct smk_netlbladdr *) v; 660 struct smk_netlbladdr *skp = (struct smk_netlbladdr *) v;
665 unsigned char *hp = (char *) &skp->smk_host.sin_addr.s_addr; 661 unsigned char *hp = (char *) &skp->smk_host.sin_addr.s_addr;
666 __be32 bebits; 662 int maskn;
667 int maskn = 0; 663 u32 temp_mask = be32_to_cpu(skp->smk_mask.s_addr);
668 664
669 for (bebits = BEMASK; bebits != 0; maskn++, bebits <<= 1) 665 for (maskn = 0; temp_mask; temp_mask <<= 1, maskn++);
670 if ((skp->smk_mask.s_addr & bebits) == 0)
671 break;
672 666
673 seq_printf(s, "%u.%u.%u.%u/%d %s\n", 667 seq_printf(s, "%u.%u.%u.%u/%d %s\n",
674 hp[0], hp[1], hp[2], hp[3], maskn, skp->smk_label); 668 hp[0], hp[1], hp[2], hp[3], maskn, skp->smk_label);
@@ -702,6 +696,42 @@ static int smk_open_netlbladdr(struct inode *inode, struct file *file)
702} 696}
703 697
704/** 698/**
699 * smk_netlbladdr_insert
700 * @new : netlabel to insert
701 *
702 * This helper insert netlabel in the smack_netlbladdrs list
703 * sorted by netmask length (longest to smallest)
704 */
705static void smk_netlbladdr_insert(struct smk_netlbladdr *new)
706{
707 struct smk_netlbladdr *m;
708
709 if (smack_netlbladdrs == NULL) {
710 smack_netlbladdrs = new;
711 return;
712 }
713
714 /* the comparison '>' is a bit hacky, but works */
715 if (new->smk_mask.s_addr > smack_netlbladdrs->smk_mask.s_addr) {
716 new->smk_next = smack_netlbladdrs;
717 smack_netlbladdrs = new;
718 return;
719 }
720 for (m = smack_netlbladdrs; m != NULL; m = m->smk_next) {
721 if (m->smk_next == NULL) {
722 m->smk_next = new;
723 return;
724 }
725 if (new->smk_mask.s_addr > m->smk_next->smk_mask.s_addr) {
726 new->smk_next = m->smk_next;
727 m->smk_next = new;
728 return;
729 }
730 }
731}
732
733
734/**
705 * smk_write_netlbladdr - write() for /smack/netlabel 735 * smk_write_netlbladdr - write() for /smack/netlabel
706 * @filp: file pointer, not actually used 736 * @filp: file pointer, not actually used
707 * @buf: where to get the data from 737 * @buf: where to get the data from
@@ -724,8 +754,9 @@ static ssize_t smk_write_netlbladdr(struct file *file, const char __user *buf,
724 struct netlbl_audit audit_info; 754 struct netlbl_audit audit_info;
725 struct in_addr mask; 755 struct in_addr mask;
726 unsigned int m; 756 unsigned int m;
727 __be32 bebits = BEMASK; 757 u32 mask_bits = (1<<31);
728 __be32 nsa; 758 __be32 nsa;
759 u32 temp_mask;
729 760
730 /* 761 /*
731 * Must have privilege. 762 * Must have privilege.
@@ -761,10 +792,13 @@ static ssize_t smk_write_netlbladdr(struct file *file, const char __user *buf,
761 if (sp == NULL) 792 if (sp == NULL)
762 return -EINVAL; 793 return -EINVAL;
763 794
764 for (mask.s_addr = 0; m > 0; m--) { 795 for (temp_mask = 0; m > 0; m--) {
765 mask.s_addr |= bebits; 796 temp_mask |= mask_bits;
766 bebits <<= 1; 797 mask_bits >>= 1;
767 } 798 }
799 mask.s_addr = cpu_to_be32(temp_mask);
800
801 newname.sin_addr.s_addr &= mask.s_addr;
768 /* 802 /*
769 * Only allow one writer at a time. Writes should be 803 * Only allow one writer at a time. Writes should be
770 * quite rare and small in any case. 804 * quite rare and small in any case.
@@ -772,6 +806,7 @@ static ssize_t smk_write_netlbladdr(struct file *file, const char __user *buf,
772 mutex_lock(&smk_netlbladdr_lock); 806 mutex_lock(&smk_netlbladdr_lock);
773 807
774 nsa = newname.sin_addr.s_addr; 808 nsa = newname.sin_addr.s_addr;
809 /* try to find if the prefix is already in the list */
775 for (skp = smack_netlbladdrs; skp != NULL; skp = skp->smk_next) 810 for (skp = smack_netlbladdrs; skp != NULL; skp = skp->smk_next)
776 if (skp->smk_host.sin_addr.s_addr == nsa && 811 if (skp->smk_host.sin_addr.s_addr == nsa &&
777 skp->smk_mask.s_addr == mask.s_addr) 812 skp->smk_mask.s_addr == mask.s_addr)
@@ -787,9 +822,8 @@ static ssize_t smk_write_netlbladdr(struct file *file, const char __user *buf,
787 rc = 0; 822 rc = 0;
788 skp->smk_host.sin_addr.s_addr = newname.sin_addr.s_addr; 823 skp->smk_host.sin_addr.s_addr = newname.sin_addr.s_addr;
789 skp->smk_mask.s_addr = mask.s_addr; 824 skp->smk_mask.s_addr = mask.s_addr;
790 skp->smk_next = smack_netlbladdrs;
791 skp->smk_label = sp; 825 skp->smk_label = sp;
792 smack_netlbladdrs = skp; 826 smk_netlbladdr_insert(skp);
793 } 827 }
794 } else { 828 } else {
795 rc = netlbl_cfg_unlbl_static_del(&init_net, NULL, 829 rc = netlbl_cfg_unlbl_static_del(&init_net, NULL,
diff --git a/sound/core/jack.c b/sound/core/jack.c
index dd4a12dc09aa..077a85262c1c 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -47,7 +47,7 @@ static int snd_jack_dev_register(struct snd_device *device)
47 int err; 47 int err;
48 48
49 snprintf(jack->name, sizeof(jack->name), "%s %s", 49 snprintf(jack->name, sizeof(jack->name), "%s %s",
50 card->longname, jack->id); 50 card->shortname, jack->id);
51 jack->input_dev->name = jack->name; 51 jack->input_dev->name = jack->name;
52 52
53 /* Default to the sound card device. */ 53 /* Default to the sound card device. */
diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c
index a466443c4a26..2fa9299a440d 100644
--- a/sound/core/oss/rate.c
+++ b/sound/core/oss/rate.c
@@ -157,7 +157,7 @@ static void resample_shrink(struct snd_pcm_plugin *plugin,
157 while (dst_frames1 > 0) { 157 while (dst_frames1 > 0) {
158 S1 = S2; 158 S1 = S2;
159 if (src_frames1-- > 0) { 159 if (src_frames1-- > 0) {
160 S1 = *src; 160 S2 = *src;
161 src += src_step; 161 src += src_step;
162 } 162 }
163 if (pos & ~R_MASK) { 163 if (pos & ~R_MASK) {
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index 5b89c0883d60..48b64e6b2670 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -706,7 +706,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
706 mtp_card->card = card; 706 mtp_card->card = card;
707 mtp_card->irq = -1; 707 mtp_card->irq = -1;
708 mtp_card->share_irq = 0; 708 mtp_card->share_irq = 0;
709 mtp_card->inmidiport = 0xffffffff;
710 mtp_card->inmidistate = 0; 709 mtp_card->inmidistate = 0;
711 mtp_card->outmidihwport = 0xffffffff; 710 mtp_card->outmidihwport = 0xffffffff;
712 init_timer(&mtp_card->timer); 711 init_timer(&mtp_card->timer);
@@ -719,6 +718,8 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
719 if (err < 0) 718 if (err < 0)
720 goto __error; 719 goto __error;
721 720
721 mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST;
722
722 err = snd_mtpav_get_ISA(mtp_card); 723 err = snd_mtpav_get_ISA(mtp_card);
723 if (err < 0) 724 if (err < 0)
724 goto __error; 725 goto __error;
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c
index 57d9f154c88b..38931f2f6967 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -847,23 +847,23 @@ static int __init AtaIrqInit(void)
847 of events. So all we need to keep the music playing is 847 of events. So all we need to keep the music playing is
848 to provide the sound hardware with new data upon 848 to provide the sound hardware with new data upon
849 an interrupt from timer A. */ 849 an interrupt from timer A. */
850 mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ 850 st_mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */
851 mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ 851 st_mfp.tim_dt_a = 1; /* Cause interrupt after first event. */
852 mfp.tim_ct_a = 8; /* Turn on event counting. */ 852 st_mfp.tim_ct_a = 8; /* Turn on event counting. */
853 /* Register interrupt handler. */ 853 /* Register interrupt handler. */
854 if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", 854 if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound",
855 AtaInterrupt)) 855 AtaInterrupt))
856 return 0; 856 return 0;
857 mfp.int_en_a |= 0x20; /* Turn interrupt on. */ 857 st_mfp.int_en_a |= 0x20; /* Turn interrupt on. */
858 mfp.int_mk_a |= 0x20; 858 st_mfp.int_mk_a |= 0x20;
859 return 1; 859 return 1;
860} 860}
861 861
862#ifdef MODULE 862#ifdef MODULE
863static void AtaIrqCleanUp(void) 863static void AtaIrqCleanUp(void)
864{ 864{
865 mfp.tim_ct_a = 0; /* stop timer */ 865 st_mfp.tim_ct_a = 0; /* stop timer */
866 mfp.int_en_a &= ~0x20; /* turn interrupt off */ 866 st_mfp.int_en_a &= ~0x20; /* turn interrupt off */
867 free_irq(IRQ_MFP_TIMA, AtaInterrupt); 867 free_irq(IRQ_MFP_TIMA, AtaInterrupt);
868} 868}
869#endif /* MODULE */ 869#endif /* MODULE */
@@ -1599,7 +1599,7 @@ static int __init dmasound_atari_init(void)
1599 is_falcon = 0; 1599 is_falcon = 0;
1600 } else 1600 } else
1601 return -ENODEV; 1601 return -ENODEV;
1602 if ((mfp.int_en_a & mfp.int_mk_a & 0x20) == 0) 1602 if ((st_mfp.int_en_a & st_mfp.int_mk_a & 0x20) == 0)
1603 return dmasound_init(); 1603 return dmasound_init();
1604 else { 1604 else {
1605 printk("DMA sound driver: Timer A interrupt already in use\n"); 1605 printk("DMA sound driver: Timer A interrupt already in use\n");
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 3f00ddf450f8..c7c54e7748e9 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -165,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444);
165MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); 165MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");
166 166
167static struct pci_device_id snd_aw2_ids[] = { 167static struct pci_device_id snd_aw2_ids[] = {
168 {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID, 168 {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0,
169 0, 0, 0}, 169 0, 0, 0},
170 {0} 170 {0}
171}; 171};
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 7958006a1d66..101a1c13a20d 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1528,6 +1528,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1528 .ca0151_chip = 1, 1528 .ca0151_chip = 1,
1529 .spk71 = 1, 1529 .spk71 = 1,
1530 .spdif_bug = 1, 1530 .spdif_bug = 1,
1531 .invert_shared_spdif = 1, /* digital/analog switch swapped */
1531 .ac97_chip = 1} , 1532 .ac97_chip = 1} ,
1532 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, 1533 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102,
1533 .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]", 1534 .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]",
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 0b708134d12f..d03f99298be9 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3088,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
3088} 3088}
3089EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); 3089EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);
3090 3090
3091int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
3092 struct hda_multi_out *mout)
3093{
3094 mutex_lock(&codec->spdif_mutex);
3095 cleanup_dig_out_stream(codec, mout->dig_out_nid);
3096 mutex_unlock(&codec->spdif_mutex);
3097 return 0;
3098}
3099EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup);
3100
3091/* 3101/*
3092 * release the digital out 3102 * release the digital out
3093 */ 3103 */
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 300ab407cf42..4ae51dcb81af 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -175,7 +175,7 @@ static int reconfig_codec(struct hda_codec *codec)
175 err = snd_hda_codec_build_controls(codec); 175 err = snd_hda_codec_build_controls(codec);
176 if (err < 0) 176 if (err < 0)
177 return err; 177 return err;
178 return 0; 178 return snd_card_register(codec->bus->card);
179} 179}
180 180
181/* 181/*
@@ -277,18 +277,19 @@ static ssize_t init_verbs_store(struct device *dev,
277{ 277{
278 struct snd_hwdep *hwdep = dev_get_drvdata(dev); 278 struct snd_hwdep *hwdep = dev_get_drvdata(dev);
279 struct hda_codec *codec = hwdep->private_data; 279 struct hda_codec *codec = hwdep->private_data;
280 char *p; 280 struct hda_verb *v;
281 struct hda_verb verb, *v; 281 int nid, verb, param;
282 282
283 verb.nid = simple_strtoul(buf, &p, 0); 283 if (sscanf(buf, "%i %i %i", &nid, &verb, &param) != 3)
284 verb.verb = simple_strtoul(p, &p, 0); 284 return -EINVAL;
285 verb.param = simple_strtoul(p, &p, 0); 285 if (!nid || !verb)
286 if (!verb.nid || !verb.verb || !verb.param)
287 return -EINVAL; 286 return -EINVAL;
288 v = snd_array_new(&codec->init_verbs); 287 v = snd_array_new(&codec->init_verbs);
289 if (!v) 288 if (!v)
290 return -ENOMEM; 289 return -ENOMEM;
291 *v = verb; 290 v->nid = nid;
291 v->verb = verb;
292 v->param = param;
292 return count; 293 return count;
293} 294}
294 295
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 11e791b965f6..5e909e0da04b 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1947,16 +1947,13 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
1947 return 0; 1947 return 0;
1948} 1948}
1949 1949
1950static int azx_resume_early(struct pci_dev *pci)
1951{
1952 return pci_restore_state(pci);
1953}
1954
1955static int azx_resume(struct pci_dev *pci) 1950static int azx_resume(struct pci_dev *pci)
1956{ 1951{
1957 struct snd_card *card = pci_get_drvdata(pci); 1952 struct snd_card *card = pci_get_drvdata(pci);
1958 struct azx *chip = card->private_data; 1953 struct azx *chip = card->private_data;
1959 1954
1955 pci_set_power_state(pci, PCI_D0);
1956 pci_restore_state(pci);
1960 if (pci_enable_device(pci) < 0) { 1957 if (pci_enable_device(pci) < 0) {
1961 printk(KERN_ERR "hda-intel: pci_enable_device failed, " 1958 printk(KERN_ERR "hda-intel: pci_enable_device failed, "
1962 "disabling device\n"); 1959 "disabling device\n");
@@ -2098,6 +2095,8 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = {
2098 SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), 2095 SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01),
2099 /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ 2096 /* including bogus ALC268 in slot#2 that conflicts with ALC888 */
2100 SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), 2097 SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01),
2098 /* conflict of ALC268 in slot#3 (digital I/O); a temporary fix */
2099 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba laptop", 0x03),
2101 {} 2100 {}
2102}; 2101};
2103 2102
@@ -2468,7 +2467,6 @@ static struct pci_driver driver = {
2468 .remove = __devexit_p(azx_remove), 2467 .remove = __devexit_p(azx_remove),
2469#ifdef CONFIG_PM 2468#ifdef CONFIG_PM
2470 .suspend = azx_suspend, 2469 .suspend = azx_suspend,
2471 .resume_early = azx_resume_early,
2472 .resume = azx_resume, 2470 .resume = azx_resume,
2473#endif 2471#endif
2474}; 2472};
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 1dd8716c387f..44f189cb97ae 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
251 unsigned int stream_tag, 251 unsigned int stream_tag,
252 unsigned int format, 252 unsigned int format,
253 struct snd_pcm_substream *substream); 253 struct snd_pcm_substream *substream);
254int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
255 struct hda_multi_out *mout);
254int snd_hda_multi_out_analog_open(struct hda_codec *codec, 256int snd_hda_multi_out_analog_open(struct hda_codec *codec,
255 struct hda_multi_out *mout, 257 struct hda_multi_out *mout,
256 struct snd_pcm_substream *substream, 258 struct snd_pcm_substream *substream,
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2e7371ec2e23..e48612323aa0 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
275 format, substream); 275 format, substream);
276} 276}
277 277
278static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
279 struct hda_codec *codec,
280 struct snd_pcm_substream *substream)
281{
282 struct ad198x_spec *spec = codec->spec;
283 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
284}
285
278/* 286/*
279 * Analog capture 287 * Analog capture
280 */ 288 */
@@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = {
333 .ops = { 341 .ops = {
334 .open = ad198x_dig_playback_pcm_open, 342 .open = ad198x_dig_playback_pcm_open,
335 .close = ad198x_dig_playback_pcm_close, 343 .close = ad198x_dig_playback_pcm_close,
336 .prepare = ad198x_dig_playback_pcm_prepare 344 .prepare = ad198x_dig_playback_pcm_prepare,
345 .cleanup = ad198x_dig_playback_pcm_cleanup
337 }, 346 },
338}; 347};
339 348
@@ -1885,8 +1894,8 @@ static hda_nid_t ad1988_capsrc_nids[3] = {
1885#define AD1988_SPDIF_OUT_HDMI 0x0b 1894#define AD1988_SPDIF_OUT_HDMI 0x0b
1886#define AD1988_SPDIF_IN 0x07 1895#define AD1988_SPDIF_IN 0x07
1887 1896
1888static hda_nid_t ad1989b_slave_dig_outs[2] = { 1897static hda_nid_t ad1989b_slave_dig_outs[] = {
1889 AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI 1898 AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0
1890}; 1899};
1891 1900
1892static struct hda_input_mux ad1988_6stack_capture_source = { 1901static struct hda_input_mux ad1988_6stack_capture_source = {
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c
index 3564f4e4b74c..fcc77fec4487 100644
--- a/sound/pci/hda/patch_intelhdmi.c
+++ b/sound/pci/hda/patch_intelhdmi.c
@@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_verb[] = {
49 {} /* terminator */ 49 {} /* terminator */
50}; 50};
51 51
52static struct hda_verb pinout_disable_verb[] = {
53 {PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00},
54 {}
55};
56
57static struct hda_verb unsolicited_response_verb[] = { 52static struct hda_verb unsolicited_response_verb[] = {
58 {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 53 {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN |
59 INTEL_HDMI_EVENT_TAG}, 54 INTEL_HDMI_EVENT_TAG},
@@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid,
248 243
249static void hdmi_enable_output(struct hda_codec *codec) 244static void hdmi_enable_output(struct hda_codec *codec)
250{ 245{
251 /* Enable Audio InfoFrame Transmission */
252 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
253 snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
254 AC_DIPXMIT_BEST);
255 /* Unmute */ 246 /* Unmute */
256 if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) 247 if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP)
257 snd_hda_codec_write(codec, PIN_NID, 0, 248 snd_hda_codec_write(codec, PIN_NID, 0,
@@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hda_codec *codec)
260 snd_hda_sequence_write(codec, pinout_enable_verb); 251 snd_hda_sequence_write(codec, pinout_enable_verb);
261} 252}
262 253
263static void hdmi_disable_output(struct hda_codec *codec) 254/*
255 * Enable Audio InfoFrame Transmission
256 */
257static void hdmi_start_infoframe_trans(struct hda_codec *codec)
264{ 258{
265 snd_hda_sequence_write(codec, pinout_disable_verb); 259 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
266 if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) 260 snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
267 snd_hda_codec_write(codec, PIN_NID, 0, 261 AC_DIPXMIT_BEST);
268 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 262}
269 263
270 /* 264/*
271 * FIXME: noises may arise when playing music after reloading the 265 * Disable Audio InfoFrame Transmission
272 * kernel module, until the next X restart or monitor repower. 266 */
273 */ 267static void hdmi_stop_infoframe_trans(struct hda_codec *codec)
268{
269 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
270 snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
271 AC_DIPXMIT_DISABLE);
274} 272}
275 273
276static int hdmi_get_channel_count(struct hda_codec *codec) 274static int hdmi_get_channel_count(struct hda_codec *codec)
@@ -368,11 +366,16 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec,
368 struct hdmi_audio_infoframe *ai) 366 struct hdmi_audio_infoframe *ai)
369{ 367{
370 u8 *params = (u8 *)ai; 368 u8 *params = (u8 *)ai;
369 u8 sum = 0;
371 int i; 370 int i;
372 371
373 hdmi_debug_dip_size(codec); 372 hdmi_debug_dip_size(codec);
374 hdmi_clear_dip_buffers(codec); /* be paranoid */ 373 hdmi_clear_dip_buffers(codec); /* be paranoid */
375 374
375 for (i = 0; i < sizeof(ai); i++)
376 sum += params[i];
377 ai->checksum = - sum;
378
376 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); 379 hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
377 for (i = 0; i < sizeof(ai); i++) 380 for (i = 0; i < sizeof(ai); i++)
378 hdmi_write_dip_byte(codec, PIN_NID, params[i]); 381 hdmi_write_dip_byte(codec, PIN_NID, params[i]);
@@ -419,14 +422,18 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec,
419 /* 422 /*
420 * CA defaults to 0 for basic stereo audio 423 * CA defaults to 0 for basic stereo audio
421 */ 424 */
422 if (!eld->eld_ver)
423 return 0;
424 if (!eld->spk_alloc)
425 return 0;
426 if (channels <= 2) 425 if (channels <= 2)
427 return 0; 426 return 0;
428 427
429 /* 428 /*
429 * HDMI sink's ELD info cannot always be retrieved for now, e.g.
430 * in console or for audio devices. Assume the highest speakers
431 * configuration, to _not_ prohibit multi-channel audio playback.
432 */
433 if (!eld->spk_alloc)
434 eld->spk_alloc = 0xffff;
435
436 /*
430 * expand ELD's speaker allocation mask 437 * expand ELD's speaker allocation mask
431 * 438 *
432 * ELD tells the speaker mask in a compact(paired) form, 439 * ELD tells the speaker mask in a compact(paired) form,
@@ -485,6 +492,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
485 hdmi_setup_channel_mapping(codec, &ai); 492 hdmi_setup_channel_mapping(codec, &ai);
486 493
487 hdmi_fill_audio_infoframe(codec, &ai); 494 hdmi_fill_audio_infoframe(codec, &ai);
495 hdmi_start_infoframe_trans(codec);
488} 496}
489 497
490 498
@@ -562,7 +570,7 @@ static int intel_hdmi_playback_pcm_close(struct hda_pcm_stream *hinfo,
562{ 570{
563 struct intel_hdmi_spec *spec = codec->spec; 571 struct intel_hdmi_spec *spec = codec->spec;
564 572
565 hdmi_disable_output(codec); 573 hdmi_stop_infoframe_trans(codec);
566 574
567 return snd_hda_multi_out_dig_close(codec, &spec->multiout); 575 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
568} 576}
@@ -582,8 +590,6 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
582 590
583 hdmi_setup_audio_infoframe(codec, substream); 591 hdmi_setup_audio_infoframe(codec, substream);
584 592
585 hdmi_enable_output(codec);
586
587 return 0; 593 return 0;
588} 594}
589 595
@@ -628,8 +634,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec)
628 634
629static int intel_hdmi_init(struct hda_codec *codec) 635static int intel_hdmi_init(struct hda_codec *codec)
630{ 636{
631 /* disable audio output as early as possible */ 637 hdmi_enable_output(codec);
632 hdmi_disable_output(codec);
633 638
634 snd_hda_sequence_write(codec, unsolicited_response_verb); 639 snd_hda_sequence_write(codec, unsolicited_response_verb);
635 640
@@ -679,6 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = {
679 { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, 684 { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi },
680 { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, 685 { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi },
681 { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, 686 { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi },
687 { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi },
682 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, 688 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi },
683 {} /* terminator */ 689 {} /* terminator */
684}; 690};
@@ -687,6 +693,7 @@ MODULE_ALIAS("snd-hda-codec-id:808629fb");
687MODULE_ALIAS("snd-hda-codec-id:80862801"); 693MODULE_ALIAS("snd-hda-codec-id:80862801");
688MODULE_ALIAS("snd-hda-codec-id:80862802"); 694MODULE_ALIAS("snd-hda-codec-id:80862802");
689MODULE_ALIAS("snd-hda-codec-id:80862803"); 695MODULE_ALIAS("snd-hda-codec-id:80862803");
696MODULE_ALIAS("snd-hda-codec-id:80862804");
690MODULE_ALIAS("snd-hda-codec-id:10951392"); 697MODULE_ALIAS("snd-hda-codec-id:10951392");
691 698
692MODULE_LICENSE("GPL"); 699MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ae5c8a0d1479..6c26afcb8262 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7017,6 +7017,7 @@ static int patch_alc882(struct hda_codec *codec)
7017 case 0x106b3e00: /* iMac 24 Aluminium */ 7017 case 0x106b3e00: /* iMac 24 Aluminium */
7018 board_config = ALC885_IMAC24; 7018 board_config = ALC885_IMAC24;
7019 break; 7019 break;
7020 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7020 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 7021 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7021 case 0x106b00a4: /* MacbookPro4,1 */ 7022 case 0x106b00a4: /* MacbookPro4,1 */
7022 case 0x106b2c00: /* Macbook Pro rev3 */ 7023 case 0x106b2c00: /* Macbook Pro rev3 */
@@ -8469,6 +8470,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8469 ALC888_ACER_ASPIRE_4930G), 8470 ALC888_ACER_ASPIRE_4930G),
8470 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", 8471 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8471 ALC888_ACER_ASPIRE_4930G), 8472 ALC888_ACER_ASPIRE_4930G),
8473 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8474 ALC888_ACER_ASPIRE_4930G),
8472 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8475 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8473 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 8476 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8474 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 8477 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8478,6 +8481,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8478 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), 8481 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8479 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), 8482 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8480 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8483 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8484 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8481 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), 8485 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8482 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), 8486 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8483 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 8487 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
@@ -10553,6 +10557,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
10553 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), 10557 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10554 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), 10558 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10555 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), 10559 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10560 SND_PCI_QUIRK(0x103c, 0x170b, "HP xw*", ALC262_HP_BPC),
10556 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), 10561 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10557 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), 10562 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10558 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), 10563 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 38428e22428f..6094344fb223 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1207,7 +1207,7 @@ static const char *slave_vols[] = {
1207 "LFE Playback Volume", 1207 "LFE Playback Volume",
1208 "Side Playback Volume", 1208 "Side Playback Volume",
1209 "Headphone Playback Volume", 1209 "Headphone Playback Volume",
1210 "Headphone Playback Volume", 1210 "Headphone2 Playback Volume",
1211 "Speaker Playback Volume", 1211 "Speaker Playback Volume",
1212 "External Speaker Playback Volume", 1212 "External Speaker Playback Volume",
1213 "Speaker2 Playback Volume", 1213 "Speaker2 Playback Volume",
@@ -1221,7 +1221,7 @@ static const char *slave_sws[] = {
1221 "LFE Playback Switch", 1221 "LFE Playback Switch",
1222 "Side Playback Switch", 1222 "Side Playback Switch",
1223 "Headphone Playback Switch", 1223 "Headphone Playback Switch",
1224 "Headphone Playback Switch", 1224 "Headphone2 Playback Switch",
1225 "Speaker Playback Switch", 1225 "Speaker Playback Switch",
1226 "External Speaker Playback Switch", 1226 "External Speaker Playback Switch",
1227 "Speaker2 Playback Switch", 1227 "Speaker2 Playback Switch",
@@ -1799,7 +1799,7 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1799 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, 1799 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
1800 "HP dv5", STAC_HP_M4), 1800 "HP dv5", STAC_HP_M4),
1801 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, 1801 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
1802 "HP dv7", STAC_HP_M4), 1802 "HP dv7", STAC_HP_DV5),
1803 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, 1803 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7,
1804 "HP dv4", STAC_HP_DV5), 1804 "HP dv4", STAC_HP_DV5),
1805 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, 1805 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
@@ -2442,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2442 stream_tag, format, substream); 2442 stream_tag, format, substream);
2443} 2443}
2444 2444
2445static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2446 struct hda_codec *codec,
2447 struct snd_pcm_substream *substream)
2448{
2449 struct sigmatel_spec *spec = codec->spec;
2450 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2451}
2452
2445 2453
2446/* 2454/*
2447 * Analog capture callbacks 2455 * Analog capture callbacks
@@ -2486,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2486 .ops = { 2494 .ops = {
2487 .open = stac92xx_dig_playback_pcm_open, 2495 .open = stac92xx_dig_playback_pcm_open,
2488 .close = stac92xx_dig_playback_pcm_close, 2496 .close = stac92xx_dig_playback_pcm_close,
2489 .prepare = stac92xx_dig_playback_pcm_prepare 2497 .prepare = stac92xx_dig_playback_pcm_prepare,
2498 .cleanup = stac92xx_dig_playback_pcm_cleanup
2490 }, 2499 },
2491}; 2500};
2492 2501
@@ -3507,6 +3516,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3507 if (! spec->autocfg.line_outs) 3516 if (! spec->autocfg.line_outs)
3508 return 0; /* can't find valid pin config */ 3517 return 0; /* can't find valid pin config */
3509 3518
3519#if 0 /* FIXME: temporarily disabled */
3510 /* If we have no real line-out pin and multiple hp-outs, HPs should 3520 /* If we have no real line-out pin and multiple hp-outs, HPs should
3511 * be set up as multi-channel outputs. 3521 * be set up as multi-channel outputs.
3512 */ 3522 */
@@ -3526,6 +3536,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3526 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; 3536 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3527 spec->autocfg.hp_outs = 0; 3537 spec->autocfg.hp_outs = 0;
3528 } 3538 }
3539#endif /* FIXME: temporarily disabled */
3529 if (spec->autocfg.mono_out_pin) { 3540 if (spec->autocfg.mono_out_pin) {
3530 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & 3541 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3531 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); 3542 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
@@ -4980,7 +4991,7 @@ again:
4980 case STAC_DELL_M4_3: 4991 case STAC_DELL_M4_3:
4981 spec->num_dmics = 1; 4992 spec->num_dmics = 1;
4982 spec->num_smuxes = 0; 4993 spec->num_smuxes = 0;
4983 spec->num_dmuxes = 0; 4994 spec->num_dmuxes = 1;
4984 break; 4995 break;
4985 default: 4996 default:
4986 spec->num_dmics = STAC92HD71BXX_NUM_DMICS; 4997 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 18c7c91786bc..6c870c12a177 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) and EEPROM self-destruct (do not use!) 29 * SPI 4 -> 4th PCM1796 (back)
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,12 +207,6 @@ 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
216 /* maps ALSA channel pair number to SPI output */ 210 /* maps ALSA channel pair number to SPI output */
217 static const u8 codec_map[4] = { 211 static const u8 codec_map[4] = {
218 0, 1, 2, 4 212 0, 1, 2, 4
@@ -223,7 +217,6 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
223 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | 217 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
224 OXYGEN_SPI_CEN_LATCH_CLOCK_HI, 218 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
225 (reg << 8) | value); 219 (reg << 8) | value);
226#endif
227} 220}
228 221
229static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, 222static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
@@ -757,9 +750,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
757 750
758static int xonar_d2_control_filter(struct snd_kcontrol_new *template) 751static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
759{ 752{
760 if (!strncmp(template->name, "Master Playback ", 16))
761 /* disable volume/mute because they would require SPI writes */
762 return 1;
763 if (!strncmp(template->name, "CD Capture ", 11)) 753 if (!strncmp(template->name, "CD Capture ", 11))
764 /* CD in is actually connected to the video in pin */ 754 /* CD in is actually connected to the video in pin */
765 template->private_value ^= AC97_CD ^ AC97_VIDEO; 755 template->private_value ^= AC97_CD ^ AC97_VIDEO;
@@ -850,8 +840,9 @@ static const struct oxygen_model model_xonar_d2 = {
850 .dac_volume_min = 0x0f, 840 .dac_volume_min = 0x0f,
851 .dac_volume_max = 0xff, 841 .dac_volume_max = 0xff,
852 .misc_flags = OXYGEN_MISC_MIDI, 842 .misc_flags = OXYGEN_MISC_MIDI,
853 .function_flags = OXYGEN_FUNCTION_SPI, 843 .function_flags = OXYGEN_FUNCTION_SPI |
854 .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S, 844 OXYGEN_FUNCTION_ENABLE_SPI_4_5,
845 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
855 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 846 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
856}; 847};
857 848
diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h
index 84131a916c92..69d87dee6995 100644
--- a/sound/pci/pcxhr/pcxhr.h
+++ b/sound/pci/pcxhr/pcxhr.h
@@ -97,12 +97,12 @@ struct pcxhr_mgr {
97 int capture_chips; 97 int capture_chips;
98 int fw_file_set; 98 int fw_file_set;
99 int firmware_num; 99 int firmware_num;
100 int is_hr_stereo:1; 100 unsigned int is_hr_stereo:1;
101 int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ 101 unsigned int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */
102 int board_has_analog:1; /* if 0 the board is digital only */ 102 unsigned int board_has_analog:1; /* if 0 the board is digital only */
103 int board_has_mic:1; /* if 1 the board has microphone input */ 103 unsigned int board_has_mic:1; /* if 1 the board has microphone input */
104 int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ 104 unsigned int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */
105 int mono_capture:1; /* if 1 the board does mono capture */ 105 unsigned int mono_capture:1; /* if 1 the board does mono capture */
106 106
107 struct snd_dma_buffer hostport; 107 struct snd_dma_buffer hostport;
108 108
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index b47a749c5ea2..aea0cb72d80a 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -165,10 +165,13 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
165 struct snd_ctl_elem_value *ucontrol) 165 struct snd_ctl_elem_value *ucontrol)
166{ 166{
167 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 167 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
168 int reg = kcontrol->private_value & 0xff; 168 struct soc_mixer_control *mc =
169 int shift = (kcontrol->private_value >> 8) & 0x0f; 169 (struct soc_mixer_control *)kcontrol->private_value;
170 int mask = (kcontrol->private_value >> 16) & 0xff; 170 unsigned int reg = mc->reg;
171 int invert = (kcontrol->private_value >> 24) & 0x01; 171 unsigned int shift = mc->shift;
172 int max = mc->max;
173 unsigned int mask = (1 << fls(max)) - 1;
174 unsigned int invert = mc->invert;
172 unsigned short val, val_mask; 175 unsigned short val, val_mask;
173 int ret; 176 int ret;
174 struct snd_soc_dapm_path *path; 177 struct snd_soc_dapm_path *path;
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 1cbb7b9b51ce..a5731faa150c 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -176,7 +176,9 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
176 struct snd_ctl_elem_value *ucontrol) 176 struct snd_ctl_elem_value *ucontrol)
177{ 177{
178 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 178 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
179 int reg = kcontrol->private_value & 0xff; 179 struct soc_mixer_control *mc =
180 (struct soc_mixer_control *)kcontrol->private_value;
181 int reg = mc->reg;
180 int ret; 182 int ret;
181 u16 val; 183 u16 val;
182 184
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index ad97836818b1..e226fa75669c 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -91,7 +91,7 @@ static struct snd_soc_dai_link sdp3430_dai = {
91}; 91};
92 92
93/* Audio machine driver */ 93/* Audio machine driver */
94static struct snd_soc_machine snd_soc_machine_sdp3430 = { 94static struct snd_soc_card snd_soc_sdp3430 = {
95 .name = "SDP3430", 95 .name = "SDP3430",
96 .platform = &omap_soc_platform, 96 .platform = &omap_soc_platform,
97 .dai_link = &sdp3430_dai, 97 .dai_link = &sdp3430_dai,
@@ -100,7 +100,7 @@ static struct snd_soc_machine snd_soc_machine_sdp3430 = {
100 100
101/* Audio subsystem */ 101/* Audio subsystem */
102static struct snd_soc_device sdp3430_snd_devdata = { 102static struct snd_soc_device sdp3430_snd_devdata = {
103 .machine = &snd_soc_machine_sdp3430, 103 .card = &snd_soc_sdp3430,
104 .codec_dev = &soc_codec_dev_twl4030, 104 .codec_dev = &soc_codec_dev_twl4030,
105}; 105};
106 106
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 55fdb4abb179..ec3f8bb4b51d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1385,7 +1385,10 @@ int snd_soc_init_card(struct snd_soc_device *socdev)
1385 1385
1386 mutex_lock(&codec->mutex); 1386 mutex_lock(&codec->mutex);
1387#ifdef CONFIG_SND_SOC_AC97_BUS 1387#ifdef CONFIG_SND_SOC_AC97_BUS
1388 if (ac97) { 1388 /* Only instantiate AC97 if not already done by the adaptor
1389 * for the generic AC97 subsystem.
1390 */
1391 if (ac97 && strcmp(codec->name, "AC97") != 0) {
1389 ret = soc_ac97_dev_register(codec); 1392 ret = soc_ac97_dev_register(codec);
1390 if (ret < 0) { 1393 if (ret < 0) {
1391 printk(KERN_ERR "asoc: AC97 device register failed\n"); 1394 printk(KERN_ERR "asoc: AC97 device register failed\n");
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 2ab83129d9b0..19e37451c216 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
2524 * build the rate table and bitmap flags 2524 * build the rate table and bitmap flags
2525 */ 2525 */
2526 int r, idx; 2526 int r, idx;
2527 unsigned int nonzero_rates = 0;
2528 2527
2529 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); 2528 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
2530 if (fp->rate_table == NULL) { 2529 if (fp->rate_table == NULL) {
@@ -2532,24 +2531,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
2532 return -1; 2531 return -1;
2533 } 2532 }
2534 2533
2535 fp->nr_rates = nr_rates; 2534 fp->nr_rates = 0;
2536 fp->rate_min = fp->rate_max = combine_triple(&fmt[8]); 2535 fp->rate_min = fp->rate_max = 0;
2537 for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { 2536 for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
2538 unsigned int rate = combine_triple(&fmt[idx]); 2537 unsigned int rate = combine_triple(&fmt[idx]);
2538 if (!rate)
2539 continue;
2539 /* C-Media CM6501 mislabels its 96 kHz altsetting */ 2540 /* C-Media CM6501 mislabels its 96 kHz altsetting */
2540 if (rate == 48000 && nr_rates == 1 && 2541 if (rate == 48000 && nr_rates == 1 &&
2541 chip->usb_id == USB_ID(0x0d8c, 0x0201) && 2542 (chip->usb_id == USB_ID(0x0d8c, 0x0201) ||
2543 chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
2542 fp->altsetting == 5 && fp->maxpacksize == 392) 2544 fp->altsetting == 5 && fp->maxpacksize == 392)
2543 rate = 96000; 2545 rate = 96000;
2544 fp->rate_table[r] = rate; 2546 fp->rate_table[fp->nr_rates] = rate;
2545 nonzero_rates |= rate; 2547 if (!fp->rate_min || rate < fp->rate_min)
2546 if (rate < fp->rate_min)
2547 fp->rate_min = rate; 2548 fp->rate_min = rate;
2548 else if (rate > fp->rate_max) 2549 if (!fp->rate_max || rate > fp->rate_max)
2549 fp->rate_max = rate; 2550 fp->rate_max = rate;
2550 fp->rates |= snd_pcm_rate_to_rate_bit(rate); 2551 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
2552 fp->nr_rates++;
2551 } 2553 }
2552 if (!nonzero_rates) { 2554 if (!fp->nr_rates) {
2553 hwc_debug("All rates were zero. Skipping format!\n"); 2555 hwc_debug("All rates were zero. Skipping format!\n");
2554 return -1; 2556 return -1;
2555 } 2557 }
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 320641ab5be7..26bad373fe65 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
1625 } 1625 }
1626 1626
1627 ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1627 ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
1628 ep_info.out_interval = 0;
1628 ep_info.out_cables = endpoint->out_cables & 0x5555; 1629 ep_info.out_cables = endpoint->out_cables & 0x5555;
1629 err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); 1630 err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
1630 if (err < 0) 1631 if (err < 0)
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index e9693a29d00e..4c4037503600 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -73,14 +73,13 @@ static int kvm_iommu_map_memslots(struct kvm *kvm)
73{ 73{
74 int i, r = 0; 74 int i, r = 0;
75 75
76 down_read(&kvm->slots_lock);
77 for (i = 0; i < kvm->nmemslots; i++) { 76 for (i = 0; i < kvm->nmemslots; i++) {
78 r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, 77 r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn,
79 kvm->memslots[i].npages); 78 kvm->memslots[i].npages);
80 if (r) 79 if (r)
81 break; 80 break;
82 } 81 }
83 up_read(&kvm->slots_lock); 82
84 return r; 83 return r;
85} 84}
86 85
@@ -190,12 +189,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
190static int kvm_iommu_unmap_memslots(struct kvm *kvm) 189static int kvm_iommu_unmap_memslots(struct kvm *kvm)
191{ 190{
192 int i; 191 int i;
193 down_read(&kvm->slots_lock); 192
194 for (i = 0; i < kvm->nmemslots; i++) { 193 for (i = 0; i < kvm->nmemslots; i++) {
195 kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, 194 kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn,
196 kvm->memslots[i].npages); 195 kvm->memslots[i].npages);
197 } 196 }
198 up_read(&kvm->slots_lock);
199 197
200 return 0; 198 return 0;
201} 199}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3a5a08298aab..29a667ce35b0 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -173,7 +173,6 @@ static void kvm_assigned_dev_interrupt_work_handler(struct work_struct *work)
173 assigned_dev->host_irq_disabled = false; 173 assigned_dev->host_irq_disabled = false;
174 } 174 }
175 mutex_unlock(&assigned_dev->kvm->lock); 175 mutex_unlock(&assigned_dev->kvm->lock);
176 kvm_put_kvm(assigned_dev->kvm);
177} 176}
178 177
179static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) 178static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)
@@ -181,8 +180,6 @@ static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)
181 struct kvm_assigned_dev_kernel *assigned_dev = 180 struct kvm_assigned_dev_kernel *assigned_dev =
182 (struct kvm_assigned_dev_kernel *) dev_id; 181 (struct kvm_assigned_dev_kernel *) dev_id;
183 182
184 kvm_get_kvm(assigned_dev->kvm);
185
186 schedule_work(&assigned_dev->interrupt_work); 183 schedule_work(&assigned_dev->interrupt_work);
187 184
188 disable_irq_nosync(irq); 185 disable_irq_nosync(irq);
@@ -213,6 +210,7 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian)
213 } 210 }
214} 211}
215 212
213/* The function implicit hold kvm->lock mutex due to cancel_work_sync() */
216static void kvm_free_assigned_irq(struct kvm *kvm, 214static void kvm_free_assigned_irq(struct kvm *kvm,
217 struct kvm_assigned_dev_kernel *assigned_dev) 215 struct kvm_assigned_dev_kernel *assigned_dev)
218{ 216{
@@ -228,11 +226,24 @@ static void kvm_free_assigned_irq(struct kvm *kvm,
228 if (!assigned_dev->irq_requested_type) 226 if (!assigned_dev->irq_requested_type)
229 return; 227 return;
230 228
231 if (cancel_work_sync(&assigned_dev->interrupt_work)) 229 /*
232 /* We had pending work. That means we will have to take 230 * In kvm_free_device_irq, cancel_work_sync return true if:
233 * care of kvm_put_kvm. 231 * 1. work is scheduled, and then cancelled.
234 */ 232 * 2. work callback is executed.
235 kvm_put_kvm(kvm); 233 *
234 * The first one ensured that the irq is disabled and no more events
235 * would happen. But for the second one, the irq may be enabled (e.g.
236 * for MSI). So we disable irq here to prevent further events.
237 *
238 * Notice this maybe result in nested disable if the interrupt type is
239 * INTx, but it's OK for we are going to free it.
240 *
241 * If this function is a part of VM destroy, please ensure that till
242 * now, the kvm state is still legal for probably we also have to wait
243 * interrupt_work done.
244 */
245 disable_irq_nosync(assigned_dev->host_irq);
246 cancel_work_sync(&assigned_dev->interrupt_work);
236 247
237 free_irq(assigned_dev->host_irq, (void *)assigned_dev); 248 free_irq(assigned_dev->host_irq, (void *)assigned_dev);
238 249
@@ -285,8 +296,8 @@ static int assigned_device_update_intx(struct kvm *kvm,
285 296
286 if (irqchip_in_kernel(kvm)) { 297 if (irqchip_in_kernel(kvm)) {
287 if (!msi2intx && 298 if (!msi2intx &&
288 adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI) { 299 (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) {
289 free_irq(adev->host_irq, (void *)kvm); 300 free_irq(adev->host_irq, (void *)adev);
290 pci_disable_msi(adev->dev); 301 pci_disable_msi(adev->dev);
291 } 302 }
292 303
@@ -455,6 +466,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
455 struct kvm_assigned_dev_kernel *match; 466 struct kvm_assigned_dev_kernel *match;
456 struct pci_dev *dev; 467 struct pci_dev *dev;
457 468
469 down_read(&kvm->slots_lock);
458 mutex_lock(&kvm->lock); 470 mutex_lock(&kvm->lock);
459 471
460 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, 472 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
@@ -516,6 +528,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
516 528
517out: 529out:
518 mutex_unlock(&kvm->lock); 530 mutex_unlock(&kvm->lock);
531 up_read(&kvm->slots_lock);
519 return r; 532 return r;
520out_list_del: 533out_list_del:
521 list_del(&match->list); 534 list_del(&match->list);
@@ -527,6 +540,7 @@ out_put:
527out_free: 540out_free:
528 kfree(match); 541 kfree(match);
529 mutex_unlock(&kvm->lock); 542 mutex_unlock(&kvm->lock);
543 up_read(&kvm->slots_lock);
530 return r; 544 return r;
531} 545}
532#endif 546#endif
@@ -789,11 +803,19 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
789 return young; 803 return young;
790} 804}
791 805
806static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
807 struct mm_struct *mm)
808{
809 struct kvm *kvm = mmu_notifier_to_kvm(mn);
810 kvm_arch_flush_shadow(kvm);
811}
812
792static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { 813static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
793 .invalidate_page = kvm_mmu_notifier_invalidate_page, 814 .invalidate_page = kvm_mmu_notifier_invalidate_page,
794 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, 815 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,
795 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, 816 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end,
796 .clear_flush_young = kvm_mmu_notifier_clear_flush_young, 817 .clear_flush_young = kvm_mmu_notifier_clear_flush_young,
818 .release = kvm_mmu_notifier_release,
797}; 819};
798#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ 820#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */
799 821
@@ -883,6 +905,7 @@ static void kvm_destroy_vm(struct kvm *kvm)
883{ 905{
884 struct mm_struct *mm = kvm->mm; 906 struct mm_struct *mm = kvm->mm;
885 907
908 kvm_arch_sync_events(kvm);
886 spin_lock(&kvm_lock); 909 spin_lock(&kvm_lock);
887 list_del(&kvm->vm_list); 910 list_del(&kvm->vm_list);
888 spin_unlock(&kvm_lock); 911 spin_unlock(&kvm_lock);